content
stringlengths
23
1.05M
package body AdaM.Assist.Query.find_Entities.Metrics is procedure dummy is begin null; end dummy; end AdaM.Assist.Query.find_Entities.Metrics;
package HAL.GPIO with SPARK_Mode => Off is type GPIO_Point is limited interface; type GPIO_Point_Ref is not null access all GPIO_Point'Class; function Set (Point : GPIO_Point) return Boolean is abstract; procedure Set (Point : in GPIO_Point) is abstract; procedure Clear (Point : in out GPIO_Point) is abstract; procedure Toggle (Point : in out GPIO_Point) is abstract; end HAL.GPIO;
with Ada.Text_IO; use Ada.Text_IO; procedure Array_Loop_Test is type Array_Index is range 1..3; A1 : array (Array_Index) of Character := "abc"; A2 : array (Array_Index) of Character := "ABC"; A3 : array (Array_Index) of Integer := (1, 2, 3); begin for Index in Array_Index'Range loop Put_Line (A1 (Index) & A2 (Index) & Integer'Image (A3 (Index))(2)); end loop; end Array_Loop_Test;
with Matriz; use Matriz; with rotar_derecha; procedure matriz_toeplitz (V : in out Vector_De_Enteros; M : out Matriz_De_Enteros) is Fila : Integer; begin Fila := V'First; for I in V'First .. V'Last loop -- Filas del matriz if Fila > V'First then -- En la primera fila no se tiene que rotar el vector rotar_derecha(V); end if; for J in V'First .. V'Last loop M(I, J) := V(J); end loop; Fila := Fila + 1; end loop; end matriz_toeplitz;
--------------------------------------------------------------------------------- -- Copyright 2004-2005 © Luke A. Guest -- -- This code is to be used for tutorial purposes only. -- You may not redistribute this code in any form without my express permission. --------------------------------------------------------------------------------- with Matrix3x3; with Vector3; use type Matrix3x3.Object; package OBB is type Object is record Min, Max : Vector3.Object; end record; function Create return Object; procedure Empty(Self : in out Object); procedure Add(Self : in out Object; Vertex : in Vector3.Object); procedure Render(Self : in Object); end OBB;
with openGL.Server, Lumen.Window, ada.Text_IO; procedure launch_core_Test -- -- Exercise basic subprograms common to all GL profiles. -- -- TODO: Complete this. -- is use ada.Text_IO; Win : Lumen.Window.Window_Handle; begin -- Create Lumen window to provide a current GL context. -- lumen.Window.create (Win, Name => "GL Core Test", Animated => False); put_Line ("openGL Server: " & openGL.Server.Version); delay 5.0; end launch_core_Test;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . R E D _ B L A C K _ T R E E S . -- -- G E N E R I C _ K E Y S -- -- -- -- S p e c -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers.Red_Black_Trees.Generic_Operations; generic with package Tree_Operations is new Generic_Operations (<>); use Tree_Operations.Tree_Types; type Key_Type (<>) is limited private; with function Is_Less_Key_Node (L : Key_Type; R : Node_Access) return Boolean; with function Is_Greater_Key_Node (L : Key_Type; R : Node_Access) return Boolean; package Ada.Containers.Red_Black_Trees.Generic_Keys is pragma Pure; generic with function New_Node return Node_Access; procedure Generic_Insert_Post (Tree : in out Tree_Type; X, Y : Node_Access; Key : Key_Type; Z : out Node_Access); generic with procedure Insert_Post (Tree : in out Tree_Type; X, Y : Node_Access; Key : Key_Type; Z : out Node_Access); procedure Generic_Conditional_Insert (Tree : in out Tree_Type; Key : Key_Type; Node : out Node_Access; Success : out Boolean); generic with procedure Insert_Post (Tree : in out Tree_Type; X, Y : Node_Access; Key : Key_Type; Z : out Node_Access); procedure Generic_Unconditional_Insert (Tree : in out Tree_Type; Key : Key_Type; Node : out Node_Access); generic with procedure Insert_Post (Tree : in out Tree_Type; X, Y : Node_Access; Key : Key_Type; Z : out Node_Access); with procedure Unconditional_Insert_Sans_Hint (Tree : in out Tree_Type; Key : Key_Type; Node : out Node_Access); procedure Generic_Unconditional_Insert_With_Hint (Tree : in out Tree_Type; Hint : Node_Access; Key : Key_Type; Node : out Node_Access); generic with procedure Insert_Post (Tree : in out Tree_Type; X, Y : Node_Access; Key : Key_Type; Z : out Node_Access); with procedure Conditional_Insert_Sans_Hint (Tree : in out Tree_Type; Key : Key_Type; Node : out Node_Access; Success : out Boolean); procedure Generic_Conditional_Insert_With_Hint (Tree : in out Tree_Type; Position : Node_Access; Key : Key_Type; Node : out Node_Access; Success : out Boolean); function Find (Tree : Tree_Type; Key : Key_Type) return Node_Access; function Ceiling (Tree : Tree_Type; Key : Key_Type) return Node_Access; function Floor (Tree : Tree_Type; Key : Key_Type) return Node_Access; function Upper_Bound (Tree : Tree_Type; Key : Key_Type) return Node_Access; generic with procedure Process (Node : Node_Access); procedure Generic_Iteration (Tree : Tree_Type; Key : Key_Type); generic with procedure Process (Node : Node_Access); procedure Generic_Reverse_Iteration (Tree : Tree_Type; Key : Key_Type); end Ada.Containers.Red_Black_Trees.Generic_Keys;
-- Copyright 2017 Steven Stewart-Gallus -- -- 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 Linted.Atomics; with Linted.ABAs; with Linted.Sched; package body Linted.Lock_Free_Stack with Refined_State => (State => (Buf_Contents, Buf_Nodes, Buf_Head, Buf_Free, Head_Contention, Free_Contention)) is type My_Ix is new Ix with Default_Value => 0; package ABA is new ABAs (My_Ix); package Aba_Atomics is new Atomics (ABA.ABA); package Access_Atomics is new Atomics (My_Ix); use type ABA.Tag_T; type Element_Array is array (My_Ix range 1 .. My_Ix (Ix'Last)) of Element_T with Independent_Components; Buf_Contents : Element_Array; type Node_Array is array (My_Ix range 1 .. My_Ix (Ix'Last)) of Access_Atomics.Atomic with Independent_Components; Buf_Nodes : Node_Array; Buf_Head : Aba_Atomics.Atomic; Head_Contention : Sched.Contention; Buf_Free : Aba_Atomics.Atomic; Free_Contention : Sched.Contention; procedure Allocate (Free : out My_Ix) with Global => (In_Out => (Buf_Nodes, Buf_Free, Free_Contention)), Depends => (Free => (Buf_Free, Buf_Nodes), Buf_Nodes => (Buf_Nodes, Buf_Free), Free_Contention => (Buf_Free, Buf_Nodes, Free_Contention), Buf_Free => (Buf_Nodes, Buf_Free)); procedure Deallocate (Head : My_Ix) with Pre => Head /= 0, Global => (In_Out => (Buf_Nodes, Buf_Free, Free_Contention)), Depends => (Buf_Nodes => (Buf_Nodes, Buf_Free, Head), Free_Contention => (Buf_Free, Head, Free_Contention), Buf_Free => (Buf_Free, Head)); procedure Push_Node (N : in out Aba_Atomics.Atomic; Contention : in out Sched.Contention; Free : My_Ix) with Pre => Free /= 0, Global => (In_Out => Buf_Nodes), Depends => (N => (Free, N), Contention => (Free, N, Contention), Buf_Nodes => (Free, Buf_Nodes, N)); procedure Pop_Node (N : in out Aba_Atomics.Atomic; Contention : in out Sched.Contention; Head : out My_Ix) with Global => (In_Out => Buf_Nodes), Depends => (Head => (Buf_Nodes, N), Contention => (N, Buf_Nodes, Contention), N => (Buf_Nodes, N), Buf_Nodes => (N, Buf_Nodes)); procedure Allocate (Free : out My_Ix) is begin Pop_Node (Buf_Free, Free_Contention, Free); end Allocate; procedure Deallocate (Head : My_Ix) is begin Push_Node (Buf_Free, Free_Contention, Head); end Deallocate; procedure Try_Push (Element : Element_T; Success : out Boolean) with Refined_Global => (In_Out => (Buf_Contents, Buf_Nodes, Buf_Head, Buf_Free, Head_Contention, Free_Contention)) is Free : My_Ix; begin Allocate (Free); if 0 = Free then Success := False; else Buf_Contents (Free) := Element; Push_Node (Buf_Head, Head_Contention, Free); Success := True; end if; end Try_Push; procedure Push_Node (N : in out Aba_Atomics.Atomic; Contention : in out Sched.Contention; Free : My_Ix) is Head : ABA.ABA; Swapped : Boolean; begin loop Aba_Atomics.Get (N, Head); Access_Atomics.Set (Buf_Nodes (Free), ABA.Element (Head)); Aba_Atomics.Compare_And_Swap (N, Head, ABA.Initialize (Free, ABA.Tag (Head) + 1), Swapped); exit when Swapped; Sched.Backoff (Contention); end loop; Sched.Success (Contention); end Push_Node; procedure Try_Pop (Element : out Element_T; Success : out Boolean) with Refined_Global => (In_Out => (Buf_Contents, Buf_Nodes, Buf_Head, Buf_Free, Head_Contention, Free_Contention)) is Head : My_Ix; begin Pop_Node (Buf_Head, Head_Contention, Head); if 0 = Head then declare Dummy : Element_T; begin Element := Dummy; end; Success := False; else Element := Buf_Contents (Head); declare Dummy : Element_T; begin Buf_Contents (Head) := Dummy; end; Deallocate (Head); Success := True; end if; end Try_Pop; procedure Pop_Node (N : in out Aba_Atomics.Atomic; Contention : in out Sched.Contention; Head : out My_Ix) is New_Head : My_Ix; Swapped : Boolean; ABA_Head : ABA.ABA; begin loop Aba_Atomics.Get (N, ABA_Head); if ABA.Element (ABA_Head) = 0 then exit; end if; Access_Atomics.Get (Buf_Nodes (ABA.Element (ABA_Head)), New_Head); Aba_Atomics.Compare_And_Swap (N, ABA_Head, ABA.Initialize (New_Head, ABA.Tag (ABA_Head) + 1), Swapped); exit when Swapped; Sched.Backoff (Contention); end loop; Sched.Success (Contention); Head := ABA.Element (ABA_Head); end Pop_Node; begin declare Old_Node : My_Ix := 0; begin for II in 1 .. My_Ix (Ix'Last) loop Buf_Nodes (II).Set (Old_Node); Old_Node := II; end loop; Buf_Free.Set (ABA.Initialize (Old_Node, 0)); end; end Linted.Lock_Free_Stack;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A U N I T . T E S T _ C A L L E R -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2008-2011, 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/>. -- -- -- -- GNAT is maintained by AdaCore (http://www.adacore.com) -- -- -- ------------------------------------------------------------------------------ -- <description> -- A Test caller provides access to a test case type based on a test fixture. -- Test callers are useful when you want to run individual test or add it to -- a suite. -- Test callers invoke only one Test (i.e. test method) on one Fixture of a -- AUnit.Test_Fixtures.Test_Fixture. -- -- Here is an example: -- -- <code> -- package Math_Test is -- Type Test is new AUnit.Test_Fixtures.Test_Fixture with record -- M_Value1 : Integer; -- M_Value2 : Integer; -- end record; -- -- procedure Set_Up (T : in out Test); -- -- procedure Test_Addition (T : in out Test); -- procedure Test_Subtraction (T : in out Test); -- -- end Math_Test; -- -- function Suite return AUnit.Test_Suites.Test_Suite_Access is -- package Caller is new AUnit.Test_Caller (Math_Test.Test); -- The_Suite : AUnit.Test_Suites.Test_Suite_Access := -- new AUnit.Test_Suites.Test_Suite; -- begin -- The_Suite.Add_Test -- (Caller.Create ("Test Addition on integers", -- Math_Test.Test_Addition'Access)); -- The_Suite.Add_Test -- (Caller.Create ("Test Subtraction on integers", -- Math_Test.Test_Subtraction'Access)); -- return The_Suite; -- end Suite; -- </code> -- </description> with AUnit.Simple_Test_Cases; with AUnit.Test_Fixtures; generic type Test_Fixture is new AUnit.Test_Fixtures.Test_Fixture with private; package AUnit.Test_Caller is type Test_Case is new AUnit.Simple_Test_Cases.Test_Case with private; type Test_Case_Access is access all Test_Case'Class; type Test_Method is access procedure (Test : in out Test_Fixture); function Create (Name : String; Test : Test_Method) return Test_Case_Access; -- Return a test case from a test fixture method, reporting the result -- of the test using the Name parameter. procedure Create (TC : out Test_Case'Class; Name : String; Test : Test_Method); -- Initialize a test case from a test fixture method, reporting the result -- of the test using the Name parameter. function Name (Test : Test_Case) return Message_String; -- Test case name procedure Run_Test (Test : in out Test_Case); -- Perform the test. procedure Set_Up (Test : in out Test_Case); -- Set up performed before each test case procedure Tear_Down (Test : in out Test_Case); -- Tear down performed after each test case private type Fixture_Access is access all Test_Fixture; pragma No_Strict_Aliasing (Fixture_Access); type Test_Case is new AUnit.Simple_Test_Cases.Test_Case with record Fixture : Fixture_Access; Name : Message_String; Method : Test_Method; end record; end AUnit.Test_Caller;
----------------------------------------------------------------------- -- babel-files-maps -- Hash maps for files and directories -- 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. ----------------------------------------------------------------------- package body Babel.Files.Maps is -- ------------------------------ -- Find the file with the given name in the file map. -- ------------------------------ function Find (From : in File_Map; Name : in String) return File_Cursor is begin return From.Find (Key => Name'Unrestricted_Access); end Find; -- ------------------------------ -- Find the file with the given name in the file map. -- ------------------------------ function Find (From : in File_Map; Name : in String) return File_Type is Pos : constant File_Cursor := From.Find (Key => Name'Unrestricted_Access); begin if File_Maps.Has_Element (Pos) then return File_Maps.Element (Pos); else return NO_FILE; end if; end Find; -- ------------------------------ -- Insert the file in the file map. -- ------------------------------ procedure Insert (Into : in out File_Map; File : in File_Type) is begin Into.Insert (Key => File.Name'Unrestricted_Access, New_Item => File); end Insert; -- ------------------------------ -- Find the directory with the given name in the directory map. -- ------------------------------ function Find (From : in Directory_Map; Name : in String) return Directory_Cursor is begin return From.Find (Key => Name'Unrestricted_Access); end Find; -- ------------------------------ -- Find the directory with the given name in the directory map. -- ------------------------------ function Find (From : in Directory_Map; Name : in String) return Directory_Type is Pos : constant Directory_Cursor := From.Find (Key => Name'Unrestricted_Access); begin if Directory_Maps.Has_Element (Pos) then return Directory_Maps.Element (Pos); else return NO_DIRECTORY; end if; end Find; procedure Add_File (Dirs : in out Directory_Map; Files : in out File_Map; Path : in String; File : out File_Type) is Pos : constant Natural := Util.Strings.Rindex (Path, '/'); File_Pos : File_Cursor; Dir : Directory_Type := NO_DIRECTORY; begin if Pos = 0 then File := Find (Files, Path); Dir := Find (Dirs, "."); else File := Find (Files, Path (Pos + 1 .. Path'Last)); Dir := Find (Dirs, Path (Path'First .. Pos - 1)); end if; if Dir = NO_DIRECTORY then if Pos = 0 then Dir := Allocate (".", NO_DIRECTORY); else Dir := Allocate (Path (Path'First .. Pos - 1), NO_DIRECTORY); end if; Dirs.Insert (Dir.Name.all'Access, Dir); end if; if File = NO_FILE then if Pos = 0 then File := Allocate (Path, Dir); else File := Allocate (Path (Pos + 1 .. Path'Last), Dir); end if; Files.Insert (File.Name'Unrestricted_Access, File); end if; end Add_File; -- ------------------------------ -- Add the file with the given name in the container. -- ------------------------------ overriding procedure Add_File (Into : in out Differential_Container; Element : in File_Type) is use type ADO.Identifier; begin if Element.Id = ADO.NO_IDENTIFIER then Into.Known_Files.Insert (Element.Name'Unrestricted_Access, Element); end if; end Add_File; -- ------------------------------ -- Add the directory with the given name in the container. -- ------------------------------ overriding procedure Add_Directory (Into : in out Differential_Container; Element : in Directory_Type) is use type ADO.Identifier; begin if Element.Id = ADO.NO_IDENTIFIER then Into.Known_Dirs.Insert (Element.Name.all'Access, Element); end if; end Add_Directory; -- ------------------------------ -- Create a new file instance with the given name in the container. -- ------------------------------ overriding function Create (Into : in Differential_Container; Name : in String) return File_Type is begin return Allocate (Name => Name, Dir => Into.Current); end Create; -- ------------------------------ -- Create a new directory instance with the given name in the container. -- ------------------------------ overriding function Create (Into : in Differential_Container; Name : in String) return Directory_Type is begin return Allocate (Name => Name, Dir => Into.Current); end Create; -- ------------------------------ -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. -- ------------------------------ overriding function Find (From : in Differential_Container; Name : in String) return File_Type is begin return Find (From.Known_Files, Name); end Find; -- ------------------------------ -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. -- ------------------------------ overriding function Find (From : in Differential_Container; Name : in String) return Directory_Type is begin return Find (From.Known_Dirs, Name); end Find; -- ------------------------------ -- Set the directory object associated with the container. -- ------------------------------ overriding procedure Set_Directory (Into : in out Differential_Container; Directory : in Directory_Type) is begin Default_Container (Into).Set_Directory (Directory); Into.Known_Files.Clear; Into.Known_Dirs.Clear; end Set_Directory; -- ------------------------------ -- Prepare the differential container by setting up the known files and known -- directories. The <tt>Update</tt> procedure is called to give access to the -- maps that can be updated. -- ------------------------------ procedure Prepare (Container : in out Differential_Container; Update : access procedure (Files : in out File_Map; Dirs : in out Directory_Map)) is begin Update (Container.Known_Files, Container.Known_Dirs); end Prepare; end Babel.Files.Maps;
package Support.RegEx is -- re_intg : String := "([-+]?[0-9]+)"; -- re_real : String := "([-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?)"; -- note counts as 2 groups (1.234(e+56)) -- re_text : String := "([a-zA-Z0-9 .-]+)"; -- re_space : String := "( |\t)+"; -- re_email : String := "([a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,})"; -- note: if the_line = "foo bah moo cow" and the_regex = "moo" then -- result = grep (the_line,the_regex,1) will return result = "moo" -- *but* the range of result will be based on where the target was found -- thus result'first = 9 and result'last = 11 -- find a sub-string within a string function grep (the_line : String; the_regex : String; the_group : Integer; the_match : Integer := 1; fail : String := "<no match>") return String; -- find an integer within a string function grep (the_line : String; the_regex : String; the_group : Integer; the_match : Integer := 1; fail : Integer := -333) return Integer; -- find a real number within a string function grep (the_line : String; the_regex : String; the_group : Integer; the_match : Integer := 1; fail : Real := -333.3e33) return Real; function grep (the_line : String; the_regex : String; the_group : Integer := 1; the_match : Integer := 1) return Boolean; function regex_match (the_line : String; the_regex : String) return Boolean; procedure grep (the_match : out String; found : out Boolean; the_line : String; the_regex : String; the_group : Integer); procedure grep (the_beg : out Integer; the_end : out Integer; found : out Boolean; the_line : String; the_regex : String; the_group : Integer := 0); end Support.RegEx;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ U N S T -- -- -- -- B o d y -- -- -- -- Copyright (C) 2014-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. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Debug; use Debug; with Einfo; use Einfo; with Elists; use Elists; with Exp_Util; use Exp_Util; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; with Output; use Output; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch8; use Sem_Ch8; with Sem_Mech; use Sem_Mech; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stand; use Stand; with Tbuild; use Tbuild; with Uintp; use Uintp; package body Exp_Unst is ----------------------- -- Local Subprograms -- ----------------------- procedure Unnest_Subprogram (Subp : Entity_Id; Subp_Body : Node_Id; For_Inline : Boolean := False); -- Subp is a library-level subprogram which has nested subprograms, and -- Subp_Body is the corresponding N_Subprogram_Body node. This procedure -- declares the AREC types and objects, adds assignments to the AREC record -- as required, defines the xxxPTR types for uplevel referenced objects, -- adds the ARECP parameter to all nested subprograms which need it, and -- modifies all uplevel references appropriately. If For_Inline is True, -- we're unnesting this subprogram because it's on the list of inlined -- subprograms and should unnest it despite it not being part of the main -- unit. ----------- -- Calls -- ----------- -- Table to record calls within the nest being analyzed. These are the -- calls which may need to have an AREC actual added. This table is built -- new for each subprogram nest and cleared at the end of processing each -- subprogram nest. type Call_Entry is record N : Node_Id; -- The actual call Caller : Entity_Id; -- Entity of the subprogram containing the call (can be at any level) Callee : Entity_Id; -- Entity of the subprogram called (always at level 2 or higher). Note -- that in accordance with the basic rules of nesting, the level of To -- is either less than or equal to the level of From, or one greater. end record; package Calls is new Table.Table ( Table_Component_Type => Call_Entry, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => 100, Table_Increment => 200, Table_Name => "Unnest_Calls"); -- Records each call within the outer subprogram and all nested subprograms -- that are to other subprograms nested within the outer subprogram. These -- are the calls that may need an additional parameter. procedure Append_Unique_Call (Call : Call_Entry); -- Append a call entry to the Calls table. A check is made to see if the -- table already contains this entry and if so it has no effect. ---------------------------------- -- Subprograms For Fat Pointers -- ---------------------------------- function Build_Access_Type_Decl (E : Entity_Id; Scop : Entity_Id) return Node_Id; -- For an uplevel reference that involves an unconstrained array type, -- build an access type declaration for the corresponding activation -- record component. The relevant attributes of the access type are -- set here to avoid a full analysis that would require a scope stack. function Needs_Fat_Pointer (E : Entity_Id) return Boolean; -- A formal parameter of an unconstrained array type that appears in an -- uplevel reference requires the construction of an access type, to be -- used in the corresponding component declaration. ----------- -- Urefs -- ----------- -- Table to record explicit uplevel references to objects (variables, -- constants, formal parameters). These are the references that will -- need rewriting to use the activation table (AREC) pointers. Also -- included are implicit and explicit uplevel references to types, but -- these do not get rewritten by the front end. This table is built new -- for each subprogram nest and cleared at the end of processing each -- subprogram nest. type Uref_Entry is record Ref : Node_Id; -- The reference itself. For objects this is always an entity reference -- and the referenced entity will have its Is_Uplevel_Referenced_Entity -- flag set and will appear in the Uplevel_Referenced_Entities list of -- the subprogram declaring this entity. Ent : Entity_Id; -- The Entity_Id of the uplevel referenced object or type Caller : Entity_Id; -- The entity for the subprogram immediately containing this entity Callee : Entity_Id; -- The entity for the subprogram containing the referenced entity. Note -- that the level of Callee must be less than the level of Caller, since -- this is an uplevel reference. end record; package Urefs is new Table.Table ( Table_Component_Type => Uref_Entry, Table_Index_Type => Nat, Table_Low_Bound => 1, Table_Initial => 100, Table_Increment => 200, Table_Name => "Unnest_Urefs"); ------------------------ -- Append_Unique_Call -- ------------------------ procedure Append_Unique_Call (Call : Call_Entry) is begin for J in Calls.First .. Calls.Last loop if Calls.Table (J) = Call then return; end if; end loop; Calls.Append (Call); end Append_Unique_Call; ----------------------------- -- Build_Access_Type_Decl -- ----------------------------- function Build_Access_Type_Decl (E : Entity_Id; Scop : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (E); Typ : Entity_Id; begin Typ := Make_Temporary (Loc, 'S'); Set_Ekind (Typ, E_General_Access_Type); Set_Etype (Typ, Typ); Set_Scope (Typ, Scop); Set_Directly_Designated_Type (Typ, Etype (E)); return Make_Full_Type_Declaration (Loc, Defining_Identifier => Typ, Type_Definition => Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Etype (E), Loc))); end Build_Access_Type_Decl; --------------- -- Get_Level -- --------------- function Get_Level (Subp : Entity_Id; Sub : Entity_Id) return Nat is Lev : Nat; S : Entity_Id; begin Lev := 1; S := Sub; loop if S = Subp then return Lev; else Lev := Lev + 1; S := Enclosing_Subprogram (S); end if; end loop; end Get_Level; -------------------------- -- In_Synchronized_Unit -- -------------------------- function In_Synchronized_Unit (Subp : Entity_Id) return Boolean is S : Entity_Id := Scope (Subp); begin while Present (S) and then S /= Standard_Standard loop if Is_Concurrent_Type (S) then return True; elsif Is_Private_Type (S) and then Present (Full_View (S)) and then Is_Concurrent_Type (Full_View (S)) then return True; end if; S := Scope (S); end loop; return False; end In_Synchronized_Unit; ----------------------- -- Needs_Fat_Pointer -- ----------------------- function Needs_Fat_Pointer (E : Entity_Id) return Boolean is Typ : Entity_Id := Etype (E); begin if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then Typ := Full_View (Typ); end if; return Is_Array_Type (Typ) and then not Is_Constrained (Typ); end Needs_Fat_Pointer; ---------------- -- Subp_Index -- ---------------- function Subp_Index (Sub : Entity_Id) return SI_Type is E : Entity_Id := Sub; begin pragma Assert (Is_Subprogram (E)); if Subps_Index (E) = Uint_0 then E := Ultimate_Alias (E); -- The body of a protected operation has a different name and -- has been scanned at this point, and thus has an entry in the -- subprogram table. if E = Sub and then Present (Protected_Body_Subprogram (E)) then E := Protected_Body_Subprogram (E); end if; if Ekind (E) = E_Function and then Rewritten_For_C (E) and then Present (Corresponding_Procedure (E)) then E := Corresponding_Procedure (E); end if; end if; pragma Assert (Subps_Index (E) /= Uint_0); return SI_Type (UI_To_Int (Subps_Index (E))); end Subp_Index; ----------------------- -- Unnest_Subprogram -- ----------------------- procedure Unnest_Subprogram (Subp : Entity_Id; Subp_Body : Node_Id; For_Inline : Boolean := False) is function AREC_Name (J : Pos; S : String) return Name_Id; -- Returns name for string ARECjS, where j is the decimal value of j function Enclosing_Subp (Subp : SI_Type) return SI_Type; -- Subp is the index of a subprogram which has a Lev greater than 1. -- This function returns the index of the enclosing subprogram which -- will have a Lev value one less than this. function Img_Pos (N : Pos) return String; -- Return image of N without leading blank function Upref_Name (Ent : Entity_Id; Index : Pos; Clist : List_Id) return Name_Id; -- This function returns the name to be used in the activation record to -- reference the variable uplevel. Clist is the list of components that -- have been created in the activation record so far. Normally the name -- is just a copy of the Chars field of the entity. The exception is -- when the name has already been used, in which case we suffix the name -- with the index value Index to avoid duplication. This happens with -- declare blocks and generic parameters at least. --------------- -- AREC_Name -- --------------- function AREC_Name (J : Pos; S : String) return Name_Id is begin return Name_Find ("AREC" & Img_Pos (J) & S); end AREC_Name; -------------------- -- Enclosing_Subp -- -------------------- function Enclosing_Subp (Subp : SI_Type) return SI_Type is STJ : Subp_Entry renames Subps.Table (Subp); Ret : constant SI_Type := Subp_Index (Enclosing_Subprogram (STJ.Ent)); begin pragma Assert (STJ.Lev > 1); pragma Assert (Subps.Table (Ret).Lev = STJ.Lev - 1); return Ret; end Enclosing_Subp; ------------- -- Img_Pos -- ------------- function Img_Pos (N : Pos) return String is Buf : String (1 .. 20); Ptr : Natural; NV : Nat; begin Ptr := Buf'Last; NV := N; while NV /= 0 loop Buf (Ptr) := Character'Val (48 + NV mod 10); Ptr := Ptr - 1; NV := NV / 10; end loop; return Buf (Ptr + 1 .. Buf'Last); end Img_Pos; ---------------- -- Upref_Name -- ---------------- function Upref_Name (Ent : Entity_Id; Index : Pos; Clist : List_Id) return Name_Id is C : Node_Id; begin C := First (Clist); loop if No (C) then return Chars (Ent); elsif Chars (Defining_Identifier (C)) = Chars (Ent) then return Name_Find (Get_Name_String (Chars (Ent)) & Img_Pos (Index)); else Next (C); end if; end loop; end Upref_Name; -- Start of processing for Unnest_Subprogram begin -- Nothing to do inside a generic (all processing is for instance) if Inside_A_Generic then return; end if; -- If the main unit is a package body then we need to examine the spec -- to determine whether the main unit is generic (the scope stack is not -- present when this is called on the main unit). if not For_Inline and then Ekind (Cunit_Entity (Main_Unit)) = E_Package_Body and then Is_Generic_Unit (Spec_Entity (Cunit_Entity (Main_Unit))) then return; -- Only unnest when generating code for the main source unit or if -- we're unnesting for inline. But in some Annex E cases the Sloc -- points to a different unit, so also make sure that the Parent -- isn't in something that we know we're generating code for. elsif not For_Inline and then not In_Extended_Main_Code_Unit (Subp_Body) and then not In_Extended_Main_Code_Unit (Parent (Subp_Body)) then return; end if; -- This routine is called late, after the scope stack is gone. The -- following creates a suitable dummy scope stack to be used for the -- analyze/expand calls made from this routine. Push_Scope (Subp); -- First step, we must mark all nested subprograms that require a static -- link (activation record) because either they contain explicit uplevel -- references (as indicated by Is_Uplevel_Referenced_Entity being set at -- this point), or they make calls to other subprograms in the same nest -- that require a static link (in which case we set this flag). -- This is a recursive definition, and to implement this, we have to -- build a call graph for the set of nested subprograms, and then go -- over this graph to implement recursively the invariant that if a -- subprogram has a call to a subprogram requiring a static link, then -- the calling subprogram requires a static link. -- First populate the above tables Subps_First := Subps.Last + 1; Calls.Init; Urefs.Init; Build_Tables : declare Current_Subprogram : Entity_Id := Empty; -- When we scan a subprogram body, we set Current_Subprogram to the -- corresponding entity. This gets recursively saved and restored. function Visit_Node (N : Node_Id) return Traverse_Result; -- Visit a single node in Subp ----------- -- Visit -- ----------- procedure Visit is new Traverse_Proc (Visit_Node); -- Used to traverse the body of Subp, populating the tables ---------------- -- Visit_Node -- ---------------- function Visit_Node (N : Node_Id) return Traverse_Result is Ent : Entity_Id; Caller : Entity_Id; Callee : Entity_Id; procedure Check_Static_Type (In_T : Entity_Id; N : Node_Id; DT : in out Boolean; Check_Designated : Boolean := False); -- Given a type In_T, checks if it is a static type defined as -- a type with no dynamic bounds in sight. If so, the only -- action is to set Is_Static_Type True for In_T. If In_T is -- not a static type, then all types with dynamic bounds -- associated with In_T are detected, and their bounds are -- marked as uplevel referenced if not at the library level, -- and DT is set True. If N is specified, it's the node that -- will need to be replaced. If not specified, it means we -- can't do a replacement because the bound is implicit. -- If Check_Designated is True and In_T or its full view -- is an access type, check whether the designated type -- has dynamic bounds. procedure Note_Uplevel_Ref (E : Entity_Id; N : Node_Id; Caller : Entity_Id; Callee : Entity_Id); -- Called when we detect an explicit or implicit uplevel reference -- from within Caller to entity E declared in Callee. E can be a -- an object or a type. procedure Register_Subprogram (E : Entity_Id; Bod : Node_Id); -- Enter a subprogram whose body is visible or which is a -- subprogram instance into the subprogram table. ----------------------- -- Check_Static_Type -- ----------------------- procedure Check_Static_Type (In_T : Entity_Id; N : Node_Id; DT : in out Boolean; Check_Designated : Boolean := False) is T : constant Entity_Id := Get_Fullest_View (In_T); procedure Note_Uplevel_Bound (N : Node_Id; Ref : Node_Id); -- N is the bound of a dynamic type. This procedure notes that -- this bound is uplevel referenced, it can handle references -- to entities (typically _FIRST and _LAST entities), and also -- attribute references of the form T'name (name is typically -- FIRST or LAST) where T is the uplevel referenced bound. -- Ref, if Present, is the location of the reference to -- replace. ------------------------ -- Note_Uplevel_Bound -- ------------------------ procedure Note_Uplevel_Bound (N : Node_Id; Ref : Node_Id) is begin -- Entity name case. Make sure that the entity is declared -- in a subprogram. This may not be the case for a type in a -- loop appearing in a precondition. -- Exclude explicitly discriminants (that can appear -- in bounds of discriminated components). if Is_Entity_Name (N) then if Present (Entity (N)) and then not Is_Type (Entity (N)) and then Present (Enclosing_Subprogram (Entity (N))) and then Ekind (Entity (N)) /= E_Discriminant then Note_Uplevel_Ref (E => Entity (N), N => Empty, Caller => Current_Subprogram, Callee => Enclosing_Subprogram (Entity (N))); end if; -- Attribute or indexed component case elsif Nkind (N) in N_Attribute_Reference | N_Indexed_Component then Note_Uplevel_Bound (Prefix (N), Ref); -- The indices of the indexed components, or the -- associated expressions of an attribute reference, -- may also involve uplevel references. declare Expr : Node_Id; begin Expr := First (Expressions (N)); while Present (Expr) loop Note_Uplevel_Bound (Expr, Ref); Next (Expr); end loop; end; -- The type of the prefix may be have an uplevel -- reference if this needs bounds. if Nkind (N) = N_Attribute_Reference then declare Attr : constant Attribute_Id := Get_Attribute_Id (Attribute_Name (N)); DT : Boolean := False; begin if (Attr = Attribute_First or else Attr = Attribute_Last or else Attr = Attribute_Length) and then Is_Constrained (Etype (Prefix (N))) then Check_Static_Type (Etype (Prefix (N)), Empty, DT); end if; end; end if; -- Binary operator cases. These can apply to arrays for -- which we may need bounds. elsif Nkind (N) in N_Binary_Op then Note_Uplevel_Bound (Left_Opnd (N), Ref); Note_Uplevel_Bound (Right_Opnd (N), Ref); -- Unary operator case elsif Nkind (N) in N_Unary_Op then Note_Uplevel_Bound (Right_Opnd (N), Ref); -- Explicit dereference and selected component case elsif Nkind (N) in N_Explicit_Dereference | N_Selected_Component then Note_Uplevel_Bound (Prefix (N), Ref); -- Conditional expressions elsif Nkind (N) = N_If_Expression then declare Expr : Node_Id; begin Expr := First (Expressions (N)); while Present (Expr) loop Note_Uplevel_Bound (Expr, Ref); Next (Expr); end loop; end; elsif Nkind (N) = N_Case_Expression then declare Alternative : Node_Id; begin Note_Uplevel_Bound (Expression (N), Ref); Alternative := First (Alternatives (N)); while Present (Alternative) loop Note_Uplevel_Bound (Expression (Alternative), Ref); end loop; end; -- Conversion case elsif Nkind (N) = N_Type_Conversion then Note_Uplevel_Bound (Expression (N), Ref); end if; end Note_Uplevel_Bound; -- Start of processing for Check_Static_Type begin -- If already marked static, immediate return if Is_Static_Type (T) and then not Check_Designated then return; end if; -- If the type is at library level, always consider it static, -- since such uplevel references are irrelevant. if Is_Library_Level_Entity (T) then Set_Is_Static_Type (T); return; end if; -- Otherwise figure out what the story is with this type -- For a scalar type, check bounds if Is_Scalar_Type (T) then -- If both bounds static, then this is a static type declare LB : constant Node_Id := Type_Low_Bound (T); UB : constant Node_Id := Type_High_Bound (T); begin if not Is_Static_Expression (LB) then Note_Uplevel_Bound (LB, N); DT := True; end if; if not Is_Static_Expression (UB) then Note_Uplevel_Bound (UB, N); DT := True; end if; end; -- For record type, check all components and discriminant -- constraints if present. elsif Is_Record_Type (T) then declare C : Entity_Id; D : Elmt_Id; begin C := First_Component_Or_Discriminant (T); while Present (C) loop Check_Static_Type (Etype (C), N, DT); Next_Component_Or_Discriminant (C); end loop; if Has_Discriminants (T) and then Present (Discriminant_Constraint (T)) then D := First_Elmt (Discriminant_Constraint (T)); while Present (D) loop if not Is_Static_Expression (Node (D)) then Note_Uplevel_Bound (Node (D), N); DT := True; end if; Next_Elmt (D); end loop; end if; end; -- For array type, check index types and component type elsif Is_Array_Type (T) then declare IX : Node_Id; begin Check_Static_Type (Component_Type (T), N, DT); IX := First_Index (T); while Present (IX) loop Check_Static_Type (Etype (IX), N, DT); Next_Index (IX); end loop; end; -- For private type, examine whether full view is static elsif Is_Incomplete_Or_Private_Type (T) and then Present (Full_View (T)) then Check_Static_Type (Full_View (T), N, DT, Check_Designated); if Is_Static_Type (Full_View (T)) then Set_Is_Static_Type (T); end if; -- For access types, check designated type when required elsif Is_Access_Type (T) and then Check_Designated then Check_Static_Type (Directly_Designated_Type (T), N, DT); -- For now, ignore other types else return; end if; if not DT then Set_Is_Static_Type (T); end if; end Check_Static_Type; ---------------------- -- Note_Uplevel_Ref -- ---------------------- procedure Note_Uplevel_Ref (E : Entity_Id; N : Node_Id; Caller : Entity_Id; Callee : Entity_Id) is Full_E : Entity_Id := E; begin -- Nothing to do for static type if Is_Static_Type (E) then return; end if; -- Nothing to do if Caller and Callee are the same if Caller = Callee then return; -- Callee may be a function that returns an array, and that has -- been rewritten as a procedure. If caller is that procedure, -- nothing to do either. elsif Ekind (Callee) = E_Function and then Rewritten_For_C (Callee) and then Corresponding_Procedure (Callee) = Caller then return; elsif Ekind (Callee) in E_Entry | E_Entry_Family then return; end if; -- We have a new uplevel referenced entity if Ekind (E) = E_Constant and then Present (Full_View (E)) then Full_E := Full_View (E); end if; -- All we do at this stage is to add the uplevel reference to -- the table. It's too early to do anything else, since this -- uplevel reference may come from an unreachable subprogram -- in which case the entry will be deleted. Urefs.Append ((N, Full_E, Caller, Callee)); end Note_Uplevel_Ref; ------------------------- -- Register_Subprogram -- ------------------------- procedure Register_Subprogram (E : Entity_Id; Bod : Node_Id) is L : constant Nat := Get_Level (Subp, E); begin -- Subprograms declared in tasks and protected types cannot be -- eliminated because calls to them may be in other units, so -- they must be treated as reachable. Subps.Append ((Ent => E, Bod => Bod, Lev => L, Reachable => In_Synchronized_Unit (E) or else Address_Taken (E), Uplevel_Ref => L, Declares_AREC => False, Uents => No_Elist, Last => 0, ARECnF => Empty, ARECn => Empty, ARECnT => Empty, ARECnPT => Empty, ARECnP => Empty, ARECnU => Empty)); Set_Subps_Index (E, UI_From_Int (Subps.Last)); -- If we marked this reachable because it's in a synchronized -- unit, we have to mark all enclosing subprograms as reachable -- as well. We do the same for subprograms with Address_Taken, -- because otherwise we can run into problems with looking at -- enclosing subprograms in Subps.Table due to their being -- unreachable (the Subp_Index of unreachable subps is later -- set to zero and their entry in Subps.Table is removed). if In_Synchronized_Unit (E) or else Address_Taken (E) then declare S : Entity_Id := E; begin for J in reverse 1 .. L - 1 loop S := Enclosing_Subprogram (S); Subps.Table (Subp_Index (S)).Reachable := True; end loop; end; end if; end Register_Subprogram; -- Start of processing for Visit_Node begin case Nkind (N) is -- Record a subprogram call when N_Function_Call | N_Procedure_Call_Statement => -- We are only interested in direct calls, not indirect -- calls (where Name (N) is an explicit dereference) at -- least for now! if Nkind (Name (N)) in N_Has_Entity then Ent := Entity (Name (N)); -- We are only interested in calls to subprograms nested -- within Subp. Calls to Subp itself or to subprograms -- outside the nested structure do not affect us. if Scope_Within (Ent, Subp) and then Is_Subprogram (Ent) and then not Is_Imported (Ent) then Append_Unique_Call ((N, Current_Subprogram, Ent)); end if; end if; -- For all calls where the formal is an unconstrained array -- and the actual is constrained we need to check the bounds -- for uplevel references. declare Actual : Entity_Id; DT : Boolean := False; Formal : Node_Id; Subp : Entity_Id; begin if Nkind (Name (N)) = N_Explicit_Dereference then Subp := Etype (Name (N)); else Subp := Entity (Name (N)); end if; Actual := First_Actual (N); Formal := First_Formal_With_Extras (Subp); while Present (Actual) loop if Is_Array_Type (Etype (Formal)) and then not Is_Constrained (Etype (Formal)) and then Is_Constrained (Etype (Actual)) then Check_Static_Type (Etype (Actual), Empty, DT); end if; Next_Actual (Actual); Next_Formal_With_Extras (Formal); end loop; end; -- An At_End_Proc in a statement sequence indicates that there -- is a call from the enclosing construct or block to that -- subprogram. As above, the called entity must be local and -- not imported. when N_Handled_Sequence_Of_Statements => if Present (At_End_Proc (N)) and then Scope_Within (Entity (At_End_Proc (N)), Subp) and then not Is_Imported (Entity (At_End_Proc (N))) then Append_Unique_Call ((N, Current_Subprogram, Entity (At_End_Proc (N)))); end if; -- Similarly, the following constructs include a semantic -- attribute Procedure_To_Call that must be handled like -- other calls. Likewise for attribute Storage_Pool. when N_Allocator | N_Extended_Return_Statement | N_Free_Statement | N_Simple_Return_Statement => declare Pool : constant Entity_Id := Storage_Pool (N); Proc : constant Entity_Id := Procedure_To_Call (N); begin if Present (Proc) and then Scope_Within (Proc, Subp) and then not Is_Imported (Proc) then Append_Unique_Call ((N, Current_Subprogram, Proc)); end if; if Present (Pool) and then not Is_Library_Level_Entity (Pool) and then Scope_Within_Or_Same (Scope (Pool), Subp) then Caller := Current_Subprogram; Callee := Enclosing_Subprogram (Pool); if Callee /= Caller then Note_Uplevel_Ref (Pool, Empty, Caller, Callee); end if; end if; end; -- For an allocator with a qualified expression, check type -- of expression being qualified. The explicit type name is -- handled as an entity reference. if Nkind (N) = N_Allocator and then Nkind (Expression (N)) = N_Qualified_Expression then declare DT : Boolean := False; begin Check_Static_Type (Etype (Expression (Expression (N))), Empty, DT); end; -- For a Return or Free (all other nodes we handle here), -- we usually need the size of the object, so we need to be -- sure that any nonstatic bounds of the expression's type -- that are uplevel are handled. elsif Nkind (N) /= N_Allocator and then Present (Expression (N)) then declare DT : Boolean := False; begin Check_Static_Type (Etype (Expression (N)), Empty, DT, Check_Designated => Nkind (N) = N_Free_Statement); end; end if; -- A 'Access reference is a (potential) call. So is 'Address, -- in particular on imported subprograms. Other attributes -- require special handling. when N_Attribute_Reference => declare Attr : constant Attribute_Id := Get_Attribute_Id (Attribute_Name (N)); begin case Attr is when Attribute_Access | Attribute_Unchecked_Access | Attribute_Unrestricted_Access | Attribute_Address => if Nkind (Prefix (N)) in N_Has_Entity then Ent := Entity (Prefix (N)); -- We only need to examine calls to subprograms -- nested within current Subp. if Scope_Within (Ent, Subp) then if Is_Imported (Ent) then null; elsif Is_Subprogram (Ent) then Append_Unique_Call ((N, Current_Subprogram, Ent)); end if; end if; end if; -- References to bounds can be uplevel references if -- the type isn't static. when Attribute_First | Attribute_Last | Attribute_Length => -- Special-case attributes of objects whose bounds -- may be uplevel references. More complex prefixes -- handled during full traversal. Note that if the -- nominal subtype of the prefix is unconstrained, -- the bound must be obtained from the object, not -- from the (possibly) uplevel reference. We call -- Get_Referenced_Object to deal with prefixes that -- are object renamings (prefixes that are types -- can be passed and will simply be returned). But -- it's also legal to get the bounds from the type -- of the prefix, so we have to handle both cases. declare DT : Boolean := False; begin if Is_Constrained (Etype (Get_Referenced_Object (Prefix (N)))) then Check_Static_Type (Etype (Get_Referenced_Object (Prefix (N))), Empty, DT); end if; if Is_Constrained (Etype (Prefix (N))) then Check_Static_Type (Etype (Prefix (N)), Empty, DT); end if; end; when others => null; end case; end; -- Component associations in aggregates are either static or -- else the aggregate will be expanded into assignments, in -- which case the expression is analyzed later and provides -- no relevant code generation. when N_Component_Association => if No (Expression (N)) or else No (Etype (Expression (N))) then return Skip; end if; -- Generic associations are not analyzed: the actuals are -- transferred to renaming and subtype declarations that -- are the ones that must be examined. when N_Generic_Association => return Skip; -- Indexed references can be uplevel if the type isn't static -- and if the lower bound (or an inner bound for a multi- -- dimensional array) is uplevel. when N_Indexed_Component | N_Slice => if Is_Constrained (Etype (Prefix (N))) then declare DT : Boolean := False; begin Check_Static_Type (Etype (Prefix (N)), Empty, DT); end; end if; -- A selected component can have an implicit up-level -- reference due to the bounds of previous fields in the -- record. We simplify the processing here by examining -- all components of the record. -- Selected components appear as unit names and end labels -- for child units. Prefixes of these nodes denote parent -- units and carry no type information so they are skipped. when N_Selected_Component => if Present (Etype (Prefix (N))) then declare DT : Boolean := False; begin Check_Static_Type (Etype (Prefix (N)), Empty, DT); end; end if; -- For EQ/NE comparisons, we need the type of the operands -- in order to do the comparison, which means we need the -- bounds. when N_Op_Eq | N_Op_Ne => declare DT : Boolean := False; begin Check_Static_Type (Etype (Left_Opnd (N)), Empty, DT); Check_Static_Type (Etype (Right_Opnd (N)), Empty, DT); end; -- Likewise we need the sizes to compute how much to move in -- an assignment. when N_Assignment_Statement => declare DT : Boolean := False; begin Check_Static_Type (Etype (Name (N)), Empty, DT); Check_Static_Type (Etype (Expression (N)), Empty, DT); end; -- Record a subprogram. We record a subprogram body that acts -- as a spec. Otherwise we record a subprogram declaration, -- providing that it has a corresponding body we can get hold -- of. The case of no corresponding body being available is -- ignored for now. when N_Subprogram_Body => Ent := Unique_Defining_Entity (N); -- Ignore generic subprogram if Is_Generic_Subprogram (Ent) then return Skip; end if; -- Make new entry in subprogram table if not already made Register_Subprogram (Ent, N); -- We make a recursive call to scan the subprogram body, so -- that we can save and restore Current_Subprogram. declare Save_CS : constant Entity_Id := Current_Subprogram; Decl : Node_Id; begin Current_Subprogram := Ent; -- Scan declarations Decl := First (Declarations (N)); while Present (Decl) loop Visit (Decl); Next (Decl); end loop; -- Scan statements Visit (Handled_Statement_Sequence (N)); -- Restore current subprogram setting Current_Subprogram := Save_CS; end; -- Now at this level, return skipping the subprogram body -- descendants, since we already took care of them! return Skip; -- If we have a body stub, visit the associated subunit, which -- is a semantic descendant of the stub. when N_Body_Stub => Visit (Library_Unit (N)); -- A declaration of a wrapper package indicates a subprogram -- instance for which there is no explicit body. Enter the -- subprogram instance in the table. when N_Package_Declaration => if Is_Wrapper_Package (Defining_Entity (N)) then Register_Subprogram (Related_Instance (Defining_Entity (N)), Empty); end if; -- Skip generic declarations when N_Generic_Declaration => return Skip; -- Skip generic package body when N_Package_Body => if Present (Corresponding_Spec (N)) and then Ekind (Corresponding_Spec (N)) = E_Generic_Package then return Skip; end if; -- Pragmas and component declarations are ignored. Quantified -- expressions are expanded into explicit loops and the -- original epression must be ignored. when N_Component_Declaration | N_Pragma | N_Quantified_Expression => return Skip; -- We want to skip the function spec for a generic function -- to avoid looking at any generic types that might be in -- its formals. when N_Function_Specification => if Is_Generic_Subprogram (Unique_Defining_Entity (N)) then return Skip; end if; -- Otherwise record an uplevel reference in a local identifier when others => if Nkind (N) in N_Has_Entity and then Present (Entity (N)) then Ent := Entity (N); -- Only interested in entities declared within our nest if not Is_Library_Level_Entity (Ent) and then Scope_Within_Or_Same (Scope (Ent), Subp) -- Skip entities defined in inlined subprograms and then Chars (Enclosing_Subprogram (Ent)) /= Name_uParent -- Constants and variables are potentially uplevel -- references to global declarations. and then (Ekind (Ent) in E_Constant | E_Loop_Parameter | E_Variable -- Formals are interesting, but not if being used -- as mere names of parameters for name notation -- calls. or else (Is_Formal (Ent) and then not (Nkind (Parent (N)) = N_Parameter_Association and then Selector_Name (Parent (N)) = N)) -- Types other than known Is_Static types are -- potentially interesting. or else (Is_Type (Ent) and then not Is_Static_Type (Ent))) then -- Here we have a potentially interesting uplevel -- reference to examine. if Is_Type (Ent) then declare DT : Boolean := False; begin Check_Static_Type (Ent, N, DT); return OK; end; end if; Caller := Current_Subprogram; Callee := Enclosing_Subprogram (Ent); if Callee /= Caller and then (not Is_Static_Type (Ent) or else Needs_Fat_Pointer (Ent)) then Note_Uplevel_Ref (Ent, N, Caller, Callee); -- Check the type of a formal parameter of the current -- subprogram, whose formal type may be an uplevel -- reference. elsif Is_Formal (Ent) and then Scope (Ent) = Current_Subprogram then declare DT : Boolean := False; begin Check_Static_Type (Etype (Ent), Empty, DT); end; end if; end if; end if; end case; -- Fall through to continue scanning children of this node return OK; end Visit_Node; -- Start of processing for Build_Tables begin -- Traverse the body to get subprograms, calls and uplevel references Visit (Subp_Body); end Build_Tables; -- Now do the first transitive closure which determines which -- subprograms in the nest are actually reachable. Reachable_Closure : declare Modified : Boolean; begin Subps.Table (Subps_First).Reachable := True; -- We use a simple minded algorithm as follows (obviously this can -- be done more efficiently, using one of the standard algorithms -- for efficient transitive closure computation, but this is simple -- and most likely fast enough that its speed does not matter). -- Repeatedly scan the list of calls. Any time we find a call from -- A to B, where A is reachable, but B is not, then B is reachable, -- and note that we have made a change by setting Modified True. We -- repeat this until we make a pass with no modifications. Outer : loop Modified := False; Inner : for J in Calls.First .. Calls.Last loop declare CTJ : Call_Entry renames Calls.Table (J); SINF : constant SI_Type := Subp_Index (CTJ.Caller); SINT : constant SI_Type := Subp_Index (CTJ.Callee); SUBF : Subp_Entry renames Subps.Table (SINF); SUBT : Subp_Entry renames Subps.Table (SINT); begin if SUBF.Reachable and then not SUBT.Reachable then SUBT.Reachable := True; Modified := True; end if; end; end loop Inner; exit Outer when not Modified; end loop Outer; end Reachable_Closure; -- Remove calls from unreachable subprograms declare New_Index : Nat; begin New_Index := 0; for J in Calls.First .. Calls.Last loop declare CTJ : Call_Entry renames Calls.Table (J); SINF : constant SI_Type := Subp_Index (CTJ.Caller); SINT : constant SI_Type := Subp_Index (CTJ.Callee); SUBF : Subp_Entry renames Subps.Table (SINF); SUBT : Subp_Entry renames Subps.Table (SINT); begin if SUBF.Reachable then pragma Assert (SUBT.Reachable); New_Index := New_Index + 1; Calls.Table (New_Index) := Calls.Table (J); end if; end; end loop; Calls.Set_Last (New_Index); end; -- Remove uplevel references from unreachable subprograms declare New_Index : Nat; begin New_Index := 0; for J in Urefs.First .. Urefs.Last loop declare URJ : Uref_Entry renames Urefs.Table (J); SINF : constant SI_Type := Subp_Index (URJ.Caller); SINT : constant SI_Type := Subp_Index (URJ.Callee); SUBF : Subp_Entry renames Subps.Table (SINF); SUBT : Subp_Entry renames Subps.Table (SINT); S : Entity_Id; begin -- Keep reachable reference if SUBF.Reachable then New_Index := New_Index + 1; Urefs.Table (New_Index) := Urefs.Table (J); -- And since we know we are keeping this one, this is a good -- place to fill in information for a good reference. -- Mark all enclosing subprograms need to declare AREC S := URJ.Caller; loop S := Enclosing_Subprogram (S); -- If we are at the top level, as can happen with -- references to formals in aspects of nested subprogram -- declarations, there are no further subprograms to mark -- as requiring activation records. exit when No (S); declare SUBI : Subp_Entry renames Subps.Table (Subp_Index (S)); begin SUBI.Declares_AREC := True; -- If this entity was marked reachable because it is -- in a task or protected type, there may not appear -- to be any calls to it, which would normally adjust -- the levels of the parent subprograms. So we need to -- be sure that the uplevel reference of that entity -- takes into account possible calls. if In_Synchronized_Unit (SUBF.Ent) and then SUBT.Lev < SUBI.Uplevel_Ref then SUBI.Uplevel_Ref := SUBT.Lev; end if; end; exit when S = URJ.Callee; end loop; -- Add to list of uplevel referenced entities for Callee. -- We do not add types to this list, only actual references -- to objects that will be referenced uplevel, and we use -- the flag Is_Uplevel_Referenced_Entity to avoid making -- duplicate entries in the list. Discriminants are also -- excluded, only the enclosing object can appear in the -- list. if not Is_Uplevel_Referenced_Entity (URJ.Ent) and then Ekind (URJ.Ent) /= E_Discriminant then Set_Is_Uplevel_Referenced_Entity (URJ.Ent); Append_New_Elmt (URJ.Ent, SUBT.Uents); end if; -- And set uplevel indication for caller if SUBT.Lev < SUBF.Uplevel_Ref then SUBF.Uplevel_Ref := SUBT.Lev; end if; end if; end; end loop; Urefs.Set_Last (New_Index); end; -- Remove unreachable subprograms from Subps table. Note that we do -- this after eliminating entries from the other two tables, since -- those elimination steps depend on referencing the Subps table. declare New_SI : SI_Type; begin New_SI := Subps_First - 1; for J in Subps_First .. Subps.Last loop declare STJ : Subp_Entry renames Subps.Table (J); Spec : Node_Id; Decl : Node_Id; begin -- Subprogram is reachable, copy and reset index if STJ.Reachable then New_SI := New_SI + 1; Subps.Table (New_SI) := STJ; Set_Subps_Index (STJ.Ent, UI_From_Int (New_SI)); -- Subprogram is not reachable else -- Clear index, since no longer active Set_Subps_Index (Subps.Table (J).Ent, Uint_0); -- Output debug information if -gnatd.3 set if Debug_Flag_Dot_3 then Write_Str ("Eliminate "); Write_Name (Chars (Subps.Table (J).Ent)); Write_Str (" at "); Write_Location (Sloc (Subps.Table (J).Ent)); Write_Str (" (not referenced)"); Write_Eol; end if; -- Rewrite declaration, body, and corresponding freeze node -- to null statements. -- A subprogram instantiation does not have an explicit -- body. If unused, we could remove the corresponding -- wrapper package and its body (TBD). if Present (STJ.Bod) then Spec := Corresponding_Spec (STJ.Bod); if Present (Spec) then Decl := Parent (Declaration_Node (Spec)); Rewrite (Decl, Make_Null_Statement (Sloc (Decl))); if Present (Freeze_Node (Spec)) then Rewrite (Freeze_Node (Spec), Make_Null_Statement (Sloc (Decl))); end if; end if; Rewrite (STJ.Bod, Make_Null_Statement (Sloc (STJ.Bod))); end if; end if; end; end loop; Subps.Set_Last (New_SI); end; -- Now it is time for the second transitive closure, which follows calls -- and makes sure that A calls B, and B has uplevel references, then A -- is also marked as having uplevel references. Closure_Uplevel : declare Modified : Boolean; begin -- We use a simple minded algorithm as follows (obviously this can -- be done more efficiently, using one of the standard algorithms -- for efficient transitive closure computation, but this is simple -- and most likely fast enough that its speed does not matter). -- Repeatedly scan the list of calls. Any time we find a call from -- A to B, where B has uplevel references, make sure that A is marked -- as having at least the same level of uplevel referencing. Outer2 : loop Modified := False; Inner2 : for J in Calls.First .. Calls.Last loop declare CTJ : Call_Entry renames Calls.Table (J); SINF : constant SI_Type := Subp_Index (CTJ.Caller); SINT : constant SI_Type := Subp_Index (CTJ.Callee); SUBF : Subp_Entry renames Subps.Table (SINF); SUBT : Subp_Entry renames Subps.Table (SINT); begin if SUBT.Lev > SUBT.Uplevel_Ref and then SUBF.Uplevel_Ref > SUBT.Uplevel_Ref then SUBF.Uplevel_Ref := SUBT.Uplevel_Ref; Modified := True; end if; end; end loop Inner2; exit Outer2 when not Modified; end loop Outer2; end Closure_Uplevel; -- We have one more step before the tables are complete. An uplevel -- call from subprogram A to subprogram B where subprogram B has uplevel -- references is in effect an uplevel reference, and must arrange for -- the proper activation link to be passed. for J in Calls.First .. Calls.Last loop declare CTJ : Call_Entry renames Calls.Table (J); SINF : constant SI_Type := Subp_Index (CTJ.Caller); SINT : constant SI_Type := Subp_Index (CTJ.Callee); SUBF : Subp_Entry renames Subps.Table (SINF); SUBT : Subp_Entry renames Subps.Table (SINT); A : Entity_Id; begin -- If callee has uplevel references if SUBT.Uplevel_Ref < SUBT.Lev -- And this is an uplevel call and then SUBT.Lev < SUBF.Lev then -- We need to arrange for finding the uplink A := CTJ.Caller; loop A := Enclosing_Subprogram (A); Subps.Table (Subp_Index (A)).Declares_AREC := True; exit when A = CTJ.Callee; -- In any case exit when we get to the outer level. This -- happens in some odd cases with generics (in particular -- sem_ch3.adb does not compile without this kludge ???). exit when A = Subp; end loop; end if; end; end loop; -- The tables are now complete, so we can record the last index in the -- Subps table for later reference in Cprint. Subps.Table (Subps_First).Last := Subps.Last; -- Next step, create the entities for code we will insert. We do this -- at the start so that all the entities are defined, regardless of the -- order in which we do the code insertions. Create_Entities : for J in Subps_First .. Subps.Last loop declare STJ : Subp_Entry renames Subps.Table (J); Loc : constant Source_Ptr := Sloc (STJ.Bod); begin -- First we create the ARECnF entity for the additional formal for -- all subprograms which need an activation record passed. if STJ.Uplevel_Ref < STJ.Lev then STJ.ARECnF := Make_Defining_Identifier (Loc, Chars => AREC_Name (J, "F")); end if; -- Define the AREC entities for the activation record if needed if STJ.Declares_AREC then STJ.ARECn := Make_Defining_Identifier (Loc, AREC_Name (J, "")); STJ.ARECnT := Make_Defining_Identifier (Loc, AREC_Name (J, "T")); STJ.ARECnPT := Make_Defining_Identifier (Loc, AREC_Name (J, "PT")); STJ.ARECnP := Make_Defining_Identifier (Loc, AREC_Name (J, "P")); -- Define uplink component entity if inner nesting case if Present (STJ.ARECnF) then STJ.ARECnU := Make_Defining_Identifier (Loc, AREC_Name (J, "U")); end if; end if; end; end loop Create_Entities; -- Loop through subprograms Subp_Loop : declare Addr : Entity_Id := Empty; begin for J in Subps_First .. Subps.Last loop declare STJ : Subp_Entry renames Subps.Table (J); begin -- First add the extra formal if needed. This applies to all -- nested subprograms that require an activation record to be -- passed, as indicated by ARECnF being defined. if Present (STJ.ARECnF) then -- Here we need the extra formal. We do the expansion and -- analysis of this manually, since it is fairly simple, -- and it is not obvious how we can get what we want if we -- try to use the normal Analyze circuit. Add_Extra_Formal : declare Encl : constant SI_Type := Enclosing_Subp (J); STJE : Subp_Entry renames Subps.Table (Encl); -- Index and Subp_Entry for enclosing routine Form : constant Entity_Id := STJ.ARECnF; -- The formal to be added. Note that n here is one less -- than the level of the subprogram itself (STJ.Ent). procedure Add_Form_To_Spec (F : Entity_Id; S : Node_Id); -- S is an N_Function/Procedure_Specification node, and F -- is the new entity to add to this subprogramn spec as -- the last Extra_Formal. ---------------------- -- Add_Form_To_Spec -- ---------------------- procedure Add_Form_To_Spec (F : Entity_Id; S : Node_Id) is Sub : constant Entity_Id := Defining_Entity (S); Ent : Entity_Id; begin -- Case of at least one Extra_Formal is present, set -- ARECnF as the new last entry in the list. if Present (Extra_Formals (Sub)) then Ent := Extra_Formals (Sub); while Present (Extra_Formal (Ent)) loop Ent := Extra_Formal (Ent); end loop; Set_Extra_Formal (Ent, F); -- No Extra formals present else Set_Extra_Formals (Sub, F); Ent := Last_Formal (Sub); if Present (Ent) then Set_Extra_Formal (Ent, F); end if; end if; end Add_Form_To_Spec; -- Start of processing for Add_Extra_Formal begin -- Decorate the new formal entity Set_Scope (Form, STJ.Ent); Set_Ekind (Form, E_In_Parameter); Set_Etype (Form, STJE.ARECnPT); Set_Mechanism (Form, By_Copy); Set_Never_Set_In_Source (Form, True); Set_Analyzed (Form, True); Set_Comes_From_Source (Form, False); Set_Is_Activation_Record (Form, True); -- Case of only body present if Acts_As_Spec (STJ.Bod) then Add_Form_To_Spec (Form, Specification (STJ.Bod)); -- Case of separate spec else Add_Form_To_Spec (Form, Parent (STJ.Ent)); end if; end Add_Extra_Formal; end if; -- Processing for subprograms that declare an activation record if Present (STJ.ARECn) then -- Local declarations for one such subprogram declare Loc : constant Source_Ptr := Sloc (STJ.Bod); Decls : constant List_Id := New_List; -- List of new declarations we create Clist : List_Id; Comp : Entity_Id; Decl_Assign : Node_Id; -- Assignment to set uplink, Empty if none Decl_ARECnT : Node_Id; Decl_ARECnPT : Node_Id; Decl_ARECn : Node_Id; Decl_ARECnP : Node_Id; -- Declaration nodes for the AREC entities we build begin -- Build list of component declarations for ARECnT and -- load System.Address. Clist := Empty_List; if No (Addr) then Addr := RTE (RE_Address); end if; -- If we are in a subprogram that has a static link that -- is passed in (as indicated by ARECnF being defined), -- then include ARECnU : ARECmPT where ARECmPT comes from -- the level one higher than the current level, and the -- entity ARECnPT comes from the enclosing subprogram. if Present (STJ.ARECnF) then declare STJE : Subp_Entry renames Subps.Table (Enclosing_Subp (J)); begin Append_To (Clist, Make_Component_Declaration (Loc, Defining_Identifier => STJ.ARECnU, Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (STJE.ARECnPT, Loc)))); end; end if; -- Add components for uplevel referenced entities if Present (STJ.Uents) then declare Elmt : Elmt_Id; Ptr_Decl : Node_Id; Uent : Entity_Id; Indx : Nat; -- 1's origin of index in list of elements. This is -- used to uniquify names if needed in Upref_Name. begin Elmt := First_Elmt (STJ.Uents); Indx := 0; while Present (Elmt) loop Uent := Node (Elmt); Indx := Indx + 1; Comp := Make_Defining_Identifier (Loc, Chars => Upref_Name (Uent, Indx, Clist)); Set_Activation_Record_Component (Uent, Comp); if Needs_Fat_Pointer (Uent) then -- Build corresponding access type Ptr_Decl := Build_Access_Type_Decl (Etype (Uent), STJ.Ent); Append_To (Decls, Ptr_Decl); -- And use its type in the corresponding -- component. Append_To (Clist, Make_Component_Declaration (Loc, Defining_Identifier => Comp, Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Defining_Identifier (Ptr_Decl), Loc)))); else Append_To (Clist, Make_Component_Declaration (Loc, Defining_Identifier => Comp, Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Addr, Loc)))); end if; Next_Elmt (Elmt); end loop; end; end if; -- Now we can insert the AREC declarations into the body -- type ARECnT is record .. end record; -- pragma Suppress_Initialization (ARECnT); -- Note that we need to set the Suppress_Initialization -- flag after Decl_ARECnT has been analyzed. Decl_ARECnT := Make_Full_Type_Declaration (Loc, Defining_Identifier => STJ.ARECnT, Type_Definition => Make_Record_Definition (Loc, Component_List => Make_Component_List (Loc, Component_Items => Clist))); Append_To (Decls, Decl_ARECnT); -- type ARECnPT is access all ARECnT; Decl_ARECnPT := Make_Full_Type_Declaration (Loc, Defining_Identifier => STJ.ARECnPT, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => New_Occurrence_Of (STJ.ARECnT, Loc))); Append_To (Decls, Decl_ARECnPT); -- ARECn : aliased ARECnT; Decl_ARECn := Make_Object_Declaration (Loc, Defining_Identifier => STJ.ARECn, Aliased_Present => True, Object_Definition => New_Occurrence_Of (STJ.ARECnT, Loc)); Append_To (Decls, Decl_ARECn); -- ARECnP : constant ARECnPT := ARECn'Access; Decl_ARECnP := Make_Object_Declaration (Loc, Defining_Identifier => STJ.ARECnP, Constant_Present => True, Object_Definition => New_Occurrence_Of (STJ.ARECnPT, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (STJ.ARECn, Loc), Attribute_Name => Name_Access)); Append_To (Decls, Decl_ARECnP); -- If we are in a subprogram that has a static link that -- is passed in (as indicated by ARECnF being defined), -- then generate ARECn.ARECmU := ARECmF where m is -- one less than the current level to set the uplink. if Present (STJ.ARECnF) then Decl_Assign := Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (STJ.ARECn, Loc), Selector_Name => New_Occurrence_Of (STJ.ARECnU, Loc)), Expression => New_Occurrence_Of (STJ.ARECnF, Loc)); Append_To (Decls, Decl_Assign); else Decl_Assign := Empty; end if; if No (Declarations (STJ.Bod)) then Set_Declarations (STJ.Bod, Decls); else Prepend_List_To (Declarations (STJ.Bod), Decls); end if; -- Analyze the newly inserted declarations. Note that we -- do not need to establish the whole scope stack, since -- we have already set all entity fields (so there will -- be no searching of upper scopes to resolve names). But -- we do set the scope of the current subprogram, so that -- newly created entities go in the right entity chain. -- We analyze with all checks suppressed (since we do -- not expect any exceptions). Push_Scope (STJ.Ent); Analyze (Decl_ARECnT, Suppress => All_Checks); -- Note that we need to call Set_Suppress_Initialization -- after Decl_ARECnT has been analyzed, but before -- analyzing Decl_ARECnP so that the flag is properly -- taking into account. Set_Suppress_Initialization (STJ.ARECnT); Analyze (Decl_ARECnPT, Suppress => All_Checks); Analyze (Decl_ARECn, Suppress => All_Checks); Analyze (Decl_ARECnP, Suppress => All_Checks); if Present (Decl_Assign) then Analyze (Decl_Assign, Suppress => All_Checks); end if; Pop_Scope; -- Next step, for each uplevel referenced entity, add -- assignment operations to set the component in the -- activation record. if Present (STJ.Uents) then declare Elmt : Elmt_Id; begin Elmt := First_Elmt (STJ.Uents); while Present (Elmt) loop declare Ent : constant Entity_Id := Node (Elmt); Loc : constant Source_Ptr := Sloc (Ent); Dec : constant Node_Id := Declaration_Node (Ent); Asn : Node_Id; Attr : Name_Id; Comp : Entity_Id; Ins : Node_Id; Rhs : Node_Id; begin -- For parameters, we insert the assignment -- right after the declaration of ARECnP. -- For all other entities, we insert the -- assignment immediately after the -- declaration of the entity or after the -- freeze node if present. -- Note: we don't need to mark the entity -- as being aliased, because the address -- attribute will mark it as Address_Taken, -- and that is good enough. if Is_Formal (Ent) then Ins := Decl_ARECnP; elsif Has_Delayed_Freeze (Ent) then Ins := Freeze_Node (Ent); else Ins := Dec; end if; -- Build and insert the assignment: -- ARECn.nam := nam'Address -- or else 'Access for unconstrained array if Needs_Fat_Pointer (Ent) then Attr := Name_Unchecked_Access; else Attr := Name_Address; end if; Rhs := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Ent, Loc), Attribute_Name => Attr); -- If the entity is an unconstrained formal -- we wrap the attribute reference in an -- unchecked conversion to the type of the -- activation record component, to prevent -- spurious subtype conformance errors within -- instances. if Is_Formal (Ent) and then not Is_Constrained (Etype (Ent)) then -- Find target component and its type Comp := First_Component (STJ.ARECnT); while Chars (Comp) /= Chars (Ent) loop Next_Component (Comp); end loop; Rhs := Unchecked_Convert_To (Etype (Comp), Rhs); end if; Asn := Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (STJ.ARECn, Loc), Selector_Name => New_Occurrence_Of (Activation_Record_Component (Ent), Loc)), Expression => Rhs); -- If we have a loop parameter, we have -- to insert before the first statement -- of the loop. Ins points to the -- N_Loop_Parameter_Specification or to -- an N_Iterator_Specification. if Nkind (Ins) in N_Iterator_Specification | N_Loop_Parameter_Specification then -- Quantified expression are rewritten as -- loops during expansion. if Nkind (Parent (Ins)) = N_Quantified_Expression then null; else Ins := First (Statements (Parent (Parent (Ins)))); Insert_Before (Ins, Asn); end if; else Insert_After (Ins, Asn); end if; -- Analyze the assignment statement. We do -- not need to establish the relevant scope -- stack entries here, because we have -- already set the correct entity references, -- so no name resolution is required, and no -- new entities are created, so we don't even -- need to set the current scope. -- We analyze with all checks suppressed -- (since we do not expect any exceptions). Analyze (Asn, Suppress => All_Checks); end; Next_Elmt (Elmt); end loop; end; end if; end; end if; end; end loop; end Subp_Loop; -- Next step, process uplevel references. This has to be done in a -- separate pass, after completing the processing in Sub_Loop because we -- need all the AREC declarations generated, inserted, and analyzed so -- that the uplevel references can be successfully analyzed. Uplev_Refs : for J in Urefs.First .. Urefs.Last loop declare UPJ : Uref_Entry renames Urefs.Table (J); begin -- Ignore type references, these are implicit references that do -- not need rewriting (e.g. the appearence in a conversion). -- Also ignore if no reference was specified or if the rewriting -- has already been done (this can happen if the N_Identifier -- occurs more than one time in the tree). Also ignore references -- when not generating C code (in particular for the case of LLVM, -- since GNAT-LLVM will handle the processing for up-level refs). if No (UPJ.Ref) or else not Is_Entity_Name (UPJ.Ref) or else not Present (Entity (UPJ.Ref)) or else not Opt.Generate_C_Code then goto Continue; end if; -- Rewrite one reference Rewrite_One_Ref : declare Loc : constant Source_Ptr := Sloc (UPJ.Ref); -- Source location for the reference Typ : constant Entity_Id := Etype (UPJ.Ent); -- The type of the referenced entity Atyp : Entity_Id; -- The actual subtype of the reference RS_Caller : constant SI_Type := Subp_Index (UPJ.Caller); -- Subp_Index for caller containing reference STJR : Subp_Entry renames Subps.Table (RS_Caller); -- Subp_Entry for subprogram containing reference RS_Callee : constant SI_Type := Subp_Index (UPJ.Callee); -- Subp_Index for subprogram containing referenced entity STJE : Subp_Entry renames Subps.Table (RS_Callee); -- Subp_Entry for subprogram containing referenced entity Pfx : Node_Id; Comp : Entity_Id; SI : SI_Type; begin Atyp := Etype (UPJ.Ref); if Ekind (Atyp) /= E_Record_Subtype then Atyp := Get_Actual_Subtype (UPJ.Ref); end if; -- Ignore if no ARECnF entity for enclosing subprogram which -- probably happens as a result of not properly treating -- instance bodies. To be examined ??? -- If this test is omitted, then the compilation of freeze.adb -- and inline.adb fail in unnesting mode. if No (STJR.ARECnF) then goto Continue; end if; -- If this is a reference to a global constant, use its value -- rather than create a reference. It is more efficient and -- furthermore indispensable if the context requires a -- constant, such as a branch of a case statement. if Ekind (UPJ.Ent) = E_Constant and then Is_True_Constant (UPJ.Ent) and then Present (Constant_Value (UPJ.Ent)) and then Is_Static_Expression (Constant_Value (UPJ.Ent)) then Rewrite (UPJ.Ref, New_Copy_Tree (Constant_Value (UPJ.Ent))); goto Continue; end if; -- Push the current scope, so that the pointer type Tnn, and -- any subsidiary entities resulting from the analysis of the -- rewritten reference, go in the right entity chain. Push_Scope (STJR.Ent); -- Now we need to rewrite the reference. We have a reference -- from level STJR.Lev to level STJE.Lev. The general form of -- the rewritten reference for entity X is: -- Typ'Deref (ARECaF.ARECbU.ARECcU.ARECdU....ARECmU.X) -- where a,b,c,d .. m = -- STJR.Lev - 1, STJR.Lev - 2, .. STJE.Lev pragma Assert (STJR.Lev > STJE.Lev); -- Compute the prefix of X. Here are examples to make things -- clear (with parens to show groupings, the prefix is -- everything except the .X at the end). -- level 2 to level 1 -- AREC1F.X -- level 3 to level 1 -- (AREC2F.AREC1U).X -- level 4 to level 1 -- ((AREC3F.AREC2U).AREC1U).X -- level 6 to level 2 -- (((AREC5F.AREC4U).AREC3U).AREC2U).X -- In the above, ARECnF and ARECnU are pointers, so there are -- explicit dereferences required for these occurrences. Pfx := Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (STJR.ARECnF, Loc)); SI := RS_Caller; for L in STJE.Lev .. STJR.Lev - 2 loop SI := Enclosing_Subp (SI); Pfx := Make_Explicit_Dereference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Pfx, Selector_Name => New_Occurrence_Of (Subps.Table (SI).ARECnU, Loc))); end loop; -- Get activation record component (must exist) Comp := Activation_Record_Component (UPJ.Ent); pragma Assert (Present (Comp)); -- Do the replacement. If the component type is an access type, -- this is an uplevel reference for an entity that requires a -- fat pointer, so dereference the component. if Is_Access_Type (Etype (Comp)) then Rewrite (UPJ.Ref, Make_Explicit_Dereference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Pfx, Selector_Name => New_Occurrence_Of (Comp, Loc)))); else Rewrite (UPJ.Ref, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Atyp, Loc), Attribute_Name => Name_Deref, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Pfx, Selector_Name => New_Occurrence_Of (Comp, Loc))))); end if; -- Analyze and resolve the new expression. We do not need to -- establish the relevant scope stack entries here, because we -- have already set all the correct entity references, so no -- name resolution is needed. We have already set the current -- scope, so that any new entities created will be in the right -- scope. -- We analyze with all checks suppressed (since we do not -- expect any exceptions) Analyze_And_Resolve (UPJ.Ref, Typ, Suppress => All_Checks); -- Generate an extra temporary to facilitate the C backend -- processing this dereference if Opt.Modify_Tree_For_C and then Nkind (Parent (UPJ.Ref)) in N_Type_Conversion | N_Unchecked_Type_Conversion then Force_Evaluation (UPJ.Ref, Mode => Strict); end if; Pop_Scope; end Rewrite_One_Ref; end; <<Continue>> null; end loop Uplev_Refs; -- Finally, loop through all calls adding extra actual for the -- activation record where it is required. Adjust_Calls : for J in Calls.First .. Calls.Last loop -- Process a single call, we are only interested in a call to a -- subprogram that actually needs a pointer to an activation record, -- as indicated by the ARECnF entity being set. This excludes the -- top level subprogram, and any subprogram not having uplevel refs. Adjust_One_Call : declare CTJ : Call_Entry renames Calls.Table (J); STF : Subp_Entry renames Subps.Table (Subp_Index (CTJ.Caller)); STT : Subp_Entry renames Subps.Table (Subp_Index (CTJ.Callee)); Loc : constant Source_Ptr := Sloc (CTJ.N); Extra : Node_Id; ExtraP : Node_Id; SubX : SI_Type; Act : Node_Id; begin if Present (STT.ARECnF) and then Nkind (CTJ.N) in N_Subprogram_Call then -- CTJ.N is a call to a subprogram which may require a pointer -- to an activation record. The subprogram containing the call -- is CTJ.From and the subprogram being called is CTJ.To, so we -- have a call from level STF.Lev to level STT.Lev. -- There are three possibilities: -- For a call to the same level, we just pass the activation -- record passed to the calling subprogram. if STF.Lev = STT.Lev then Extra := New_Occurrence_Of (STF.ARECnF, Loc); -- For a call that goes down a level, we pass a pointer to the -- activation record constructed within the caller (which may -- be the outer-level subprogram, but also may be a more deeply -- nested caller). elsif STT.Lev = STF.Lev + 1 then Extra := New_Occurrence_Of (STF.ARECnP, Loc); -- Otherwise we must have an upcall (STT.Lev < STF.LEV), -- since it is not possible to do a downcall of more than -- one level. -- For a call from level STF.Lev to level STT.Lev, we -- have to find the activation record needed by the -- callee. This is as follows: -- ARECaF.ARECbU.ARECcU....ARECmU -- where a,b,c .. m = -- STF.Lev - 1, STF.Lev - 2, STF.Lev - 3 .. STT.Lev else pragma Assert (STT.Lev < STF.Lev); Extra := New_Occurrence_Of (STF.ARECnF, Loc); SubX := Subp_Index (CTJ.Caller); for K in reverse STT.Lev .. STF.Lev - 1 loop SubX := Enclosing_Subp (SubX); Extra := Make_Selected_Component (Loc, Prefix => Extra, Selector_Name => New_Occurrence_Of (Subps.Table (SubX).ARECnU, Loc)); end loop; end if; -- Extra is the additional parameter to be added. Build a -- parameter association that we can append to the actuals. ExtraP := Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of (STT.ARECnF, Loc), Explicit_Actual_Parameter => Extra); if No (Parameter_Associations (CTJ.N)) then Set_Parameter_Associations (CTJ.N, Empty_List); end if; Append (ExtraP, Parameter_Associations (CTJ.N)); -- We need to deal with the actual parameter chain as well. The -- newly added parameter is always the last actual. Act := First_Named_Actual (CTJ.N); if No (Act) then Set_First_Named_Actual (CTJ.N, Extra); -- If call has been relocated (as with an expression in -- an aggregate), set First_Named pointer in original node -- as well, because that's the parent of the parameter list. Set_First_Named_Actual (Parent (List_Containing (ExtraP)), Extra); -- Here we must follow the chain and append the new entry else loop declare PAN : Node_Id; NNA : Node_Id; begin PAN := Parent (Act); pragma Assert (Nkind (PAN) = N_Parameter_Association); NNA := Next_Named_Actual (PAN); if No (NNA) then Set_Next_Named_Actual (PAN, Extra); exit; end if; Act := NNA; end; end loop; end if; -- Analyze and resolve the new actual. We do not need to -- establish the relevant scope stack entries here, because -- we have already set all the correct entity references, so -- no name resolution is needed. -- We analyze with all checks suppressed (since we do not -- expect any exceptions, and also we temporarily turn off -- Unested_Subprogram_Mode to avoid trying to mark uplevel -- references (not needed at this stage, and in fact causes -- a bit of recursive chaos). Opt.Unnest_Subprogram_Mode := False; Analyze_And_Resolve (Extra, Etype (STT.ARECnF), Suppress => All_Checks); Opt.Unnest_Subprogram_Mode := True; end if; end Adjust_One_Call; end loop Adjust_Calls; return; end Unnest_Subprogram; ------------------------ -- Unnest_Subprograms -- ------------------------ procedure Unnest_Subprograms (N : Node_Id) is function Search_Subprograms (N : Node_Id) return Traverse_Result; -- Tree visitor that search for outer level procedures with nested -- subprograms and invokes Unnest_Subprogram() --------------- -- Do_Search -- --------------- procedure Do_Search is new Traverse_Proc (Search_Subprograms); -- Subtree visitor instantiation ------------------------ -- Search_Subprograms -- ------------------------ function Search_Subprograms (N : Node_Id) return Traverse_Result is begin if Nkind (N) in N_Subprogram_Body | N_Subprogram_Body_Stub then declare Spec_Id : constant Entity_Id := Unique_Defining_Entity (N); begin -- We are only interested in subprograms (not generic -- subprograms), that have nested subprograms. if Is_Subprogram (Spec_Id) and then Has_Nested_Subprogram (Spec_Id) and then Is_Library_Level_Entity (Spec_Id) then Unnest_Subprogram (Spec_Id, N); end if; end; -- The proper body of a stub may contain nested subprograms, and -- therefore must be visited explicitly. Nested stubs are examined -- recursively in Visit_Node. elsif Nkind (N) in N_Body_Stub then Do_Search (Library_Unit (N)); -- Skip generic packages elsif Nkind (N) = N_Package_Body and then Ekind (Corresponding_Spec (N)) = E_Generic_Package then return Skip; end if; return OK; end Search_Subprograms; Subp : Entity_Id; Subp_Body : Node_Id; -- Start of processing for Unnest_Subprograms begin if not Opt.Unnest_Subprogram_Mode or not Opt.Expander_Active then return; end if; -- A specification will contain bodies if it contains instantiations so -- examine package or subprogram declaration of the main unit, when it -- is present. if Nkind (Unit (N)) = N_Package_Body or else (Nkind (Unit (N)) = N_Subprogram_Body and then not Acts_As_Spec (N)) then Do_Search (Library_Unit (N)); end if; Do_Search (N); -- Unnest any subprograms passed on the list of inlined subprograms Subp := First_Inlined_Subprogram (N); while Present (Subp) loop Subp_Body := Parent (Declaration_Node (Subp)); if Nkind (Subp_Body) = N_Subprogram_Declaration and then Present (Corresponding_Body (Subp_Body)) then Subp_Body := Parent (Declaration_Node (Corresponding_Body (Subp_Body))); end if; Unnest_Subprogram (Subp, Subp_Body, For_Inline => True); Next_Inlined_Subprogram (Subp); end loop; end Unnest_Subprograms; end Exp_Unst;
----------------------------------------------------------------------- -- Util.Beans.Objects.Enums -- Helper conversion for discrete types -- Copyright (C) 2010 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. ----------------------------------------------------------------------- generic type T is (<>); -- When True, round the integer value held by the object before -- converting it into the type T. ROUND_VALUE : Boolean := False; package Util.Beans.Objects.Enums is -- Create an object from the given value. function To_Object (Value : in T) return Object; -- Convert the object into a value. -- Raises Constraint_Error if the object cannot be converter to the target type. function To_Value (Value : in Util.Beans.Objects.Object) return T; end Util.Beans.Objects.Enums;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; -- Afficher le tarif d'une place procedure Tarif_Place is Age: Integer; -- l'âge de la personne Tarif: Float; -- le tarif à appliquer begin -- Demander l'age Get (Age); -- Déterminer le tarif de la place Tarif := 12.60; if Age < 14 then Tarif := 7.0; elsif Age >= 65 then Tarif := 10.30; end if; -- Afficher le tarif Put ("Le tarif pour "); Put (Age, 1); Put (" ans est "); Put (Tarif, Exp => 0, Aft => 2, Fore => 1); Put (" euros."); New_Line; end Tarif_Place;
pragma License (Unrestricted); -- implementation unit required by compiler package System.Finalization_Root is pragma Pure; -- required for controlled type by compiler (s-finroo.ads) type Root_Controlled is abstract tagged null record; procedure Adjust (Object : in out Root_Controlled) is null; procedure Initialize (Object : in out Root_Controlled) is null; procedure Finalize (Object : in out Root_Controlled) is null; end System.Finalization_Root;
with Debug; use Debug; with Ada.Numerics.Discrete_Random; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; package body Instruction is package Random_OpCode is new Ada.Numerics.Discrete_Random (OpCode); package Random_Reg is new Ada.Numerics.Discrete_Random (Reg); package Random_Offset is new Ada.Numerics.Discrete_Random (Offset); OpCodeG : Random_OpCode.Generator; RegG : Random_Reg.Generator; OffsetG : Random_Offset.Generator; procedure Init is begin Random_OpCode.Reset(OpcodeG); Random_Reg.Reset(RegG); Random_Offset.Reset(OffsetG); end Init; procedure GenerateRandomInstr(Inst : out Instr) is Op : OpCode := Random_OpCode.Random(OpCodeG); R1 : Reg := Random_Reg.Random(RegG); R2 : Reg := Random_Reg.Random(RegG); R3 : Reg := Random_Reg.Random(RegG); Offs : Offset := Random_Offset.Random(OffsetG); begin case Op is when ADD => Inst := (Op => ADD, AddRd => R1, AddRs1 => R2, AddRs2 => R3); return; when SUB => Inst := (Op => SUB, SubRd => R1, SubRs1 => R2, SubRs2 => R3); return; when MUL => Inst := (Op => MUL, MulRd => R1, MulRs1 => R2, MulRs2 => R3); return; when DIV => Inst := (Op => DIV, DivRd => R1, DivRs1 => R2, DivRs2 => R3); return; when RET => Inst := (Op => RET, RetRs => R1); return; when LDR => Inst := (Op => LDR, LdrRd => R1, LdrRs => R2, LdrOffs => Offs); return; when STR => Inst := (Op => STR, StrRa => R1, StrOffs => Offs, StrRb => R2); return; when MOV => Inst := (Op => MOV, MovRd => R1, MovOffs => Offs); return; when JMP => Inst := (Op => JMP, JmpOffs => Offs); return; when JZ => Inst := (Op => JZ, JzRa => R1, JzOffs => Offs); return; when NOP => Inst := (OP => NOP); end case; end GenerateRandomInstr; procedure PutReg(R : in Reg) is begin Put("R"); Put(Item => Integer(R)); end PutReg; procedure PutOffset(Offs : in Offset) is begin Put(Item => Integer(Offs)); end PutOffset; procedure DebugPrintInstr(Inst : in Instr) with SPARK_Mode is begin Put(Instruction.OpCode'Image(Inst.Op)); case Inst.Op is when ADD => Put(HT); PutReg(Inst.AddRd); Put(HT); PutReg(Inst.AddRs1); Put(HT); PutReg(Inst.AddRs2); return; when SUB => Put(HT); PutReg(Inst.SubRd); Put(HT); PutReg(Inst.SubRs1); Put(HT); PutReg(Inst.SubRs2); return; when MUL => Put(HT); PutReg(Inst.MulRd); Put(HT); PutReg(Inst.MulRs1); Put(HT); PutReg(Inst.MulRs2); return; when DIV => Put(HT); PutReg(Inst.DivRd); Put(HT); PutReg(Inst.DivRs1); Put(HT); PutReg(Inst.DivRs2); return; when RET => Put(HT); PutReg(Inst.RetRs); return; when LDR => Put(HT); PutReg(Inst.LdrRd); Put(HT); PutReg(Inst.LdrRs); Put(HT); PutOffset(Inst.LdrOffs); return; when STR => Put(HT); PutReg(Inst.StrRa); Put(HT); PutOffset(Inst.StrOffs); Put(HT); PutReg(Inst.StrRb); return; when MOV => Put(HT); PutReg(Inst.MovRd); Put(HT); PutOffset(Inst.MovOffs); return; when JMP => Put(HT); PutOffset(Inst.JmpOffs); return; when JZ => Put(HT); PutReg(Inst.JzRa); Put(HT); PutOffset(Inst.JzOffs); return; when NOP => return; end case; end DebugPrintInstr; end Instruction;
with Lv.Style; package Lv.Objx.Checkbox is subtype Instance is Obj_T; type Style_T is (Style_Bg, Style_Rel, Style_Pr, Style_Tgl_Rel, Style_Tgl_Pr, Style_Ina); -- Create a check box objects -- @param par pointer to an object, it will be the parent of the new check box -- @param copy pointer to a check box object, if not NULL then the new object will be copied from it -- @return pointer to the created check box function Create (Parent : Obj_T; Copy : Instance) return Instance; ---------------------- -- Setter functions -- ---------------------- -- Set the text of a check box -- @param self pointer to a check box -- @param txt the text of the check box procedure Set_Text (Self : Instance; Txt : C_String_Ptr); -- Set the state of the check box -- @param self pointer to a check box object -- @param checked true: make the check box checked; false: make it unchecked procedure Set_Checked (Self : Instance; Checked : U_Bool); -- Make the check box inactive (disabled) -- @param self pointer to a check box object procedure Set_Inactive (Self : Instance); -- Set a function to call when the check box is clicked -- @param self pointer to a check box object procedure Set_Action (Self : Instance; Action : Action_Func_T); -- Set a style of a check box -- @param self pointer to check box object -- @param type which style should be set -- @param style pointer to a style procedure Set_Style (Self : Instance; Type_P : Style_T; Style : access Lv.Style.Style); ---------------------- -- Getter functions -- ---------------------- -- Get the text of a check box -- @param self pointer to check box object -- @return pointer to the text of the check box function Text (Self : Instance) return C_String_Ptr; -- Get the current state of the check box -- @param self pointer to a check box object -- @return true: checked; false: not checked function Is_Checked (Self : Instance) return U_Bool; -- Get the action of a check box -- @param self pointer to a button object -- @return pointer to the action function function Action (Self : Instance) return Action_Func_T; -- Get a style of a button -- @param self pointer to check box object -- @param type which style should be get -- @return style pointer to the style function Style (Self : Instance; Type_P : Style_T) return access Lv.Style.Style; ------------- -- Imports -- ------------- pragma Import (C, Create, "lv_cb_create"); pragma Import (C, Set_Text, "lv_cb_set_text"); pragma Import (C, Set_Checked, "lv_cb_set_checked_inline"); pragma Import (C, Set_Inactive, "lv_cb_set_inactive_inline"); pragma Import (C, Set_Action, "lv_cb_set_action_inline"); pragma Import (C, Set_Style, "lv_cb_set_style"); pragma Import (C, Text, "lv_cb_get_text"); pragma Import (C, Is_Checked, "lv_cb_is_checked_inline"); pragma Import (C, Action, "lv_cb_get_action_inline"); pragma Import (C, Style, "lv_cb_get_style"); for Style_T'Size use 8; for Style_T use (Style_Bg => 0, Style_Rel => 1, Style_Pr => 2, Style_Tgl_Rel => 3, Style_Tgl_Pr => 4, Style_Ina => 5); end Lv.Objx.Checkbox;
package Unc_Constructor is type C is null record; type A is array (Positive range <>) of C; A0 : constant A; procedure P (X : A); private A0 : aliased constant A := (1 .. 0 => (null record)); end;
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . D E B U G -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1997-2001, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 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. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package encapsulates all direct interfaces to task debugging services -- that are needed by gdb with gnat mode (1.17 and higher) with Interfaces.C; with System.Tasking; with System.OS_Interface; package System.Tasking.Debug is subtype int is Interfaces.C.int; subtype unsigned_long is Interfaces.C.unsigned_long; package ST renames System.Tasking; Known_Tasks : array (0 .. 999) of Task_ID; -- Global array of tasks read by gdb, and updated by -- Create_Task and Finalize_TCB procedure Task_Creation_Hook (Thread : OS_Interface.Thread_Id); -- This procedure is used to notify VxGdb of task's creation. -- It must be called by the task's creator. procedure Task_Termination_Hook; -- This procedure is used to notify VxGdb of task's termination. function Self return Task_ID; -- return system ID of current task procedure List_Tasks; -- Print a list of all the known Ada tasks with abbreviated state -- information, one-per-line, to the standard output file procedure Print_Current_Task; procedure Print_Task_Info_Header; procedure Print_Task_Info (T : Task_ID); -- Write TASK_ID of current task, in hexadecimal, as one line, to -- the standard output file -- -- Beware that Print_Current_Task may print garbage during an early -- stage of activation. There is a small window where a task is just -- initializing itself and has not yet recorded its own task Id. -- -- Beware that Print_Current_Task will either not work at all or print -- garbage if it has interrupted a thread of control that does not -- correspond to any Ada task. For example, this is could happen if -- the debugger interrupts a signal handler that is using an alternate -- stack, or interrupts the dispatcher in the underlying thread -- implementation. procedure Set_User_State (Value : Integer); procedure Print_Accept_Info (T : Task_ID); procedure Trace (Self_ID : Task_ID; Msg : String; Other_ID : Task_ID; Flag : Character); procedure Trace (Self_ID : Task_ID; Msg : String; Flag : Character); procedure Trace (Msg : String; Flag : Character); procedure Trace (Msg : String; Other_ID : Task_ID; Flag : Character); procedure Set_Trace (Flag : Character; Value : Boolean := True); function Image (T : Task_ID) return String; procedure Suspend_All_Tasks (Thread_Self : OS_Interface.Thread_Id); -- Suspend all the tasks except the one whose associated thread is -- Thread_Self by traversing All_Tasks_Lists and calling -- System.Task_Primitives.Operations.Suspend_Task -- Such functionality is needed by gdb on some targets (e.g VxWorks) -- Warning: for efficiency purposes, there is no locking. procedure Resume_All_Tasks (Thread_Self : OS_Interface.Thread_Id); -- Resume all the tasks except the one whose associated thread is -- Thread_Self by traversing All_Tasks_Lists and calling -- System.Task_Primitives.Operations.Continue_Task -- Such functionality is needed by gdb on some targets (e.g VxWorks) -- Warning: for efficiency purposes, there is no locking. end System.Tasking.Debug; ----------------------------- -- Use of These Functions -- ----------------------------- -- Calling complicated functions from the debugger is generally pretty -- risky, especially in a multithreaded program. -- The debugger may interrupt something that is not an Ada task, -- within the thread implementation, and which is not async-safe. -- For example, under Solaris, it can interrupt code in "_dynamiclwps", -- which seems to serve as dispatcher when all the user threads are -- suspended. By experience, we have found that one cannot safely -- do certain things, apparently including calls to thread primitives -- from the debugger if the debugger has interrupted at one of these -- unsafe points. In general, if you interrupt a running program -- asynchronously (e.g. via control-C), it will not be safe to -- call the subprograms in this package. ----------------- -- Future work -- ----------------- -- It would be nice to be able to tell whether execution has been -- interrupted in an Ada task. A heuristic way of checking this would -- be if we added to the Ada TCB a component that always contains a -- constant value that is unlikely to occur accidentally in code or -- data. We could then check this in the debugger-callable subprograms, -- and simply return an error code if it looks unsafe to proceed. -- ??? -- Recently we have added such a marker as a local variable of the -- task-wrapper routine. This allows Self to generate a fake ATCB for -- non-Ada threads of control. Given this capability, it is probably -- time to revisit the issue above. -- DEADLOCK -- We follow a simple rule here to avoid deadlock: -- We do not use any locks in functions called by gdb, and we do not -- traverse linked lists. -- -- The use of an array (Known_Tasks) has many advantages: -- - Easy and fast to examine; -- - No risk of dangling references (to the next element) when traversing -- the array.
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" generic type Index_Type is (<>); type Element_Type is private; with function "+" (Left, Right : Element_Type) return Element_Type is <>; with function "-" (Left, Right : Element_Type) return Element_Type is <>; with function "-" (Left : Element_Type) return Element_Type is <>; with function "*" (Left, Right : Element_Type) return Element_Type is <>; -- not needed currently --with function "/" (Left, Right : Element_Type) return Element_Type is <>; type Vector_Type is array (Index_Type) of aliased Element_Type; package GL.Matrices is pragma Preelaborate; -- this matrix is column-major (i.e. the first index defines the column, -- the second index defines the row). -- this is important for interoperability with GLSL. type Matrix is array (Index_Type, Index_Type) of aliased Element_Type; function "+" (Left, Right : Matrix) return Matrix; function "-" (Left, Right : Matrix) return Matrix; function "-" (Left : Matrix) return Matrix; -- This is not element-wise but mathematical matrix multiplication. function "*" (Left, Right : Matrix) return Matrix; function "*" (Left : Matrix; Right : Vector_Type) return Vector_Type; function "*" (Left : Matrix; Right : Element_Type) return Matrix; function "*" (Left : Element_Type; Right : Matrix) return Matrix; function Transpose (Subject : Matrix) return Matrix; pragma Inline ("+"); pragma Inline ("-"); pragma Inline ("*"); pragma Inline (Transpose); pragma Convention (C, Matrix); end GL.Matrices;
with Ada.Containers.Formal_Hashed_Maps; with Ada.Containers.Functional_Maps; with Assignment_Tree_Branch_Bound_Communication; use Assignment_Tree_Branch_Bound_Communication; with Common; use Common; with LMCP_Messages; use LMCP_Messages; package Assignment_Tree_Branch_Bound with SPARK_Mode is type Cost_Function_Kind is (Minmax, Cumulative); package Int64_UAR_Maps is new Ada.Containers.Formal_Hashed_Maps (Key_Type => Int64, Element_Type => UniqueAutomationRequest, Hash => Int64_Hash); subtype Int64_UniqueAutomationRequest_Map is Int64_UAR_Maps.Map (200, Int64_UAR_Maps.Default_Modulus (200)); use Int64_UAR_Maps; package Int64_TaskPlanOptions_Maps is new Ada.Containers.Functional_Maps (Key_Type => Int64, Element_Type => TaskPlanOptions); type Int64_TPO_Map is new Int64_TaskPlanOptions_Maps.Map; package Int64_TPO_Map_Maps is new Ada.Containers.Formal_Hashed_Maps (Key_Type => Int64, Element_Type => Int64_TPO_Map, Hash => Int64_Hash); subtype Int64_TaskPlanOptions_Map_Map is Int64_TPO_Map_Maps.Map (200, Int64_TPO_Map_Maps.Default_Modulus (200)); use Int64_TPO_Map_Maps; package Int64_ACM_Maps is new Ada.Containers.Formal_Hashed_Maps (Key_Type => Int64, Element_Type => AssignmentCostMatrix, Hash => Int64_Hash); subtype Int64_AssignmentCostMatrix_Map is Int64_ACM_Maps.Map (200, Int64_ACM_Maps.Default_Modulus (200)); use Int64_ACM_Maps; ---------------------------- -- Annotation subprograms -- ---------------------------- function Valid_TaskPlanOptions (TaskPlanOptions_Map : Int64_TPO_Map) return Boolean; function Valid_AssignmentCostMatrix (Assignment_Cost_Matrix : AssignmentCostMatrix) return Boolean; ---------------------------------------- -- Assignment Tree Branch Bound types -- ---------------------------------------- type Assignment_Tree_Branch_Bound_Configuration_Data is record Cost_Function : Cost_Function_Kind := Minmax; Number_Nodes_Maximum : Int64 := 0; end record; type Assignment_Tree_Branch_Bound_State is record m_uniqueAutomationRequests : Int64_UniqueAutomationRequest_Map; m_taskPlanOptions : Int64_TaskPlanOptions_Map_Map; m_assignmentCostMatrixes : Int64_AssignmentCostMatrix_Map; end record with Predicate => (for all ReqId of m_taskPlanOptions => Valid_TaskPlanOptions (Element (m_taskPlanOptions, ReqId))) and then (for all ReqId of m_assignmentCostMatrixes => Valid_AssignmentCostMatrix (Element (m_assignmentCostMatrixes, ReqId))); --------------------------- -- Service functionality -- --------------------------- procedure Handle_Unique_Automation_Request (Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox; Data : Assignment_Tree_Branch_Bound_Configuration_Data; State : in out Assignment_Tree_Branch_Bound_State; Areq : UniqueAutomationRequest) with Pre => not Contains (State.m_uniqueAutomationRequests, Areq.RequestID); procedure Handle_Task_Plan_Options (Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox; Data : Assignment_Tree_Branch_Bound_Configuration_Data; State : in out Assignment_Tree_Branch_Bound_State; Options : TaskPlanOptions) with Pre => (for all TaskOption of Options.Options => (TaskOption.Cost >= 0 and then Options.TaskID = TaskOption.TaskID)) and then (not Contains (State.m_taskPlanOptions, Options.CorrespondingAutomationRequestID) or else not Has_Key (Element (State.m_taskPlanOptions, Options.CorrespondingAutomationRequestID), Options.TaskID)); procedure Handle_Assignment_Cost_Matrix (Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox; Data : Assignment_Tree_Branch_Bound_Configuration_Data; State : in out Assignment_Tree_Branch_Bound_State; Matrix : AssignmentCostMatrix) with Pre => not Contains (State.m_assignmentCostMatrixes, Matrix.CorrespondingAutomationRequestID) and then Valid_AssignmentCostMatrix (Matrix); procedure Check_Assignment_Ready (Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox; Data : Assignment_Tree_Branch_Bound_Configuration_Data; State : in out Assignment_Tree_Branch_Bound_State; ReqId : Int64); procedure Send_TaskAssignmentSummary (Mailbox : in out Assignment_Tree_Branch_Bound_Mailbox; Data : Assignment_Tree_Branch_Bound_Configuration_Data; State : in out Assignment_Tree_Branch_Bound_State; ReqId : Int64) with Pre => Contains (State.m_uniqueAutomationRequests, ReqId) and then Contains (State.m_assignmentCostMatrixes, ReqId) and then Contains (State.m_taskPlanOptions, ReqId) and then (for all TaskId of Element (State.m_uniqueAutomationRequests, ReqId).TaskList => Has_Key (Element (State.m_taskPlanOptions, ReqId), TaskId)) and then Valid_TaskPlanOptions (Element (State.m_taskPlanOptions, ReqId)); procedure Run_Calculate_Assignment (Data : Assignment_Tree_Branch_Bound_Configuration_Data; Automation_Request : UniqueAutomationRequest; Assignment_Cost_Matrix : AssignmentCostMatrix; TaskPlanOptions_Map : Int64_TPO_Map; Summary : out TaskAssignmentSummary) with Pre => Valid_AssignmentCostMatrix (Assignment_Cost_Matrix) and then Valid_TaskPlanOptions (TaskPlanOptions_Map) and then (for all TaskId of Automation_Request.TaskList => Has_Key (TaskPlanOptions_Map, TaskId)) and then (for all Id of TaskPlanOptions_Map => (for all TaskOption of Get (TaskPlanOptions_Map, Id).Options => TaskOption.TaskID = Id)); -- Returns the assignment that minimizes the cost. private function Valid_TaskPlanOptions (TaskPlanOptions_Map : Int64_TPO_Map) return Boolean is (for all TaskId of TaskPlanOptions_Map => (TaskId = Get (TaskPlanOptions_Map, TaskId).TaskID and then (for all TaskOption of Get (TaskPlanOptions_Map, TaskId).Options => (TaskId = TaskOption.TaskID and then TaskOption.Cost >= 0)))); function Valid_AssignmentCostMatrix (Assignment_Cost_Matrix : AssignmentCostMatrix) return Boolean is (for all TOC of Assignment_Cost_Matrix.CostMatrix => TOC.TimeToGo >= 0); end Assignment_Tree_Branch_Bound;
with Ada.Strings.Wide_Wide_Hash; function Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash ( Key : Bounded.Bounded_Wide_Wide_String) return Containers.Hash_Type is begin return Strings.Wide_Wide_Hash (Key.Element (1 .. Key.Length)); end Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash;
----------------------------------------------------------------------- -- awa-components-inputs -- AWA input field component -- 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.Strings.Unbounded; with ASF.Components.Html.Messages; with ASF.Applications.Messages.Vectors; with Util.Beans.Objects; package body AWA.Components.Inputs is use Ada.Strings.Unbounded; -- ------------------------------ -- Render the input field title. -- ------------------------------ procedure Render_Title (UI : in UIInput; Writer : in Response_Writer_Access; Context : in out Faces_Context'Class) is Title : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "title"); begin Writer.Start_Element ("dt"); Writer.Write (Title); Writer.End_Element ("dt"); end Render_Title; -- ------------------------------ -- Render the input component. Starts the DL/DD list and write the input -- component with the possible associated error message. -- ------------------------------ overriding procedure Encode_Begin (UI : in UIInput; Context : in out Faces_Context'Class) is begin if not UI.Is_Rendered (Context) then return; end if; declare Id : constant String := To_String (UI.Get_Client_Id); Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Messages : constant ASF.Applications.Messages.Vectors.Cursor := Context.Get_Messages (Id); Style : constant String := UI.Get_Attribute ("styleClass", Context); begin Writer.Start_Element ("dl"); if ASF.Applications.Messages.Vectors.Has_Element (Messages) then Writer.Write_Attribute ("class", Style & " awa-error"); elsif Style'Length > 0 then Writer.Write_Attribute ("class", Style); end if; UI.Render_Title (Writer, Context); Writer.Start_Element ("dd"); UI.Render_Input (Context); end; end Encode_Begin; -- ------------------------------ -- Render the end of the input component. Closes the DL/DD list. -- ------------------------------ overriding procedure Encode_End (UI : in UIInput; Context : in out Faces_Context'Class) is use ASF.Components.Html.Messages; begin if not UI.Is_Rendered (Context) then return; end if; -- Render the error message associated with the input field. declare Id : constant String := To_String (UI.Get_Client_Id); Writer : constant Response_Writer_Access := Context.Get_Response_Writer; Messages : constant ASF.Applications.Messages.Vectors.Cursor := Context.Get_Messages (Id); begin if ASF.Applications.Messages.Vectors.Has_Element (Messages) then Write_Message (UI, ASF.Applications.Messages.Vectors.Element (Messages), SPAN_NO_STYLE, False, True, Context); end if; Writer.End_Element ("dd"); Writer.End_Element ("dl"); end; end Encode_End; end AWA.Components.Inputs;
with Ada.Text_IO; use Ada.Text_IO; with Common_Formal_Containers; use Common_Formal_Containers; procedure Test is S : Int64_Set; use Int64_Sets; begin Put_Line ("Starting"); Include (S, 1000); Put_Line ("Done"); end Test;
with Ada.Unchecked_Conversion; with C.stdlib; package body System.Native_Locales is use type C.char; use type C.char_array; use type C.char_ptr; use type C.size_t; subtype Fixed_char_array is C.char_array (C.size_t); type char_array_const_ptr is access constant Fixed_char_array with Convention => C; function To_char_array_const_ptr is new Ada.Unchecked_Conversion (C.char_ptr, char_array_const_ptr); -- should it use CFLocaleGetValue in OSX ??? LANG : constant C.char_array := "LANG" & C.char'Val (0); -- implementation function Language return ISO_639_Alpha_2 is P : C.char_ptr; begin P := C.stdlib.getenv (LANG (0)'Access); if P /= null then declare Value : constant char_array_const_ptr := To_char_array_const_ptr (P); Len : C.size_t := 0; begin while Value (Len) in 'a' .. 'z' loop Len := Len + 1; end loop; if Len = 2 then return (1 => Character (Value (0)), 2 => Character (Value (1))); end if; end; end if; return Ada.Locales.ISO_639_Alpha_2_Unknown; end Language; function Language return ISO_639_Alpha_3 is begin return Ada.Locales.To_Alpha_3 (Language); end Language; function Country return ISO_3166_1_Alpha_2 is P : C.char_ptr; begin P := C.stdlib.getenv (LANG (0)'Access); if P /= null then declare Value : constant char_array_const_ptr := To_char_array_const_ptr (P); I : C.size_t := 0; begin while Value (I) /= C.char'Val (0) and then Value (I) /= '.' -- codeset and then Value (I) /= '@' -- modifier loop I := I + 1; end loop; if I >= 2 and then Value (I - 1) in 'A' .. 'Z' and then Value (I - 2) in 'A' .. 'Z' and then (I = 2 or else Value (I - 3) = '_') then return ( 1 => Character (Value (I - 2)), 2 => Character (Value (I - 1))); end if; end; end if; return Ada.Locales.ISO_3166_1_Alpha_2_Unknown; end Country; end System.Native_Locales;
-------------------------------------------------------------------------------- -- -- -- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU Lesser General Public -- -- License as published by the Free Software Foundation; either -- -- version 2.1 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 -- -- Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser 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 -- -- -- -------------------------------------------------------------------------------- -- $Author$ -- $Date$ -- $Revision$ with RASCAL.OS; with RASCAL.TaskManager; with RASCAL.Variable; with RASCAL.UserMessages; Use RASCAL.UserMessages; with RASCAL.Utility; use RASCAL.Utility; with RASCAL.Memory; use RASCAL.Memory; with RASCAL.FileExternal; with Kernel; use Kernel; with Interfaces.C; use Interfaces.C; with Reporter; package body RASCAL.InteractiveHelp is package FileExternal renames RASCAL.FileExternal; -- procedure Run is Wimp_ProcessKey : constant := 16#400DC#; Register : aliased Kernel.swi_regs; Error : oserror_access; Sys_Variable : String := Variable.Get_Value("Help$Dir"); Message : Message_HelpEnable; begin if TaskManager.is_Task("Help") or else TaskManager.is_Task("Info") then SendMessage(Message'Address,17,Message_Event_HelpEnable,0,0,24); Register.R(0):=385; Error := Kernel.swi (Wimp_ProcessKey,register'Access, register'Access); if Error /= null then pragma Debug(Reporter.Report("InteractiveHelp.Run: " & To_Ada(Error.ErrMess))); OS.Raise_Error(Error); end if; else if Sys_Variable'Length > 0 then Call_OS_CLI("Filer_Run <Help$Dir>"); else if FileExternal.Exists ("<Boot$Dir>.^.Apps.!Help") then Call_OS_CLI("Filer_Run <Boot$Dir>.^.Apps.!Help"); elsif FileExternal.Exists ("<Boot$Dir>.^.Apps.!Info") then Call_OS_CLI("Filer_Run <Boot$Dir>.^.Apps.!Info"); elsif FileExternal.Exists ("Resources:$.Apps.!Help") then Call_OS_CLI("Filer_Run Resources:$.Apps.!Help"); elsif FileExternal.Exists ("Resources:$.Apps.!Info") then Call_OS_CLI("Filer_Run Resources:$.Apps.!Info"); else raise Help_Not_Found; end if; end if; end if; end Run; -- end RASCAL.InteractiveHelp;
-- SPDX-FileCopyrightText: 2020-2021 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Nodes.Proxy_Associations; package body Program.Nodes.Proxy_Calls is ----------------- -- Called_Name -- ----------------- overriding function Called_Name (Self : Proxy_Call) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Called_Name; end Called_Name; ------------------------------------- -- Can_Be_Parenthesized_Expression -- ------------------------------------- function Can_Be_Parenthesized_Expression (Self : Proxy_Call'Class) return Boolean is begin for J in Self.Elements.Each_Element loop declare Item : constant Program.Elements.Record_Component_Associations .Record_Component_Association_Access := J.Element.To_Record_Component_Association; begin if Item.Choices.Length /= 0 or else not Item.Component_Value.Assigned or else J.Index > 1 then return False; end if; end; end loop; return Self.Elements.Length = 1; end Can_Be_Parenthesized_Expression; ---------------- -- Components -- ---------------- overriding function Components (Self : Proxy_Call) return Program.Elements.Record_Component_Associations .Record_Component_Association_Vector_Access is begin return Self.This.Components'Unchecked_Access; end Components; ------------ -- Create -- ------------ function Create (Called_Name : Program.Elements.Expressions.Expression_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Element_Vectors.Element_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return Proxy_Call is begin pragma Warnings (Off, "others choice is redundant"); -- gpl 2019 return Self : aliased Proxy_Call := (This => <>, Current => A_Record_Aggregate, Called_Name => Called_Name, Left_Bracket_Token => Left_Bracket_Token, Elements => Parameters, Components => <>, Parameters => <>, Discr => <>, Ranges => <>, Right_Bracket_Token => Right_Bracket_Token, Semicolon_Token => null, Enclosing_Element => null, Text => <>) do if Called_Name.Assigned then Set_Enclosing_Element (Self.Called_Name, Self'Unchecked_Access); end if; for Item in Self.Elements.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; end return; end Create; --------------- -- Delimiter -- --------------- overriding function Delimiter (Self : Base_Vector; Index : Positive) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Parent.Elements.Delimiter (Index); end Delimiter; ------------------- -- Discriminants -- ------------------- overriding function Discriminants (Self : Proxy_Call) return not null Program.Elements.Discriminant_Associations .Discriminant_Association_Vector_Access is begin return Self.This.Discr'Unchecked_Access; end Discriminants; ------------- -- Element -- ------------- overriding function Element (Self : Record_Component_Association_Vector; Index : Positive) return not null Program.Elements.Element_Access is begin return Self.Parent.Elements.Element (Index); end Element; ------------- -- Element -- ------------- overriding function Element (Self : Parameter_Vector; Index : Positive) return not null Program.Elements.Element_Access is begin return Self.Parent.Elements.Element (Index); end Element; ------------- -- Element -- ------------- overriding function Element (Self : Discriminant_Association_Vector; Index : Positive) return not null Program.Elements.Element_Access is begin return Self.Parent.Elements.Element (Index); end Element; ------------- -- Element -- ------------- overriding function Element (Self : Discrete_Range_Vector; Index : Positive) return not null Program.Elements.Element_Access is Result : not null Program.Elements.Element_Access := Self.Parent.Elements.Element (Index); begin if Result.Is_Discrete_Simple_Expression_Range then Result := Program.Nodes.Proxy_Associations.Proxy_Association_Access (Result).Choices.Element (1); end if; return Result; end Element; ---------------- -- Get_Length -- ---------------- overriding function Get_Length (Self : Base_Vector) return Positive is begin return Self.Parent.Elements.Get_Length; end Get_Length; ----------------------- -- Is_Call_Statement -- ----------------------- overriding function Is_Call_Statement (Self : Proxy_Call) return Boolean is begin return Self.Current = A_Call_Statement; end Is_Call_Statement; ------------------- -- Is_Constraint -- ------------------- overriding function Is_Constraint (Self : Proxy_Call) return Boolean is begin return Self.Current in A_Discriminant_Constraint | An_Index_Constraint; end Is_Constraint; ------------------- -- Is_Definition -- ------------------- overriding function Is_Definition (Self : Proxy_Call) return Boolean is begin return Self.Current in A_Discriminant_Constraint | An_Index_Constraint; end Is_Definition; -------------------------------- -- Is_Discriminant_Constraint -- -------------------------------- overriding function Is_Discriminant_Constraint (Self : Proxy_Call) return Boolean is begin return Self.Current = A_Discriminant_Constraint; end Is_Discriminant_Constraint; ------------------- -- Is_Expression -- ------------------- overriding function Is_Expression (Self : Proxy_Call) return Boolean is begin return Self.Current in A_Record_Aggregate | A_Function_Call; end Is_Expression; ---------------------- -- Is_Function_Call -- ---------------------- overriding function Is_Function_Call (Self : Proxy_Call) return Boolean is begin return Self.Current = A_Function_Call; end Is_Function_Call; ------------------------- -- Is_Index_Constraint -- ------------------------- overriding function Is_Index_Constraint (Self : Proxy_Call) return Boolean is begin return Self.Current = An_Index_Constraint; end Is_Index_Constraint; ------------------------- -- Is_Record_Aggregate -- ------------------------- overriding function Is_Record_Aggregate (Self : Proxy_Call) return Boolean is begin return Self.Current = A_Record_Aggregate; end Is_Record_Aggregate; ------------------ -- Is_Statement -- ------------------ overriding function Is_Statement (Self : Proxy_Call) return Boolean is begin return Self.Current = A_Call_Statement; end Is_Statement; ------------------------ -- Left_Bracket_Token -- ------------------------ overriding function Left_Bracket_Token (Self : Proxy_Call) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; ------------------------ -- Left_Bracket_Token -- ------------------------ overriding function Left_Bracket_Token (Self : Proxy_Call_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Parent.Left_Bracket_Token; end Left_Bracket_Token; ---------------- -- Parameters -- ---------------- overriding function Parameters (Self : Proxy_Call) return Program.Elements.Parameter_Associations .Parameter_Association_Vector_Access is begin return Self.This.Parameters'Unchecked_Access; end Parameters; ------------ -- Prefix -- ------------ overriding function Prefix (Self : Proxy_Call) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Called_Name; end Prefix; ------------ -- Ranges -- ------------ overriding function Ranges (Self : Proxy_Call) return not null Program.Elements.Discrete_Ranges .Discrete_Range_Vector_Access is begin return Self.This.Ranges'Unchecked_Access; end Ranges; ------------------------- -- Right_Bracket_Token -- ------------------------- overriding function Right_Bracket_Token (Self : Proxy_Call) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; ------------------------- -- Right_Bracket_Token -- ------------------------- overriding function Right_Bracket_Token (Self : Proxy_Call_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Parent.Right_Bracket_Token; end Right_Bracket_Token; --------------------- -- Semicolon_Token -- --------------------- overriding function Semicolon_Token (Self : Proxy_Call) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; ---------------------------- -- To_Call_Statement_Text -- ---------------------------- overriding function To_Call_Statement_Text (Self : in out Proxy_Call) return Program.Elements.Call_Statements.Call_Statement_Text_Access is begin return Self'Unchecked_Access; end To_Call_Statement_Text; ------------------------------------- -- To_Discriminant_Constraint_Text -- ------------------------------------- overriding function To_Discriminant_Constraint_Text (Self : in out Proxy_Call) return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Text_Access is begin return Self.Text'Unchecked_Access; end To_Discriminant_Constraint_Text; --------------------------- -- To_Function_Call_Text -- --------------------------- overriding function To_Function_Call_Text (Self : in out Proxy_Call) return Program.Elements.Function_Calls.Function_Call_Text_Access is begin return Self'Unchecked_Access; end To_Function_Call_Text; ------------------------------ -- To_Index_Constraint_Text -- ------------------------------ overriding function To_Index_Constraint_Text (Self : in out Proxy_Call) return Program.Elements.Index_Constraints.Index_Constraint_Text_Access is begin return Self.Text'Unchecked_Access; end To_Index_Constraint_Text; ------------------------------ -- To_Record_Aggregate_Text -- ------------------------------ overriding function To_Record_Aggregate_Text (Self : in out Proxy_Call) return Program.Elements.Record_Aggregates.Record_Aggregate_Text_Access is begin return Self.Text'Unchecked_Access; end To_Record_Aggregate_Text; ------------------------------------- -- Turn_To_Discriminant_Constraint -- ------------------------------------- procedure Turn_To_Discriminant_Constraint (Self : in out Proxy_Call'Class; Mark : out Program.Elements.Expressions.Expression_Access) is begin Self.Current := A_Discriminant_Constraint; Mark := Self.Called_Name; for Item in Self.Elements.Each_Element loop Program.Nodes.Proxy_Associations.Proxy_Association_Access (Item.Element).Turn_To_Discriminant_Association; end loop; end Turn_To_Discriminant_Constraint; --------------------------- -- Turn_To_Function_Call -- --------------------------- procedure Turn_To_Function_Call (Self : in out Proxy_Call'Class; Called_Name : not null Program.Elements.Expressions.Expression_Access) is begin Self.Current := A_Function_Call; Self.Called_Name := Called_Name; for Item in Self.Elements.Each_Element loop Program.Nodes.Proxy_Associations.Proxy_Association_Access (Item.Element).Turn_To_Parameter; end loop; end Turn_To_Function_Call; ------------------------------ -- Turn_To_Index_Constraint -- ------------------------------ procedure Turn_To_Index_Constraint (Self : in out Proxy_Call'Class) is begin Self.Current := An_Index_Constraint; for Item in Self.Elements.Each_Element loop Program.Nodes.Proxy_Associations.Proxy_Association_Access (Item.Element).Turn_To_Discrete_Range; end loop; end Turn_To_Index_Constraint; -------------------------------------- -- Turn_To_Parenthesized_Expression -- -------------------------------------- procedure Turn_To_Parenthesized_Expression (Self : in out Proxy_Call'Class) is begin raise Program_Error; end Turn_To_Parenthesized_Expression; ---------------------------- -- Turn_To_Procedure_Call -- ---------------------------- procedure Turn_To_Procedure_Call (Self : in out Proxy_Call'Class; Semicolon_Token : Program.Lexical_Elements.Lexical_Element_Access) is begin Self.Current := A_Call_Statement; Self.Semicolon_Token := Semicolon_Token; end Turn_To_Procedure_Call; ----------- -- Visit -- ----------- overriding procedure Visit (Self : not null access Proxy_Call; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin case Self.Current is when A_Call_Statement => Visitor.Call_Statement (Self); when A_Function_Call => Visitor.Function_Call (Self); when A_Discriminant_Constraint => Visitor.Discriminant_Constraint (Self); when An_Index_Constraint => Visitor.Index_Constraint (Self); when A_Record_Aggregate => Visitor.Record_Aggregate (Self); end case; end Visit; end Program.Nodes.Proxy_Calls;
-- { dg-do compile } -- { dg-options "-O2" } PROCEDURE Array8 IS function ID (I : Integer) return Integer is begin return I; end; SUBTYPE STB IS INTEGER RANGE ID(-8) .. -5; TYPE TB IS ARRAY (STB RANGE <>) OF INTEGER; GENERIC B1 : TB; PROCEDURE PROC1; PROCEDURE PROC1 IS BEGIN IF B1'FIRST /= -8 THEN raise Program_Error; ELSIF B1'LAST /= ID(-5) THEN raise Program_Error; ELSIF B1 /= (7, 6, 5, 4) THEN raise Program_Error; END IF; END; PROCEDURE PROC2 IS NEW PROC1 ((7, 6, ID(5), 4)); BEGIN PROC2; END;
-- Copyright 2021 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. with System; with Gl; use Gl; package Pck is subtype My_Length is Natural range 1 .. Length; type My_Array is array (My_Length) of Natural; N_A : Integer := 2; N_T : Integer := 2; type Arr is array (Positive range <>) of Integer; type Inner is record A1 : Arr (1 .. N_A); A2 : Arr (1 .. N_A); end record; type Inner_Arr is array (Positive range <>) of Inner; type Outer is record A : Inner_Arr (1 .. N_T); end record; procedure Do_Nothing (A : System.Address); end Pck;
-- -- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.debug; with soc.rng; package body ewok.rng with spark_mode => off is procedure random_array (tab : out unsigned_8_array; success : out boolean) is rand : unsigned_32; rand_bytes : unsigned_8_array (1 .. 4) with address => rand'address, size => 4 * byte'size; index : unsigned_32; ok : boolean; begin index := tab'first; while index < tab'last loop soc.rng.random (rand, ok); if not ok then pragma DEBUG (debug.log (debug.ERROR, "RNG failed!")); success := false; return; end if; if index + 3 <= tab'last then tab(index .. index + 3) := rand_bytes; else tab(index .. tab'last) := rand_bytes(1 .. tab'last - index + 1); end if; index := index + 4; end loop; success := true; end random_array; procedure random (rand : out unsigned_32; success : out boolean) is begin soc.rng.random (rand, success); if not success then pragma DEBUG (debug.log (debug.ERROR, "RNG failed!")); end if; end random; end ewok.rng;
-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Characters.Wide_Wide_Latin_1; with Ada.Directories; with Ada.Streams; with GNAT.OS_Lib; with League.JSON.Values; with League.Text_Codecs; with Spawn.Processes.Monitor_Loop; with Magics.ALR; with Magics.Gprbuild_Options; with Magics.Ls_Magic; with Magics.Output; with Magics.Write_File; with Ada_Kernels.Configuration; package body Ada_Kernels is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; function "-" (Text : Wide_Wide_String) return League.JSON.Values.JSON_Value is (League.JSON.Values.To_JSON_Value (+Text)); function "&" (Left : League.String_Vectors.Universal_String_Vector; Text : League.Strings.Universal_String) return League.String_Vectors.Universal_String_Vector; procedure Parse_Line_Magic (Code : League.Strings.Universal_String; Args : out League.String_Vectors.Universal_String_Vector); -- Extract one line magic from Code, split it and put it into Args. procedure Parse_Block_Magic (Code : League.Strings.Universal_String; Args : out League.String_Vectors.Universal_String_Vector; Text : out League.Strings.Universal_String); -- Extract block magic from the first line of the Code into Args and return -- rest of the Code in Text. function Find_In_Path (File : String) return League.Strings.Universal_String; procedure Execute_Magic (Self : aliased in out Session'Class; IO_Pub : not null Jupyter.Kernels.IO_Pub_Access; Execution_Counter : Positive; Magic : League.String_Vectors.Universal_String_Vector; Silent : Boolean; Error : in out Jupyter.Kernels.Execution_Error; Block : League.Strings.Universal_String := League.Strings.Empty_Universal_String); -- Execute one line magic command. procedure With_Clause_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Error : out League.Strings.Universal_String); -- Check if given Code is a `clause` before a compilation unit procedure Launch_Cell (Self : in out Session'Class; GPR : League.Strings.Universal_String; Lib : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String); -- Make a Lib library using given GPR and load it into driver. Return -- Error and Text. procedure Statements_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String); -- Check if given Code is a statement sequence procedure Declarations_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String); -- Check if given Code is a statement sequence procedure Compilation_Unit_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String); -- Check if given Code is a compilation unit sequence procedure Read_File (Name : League.Strings.Universal_String; Text : out League.Strings.Universal_String); procedure Write_File (Name : League.Strings.Universal_String; Text : League.Strings.Universal_String); function Format (Pattern : League.Strings.Universal_String; Args : League.String_Vectors.Universal_String_Vector) return League.Strings.Universal_String; function Format (Pattern : League.Strings.Universal_String; Arg : League.Strings.Universal_String) return League.Strings.Universal_String; function Format (Pattern : League.Strings.Universal_String; Arg_1 : League.Strings.Universal_String; Arg_2 : League.Strings.Universal_String; Arg_3 : League.Strings.Universal_String := League.Strings.Empty_Universal_String; Arg_4 : League.Strings.Universal_String := League.Strings.Empty_Universal_String; Arg_5 : League.Strings.Universal_String := League.Strings.Empty_Universal_String) return League.Strings.Universal_String; function Image (Value : Natural) return League.Strings.Universal_String; type Cell_Kind is (With_Cell, Execute_Cell, Run_Cell, Run_Cell_Spec); procedure Create_Project_File (Self : aliased in out Session'Class; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Cell_Kind : Ada_Kernels.Cell_Kind; Result : out League.Strings.Universal_String); function With_Runs (Self : Session'Class) return League.Strings.Universal_String; -- For each post run return `with Run_$; use Run_$;` clauses function To_Spec (Text : League.Strings.Universal_String) return League.Strings.Universal_String; -- Turn Text of a subprogram body return corresponding specification Line_Feed : constant Wide_Wide_Character := Ada.Characters.Wide_Wide_Latin_1.LF; UTF_8 : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec (+"UTF-8"); SO_Extension : Wide_Wide_String renames Ada_Kernels.Configuration.Shared_Library_Suffix; --------- -- "&" -- --------- function "&" (Left : League.String_Vectors.Universal_String_Vector; Text : League.Strings.Universal_String) return League.String_Vectors.Universal_String_Vector is begin return Result : League.String_Vectors.Universal_String_Vector := Left do Result.Append (Text); end return; end "&"; ------------ -- Append -- ------------ procedure Append (Args : in out League.String_Vectors.Universal_String_Vector; Option : Gprbuild_Options) is procedure Append_Section (Name : Wide_Wide_String; Value : League.String_Vectors.Universal_String_Vector); procedure Append_Section (Name : Wide_Wide_String; Value : League.String_Vectors.Universal_String_Vector) is begin if not Value.Is_Empty then Args.Append (+Name); Args.Append (Value); end if; end Append_Section; begin Args.Append (Option.Gargs); Append_Section ("-cargs", Option.Cargs); Append_Section ("-largs", Option.Largs); Append_Section ("-bargs", Option.Bargs); end Append; ---------------------------- -- Compilation_Unit_Probe -- ---------------------------- procedure Compilation_Unit_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String) is pragma Unreferenced (Text); use type League.Strings.Universal_String; GPR : League.Strings.Universal_String; Args : League.String_Vectors.Universal_String_Vector; Output : League.Strings.Universal_String; Errors : League.Strings.Universal_String; Name : League.Strings.Universal_String; Value : League.Strings.Universal_String; Spec : constant League.Strings.Universal_String := Dir & Format (+"run_$.ads", Run); Impl : constant League.Strings.Universal_String := Dir & Format (+"run_$.adb", Run); Status : Integer; Names : League.String_Vectors.Universal_String_Vector; Clauses : constant League.Strings.Universal_String := Self.Clauses.Join (Line_Feed); Has_Spec : Boolean := False; Has_Body : Boolean := False; begin Write_File (Dir & "code", Code); Args.Append (+"-w"); Args.Append (Dir & "code"); Args.Append (Dir); Processes.Run (Program => Self.Gnatchop, Arguments => Args, Env => Self.Build_Env, Directory => Dir, Output => Output, Errors => Errors, Status => Status); Names := Output.Split (Line_Feed); for J in 1 .. Names.Length loop Name := Names (J); if Name.Starts_With (" ") then Name := Name.Tail_From (4); Read_File (Name, Value); Ada.Directories.Delete_File (Name.To_UTF_8_String); if Name.Ends_With (".ads") then Write_File (Spec, Clauses & Self.With_Runs & Format (+"package Run_$ is $ end;", Run, Value)); Has_Spec := True; else if not Has_Spec then Write_File (Spec, Clauses & Self.With_Runs & Format (+"package Run_$ is $ end;", Run, To_Spec (Value))); end if; Write_File (Impl, Format (+"package body Run_$ is $ end;", Run, Value)); Has_Body := True; end if; end if; end loop; if Has_Body then Self.Create_Project_File (Dir, Run, Run_Cell, GPR); elsif Has_Spec then Self.Create_Project_File (Dir, Run, Run_Cell_Spec, GPR); else Error := Errors; return; end if; Self.Launch_Cell (GPR, Format (+"$.libs/libjasrun_$" & SO_Extension, Dir, Run), Text, Error); if Error.Is_Empty then Self.Runs.Append (Run); end if; end Compilation_Unit_Probe; ------------------------- -- Create_Project_File -- ------------------------- procedure Create_Project_File (Self : aliased in out Session'Class; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Cell_Kind : Ada_Kernels.Cell_Kind; Result : out League.Strings.Universal_String) is use type League.Strings.Universal_String; Lines : League.String_Vectors.Universal_String_Vector; Kind : League.Strings.Universal_String := +Cell_Kind'Wide_Wide_Image; Name : League.Strings.Universal_String; Src : League.Strings.Universal_String; Comp : League.Strings.Universal_String; Bind : League.Strings.Universal_String; begin case Cell_Kind is when With_Cell => Src := +"Unit & "".adb"""; Kind := +"with"; when Execute_Cell => Src := +"Unit & "".ads"", Unit & "".adb"""; Kind := +"execute"; when Run_Cell => Src := +"Unit & "".ads"", Unit & "".adb"""; Kind := +"run"; when Run_Cell_Spec => Src := +"Unit & "".ads"""; Kind := +"run"; end case; Lines.Append (+"with ""../notebook.gpr"";"); for J in 1 .. Self.Runs.Length loop Lines := Lines & Format (+"with ""../.run$/run_$.gpr"";", Self.Runs (J)); end loop; Comp := +"""-gnatW8"", ""-gnatVa"", ""-fstack-check"", ""-gnatv"", ""-g"""; Bind := +"""-W8"", ""-E"""; Name := Format (+"$_$", Kind, Run); Result := Dir & Name & ".gpr"; Lines := Lines & Format (+"project $ is", Name) & Format (+" Unit := ""$"";", Name) & Format (+" for Source_Files use ($);", Src) & Format (+" for Object_Dir use ""$.objs"";", Dir) & Format (+" for Library_Dir use ""$.libs"";", Dir) & (+" for Library_Kind use ""dynamic"";") & (+" for Library_Interface use (Unit);") & Format (+" for Library_Name use ""jas$"";", Name) & (+" package Compiler is") & Format (+" for Default_Switches (""Ada"") use ($);", Comp) & (+" end Compiler;") & (+" package Binder is") & Format (+" for Switches (""Ada"") use ($);", Bind) & (+" end Binder;") & Format (+"end $;", Name); Write_File (Result, Lines.Join (Line_Feed)); end Create_Project_File; -------------------- -- Create_Session -- -------------------- overriding procedure Create_Session (Self : aliased in out Kernel; Session_Id : Positive; Result : out Jupyter.Kernels.Session_Access) is use type League.Strings.Universal_String; procedure ALR_Init (Dir : League.Strings.Universal_String); procedure ALR_Init (Dir : League.Strings.Universal_String) is Args : League.String_Vectors.Universal_String_Vector; Output : League.Strings.Universal_String; Errors : League.Strings.Universal_String; Status : Integer; begin Args.Append (+"--non-interactive"); Args.Append (+"--no-tty"); Args.Append (+"--no-color"); Args.Append (+"init"); Args.Append (+"--in-place"); Args.Append (+"--no-skel"); Args.Append (+"--lib"); Args.Append (+"notebook"); Processes.Run (Program => Self.ALR, Arguments => Args, Directory => Dir, Output => Output, Errors => Errors, Status => Status); if Status /= 0 then Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, Output.To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Put_Line (Ada.Wide_Wide_Text_IO.Standard_Error, Errors.To_Wide_Wide_String); end if; pragma Assert (Status = 0); end ALR_Init; Dir : League.Strings.Universal_String := Self.Top_Dir; Object : constant Session_Access := new Session; PID : constant Natural := GNAT.OS_Lib.Pid_To_Integer (GNAT.OS_Lib.Current_Process_Id); begin Dir.Append (Image (PID)); Object.Directory.Append (Dir); Object.Directory.Append (Image (Session_Id)); Ada.Directories.Create_Path (Object.Directory.To_UTF_8_String); Object.Directory.Append ('/'); Object.Gprbuild.Path := Self.Gprbuild; Object.Gnatchop := Self.Gnatchop; Object.ALR := Self.ALR; Self.Map.Insert (Session_Id, Object); if not Self.ALR.Is_Empty then ALR_Init (Object.Directory); end if; Write_File (Object.Directory & "notebook.gpr", +"abstract project Notebook is end Notebook;"); Object.Process.Set_Working_Directory (Object.Directory.To_UTF_8_String); Object.Process.Set_Program (Self.Driver.To_UTF_8_String); Object.Process.Set_Listener (Spawn.Processes.Process_Listener_Access (Object)); Object.Process.Start; Ada.Wide_Wide_Text_IO.Create (Object.Trace, Name => Object.Directory.To_UTF_8_String & "trace.log"); Result := Jupyter.Kernels.Session_Access (Object); end Create_Session; ------------------------ -- Declarations_Probe -- ------------------------ procedure Declarations_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String) is use type League.Strings.Universal_String; GPR : League.Strings.Universal_String; Clauses : constant League.Strings.Universal_String := Self.Clauses.Join (Line_Feed); begin Write_File (Dir & Format (+"run_$.ads", Run), Clauses & Self.With_Runs & Format (+"package Run_$ is $ end;", Run, Code)); Self.Create_Project_File (Dir, Run, Run_Cell_Spec, GPR); Self.Launch_Cell (GPR, Format (+"$.libs/libjasrun_$" & SO_Extension, Dir, Run), Text, Error); if Error.Is_Empty then Self.Runs.Append (Run); end if; end Declarations_Probe; -------------------- -- Error_Occurred -- -------------------- overriding procedure Error_Occurred (Self : in out Session; Process_Error : Integer) is pragma Unreferenced (Process_Error); begin Self.Finished := True; end Error_Occurred; ------------------------ -- Exception_Occurred -- ------------------------ overriding procedure Exception_Occurred (Self : in out Session; Occurrence : Ada.Exceptions.Exception_Occurrence) is pragma Unreferenced (Occurrence); begin Self.Finished := True; end Exception_Occurred; ------------- -- Execute -- ------------- overriding procedure Execute (Self : aliased in out Session; IO_Pub : not null Jupyter.Kernels.IO_Pub_Access; Execution_Counter : Positive; Code : League.Strings.Universal_String; Silent : Boolean; User_Expressions : League.JSON.Objects.JSON_Object; Allow_Stdin : Boolean; Stop_On_Error : Boolean; Expression_Values : out League.JSON.Objects.JSON_Object; Error : in out Jupyter.Kernels.Execution_Error) is pragma Unreferenced (User_Expressions, Allow_Stdin, Stop_On_Error, Expression_Values); use type League.Strings.Universal_String; With_Error : League.Strings.Universal_String; Stmt_Error : League.Strings.Universal_String; Decl_Error : League.Strings.Universal_String; Unit_Error : League.Strings.Universal_String; Data : League.JSON.Objects.JSON_Object; Meta : League.JSON.Objects.JSON_Object; Text : League.Strings.Universal_String; Run : constant League.Strings.Universal_String := Image (Execution_Counter); Dir : constant League.Strings.Universal_String := Self.Directory & ".run" & Run & "/"; begin Self.IO_Pub := IO_Pub; declare Magic : League.String_Vectors.Universal_String_Vector; Block : League.Strings.Universal_String; begin Parse_Line_Magic (Code, Magic); if Magic.Length >= 1 then Self.Execute_Magic (IO_Pub, Execution_Counter, Magic, Silent, Error); return; end if; Parse_Block_Magic (Code, Magic, Block); if Magic.Length >= 1 then Self.Execute_Magic (IO_Pub, Execution_Counter, Magic, Silent, Error, Block); return; end if; end; Ada.Directories.Create_Path (Dir.To_UTF_8_String & "/.objs"); Ada.Directories.Create_Path (Dir.To_UTF_8_String & "/.libs"); Self.With_Clause_Probe (Code, Dir, Run, With_Error); if not With_Error.Is_Empty then Self.Statements_Probe (Code, Dir, Run, Text, Stmt_Error); if not Stmt_Error.Is_Empty then Self.Declarations_Probe (Code, Dir, Run, Text, Decl_Error); if not Decl_Error.Is_Empty then Self.Compilation_Unit_Probe (Code, Dir, Run, Text, Unit_Error); end if; end if; end if; Expression_Values := League.JSON.Objects.Empty_JSON_Object; if not Unit_Error.Is_Empty then Text := +"Unable to process. Program state doesn't change!"; Text.Append (Line_Feed); Text.Append (Line_Feed); Text.Append ("Errors for context clauses probe:"); Text.Append (Line_Feed); Text.Append (With_Error); Text.Append (Line_Feed); Text.Append (Line_Feed); Text.Append ("Errors for statements probe:"); Text.Append (Line_Feed); Text.Append (Stmt_Error); Text.Append (Line_Feed); Text.Append (Line_Feed); Text.Append ("Errors for basic declarative items probe:"); Text.Append (Line_Feed); Text.Append (Decl_Error); Text.Append (Line_Feed); Text.Append (Line_Feed); Text.Append ("Errors for compilation unit probe:"); Text.Append (Line_Feed); Text.Append (Unit_Error); Text.Append (Line_Feed); IO_Pub.Stream (Name => +"stderr", Text => Text); Error.Name := +"CompilationFailed"; Error.Value := Text; elsif not Silent and not Text.Is_Empty then Data.Insert (+"text/plain", League.JSON.Values.To_JSON_Value (Text)); IO_Pub.Execute_Result (Data => Data, Metadata => Meta, Transient => League.JSON.Objects.Empty_JSON_Object); end if; end Execute; ------------------- -- Execute_Magic -- ------------------- procedure Execute_Magic (Self : aliased in out Session'Class; IO_Pub : not null Jupyter.Kernels.IO_Pub_Access; Execution_Counter : Positive; Magic : League.String_Vectors.Universal_String_Vector; Silent : Boolean; Error : in out Jupyter.Kernels.Execution_Error; Block : League.Strings.Universal_String := League.Strings.Empty_Universal_String) is pragma Unreferenced (Execution_Counter); use type League.Strings.Universal_String; Info : League.Strings.Universal_String; First : League.Strings.Universal_String := Magic (1); Help : constant Boolean := First.Ends_With ("?"); begin if Help then First := First.Head_To (First.Length - 1); -- String '?' if any end if; if First = +"%alr" then if Help then Info := (First & " {options}") & Line_Feed & Line_Feed & "Execute alr {options} to manage project dependencies."; else Magics.ALR (IO_Pub, Self.ALR, Self.Directory, Magic.Slice (2, Magic.Length), Self.Build_Env, Silent); end if; elsif First = +"%lsmagic" then if Help then Info := +"List currently available magic functions."; else Magics.Ls_Magic (IO_Pub, Silent); end if; elsif First.To_Wide_Wide_String in "%gargs" | "%cargs" | "%largs" | "%bargs" then if Help then Info := (First & " {options}") & Line_Feed & Line_Feed & "Setup additional options for gprbuild in a -" & First.Tail_From (2) & " section or reset if no option given."; elsif First.Starts_With ("%g") then Magics.Gprbuild_Options (IO_Pub, Silent, Self.Gprbuild.Gargs, +"-gargs", Magic.Slice (2, Magic.Length)); elsif First.Starts_With ("%c") then Magics.Gprbuild_Options (IO_Pub, Silent, Self.Gprbuild.Cargs, +"-cargs", Magic.Slice (2, Magic.Length)); elsif First.Starts_With ("%l") then Magics.Gprbuild_Options (IO_Pub, Silent, Self.Gprbuild.Largs, +"-largs", Magic.Slice (2, Magic.Length)); elsif First.Starts_With ("%b") then Magics.Gprbuild_Options (IO_Pub, Silent, Self.Gprbuild.Bargs, +"-bargs", Magic.Slice (2, Magic.Length)); else null; end if; elsif First = +"%%output" then if Help then Info := (+"%%output MIME-type") & Line_Feed & Line_Feed & "Render the cell as a content of the given MIME-type."; elsif Magic.Length = 2 then Magics.Output (IO_Pub, Magic (2), Block, Silent); else Error.Name := +"UsageError"; Error.Value := +"Run: %%output MIME-type."; IO_Pub.Stream (Name => +"stderr", Text => Error.Name & ": " & Error.Value); end if; elsif First = +"%%writefile" then if Help then Info := (+"%%writefile filename") & Line_Feed & Line_Feed & "Write the contents of the cell to a file."; elsif Magic.Length = 2 then Magics.Write_File (IO_Pub, Magic (2), Block, Silent); else Error.Name := +"UsageError"; Error.Value := +"Run: %%writefile <filename>."; IO_Pub.Stream (Name => +"stderr", Text => Error.Name & ": " & Error.Value); end if; else Error.Name := +"UsageError"; Error.Value := "Magic function `" & First & "` not found." & Line_Feed & Line_Feed & "Use %lsmagic to list available magic functions."; IO_Pub.Stream (Name => +"stderr", Text => Error.Name & ": " & Error.Value); end if; if not Info.Is_Empty then IO_Pub.Stream (Name => +"stderr", Text => Info); end if; end Execute_Magic; ------------------- -- Find_Gprbuild -- ------------------- function Find_In_Path (File : String) return League.Strings.Universal_String is use type GNAT.OS_Lib.String_Access; Found : GNAT.OS_Lib.String_Access; Result : League.Strings.Universal_String; begin Found := GNAT.OS_Lib.Locate_Exec_On_Path (File); if Found /= null then Result := League.Strings.From_UTF_8_String (Found.all); GNAT.OS_Lib.Free (Found); end if; return Result; end Find_In_Path; -------------- -- Finished -- -------------- overriding procedure Finished (Self : in out Session; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code) is pragma Unreferenced (Exit_Status, Exit_Code); begin Self.Finished := True; end Finished; ------------ -- Format -- ------------ function Format (Pattern : League.Strings.Universal_String; Args : League.String_Vectors.Universal_String_Vector) return League.Strings.Universal_String is List : constant League.String_Vectors.Universal_String_Vector := Pattern.Split ('$'); Result : League.Strings.Universal_String := List (1); begin for J in 2 .. List.Length loop Result.Append (Args (J - 1)); Result.Append (List (J)); end loop; return Result; end Format; ------------ -- Format -- ------------ function Format (Pattern : League.Strings.Universal_String; Arg : League.Strings.Universal_String) return League.Strings.Universal_String is List : League.String_Vectors.Universal_String_Vector; begin for J in 1 .. Pattern.Count ('$') loop List.Append (Arg); end loop; return Format (Pattern, List); end Format; ------------ -- Format -- ------------ function Format (Pattern : League.Strings.Universal_String; Arg_1 : League.Strings.Universal_String; Arg_2 : League.Strings.Universal_String; Arg_3 : League.Strings.Universal_String := League.Strings.Empty_Universal_String; Arg_4 : League.Strings.Universal_String := League.Strings.Empty_Universal_String; Arg_5 : League.Strings.Universal_String := League.Strings.Empty_Universal_String) return League.Strings.Universal_String is List : League.String_Vectors.Universal_String_Vector; begin List.Append (Arg_1); List.Append (Arg_2); List.Append (Arg_3); List.Append (Arg_4); List.Append (Arg_5); return Format (Pattern, List); end Format; ----------------- -- Get_Session -- ----------------- overriding function Get_Session (Self : aliased in out Kernel; Session_Id : Positive) return Jupyter.Kernels.Session_Access is Result : constant Session_Access := Self.Map (Session_Id); begin return Jupyter.Kernels.Session_Access (Result); end Get_Session; ----------- -- Image -- ----------- function Image (Value : Natural) return League.Strings.Universal_String is Text : constant Wide_Wide_String := Value'Wide_Wide_Image; begin return +Text (2 .. Text'Last); end Image; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Kernel'Class; Top_Dir : League.Strings.Universal_String; Error : out League.Strings.Universal_String) is begin Self.Top_Dir := Top_Dir; Self.Gprbuild := Find_In_Path ("gprbuild"); Self.Gnatchop := Find_In_Path ("gnatchop"); Self.ALR := Find_In_Path ("alr"); Self.Driver := Find_In_Path ("ada_driver"); if Self.Gprbuild.Is_Empty then Error.Append ("No `gprbuild` in the PATH"); elsif Self.Gnatchop.Is_Empty then Error.Append ("No `gnatchop` in the PATH"); elsif Self.Driver.Is_Empty then Error.Append ("No `ada_driver` in the PATH"); end if; end Initialize; ----------------- -- Kernel_Info -- ----------------- overriding procedure Kernel_Info (Self : aliased in out Kernel; Result : out League.JSON.Objects.JSON_Object) is pragma Unreferenced (Self); Language : League.JSON.Objects.JSON_Object; begin Language.Insert (+"name", -"Ada"); Language.Insert (+"version", -"2012"); Language.Insert (+"mimetype", -"text/x-ada"); Language.Insert (+"file_extension", -".adb"); Language.Insert (+"pygments_lexer", -"ada"); Language.Insert (+"codemirror_mode", -"ada"); Result.Insert (+"protocol_version", -"5.3"); Result.Insert (+"implementation", -"dummy"); Result.Insert (+"implementation_version", -"0.1.0"); Result.Insert (+"language_info", Language.To_JSON_Value); Result.Insert (+"banner", -"Some banner."); Result.Insert (+"status", -"ok"); end Kernel_Info; ----------------- -- Launch_Cell -- ----------------- procedure Launch_Cell (Self : in out Session'Class; GPR : League.Strings.Universal_String; Lib : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String) is use type League.Strings.Universal_String; Args : League.String_Vectors.Universal_String_Vector; Listing : League.Strings.Universal_String; Errors : League.Strings.Universal_String; Status : Integer; begin Args.Append (+"-p"); Args.Append ("-P" & GPR); Append (Args, Self.Gprbuild); -- Append custom options Processes.Run (Program => Self.Gprbuild.Path, Arguments => Args, Env => Self.Build_Env, Directory => Self.Directory, Output => Listing, Errors => Errors, Status => Status); if Status = 0 then declare Load : League.Strings.Universal_String; Ignore : Ada.Streams.Stream_Element_Offset; Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec (+"UTF-8"); begin Load := Format (+"Load $", Lib); Ada.Wide_Wide_Text_IO.Put_Line (Self.Trace, Load.To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Flush (Self.Trace); Load.Append (Line_Feed); Self.Process.Write_Standard_Input (Codec.Encode (Load).To_Stream_Element_Array, Ignore); Self.Ready := False; while not Self.Ready loop Spawn.Processes.Monitor_Loop (Timeout => 50); end loop; Text := UTF_8.Decode (Self.Stdout); Self.Stdout.Clear; end; else Error := Listing; end if; end Launch_Cell; ----------------------- -- Parse_Block_Magic -- ----------------------- procedure Parse_Block_Magic (Code : League.Strings.Universal_String; Args : out League.String_Vectors.Universal_String_Vector; Text : out League.Strings.Universal_String) is Pos : constant Natural := Code.Index (Line_Feed); begin if Pos = 0 then Args := Code.Split (' '); Text.Clear; else Args := Code.Head_To (Pos - 1).Split (' '); Text := Code.Tail_From (Pos + 1); end if; if Args.Length >= 1 then if not Args (1).Starts_With ("%%") then Args.Clear; end if; end if; end Parse_Block_Magic; ---------------------- -- Parse_Line_Magic -- ---------------------- procedure Parse_Line_Magic (Code : League.Strings.Universal_String; Args : out League.String_Vectors.Universal_String_Vector) is Lines : constant League.String_Vectors.Universal_String_Vector := Code.Split (Line_Feed, League.Strings.Skip_Empty); begin for J in 1 .. Lines.Length loop declare Line : constant League.Strings.Universal_String := Lines (J); Words : constant League.String_Vectors.Universal_String_Vector := Line.Split (' ', League.Strings.Skip_Empty); begin if Line.Starts_With ("%") and not Line.Starts_With ("%%") then Args := Words; exit; end if; end; end loop; end Parse_Line_Magic; --------------- -- Read_File -- --------------- procedure Read_File (Name : League.Strings.Universal_String; Text : out League.Strings.Universal_String) is Input : Ada.Wide_Wide_Text_IO.File_Type; begin Ada.Wide_Wide_Text_IO.Open (Input, Mode => Ada.Wide_Wide_Text_IO.In_File, Name => Name.To_UTF_8_String, Form => "WCEM=8"); Text.Clear; while not Ada.Wide_Wide_Text_IO.End_Of_File (Input) loop Text.Append (Ada.Wide_Wide_Text_IO.Get_Line (Input)); Text.Append (Line_Feed); end loop; Ada.Wide_Wide_Text_IO.Close (Input); end Read_File; ------------------------------ -- Standard_Error_Available -- ------------------------------ overriding procedure Standard_Error_Available (Self : in out Session) is use type Ada.Streams.Stream_Element; use type Ada.Streams.Stream_Element_Count; use type Jupyter.Kernels.IO_Pub_Access; procedure Append (Data : Ada.Streams.Stream_Element_Array); procedure On_Service_Message; ------------ -- Append -- ------------ procedure Append (Data : Ada.Streams.Stream_Element_Array) is begin if Self.Injected then Self.Service.Append (Data); else Self.Stderr.Append (Data); end if; end Append; procedure On_Service_Message is Text : constant League.Strings.Universal_String := UTF_8.Decode (Self.Service); begin if Text.Starts_With ("%jad_error:") then Self.IO_Pub.Stream (+"stderr", Text.Tail_From (12)); elsif Text.Starts_With ("%jad_bad:") then Self.IO_Pub.Stream (+"stderr", Text.Tail_From (10)); elsif Text.Starts_With ("%jad_ready") then Self.Ready := True; else raise Program_Error with Text.To_UTF_8_String; end if; Self.Service.Clear; end On_Service_Message; begin loop declare Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; From : Ada.Streams.Stream_Element_Count := 1; begin Self.Process.Read_Standard_Error (Data, Last); exit when Last < Data'First; for J in 1 .. Last loop if Data (J) = 0 then Append (Data (From .. J - 1)); if Self.Injected then On_Service_Message; end if; Self.Injected := not Self.Injected; From := J + 1; end if; end loop; if From <= Last then Append (Data (From .. Last)); end if; end; end loop; if Self.IO_Pub /= null and not Self.Stderr.Is_Empty then Self.IO_Pub.Stream (+"stderr", UTF_8.Decode (Self.Stderr)); Self.Stderr.Clear; end if; end Standard_Error_Available; ------------------------------- -- Standard_Output_Available -- ------------------------------- overriding procedure Standard_Output_Available (Self : in out Session) is use type Ada.Streams.Stream_Element_Count; begin loop declare Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin Self.Process.Read_Standard_Output (Data, Last); exit when Last < Data'First; Self.Stdout.Append (Data (1 .. Last)); end; end loop; end Standard_Output_Available; ---------------------- -- Statements_Probe -- ---------------------- procedure Statements_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Text : out League.Strings.Universal_String; Error : out League.Strings.Universal_String) is use type League.Strings.Universal_String; GPR : League.Strings.Universal_String; Clauses : constant League.Strings.Universal_String := Self.Clauses.Join (Line_Feed); begin Write_File (Dir & Format (+"execute_$.ads", Run), Format (+"package Execute_$ is pragma Elaborate_Body; end;", Run)); Write_File (Dir & Format (+"execute_$.adb", Run), Clauses & Self.With_Runs & Format (+"package body Execute_$ is begin $ end;", Run, Code)); Self.Create_Project_File (Dir, Run, Execute_Cell, GPR); Self.Launch_Cell (GPR, Format (+"$.libs/libjasexecute_$" & SO_Extension, Dir, Run), Text, Error); end Statements_Probe; ------------- -- To_Spec -- ------------- function To_Spec (Text : League.Strings.Universal_String) return League.Strings.Universal_String is use type League.Strings.Universal_String; Line : League.Strings.Universal_String; Lines : constant League.String_Vectors.Universal_String_Vector := Text.Split (Line_Feed); Result : League.String_Vectors.Universal_String_Vector; begin for J in 1 .. Lines.Length loop Line := Lines (J); if Line.Ends_With (" is") then Result.Append (Line.Head_To (Line.Length - 3) & ";"); exit; elsif Line.Index (" is ") > 0 then Result.Append (Line.Head_To (Line.Index (" is ")) & ";"); exit; else Result.Append (Line); end if; end loop; return Result.Join (Line_Feed); end To_Spec; ----------------------- -- With_Clause_Probe -- ----------------------- procedure With_Clause_Probe (Self : aliased in out Session'Class; Code : League.Strings.Universal_String; Dir : League.Strings.Universal_String; Run : League.Strings.Universal_String; Error : out League.Strings.Universal_String) is use type League.Strings.Universal_String; GPR : League.Strings.Universal_String; Args : League.String_Vectors.Universal_String_Vector; Listing : League.Strings.Universal_String; Errors : League.Strings.Universal_String; Clauses : constant League.Strings.Universal_String := Self.Clauses.Join (Line_Feed); Status : Integer; begin Write_File (Dir & Format (+"with_$.adb", Run), Clauses & Self.With_Runs & Code & Format (+"procedure With_$ is begin null; end;", Run)); Self.Create_Project_File (Dir, Run, With_Cell, GPR); Args.Append (+"-p"); Args.Append ("-P" & GPR); Args.Append (+"-c"); -- Just compile Append (Args, Self.Gprbuild); -- Append custom options Processes.Run (Program => Self.Gprbuild.Path, Arguments => Args, Env => Self.Build_Env, Directory => Self.Directory, Output => Listing, Errors => Errors, Status => Status); if Status = 0 then Self.Clauses.Append (Code.Split (Line_Feed, League.Strings.Skip_Empty)); elsif Listing.Is_Empty then Error := Errors; else Error := Listing; end if; end With_Clause_Probe; --------------- -- With_Runs -- --------------- function With_Runs (Self : Session'Class) return League.Strings.Universal_String is Result : League.String_Vectors.Universal_String_Vector; begin for J in 1 .. Self.Runs.Length loop Result.Append (Format (+"with Run_$; use Run_$;", Self.Runs (J))); end loop; return Result.Join (Line_Feed); end With_Runs; ---------------- -- Write_File -- ---------------- procedure Write_File (Name : League.Strings.Universal_String; Text : League.Strings.Universal_String) is Output : Ada.Wide_Wide_Text_IO.File_Type; begin Ada.Wide_Wide_Text_IO.Create (Output, Name => Name.To_UTF_8_String, Form => "WCEM=8"); Ada.Wide_Wide_Text_IO.Put_Line (Output, Text.To_Wide_Wide_String); Ada.Wide_Wide_Text_IO.Close (Output); end Write_File; end Ada_Kernels;
package body CLIC_Ex.Commands.Double_Dash is Upper_Case : aliased Boolean := False; ------------- -- Execute -- ------------- overriding procedure Execute (Cmd : in out Instance; Args : AAA.Strings.Vector) is begin if Upper_Case then Ada.Text_IO.Put_Line (AAA.Strings.To_Upper_Case (Args.Flatten)); else Ada.Text_IO.Put_Line (Args.Flatten); end if; end Execute; -------------------- -- Setup_Switches -- -------------------- overriding procedure Setup_Switches (Cmd : in out Instance; Config : in out CLIC.Subcommand.Switches_Configuration) is begin CLIC.Subcommand.Define_Switch (Config, Output => Upper_Case'Access, Long_Switch => "--upper"); end Setup_Switches; end CLIC_Ex.Commands.Double_Dash;
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- package Ada.Tags is pragma Preelaborate(Tags); type Tag is private; pragma Preelaborable_Initialization(Tag); No_Tag : constant Tag; function Expanded_Name (T : Tag) return String; function Wide_Expanded_Name (T : Tag) return Wide_String; function Wide_Wide_Expanded_Name (T : Tag) return Wide_Wide_String; function External_Tag (T : Tag) return String; function Internal_Tag (External : String) return Tag; function Descendant_Tag (External : String; Ancestor : Tag) return Tag; function Is_Descendant_At_Same_Level (Descendant, Ancestor : Tag) return Boolean; function Parent_Tag (T : Tag) return Tag; type Tag_Array is array (Positive range <>) of Tag; function Interface_Ancestor_Tags (T : Tag) return Tag_Array; Tag_Error : exception; private pragma Import (Ada, Tag); pragma Import (Ada, No_Tag); end Ada.Tags;
-- { dg-do run } -- { dg-options "-gnatws -gnatVa" } pragma Initialize_Scalars; procedure init_scalar1 is type Fixed_3T is delta 2.0 ** (- 4) range - 2.0 ** 19 .. (2.0 ** 19 - 2.0 ** (- 4)); for Fixed_3T'Size use 3*8; Write_Value : constant Fixed_3T := Fixed_3T(524287.875); type singleton is array (1 .. 1) of Fixed_3T; pragma Pack (singleton); it : Singleton; begin null; end;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ADA.STRINGS.TEXT_OUTPUT.UTILS -- -- -- -- S p e c -- -- -- -- Copyright (C) 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. -- -- -- ------------------------------------------------------------------------------ package Ada.Strings.Text_Output.Utils with Pure is -- This package provides utility functions on Sink'Class. These are -- intended for use by Put_Image attributes, both the default versions -- generated by the compiler, and user-defined ones. procedure Full (S : in out Sink'Class) with Inline; -- Must be called when the current chunk is full. Dispatches to -- Full_Method. procedure Flush (S : in out Sink'Class) with Inline; -- Dispatches to Flush_Method -- Full_Method and Flush_Method should be called only via Full and Flush procedure Put_Character (S : in out Sink'Class; Item : Character); procedure Put_Wide_Character (S : in out Sink'Class; Item : Wide_Character); procedure Put_Wide_Wide_Character (S : in out Sink'Class; Item : Wide_Wide_Character); procedure Put_String (S : in out Sink'Class; Item : String); procedure Put_Wide_String (S : in out Sink'Class; Item : Wide_String); procedure Put_Wide_Wide_String (S : in out Sink'Class; Item : Wide_Wide_String); -- Encode characters or strings as UTF-8, and send them to S. subtype Character_7 is Character range Character'Val (0) .. Character'Val (2**7 - 1); -- 7-bit character. These are the same in both Latin-1 and UTF-8. procedure Put_7bit (S : in out Sink'Class; Item : Character_7) with Inline, Pre => Item /= NL; procedure Put_7bit_NL (S : in out Sink'Class; Item : Character_7) with Inline; -- Put a 7-bit character, and adjust the Column. For Put_7bit_NL, Item can -- be NL. procedure Put_UTF_8 (S : in out Sink'Class; Item : UTF_8) with Inline; procedure Put_UTF_8_Lines (S : in out Sink'Class; Item : UTF_8_Lines); -- Send data that is already UTF-8 encoded (including 7-bit ASCII) to -- S. These are more efficient than Put_String. procedure New_Line (S : in out Sink'Class) with Inline, Post => Column (S) = 1; -- Puts the new-line character. function Column (S : Sink'Class) return Positive with Inline; -- Current output column. The Column is initially 1, and is incremented for -- each 7-bit character output, except for the new-line character, which -- sets Column back to 1. The next character to be output will go in this -- column. procedure Tab_To_Column (S : in out Sink'Class; Column : Positive); -- Put spaces until we're at or past Column. procedure Set_Indentation (S : in out Sink'Class; Amount : Natural) with Inline; function Indentation (S : Sink'Class) return Natural with Inline; -- Indentation is initially 0. Set_Indentation sets it, and Indentation -- returns it. This number of space characters are put at the start of -- each nonempty line. subtype Optional_Indentation is Integer range -1 .. Natural'Last; Default : constant Optional_Indentation := -1; procedure Indent (S : in out Sink'Class; Amount : Optional_Indentation := Default) with Inline; procedure Outdent (S : in out Sink'Class; Amount : Optional_Indentation := Default) with Inline; -- Increase/decrease Indentation by Amount. If Amount = Default, the amount -- specified by the Indent_Amount parameter of the sink creation function -- is used. The sink creation functions are New_Buffer, Create_File, and -- Create_New_File. end Ada.Strings.Text_Output.Utils;
package body Irc.Commands is procedure Install_Commands (Conn : in out Connection) is begin -- general commands Conn.On_Message ("001", Join_On_Ident'Access); Conn.On_Message ("433", Nick_In_Use'Access); Conn.On_Message ("PING", Ping_Server'Access); Conn.On_Regexp (".*", Log_Line'Access); end Install_Commands; ---------------------------- -- Begin general commands -- ---------------------------- procedure Join_On_Ident (Conn : in out Connection; Msg : IrcMessage) is Channels : Bot.Unbounded_Vector.Vector := Conn.Get_Default_Channels; begin for I in Channels.First_Index .. Channels.Last_Index loop Conn.Join (SU.To_String (Channels.Element (I))); end loop; end Join_On_Ident; procedure Nick_In_Use (Conn : in out Connection; Msg : IrcMessage) is use SU; Attr : Bot.Nick_Attributes := Conn.Get_Attributes; New_Nick : SU.Unbounded_String := Attr.Nick & "_"; begin Attr.Nick := New_Nick; Conn.Command (Cmd => "NICK", Args => SU.To_String (New_Nick)); Conn.Set_Attributes (Attr); end Nick_In_Use; procedure Ping_Server (Conn : in out Connection; Msg : Message.Message) is begin Conn.Command (Cmd => "PONG", Args => SU.To_String (Msg.Args)); end Ping_Server; procedure Log_Line (Conn : in out Connection; Msg : IrcMessage) is begin Msg.Print; end Log_Line; end Irc.Commands;
-- Generated at 2015-06-24 18:19:13 +0000 by Natools.Static_Hash_Maps -- from src/natools-s_expressions-templates-dates-maps.sx with Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds; with Natools.Static_Maps.S_Expressions.Templates.Dates.Zones; package body Natools.Static_Maps.S_Expressions.Templates.Dates is function Main (Key : String) return Main_Command is N : constant Natural := Natools.Static_Maps.S_Expressions.Templates.Dates.Cmds.Hash (Key); begin if Map_1_Keys (N).all = Key then return Map_1_Elements (N); else return Error; end if; end Main; function To_Time_Offset (Key : String) return Integer is N : constant Natural := Natools.Static_Maps.S_Expressions.Templates.Dates.Zones.Hash (Key); begin if Map_2_Keys (N).all = Key then return Map_2_Elements (N); else raise Constraint_Error with "Key """ & Key & """ not in map"; end if; end To_Time_Offset; end Natools.Static_Maps.S_Expressions.Templates.Dates;
--- src/ahven-framework.adb.orig 2014-02-08 21:21:51.000000000 +0000 +++ src/ahven-framework.adb @@ -14,6 +14,8 @@ -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- +with GNAT.Traceback.Symbolic; +with GNAT.Regpat; with Ada.Strings; with Ada.Unchecked_Deallocation; with Ada.Exceptions; @@ -22,6 +24,24 @@ with Ahven.Long_AStrings; package body Ahven.Framework is use Ahven.AStrings; + -- Convert an exception into a traceback, but truncate it at the first + -- line matching "0x.* in ahven.framework" as this is unwanted trace. + function Filtered_Traceback (E : in Ada.Exceptions.Exception_Occurrence) + return String is + ftb : constant String := GNAT.Traceback.Symbolic.Symbolic_Traceback (E); + pat : constant String := "(0x[0-9a-f]* in ahven\.framework)"; + reg : constant GNAT.Regpat.Pattern_Matcher := GNAT.Regpat.Compile (pat); + result : GNAT.Regpat.Match_Array (0 .. 1); + use type GNAT.Regpat.Match_Location; + begin + GNAT.Regpat.Match (reg, ftb, result); + if result (0) = GNAT.Regpat.No_Match then + return ftb; + else + return ftb (1 .. result (1).First - 2); + end if; + end Filtered_Traceback; + -- A few local procedures, so we do not need to duplicate code. procedure Free_Test is new Ada.Unchecked_Deallocation (Object => Test'Class, @@ -346,19 +366,19 @@ package body Ahven.Framework is Set_Status (S => TEST_FAIL, Message => Ada.Exceptions.Exception_Message (E), - Long_Message => Ada.Exceptions.Exception_Information (E), + Long_Message => Filtered_Traceback (E), R => Result); when E : Test_Skipped_Error => Set_Status (S => TEST_SKIP, Message => Ada.Exceptions.Exception_Message (E), - Long_Message => Ada.Exceptions.Exception_Information (E), + Long_Message => Filtered_Traceback (E), R => Result); when E : others => Set_Status (S => TEST_ERROR, Message => Ada.Exceptions.Exception_Message (E), - Long_Message => Ada.Exceptions.Exception_Information (E), + Long_Message => Filtered_Traceback (E), R => Result); end; end Run_A_Command;
-- Copyright 2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "PentestTools" type = "api" function start() set_rate_limit(1) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function vertical(ctx, domain) local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end local id = start_scan(domain, c.key) if id == "" then return end while(true) do local status = get_scan_status(id, c.key) if status == "failed" then return elseif status == "finished" then break end for _=1,5 do check_rate_limit() end end local output = get_output(id, c.key) if output ~= "" then for _, r in pairs(output) do new_name(ctx, r[1]) new_addr(ctx, r[2], r[1]) end end end function start_scan(domain, key) local body = json.encode({ ['op']="start_scan", ['tool_id']=20, ['target']=domain, ['tool_params'] = { ['web_details']="off", ['do_bing_search']="off", }, }) local resp, err = request(ctx, { ['url']=build_url(key), method="POST", data=body, headers={['Content-Type']="application/json"} }) if (err ~= nil and err ~= "") then log(ctx, "start_scan request to service failed: " .. err) return "" end d = json.decode(resp) if (d == nil or d.op_status ~= "success") then return "" end return d.scan_id end function get_scan_status(id, key) local body = json.encode({ ['op']="get_scan_status", ['scan_id']=id, }) local resp, err = request(ctx, { ['url']=build_url(key), method="POST", data=body, headers={['Content-Type']="application/json"} }) if (err ~= nil and err ~= "") then log(ctx, "get_scan_status request to service failed: " .. err) return "failed" end d = json.decode(resp) if (d == nil or d.op_status ~= "success") then return "failed" elseif (d.scan_status == "waiting" or d.scan_status == "running") then return "progress" else return "finished" end end function get_output(id, key) local body = json.encode({ ['op']="get_output", ['scan_id']=id, ['output_format']="json", }) local resp, err = request(ctx, { ['url']=build_url(key), method="POST", data=body, headers={['Content-Type']="application/json"} }) if (err ~= nil and err ~= "") then log(ctx, "get_output request to service failed: " .. err) return "" end d = json.decode(resp) if (d == nil or d.op_status ~= "success" or d.output_json == nil or #(d['output_json'].output_data) == 0) then return "" end return d['output_json'][1].output_data end function build_url(key) return "https://pentest-tools.com/api?key=" .. key end
Foo (1, 0.0); Foo (1); Foo (Arg_2 => 0.0, Arg_1 => 1); Foo (Arg_1 => 1);
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL -- -- Ada 2012 bindings to the SDL 2.x.y library. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; package SDL is package C renames Interfaces.C; use type C.int; type Init_Flags is mod 2 ** 32 with Convention => C; Null_Init_Flags : constant Init_Flags := 16#0000_0000#; Enable_Timer : constant Init_Flags := 16#0000_0001#; Enable_Audio : constant Init_Flags := 16#0000_0010#; Enable_Screen : constant Init_Flags := 16#0000_0020#; Enable_Joystick : constant Init_Flags := 16#0000_0200#; Enable_Haptic : constant Init_Flags := 16#0000_1000#; Enable_Game_Controller : constant Init_Flags := 16#0000_2000#; Enable_Events : constant Init_Flags := 16#0000_4000#; Enable_No_Parachute : constant Init_Flags := 16#0010_0000#; Enable_Everything : constant Init_Flags := Enable_Timer or Enable_Audio or Enable_Screen or Enable_Joystick or Enable_Haptic or Enable_Game_Controller or Enable_Events or Enable_No_Parachute; -- Coordinates are for positioning things. subtype Coordinate is C.int; subtype Natural_Coordinate is Coordinate range 0 .. Coordinate'Last; subtype Positive_Coordinate is Coordinate range 1 .. Coordinate'Last; Centre_Coordinate : constant Coordinate := 0; type Coordinates is record X : SDL.Coordinate; Y : SDL.Coordinate; end record with Convention => C; Zero_Coordinate : constant Coordinates := (others => 0); subtype Natural_Coordinates is Coordinates with Dynamic_Predicate => Natural_Coordinates.X >= Natural_Coordinate'First and Natural_Coordinates.Y >= Natural_Coordinate'First; subtype Positive_Coordinates is Coordinates with Dynamic_Predicate => Positive_Coordinates.X >= Positive_Coordinate'First and Positive_Coordinates.Y >= Positive_Coordinate'First; -- Dimensions are for sizing things. subtype Dimension is C.int; subtype Natural_Dimension is Dimension range 0 .. Dimension'Last; subtype Positive_Dimension is Dimension range 1 .. Dimension'Last; type Sizes is record Width : Dimension; Height : Dimension; end record with Convention => C; Zero_Size : constant Sizes := (others => Natural_Dimension'First); subtype Natural_Sizes is Sizes with Dynamic_Predicate => Natural_Sizes.Width >= 0 and Natural_Sizes.Height >= 0; subtype Positive_Sizes is Sizes with Dynamic_Predicate => Positive_Sizes.Width >= 1 and Positive_Sizes.Height >= 1; function "*" (Left : in Sizes; Scale : in Positive_Dimension) return Sizes is (Sizes'(Width => Left.Width * Scale, Height => Left.Height * Scale)); function "/" (Left : in Sizes; Scale : in Positive_Dimension) return Sizes is (Sizes'(Width => Left.Width / Scale, Height => Left.Height / Scale)); function Initialise (Flags : in Init_Flags := Enable_Everything) return Boolean; procedure Finalise with Import => True, Convention => C, External_Name => "SDL_Quit"; function Initialise_Sub_System (Flags : in Init_Flags) return Boolean; procedure Finalise_Sub_System (Flags : in Init_Flags) with Import => True, Convention => C, External_Name => "SDL_QuitSubSystem"; -- Get which sub-systems were initialised. function Was_Initialised return Init_Flags; -- Check whether a set of sub-systems were initialised. function Was_Initialised (Flags : in Init_Flags) return Boolean; private Success : constant Interfaces.C.int := 0; type SDL_Bool is (SDL_False, SDL_True) with Convention => C; -- The next value is used in mapping the Ada types onto the C types, it is the word size used for all data -- in SDL, i.e. all data is 4 byte aligned so it works with 32-bit architectures. Word : constant := 4; -- These constants are internal to the events system. SDL_Query : constant C.int := -1; SDL_Ignore : constant C.int := 0; SDL_Disable : constant C.int := 0; SDL_Enable : constant C.int := 1; end SDL;
-- C41401A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CONSTRAINT_ERROR IS RAISED IF THE PREFIX OF THE FOLLOWING -- ATTRIBUTES HAS THE VALUE NULL: -- A) 'CALLABLE AND 'TERMINATED FOR A TASK TYPE. -- B) 'FIRST, 'FIRST(N), 'LAST, 'LAST(N), 'LENGTH, 'LENGTH(N), -- 'RANGE, AND 'RANGE(N) FOR AN ARRAY TYPE. -- TBN 10/2/86 -- EDS 07/14/98 AVOID OPTIMIZATION WITH REPORT; USE REPORT; PROCEDURE C41401A IS SUBTYPE INT IS INTEGER RANGE 1 .. 10; TASK TYPE TT IS ENTRY E; END TT; TYPE ACC_TT IS ACCESS TT; TYPE NULL_ARR1 IS ARRAY (2 .. 1) OF INTEGER; TYPE ARRAY1 IS ARRAY (INT RANGE <>) OF INTEGER; TYPE NULL_ARR2 IS ARRAY (3 .. 1, 2 .. 1) OF INTEGER; TYPE ARRAY2 IS ARRAY (INT RANGE <>, INT RANGE <>) OF INTEGER; TYPE ACC_NULL1 IS ACCESS NULL_ARR1; TYPE ACC_ARR1 IS ACCESS ARRAY1; TYPE ACC_NULL2 IS ACCESS NULL_ARR2; TYPE ACC_ARR2 IS ACCESS ARRAY2; PTR_TT : ACC_TT; PTR_ARA1: ACC_NULL1; PTR_ARA2 : ACC_ARR1 (1 .. 4); PTR_ARA3 : ACC_NULL2; PTR_ARA4 : ACC_ARR2 (1 .. 2, 2 .. 4); BOOL_VAR : BOOLEAN := FALSE; INT_VAR : INTEGER := 1; TASK BODY TT IS BEGIN ACCEPT E; END TT; BEGIN TEST ("C41401A", "CHECK THAT CONSTRAINT_ERROR IS RAISED IF THE " & "PREFIX HAS A VALUE OF NULL FOR THE FOLLOWING " & "ATTRIBUTES: 'CALLABLE, 'TERMINATED, 'FIRST, " & "'LAST, 'LENGTH, AND 'RANGE"); BEGIN IF EQUAL (3, 2) THEN PTR_TT := NEW TT; END IF; BOOL_VAR := IDENT_BOOL(PTR_TT'CALLABLE); FAILED ("CONSTRAINT_ERROR NOT RAISED - 1 " & BOOLEAN'IMAGE(BOOL_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 2"); END; BEGIN IF EQUAL (1, 3) THEN PTR_TT := NEW TT; END IF; BOOL_VAR := IDENT_BOOL(PTR_TT'TERMINATED); FAILED ("CONSTRAINT_ERROR NOT RAISED - 3 " & BOOLEAN'IMAGE(BOOL_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 4"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA1'FIRST); FAILED ("CONSTRAINT_ERROR NOT RAISED - 5 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 6"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA2'LAST); FAILED ("CONSTRAINT_ERROR NOT RAISED - 7 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 8"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA1'LENGTH); FAILED ("CONSTRAINT_ERROR NOT RAISED - 9 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 10"); END; BEGIN DECLARE A : ARRAY1 (PTR_ARA2'RANGE); BEGIN A (1) := IDENT_INT(1); FAILED ("CONSTRAINT_ERROR NOT RAISED - 11 " & INTEGER'IMAGE(A(1))); EXCEPTION WHEN OTHERS => FAILED ("CONSTRAINT_ERROR NOT RAISED - 11 "); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 12"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA3'FIRST(2)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 13 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 14"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA4'LAST(2)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 15 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 16"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA3'LENGTH(2)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 17 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 18"); END; BEGIN DECLARE A : ARRAY1 (PTR_ARA4'RANGE(2)); BEGIN A (1) := IDENT_INT(1); FAILED ("CONSTRAINT_ERROR NOT RAISED - 19 " & INTEGER'IMAGE(A(1))); EXCEPTION WHEN OTHERS => FAILED ("CONSTRAINT_ERROR NOT RAISED - 19 "); END; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 20"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA4'LAST(1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 21 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 22"); END; BEGIN INT_VAR := IDENT_INT(PTR_ARA3'LENGTH(1)); FAILED ("CONSTRAINT_ERROR NOT RAISED - 23 " & INTEGER'IMAGE(INT_VAR)); EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("UNEXPECTED EXCEPTION RAISED - 24"); END; RESULT; END C41401A;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . P E R F E C T _ H A S H _ G E N E R A T O R S -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2019, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.IO_Exceptions; use Ada.IO_Exceptions; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Directories; with GNAT.Heap_Sort_G; with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.Table; package body GNAT.Perfect_Hash_Generators is -- We are using the algorithm of J. Czech as described in Zbigniew J. -- Czech, George Havas, and Bohdan S. Majewski ``An Optimal Algorithm for -- Generating Minimal Perfect Hash Functions'', Information Processing -- Letters, 43(1992) pp.257-264, Oct.1992 -- This minimal perfect hash function generator is based on random graphs -- and produces a hash function of the form: -- h (w) = (g (f1 (w)) + g (f2 (w))) mod m -- where f1 and f2 are functions that map strings into integers, and g is -- a function that maps integers into [0, m-1]. h can be order preserving. -- For instance, let W = {w_0, ..., w_i, ..., w_m-1}, h can be defined -- such that h (w_i) = i. -- This algorithm defines two possible constructions of f1 and f2. Method -- b) stores the hash function in less memory space at the expense of -- greater CPU time. -- a) fk (w) = sum (for i in 1 .. length (w)) (Tk (i, w (i))) mod n -- size (Tk) = max (for w in W) (length (w)) * size (used char set) -- b) fk (w) = sum (for i in 1 .. length (w)) (Tk (i) * w (i)) mod n -- size (Tk) = max (for w in W) (length (w)) but the table lookups are -- replaced by multiplications. -- where Tk values are randomly generated. n is defined later on but the -- algorithm recommends to use a value a little bit greater than 2m. Note -- that for large values of m, the main memory space requirements comes -- from the memory space for storing function g (>= 2m entries). -- Random graphs are frequently used to solve difficult problems that do -- not have polynomial solutions. This algorithm is based on a weighted -- undirected graph. It comprises two steps: mapping and assignment. -- In the mapping step, a graph G = (V, E) is constructed, where = {0, 1, -- ..., n-1} and E = {(for w in W) (f1 (w), f2 (w))}. In order for the -- assignment step to be successful, G has to be acyclic. To have a high -- probability of generating an acyclic graph, n >= 2m. If it is not -- acyclic, Tk have to be regenerated. -- In the assignment step, the algorithm builds function g. As G is -- acyclic, there is a vertex v1 with only one neighbor v2. Let w_i be -- the word such that v1 = f1 (w_i) and v2 = f2 (w_i). Let g (v1) = 0 by -- construction and g (v2) = (i - g (v1)) mod n (or h (i) - g (v1) mod n). -- If word w_j is such that v2 = f1 (w_j) and v3 = f2 (w_j), g (v3) = (j - -- g (v2)) mod (or to be general, (h (j) - g (v2)) mod n). If w_i has no -- neighbor, then another vertex is selected. The algorithm traverses G to -- assign values to all the vertices. It cannot assign a value to an -- already assigned vertex as G is acyclic. subtype Word_Id is Integer; subtype Key_Id is Integer; subtype Vertex_Id is Integer; subtype Edge_Id is Integer; subtype Table_Id is Integer; No_Vertex : constant Vertex_Id := -1; No_Edge : constant Edge_Id := -1; No_Table : constant Table_Id := -1; type Word_Type is new String_Access; procedure Free_Word (W : in out Word_Type) renames Free; function New_Word (S : String) return Word_Type; procedure Resize_Word (W : in out Word_Type; Len : Natural); -- Resize string W to have a length Len type Key_Type is record Edge : Edge_Id; end record; -- A key corresponds to an edge in the algorithm graph type Vertex_Type is record First : Edge_Id; Last : Edge_Id; end record; -- A vertex can be involved in several edges. First and Last are the bounds -- of an array of edges stored in a global edge table. type Edge_Type is record X : Vertex_Id; Y : Vertex_Id; Key : Key_Id; end record; -- An edge is a peer of vertices. In the algorithm, a key is associated to -- an edge. package WT is new GNAT.Table (Word_Type, Word_Id, 0, 32, 32); package IT is new GNAT.Table (Integer, Integer, 0, 32, 32); -- The two main tables. WT is used to store the words in their initial -- version and in their reduced version (that is words reduced to their -- significant characters). As an instance of GNAT.Table, WT does not -- initialize string pointers to null. This initialization has to be done -- manually when the table is allocated. IT is used to store several -- tables of components containing only integers. function Image (Int : Integer; W : Natural := 0) return String; function Image (Str : String; W : Natural := 0) return String; -- Return a string which includes string Str or integer Int preceded by -- leading spaces if required by width W. function Trim_Trailing_Nuls (Str : String) return String; -- Return Str with trailing NUL characters removed Output : File_Descriptor renames GNAT.OS_Lib.Standout; -- Shortcuts EOL : constant Character := ASCII.LF; Max : constant := 78; Last : Natural := 0; Line : String (1 .. Max); -- Use this line to provide buffered IO procedure Add (C : Character); procedure Add (S : String); -- Add a character or a string in Line and update Last procedure Put (F : File_Descriptor; S : String; F1 : Natural; L1 : Natural; C1 : Natural; F2 : Natural; L2 : Natural; C2 : Natural); -- Write string S into file F as a element of an array of one or two -- dimensions. Fk (resp. Lk and Ck) indicates the first (resp last and -- current) index in the k-th dimension. If F1 = L1 the array is considered -- as a one dimension array. This dimension is described by F2 and L2. This -- routine takes care of all the parenthesis, spaces and commas needed to -- format correctly the array. Moreover, the array is well indented and is -- wrapped to fit in a 80 col line. When the line is full, the routine -- writes it into file F. When the array is completed, the routine adds -- semi-colon and writes the line into file F. procedure New_Line (File : File_Descriptor); -- Simulate Ada.Text_IO.New_Line with GNAT.OS_Lib procedure Put (File : File_Descriptor; Str : String); -- Simulate Ada.Text_IO.Put with GNAT.OS_Lib procedure Put_Used_Char_Set (File : File_Descriptor; Title : String); -- Output a title and a used character set procedure Put_Int_Vector (File : File_Descriptor; Title : String; Vector : Integer; Length : Natural); -- Output a title and a vector procedure Put_Int_Matrix (File : File_Descriptor; Title : String; Table : Table_Id; Len_1 : Natural; Len_2 : Natural); -- Output a title and a matrix. When the matrix has only one non-empty -- dimension (Len_2 = 0), output a vector. procedure Put_Edges (File : File_Descriptor; Title : String); -- Output a title and an edge table procedure Put_Initial_Keys (File : File_Descriptor; Title : String); -- Output a title and a key table procedure Put_Reduced_Keys (File : File_Descriptor; Title : String); -- Output a title and a key table procedure Put_Vertex_Table (File : File_Descriptor; Title : String); -- Output a title and a vertex table function Ada_File_Base_Name (Pkg_Name : String) return String; -- Return the base file name (i.e. without .ads/.adb extension) for an -- Ada source file containing the named package, using the standard GNAT -- file-naming convention. For example, if Pkg_Name is "Parent.Child", we -- return "parent-child". ---------------------------------- -- Character Position Selection -- ---------------------------------- -- We reduce the maximum key size by selecting representative positions -- in these keys. We build a matrix with one word per line. We fill the -- remaining space of a line with ASCII.NUL. The heuristic selects the -- position that induces the minimum number of collisions. If there are -- collisions, select another position on the reduced key set responsible -- of the collisions. Apply the heuristic until there is no more collision. procedure Apply_Position_Selection; -- Apply Position selection and build the reduced key table procedure Parse_Position_Selection (Argument : String); -- Parse Argument and compute the position set. Argument is list of -- substrings separated by commas. Each substring represents a position -- or a range of positions (like x-y). procedure Select_Character_Set; -- Define an optimized used character set like Character'Pos in order not -- to allocate tables of 256 entries. procedure Select_Char_Position; -- Find a min char position set in order to reduce the max key length. The -- heuristic selects the position that induces the minimum number of -- collisions. If there are collisions, select another position on the -- reduced key set responsible of the collisions. Apply the heuristic until -- there is no collision. ----------------------------- -- Random Graph Generation -- ----------------------------- procedure Random (Seed : in out Natural); -- Simulate Ada.Discrete_Numerics.Random procedure Generate_Mapping_Table (Tab : Table_Id; L1 : Natural; L2 : Natural; Seed : in out Natural); -- Random generation of the tables below. T is already allocated procedure Generate_Mapping_Tables (Opt : Optimization; Seed : in out Natural); -- Generate the mapping tables T1 and T2. They are used to define fk (w) = -- sum (for i in 1 .. length (w)) (Tk (i, w (i))) mod n. Keys, NK and Chars -- are used to compute the matrix size. --------------------------- -- Algorithm Computation -- --------------------------- procedure Compute_Edges_And_Vertices (Opt : Optimization); -- Compute the edge and vertex tables. These are empty when a self loop is -- detected (f1 (w) = f2 (w)). The edge table is sorted by X value and then -- Y value. Keys is the key table and NK the number of keys. Chars is the -- set of characters really used in Keys. NV is the number of vertices -- recommended by the algorithm. T1 and T2 are the mapping tables needed to -- compute f1 (w) and f2 (w). function Acyclic return Boolean; -- Return True when the graph is acyclic. Vertices is the current vertex -- table and Edges the current edge table. procedure Assign_Values_To_Vertices; -- Execute the assignment step of the algorithm. Keys is the current key -- table. Vertices and Edges represent the random graph. G is the result of -- the assignment step such that: -- h (w) = (g (f1 (w)) + g (f2 (w))) mod m function Sum (Word : Word_Type; Table : Table_Id; Opt : Optimization) return Natural; -- For an optimization of CPU_Time return -- fk (w) = sum (for i in 1 .. length (w)) (Tk (i, w (i))) mod n -- For an optimization of Memory_Space return -- fk (w) = sum (for i in 1 .. length (w)) (Tk (i) * w (i)) mod n -- Here NV = n ------------------------------- -- Internal Table Management -- ------------------------------- function Allocate (N : Natural; S : Natural := 1) return Table_Id; -- Allocate N * S ints from IT table ---------- -- Keys -- ---------- Keys : Table_Id := No_Table; NK : Natural := 0; -- NK : Number of Keys function Initial (K : Key_Id) return Word_Id; pragma Inline (Initial); function Reduced (K : Key_Id) return Word_Id; pragma Inline (Reduced); function Get_Key (N : Key_Id) return Key_Type; procedure Set_Key (N : Key_Id; Item : Key_Type); -- Get or Set Nth element of Keys table ------------------ -- Char_Pos_Set -- ------------------ Char_Pos_Set : Table_Id := No_Table; Char_Pos_Set_Len : Natural; -- Character Selected Position Set function Get_Char_Pos (P : Natural) return Natural; procedure Set_Char_Pos (P : Natural; Item : Natural); -- Get or Set the string position of the Pth selected character ------------------- -- Used_Char_Set -- ------------------- Used_Char_Set : Table_Id := No_Table; Used_Char_Set_Len : Natural; -- Used Character Set : Define a new character mapping. When all the -- characters are not present in the keys, in order to reduce the size -- of some tables, we redefine the character mapping. function Get_Used_Char (C : Character) return Natural; procedure Set_Used_Char (C : Character; Item : Natural); ------------ -- Tables -- ------------ T1 : Table_Id := No_Table; T2 : Table_Id := No_Table; T1_Len : Natural; T2_Len : Natural; -- T1 : Values table to compute F1 -- T2 : Values table to compute F2 function Get_Table (T : Integer; X, Y : Natural) return Natural; procedure Set_Table (T : Integer; X, Y : Natural; Item : Natural); ----------- -- Graph -- ----------- G : Table_Id := No_Table; G_Len : Natural; -- Values table to compute G NT : Natural := Default_Tries; -- Number of tries running the algorithm before raising an error function Get_Graph (N : Natural) return Integer; procedure Set_Graph (N : Natural; Item : Integer); -- Get or Set Nth element of graph ----------- -- Edges -- ----------- Edge_Size : constant := 3; Edges : Table_Id := No_Table; Edges_Len : Natural; -- Edges : Edge table of the random graph G function Get_Edges (F : Natural) return Edge_Type; procedure Set_Edges (F : Natural; Item : Edge_Type); -------------- -- Vertices -- -------------- Vertex_Size : constant := 2; Vertices : Table_Id := No_Table; -- Vertex table of the random graph G NV : Natural; -- Number of Vertices function Get_Vertices (F : Natural) return Vertex_Type; procedure Set_Vertices (F : Natural; Item : Vertex_Type); -- Comments needed ??? K2V : Float; -- Ratio between Keys and Vertices (parameter of Czech's algorithm) Opt : Optimization; -- Optimization mode (memory vs CPU) Max_Key_Len : Natural := 0; Min_Key_Len : Natural := 0; -- Maximum and minimum of all the word length S : Natural; -- Seed function Type_Size (L : Natural) return Natural; -- Given the last L of an unsigned integer type T, return its size ------------- -- Acyclic -- ------------- function Acyclic return Boolean is Marks : array (0 .. NV - 1) of Vertex_Id := (others => No_Vertex); function Traverse (Edge : Edge_Id; Mark : Vertex_Id) return Boolean; -- Propagate Mark from X to Y. X is already marked. Mark Y and propagate -- it to the edges of Y except the one representing the same key. Return -- False when Y is marked with Mark. -------------- -- Traverse -- -------------- function Traverse (Edge : Edge_Id; Mark : Vertex_Id) return Boolean is E : constant Edge_Type := Get_Edges (Edge); K : constant Key_Id := E.Key; Y : constant Vertex_Id := E.Y; M : constant Vertex_Id := Marks (E.Y); V : Vertex_Type; begin if M = Mark then return False; elsif M = No_Vertex then Marks (Y) := Mark; V := Get_Vertices (Y); for J in V.First .. V.Last loop -- Do not propagate to the edge representing the same key if Get_Edges (J).Key /= K and then not Traverse (J, Mark) then return False; end if; end loop; end if; return True; end Traverse; Edge : Edge_Type; -- Start of processing for Acyclic begin -- Edges valid range is for J in 1 .. Edges_Len - 1 loop Edge := Get_Edges (J); -- Mark X of E when it has not been already done if Marks (Edge.X) = No_Vertex then Marks (Edge.X) := Edge.X; end if; -- Traverse E when this has not already been done if Marks (Edge.Y) = No_Vertex and then not Traverse (J, Edge.X) then return False; end if; end loop; return True; end Acyclic; ------------------------ -- Ada_File_Base_Name -- ------------------------ function Ada_File_Base_Name (Pkg_Name : String) return String is begin -- Convert to lower case, then replace '.' with '-' return Result : String := To_Lower (Pkg_Name) do for J in Result'Range loop if Result (J) = '.' then Result (J) := '-'; end if; end loop; end return; end Ada_File_Base_Name; --------- -- Add -- --------- procedure Add (C : Character) is pragma Assert (C /= ASCII.NUL); begin Line (Last + 1) := C; Last := Last + 1; end Add; --------- -- Add -- --------- procedure Add (S : String) is Len : constant Natural := S'Length; begin for J in S'Range loop pragma Assert (S (J) /= ASCII.NUL); null; end loop; Line (Last + 1 .. Last + Len) := S; Last := Last + Len; end Add; -------------- -- Allocate -- -------------- function Allocate (N : Natural; S : Natural := 1) return Table_Id is L : constant Integer := IT.Last; begin IT.Set_Last (L + N * S); -- Initialize, so debugging printouts don't trip over uninitialized -- components. for J in L + 1 .. IT.Last loop IT.Table (J) := -1; end loop; return L + 1; end Allocate; ------------------------------ -- Apply_Position_Selection -- ------------------------------ procedure Apply_Position_Selection is begin for J in 0 .. NK - 1 loop declare IW : constant String := WT.Table (Initial (J)).all; RW : String (1 .. IW'Length) := (others => ASCII.NUL); N : Natural := IW'First - 1; begin -- Select the characters of Word included in the position -- selection. for C in 0 .. Char_Pos_Set_Len - 1 loop exit when IW (Get_Char_Pos (C)) = ASCII.NUL; N := N + 1; RW (N) := IW (Get_Char_Pos (C)); end loop; -- Build the new table with the reduced word. Be careful -- to deallocate the old version to avoid memory leaks. Free_Word (WT.Table (Reduced (J))); WT.Table (Reduced (J)) := New_Word (RW); Set_Key (J, (Edge => No_Edge)); end; end loop; end Apply_Position_Selection; ------------------------------- -- Assign_Values_To_Vertices -- ------------------------------- procedure Assign_Values_To_Vertices is X : Vertex_Id; procedure Assign (X : Vertex_Id); -- Execute assignment on X's neighbors except the vertex that we are -- coming from which is already assigned. ------------ -- Assign -- ------------ procedure Assign (X : Vertex_Id) is E : Edge_Type; V : constant Vertex_Type := Get_Vertices (X); begin for J in V.First .. V.Last loop E := Get_Edges (J); if Get_Graph (E.Y) = -1 then Set_Graph (E.Y, (E.Key - Get_Graph (X)) mod NK); Assign (E.Y); end if; end loop; end Assign; -- Start of processing for Assign_Values_To_Vertices begin -- Value -1 denotes an uninitialized value as it is supposed to -- be in the range 0 .. NK. if G = No_Table then G_Len := NV; G := Allocate (G_Len, 1); end if; for J in 0 .. G_Len - 1 loop Set_Graph (J, -1); end loop; for K in 0 .. NK - 1 loop X := Get_Edges (Get_Key (K).Edge).X; if Get_Graph (X) = -1 then Set_Graph (X, 0); Assign (X); end if; end loop; for J in 0 .. G_Len - 1 loop if Get_Graph (J) = -1 then Set_Graph (J, 0); end if; end loop; if Verbose then Put_Int_Vector (Output, "Assign Values To Vertices", G, G_Len); end if; end Assign_Values_To_Vertices; ------------- -- Compute -- ------------- procedure Compute (Position : String := Default_Position) is Success : Boolean := False; begin if NK = 0 then raise Program_Error with "keywords set cannot be empty"; end if; if Verbose then Put_Initial_Keys (Output, "Initial Key Table"); end if; if Position'Length /= 0 then Parse_Position_Selection (Position); else Select_Char_Position; end if; if Verbose then Put_Int_Vector (Output, "Char Position Set", Char_Pos_Set, Char_Pos_Set_Len); end if; Apply_Position_Selection; if Verbose then Put_Reduced_Keys (Output, "Reduced Keys Table"); end if; Select_Character_Set; if Verbose then Put_Used_Char_Set (Output, "Character Position Table"); end if; -- Perform Czech's algorithm for J in 1 .. NT loop Generate_Mapping_Tables (Opt, S); Compute_Edges_And_Vertices (Opt); -- When graph is not empty (no self-loop from previous operation) and -- not acyclic. if 0 < Edges_Len and then Acyclic then Success := True; exit; end if; end loop; if not Success then raise Too_Many_Tries; end if; Assign_Values_To_Vertices; end Compute; -------------------------------- -- Compute_Edges_And_Vertices -- -------------------------------- procedure Compute_Edges_And_Vertices (Opt : Optimization) is X : Natural; Y : Natural; Key : Key_Type; Edge : Edge_Type; Vertex : Vertex_Type; Not_Acyclic : Boolean := False; procedure Move (From : Natural; To : Natural); function Lt (L, R : Natural) return Boolean; -- Subprograms needed for GNAT.Heap_Sort_G -------- -- Lt -- -------- function Lt (L, R : Natural) return Boolean is EL : constant Edge_Type := Get_Edges (L); ER : constant Edge_Type := Get_Edges (R); begin return EL.X < ER.X or else (EL.X = ER.X and then EL.Y < ER.Y); end Lt; ---------- -- Move -- ---------- procedure Move (From : Natural; To : Natural) is begin Set_Edges (To, Get_Edges (From)); end Move; package Sorting is new GNAT.Heap_Sort_G (Move, Lt); -- Start of processing for Compute_Edges_And_Vertices begin -- We store edges from 1 to 2 * NK and leave zero alone in order to use -- GNAT.Heap_Sort_G. Edges_Len := 2 * NK + 1; if Edges = No_Table then Edges := Allocate (Edges_Len, Edge_Size); end if; if Vertices = No_Table then Vertices := Allocate (NV, Vertex_Size); end if; for J in 0 .. NV - 1 loop Set_Vertices (J, (No_Vertex, No_Vertex - 1)); end loop; -- For each w, X = f1 (w) and Y = f2 (w) for J in 0 .. NK - 1 loop Key := Get_Key (J); Key.Edge := No_Edge; Set_Key (J, Key); X := Sum (WT.Table (Reduced (J)), T1, Opt); Y := Sum (WT.Table (Reduced (J)), T2, Opt); -- Discard T1 and T2 as soon as we discover a self loop if X = Y then Not_Acyclic := True; exit; end if; -- We store (X, Y) and (Y, X) to ease assignment step Set_Edges (2 * J + 1, (X, Y, J)); Set_Edges (2 * J + 2, (Y, X, J)); end loop; -- Return an empty graph when self loop detected if Not_Acyclic then Edges_Len := 0; else if Verbose then Put_Edges (Output, "Unsorted Edge Table"); Put_Int_Matrix (Output, "Function Table 1", T1, T1_Len, T2_Len); Put_Int_Matrix (Output, "Function Table 2", T2, T1_Len, T2_Len); end if; -- Enforce consistency between edges and keys. Construct Vertices and -- compute the list of neighbors of a vertex First .. Last as Edges -- is sorted by X and then Y. To compute the neighbor list, sort the -- edges. Sorting.Sort (Edges_Len - 1); if Verbose then Put_Edges (Output, "Sorted Edge Table"); Put_Int_Matrix (Output, "Function Table 1", T1, T1_Len, T2_Len); Put_Int_Matrix (Output, "Function Table 2", T2, T1_Len, T2_Len); end if; -- Edges valid range is 1 .. 2 * NK for E in 1 .. Edges_Len - 1 loop Edge := Get_Edges (E); Key := Get_Key (Edge.Key); if Key.Edge = No_Edge then Key.Edge := E; Set_Key (Edge.Key, Key); end if; Vertex := Get_Vertices (Edge.X); if Vertex.First = No_Edge then Vertex.First := E; end if; Vertex.Last := E; Set_Vertices (Edge.X, Vertex); end loop; if Verbose then Put_Reduced_Keys (Output, "Key Table"); Put_Edges (Output, "Edge Table"); Put_Vertex_Table (Output, "Vertex Table"); end if; end if; end Compute_Edges_And_Vertices; ------------ -- Define -- ------------ procedure Define (Name : Table_Name; Item_Size : out Natural; Length_1 : out Natural; Length_2 : out Natural) is begin case Name is when Character_Position => Item_Size := 8; Length_1 := Char_Pos_Set_Len; Length_2 := 0; when Used_Character_Set => Item_Size := 8; Length_1 := 256; Length_2 := 0; when Function_Table_1 | Function_Table_2 => Item_Size := Type_Size (NV); Length_1 := T1_Len; Length_2 := T2_Len; when Graph_Table => Item_Size := Type_Size (NK); Length_1 := NV; Length_2 := 0; end case; end Define; -------------- -- Finalize -- -------------- procedure Finalize is begin if Verbose then Put (Output, "Finalize"); New_Line (Output); end if; -- Deallocate all the WT components (both initial and reduced ones) to -- avoid memory leaks. for W in 0 .. WT.Last loop -- Note: WT.Table (NK) is a temporary variable, do not free it since -- this would cause a double free. if W /= NK then Free_Word (WT.Table (W)); end if; end loop; WT.Release; IT.Release; -- Reset all variables for next usage Keys := No_Table; Char_Pos_Set := No_Table; Char_Pos_Set_Len := 0; Used_Char_Set := No_Table; Used_Char_Set_Len := 0; T1 := No_Table; T2 := No_Table; T1_Len := 0; T2_Len := 0; G := No_Table; G_Len := 0; Edges := No_Table; Edges_Len := 0; Vertices := No_Table; NV := 0; NK := 0; Max_Key_Len := 0; Min_Key_Len := 0; end Finalize; ---------------------------- -- Generate_Mapping_Table -- ---------------------------- procedure Generate_Mapping_Table (Tab : Integer; L1 : Natural; L2 : Natural; Seed : in out Natural) is begin for J in 0 .. L1 - 1 loop for K in 0 .. L2 - 1 loop Random (Seed); Set_Table (Tab, J, K, Seed mod NV); end loop; end loop; end Generate_Mapping_Table; ----------------------------- -- Generate_Mapping_Tables -- ----------------------------- procedure Generate_Mapping_Tables (Opt : Optimization; Seed : in out Natural) is begin -- If T1 and T2 are already allocated no need to do it twice. Reuse them -- as their size has not changed. if T1 = No_Table and then T2 = No_Table then declare Used_Char_Last : Natural := 0; Used_Char : Natural; begin if Opt = CPU_Time then for P in reverse Character'Range loop Used_Char := Get_Used_Char (P); if Used_Char /= 0 then Used_Char_Last := Used_Char; exit; end if; end loop; end if; T1_Len := Char_Pos_Set_Len; T2_Len := Used_Char_Last + 1; T1 := Allocate (T1_Len * T2_Len); T2 := Allocate (T1_Len * T2_Len); end; end if; Generate_Mapping_Table (T1, T1_Len, T2_Len, Seed); Generate_Mapping_Table (T2, T1_Len, T2_Len, Seed); if Verbose then Put_Used_Char_Set (Output, "Used Character Set"); Put_Int_Matrix (Output, "Function Table 1", T1, T1_Len, T2_Len); Put_Int_Matrix (Output, "Function Table 2", T2, T1_Len, T2_Len); end if; end Generate_Mapping_Tables; ------------------ -- Get_Char_Pos -- ------------------ function Get_Char_Pos (P : Natural) return Natural is N : constant Natural := Char_Pos_Set + P; begin return IT.Table (N); end Get_Char_Pos; --------------- -- Get_Edges -- --------------- function Get_Edges (F : Natural) return Edge_Type is N : constant Natural := Edges + (F * Edge_Size); E : Edge_Type; begin E.X := IT.Table (N); E.Y := IT.Table (N + 1); E.Key := IT.Table (N + 2); return E; end Get_Edges; --------------- -- Get_Graph -- --------------- function Get_Graph (N : Natural) return Integer is begin return IT.Table (G + N); end Get_Graph; ------------- -- Get_Key -- ------------- function Get_Key (N : Key_Id) return Key_Type is K : Key_Type; begin K.Edge := IT.Table (Keys + N); return K; end Get_Key; --------------- -- Get_Table -- --------------- function Get_Table (T : Integer; X, Y : Natural) return Natural is N : constant Natural := T + (Y * T1_Len) + X; begin return IT.Table (N); end Get_Table; ------------------- -- Get_Used_Char -- ------------------- function Get_Used_Char (C : Character) return Natural is N : constant Natural := Used_Char_Set + Character'Pos (C); begin return IT.Table (N); end Get_Used_Char; ------------------ -- Get_Vertices -- ------------------ function Get_Vertices (F : Natural) return Vertex_Type is N : constant Natural := Vertices + (F * Vertex_Size); V : Vertex_Type; begin V.First := IT.Table (N); V.Last := IT.Table (N + 1); return V; end Get_Vertices; ----------- -- Image -- ----------- function Image (Int : Integer; W : Natural := 0) return String is B : String (1 .. 32); L : Natural := 0; procedure Img (V : Natural); -- Compute image of V into B, starting at B (L), incrementing L --------- -- Img -- --------- procedure Img (V : Natural) is begin if V > 9 then Img (V / 10); end if; L := L + 1; B (L) := Character'Val ((V mod 10) + Character'Pos ('0')); end Img; -- Start of processing for Image begin if Int < 0 then L := L + 1; B (L) := '-'; Img (-Int); else Img (Int); end if; return Image (B (1 .. L), W); end Image; ----------- -- Image -- ----------- function Image (Str : String; W : Natural := 0) return String is Len : constant Natural := Str'Length; Max : Natural := Len; begin if Max < W then Max := W; end if; declare Buf : String (1 .. Max) := (1 .. Max => ' '); begin for J in 0 .. Len - 1 loop Buf (Max - Len + 1 + J) := Str (Str'First + J); end loop; return Buf; end; end Image; ------------- -- Initial -- ------------- function Initial (K : Key_Id) return Word_Id is begin return K; end Initial; ---------------- -- Initialize -- ---------------- procedure Initialize (Seed : Natural; K_To_V : Float := Default_K_To_V; Optim : Optimization := Memory_Space; Tries : Positive := Default_Tries) is begin if Verbose then Put (Output, "Initialize"); New_Line (Output); end if; -- Deallocate the part of the table concerning the reduced words. -- Initial words are already present in the table. We may have reduced -- words already there because a previous computation failed. We are -- currently retrying and the reduced words have to be deallocated. for W in Reduced (0) .. WT.Last loop Free_Word (WT.Table (W)); end loop; IT.Init; -- Initialize of computation variables Keys := No_Table; Char_Pos_Set := No_Table; Char_Pos_Set_Len := 0; Used_Char_Set := No_Table; Used_Char_Set_Len := 0; T1 := No_Table; T2 := No_Table; T1_Len := 0; T2_Len := 0; G := No_Table; G_Len := 0; Edges := No_Table; Edges_Len := 0; Vertices := No_Table; NV := 0; S := Seed; K2V := K_To_V; Opt := Optim; NT := Tries; if K2V <= 2.0 then raise Program_Error with "K to V ratio cannot be lower than 2.0"; end if; -- Do not accept a value of K2V too close to 2.0 such that once -- rounded up, NV = 2 * NK because the algorithm would not converge. NV := Natural (Float (NK) * K2V); if NV <= 2 * NK then NV := 2 * NK + 1; end if; Keys := Allocate (NK); -- Resize initial words to have all of them at the same size -- (so the size of the largest one). for K in 0 .. NK - 1 loop Resize_Word (WT.Table (Initial (K)), Max_Key_Len); end loop; -- Allocated the table to store the reduced words. As WT is a -- GNAT.Table (using C memory management), pointers have to be -- explicitly initialized to null. WT.Set_Last (Reduced (NK - 1)); -- Note: Reduced (0) = NK + 1 WT.Table (NK) := null; for W in 0 .. NK - 1 loop WT.Table (Reduced (W)) := null; end loop; end Initialize; ------------ -- Insert -- ------------ procedure Insert (Value : String) is Len : constant Natural := Value'Length; begin if Verbose then Put (Output, "Inserting """ & Value & """"); New_Line (Output); end if; for J in Value'Range loop pragma Assert (Value (J) /= ASCII.NUL); null; end loop; WT.Set_Last (NK); WT.Table (NK) := New_Word (Value); NK := NK + 1; if Max_Key_Len < Len then Max_Key_Len := Len; end if; if Min_Key_Len = 0 or else Len < Min_Key_Len then Min_Key_Len := Len; end if; end Insert; -------------- -- New_Line -- -------------- procedure New_Line (File : File_Descriptor) is begin if Write (File, EOL'Address, 1) /= 1 then raise Program_Error; end if; end New_Line; -------------- -- New_Word -- -------------- function New_Word (S : String) return Word_Type is begin return new String'(S); end New_Word; ------------------------------ -- Parse_Position_Selection -- ------------------------------ procedure Parse_Position_Selection (Argument : String) is N : Natural := Argument'First; L : constant Natural := Argument'Last; M : constant Natural := Max_Key_Len; T : array (1 .. M) of Boolean := (others => False); function Parse_Index return Natural; -- Parse argument starting at index N to find an index ----------------- -- Parse_Index -- ----------------- function Parse_Index return Natural is C : Character := Argument (N); V : Natural := 0; begin if C = '$' then N := N + 1; return M; end if; if C not in '0' .. '9' then raise Program_Error with "cannot read position argument"; end if; while C in '0' .. '9' loop V := V * 10 + (Character'Pos (C) - Character'Pos ('0')); N := N + 1; exit when L < N; C := Argument (N); end loop; return V; end Parse_Index; -- Start of processing for Parse_Position_Selection begin -- Empty specification means all the positions if L < N then Char_Pos_Set_Len := M; Char_Pos_Set := Allocate (Char_Pos_Set_Len); for C in 0 .. Char_Pos_Set_Len - 1 loop Set_Char_Pos (C, C + 1); end loop; else loop declare First, Last : Natural; begin First := Parse_Index; Last := First; -- Detect a range if N <= L and then Argument (N) = '-' then N := N + 1; Last := Parse_Index; end if; -- Include the positions in the selection for J in First .. Last loop T (J) := True; end loop; end; exit when L < N; if Argument (N) /= ',' then raise Program_Error with "cannot read position argument"; end if; N := N + 1; end loop; -- Compute position selection length N := 0; for J in T'Range loop if T (J) then N := N + 1; end if; end loop; -- Fill position selection Char_Pos_Set_Len := N; Char_Pos_Set := Allocate (Char_Pos_Set_Len); N := 0; for J in T'Range loop if T (J) then Set_Char_Pos (N, J); N := N + 1; end if; end loop; end if; end Parse_Position_Selection; ------------- -- Produce -- ------------- procedure Produce (Pkg_Name : String := Default_Pkg_Name; Use_Stdout : Boolean := False) is File : File_Descriptor := Standout; Status : Boolean; -- For call to Close function Array_Img (N, T, R1 : String; R2 : String := "") return String; -- Return string "N : constant array (R1[, R2]) of T;" function Range_Img (F, L : Natural; T : String := "") return String; -- Return string "[T range ]F .. L" function Type_Img (L : Natural) return String; -- Return the larger unsigned type T such that T'Last < L --------------- -- Array_Img -- --------------- function Array_Img (N, T, R1 : String; R2 : String := "") return String is begin Last := 0; Add (" "); Add (N); Add (" : constant array ("); Add (R1); if R2 /= "" then Add (", "); Add (R2); end if; Add (") of "); Add (T); Add (" :="); return Line (1 .. Last); end Array_Img; --------------- -- Range_Img -- --------------- function Range_Img (F, L : Natural; T : String := "") return String is FI : constant String := Image (F); FL : constant Natural := FI'Length; LI : constant String := Image (L); LL : constant Natural := LI'Length; TL : constant Natural := T'Length; RI : String (1 .. TL + 7 + FL + 4 + LL); Len : Natural := 0; begin if TL /= 0 then RI (Len + 1 .. Len + TL) := T; Len := Len + TL; RI (Len + 1 .. Len + 7) := " range "; Len := Len + 7; end if; RI (Len + 1 .. Len + FL) := FI; Len := Len + FL; RI (Len + 1 .. Len + 4) := " .. "; Len := Len + 4; RI (Len + 1 .. Len + LL) := LI; Len := Len + LL; return RI (1 .. Len); end Range_Img; -------------- -- Type_Img -- -------------- function Type_Img (L : Natural) return String is S : constant String := Image (Type_Size (L)); U : String := "Unsigned_ "; N : Natural := 9; begin for J in S'Range loop N := N + 1; U (N) := S (J); end loop; return U (1 .. N); end Type_Img; F : Natural; L : Natural; P : Natural; FName : String := Ada_File_Base_Name (Pkg_Name) & ".ads"; -- Initially, the name of the spec file, then modified to be the name of -- the body file. Not used if Use_Stdout is True. -- Start of processing for Produce begin if Verbose and then not Use_Stdout then Put (Output, "Producing " & Ada.Directories.Current_Directory & "/" & FName); New_Line (Output); end if; if not Use_Stdout then File := Create_File (FName, Binary); if File = Invalid_FD then raise Program_Error with "cannot create: " & FName; end if; end if; Put (File, "package "); Put (File, Pkg_Name); Put (File, " is"); New_Line (File); Put (File, " function Hash (S : String) return Natural;"); New_Line (File); Put (File, "end "); Put (File, Pkg_Name); Put (File, ";"); New_Line (File); if not Use_Stdout then Close (File, Status); if not Status then raise Device_Error; end if; end if; if not Use_Stdout then -- Set to body file name FName (FName'Last) := 'b'; File := Create_File (FName, Binary); if File = Invalid_FD then raise Program_Error with "cannot create: " & FName; end if; end if; Put (File, "with Interfaces; use Interfaces;"); New_Line (File); New_Line (File); Put (File, "package body "); Put (File, Pkg_Name); Put (File, " is"); New_Line (File); New_Line (File); if Opt = CPU_Time then Put (File, Array_Img ("C", Type_Img (256), "Character")); New_Line (File); F := Character'Pos (Character'First); L := Character'Pos (Character'Last); for J in Character'Range loop P := Get_Used_Char (J); Put (File, Image (P), 1, 0, 1, F, L, Character'Pos (J)); end loop; New_Line (File); end if; F := 0; L := Char_Pos_Set_Len - 1; Put (File, Array_Img ("P", "Natural", Range_Img (F, L))); New_Line (File); for J in F .. L loop Put (File, Image (Get_Char_Pos (J)), 1, 0, 1, F, L, J); end loop; New_Line (File); case Opt is when CPU_Time => Put_Int_Matrix (File, Array_Img ("T1", Type_Img (NV), Range_Img (0, T1_Len - 1), Range_Img (0, T2_Len - 1, Type_Img (256))), T1, T1_Len, T2_Len); when Memory_Space => Put_Int_Matrix (File, Array_Img ("T1", Type_Img (NV), Range_Img (0, T1_Len - 1)), T1, T1_Len, 0); end case; New_Line (File); case Opt is when CPU_Time => Put_Int_Matrix (File, Array_Img ("T2", Type_Img (NV), Range_Img (0, T1_Len - 1), Range_Img (0, T2_Len - 1, Type_Img (256))), T2, T1_Len, T2_Len); when Memory_Space => Put_Int_Matrix (File, Array_Img ("T2", Type_Img (NV), Range_Img (0, T1_Len - 1)), T2, T1_Len, 0); end case; New_Line (File); Put_Int_Vector (File, Array_Img ("G", Type_Img (NK), Range_Img (0, G_Len - 1)), G, G_Len); New_Line (File); Put (File, " function Hash (S : String) return Natural is"); New_Line (File); Put (File, " F : constant Natural := S'First - 1;"); New_Line (File); Put (File, " L : constant Natural := S'Length;"); New_Line (File); Put (File, " F1, F2 : Natural := 0;"); New_Line (File); Put (File, " J : "); case Opt is when CPU_Time => Put (File, Type_Img (256)); when Memory_Space => Put (File, "Natural"); end case; Put (File, ";"); New_Line (File); Put (File, " begin"); New_Line (File); Put (File, " for K in P'Range loop"); New_Line (File); Put (File, " exit when L < P (K);"); New_Line (File); Put (File, " J := "); case Opt is when CPU_Time => Put (File, "C"); when Memory_Space => Put (File, "Character'Pos"); end case; Put (File, " (S (P (K) + F));"); New_Line (File); Put (File, " F1 := (F1 + Natural (T1 (K"); if Opt = CPU_Time then Put (File, ", J"); end if; Put (File, "))"); if Opt = Memory_Space then Put (File, " * J"); end if; Put (File, ") mod "); Put (File, Image (NV)); Put (File, ";"); New_Line (File); Put (File, " F2 := (F2 + Natural (T2 (K"); if Opt = CPU_Time then Put (File, ", J"); end if; Put (File, "))"); if Opt = Memory_Space then Put (File, " * J"); end if; Put (File, ") mod "); Put (File, Image (NV)); Put (File, ";"); New_Line (File); Put (File, " end loop;"); New_Line (File); Put (File, " return (Natural (G (F1)) + Natural (G (F2))) mod "); Put (File, Image (NK)); Put (File, ";"); New_Line (File); Put (File, " end Hash;"); New_Line (File); New_Line (File); Put (File, "end "); Put (File, Pkg_Name); Put (File, ";"); New_Line (File); if not Use_Stdout then Close (File, Status); if not Status then raise Device_Error; end if; end if; end Produce; --------- -- Put -- --------- procedure Put (File : File_Descriptor; Str : String) is Len : constant Natural := Str'Length; begin for J in Str'Range loop pragma Assert (Str (J) /= ASCII.NUL); null; end loop; if Write (File, Str'Address, Len) /= Len then raise Program_Error; end if; end Put; --------- -- Put -- --------- procedure Put (F : File_Descriptor; S : String; F1 : Natural; L1 : Natural; C1 : Natural; F2 : Natural; L2 : Natural; C2 : Natural) is Len : constant Natural := S'Length; procedure Flush; -- Write current line, followed by LF ----------- -- Flush -- ----------- procedure Flush is begin Put (F, Line (1 .. Last)); New_Line (F); Last := 0; end Flush; -- Start of processing for Put begin if C1 = F1 and then C2 = F2 then Last := 0; end if; if Last + Len + 3 >= Max then Flush; end if; if Last = 0 then Add (" "); if F1 <= L1 then if C1 = F1 and then C2 = F2 then Add ('('); if F1 = L1 then Add ("0 .. 0 => "); end if; else Add (' '); end if; end if; end if; if C2 = F2 then Add ('('); if F2 = L2 then Add ("0 .. 0 => "); end if; else Add (' '); end if; Add (S); if C2 = L2 then Add (')'); if F1 > L1 then Add (';'); Flush; elsif C1 /= L1 then Add (','); Flush; else Add (')'); Add (';'); Flush; end if; else Add (','); end if; end Put; --------------- -- Put_Edges -- --------------- procedure Put_Edges (File : File_Descriptor; Title : String) is E : Edge_Type; F1 : constant Natural := 1; L1 : constant Natural := Edges_Len - 1; M : constant Natural := Max / 5; begin Put (File, Title); New_Line (File); -- Edges valid range is 1 .. Edge_Len - 1 for J in F1 .. L1 loop E := Get_Edges (J); Put (File, Image (J, M), F1, L1, J, 1, 4, 1); Put (File, Image (E.X, M), F1, L1, J, 1, 4, 2); Put (File, Image (E.Y, M), F1, L1, J, 1, 4, 3); Put (File, Image (E.Key, M), F1, L1, J, 1, 4, 4); end loop; end Put_Edges; ---------------------- -- Put_Initial_Keys -- ---------------------- procedure Put_Initial_Keys (File : File_Descriptor; Title : String) is F1 : constant Natural := 0; L1 : constant Natural := NK - 1; M : constant Natural := Max / 5; K : Key_Type; begin Put (File, Title); New_Line (File); for J in F1 .. L1 loop K := Get_Key (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2); Put (File, Trim_Trailing_Nuls (WT.Table (Initial (J)).all), F1, L1, J, 1, 3, 3); end loop; end Put_Initial_Keys; -------------------- -- Put_Int_Matrix -- -------------------- procedure Put_Int_Matrix (File : File_Descriptor; Title : String; Table : Integer; Len_1 : Natural; Len_2 : Natural) is F1 : constant Integer := 0; L1 : constant Integer := Len_1 - 1; F2 : constant Integer := 0; L2 : constant Integer := Len_2 - 1; Ix : Natural; begin Put (File, Title); New_Line (File); if Len_2 = 0 then for J in F1 .. L1 loop Ix := IT.Table (Table + J); Put (File, Image (Ix), 1, 0, 1, F1, L1, J); end loop; else for J in F1 .. L1 loop for K in F2 .. L2 loop Ix := IT.Table (Table + J + K * Len_1); Put (File, Image (Ix), F1, L1, J, F2, L2, K); end loop; end loop; end if; end Put_Int_Matrix; -------------------- -- Put_Int_Vector -- -------------------- procedure Put_Int_Vector (File : File_Descriptor; Title : String; Vector : Integer; Length : Natural) is F2 : constant Natural := 0; L2 : constant Natural := Length - 1; begin Put (File, Title); New_Line (File); for J in F2 .. L2 loop Put (File, Image (IT.Table (Vector + J)), 1, 0, 1, F2, L2, J); end loop; end Put_Int_Vector; ---------------------- -- Put_Reduced_Keys -- ---------------------- procedure Put_Reduced_Keys (File : File_Descriptor; Title : String) is F1 : constant Natural := 0; L1 : constant Natural := NK - 1; M : constant Natural := Max / 5; K : Key_Type; begin Put (File, Title); New_Line (File); for J in F1 .. L1 loop K := Get_Key (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (K.Edge, M), F1, L1, J, 1, 3, 2); Put (File, Trim_Trailing_Nuls (WT.Table (Reduced (J)).all), F1, L1, J, 1, 3, 3); end loop; end Put_Reduced_Keys; ----------------------- -- Put_Used_Char_Set -- ----------------------- procedure Put_Used_Char_Set (File : File_Descriptor; Title : String) is F : constant Natural := Character'Pos (Character'First); L : constant Natural := Character'Pos (Character'Last); begin Put (File, Title); New_Line (File); for J in Character'Range loop Put (File, Image (Get_Used_Char (J)), 1, 0, 1, F, L, Character'Pos (J)); end loop; end Put_Used_Char_Set; ---------------------- -- Put_Vertex_Table -- ---------------------- procedure Put_Vertex_Table (File : File_Descriptor; Title : String) is F1 : constant Natural := 0; L1 : constant Natural := NV - 1; M : constant Natural := Max / 4; V : Vertex_Type; begin Put (File, Title); New_Line (File); for J in F1 .. L1 loop V := Get_Vertices (J); Put (File, Image (J, M), F1, L1, J, 1, 3, 1); Put (File, Image (V.First, M), F1, L1, J, 1, 3, 2); Put (File, Image (V.Last, M), F1, L1, J, 1, 3, 3); end loop; end Put_Vertex_Table; ------------ -- Random -- ------------ procedure Random (Seed : in out Natural) is -- Park & Miller Standard Minimal using Schrage's algorithm to avoid -- overflow: Xn+1 = 16807 * Xn mod (2 ** 31 - 1) R : Natural; Q : Natural; X : Integer; begin R := Seed mod 127773; Q := Seed / 127773; X := 16807 * R - 2836 * Q; Seed := (if X < 0 then X + 2147483647 else X); end Random; ------------- -- Reduced -- ------------- function Reduced (K : Key_Id) return Word_Id is begin return K + NK + 1; end Reduced; ----------------- -- Resize_Word -- ----------------- procedure Resize_Word (W : in out Word_Type; Len : Natural) is S1 : constant String := W.all; S2 : String (1 .. Len) := (others => ASCII.NUL); L : constant Natural := S1'Length; begin if L /= Len then Free_Word (W); S2 (1 .. L) := S1; W := New_Word (S2); end if; end Resize_Word; -------------------------- -- Select_Char_Position -- -------------------------- procedure Select_Char_Position is type Vertex_Table_Type is array (Natural range <>) of Vertex_Type; procedure Build_Identical_Keys_Sets (Table : in out Vertex_Table_Type; Last : in out Natural; Pos : Natural); -- Build a list of keys subsets that are identical with the current -- position selection plus Pos. Once this routine is called, reduced -- words are sorted by subsets and each item (First, Last) in Sets -- defines the range of identical keys. -- Need comment saying exactly what Last is ??? function Count_Different_Keys (Table : Vertex_Table_Type; Last : Natural; Pos : Natural) return Natural; -- For each subset in Sets, count the number of different keys if we add -- Pos to the current position selection. Sel_Position : IT.Table_Type (1 .. Max_Key_Len); Last_Sel_Pos : Natural := 0; Max_Sel_Pos : Natural := 0; ------------------------------- -- Build_Identical_Keys_Sets -- ------------------------------- procedure Build_Identical_Keys_Sets (Table : in out Vertex_Table_Type; Last : in out Natural; Pos : Natural) is S : constant Vertex_Table_Type := Table (Table'First .. Last); C : constant Natural := Pos; -- Shortcuts (why are these not renames ???) F : Integer; L : Integer; -- First and last words of a subset Offset : Natural; -- GNAT.Heap_Sort assumes that the first array index is 1. Offset -- defines the translation to operate. function Lt (L, R : Natural) return Boolean; procedure Move (From : Natural; To : Natural); -- Subprograms needed by GNAT.Heap_Sort_G -------- -- Lt -- -------- function Lt (L, R : Natural) return Boolean is C : constant Natural := Pos; Left : Natural; Right : Natural; begin if L = 0 then Left := NK; Right := Offset + R; elsif R = 0 then Left := Offset + L; Right := NK; else Left := Offset + L; Right := Offset + R; end if; return WT.Table (Left)(C) < WT.Table (Right)(C); end Lt; ---------- -- Move -- ---------- procedure Move (From : Natural; To : Natural) is Target, Source : Natural; begin if From = 0 then Source := NK; Target := Offset + To; elsif To = 0 then Source := Offset + From; Target := NK; else Source := Offset + From; Target := Offset + To; end if; WT.Table (Target) := WT.Table (Source); WT.Table (Source) := null; end Move; package Sorting is new GNAT.Heap_Sort_G (Move, Lt); -- Start of processing for Build_Identical_Key_Sets begin Last := 0; -- For each subset in S, extract the new subsets we have by adding C -- in the position selection. for J in S'Range loop if S (J).First = S (J).Last then F := S (J).First; L := S (J).Last; Last := Last + 1; Table (Last) := (F, L); else Offset := Reduced (S (J).First) - 1; Sorting.Sort (S (J).Last - S (J).First + 1); F := S (J).First; L := F; for N in S (J).First .. S (J).Last loop -- For the last item, close the last subset if N = S (J).Last then Last := Last + 1; Table (Last) := (F, N); -- Two contiguous words are identical when they have the -- same Cth character. elsif WT.Table (Reduced (N))(C) = WT.Table (Reduced (N + 1))(C) then L := N + 1; -- Find a new subset of identical keys. Store the current -- one and create a new subset. else Last := Last + 1; Table (Last) := (F, L); F := N + 1; L := F; end if; end loop; end if; end loop; end Build_Identical_Keys_Sets; -------------------------- -- Count_Different_Keys -- -------------------------- function Count_Different_Keys (Table : Vertex_Table_Type; Last : Natural; Pos : Natural) return Natural is N : array (Character) of Natural; C : Character; T : Natural := 0; begin -- For each subset, count the number of words that are still -- different when we include Pos in the position selection. Only -- focus on this position as the other positions already produce -- identical keys. for S in 1 .. Last loop -- Count the occurrences of the different characters N := (others => 0); for K in Table (S).First .. Table (S).Last loop C := WT.Table (Reduced (K))(Pos); N (C) := N (C) + 1; end loop; -- Update the number of different keys. Each character used -- denotes a different key. for J in N'Range loop if N (J) > 0 then T := T + 1; end if; end loop; end loop; return T; end Count_Different_Keys; -- Start of processing for Select_Char_Position begin -- Initialize the reduced words set for K in 0 .. NK - 1 loop WT.Table (Reduced (K)) := New_Word (WT.Table (Initial (K)).all); end loop; declare Differences : Natural; Max_Differences : Natural := 0; Old_Differences : Natural; Max_Diff_Sel_Pos : Natural := 0; -- init to kill warning Max_Diff_Sel_Pos_Idx : Natural := 0; -- init to kill warning Same_Keys_Sets_Table : Vertex_Table_Type (1 .. NK); Same_Keys_Sets_Last : Natural := 1; begin for C in Sel_Position'Range loop Sel_Position (C) := C; end loop; Same_Keys_Sets_Table (1) := (0, NK - 1); loop -- Preserve maximum number of different keys and check later on -- that this value is strictly incrementing. Otherwise, it means -- that two keys are strictly identical. Old_Differences := Max_Differences; -- The first position should not exceed the minimum key length. -- Otherwise, we may end up with an empty word once reduced. Max_Sel_Pos := (if Last_Sel_Pos = 0 then Min_Key_Len else Max_Key_Len); -- Find which position increases more the number of differences for J in Last_Sel_Pos + 1 .. Max_Sel_Pos loop Differences := Count_Different_Keys (Same_Keys_Sets_Table, Same_Keys_Sets_Last, Sel_Position (J)); if Verbose then Put (Output, "Selecting position" & Sel_Position (J)'Img & " results in" & Differences'Img & " differences"); New_Line (Output); end if; if Differences > Max_Differences then Max_Differences := Differences; Max_Diff_Sel_Pos := Sel_Position (J); Max_Diff_Sel_Pos_Idx := J; end if; end loop; if Old_Differences = Max_Differences then raise Program_Error with "some keys are identical"; end if; -- Insert selected position and sort Sel_Position table Last_Sel_Pos := Last_Sel_Pos + 1; Sel_Position (Last_Sel_Pos + 1 .. Max_Diff_Sel_Pos_Idx) := Sel_Position (Last_Sel_Pos .. Max_Diff_Sel_Pos_Idx - 1); Sel_Position (Last_Sel_Pos) := Max_Diff_Sel_Pos; for P in 1 .. Last_Sel_Pos - 1 loop if Max_Diff_Sel_Pos < Sel_Position (P) then Sel_Position (P + 1 .. Last_Sel_Pos) := Sel_Position (P .. Last_Sel_Pos - 1); Sel_Position (P) := Max_Diff_Sel_Pos; exit; end if; end loop; exit when Max_Differences = NK; Build_Identical_Keys_Sets (Same_Keys_Sets_Table, Same_Keys_Sets_Last, Max_Diff_Sel_Pos); if Verbose then Put (Output, "Selecting position" & Max_Diff_Sel_Pos'Img & " results in" & Max_Differences'Img & " differences"); New_Line (Output); Put (Output, "--"); New_Line (Output); for J in 1 .. Same_Keys_Sets_Last loop for K in Same_Keys_Sets_Table (J).First .. Same_Keys_Sets_Table (J).Last loop Put (Output, Trim_Trailing_Nuls (WT.Table (Reduced (K)).all)); New_Line (Output); end loop; Put (Output, "--"); New_Line (Output); end loop; end if; end loop; end; Char_Pos_Set_Len := Last_Sel_Pos; Char_Pos_Set := Allocate (Char_Pos_Set_Len); for C in 1 .. Last_Sel_Pos loop Set_Char_Pos (C - 1, Sel_Position (C)); end loop; end Select_Char_Position; -------------------------- -- Select_Character_Set -- -------------------------- procedure Select_Character_Set is Last : Natural := 0; Used : array (Character) of Boolean := (others => False); Char : Character; begin for J in 0 .. NK - 1 loop for K in 0 .. Char_Pos_Set_Len - 1 loop Char := WT.Table (Initial (J))(Get_Char_Pos (K)); exit when Char = ASCII.NUL; Used (Char) := True; end loop; end loop; Used_Char_Set_Len := 256; Used_Char_Set := Allocate (Used_Char_Set_Len); for J in Used'Range loop if Used (J) then Set_Used_Char (J, Last); Last := Last + 1; else Set_Used_Char (J, 0); end if; end loop; end Select_Character_Set; ------------------ -- Set_Char_Pos -- ------------------ procedure Set_Char_Pos (P : Natural; Item : Natural) is N : constant Natural := Char_Pos_Set + P; begin IT.Table (N) := Item; end Set_Char_Pos; --------------- -- Set_Edges -- --------------- procedure Set_Edges (F : Natural; Item : Edge_Type) is N : constant Natural := Edges + (F * Edge_Size); begin IT.Table (N) := Item.X; IT.Table (N + 1) := Item.Y; IT.Table (N + 2) := Item.Key; end Set_Edges; --------------- -- Set_Graph -- --------------- procedure Set_Graph (N : Natural; Item : Integer) is begin IT.Table (G + N) := Item; end Set_Graph; ------------- -- Set_Key -- ------------- procedure Set_Key (N : Key_Id; Item : Key_Type) is begin IT.Table (Keys + N) := Item.Edge; end Set_Key; --------------- -- Set_Table -- --------------- procedure Set_Table (T : Integer; X, Y : Natural; Item : Natural) is N : constant Natural := T + ((Y * T1_Len) + X); begin IT.Table (N) := Item; end Set_Table; ------------------- -- Set_Used_Char -- ------------------- procedure Set_Used_Char (C : Character; Item : Natural) is N : constant Natural := Used_Char_Set + Character'Pos (C); begin IT.Table (N) := Item; end Set_Used_Char; ------------------ -- Set_Vertices -- ------------------ procedure Set_Vertices (F : Natural; Item : Vertex_Type) is N : constant Natural := Vertices + (F * Vertex_Size); begin IT.Table (N) := Item.First; IT.Table (N + 1) := Item.Last; end Set_Vertices; --------- -- Sum -- --------- function Sum (Word : Word_Type; Table : Table_Id; Opt : Optimization) return Natural is S : Natural := 0; R : Natural; begin case Opt is when CPU_Time => for J in 0 .. T1_Len - 1 loop exit when Word (J + 1) = ASCII.NUL; R := Get_Table (Table, J, Get_Used_Char (Word (J + 1))); S := (S + R) mod NV; end loop; when Memory_Space => for J in 0 .. T1_Len - 1 loop exit when Word (J + 1) = ASCII.NUL; R := Get_Table (Table, J, 0); S := (S + R * Character'Pos (Word (J + 1))) mod NV; end loop; end case; return S; end Sum; ------------------------ -- Trim_Trailing_Nuls -- ------------------------ function Trim_Trailing_Nuls (Str : String) return String is begin for J in reverse Str'Range loop if Str (J) /= ASCII.NUL then return Str (Str'First .. J); end if; end loop; return Str; end Trim_Trailing_Nuls; --------------- -- Type_Size -- --------------- function Type_Size (L : Natural) return Natural is begin if L <= 2 ** 8 then return 8; elsif L <= 2 ** 16 then return 16; else return 32; end if; end Type_Size; ----------- -- Value -- ----------- function Value (Name : Table_Name; J : Natural; K : Natural := 0) return Natural is begin case Name is when Character_Position => return Get_Char_Pos (J); when Used_Character_Set => return Get_Used_Char (Character'Val (J)); when Function_Table_1 => return Get_Table (T1, J, K); when Function_Table_2 => return Get_Table (T2, J, K); when Graph_Table => return Get_Graph (J); end case; end Value; end GNAT.Perfect_Hash_Generators;
separate (Numerics) function Dot_Product (Left_I, Right_J : in Int_Array; Left_X, Right_Y : in Real_Vector) return Real is Result : Real := 0.0; I : Nat := Left_I'First; J : Nat := Right_J'First; L : constant Nat := Left_I'Last; R : constant Nat := Right_J'Last; begin while I <= L and J <= R loop if Left_I (I) = Right_J (J) then Result := Result + Left_X (I) * Right_Y (J); I := I + 1; J := J + 1; elsif I <= L then while J <= R and then Right_J (J) < Left_I (I) loop J := J + 1; end loop; elsif J <= R then while I <= L and then Left_I (I) < Right_J (J) loop I := I + 1; end loop; end if; end loop; return Result; end Dot_Product;
package body agar.gui.widget.editable is package cbinds is procedure set_static (editable : editable_access_t; enable : c.int); pragma import (c, set_static, "AG_EditableSetStatic"); procedure set_password (editable : editable_access_t; enable : c.int); pragma import (c, set_password, "AG_EditableSetPassword"); procedure set_integer_only (editable : editable_access_t; enable : c.int); pragma import (c, set_integer_only, "AG_EditableSetIntOnly"); procedure set_float_only (editable : editable_access_t; enable : c.int); pragma import (c, set_float_only, "AG_EditableSetFltOnly"); procedure size_hint (editable : editable_access_t; text : cs.chars_ptr); pragma import (c, size_hint, "AG_EditableSizeHint"); procedure size_hint_pixels (editable : editable_access_t; width : c.int; height : c.int); pragma import (c, size_hint_pixels, "AG_EditableSizeHintPixels"); function map_position (editable : editable_access_t; x : c.int; y : c.int; pos : access c.int; absolute : c.int) return c.int; pragma import (c, map_position, "AG_EditableMapPosition"); procedure move_cursor (editable : editable_access_t; x : c.int; y : c.int; absolute : c.int); pragma import (c, move_cursor, "AG_EditableMoveCursor"); function get_cursor_position (editable : editable_access_t) return c.int; pragma import (c, get_cursor_position, "AG_EditableGetCursorPos"); function set_cursor_position (editable : editable_access_t; index : c.int) return c.int; pragma import (c, set_cursor_position, "AG_EditableSetCursorPos"); procedure set_string (editable : editable_access_t; text : cs.chars_ptr); pragma import (c, set_string, "AG_EditableSetString"); function get_integer (editable : editable_access_t) return c.int; pragma import (c, get_integer, "AG_EditableInt"); function get_float (editable : editable_access_t) return c.c_float; pragma import (c, get_float, "AG_EditableFlt"); function get_long_float (editable : editable_access_t) return c.double; pragma import (c, get_long_float, "AG_EditableDbl"); end cbinds; procedure set_static (editable : editable_access_t; enable : boolean) is begin if enable then cbinds.set_static (editable => editable, enable => 1); else cbinds.set_static (editable => editable, enable => 0); end if; end set_static; procedure set_password (editable : editable_access_t; enable : boolean) is begin if enable then cbinds.set_password (editable => editable, enable => 1); else cbinds.set_password (editable => editable, enable => 0); end if; end set_password; procedure set_integer_only (editable : editable_access_t; enable : boolean) is begin if enable then cbinds.set_integer_only (editable => editable, enable => 1); else cbinds.set_integer_only (editable => editable, enable => 0); end if; end set_integer_only; procedure set_float_only (editable : editable_access_t; enable : boolean) is begin if enable then cbinds.set_float_only (editable => editable, enable => 1); else cbinds.set_float_only (editable => editable, enable => 0); end if; end set_float_only; procedure size_hint (editable : editable_access_t; text : string) is ca_text : aliased c.char_array := c.to_c (text); begin cbinds.size_hint (editable => editable, text => cs.to_chars_ptr (ca_text'unchecked_access)); end size_hint; procedure size_hint_pixels (editable : editable_access_t; width : positive; height : positive) is begin cbinds.size_hint_pixels (editable => editable, width => c.int (width), height => c.int (height)); end size_hint_pixels; -- cursor manipulation procedure map_position (editable : editable_access_t; x : integer; y : integer; index : out natural; pos : out cursor_pos_t; absolute : boolean) is c_abs : c.int := 0; c_pos : aliased c.int; c_ind : c.int; begin if absolute then c_abs := 1; end if; c_ind := cbinds.map_position (editable => editable, x => c.int (x), y => c.int (y), pos => c_pos'unchecked_access, absolute => c_abs); index := natural (c_ind); pos := cursor_pos_t'val (c_pos); end map_position; procedure move_cursor (editable : editable_access_t; x : integer; y : integer; absolute : boolean) is c_abs : c.int := 0; begin if absolute then c_abs := 1; end if; cbinds.move_cursor (editable => editable, x => c.int (x), y => c.int (y), absolute => c_abs); end move_cursor; function get_cursor_position (editable : editable_access_t) return natural is begin return natural (cbinds.get_cursor_position (editable)); end get_cursor_position; function set_cursor_position (editable : editable_access_t; index : integer) return integer is begin return integer (cbinds.set_cursor_position (editable, c.int (index))); end set_cursor_position; -- text manipulation procedure set_string (editable : editable_access_t; text : string) is ca_text : aliased c.char_array := c.to_c (text); begin cbinds.set_string (editable, cs.to_chars_ptr (ca_text'unchecked_access)); end set_string; function get_integer (editable : editable_access_t) return integer is begin return integer (cbinds.get_integer (editable)); end get_integer; function get_float (editable : editable_access_t) return float is begin return float (cbinds.get_float (editable)); end get_float; function get_long_float (editable : editable_access_t) return long_float is begin return long_float (cbinds.get_long_float (editable)); end get_long_float; function widget (editable : editable_access_t) return widget_access_t is begin return editable.widget'access; end widget; end agar.gui.widget.editable;
package Rev with SPARK_Mode is procedure Reve (S : in out String) with SPARK_Mode, Pre => S'First < Positive'Last / 2 and S'Last < Positive'Last / 2, Post => (for all I in S'Range => S(I) = S'Old(S'First + S'Last - I)); end Rev;
with C.string; package body GMP is function Version return String is S : constant C.char_const_ptr := C.gmp.qqgmp_version; Length : constant Natural := Natural (C.string.strlen (S)); Result : String (1 .. Length); for Result'Address use S.all'Address; begin return Result; end Version; function Default_Precision return Precision is begin return Precision (C.gmp.gmpf_get_default_prec); end Default_Precision; procedure mpz_set_Long_Long_Integer ( rop : not null access C.gmp.mpz_struct; op : in Long_Long_Integer) is subtype ui is Long_Long_Integer range Long_Long_Integer (C.unsigned_long'First) .. Long_Long_Integer ( C.unsigned_long_long'Min ( C.unsigned_long_long (C.unsigned_long'Last), C.unsigned_long_long (Long_Long_Integer'Last))); op_in_ui : constant Boolean := op in ui; begin if op_in_ui then C.gmp.mpz_set_ui (rop, C.unsigned_long'Mod (op)); else declare subtype si is Long_Long_Integer range Long_Long_Integer (C.signed_long'First) .. Long_Long_Integer (C.signed_long'Last); pragma Warnings (Off); -- always True in 64bit environment op_in_si : constant Boolean := op in si; pragma Warnings (On); begin if op_in_si then C.gmp.mpz_set_si (rop, C.signed_long (op)); else C.gmp.mpz_set_si ( rop, C.signed_long (C.Shift_Right_Arithmetic ( C.signed_long_long (op), C.unsigned_long'Size))); C.gmp.mpz_mul_2exp ( rop, rop, C.unsigned_long'Size); C.gmp.mpz_add_ui ( rop, rop, C.unsigned_long'Mod (op)); end if; end; end if; end mpz_set_Long_Long_Integer; end GMP;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B O A R D _ P A R A M E T E R S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2020, 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. -- -- -- ------------------------------------------------------------------------------ -- This package defines basic parameters used by the non tasking part of -- the runtime. -- This is the TMS570 (ARMv7) version of this package package System.Board_Parameters is pragma No_Elaboration_Code_All; pragma Pure; -------------------- -- Hardware clock -- -------------------- -- see system_tms570lc43.c for clock setup Clock_Frequency : constant Natural := 300_000_000; -- GCLK clock Hz: used by the Cortex-R cores -- GCLK Max. = 300MHz on the TMS570LC43 -- GCLK Value = Max. (value on the HDK board) HCLK_Frequency : constant := Clock_Frequency / 2; -- Main clock used by the high-speed system modules -- HCLK Max. = 150MHz -- HCLK Value = Max. VCLK_Frequency : constant := HCLK_Frequency / 2; -- used by some system modules, peripheral modules accessed via the -- Peripheral Central Resource controller. -- VCLK Max. = 110MHz -- VCLK Value = 75 MHz end System.Board_Parameters;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ A T T R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Atree; use Atree; with Casing; use Casing; with Checks; use Checks; with Debug; use Debug; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Eval_Fat; with Exp_Dist; use Exp_Dist; with Exp_Util; use Exp_Util; with Expander; use Expander; with Freeze; use Freeze; with Gnatvsn; use Gnatvsn; with Itypes; use Itypes; with Lib; use Lib; with Lib.Xref; use Lib.Xref; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sdefault; use Sdefault; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Cat; use Sem_Cat; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; with Sem_Ch10; use Sem_Ch10; with Sem_Dim; use Sem_Dim; with Sem_Dist; use Sem_Dist; with Sem_Elab; use Sem_Elab; with Sem_Elim; use Sem_Elim; with Sem_Eval; use Sem_Eval; with Sem_Prag; use Sem_Prag; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sem_Util; use Sem_Util; with Sem_Warn; with Stand; use Stand; with Sinfo; use Sinfo; with Sinput; use Sinput; with System; with Stringt; use Stringt; with Style; with Stylesw; use Stylesw; with Targparm; use Targparm; with Ttypes; use Ttypes; with Tbuild; use Tbuild; with Uintp; use Uintp; with Uname; use Uname; with Urealp; use Urealp; with System.CRC32; use System.CRC32; package body Sem_Attr is True_Value : constant Uint := Uint_1; False_Value : constant Uint := Uint_0; -- Synonyms to be used when these constants are used as Boolean values Bad_Attribute : exception; -- Exception raised if an error is detected during attribute processing, -- used so that we can abandon the processing so we don't run into -- trouble with cascaded errors. -- The following array is the list of attributes defined in the Ada 83 RM. -- In Ada 83 mode, these are the only recognized attributes. In other Ada -- modes all these attributes are recognized, even if removed in Ada 95. Attribute_83 : constant Attribute_Class_Array := Attribute_Class_Array'( Attribute_Address | Attribute_Aft | Attribute_Alignment | Attribute_Base | Attribute_Callable | Attribute_Constrained | Attribute_Count | Attribute_Delta | Attribute_Digits | Attribute_Emax | Attribute_Epsilon | Attribute_First | Attribute_First_Bit | Attribute_Fore | Attribute_Image | Attribute_Large | Attribute_Last | Attribute_Last_Bit | Attribute_Leading_Part | Attribute_Length | Attribute_Machine_Emax | Attribute_Machine_Emin | Attribute_Machine_Mantissa | Attribute_Machine_Overflows | Attribute_Machine_Radix | Attribute_Machine_Rounds | Attribute_Mantissa | Attribute_Pos | Attribute_Position | Attribute_Pred | Attribute_Range | Attribute_Safe_Emax | Attribute_Safe_Large | Attribute_Safe_Small | Attribute_Size | Attribute_Small | Attribute_Storage_Size | Attribute_Succ | Attribute_Terminated | Attribute_Val | Attribute_Value | Attribute_Width => True, others => False); -- The following array is the list of attributes defined in the Ada 2005 -- RM which are not defined in Ada 95. These are recognized in Ada 95 mode, -- but in Ada 95 they are considered to be implementation defined. Attribute_05 : constant Attribute_Class_Array := Attribute_Class_Array'( Attribute_Machine_Rounding | Attribute_Mod | Attribute_Priority | Attribute_Stream_Size | Attribute_Wide_Wide_Width => True, others => False); -- The following array is the list of attributes defined in the Ada 2012 -- RM which are not defined in Ada 2005. These are recognized in Ada 95 -- and Ada 2005 modes, but are considered to be implementation defined. Attribute_12 : constant Attribute_Class_Array := Attribute_Class_Array'( Attribute_First_Valid | Attribute_Has_Same_Storage | Attribute_Last_Valid | Attribute_Max_Alignment_For_Allocation => True, others => False); -- The following array contains all attributes that imply a modification -- of their prefixes or result in an access value. Such prefixes can be -- considered as lvalues. Attribute_Name_Implies_Lvalue_Prefix : constant Attribute_Class_Array := Attribute_Class_Array'( Attribute_Access | Attribute_Address | Attribute_Input | Attribute_Read | Attribute_Unchecked_Access | Attribute_Unrestricted_Access => True, others => False); ----------------------- -- Local_Subprograms -- ----------------------- procedure Eval_Attribute (N : Node_Id); -- Performs compile time evaluation of attributes where possible, leaving -- the Is_Static_Expression/Raises_Constraint_Error flags appropriately -- set, and replacing the node with a literal node if the value can be -- computed at compile time. All static attribute references are folded, -- as well as a number of cases of non-static attributes that can always -- be computed at compile time (e.g. floating-point model attributes that -- are applied to non-static subtypes). Of course in such cases, the -- Is_Static_Expression flag will not be set on the resulting literal. -- Note that the only required action of this procedure is to catch the -- static expression cases as described in the RM. Folding of other cases -- is done where convenient, but some additional non-static folding is in -- Expand_N_Attribute_Reference in cases where this is more convenient. function Is_Anonymous_Tagged_Base (Anon : Entity_Id; Typ : Entity_Id) return Boolean; -- For derived tagged types that constrain parent discriminants we build -- an anonymous unconstrained base type. We need to recognize the relation -- between the two when analyzing an access attribute for a constrained -- component, before the full declaration for Typ has been analyzed, and -- where therefore the prefix of the attribute does not match the enclosing -- scope. procedure Set_Boolean_Result (N : Node_Id; B : Boolean); -- Rewrites node N with an occurrence of either Standard_False or -- Standard_True, depending on the value of the parameter B. The -- result is marked as a static expression. ----------------------- -- Analyze_Attribute -- ----------------------- procedure Analyze_Attribute (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Aname : constant Name_Id := Attribute_Name (N); P : constant Node_Id := Prefix (N); Exprs : constant List_Id := Expressions (N); Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname); E1 : Node_Id; E2 : Node_Id; P_Type : Entity_Id; -- Type of prefix after analysis P_Base_Type : Entity_Id; -- Base type of prefix after analysis ----------------------- -- Local Subprograms -- ----------------------- procedure Address_Checks; -- Semantic checks for valid use of Address attribute. This was made -- a separate routine with the idea of using it for unrestricted access -- which seems like it should follow the same rules, but that turned -- out to be impractical. So now this is only used for Address. procedure Analyze_Access_Attribute; -- Used for Access, Unchecked_Access, Unrestricted_Access attributes. -- Internally, Id distinguishes which of the three cases is involved. procedure Analyze_Attribute_Old_Result (Legal : out Boolean; Spec_Id : out Entity_Id); -- Common processing for attributes 'Old and 'Result. The routine checks -- that the attribute appears in a postcondition-like aspect or pragma -- associated with a suitable subprogram or a body. Flag Legal is set -- when the above criteria are met. Spec_Id denotes the entity of the -- subprogram [body] or Empty if the attribute is illegal. procedure Bad_Attribute_For_Predicate; -- Output error message for use of a predicate (First, Last, Range) not -- allowed with a type that has predicates. If the type is a generic -- actual, then the message is a warning, and we generate code to raise -- program error with an appropriate reason. No error message is given -- for internally generated uses of the attributes. This legality rule -- only applies to scalar types. procedure Check_Array_Or_Scalar_Type; -- Common procedure used by First, Last, Range attribute to check -- that the prefix is a constrained array or scalar type, or a name -- of an array object, and that an argument appears only if appropriate -- (i.e. only in the array case). procedure Check_Array_Type; -- Common semantic checks for all array attributes. Checks that the -- prefix is a constrained array type or the name of an array object. -- The error message for non-arrays is specialized appropriately. procedure Check_Asm_Attribute; -- Common semantic checks for Asm_Input and Asm_Output attributes procedure Check_Component; -- Common processing for Bit_Position, First_Bit, Last_Bit, and -- Position. Checks prefix is an appropriate selected component. procedure Check_Decimal_Fixed_Point_Type; -- Check that prefix of attribute N is a decimal fixed-point type procedure Check_Dereference; -- If the prefix of attribute is an object of an access type, then -- introduce an explicit dereference, and adjust P_Type accordingly. procedure Check_Discrete_Type; -- Verify that prefix of attribute N is a discrete type procedure Check_E0; -- Check that no attribute arguments are present procedure Check_Either_E0_Or_E1; -- Check that there are zero or one attribute arguments present procedure Check_E1; -- Check that exactly one attribute argument is present procedure Check_E2; -- Check that two attribute arguments are present procedure Check_Enum_Image; -- If the prefix type of 'Image is an enumeration type, set all its -- literals as referenced, since the image function could possibly end -- up referencing any of the literals indirectly. Same for Enum_Val. -- Set the flag only if the reference is in the main code unit. Same -- restriction when resolving 'Value; otherwise an improperly set -- reference when analyzing an inlined body will lose a proper -- warning on a useless with_clause. procedure Check_First_Last_Valid; -- Perform all checks for First_Valid and Last_Valid attributes procedure Check_Fixed_Point_Type; -- Verify that prefix of attribute N is a fixed type procedure Check_Fixed_Point_Type_0; -- Verify that prefix of attribute N is a fixed type and that -- no attribute expressions are present procedure Check_Floating_Point_Type; -- Verify that prefix of attribute N is a float type procedure Check_Floating_Point_Type_0; -- Verify that prefix of attribute N is a float type and that -- no attribute expressions are present procedure Check_Floating_Point_Type_1; -- Verify that prefix of attribute N is a float type and that -- exactly one attribute expression is present procedure Check_Floating_Point_Type_2; -- Verify that prefix of attribute N is a float type and that -- two attribute expressions are present procedure Check_SPARK_05_Restriction_On_Attribute; -- Issue an error in formal mode because attribute N is allowed procedure Check_Integer_Type; -- Verify that prefix of attribute N is an integer type procedure Check_Modular_Integer_Type; -- Verify that prefix of attribute N is a modular integer type procedure Check_Not_CPP_Type; -- Check that P (the prefix of the attribute) is not an CPP type -- for which no Ada predefined primitive is available. procedure Check_Not_Incomplete_Type; -- Check that P (the prefix of the attribute) is not an incomplete -- type or a private type for which no full view has been given. procedure Check_Object_Reference (P : Node_Id); -- Check that P is an object reference procedure Check_PolyORB_Attribute; -- Validity checking for PolyORB/DSA attribute procedure Check_Program_Unit; -- Verify that prefix of attribute N is a program unit procedure Check_Real_Type; -- Verify that prefix of attribute N is fixed or float type procedure Check_Scalar_Type; -- Verify that prefix of attribute N is a scalar type procedure Check_Standard_Prefix; -- Verify that prefix of attribute N is package Standard. Also checks -- that there are no arguments. procedure Check_Stream_Attribute (Nam : TSS_Name_Type); -- Validity checking for stream attribute. Nam is the TSS name of the -- corresponding possible defined attribute function (e.g. for the -- Read attribute, Nam will be TSS_Stream_Read). procedure Check_System_Prefix; -- Verify that prefix of attribute N is package System procedure Check_Task_Prefix; -- Verify that prefix of attribute N is a task or task type procedure Check_Type; -- Verify that the prefix of attribute N is a type procedure Check_Unit_Name (Nod : Node_Id); -- Check that Nod is of the form of a library unit name, i.e that -- it is an identifier, or a selected component whose prefix is -- itself of the form of a library unit name. Note that this is -- quite different from Check_Program_Unit, since it only checks -- the syntactic form of the name, not the semantic identity. This -- is because it is used with attributes (Elab_Body, Elab_Spec and -- Elaborated) which can refer to non-visible unit. procedure Error_Attr (Msg : String; Error_Node : Node_Id); pragma No_Return (Error_Attr); procedure Error_Attr; pragma No_Return (Error_Attr); -- Posts error using Error_Msg_N at given node, sets type of attribute -- node to Any_Type, and then raises Bad_Attribute to avoid any further -- semantic processing. The message typically contains a % insertion -- character which is replaced by the attribute name. The call with -- no arguments is used when the caller has already generated the -- required error messages. procedure Error_Attr_P (Msg : String); pragma No_Return (Error_Attr); -- Like Error_Attr, but error is posted at the start of the prefix procedure Legal_Formal_Attribute; -- Common processing for attributes Definite and Has_Discriminants. -- Checks that prefix is generic indefinite formal type. procedure Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements; -- Common processing for attributes Max_Alignment_For_Allocation and -- Max_Size_In_Storage_Elements. procedure Min_Max; -- Common processing for attributes Max and Min procedure Standard_Attribute (Val : Int); -- Used to process attributes whose prefix is package Standard which -- yield values of type Universal_Integer. The attribute reference -- node is rewritten with an integer literal of the given value which -- is marked as static. procedure Uneval_Old_Msg; -- Called when Loop_Entry or Old is used in a potentially unevaluated -- expression. Generates appropriate message or warning depending on -- the setting of Opt.Uneval_Old (or flags in an N_Aspect_Specification -- node in the aspect case). procedure Unexpected_Argument (En : Node_Id); -- Signal unexpected attribute argument (En is the argument) procedure Validate_Non_Static_Attribute_Function_Call; -- Called when processing an attribute that is a function call to a -- non-static function, i.e. an attribute function that either takes -- non-scalar arguments or returns a non-scalar result. Verifies that -- such a call does not appear in a preelaborable context. -------------------- -- Address_Checks -- -------------------- procedure Address_Checks is begin -- An Address attribute created by expansion is legal even when it -- applies to other entity-denoting expressions. if not Comes_From_Source (N) then return; -- Address attribute on a protected object self reference is legal elsif Is_Protected_Self_Reference (P) then return; -- Address applied to an entity elsif Is_Entity_Name (P) then declare Ent : constant Entity_Id := Entity (P); begin if Is_Subprogram (Ent) then Set_Address_Taken (Ent); Kill_Current_Values (Ent); -- An Address attribute is accepted when generated by the -- compiler for dispatching operation, and an error is -- issued once the subprogram is frozen (to avoid confusing -- errors about implicit uses of Address in the dispatch -- table initialization). if Has_Pragma_Inline_Always (Entity (P)) and then Comes_From_Source (P) then Error_Attr_P ("prefix of % attribute cannot be Inline_Always " & "subprogram"); -- It is illegal to apply 'Address to an intrinsic -- subprogram. This is now formalized in AI05-0095. -- In an instance, an attempt to obtain 'Address of an -- intrinsic subprogram (e.g the renaming of a predefined -- operator that is an actual) raises Program_Error. elsif Convention (Ent) = Convention_Intrinsic then if In_Instance then Rewrite (N, Make_Raise_Program_Error (Loc, Reason => PE_Address_Of_Intrinsic)); else Error_Msg_Name_1 := Aname; Error_Msg_N ("cannot take % of intrinsic subprogram", N); end if; -- Issue an error if prefix denotes an eliminated subprogram else Check_For_Eliminated_Subprogram (P, Ent); end if; -- Object or label reference elsif Is_Object (Ent) or else Ekind (Ent) = E_Label then Set_Address_Taken (Ent); -- Deal with No_Implicit_Aliasing restriction if Restriction_Check_Required (No_Implicit_Aliasing) then if not Is_Aliased_View (P) then Check_Restriction (No_Implicit_Aliasing, P); else Check_No_Implicit_Aliasing (P); end if; end if; -- If we have an address of an object, and the attribute -- comes from source, then set the object as potentially -- source modified. We do this because the resulting address -- can potentially be used to modify the variable and we -- might not detect this, leading to some junk warnings. Set_Never_Set_In_Source (Ent, False); -- Allow Address to be applied to task or protected type, -- returning null address (what is that about???) elsif (Is_Concurrent_Type (Etype (Ent)) and then Etype (Ent) = Base_Type (Ent)) or else Ekind (Ent) = E_Package or else Is_Generic_Unit (Ent) then Rewrite (N, New_Occurrence_Of (RTE (RE_Null_Address), Sloc (N))); -- Anything else is illegal else Error_Attr ("invalid prefix for % attribute", P); end if; end; -- Object is OK elsif Is_Object_Reference (P) then return; -- Subprogram called using dot notation elsif Nkind (P) = N_Selected_Component and then Is_Subprogram (Entity (Selector_Name (P))) then return; -- What exactly are we allowing here ??? and is this properly -- documented in the sinfo documentation for this node ??? elsif Relaxed_RM_Semantics and then Nkind (P) = N_Attribute_Reference then return; -- All other non-entity name cases are illegal else Error_Attr ("invalid prefix for % attribute", P); end if; end Address_Checks; ------------------------------ -- Analyze_Access_Attribute -- ------------------------------ procedure Analyze_Access_Attribute is Acc_Type : Entity_Id; Scop : Entity_Id; Typ : Entity_Id; function Build_Access_Object_Type (DT : Entity_Id) return Entity_Id; -- Build an access-to-object type whose designated type is DT, -- and whose Ekind is appropriate to the attribute type. The -- type that is constructed is returned as the result. procedure Build_Access_Subprogram_Type (P : Node_Id); -- Build an access to subprogram whose designated type is the type of -- the prefix. If prefix is overloaded, so is the node itself. The -- result is stored in Acc_Type. function OK_Self_Reference return Boolean; -- An access reference whose prefix is a type can legally appear -- within an aggregate, where it is obtained by expansion of -- a defaulted aggregate. The enclosing aggregate that contains -- the self-referenced is flagged so that the self-reference can -- be expanded into a reference to the target object (see exp_aggr). ------------------------------ -- Build_Access_Object_Type -- ------------------------------ function Build_Access_Object_Type (DT : Entity_Id) return Entity_Id is Typ : constant Entity_Id := New_Internal_Entity (E_Access_Attribute_Type, Current_Scope, Loc, 'A'); begin Set_Etype (Typ, Typ); Set_Is_Itype (Typ); Set_Associated_Node_For_Itype (Typ, N); Set_Directly_Designated_Type (Typ, DT); return Typ; end Build_Access_Object_Type; ---------------------------------- -- Build_Access_Subprogram_Type -- ---------------------------------- procedure Build_Access_Subprogram_Type (P : Node_Id) is Index : Interp_Index; It : Interp; procedure Check_Local_Access (E : Entity_Id); -- Deal with possible access to local subprogram. If we have such -- an access, we set a flag to kill all tracked values on any call -- because this access value may be passed around, and any called -- code might use it to access a local procedure which clobbers a -- tracked value. If the scope is a loop or block, indicate that -- value tracking is disabled for the enclosing subprogram. function Get_Kind (E : Entity_Id) return Entity_Kind; -- Distinguish between access to regular/protected subprograms ------------------------ -- Check_Local_Access -- ------------------------ procedure Check_Local_Access (E : Entity_Id) is begin if not Is_Library_Level_Entity (E) then Set_Suppress_Value_Tracking_On_Call (Current_Scope); Set_Suppress_Value_Tracking_On_Call (Nearest_Dynamic_Scope (Current_Scope)); end if; end Check_Local_Access; -------------- -- Get_Kind -- -------------- function Get_Kind (E : Entity_Id) return Entity_Kind is begin if Convention (E) = Convention_Protected then return E_Access_Protected_Subprogram_Type; else return E_Access_Subprogram_Type; end if; end Get_Kind; -- Start of processing for Build_Access_Subprogram_Type begin -- In the case of an access to subprogram, use the name of the -- subprogram itself as the designated type. Type-checking in -- this case compares the signatures of the designated types. -- Note: This fragment of the tree is temporarily malformed -- because the correct tree requires an E_Subprogram_Type entity -- as the designated type. In most cases this designated type is -- later overridden by the semantics with the type imposed by the -- context during the resolution phase. In the specific case of -- the expression Address!(Prim'Unrestricted_Access), used to -- initialize slots of dispatch tables, this work will be done by -- the expander (see Exp_Aggr). -- The reason to temporarily add this kind of node to the tree -- instead of a proper E_Subprogram_Type itype, is the following: -- in case of errors found in the source file we report better -- error messages. For example, instead of generating the -- following error: -- "expected access to subprogram with profile -- defined at line X" -- we currently generate: -- "expected access to function Z defined at line X" Set_Etype (N, Any_Type); if not Is_Overloaded (P) then Check_Local_Access (Entity (P)); if not Is_Intrinsic_Subprogram (Entity (P)) then Acc_Type := Create_Itype (Get_Kind (Entity (P)), N); Set_Is_Public (Acc_Type, False); Set_Etype (Acc_Type, Acc_Type); Set_Convention (Acc_Type, Convention (Entity (P))); Set_Directly_Designated_Type (Acc_Type, Entity (P)); Set_Etype (N, Acc_Type); Freeze_Before (N, Acc_Type); end if; else Get_First_Interp (P, Index, It); while Present (It.Nam) loop Check_Local_Access (It.Nam); if not Is_Intrinsic_Subprogram (It.Nam) then Acc_Type := Create_Itype (Get_Kind (It.Nam), N); Set_Is_Public (Acc_Type, False); Set_Etype (Acc_Type, Acc_Type); Set_Convention (Acc_Type, Convention (It.Nam)); Set_Directly_Designated_Type (Acc_Type, It.Nam); Add_One_Interp (N, Acc_Type, Acc_Type); Freeze_Before (N, Acc_Type); end if; Get_Next_Interp (Index, It); end loop; end if; -- Cannot be applied to intrinsic. Looking at the tests above, -- the only way Etype (N) can still be set to Any_Type is if -- Is_Intrinsic_Subprogram was True for some referenced entity. if Etype (N) = Any_Type then Error_Attr_P ("prefix of % attribute cannot be intrinsic"); end if; end Build_Access_Subprogram_Type; ---------------------- -- OK_Self_Reference -- ---------------------- function OK_Self_Reference return Boolean is Par : Node_Id; begin Par := Parent (N); while Present (Par) and then (Nkind (Par) = N_Component_Association or else Nkind (Par) in N_Subexpr) loop if Nkind_In (Par, N_Aggregate, N_Extension_Aggregate) then if Etype (Par) = Typ then Set_Has_Self_Reference (Par); -- Check the context: the aggregate must be part of the -- initialization of a type or component, or it is the -- resulting expansion in an initialization procedure. if Is_Init_Proc (Current_Scope) then return True; else Par := Parent (Par); while Present (Par) loop if Nkind (Par) = N_Full_Type_Declaration then return True; end if; Par := Parent (Par); end loop; end if; return False; end if; end if; Par := Parent (Par); end loop; -- No enclosing aggregate, or not a self-reference return False; end OK_Self_Reference; -- Start of processing for Analyze_Access_Attribute begin Check_SPARK_05_Restriction_On_Attribute; Check_E0; if Nkind (P) = N_Character_Literal then Error_Attr_P ("prefix of % attribute cannot be enumeration literal"); end if; -- Case of access to subprogram if Is_Entity_Name (P) and then Is_Overloadable (Entity (P)) then if Has_Pragma_Inline_Always (Entity (P)) then Error_Attr_P ("prefix of % attribute cannot be Inline_Always subprogram"); elsif Aname = Name_Unchecked_Access then Error_Attr ("attribute% cannot be applied to a subprogram", P); end if; -- Issue an error if the prefix denotes an eliminated subprogram Check_For_Eliminated_Subprogram (P, Entity (P)); -- Check for obsolescent subprogram reference Check_Obsolescent_2005_Entity (Entity (P), P); -- Build the appropriate subprogram type Build_Access_Subprogram_Type (P); -- For P'Access or P'Unrestricted_Access, where P is a nested -- subprogram, we might be passing P to another subprogram (but we -- don't check that here), which might call P. P could modify -- local variables, so we need to kill current values. It is -- important not to do this for library-level subprograms, because -- Kill_Current_Values is very inefficient in the case of library -- level packages with lots of tagged types. if Is_Library_Level_Entity (Entity (Prefix (N))) then null; -- Do not kill values on nodes initializing dispatch tables -- slots. The construct Prim_Ptr!(Prim'Unrestricted_Access) -- is currently generated by the expander only for this -- purpose. Done to keep the quality of warnings currently -- generated by the compiler (otherwise any declaration of -- a tagged type cleans constant indications from its scope). elsif Nkind (Parent (N)) = N_Unchecked_Type_Conversion and then (Etype (Parent (N)) = RTE (RE_Prim_Ptr) or else Etype (Parent (N)) = RTE (RE_Size_Ptr)) and then Is_Dispatching_Operation (Directly_Designated_Type (Etype (N))) then null; else Kill_Current_Values; end if; -- In the static elaboration model, treat the attribute reference -- as a call for elaboration purposes. Suppress this treatment -- under debug flag. In any case, we are all done. if not Dynamic_Elaboration_Checks and not Debug_Flag_Dot_UU then Check_Elab_Call (N); end if; return; -- Component is an operation of a protected type elsif Nkind (P) = N_Selected_Component and then Is_Overloadable (Entity (Selector_Name (P))) then if Ekind (Entity (Selector_Name (P))) = E_Entry then Error_Attr_P ("prefix of % attribute must be subprogram"); end if; Build_Access_Subprogram_Type (Selector_Name (P)); return; end if; -- Deal with incorrect reference to a type, but note that some -- accesses are allowed: references to the current type instance, -- or in Ada 2005 self-referential pointer in a default-initialized -- aggregate. if Is_Entity_Name (P) then Typ := Entity (P); -- The reference may appear in an aggregate that has been expanded -- into a loop. Locate scope of type definition, if any. Scop := Current_Scope; while Ekind (Scop) = E_Loop loop Scop := Scope (Scop); end loop; if Is_Type (Typ) then -- OK if we are within the scope of a limited type -- let's mark the component as having per object constraint if Is_Anonymous_Tagged_Base (Scop, Typ) then Typ := Scop; Set_Entity (P, Typ); Set_Etype (P, Typ); end if; if Typ = Scop then declare Q : Node_Id := Parent (N); begin while Present (Q) and then Nkind (Q) /= N_Component_Declaration loop Q := Parent (Q); end loop; if Present (Q) then Set_Has_Per_Object_Constraint (Defining_Identifier (Q), True); end if; end; if Nkind (P) = N_Expanded_Name then Error_Msg_F ("current instance prefix must be a direct name", P); end if; -- If a current instance attribute appears in a component -- constraint it must appear alone; other contexts (spec- -- expressions, within a task body) are not subject to this -- restriction. if not In_Spec_Expression and then not Has_Completion (Scop) and then not Nkind_In (Parent (N), N_Discriminant_Association, N_Index_Or_Discriminant_Constraint) then Error_Msg_N ("current instance attribute must appear alone", N); end if; if Is_CPP_Class (Root_Type (Typ)) then Error_Msg_N ("??current instance unsupported for derivations of " & "'C'P'P types", N); end if; -- OK if we are in initialization procedure for the type -- in question, in which case the reference to the type -- is rewritten as a reference to the current object. elsif Ekind (Scop) = E_Procedure and then Is_Init_Proc (Scop) and then Etype (First_Formal (Scop)) = Typ then Rewrite (N, Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uInit), Attribute_Name => Name_Unrestricted_Access)); Analyze (N); return; -- OK if a task type, this test needs sharpening up ??? elsif Is_Task_Type (Typ) then null; -- OK if self-reference in an aggregate in Ada 2005, and -- the reference comes from a copied default expression. -- Note that we check legality of self-reference even if the -- expression comes from source, e.g. when a single component -- association in an aggregate has a box association. elsif Ada_Version >= Ada_2005 and then OK_Self_Reference then null; -- OK if reference to current instance of a protected object elsif Is_Protected_Self_Reference (P) then null; -- Otherwise we have an error case else Error_Attr ("% attribute cannot be applied to type", P); return; end if; end if; end if; -- If we fall through, we have a normal access to object case -- Unrestricted_Access is (for now) legal wherever an allocator would -- be legal, so its Etype is set to E_Allocator. The expected type -- of the other attributes is a general access type, and therefore -- we label them with E_Access_Attribute_Type. if not Is_Overloaded (P) then Acc_Type := Build_Access_Object_Type (P_Type); Set_Etype (N, Acc_Type); else declare Index : Interp_Index; It : Interp; begin Set_Etype (N, Any_Type); Get_First_Interp (P, Index, It); while Present (It.Typ) loop Acc_Type := Build_Access_Object_Type (It.Typ); Add_One_Interp (N, Acc_Type, Acc_Type); Get_Next_Interp (Index, It); end loop; end; end if; -- Special cases when we can find a prefix that is an entity name declare PP : Node_Id; Ent : Entity_Id; begin PP := P; loop if Is_Entity_Name (PP) then Ent := Entity (PP); -- If we have an access to an object, and the attribute -- comes from source, then set the object as potentially -- source modified. We do this because the resulting access -- pointer can be used to modify the variable, and we might -- not detect this, leading to some junk warnings. -- We only do this for source references, since otherwise -- we can suppress warnings, e.g. from the unrestricted -- access generated for validity checks in -gnatVa mode. if Comes_From_Source (N) then Set_Never_Set_In_Source (Ent, False); end if; -- Mark entity as address taken in the case of -- 'Unrestricted_Access or subprograms, and kill current -- values. if Aname = Name_Unrestricted_Access or else Is_Subprogram (Ent) then Set_Address_Taken (Ent); end if; Kill_Current_Values (Ent); exit; elsif Nkind_In (PP, N_Selected_Component, N_Indexed_Component) then PP := Prefix (PP); else exit; end if; end loop; end; -- Check for aliased view. We allow a nonaliased prefix when within -- an instance because the prefix may have been a tagged formal -- object, which is defined to be aliased even when the actual -- might not be (other instance cases will have been caught in the -- generic). Similarly, within an inlined body we know that the -- attribute is legal in the original subprogram, and therefore -- legal in the expansion. if not Is_Aliased_View (P) and then not In_Instance and then not In_Inlined_Body and then Comes_From_Source (N) then -- Here we have a non-aliased view. This is illegal unless we -- have the case of Unrestricted_Access, where for now we allow -- this (we will reject later if expected type is access to an -- unconstrained array with a thin pointer). -- No need for an error message on a generated access reference -- for the controlling argument in a dispatching call: error will -- be reported when resolving the call. if Aname /= Name_Unrestricted_Access then Error_Attr_P ("prefix of % attribute must be aliased"); Check_No_Implicit_Aliasing (P); -- For Unrestricted_Access, record that prefix is not aliased -- to simplify legality check later on. else Set_Non_Aliased_Prefix (N); end if; -- If we have an aliased view, and we have Unrestricted_Access, then -- output a warning that Unchecked_Access would have been fine, and -- change the node to be Unchecked_Access. else -- For now, hold off on this change ??? null; end if; end Analyze_Access_Attribute; ---------------------------------- -- Analyze_Attribute_Old_Result -- ---------------------------------- procedure Analyze_Attribute_Old_Result (Legal : out Boolean; Spec_Id : out Entity_Id) is procedure Check_Placement_In_Check (Prag : Node_Id); -- Verify that the attribute appears within pragma Check that mimics -- a postcondition. procedure Check_Placement_In_Contract_Cases (Prag : Node_Id); -- Verify that the attribute appears within a consequence of aspect -- or pragma Contract_Cases denoted by Prag. procedure Check_Placement_In_Test_Case (Prag : Node_Id); -- Verify that the attribute appears within the "Ensures" argument of -- aspect or pragma Test_Case denoted by Prag. function Is_Within (Nod : Node_Id; Encl_Nod : Node_Id) return Boolean; -- Subsidiary to Check_Placemenet_In_XXX. Determine whether arbitrary -- node Nod is within enclosing node Encl_Nod. procedure Placement_Error; -- Emit a general error when the attributes does not appear in a -- postcondition-like aspect or pragma. ------------------------------ -- Check_Placement_In_Check -- ------------------------------ procedure Check_Placement_In_Check (Prag : Node_Id) is Args : constant List_Id := Pragma_Argument_Associations (Prag); Nam : constant Name_Id := Chars (Get_Pragma_Arg (First (Args))); begin -- The "Name" argument of pragma Check denotes a postcondition if Nam_In (Nam, Name_Post, Name_Post_Class, Name_Postcondition, Name_Refined_Post) then null; -- Otherwise the placement of the attribute is illegal else Placement_Error; end if; end Check_Placement_In_Check; --------------------------------------- -- Check_Placement_In_Contract_Cases -- --------------------------------------- procedure Check_Placement_In_Contract_Cases (Prag : Node_Id) is Arg : Node_Id; Cases : Node_Id; CCase : Node_Id; begin -- Obtain the argument of the aspect or pragma if Nkind (Prag) = N_Aspect_Specification then Arg := Prag; else Arg := First (Pragma_Argument_Associations (Prag)); end if; Cases := Expression (Arg); if Present (Component_Associations (Cases)) then CCase := First (Component_Associations (Cases)); while Present (CCase) loop -- Detect whether the attribute appears within the -- consequence of the current contract case. if Nkind (CCase) = N_Component_Association and then Is_Within (N, Expression (CCase)) then return; end if; Next (CCase); end loop; end if; -- Otherwise aspect or pragma Contract_Cases is either malformed -- or the attribute does not appear within a consequence. Error_Attr ("attribute % must appear in the consequence of a contract case", P); end Check_Placement_In_Contract_Cases; ---------------------------------- -- Check_Placement_In_Test_Case -- ---------------------------------- procedure Check_Placement_In_Test_Case (Prag : Node_Id) is Arg : constant Node_Id := Test_Case_Arg (Prag => Prag, Arg_Nam => Name_Ensures, From_Aspect => Nkind (Prag) = N_Aspect_Specification); begin -- Detect whether the attribute appears within the "Ensures" -- expression of aspect or pragma Test_Case. if Present (Arg) and then Is_Within (N, Arg) then null; else Error_Attr ("attribute % must appear in the ensures expression of a " & "test case", P); end if; end Check_Placement_In_Test_Case; --------------- -- Is_Within -- --------------- function Is_Within (Nod : Node_Id; Encl_Nod : Node_Id) return Boolean is Par : Node_Id; begin Par := Nod; while Present (Par) loop if Par = Encl_Nod then return True; -- Prevent the search from going too far elsif Is_Body_Or_Package_Declaration (Par) then exit; end if; Par := Parent (Par); end loop; return False; end Is_Within; --------------------- -- Placement_Error -- --------------------- procedure Placement_Error is begin if Aname = Name_Old then Error_Attr ("attribute % can only appear in postcondition", P); -- Specialize the error message for attribute 'Result else Error_Attr ("attribute % can only appear in postcondition of function", P); end if; end Placement_Error; -- Local variables Prag : Node_Id; Prag_Nam : Name_Id; Subp_Decl : Node_Id; -- Start of processing for Analyze_Attribute_Old_Result begin -- Assume that the attribute is illegal Legal := False; Spec_Id := Empty; -- Traverse the parent chain to find the aspect or pragma where the -- attribute resides. Prag := N; while Present (Prag) loop if Nkind_In (Prag, N_Aspect_Specification, N_Pragma) then exit; -- Prevent the search from going too far elsif Is_Body_Or_Package_Declaration (Prag) then exit; end if; Prag := Parent (Prag); end loop; -- The attribute is allowed to appear only in postcondition-like -- aspects or pragmas. if Nkind_In (Prag, N_Aspect_Specification, N_Pragma) then if Nkind (Prag) = N_Aspect_Specification then Prag_Nam := Chars (Identifier (Prag)); else Prag_Nam := Pragma_Name (Prag); end if; if Prag_Nam = Name_Check then Check_Placement_In_Check (Prag); elsif Prag_Nam = Name_Contract_Cases then Check_Placement_In_Contract_Cases (Prag); -- Attribute 'Result is allowed to appear in aspect or pragma -- [Refined_]Depends (SPARK RM 6.1.5(11)). elsif Nam_In (Prag_Nam, Name_Depends, Name_Refined_Depends) and then Aname = Name_Result then null; elsif Nam_In (Prag_Nam, Name_Post, Name_Post_Class, Name_Postcondition, Name_Refined_Post) then null; elsif Prag_Nam = Name_Test_Case then Check_Placement_In_Test_Case (Prag); else Placement_Error; return; end if; -- Otherwise the placement of the attribute is illegal else Placement_Error; return; end if; -- Find the related subprogram subject to the aspect or pragma if Nkind (Prag) = N_Aspect_Specification then Subp_Decl := Parent (Prag); else Subp_Decl := Find_Related_Declaration_Or_Body (Prag); end if; -- The aspect or pragma where the attribute resides should be -- associated with a subprogram declaration or a body. If this is not -- the case, then the aspect or pragma is illegal. Return as analysis -- cannot be carried out. Note that it is legal to have the aspect -- appear on a subprogram renaming, when the renamed entity is an -- attribute reference. -- Generating C code the internally built nested _postcondition -- subprograms are inlined; after expanded, inlined aspects are -- located in the internal block generated by the frontend. if Nkind (Subp_Decl) = N_Block_Statement and then Modify_Tree_For_C and then In_Inlined_Body then null; elsif not Nkind_In (Subp_Decl, N_Abstract_Subprogram_Declaration, N_Entry_Declaration, N_Generic_Subprogram_Declaration, N_Subprogram_Body, N_Subprogram_Body_Stub, N_Subprogram_Declaration, N_Subprogram_Renaming_Declaration) then return; end if; -- If we get here, then the attribute is legal Legal := True; Spec_Id := Unique_Defining_Entity (Subp_Decl); -- When generating C code, nested _postcondition subprograms are -- inlined by the front end to avoid problems (when unnested) with -- referenced itypes. Handle that here, since as part of inlining the -- expander nests subprogram within a dummy procedure named _parent -- (see Build_Postconditions_Procedure and Build_Body_To_Inline). -- Hence, in this context, the spec_id of _postconditions is the -- enclosing scope. if Modify_Tree_For_C and then Chars (Spec_Id) = Name_uParent and then Chars (Scope (Spec_Id)) = Name_uPostconditions then -- This situation occurs only when preanalyzing the inlined body pragma Assert (not Full_Analysis); Spec_Id := Scope (Spec_Id); pragma Assert (Is_Inlined (Spec_Id)); end if; end Analyze_Attribute_Old_Result; --------------------------------- -- Bad_Attribute_For_Predicate -- --------------------------------- procedure Bad_Attribute_For_Predicate is begin if Is_Scalar_Type (P_Type) and then Comes_From_Source (N) then Error_Msg_Name_1 := Aname; Bad_Predicated_Subtype_Use ("type& has predicates, attribute % not allowed", N, P_Type); end if; end Bad_Attribute_For_Predicate; -------------------------------- -- Check_Array_Or_Scalar_Type -- -------------------------------- procedure Check_Array_Or_Scalar_Type is function In_Aspect_Specification return Boolean; -- A current instance of a type in an aspect specification is an -- object and not a type, and therefore cannot be of a scalar type -- in the prefix of one of the array attributes if the attribute -- reference is part of an aspect expression. ----------------------------- -- In_Aspect_Specification -- ----------------------------- function In_Aspect_Specification return Boolean is P : Node_Id; begin P := Parent (N); while Present (P) loop if Nkind (P) = N_Aspect_Specification then return P_Type = Entity (P); elsif Nkind (P) in N_Declaration then return False; end if; P := Parent (P); end loop; return False; end In_Aspect_Specification; -- Local variables Dims : Int; Index : Entity_Id; -- Start of processing for Check_Array_Or_Scalar_Type begin -- Case of string literal or string literal subtype. These cases -- cannot arise from legal Ada code, but the expander is allowed -- to generate them. They require special handling because string -- literal subtypes do not have standard bounds (the whole idea -- of these subtypes is to avoid having to generate the bounds) if Ekind (P_Type) = E_String_Literal_Subtype then Set_Etype (N, Etype (First_Index (P_Base_Type))); return; -- Scalar types elsif Is_Scalar_Type (P_Type) then Check_Type; if Present (E1) then Error_Attr ("invalid argument in % attribute", E1); elsif In_Aspect_Specification then Error_Attr ("prefix of % attribute cannot be the current instance of a " & "scalar type", P); else Set_Etype (N, P_Base_Type); return; end if; -- The following is a special test to allow 'First to apply to -- private scalar types if the attribute comes from generated -- code. This occurs in the case of Normalize_Scalars code. elsif Is_Private_Type (P_Type) and then Present (Full_View (P_Type)) and then Is_Scalar_Type (Full_View (P_Type)) and then not Comes_From_Source (N) then Set_Etype (N, Implementation_Base_Type (P_Type)); -- Array types other than string literal subtypes handled above else Check_Array_Type; -- We know prefix is an array type, or the name of an array -- object, and that the expression, if present, is static -- and within the range of the dimensions of the type. pragma Assert (Is_Array_Type (P_Type)); Index := First_Index (P_Base_Type); if No (E1) then -- First dimension assumed Set_Etype (N, Base_Type (Etype (Index))); else Dims := UI_To_Int (Intval (E1)); for J in 1 .. Dims - 1 loop Next_Index (Index); end loop; Set_Etype (N, Base_Type (Etype (Index))); Set_Etype (E1, Standard_Integer); end if; end if; end Check_Array_Or_Scalar_Type; ---------------------- -- Check_Array_Type -- ---------------------- procedure Check_Array_Type is D : Int; -- Dimension number for array attributes begin -- If the type is a string literal type, then this must be generated -- internally, and no further check is required on its legality. if Ekind (P_Type) = E_String_Literal_Subtype then return; -- If the type is a composite, it is an illegal aggregate, no point -- in going on. elsif P_Type = Any_Composite then raise Bad_Attribute; end if; -- Normal case of array type or subtype Check_Either_E0_Or_E1; Check_Dereference; if Is_Array_Type (P_Type) then if not Is_Constrained (P_Type) and then Is_Entity_Name (P) and then Is_Type (Entity (P)) then -- Note: we do not call Error_Attr here, since we prefer to -- continue, using the relevant index type of the array, -- even though it is unconstrained. This gives better error -- recovery behavior. Error_Msg_Name_1 := Aname; Error_Msg_F ("prefix for % attribute must be constrained array", P); end if; -- The attribute reference freezes the type, and thus the -- component type, even if the attribute may not depend on the -- component. Diagnose arrays with incomplete components now. -- If the prefix is an access to array, this does not freeze -- the designated type. if Nkind (P) /= N_Explicit_Dereference then Check_Fully_Declared (Component_Type (P_Type), P); end if; D := Number_Dimensions (P_Type); else if Is_Private_Type (P_Type) then Error_Attr_P ("prefix for % attribute may not be private type"); elsif Is_Access_Type (P_Type) and then Is_Array_Type (Designated_Type (P_Type)) and then Is_Entity_Name (P) and then Is_Type (Entity (P)) then Error_Attr_P ("prefix of % attribute cannot be access type"); elsif Attr_Id = Attribute_First or else Attr_Id = Attribute_Last then Error_Attr ("invalid prefix for % attribute", P); else Error_Attr_P ("prefix for % attribute must be array"); end if; end if; if Present (E1) then Resolve (E1, Any_Integer); Set_Etype (E1, Standard_Integer); if not Is_OK_Static_Expression (E1) or else Raises_Constraint_Error (E1) then Flag_Non_Static_Expr ("expression for dimension must be static!", E1); Error_Attr; elsif UI_To_Int (Expr_Value (E1)) > D or else UI_To_Int (Expr_Value (E1)) < 1 then Error_Attr ("invalid dimension number for array type", E1); end if; end if; if (Style_Check and Style_Check_Array_Attribute_Index) and then Comes_From_Source (N) then Style.Check_Array_Attribute_Index (N, E1, D); end if; end Check_Array_Type; ------------------------- -- Check_Asm_Attribute -- ------------------------- procedure Check_Asm_Attribute is begin Check_Type; Check_E2; -- Check first argument is static string expression Analyze_And_Resolve (E1, Standard_String); if Etype (E1) = Any_Type then return; elsif not Is_OK_Static_Expression (E1) then Flag_Non_Static_Expr ("constraint argument must be static string expression!", E1); Error_Attr; end if; -- Check second argument is right type Analyze_And_Resolve (E2, Entity (P)); -- Note: that is all we need to do, we don't need to check -- that it appears in a correct context. The Ada type system -- will do that for us. end Check_Asm_Attribute; --------------------- -- Check_Component -- --------------------- procedure Check_Component is begin Check_E0; if Nkind (P) /= N_Selected_Component or else (Ekind (Entity (Selector_Name (P))) /= E_Component and then Ekind (Entity (Selector_Name (P))) /= E_Discriminant) then Error_Attr_P ("prefix for % attribute must be selected component"); end if; end Check_Component; ------------------------------------ -- Check_Decimal_Fixed_Point_Type -- ------------------------------------ procedure Check_Decimal_Fixed_Point_Type is begin Check_Type; if not Is_Decimal_Fixed_Point_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be decimal type"); end if; end Check_Decimal_Fixed_Point_Type; ----------------------- -- Check_Dereference -- ----------------------- procedure Check_Dereference is begin -- Case of a subtype mark if Is_Entity_Name (P) and then Is_Type (Entity (P)) then return; end if; -- Case of an expression Resolve (P); if Is_Access_Type (P_Type) then -- If there is an implicit dereference, then we must freeze the -- designated type of the access type, since the type of the -- referenced array is this type (see AI95-00106). -- As done elsewhere, freezing must not happen when pre-analyzing -- a pre- or postcondition or a default value for an object or for -- a formal parameter. if not In_Spec_Expression then Freeze_Before (N, Designated_Type (P_Type)); end if; Rewrite (P, Make_Explicit_Dereference (Sloc (P), Prefix => Relocate_Node (P))); Analyze_And_Resolve (P); P_Type := Etype (P); if P_Type = Any_Type then raise Bad_Attribute; end if; P_Base_Type := Base_Type (P_Type); end if; end Check_Dereference; ------------------------- -- Check_Discrete_Type -- ------------------------- procedure Check_Discrete_Type is begin Check_Type; if not Is_Discrete_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be discrete type"); end if; end Check_Discrete_Type; -------------- -- Check_E0 -- -------------- procedure Check_E0 is begin if Present (E1) then Unexpected_Argument (E1); end if; end Check_E0; -------------- -- Check_E1 -- -------------- procedure Check_E1 is begin Check_Either_E0_Or_E1; if No (E1) then -- Special-case attributes that are functions and that appear as -- the prefix of another attribute. Error is posted on parent. if Nkind (Parent (N)) = N_Attribute_Reference and then Nam_In (Attribute_Name (Parent (N)), Name_Address, Name_Code_Address, Name_Access) then Error_Msg_Name_1 := Attribute_Name (Parent (N)); Error_Msg_N ("illegal prefix for % attribute", Parent (N)); Set_Etype (Parent (N), Any_Type); Set_Entity (Parent (N), Any_Type); raise Bad_Attribute; else Error_Attr ("missing argument for % attribute", N); end if; end if; end Check_E1; -------------- -- Check_E2 -- -------------- procedure Check_E2 is begin if No (E1) then Error_Attr ("missing arguments for % attribute (2 required)", N); elsif No (E2) then Error_Attr ("missing argument for % attribute (2 required)", N); end if; end Check_E2; --------------------------- -- Check_Either_E0_Or_E1 -- --------------------------- procedure Check_Either_E0_Or_E1 is begin if Present (E2) then Unexpected_Argument (E2); end if; end Check_Either_E0_Or_E1; ---------------------- -- Check_Enum_Image -- ---------------------- procedure Check_Enum_Image is Lit : Entity_Id; begin -- When an enumeration type appears in an attribute reference, all -- literals of the type are marked as referenced. This must only be -- done if the attribute reference appears in the current source. -- Otherwise the information on references may differ between a -- normal compilation and one that performs inlining. if Is_Enumeration_Type (P_Base_Type) and then In_Extended_Main_Code_Unit (N) then Lit := First_Literal (P_Base_Type); while Present (Lit) loop Set_Referenced (Lit); Next_Literal (Lit); end loop; end if; end Check_Enum_Image; ---------------------------- -- Check_First_Last_Valid -- ---------------------------- procedure Check_First_Last_Valid is begin Check_Discrete_Type; -- Freeze the subtype now, so that the following test for predicates -- works (we set the predicates stuff up at freeze time) Insert_Actions (N, Freeze_Entity (P_Type, P)); -- Now test for dynamic predicate if Has_Predicates (P_Type) and then not (Has_Static_Predicate (P_Type)) then Error_Attr_P ("prefix of % attribute may not have dynamic predicate"); end if; -- Check non-static subtype if not Is_OK_Static_Subtype (P_Type) then Error_Attr_P ("prefix of % attribute must be a static subtype"); end if; -- Test case for no values if Expr_Value (Type_Low_Bound (P_Type)) > Expr_Value (Type_High_Bound (P_Type)) or else (Has_Predicates (P_Type) and then Is_Empty_List (Static_Discrete_Predicate (P_Type))) then Error_Attr_P ("prefix of % attribute must be subtype with at least one " & "value"); end if; end Check_First_Last_Valid; ---------------------------- -- Check_Fixed_Point_Type -- ---------------------------- procedure Check_Fixed_Point_Type is begin Check_Type; if not Is_Fixed_Point_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be fixed point type"); end if; end Check_Fixed_Point_Type; ------------------------------ -- Check_Fixed_Point_Type_0 -- ------------------------------ procedure Check_Fixed_Point_Type_0 is begin Check_Fixed_Point_Type; Check_E0; end Check_Fixed_Point_Type_0; ------------------------------- -- Check_Floating_Point_Type -- ------------------------------- procedure Check_Floating_Point_Type is begin Check_Type; if not Is_Floating_Point_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be float type"); end if; end Check_Floating_Point_Type; --------------------------------- -- Check_Floating_Point_Type_0 -- --------------------------------- procedure Check_Floating_Point_Type_0 is begin Check_Floating_Point_Type; Check_E0; end Check_Floating_Point_Type_0; --------------------------------- -- Check_Floating_Point_Type_1 -- --------------------------------- procedure Check_Floating_Point_Type_1 is begin Check_Floating_Point_Type; Check_E1; end Check_Floating_Point_Type_1; --------------------------------- -- Check_Floating_Point_Type_2 -- --------------------------------- procedure Check_Floating_Point_Type_2 is begin Check_Floating_Point_Type; Check_E2; end Check_Floating_Point_Type_2; ------------------------ -- Check_Integer_Type -- ------------------------ procedure Check_Integer_Type is begin Check_Type; if not Is_Integer_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be integer type"); end if; end Check_Integer_Type; -------------------------------- -- Check_Modular_Integer_Type -- -------------------------------- procedure Check_Modular_Integer_Type is begin Check_Type; if not Is_Modular_Integer_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be modular integer type"); end if; end Check_Modular_Integer_Type; ------------------------ -- Check_Not_CPP_Type -- ------------------------ procedure Check_Not_CPP_Type is begin if Is_Tagged_Type (Etype (P)) and then Convention (Etype (P)) = Convention_CPP and then Is_CPP_Class (Root_Type (Etype (P))) then Error_Attr_P ("invalid use of % attribute with 'C'P'P tagged type"); end if; end Check_Not_CPP_Type; ------------------------------- -- Check_Not_Incomplete_Type -- ------------------------------- procedure Check_Not_Incomplete_Type is E : Entity_Id; Typ : Entity_Id; begin -- Ada 2005 (AI-50217, AI-326): If the prefix is an explicit -- dereference we have to check wrong uses of incomplete types -- (other wrong uses are checked at their freezing point). -- In Ada 2012, incomplete types can appear in subprogram -- profiles, but formals with incomplete types cannot be the -- prefix of attributes. -- Example 1: Limited-with -- limited with Pkg; -- package P is -- type Acc is access Pkg.T; -- X : Acc; -- S : Integer := X.all'Size; -- ERROR -- end P; -- Example 2: Tagged incomplete -- type T is tagged; -- type Acc is access all T; -- X : Acc; -- S : constant Integer := X.all'Size; -- ERROR -- procedure Q (Obj : Integer := X.all'Alignment); -- ERROR if Ada_Version >= Ada_2005 and then Nkind (P) = N_Explicit_Dereference then E := P; while Nkind (E) = N_Explicit_Dereference loop E := Prefix (E); end loop; Typ := Etype (E); if From_Limited_With (Typ) then Error_Attr_P ("prefix of % attribute cannot be an incomplete type"); -- If the prefix is an access type check the designated type elsif Is_Access_Type (Typ) and then Nkind (P) = N_Explicit_Dereference then Typ := Directly_Designated_Type (Typ); end if; if Is_Class_Wide_Type (Typ) then Typ := Root_Type (Typ); end if; -- A legal use of a shadow entity occurs only when the unit where -- the non-limited view resides is imported via a regular with -- clause in the current body. Such references to shadow entities -- may occur in subprogram formals. if Is_Incomplete_Type (Typ) and then From_Limited_With (Typ) and then Present (Non_Limited_View (Typ)) and then Is_Legal_Shadow_Entity_In_Body (Typ) then Typ := Non_Limited_View (Typ); end if; -- If still incomplete, it can be a local incomplete type, or a -- limited view whose scope is also a limited view. if Ekind (Typ) = E_Incomplete_Type then if not From_Limited_With (Typ) and then No (Full_View (Typ)) then Error_Attr_P ("prefix of % attribute cannot be an incomplete type"); -- The limited view may be available indirectly through -- an intermediate unit. If the non-limited view is available -- the attribute reference is legal. elsif From_Limited_With (Typ) and then (No (Non_Limited_View (Typ)) or else Is_Incomplete_Type (Non_Limited_View (Typ))) then Error_Attr_P ("prefix of % attribute cannot be an incomplete type"); end if; end if; -- Ada 2012 : formals in bodies may be incomplete, but no attribute -- legally applies. elsif Is_Entity_Name (P) and then Is_Formal (Entity (P)) and then Is_Incomplete_Type (Etype (Etype (P))) then Error_Attr_P ("prefix of % attribute cannot be an incomplete type"); end if; if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) or else In_Spec_Expression then return; else Check_Fully_Declared (P_Type, P); end if; end Check_Not_Incomplete_Type; ---------------------------- -- Check_Object_Reference -- ---------------------------- procedure Check_Object_Reference (P : Node_Id) is Rtyp : Entity_Id; begin -- If we need an object, and we have a prefix that is the name of -- a function entity, convert it into a function call. if Is_Entity_Name (P) and then Ekind (Entity (P)) = E_Function then Rtyp := Etype (Entity (P)); Rewrite (P, Make_Function_Call (Sloc (P), Name => Relocate_Node (P))); Analyze_And_Resolve (P, Rtyp); -- Otherwise we must have an object reference elsif not Is_Object_Reference (P) then Error_Attr_P ("prefix of % attribute must be object"); end if; end Check_Object_Reference; ---------------------------- -- Check_PolyORB_Attribute -- ---------------------------- procedure Check_PolyORB_Attribute is begin Validate_Non_Static_Attribute_Function_Call; Check_Type; Check_Not_CPP_Type; if Get_PCS_Name /= Name_PolyORB_DSA then Error_Attr ("attribute% requires the 'Poly'O'R'B 'P'C'S", N); end if; end Check_PolyORB_Attribute; ------------------------ -- Check_Program_Unit -- ------------------------ procedure Check_Program_Unit is begin if Is_Entity_Name (P) then declare K : constant Entity_Kind := Ekind (Entity (P)); T : constant Entity_Id := Etype (Entity (P)); begin if K in Subprogram_Kind or else K in Task_Kind or else K in Protected_Kind or else K = E_Package or else K in Generic_Unit_Kind or else (K = E_Variable and then (Is_Task_Type (T) or else Is_Protected_Type (T))) then return; end if; end; end if; Error_Attr_P ("prefix of % attribute must be program unit"); end Check_Program_Unit; --------------------- -- Check_Real_Type -- --------------------- procedure Check_Real_Type is begin Check_Type; if not Is_Real_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be real type"); end if; end Check_Real_Type; ----------------------- -- Check_Scalar_Type -- ----------------------- procedure Check_Scalar_Type is begin Check_Type; if not Is_Scalar_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be scalar type"); end if; end Check_Scalar_Type; ------------------------------------------ -- Check_SPARK_05_Restriction_On_Attribute -- ------------------------------------------ procedure Check_SPARK_05_Restriction_On_Attribute is begin Error_Msg_Name_1 := Aname; Check_SPARK_05_Restriction ("attribute % is not allowed", P); end Check_SPARK_05_Restriction_On_Attribute; --------------------------- -- Check_Standard_Prefix -- --------------------------- procedure Check_Standard_Prefix is begin Check_E0; if Nkind (P) /= N_Identifier or else Chars (P) /= Name_Standard then Error_Attr ("only allowed prefix for % attribute is Standard", P); end if; end Check_Standard_Prefix; ---------------------------- -- Check_Stream_Attribute -- ---------------------------- procedure Check_Stream_Attribute (Nam : TSS_Name_Type) is Etyp : Entity_Id; Btyp : Entity_Id; In_Shared_Var_Procs : Boolean; -- True when compiling System.Shared_Storage.Shared_Var_Procs body. -- For this runtime package (always compiled in GNAT mode), we allow -- stream attributes references for limited types for the case where -- shared passive objects are implemented using stream attributes, -- which is the default in GNAT's persistent storage implementation. begin Validate_Non_Static_Attribute_Function_Call; -- With the exception of 'Input, Stream attributes are procedures, -- and can only appear at the position of procedure calls. We check -- for this here, before they are rewritten, to give a more precise -- diagnostic. if Nam = TSS_Stream_Input then null; elsif Is_List_Member (N) and then not Nkind_In (Parent (N), N_Procedure_Call_Statement, N_Aggregate) then null; else Error_Attr ("invalid context for attribute%, which is a procedure", N); end if; Check_Type; Btyp := Implementation_Base_Type (P_Type); -- Stream attributes not allowed on limited types unless the -- attribute reference was generated by the expander (in which -- case the underlying type will be used, as described in Sinfo), -- or the attribute was specified explicitly for the type itself -- or one of its ancestors (taking visibility rules into account if -- in Ada 2005 mode), or a pragma Stream_Convert applies to Btyp -- (with no visibility restriction). declare Gen_Body : constant Node_Id := Enclosing_Generic_Body (N); begin if Present (Gen_Body) then In_Shared_Var_Procs := Is_RTE (Corresponding_Spec (Gen_Body), RE_Shared_Var_Procs); else In_Shared_Var_Procs := False; end if; end; if (Comes_From_Source (N) and then not (In_Shared_Var_Procs or In_Instance)) and then not Stream_Attribute_Available (P_Type, Nam) and then not Has_Rep_Pragma (Btyp, Name_Stream_Convert) then Error_Msg_Name_1 := Aname; if Is_Limited_Type (P_Type) then Error_Msg_NE ("limited type& has no% attribute", P, P_Type); Explain_Limited_Type (P_Type, P); else Error_Msg_NE ("attribute% for type& is not available", P, P_Type); end if; end if; -- Check for no stream operations allowed from No_Tagged_Streams if Is_Tagged_Type (P_Type) and then Present (No_Tagged_Streams_Pragma (P_Type)) then Error_Msg_Sloc := Sloc (No_Tagged_Streams_Pragma (P_Type)); Error_Msg_NE ("no stream operations for & (No_Tagged_Streams #)", N, P_Type); return; end if; -- Check restriction violations -- First check the No_Streams restriction, which prohibits the use -- of explicit stream attributes in the source program. We do not -- prevent the occurrence of stream attributes in generated code, -- for instance those generated implicitly for dispatching purposes. if Comes_From_Source (N) then Check_Restriction (No_Streams, P); end if; -- AI05-0057: if restriction No_Default_Stream_Attributes is active, -- it is illegal to use a predefined elementary type stream attribute -- either by itself, or more importantly as part of the attribute -- subprogram for a composite type. However, if the broader -- restriction No_Streams is active, stream operations are not -- generated, and there is no error. if Restriction_Active (No_Default_Stream_Attributes) and then not Restriction_Active (No_Streams) then declare T : Entity_Id; begin if Nam = TSS_Stream_Input or else Nam = TSS_Stream_Read then T := Type_Without_Stream_Operation (P_Type, TSS_Stream_Read); else T := Type_Without_Stream_Operation (P_Type, TSS_Stream_Write); end if; if Present (T) then Check_Restriction (No_Default_Stream_Attributes, N); Error_Msg_NE ("missing user-defined Stream Read or Write for type&", N, T); if not Is_Elementary_Type (P_Type) then Error_Msg_NE ("\which is a component of type&", N, P_Type); end if; end if; end; end if; -- Check special case of Exception_Id and Exception_Occurrence which -- are not allowed for restriction No_Exception_Registration. if Restriction_Check_Required (No_Exception_Registration) and then (Is_RTE (P_Type, RE_Exception_Id) or else Is_RTE (P_Type, RE_Exception_Occurrence)) then Check_Restriction (No_Exception_Registration, P); end if; -- Here we must check that the first argument is an access type -- that is compatible with Ada.Streams.Root_Stream_Type'Class. Analyze_And_Resolve (E1); Etyp := Etype (E1); -- Note: the double call to Root_Type here is needed because the -- root type of a class-wide type is the corresponding type (e.g. -- X for X'Class, and we really want to go to the root.) if not Is_Access_Type (Etyp) or else Root_Type (Root_Type (Designated_Type (Etyp))) /= RTE (RE_Root_Stream_Type) then Error_Attr ("expected access to Ada.Streams.Root_Stream_Type''Class", E1); end if; -- Check that the second argument is of the right type if there is -- one (the Input attribute has only one argument so this is skipped) if Present (E2) then Analyze (E2); if Nam = TSS_Stream_Read and then not Is_OK_Variable_For_Out_Formal (E2) then Error_Attr ("second argument of % attribute must be a variable", E2); end if; Resolve (E2, P_Type); end if; Check_Not_CPP_Type; end Check_Stream_Attribute; ------------------------- -- Check_System_Prefix -- ------------------------- procedure Check_System_Prefix is begin if Nkind (P) /= N_Identifier or else Chars (P) /= Name_System then Error_Attr ("only allowed prefix for % attribute is System", P); end if; end Check_System_Prefix; ----------------------- -- Check_Task_Prefix -- ----------------------- procedure Check_Task_Prefix is begin Analyze (P); -- Ada 2005 (AI-345): Attribute 'Terminated can be applied to -- task interface class-wide types. if Is_Task_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Task_Type (Designated_Type (Etype (P)))) or else (Ada_Version >= Ada_2005 and then Ekind (Etype (P)) = E_Class_Wide_Type and then Is_Interface (Etype (P)) and then Is_Task_Interface (Etype (P))) then Resolve (P); else if Ada_Version >= Ada_2005 then Error_Attr_P ("prefix of % attribute must be a task or a task " & "interface class-wide object"); else Error_Attr_P ("prefix of % attribute must be a task"); end if; end if; end Check_Task_Prefix; ---------------- -- Check_Type -- ---------------- -- The possibilities are an entity name denoting a type, or an -- attribute reference that denotes a type (Base or Class). If -- the type is incomplete, replace it with its full view. procedure Check_Type is begin if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) then Error_Attr_P ("prefix of % attribute must be a type"); elsif Is_Protected_Self_Reference (P) then Error_Attr_P ("prefix of % attribute denotes current instance " & "(RM 9.4(21/2))"); elsif Ekind (Entity (P)) = E_Incomplete_Type and then Present (Full_View (Entity (P))) then P_Type := Full_View (Entity (P)); Set_Entity (P, P_Type); end if; end Check_Type; --------------------- -- Check_Unit_Name -- --------------------- procedure Check_Unit_Name (Nod : Node_Id) is begin if Nkind (Nod) = N_Identifier then return; elsif Nkind_In (Nod, N_Selected_Component, N_Expanded_Name) then Check_Unit_Name (Prefix (Nod)); if Nkind (Selector_Name (Nod)) = N_Identifier then return; end if; end if; Error_Attr ("argument for % attribute must be unit name", P); end Check_Unit_Name; ---------------- -- Error_Attr -- ---------------- procedure Error_Attr is begin Set_Etype (N, Any_Type); Set_Entity (N, Any_Type); raise Bad_Attribute; end Error_Attr; procedure Error_Attr (Msg : String; Error_Node : Node_Id) is begin Error_Msg_Name_1 := Aname; Error_Msg_N (Msg, Error_Node); Error_Attr; end Error_Attr; ------------------ -- Error_Attr_P -- ------------------ procedure Error_Attr_P (Msg : String) is begin Error_Msg_Name_1 := Aname; Error_Msg_F (Msg, P); Error_Attr; end Error_Attr_P; ---------------------------- -- Legal_Formal_Attribute -- ---------------------------- procedure Legal_Formal_Attribute is begin Check_E0; if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) then Error_Attr_P ("prefix of % attribute must be generic type"); elsif Is_Generic_Actual_Type (Entity (P)) or else In_Instance or else In_Inlined_Body then null; elsif Is_Generic_Type (Entity (P)) then if Is_Definite_Subtype (Entity (P)) then Error_Attr_P ("prefix of % attribute must be indefinite generic type"); end if; else Error_Attr_P ("prefix of % attribute must be indefinite generic type"); end if; Set_Etype (N, Standard_Boolean); end Legal_Formal_Attribute; --------------------------------------------------------------- -- Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements -- --------------------------------------------------------------- procedure Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements is begin Check_E0; Check_Type; Check_Not_Incomplete_Type; Set_Etype (N, Universal_Integer); end Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements; ------------- -- Min_Max -- ------------- procedure Min_Max is begin Check_E2; Check_Scalar_Type; Resolve (E1, P_Base_Type); Resolve (E2, P_Base_Type); Set_Etype (N, P_Base_Type); -- Check for comparison on unordered enumeration type if Bad_Unordered_Enumeration_Reference (N, P_Base_Type) then Error_Msg_Sloc := Sloc (P_Base_Type); Error_Msg_NE ("comparison on unordered enumeration type& declared#?U?", N, P_Base_Type); end if; end Min_Max; ------------------------ -- Standard_Attribute -- ------------------------ procedure Standard_Attribute (Val : Int) is begin Check_Standard_Prefix; Rewrite (N, Make_Integer_Literal (Loc, Val)); Analyze (N); Set_Is_Static_Expression (N, True); end Standard_Attribute; -------------------- -- Uneval_Old_Msg -- -------------------- procedure Uneval_Old_Msg is Uneval_Old_Setting : Character; Prag : Node_Id; begin -- If from aspect, then Uneval_Old_Setting comes from flags in the -- N_Aspect_Specification node that corresponds to the attribute. -- First find the pragma in which we appear (note that at this stage, -- even if we appeared originally within an aspect specification, we -- are now within the corresponding pragma). Prag := N; loop Prag := Parent (Prag); exit when No (Prag) or else Nkind (Prag) = N_Pragma; end loop; if Present (Prag) then if Uneval_Old_Accept (Prag) then Uneval_Old_Setting := 'A'; elsif Uneval_Old_Warn (Prag) then Uneval_Old_Setting := 'W'; else Uneval_Old_Setting := 'E'; end if; -- If we did not find the pragma, that's odd, just use the setting -- from Opt.Uneval_Old. Perhaps this is due to a previous error? else Uneval_Old_Setting := Opt.Uneval_Old; end if; -- Processing depends on the setting of Uneval_Old case Uneval_Old_Setting is when 'E' => Error_Attr_P ("prefix of attribute % that is potentially " & "unevaluated must denote an entity"); when 'W' => Error_Msg_Name_1 := Aname; Error_Msg_F ("??prefix of attribute % appears in potentially " & "unevaluated context, exception may be raised", P); when 'A' => null; when others => raise Program_Error; end case; end Uneval_Old_Msg; ------------------------- -- Unexpected Argument -- ------------------------- procedure Unexpected_Argument (En : Node_Id) is begin Error_Attr ("unexpected argument for % attribute", En); end Unexpected_Argument; ------------------------------------------------- -- Validate_Non_Static_Attribute_Function_Call -- ------------------------------------------------- -- This function should be moved to Sem_Dist ??? procedure Validate_Non_Static_Attribute_Function_Call is begin if In_Preelaborated_Unit and then not In_Subprogram_Or_Concurrent_Unit then Flag_Non_Static_Expr ("non-static function call in preelaborated unit!", N); end if; end Validate_Non_Static_Attribute_Function_Call; -- Start of processing for Analyze_Attribute begin -- Immediate return if unrecognized attribute (already diagnosed by -- parser, so there is nothing more that we need to do). if not Is_Attribute_Name (Aname) then raise Bad_Attribute; end if; Check_Restriction_No_Use_Of_Attribute (N); -- Deal with Ada 83 issues if Comes_From_Source (N) then if not Attribute_83 (Attr_Id) then if Ada_Version = Ada_83 and then Comes_From_Source (N) then Error_Msg_Name_1 := Aname; Error_Msg_N ("(Ada 83) attribute% is not standard??", N); end if; if Attribute_Impl_Def (Attr_Id) then Check_Restriction (No_Implementation_Attributes, N); end if; end if; end if; -- Deal with Ada 2005 attributes that are implementation attributes -- because they appear in a version of Ada before Ada 2005, and -- similarly for Ada 2012 attributes appearing in an earlier version. if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005) or else (Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012) then Check_Restriction (No_Implementation_Attributes, N); end if; -- Remote access to subprogram type access attribute reference needs -- unanalyzed copy for tree transformation. The analyzed copy is used -- for its semantic information (whether prefix is a remote subprogram -- name), the unanalyzed copy is used to construct new subtree rooted -- with N_Aggregate which represents a fat pointer aggregate. if Aname = Name_Access then Discard_Node (Copy_Separate_Tree (N)); end if; -- Analyze prefix and exit if error in analysis. If the prefix is an -- incomplete type, use full view if available. Note that there are -- some attributes for which we do not analyze the prefix, since the -- prefix is not a normal name, or else needs special handling. if Aname /= Name_Elab_Body and then Aname /= Name_Elab_Spec and then Aname /= Name_Elab_Subp_Body and then Aname /= Name_Enabled and then Aname /= Name_Old then Analyze (P); P_Type := Etype (P); if Is_Entity_Name (P) and then Present (Entity (P)) and then Is_Type (Entity (P)) then if Ekind (Entity (P)) = E_Incomplete_Type then P_Type := Get_Full_View (P_Type); Set_Entity (P, P_Type); Set_Etype (P, P_Type); elsif Entity (P) = Current_Scope and then Is_Record_Type (Entity (P)) then -- Use of current instance within the type. Verify that if the -- attribute appears within a constraint, it yields an access -- type, other uses are illegal. declare Par : Node_Id; begin Par := Parent (N); while Present (Par) and then Nkind (Parent (Par)) /= N_Component_Definition loop Par := Parent (Par); end loop; if Present (Par) and then Nkind (Par) = N_Subtype_Indication then if Attr_Id /= Attribute_Access and then Attr_Id /= Attribute_Unchecked_Access and then Attr_Id /= Attribute_Unrestricted_Access then Error_Msg_N ("in a constraint the current instance can only " & "be used with an access attribute", N); end if; end if; end; end if; end if; if P_Type = Any_Type then raise Bad_Attribute; end if; P_Base_Type := Base_Type (P_Type); end if; -- Analyze expressions that may be present, exiting if an error occurs if No (Exprs) then E1 := Empty; E2 := Empty; else E1 := First (Exprs); -- Skip analysis for case of Restriction_Set, we do not expect -- the argument to be analyzed in this case. if Aname /= Name_Restriction_Set then Analyze (E1); -- Check for missing/bad expression (result of previous error) if No (E1) or else Etype (E1) = Any_Type then raise Bad_Attribute; end if; end if; E2 := Next (E1); if Present (E2) then Analyze (E2); if Etype (E2) = Any_Type then raise Bad_Attribute; end if; if Present (Next (E2)) then Unexpected_Argument (Next (E2)); end if; end if; end if; -- Cases where prefix must be resolvable by itself if Is_Overloaded (P) and then Aname /= Name_Access and then Aname /= Name_Address and then Aname /= Name_Code_Address and then Aname /= Name_Result and then Aname /= Name_Unchecked_Access then -- The prefix must be resolvable by itself, without reference to the -- attribute. One case that requires special handling is a prefix -- that is a function name, where one interpretation may be a -- parameterless call. Entry attributes are handled specially below. if Is_Entity_Name (P) and then not Nam_In (Aname, Name_Count, Name_Caller) then Check_Parameterless_Call (P); end if; if Is_Overloaded (P) then -- Ada 2005 (AI-345): Since protected and task types have -- primitive entry wrappers, the attributes Count, and Caller -- require a context check if Nam_In (Aname, Name_Count, Name_Caller) then declare Count : Natural := 0; I : Interp_Index; It : Interp; begin Get_First_Interp (P, I, It); while Present (It.Nam) loop if Comes_From_Source (It.Nam) then Count := Count + 1; else Remove_Interp (I); end if; Get_Next_Interp (I, It); end loop; if Count > 1 then Error_Attr ("ambiguous prefix for % attribute", P); else Set_Is_Overloaded (P, False); end if; end; else Error_Attr ("ambiguous prefix for % attribute", P); end if; end if; end if; -- In SPARK, attributes of private types are only allowed if the full -- type declaration is visible. -- Note: the check for Present (Entity (P)) defends against some error -- conditions where the Entity field is not set. if Is_Entity_Name (P) and then Present (Entity (P)) and then Is_Type (Entity (P)) and then Is_Private_Type (P_Type) and then not In_Open_Scopes (Scope (P_Type)) and then not In_Spec_Expression then Check_SPARK_05_Restriction ("invisible attribute of type", N); end if; -- Remaining processing depends on attribute case Attr_Id is -- Attributes related to Ada 2012 iterators. Attribute specifications -- exist for these, but they cannot be queried. when Attribute_Constant_Indexing | Attribute_Default_Iterator | Attribute_Implicit_Dereference | Attribute_Iterator_Element | Attribute_Iterable | Attribute_Variable_Indexing => Error_Msg_N ("illegal attribute", N); -- Internal attributes used to deal with Ada 2012 delayed aspects. These -- were already rejected by the parser. Thus they shouldn't appear here. when Internal_Attribute_Id => raise Program_Error; ------------------ -- Abort_Signal -- ------------------ when Attribute_Abort_Signal => Check_Standard_Prefix; Rewrite (N, New_Occurrence_Of (Stand.Abort_Signal, Loc)); Analyze (N); ------------ -- Access -- ------------ when Attribute_Access => Analyze_Access_Attribute; Check_Not_Incomplete_Type; ------------- -- Address -- ------------- when Attribute_Address => Check_E0; Address_Checks; Check_Not_Incomplete_Type; Set_Etype (N, RTE (RE_Address)); ------------------ -- Address_Size -- ------------------ when Attribute_Address_Size => Standard_Attribute (System_Address_Size); -------------- -- Adjacent -- -------------- when Attribute_Adjacent => Check_Floating_Point_Type_2; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); Resolve (E2, P_Base_Type); --------- -- Aft -- --------- when Attribute_Aft => Check_Fixed_Point_Type_0; Set_Etype (N, Universal_Integer); --------------- -- Alignment -- --------------- when Attribute_Alignment => -- Don't we need more checking here, cf Size ??? Check_E0; Check_Not_Incomplete_Type; Check_Not_CPP_Type; Set_Etype (N, Universal_Integer); --------------- -- Asm_Input -- --------------- when Attribute_Asm_Input => Check_Asm_Attribute; -- The back end may need to take the address of E2 if Is_Entity_Name (E2) then Set_Address_Taken (Entity (E2)); end if; Set_Etype (N, RTE (RE_Asm_Input_Operand)); ---------------- -- Asm_Output -- ---------------- when Attribute_Asm_Output => Check_Asm_Attribute; if Etype (E2) = Any_Type then return; elsif Aname = Name_Asm_Output then if not Is_Variable (E2) then Error_Attr ("second argument for Asm_Output is not variable", E2); end if; end if; Note_Possible_Modification (E2, Sure => True); -- The back end may need to take the address of E2 if Is_Entity_Name (E2) then Set_Address_Taken (Entity (E2)); end if; Set_Etype (N, RTE (RE_Asm_Output_Operand)); ----------------------------- -- Atomic_Always_Lock_Free -- ----------------------------- when Attribute_Atomic_Always_Lock_Free => Check_E0; Check_Type; Set_Etype (N, Standard_Boolean); ---------- -- Base -- ---------- -- Note: when the base attribute appears in the context of a subtype -- mark, the analysis is done by Sem_Ch8.Find_Type, rather than by -- the following circuit. when Attribute_Base => Base : declare Typ : Entity_Id; begin Check_E0; Find_Type (P); Typ := Entity (P); if Ada_Version >= Ada_95 and then not Is_Scalar_Type (Typ) and then not Is_Generic_Type (Typ) then Error_Attr_P ("prefix of Base attribute must be scalar type"); elsif Sloc (Typ) = Standard_Location and then Base_Type (Typ) = Typ and then Warn_On_Redundant_Constructs then Error_Msg_NE -- CODEFIX ("?r?redundant attribute, & is its own base type", N, Typ); end if; if Nkind (Parent (N)) /= N_Attribute_Reference then Error_Msg_Name_1 := Aname; Check_SPARK_05_Restriction ("attribute% is only allowed as prefix of another attribute", P); end if; Set_Etype (N, Base_Type (Entity (P))); Set_Entity (N, Base_Type (Entity (P))); Rewrite (N, New_Occurrence_Of (Entity (N), Loc)); Analyze (N); end Base; --------- -- Bit -- --------- when Attribute_Bit => Check_E0; if not Is_Object_Reference (P) then Error_Attr_P ("prefix for % attribute must be object"); -- What about the access object cases ??? else null; end if; Set_Etype (N, Universal_Integer); --------------- -- Bit_Order -- --------------- when Attribute_Bit_Order => Check_E0; Check_Type; if not Is_Record_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be record type"); end if; if Bytes_Big_Endian xor Reverse_Bit_Order (P_Type) then Rewrite (N, New_Occurrence_Of (RTE (RE_High_Order_First), Loc)); else Rewrite (N, New_Occurrence_Of (RTE (RE_Low_Order_First), Loc)); end if; Set_Etype (N, RTE (RE_Bit_Order)); Resolve (N); -- Reset incorrect indication of staticness Set_Is_Static_Expression (N, False); ------------------ -- Bit_Position -- ------------------ -- Note: in generated code, we can have a Bit_Position attribute -- applied to a (naked) record component (i.e. the prefix is an -- identifier that references an E_Component or E_Discriminant -- entity directly, and this is interpreted as expected by Gigi. -- The following code will not tolerate such usage, but when the -- expander creates this special case, it marks it as analyzed -- immediately and sets an appropriate type. when Attribute_Bit_Position => if Comes_From_Source (N) then Check_Component; end if; Set_Etype (N, Universal_Integer); ------------------ -- Body_Version -- ------------------ when Attribute_Body_Version => Check_E0; Check_Program_Unit; Set_Etype (N, RTE (RE_Version_String)); -------------- -- Callable -- -------------- when Attribute_Callable => Check_E0; Set_Etype (N, Standard_Boolean); Check_Task_Prefix; ------------ -- Caller -- ------------ when Attribute_Caller => Caller : declare Ent : Entity_Id; S : Entity_Id; begin Check_E0; if Nkind_In (P, N_Identifier, N_Expanded_Name) then Ent := Entity (P); if not Is_Entry (Ent) then Error_Attr ("invalid entry name", N); end if; else Error_Attr ("invalid entry name", N); return; end if; for J in reverse 0 .. Scope_Stack.Last loop S := Scope_Stack.Table (J).Entity; if S = Scope (Ent) then Error_Attr ("Caller must appear in matching accept or body", N); elsif S = Ent then exit; end if; end loop; Set_Etype (N, RTE (RO_AT_Task_Id)); end Caller; ------------- -- Ceiling -- ------------- when Attribute_Ceiling => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); ----------- -- Class -- ----------- when Attribute_Class => Check_Restriction (No_Dispatch, N); Check_E0; Find_Type (N); -- Applying Class to untagged incomplete type is obsolescent in Ada -- 2005. Note that we can't test Is_Tagged_Type here on P_Type, since -- this flag gets set by Find_Type in this situation. if Restriction_Check_Required (No_Obsolescent_Features) and then Ada_Version >= Ada_2005 and then Ekind (P_Type) = E_Incomplete_Type then declare DN : constant Node_Id := Declaration_Node (P_Type); begin if Nkind (DN) = N_Incomplete_Type_Declaration and then not Tagged_Present (DN) then Check_Restriction (No_Obsolescent_Features, P); end if; end; end if; ------------------ -- Code_Address -- ------------------ when Attribute_Code_Address => Check_E0; if Nkind (P) = N_Attribute_Reference and then Nam_In (Attribute_Name (P), Name_Elab_Body, Name_Elab_Spec) then null; elsif not Is_Entity_Name (P) or else (Ekind (Entity (P)) /= E_Function and then Ekind (Entity (P)) /= E_Procedure) then Error_Attr ("invalid prefix for % attribute", P); Set_Address_Taken (Entity (P)); -- Issue an error if the prefix denotes an eliminated subprogram else Check_For_Eliminated_Subprogram (P, Entity (P)); end if; Set_Etype (N, RTE (RE_Address)); ---------------------- -- Compiler_Version -- ---------------------- when Attribute_Compiler_Version => Check_E0; Check_Standard_Prefix; Rewrite (N, Make_String_Literal (Loc, "GNAT " & Gnat_Version_String)); Analyze_And_Resolve (N, Standard_String); Set_Is_Static_Expression (N, True); -------------------- -- Component_Size -- -------------------- when Attribute_Component_Size => Check_E0; Set_Etype (N, Universal_Integer); -- Note: unlike other array attributes, unconstrained arrays are OK if Is_Array_Type (P_Type) and then not Is_Constrained (P_Type) then null; else Check_Array_Type; end if; ------------- -- Compose -- ------------- when Attribute_Compose => Check_Floating_Point_Type_2; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); Resolve (E2, Any_Integer); ----------------- -- Constrained -- ----------------- when Attribute_Constrained => Check_E0; Set_Etype (N, Standard_Boolean); -- Case from RM J.4(2) of constrained applied to private type if Is_Entity_Name (P) and then Is_Type (Entity (P)) then Check_Restriction (No_Obsolescent_Features, P); if Warn_On_Obsolescent_Feature then Error_Msg_N ("constrained for private type is an obsolescent feature " & "(RM J.4)?j?", N); end if; -- If we are within an instance, the attribute must be legal -- because it was valid in the generic unit. Ditto if this is -- an inlining of a function declared in an instance. if In_Instance or else In_Inlined_Body then return; -- For sure OK if we have a real private type itself, but must -- be completed, cannot apply Constrained to incomplete type. elsif Is_Private_Type (Entity (P)) then -- Note: this is one of the Annex J features that does not -- generate a warning from -gnatwj, since in fact it seems -- very useful, and is used in the GNAT runtime. Check_Not_Incomplete_Type; return; end if; -- Normal (non-obsolescent case) of application to object of -- a discriminated type. else Check_Object_Reference (P); -- If N does not come from source, then we allow the -- the attribute prefix to be of a private type whose -- full type has discriminants. This occurs in cases -- involving expanded calls to stream attributes. if not Comes_From_Source (N) then P_Type := Underlying_Type (P_Type); end if; -- Must have discriminants or be an access type designating a type -- with discriminants. If it is a class-wide type it has unknown -- discriminants. if Has_Discriminants (P_Type) or else Has_Unknown_Discriminants (P_Type) or else (Is_Access_Type (P_Type) and then Has_Discriminants (Designated_Type (P_Type))) then return; -- The rule given in 3.7.2 is part of static semantics, but the -- intent is clearly that it be treated as a legality rule, and -- rechecked in the visible part of an instance. Nevertheless -- the intent also seems to be it should legally apply to the -- actual of a formal with unknown discriminants, regardless of -- whether the actual has discriminants, in which case the value -- of the attribute is determined using the J.4 rules. This choice -- seems the most useful, and is compatible with existing tests. elsif In_Instance then return; -- Also allow an object of a generic type if extensions allowed -- and allow this for any type at all. (this may be obsolete ???) elsif (Is_Generic_Type (P_Type) or else Is_Generic_Actual_Type (P_Type)) and then Extensions_Allowed then return; end if; end if; -- Fall through if bad prefix Error_Attr_P ("prefix of % attribute must be object of discriminated type"); --------------- -- Copy_Sign -- --------------- when Attribute_Copy_Sign => Check_Floating_Point_Type_2; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); Resolve (E2, P_Base_Type); ----------- -- Count -- ----------- when Attribute_Count => Count : declare Ent : Entity_Id; S : Entity_Id; Tsk : Entity_Id; begin Check_E0; if Nkind_In (P, N_Identifier, N_Expanded_Name) then Ent := Entity (P); if Ekind (Ent) /= E_Entry then Error_Attr ("invalid entry name", N); end if; elsif Nkind (P) = N_Indexed_Component then if not Is_Entity_Name (Prefix (P)) or else No (Entity (Prefix (P))) or else Ekind (Entity (Prefix (P))) /= E_Entry_Family then if Nkind (Prefix (P)) = N_Selected_Component and then Present (Entity (Selector_Name (Prefix (P)))) and then Ekind (Entity (Selector_Name (Prefix (P)))) = E_Entry_Family then Error_Attr ("attribute % must apply to entry of current task", P); else Error_Attr ("invalid entry family name", P); end if; return; else Ent := Entity (Prefix (P)); end if; elsif Nkind (P) = N_Selected_Component and then Present (Entity (Selector_Name (P))) and then Ekind (Entity (Selector_Name (P))) = E_Entry then Error_Attr ("attribute % must apply to entry of current task", P); else Error_Attr ("invalid entry name", N); return; end if; for J in reverse 0 .. Scope_Stack.Last loop S := Scope_Stack.Table (J).Entity; if S = Scope (Ent) then if Nkind (P) = N_Expanded_Name then Tsk := Entity (Prefix (P)); -- The prefix denotes either the task type, or else a -- single task whose task type is being analyzed. if (Is_Type (Tsk) and then Tsk = S) or else (not Is_Type (Tsk) and then Etype (Tsk) = S and then not (Comes_From_Source (S))) then null; else Error_Attr ("Attribute % must apply to entry of current task", N); end if; end if; exit; elsif Ekind (Scope (Ent)) in Task_Kind and then not Ekind_In (S, E_Block, E_Entry, E_Entry_Family, E_Loop) then Error_Attr ("Attribute % cannot appear in inner unit", N); elsif Ekind (Scope (Ent)) = E_Protected_Type and then not Has_Completion (Scope (Ent)) then Error_Attr ("attribute % can only be used inside body", N); end if; end loop; if Is_Overloaded (P) then declare Index : Interp_Index; It : Interp; begin Get_First_Interp (P, Index, It); while Present (It.Nam) loop if It.Nam = Ent then null; -- Ada 2005 (AI-345): Do not consider primitive entry -- wrappers generated for task or protected types. elsif Ada_Version >= Ada_2005 and then not Comes_From_Source (It.Nam) then null; else Error_Attr ("ambiguous entry name", N); end if; Get_Next_Interp (Index, It); end loop; end; end if; Set_Etype (N, Universal_Integer); end Count; ----------------------- -- Default_Bit_Order -- ----------------------- when Attribute_Default_Bit_Order => Default_Bit_Order : declare Target_Default_Bit_Order : System.Bit_Order; begin Check_Standard_Prefix; if Bytes_Big_Endian then Target_Default_Bit_Order := System.High_Order_First; else Target_Default_Bit_Order := System.Low_Order_First; end if; Rewrite (N, Make_Integer_Literal (Loc, UI_From_Int (System.Bit_Order'Pos (Target_Default_Bit_Order)))); Set_Etype (N, Universal_Integer); Set_Is_Static_Expression (N); end Default_Bit_Order; ---------------------------------- -- Default_Scalar_Storage_Order -- ---------------------------------- when Attribute_Default_Scalar_Storage_Order => Default_SSO : declare RE_Default_SSO : RE_Id; begin Check_Standard_Prefix; case Opt.Default_SSO is when ' ' => if Bytes_Big_Endian then RE_Default_SSO := RE_High_Order_First; else RE_Default_SSO := RE_Low_Order_First; end if; when 'H' => RE_Default_SSO := RE_High_Order_First; when 'L' => RE_Default_SSO := RE_Low_Order_First; when others => raise Program_Error; end case; Rewrite (N, New_Occurrence_Of (RTE (RE_Default_SSO), Loc)); end Default_SSO; -------------- -- Definite -- -------------- when Attribute_Definite => Legal_Formal_Attribute; ----------- -- Delta -- ----------- when Attribute_Delta => Check_Fixed_Point_Type_0; Set_Etype (N, Universal_Real); ------------ -- Denorm -- ------------ when Attribute_Denorm => Check_Floating_Point_Type_0; Set_Etype (N, Standard_Boolean); ----------- -- Deref -- ----------- when Attribute_Deref => Check_Type; Check_E1; Resolve (E1, RTE (RE_Address)); Set_Etype (N, P_Type); --------------------- -- Descriptor_Size -- --------------------- when Attribute_Descriptor_Size => Check_E0; if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) then Error_Attr_P ("prefix of attribute % must denote a type"); end if; Set_Etype (N, Universal_Integer); ------------ -- Digits -- ------------ when Attribute_Digits => Check_E0; Check_Type; if not Is_Floating_Point_Type (P_Type) and then not Is_Decimal_Fixed_Point_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be float or decimal type"); end if; Set_Etype (N, Universal_Integer); --------------- -- Elab_Body -- --------------- -- Also handles processing for Elab_Spec and Elab_Subp_Body when Attribute_Elab_Body | Attribute_Elab_Spec | Attribute_Elab_Subp_Body => Check_E0; Check_Unit_Name (P); Set_Etype (N, Standard_Void_Type); -- We have to manually call the expander in this case to get -- the necessary expansion (normally attributes that return -- entities are not expanded). Expand (N); --------------- -- Elab_Spec -- --------------- -- Shares processing with Elab_Body ---------------- -- Elaborated -- ---------------- when Attribute_Elaborated => Check_E0; Check_Unit_Name (P); Set_Etype (N, Standard_Boolean); ---------- -- Emax -- ---------- when Attribute_Emax => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ------------- -- Enabled -- ------------- when Attribute_Enabled => Check_Either_E0_Or_E1; if Present (E1) then if not Is_Entity_Name (E1) or else No (Entity (E1)) then Error_Msg_N ("entity name expected for Enabled attribute", E1); E1 := Empty; end if; end if; if Nkind (P) /= N_Identifier then Error_Msg_N ("identifier expected (check name)", P); elsif Get_Check_Id (Chars (P)) = No_Check_Id then Error_Msg_N ("& is not a recognized check name", P); end if; Set_Etype (N, Standard_Boolean); -------------- -- Enum_Rep -- -------------- when Attribute_Enum_Rep => if Present (E1) then Check_E1; Check_Discrete_Type; Resolve (E1, P_Base_Type); elsif not Is_Discrete_Type (Etype (P)) then Error_Attr_P ("prefix of % attribute must be of discrete type"); end if; Set_Etype (N, Universal_Integer); -------------- -- Enum_Val -- -------------- when Attribute_Enum_Val => Check_E1; Check_Type; if not Is_Enumeration_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be enumeration type"); end if; -- If the enumeration type has a standard representation, the effect -- is the same as 'Val, so rewrite the attribute as a 'Val. if not Has_Non_Standard_Rep (P_Base_Type) then Rewrite (N, Make_Attribute_Reference (Loc, Prefix => Relocate_Node (Prefix (N)), Attribute_Name => Name_Val, Expressions => New_List (Relocate_Node (E1)))); Analyze_And_Resolve (N, P_Base_Type); -- Non-standard representation case (enumeration with holes) else Check_Enum_Image; Resolve (E1, Any_Integer); Set_Etype (N, P_Base_Type); end if; ------------- -- Epsilon -- ------------- when Attribute_Epsilon => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Real); -------------- -- Exponent -- -------------- when Attribute_Exponent => Check_Floating_Point_Type_1; Set_Etype (N, Universal_Integer); Resolve (E1, P_Base_Type); ------------------ -- External_Tag -- ------------------ when Attribute_External_Tag => Check_E0; Check_Type; Set_Etype (N, Standard_String); if not Is_Tagged_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be tagged"); end if; --------------- -- Fast_Math -- --------------- when Attribute_Fast_Math => Check_Standard_Prefix; Rewrite (N, New_Occurrence_Of (Boolean_Literals (Fast_Math), Loc)); ----------------------- -- Finalization_Size -- ----------------------- when Attribute_Finalization_Size => Check_E0; -- The prefix denotes an object if Is_Object_Reference (P) then Check_Object_Reference (P); -- The prefix denotes a type elsif Is_Entity_Name (P) and then Is_Type (Entity (P)) then Check_Type; Check_Not_Incomplete_Type; -- Attribute 'Finalization_Size is not defined for class-wide -- types because it is not possible to know statically whether -- a definite type will have controlled components or not. if Is_Class_Wide_Type (Etype (P)) then Error_Attr_P ("prefix of % attribute cannot denote a class-wide type"); end if; -- The prefix denotes an illegal construct else Error_Attr_P ("prefix of % attribute must be a definite type or an object"); end if; Set_Etype (N, Universal_Integer); ----------- -- First -- ----------- when Attribute_First => Check_Array_Or_Scalar_Type; Bad_Attribute_For_Predicate; --------------- -- First_Bit -- --------------- when Attribute_First_Bit => Check_Component; Set_Etype (N, Universal_Integer); ----------------- -- First_Valid -- ----------------- when Attribute_First_Valid => Check_First_Last_Valid; Set_Etype (N, P_Type); ----------------- -- Fixed_Value -- ----------------- when Attribute_Fixed_Value => Check_E1; Check_Fixed_Point_Type; Resolve (E1, Any_Integer); Set_Etype (N, P_Base_Type); ----------- -- Floor -- ----------- when Attribute_Floor => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); ---------- -- Fore -- ---------- when Attribute_Fore => Check_Fixed_Point_Type_0; Set_Etype (N, Universal_Integer); -------------- -- Fraction -- -------------- when Attribute_Fraction => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); -------------- -- From_Any -- -------------- when Attribute_From_Any => Check_E1; Check_PolyORB_Attribute; Set_Etype (N, P_Base_Type); ----------------------- -- Has_Access_Values -- ----------------------- when Attribute_Has_Access_Values => Check_Type; Check_E0; Set_Etype (N, Standard_Boolean); ---------------------- -- Has_Same_Storage -- ---------------------- when Attribute_Has_Same_Storage => Check_E1; -- The arguments must be objects of any type Analyze_And_Resolve (P); Analyze_And_Resolve (E1); Check_Object_Reference (P); Check_Object_Reference (E1); Set_Etype (N, Standard_Boolean); ----------------------- -- Has_Tagged_Values -- ----------------------- when Attribute_Has_Tagged_Values => Check_Type; Check_E0; Set_Etype (N, Standard_Boolean); ----------------------- -- Has_Discriminants -- ----------------------- when Attribute_Has_Discriminants => Legal_Formal_Attribute; -------------- -- Identity -- -------------- when Attribute_Identity => Check_E0; Analyze (P); if Etype (P) = Standard_Exception_Type then Set_Etype (N, RTE (RE_Exception_Id)); -- Ada 2005 (AI-345): Attribute 'Identity may be applied to task -- interface class-wide types. elsif Is_Task_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Task_Type (Designated_Type (Etype (P)))) or else (Ada_Version >= Ada_2005 and then Ekind (Etype (P)) = E_Class_Wide_Type and then Is_Interface (Etype (P)) and then Is_Task_Interface (Etype (P))) then Resolve (P); Set_Etype (N, RTE (RO_AT_Task_Id)); else if Ada_Version >= Ada_2005 then Error_Attr_P ("prefix of % attribute must be an exception, a task or a " & "task interface class-wide object"); else Error_Attr_P ("prefix of % attribute must be a task or an exception"); end if; end if; ----------- -- Image -- ----------- when Attribute_Image => Check_SPARK_05_Restriction_On_Attribute; -- AI12-00124-1 : The ARG has adopted the GNAT semantics of 'Img -- for scalar types, so that the prefix can be an object and not -- a type, and there is no need for an argument. Given this vote -- of confidence from the ARG, simplest is to transform this new -- usage of 'Image into a reference to 'Img. if Ada_Version > Ada_2005 and then Is_Object_Reference (P) and then Is_Scalar_Type (P_Type) then Rewrite (N, Make_Attribute_Reference (Loc, Prefix => Relocate_Node (P), Attribute_Name => Name_Img)); Analyze (N); return; else Check_Scalar_Type; end if; Set_Etype (N, Standard_String); if Is_Real_Type (P_Type) then if Ada_Version = Ada_83 and then Comes_From_Source (N) then Error_Msg_Name_1 := Aname; Error_Msg_N ("(Ada 83) % attribute not allowed for real types", N); end if; end if; if Is_Enumeration_Type (P_Type) then Check_Restriction (No_Enumeration_Maps, N); end if; Check_E1; Resolve (E1, P_Base_Type); Check_Enum_Image; Validate_Non_Static_Attribute_Function_Call; -- Check restriction No_Fixed_IO. Note the check of Comes_From_Source -- to avoid giving a duplicate message for Img expanded into Image. if Restriction_Check_Required (No_Fixed_IO) and then Comes_From_Source (N) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; --------- -- Img -- --------- when Attribute_Img => Check_E0; Set_Etype (N, Standard_String); if not Is_Scalar_Type (P_Type) or else (Is_Entity_Name (P) and then Is_Type (Entity (P))) then Error_Attr_P ("prefix of % attribute must be scalar object name"); end if; Check_Enum_Image; -- Check restriction No_Fixed_IO if Restriction_Check_Required (No_Fixed_IO) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; ----------- -- Input -- ----------- when Attribute_Input => Check_E1; Check_Stream_Attribute (TSS_Stream_Input); Set_Etype (N, P_Base_Type); ------------------- -- Integer_Value -- ------------------- when Attribute_Integer_Value => Check_E1; Check_Integer_Type; Resolve (E1, Any_Fixed); -- Signal an error if argument type is not a specific fixed-point -- subtype. An error has been signalled already if the argument -- was not of a fixed-point type. if Etype (E1) = Any_Fixed and then not Error_Posted (E1) then Error_Attr ("argument of % must be of a fixed-point type", E1); end if; Set_Etype (N, P_Base_Type); ------------------- -- Invalid_Value -- ------------------- when Attribute_Invalid_Value => Check_E0; Check_Scalar_Type; Set_Etype (N, P_Base_Type); Invalid_Value_Used := True; ----------- -- Large -- ----------- when Attribute_Large => Check_E0; Check_Real_Type; Set_Etype (N, Universal_Real); ---------- -- Last -- ---------- when Attribute_Last => Check_Array_Or_Scalar_Type; Bad_Attribute_For_Predicate; -------------- -- Last_Bit -- -------------- when Attribute_Last_Bit => Check_Component; Set_Etype (N, Universal_Integer); ---------------- -- Last_Valid -- ---------------- when Attribute_Last_Valid => Check_First_Last_Valid; Set_Etype (N, P_Type); ------------------ -- Leading_Part -- ------------------ when Attribute_Leading_Part => Check_Floating_Point_Type_2; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); Resolve (E2, Any_Integer); ------------ -- Length -- ------------ when Attribute_Length => Check_Array_Type; Set_Etype (N, Universal_Integer); ------------------- -- Library_Level -- ------------------- when Attribute_Library_Level => Check_E0; if not Is_Entity_Name (P) then Error_Attr_P ("prefix of % attribute must be an entity name"); end if; if not Inside_A_Generic then Set_Boolean_Result (N, Is_Library_Level_Entity (Entity (P))); end if; Set_Etype (N, Standard_Boolean); --------------- -- Lock_Free -- --------------- when Attribute_Lock_Free => Check_E0; Set_Etype (N, Standard_Boolean); if not Is_Protected_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be a protected object"); end if; ---------------- -- Loop_Entry -- ---------------- when Attribute_Loop_Entry => Loop_Entry : declare procedure Check_References_In_Prefix (Loop_Id : Entity_Id); -- Inspect the prefix for any uses of entities declared within the -- related loop. Loop_Id denotes the loop identifier. -------------------------------- -- Check_References_In_Prefix -- -------------------------------- procedure Check_References_In_Prefix (Loop_Id : Entity_Id) is Loop_Decl : constant Node_Id := Label_Construct (Parent (Loop_Id)); function Check_Reference (Nod : Node_Id) return Traverse_Result; -- Determine whether a reference mentions an entity declared -- within the related loop. function Declared_Within (Nod : Node_Id) return Boolean; -- Determine whether Nod appears in the subtree of Loop_Decl --------------------- -- Check_Reference -- --------------------- function Check_Reference (Nod : Node_Id) return Traverse_Result is begin if Nkind (Nod) = N_Identifier and then Present (Entity (Nod)) and then Declared_Within (Declaration_Node (Entity (Nod))) then Error_Attr ("prefix of attribute % cannot reference local entities", Nod); return Abandon; else return OK; end if; end Check_Reference; procedure Check_References is new Traverse_Proc (Check_Reference); --------------------- -- Declared_Within -- --------------------- function Declared_Within (Nod : Node_Id) return Boolean is Stmt : Node_Id; begin Stmt := Nod; while Present (Stmt) loop if Stmt = Loop_Decl then return True; -- Prevent the search from going too far elsif Is_Body_Or_Package_Declaration (Stmt) then exit; end if; Stmt := Parent (Stmt); end loop; return False; end Declared_Within; -- Start of processing for Check_Prefix_For_Local_References begin Check_References (P); end Check_References_In_Prefix; -- Local variables Context : constant Node_Id := Parent (N); Attr : Node_Id; Encl_Loop : Node_Id; Encl_Prag : Node_Id := Empty; Loop_Id : Entity_Id := Empty; Scop : Entity_Id; Stmt : Node_Id; -- Start of processing for Loop_Entry begin Attr := N; -- Set the type of the attribute now to ensure the successfull -- continuation of analysis even if the attribute is misplaced. Set_Etype (Attr, P_Type); -- Attribute 'Loop_Entry may appear in several flavors: -- * Prefix'Loop_Entry - in this form, the attribute applies to the -- nearest enclosing loop. -- * Prefix'Loop_Entry (Expr) - depending on what Expr denotes, the -- attribute may be related to a loop denoted by label Expr or -- the prefix may denote an array object and Expr may act as an -- indexed component. -- * Prefix'Loop_Entry (Expr1, ..., ExprN) - the attribute applies -- to the nearest enclosing loop, all expressions are part of -- an indexed component. -- * Prefix'Loop_Entry (Expr) (...) (...) - depending on what Expr -- denotes, the attribute may be related to a loop denoted by -- label Expr or the prefix may denote a multidimensional array -- array object and Expr along with the rest of the expressions -- may act as indexed components. -- Regardless of variations, the attribute reference does not have an -- expression list. Instead, all available expressions are stored as -- indexed components. -- When the attribute is part of an indexed component, find the first -- expression as it will determine the semantics of 'Loop_Entry. if Nkind (Context) = N_Indexed_Component then E1 := First (Expressions (Context)); E2 := Next (E1); -- The attribute reference appears in the following form: -- Prefix'Loop_Entry (Exp1, Expr2, ..., ExprN) [(...)] -- In this case, the loop name is omitted and no rewriting is -- required. if Present (E2) then null; -- The form of the attribute is: -- Prefix'Loop_Entry (Expr) [(...)] -- If Expr denotes a loop entry, the whole attribute and indexed -- component will have to be rewritten to reflect this relation. else pragma Assert (Present (E1)); -- Do not expand the expression as it may have side effects. -- Simply preanalyze to determine whether it is a loop name or -- something else. Preanalyze_And_Resolve (E1); if Is_Entity_Name (E1) and then Present (Entity (E1)) and then Ekind (Entity (E1)) = E_Loop then Loop_Id := Entity (E1); -- Transform the attribute and enclosing indexed component Set_Expressions (N, Expressions (Context)); Rewrite (Context, N); Set_Etype (Context, P_Type); Attr := Context; end if; end if; end if; -- The prefix must denote an object if not Is_Object_Reference (P) then Error_Attr_P ("prefix of attribute % must denote an object"); end if; -- The prefix cannot be of a limited type because the expansion of -- Loop_Entry must create a constant initialized by the evaluated -- prefix. if Is_Limited_View (Etype (P)) then Error_Attr_P ("prefix of attribute % cannot be limited"); end if; -- Climb the parent chain to verify the location of the attribute and -- find the enclosing loop. Stmt := Attr; while Present (Stmt) loop -- Locate the corresponding enclosing pragma. Note that in the -- case of Assert[And_Cut] and Assume, we have already checked -- that the pragma appears in an appropriate loop location. if Nkind (Original_Node (Stmt)) = N_Pragma and then Nam_In (Pragma_Name_Unmapped (Original_Node (Stmt)), Name_Loop_Invariant, Name_Loop_Variant, Name_Assert, Name_Assert_And_Cut, Name_Assume) then Encl_Prag := Original_Node (Stmt); -- Locate the enclosing loop (if any). Note that Ada 2012 array -- iteration may be expanded into several nested loops, we are -- interested in the outermost one which has the loop identifier, -- and comes from source. elsif Nkind (Stmt) = N_Loop_Statement and then Present (Identifier (Stmt)) and then Comes_From_Source (Original_Node (Stmt)) and then Nkind (Original_Node (Stmt)) = N_Loop_Statement then Encl_Loop := Stmt; -- The original attribute reference may lack a loop name. Use -- the name of the enclosing loop because it is the related -- loop. if No (Loop_Id) then Loop_Id := Entity (Identifier (Encl_Loop)); end if; exit; -- Prevent the search from going too far elsif Is_Body_Or_Package_Declaration (Stmt) then exit; end if; Stmt := Parent (Stmt); end loop; -- Loop_Entry must appear within a Loop_Assertion pragma (Assert, -- Assert_And_Cut, Assume count as loop assertion pragmas for this -- purpose if they appear in an appropriate location in a loop, -- which was already checked by the top level pragma circuit). -- Loop_Entry also denotes a value and as such can appear within an -- expression that is an argument for another loop aspect. In that -- case it will have been expanded into the corresponding assignment. if Expander_Active and then Nkind (Parent (N)) = N_Assignment_Statement and then not Comes_From_Source (Parent (N)) then null; elsif No (Encl_Prag) then Error_Attr ("attribute% must appear within appropriate pragma", N); end if; -- A Loop_Entry that applies to a given loop statement must not -- appear within a body of accept statement, if this construct is -- itself enclosed by the given loop statement. for Index in reverse 0 .. Scope_Stack.Last loop Scop := Scope_Stack.Table (Index).Entity; if Ekind (Scop) = E_Loop and then Scop = Loop_Id then exit; elsif Ekind_In (Scop, E_Block, E_Loop, E_Return_Statement) then null; else Error_Attr ("attribute % cannot appear in body or accept statement", N); exit; end if; end loop; -- The prefix cannot mention entities declared within the related -- loop because they will not be visible once the prefix is moved -- outside the loop. Check_References_In_Prefix (Loop_Id); -- The prefix must denote a static entity if the pragma does not -- apply to the innermost enclosing loop statement, or if it appears -- within a potentially unevaluated epxression. if Is_Entity_Name (P) or else Nkind (Parent (P)) = N_Object_Renaming_Declaration then null; elsif Present (Encl_Loop) and then Entity (Identifier (Encl_Loop)) /= Loop_Id then Error_Attr_P ("prefix of attribute % that applies to outer loop must denote " & "an entity"); elsif Is_Potentially_Unevaluated (P) then Uneval_Old_Msg; end if; -- Replace the Loop_Entry attribute reference by its prefix if the -- related pragma is ignored. This transformation is OK with respect -- to typing because Loop_Entry's type is that of its prefix. This -- early transformation also avoids the generation of a useless loop -- entry constant. if Present (Encl_Prag) and then Is_Ignored (Encl_Prag) then Rewrite (N, Relocate_Node (P)); Preanalyze_And_Resolve (N); else Preanalyze_And_Resolve (P); end if; end Loop_Entry; ------------- -- Machine -- ------------- when Attribute_Machine => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); ------------------ -- Machine_Emax -- ------------------ when Attribute_Machine_Emax => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ------------------ -- Machine_Emin -- ------------------ when Attribute_Machine_Emin => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ---------------------- -- Machine_Mantissa -- ---------------------- when Attribute_Machine_Mantissa => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ----------------------- -- Machine_Overflows -- ----------------------- when Attribute_Machine_Overflows => Check_Real_Type; Check_E0; Set_Etype (N, Standard_Boolean); ------------------- -- Machine_Radix -- ------------------- when Attribute_Machine_Radix => Check_Real_Type; Check_E0; Set_Etype (N, Universal_Integer); ---------------------- -- Machine_Rounding -- ---------------------- when Attribute_Machine_Rounding => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); -------------------- -- Machine_Rounds -- -------------------- when Attribute_Machine_Rounds => Check_Real_Type; Check_E0; Set_Etype (N, Standard_Boolean); ------------------ -- Machine_Size -- ------------------ when Attribute_Machine_Size => Check_E0; Check_Type; Check_Not_Incomplete_Type; Set_Etype (N, Universal_Integer); -------------- -- Mantissa -- -------------- when Attribute_Mantissa => Check_E0; Check_Real_Type; Set_Etype (N, Universal_Integer); --------- -- Max -- --------- when Attribute_Max => Min_Max; ---------------------------------- -- Max_Alignment_For_Allocation -- ---------------------------------- when Attribute_Max_Size_In_Storage_Elements => Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements; ---------------------------------- -- Max_Size_In_Storage_Elements -- ---------------------------------- when Attribute_Max_Alignment_For_Allocation => Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements; ----------------------- -- Maximum_Alignment -- ----------------------- when Attribute_Maximum_Alignment => Standard_Attribute (Ttypes.Maximum_Alignment); -------------------- -- Mechanism_Code -- -------------------- when Attribute_Mechanism_Code => if not Is_Entity_Name (P) or else not Is_Subprogram (Entity (P)) then Error_Attr_P ("prefix of % attribute must be subprogram"); end if; Check_Either_E0_Or_E1; if Present (E1) then Resolve (E1, Any_Integer); Set_Etype (E1, Standard_Integer); if not Is_OK_Static_Expression (E1) then Flag_Non_Static_Expr ("expression for parameter number must be static!", E1); Error_Attr; elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P)) or else UI_To_Int (Intval (E1)) < 0 then Error_Attr ("invalid parameter number for % attribute", E1); end if; end if; Set_Etype (N, Universal_Integer); --------- -- Min -- --------- when Attribute_Min => Min_Max; --------- -- Mod -- --------- when Attribute_Mod => -- Note: this attribute is only allowed in Ada 2005 mode, but -- we do not need to test that here, since Mod is only recognized -- as an attribute name in Ada 2005 mode during the parse. Check_E1; Check_Modular_Integer_Type; Resolve (E1, Any_Integer); Set_Etype (N, P_Base_Type); ----------- -- Model -- ----------- when Attribute_Model => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); ---------------- -- Model_Emin -- ---------------- when Attribute_Model_Emin => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ------------------- -- Model_Epsilon -- ------------------- when Attribute_Model_Epsilon => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Real); -------------------- -- Model_Mantissa -- -------------------- when Attribute_Model_Mantissa => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ----------------- -- Model_Small -- ----------------- when Attribute_Model_Small => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Real); ------------- -- Modulus -- ------------- when Attribute_Modulus => Check_E0; Check_Modular_Integer_Type; Set_Etype (N, Universal_Integer); -------------------- -- Null_Parameter -- -------------------- when Attribute_Null_Parameter => Null_Parameter : declare Parnt : constant Node_Id := Parent (N); GParnt : constant Node_Id := Parent (Parnt); procedure Bad_Null_Parameter (Msg : String); -- Used if bad Null parameter attribute node is found. Issues -- given error message, and also sets the type to Any_Type to -- avoid blowups later on from dealing with a junk node. procedure Must_Be_Imported (Proc_Ent : Entity_Id); -- Called to check that Proc_Ent is imported subprogram ------------------------ -- Bad_Null_Parameter -- ------------------------ procedure Bad_Null_Parameter (Msg : String) is begin Error_Msg_N (Msg, N); Set_Etype (N, Any_Type); end Bad_Null_Parameter; ---------------------- -- Must_Be_Imported -- ---------------------- procedure Must_Be_Imported (Proc_Ent : Entity_Id) is Pent : constant Entity_Id := Ultimate_Alias (Proc_Ent); begin -- Ignore check if procedure not frozen yet (we will get -- another chance when the default parameter is reanalyzed) if not Is_Frozen (Pent) then return; elsif not Is_Imported (Pent) then Bad_Null_Parameter ("Null_Parameter can only be used with imported subprogram"); else return; end if; end Must_Be_Imported; -- Start of processing for Null_Parameter begin Check_Type; Check_E0; Set_Etype (N, P_Type); -- Case of attribute used as default expression if Nkind (Parnt) = N_Parameter_Specification then Must_Be_Imported (Defining_Entity (GParnt)); -- Case of attribute used as actual for subprogram (positional) elsif Nkind (Parnt) in N_Subprogram_Call and then Is_Entity_Name (Name (Parnt)) then Must_Be_Imported (Entity (Name (Parnt))); -- Case of attribute used as actual for subprogram (named) elsif Nkind (Parnt) = N_Parameter_Association and then Nkind (GParnt) in N_Subprogram_Call and then Is_Entity_Name (Name (GParnt)) then Must_Be_Imported (Entity (Name (GParnt))); -- Not an allowed case else Bad_Null_Parameter ("Null_Parameter must be actual or default parameter"); end if; end Null_Parameter; ----------------- -- Object_Size -- ----------------- when Attribute_Object_Size => Check_E0; Check_Type; Check_Not_Incomplete_Type; Set_Etype (N, Universal_Integer); --------- -- Old -- --------- when Attribute_Old => Old : declare procedure Check_References_In_Prefix (Subp_Id : Entity_Id); -- Inspect the contents of the prefix and detect illegal uses of a -- nested 'Old, attribute 'Result or a use of an entity declared in -- the related postcondition expression. Subp_Id is the subprogram to -- which the related postcondition applies. -------------------------------- -- Check_References_In_Prefix -- -------------------------------- procedure Check_References_In_Prefix (Subp_Id : Entity_Id) is function Check_Reference (Nod : Node_Id) return Traverse_Result; -- Detect attribute 'Old, attribute 'Result of a use of an entity -- and perform the appropriate semantic check. --------------------- -- Check_Reference -- --------------------- function Check_Reference (Nod : Node_Id) return Traverse_Result is begin -- Attributes 'Old and 'Result cannot appear in the prefix of -- another attribute 'Old. if Nkind (Nod) = N_Attribute_Reference and then Nam_In (Attribute_Name (Nod), Name_Old, Name_Result) then Error_Msg_Name_1 := Attribute_Name (Nod); Error_Msg_Name_2 := Name_Old; Error_Msg_N ("attribute % cannot appear in the prefix of attribute %", Nod); return Abandon; -- Entities mentioned within the prefix of attribute 'Old must -- be global to the related postcondition. If this is not the -- case, then the scope of the local entity is nested within -- that of the subprogram. elsif Is_Entity_Name (Nod) and then Present (Entity (Nod)) and then Scope_Within (Scope (Entity (Nod)), Subp_Id) then Error_Attr ("prefix of attribute % cannot reference local entities", Nod); return Abandon; -- Otherwise keep inspecting the prefix else return OK; end if; end Check_Reference; procedure Check_References is new Traverse_Proc (Check_Reference); -- Start of processing for Check_References_In_Prefix begin Check_References (P); end Check_References_In_Prefix; -- Local variables Legal : Boolean; Pref_Id : Entity_Id; Pref_Typ : Entity_Id; Spec_Id : Entity_Id; -- Start of processing for Old begin -- The attribute reference is a primary. If any expressions follow, -- then the attribute reference is an indexable object. Transform the -- attribute into an indexed component and analyze it. if Present (E1) then Rewrite (N, Make_Indexed_Component (Loc, Prefix => Make_Attribute_Reference (Loc, Prefix => Relocate_Node (P), Attribute_Name => Name_Old), Expressions => Expressions (N))); Analyze (N); return; end if; Analyze_Attribute_Old_Result (Legal, Spec_Id); -- The aspect or pragma where attribute 'Old resides should be -- associated with a subprogram declaration or a body. If this is not -- the case, then the aspect or pragma is illegal. Return as analysis -- cannot be carried out. -- The exception to this rule is when generating C since in this case -- postconditions are inlined. if No (Spec_Id) and then Modify_Tree_For_C and then In_Inlined_Body then Spec_Id := Entity (P); elsif not Legal then return; end if; -- The prefix must be preanalyzed as the full analysis will take -- place during expansion. Preanalyze_And_Resolve (P); -- Ensure that the prefix does not contain attributes 'Old or 'Result Check_References_In_Prefix (Spec_Id); -- Set the type of the attribute now to prevent cascaded errors Pref_Typ := Etype (P); Set_Etype (N, Pref_Typ); -- Legality checks if Is_Limited_Type (Pref_Typ) then Error_Attr ("attribute % cannot apply to limited objects", P); end if; -- The prefix is a simple name if Is_Entity_Name (P) and then Present (Entity (P)) then Pref_Id := Entity (P); -- Emit a warning when the prefix is a constant. Note that the use -- of Error_Attr would reset the type of N to Any_Type even though -- this is a warning. Use Error_Msg_XXX instead. if Is_Constant_Object (Pref_Id) then Error_Msg_Name_1 := Name_Old; Error_Msg_N ("??attribute % applied to constant has no effect", P); end if; -- Otherwise the prefix is not a simple name else -- Ensure that the prefix of attribute 'Old is an entity when it -- is potentially unevaluated (6.1.1 (27/3)). if Is_Potentially_Unevaluated (N) then Uneval_Old_Msg; -- Detect a possible infinite recursion when the prefix denotes -- the related function. -- function Func (...) return ... -- with Post => Func'Old ...; -- The function may be specified in qualified form X.Y where X is -- a protected object and Y is a protected function. In that case -- ensure that the qualified form has an entity. elsif Nkind (P) = N_Function_Call and then Nkind (Name (P)) in N_Has_Entity then Pref_Id := Entity (Name (P)); if Ekind_In (Spec_Id, E_Function, E_Generic_Function) and then Pref_Id = Spec_Id then Error_Msg_Warn := SPARK_Mode /= On; Error_Msg_N ("!possible infinite recursion<<", P); Error_Msg_N ("\!??Storage_Error ]<<", P); end if; end if; -- The prefix of attribute 'Old may refer to a component of a -- formal parameter. In this case its expansion may generate -- actual subtypes that are referenced in an inner context and -- that must be elaborated within the subprogram itself. If the -- prefix includes a function call, it may involve finalization -- actions that should be inserted when the attribute has been -- rewritten as a declaration. Create a declaration for the prefix -- and insert it at the start of the enclosing subprogram. This is -- an expansion activity that has to be performed now to prevent -- out-of-order issues. -- This expansion is both harmful and not needed in SPARK mode, -- since the formal verification back end relies on the types of -- nodes (hence is not robust w.r.t. a change to base type here), -- and does not suffer from the out-of-order issue described -- above. Thus, this expansion is skipped in SPARK mode. -- The expansion is not relevant for discrete types, which will -- not generate extra declarations, and where use of the base type -- may lead to spurious errors if context is a case. if not GNATprove_Mode then if not Is_Discrete_Type (Pref_Typ) then Pref_Typ := Base_Type (Pref_Typ); end if; Set_Etype (N, Pref_Typ); Set_Etype (P, Pref_Typ); Analyze_Dimension (N); Expand (N); end if; end if; end Old; ---------------------- -- Overlaps_Storage -- ---------------------- when Attribute_Overlaps_Storage => Check_E1; -- Both arguments must be objects of any type Analyze_And_Resolve (P); Analyze_And_Resolve (E1); Check_Object_Reference (P); Check_Object_Reference (E1); Set_Etype (N, Standard_Boolean); ------------ -- Output -- ------------ when Attribute_Output => Check_E2; Check_Stream_Attribute (TSS_Stream_Output); Set_Etype (N, Standard_Void_Type); Resolve (N, Standard_Void_Type); ------------------ -- Partition_ID -- ------------------ when Attribute_Partition_ID => Check_E0; if P_Type /= Any_Type then if not Is_Library_Level_Entity (Entity (P)) then Error_Attr_P ("prefix of % attribute must be library-level entity"); -- The defining entity of prefix should not be declared inside a -- Pure unit. RM E.1(8). Is_Pure was set during declaration. elsif Is_Entity_Name (P) and then Is_Pure (Entity (P)) then Error_Attr_P ("prefix of% attribute must not be declared pure"); end if; end if; Set_Etype (N, Universal_Integer); ------------------------- -- Passed_By_Reference -- ------------------------- when Attribute_Passed_By_Reference => Check_E0; Check_Type; Set_Etype (N, Standard_Boolean); ------------------ -- Pool_Address -- ------------------ when Attribute_Pool_Address => Check_E0; Set_Etype (N, RTE (RE_Address)); --------- -- Pos -- --------- when Attribute_Pos => Check_Discrete_Type; Check_E1; if Is_Boolean_Type (P_Type) then Error_Msg_Name_1 := Aname; Error_Msg_Name_2 := Chars (P_Type); Check_SPARK_05_Restriction ("attribute% is not allowed for type%", P); end if; Resolve (E1, P_Base_Type); Set_Etype (N, Universal_Integer); -------------- -- Position -- -------------- when Attribute_Position => Check_Component; Set_Etype (N, Universal_Integer); ---------- -- Pred -- ---------- when Attribute_Pred => Check_Scalar_Type; Check_E1; if Is_Real_Type (P_Type) or else Is_Boolean_Type (P_Type) then Error_Msg_Name_1 := Aname; Error_Msg_Name_2 := Chars (P_Type); Check_SPARK_05_Restriction ("attribute% is not allowed for type%", P); end if; Resolve (E1, P_Base_Type); Set_Etype (N, P_Base_Type); -- Since Pred works on the base type, we normally do no check for the -- floating-point case, since the base type is unconstrained. But we -- make an exception in Check_Float_Overflow mode. if Is_Floating_Point_Type (P_Type) then if not Range_Checks_Suppressed (P_Base_Type) then Set_Do_Range_Check (E1); end if; -- If not modular type, test for overflow check required else if not Is_Modular_Integer_Type (P_Type) and then not Range_Checks_Suppressed (P_Base_Type) then Enable_Range_Check (E1); end if; end if; -------------- -- Priority -- -------------- -- Ada 2005 (AI-327): Dynamic ceiling priorities when Attribute_Priority => if Ada_Version < Ada_2005 then Error_Attr ("% attribute is allowed only in Ada 2005 mode", P); end if; Check_E0; Check_Restriction (No_Dynamic_Priorities, N); -- The prefix must be a protected object (AARM D.5.2 (2/2)) Analyze (P); if Is_Protected_Type (Etype (P)) or else (Is_Access_Type (Etype (P)) and then Is_Protected_Type (Designated_Type (Etype (P)))) then Resolve (P, Etype (P)); else Error_Attr_P ("prefix of % attribute must be a protected object"); end if; Set_Etype (N, Standard_Integer); -- Must be called from within a protected procedure or entry of the -- protected object. declare S : Entity_Id; begin S := Current_Scope; while S /= Etype (P) and then S /= Standard_Standard loop S := Scope (S); end loop; if S = Standard_Standard then Error_Attr ("the attribute % is only allowed inside protected " & "operations", P); end if; end; Validate_Non_Static_Attribute_Function_Call; ----------- -- Range -- ----------- when Attribute_Range => Check_Array_Or_Scalar_Type; Bad_Attribute_For_Predicate; if Ada_Version = Ada_83 and then Is_Scalar_Type (P_Type) and then Comes_From_Source (N) then Error_Attr ("(Ada 83) % attribute not allowed for scalar type", P); end if; ------------ -- Result -- ------------ when Attribute_Result => Result : declare function Denote_Same_Function (Pref_Id : Entity_Id; Spec_Id : Entity_Id) return Boolean; -- Determine whether the entity of the prefix Pref_Id denotes the -- same entity as that of the related subprogram Spec_Id. -------------------------- -- Denote_Same_Function -- -------------------------- function Denote_Same_Function (Pref_Id : Entity_Id; Spec_Id : Entity_Id) return Boolean is Over_Id : constant Entity_Id := Overridden_Operation (Spec_Id); Subp_Spec : constant Node_Id := Parent (Spec_Id); begin -- The prefix denotes the related subprogram if Pref_Id = Spec_Id then return True; -- Account for a special case when attribute 'Result appears in -- the postcondition of a generic function. -- generic -- function Gen_Func return ... -- with Post => Gen_Func'Result ...; -- When the generic function is instantiated, the Chars field of -- the instantiated prefix still denotes the name of the generic -- function. Note that any preemptive transformation is impossible -- without a proper analysis. The structure of the wrapper package -- is as follows: -- package Anon_Gen_Pack is -- <subtypes and renamings> -- function Subp_Decl return ...; -- (!) -- pragma Postcondition (Gen_Func'Result ...); -- (!) -- function Gen_Func ... renames Subp_Decl; -- end Anon_Gen_Pack; elsif Nkind (Subp_Spec) = N_Function_Specification and then Present (Generic_Parent (Subp_Spec)) and then Ekind_In (Pref_Id, E_Generic_Function, E_Function) then if Generic_Parent (Subp_Spec) = Pref_Id then return True; elsif Present (Alias (Pref_Id)) and then Alias (Pref_Id) = Spec_Id then return True; end if; -- Account for a special case where a primitive of a tagged type -- inherits a class-wide postcondition from a parent type. In this -- case the prefix of attribute 'Result denotes the overriding -- primitive. elsif Present (Over_Id) and then Pref_Id = Over_Id then return True; end if; -- Otherwise the prefix does not denote the related subprogram return False; end Denote_Same_Function; -- Local variables In_Inlined_C_Postcondition : constant Boolean := Modify_Tree_For_C and then In_Inlined_Body; Legal : Boolean; Pref_Id : Entity_Id; Spec_Id : Entity_Id; -- Start of processing for Result begin -- The attribute reference is a primary. If any expressions follow, -- then the attribute reference is an indexable object. Transform the -- attribute into an indexed component and analyze it. if Present (E1) then Rewrite (N, Make_Indexed_Component (Loc, Prefix => Make_Attribute_Reference (Loc, Prefix => Relocate_Node (P), Attribute_Name => Name_Result), Expressions => Expressions (N))); Analyze (N); return; end if; Analyze_Attribute_Old_Result (Legal, Spec_Id); -- The aspect or pragma where attribute 'Result resides should be -- associated with a subprogram declaration or a body. If this is not -- the case, then the aspect or pragma is illegal. Return as analysis -- cannot be carried out. -- The exception to this rule is when generating C since in this case -- postconditions are inlined. if No (Spec_Id) and then In_Inlined_C_Postcondition then Spec_Id := Entity (P); elsif not Legal then return; end if; -- Attribute 'Result is part of a _Postconditions procedure. There is -- no need to perform the semantic checks below as they were already -- verified when the attribute was analyzed in its original context. -- Instead, rewrite the attribute as a reference to formal parameter -- _Result of the _Postconditions procedure. if Chars (Spec_Id) = Name_uPostconditions or else (In_Inlined_C_Postcondition and then Nkind (Parent (Spec_Id)) = N_Block_Statement) then Rewrite (N, Make_Identifier (Loc, Name_uResult)); -- The type of formal parameter _Result is that of the function -- encapsulating the _Postconditions procedure. Resolution must -- be carried out against the function return type. Analyze_And_Resolve (N, Etype (Scope (Spec_Id))); -- Otherwise attribute 'Result appears in its original context and -- all semantic checks should be carried out. else -- Verify the legality of the prefix. It must denotes the entity -- of the related [generic] function. if Is_Entity_Name (P) then Pref_Id := Entity (P); if Ekind_In (Pref_Id, E_Function, E_Generic_Function) and then Ekind (Spec_Id) = Ekind (Pref_Id) then if Denote_Same_Function (Pref_Id, Spec_Id) then -- Correct the prefix of the attribute when the context -- is a generic function. if Pref_Id /= Spec_Id then Rewrite (P, New_Occurrence_Of (Spec_Id, Loc)); Analyze (P); end if; Set_Etype (N, Etype (Spec_Id)); -- Otherwise the prefix denotes some unrelated function else Error_Msg_Name_2 := Chars (Spec_Id); Error_Attr ("incorrect prefix for attribute %, expected %", P); end if; -- Otherwise the prefix denotes some other form of subprogram -- entity. else Error_Attr ("attribute % can only appear in postcondition of " & "function", P); end if; -- Otherwise the prefix is illegal else Error_Msg_Name_2 := Chars (Spec_Id); Error_Attr ("incorrect prefix for attribute %, expected %", P); end if; end if; end Result; ------------------ -- Range_Length -- ------------------ when Attribute_Range_Length => Check_E0; Check_Discrete_Type; Set_Etype (N, Universal_Integer); ---------- -- Read -- ---------- when Attribute_Read => Check_E2; Check_Stream_Attribute (TSS_Stream_Read); Set_Etype (N, Standard_Void_Type); Resolve (N, Standard_Void_Type); Note_Possible_Modification (E2, Sure => True); --------- -- Ref -- --------- when Attribute_Ref => Check_E1; Analyze (P); if Nkind (P) /= N_Expanded_Name or else not Is_RTE (P_Type, RE_Address) then Error_Attr_P ("prefix of % attribute must be System.Address"); end if; Analyze_And_Resolve (E1, Any_Integer); Set_Etype (N, RTE (RE_Address)); --------------- -- Remainder -- --------------- when Attribute_Remainder => Check_Floating_Point_Type_2; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); Resolve (E2, P_Base_Type); --------------------- -- Restriction_Set -- --------------------- when Attribute_Restriction_Set => Restriction_Set : declare R : Restriction_Id; U : Node_Id; Unam : Unit_Name_Type; begin Check_E1; Analyze (P); Check_System_Prefix; -- No_Dependence case if Nkind (E1) = N_Parameter_Association then pragma Assert (Chars (Selector_Name (E1)) = Name_No_Dependence); U := Explicit_Actual_Parameter (E1); if not OK_No_Dependence_Unit_Name (U) then Set_Boolean_Result (N, False); Error_Attr; end if; -- See if there is an entry already in the table. That's the -- case in which we can return True. for J in No_Dependences.First .. No_Dependences.Last loop if Designate_Same_Unit (U, No_Dependences.Table (J).Unit) and then No_Dependences.Table (J).Warn = False then Set_Boolean_Result (N, True); return; end if; end loop; -- If not in the No_Dependence table, result is False Set_Boolean_Result (N, False); -- In this case, we must ensure that the binder will reject any -- other unit in the partition that sets No_Dependence for this -- unit. We do that by making an entry in the special table kept -- for this purpose (if the entry is not there already). Unam := Get_Spec_Name (Get_Unit_Name (U)); for J in Restriction_Set_Dependences.First .. Restriction_Set_Dependences.Last loop if Restriction_Set_Dependences.Table (J) = Unam then return; end if; end loop; Restriction_Set_Dependences.Append (Unam); -- Normal restriction case else if Nkind (E1) /= N_Identifier then Set_Boolean_Result (N, False); Error_Attr ("attribute % requires restriction identifier", E1); else R := Get_Restriction_Id (Process_Restriction_Synonyms (E1)); if R = Not_A_Restriction_Id then Set_Boolean_Result (N, False); Error_Msg_Node_1 := E1; Error_Attr ("invalid restriction identifier &", E1); elsif R not in Partition_Boolean_Restrictions then Set_Boolean_Result (N, False); Error_Msg_Node_1 := E1; Error_Attr ("& is not a boolean partition-wide restriction", E1); end if; if Restriction_Active (R) then Set_Boolean_Result (N, True); else Check_Restriction (R, N); Set_Boolean_Result (N, False); end if; end if; end if; end Restriction_Set; ----------- -- Round -- ----------- when Attribute_Round => Check_E1; Check_Decimal_Fixed_Point_Type; Set_Etype (N, P_Base_Type); -- Because the context is universal_real (3.5.10(12)) it is a -- legal context for a universal fixed expression. This is the -- only attribute whose functional description involves U_R. if Etype (E1) = Universal_Fixed then declare Conv : constant Node_Id := Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Universal_Real, Loc), Expression => Relocate_Node (E1)); begin Rewrite (E1, Conv); Analyze (E1); end; end if; Resolve (E1, Any_Real); -------------- -- Rounding -- -------------- when Attribute_Rounding => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); --------------- -- Safe_Emax -- --------------- when Attribute_Safe_Emax => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Integer); ---------------- -- Safe_First -- ---------------- when Attribute_Safe_First => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Real); ---------------- -- Safe_Large -- ---------------- when Attribute_Safe_Large => Check_E0; Check_Real_Type; Set_Etype (N, Universal_Real); --------------- -- Safe_Last -- --------------- when Attribute_Safe_Last => Check_Floating_Point_Type_0; Set_Etype (N, Universal_Real); ---------------- -- Safe_Small -- ---------------- when Attribute_Safe_Small => Check_E0; Check_Real_Type; Set_Etype (N, Universal_Real); -------------------------- -- Scalar_Storage_Order -- -------------------------- when Attribute_Scalar_Storage_Order => Scalar_Storage_Order : declare Ent : Entity_Id := Empty; begin Check_E0; Check_Type; if not (Is_Record_Type (P_Type) or else Is_Array_Type (P_Type)) then -- In GNAT mode, the attribute applies to generic types as well -- as composite types, and for non-composite types always returns -- the default bit order for the target. if not (GNAT_Mode and then Is_Generic_Type (P_Type)) and then not In_Instance then Error_Attr_P ("prefix of % attribute must be record or array type"); elsif not Is_Generic_Type (P_Type) then if Bytes_Big_Endian then Ent := RTE (RE_High_Order_First); else Ent := RTE (RE_Low_Order_First); end if; end if; elsif Bytes_Big_Endian xor Reverse_Storage_Order (P_Type) then Ent := RTE (RE_High_Order_First); else Ent := RTE (RE_Low_Order_First); end if; if Present (Ent) then Rewrite (N, New_Occurrence_Of (Ent, Loc)); end if; Set_Etype (N, RTE (RE_Bit_Order)); Resolve (N); -- Reset incorrect indication of staticness Set_Is_Static_Expression (N, False); end Scalar_Storage_Order; ----------- -- Scale -- ----------- when Attribute_Scale => Check_E0; Check_Decimal_Fixed_Point_Type; Set_Etype (N, Universal_Integer); ------------- -- Scaling -- ------------- when Attribute_Scaling => Check_Floating_Point_Type_2; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); ------------------ -- Signed_Zeros -- ------------------ when Attribute_Signed_Zeros => Check_Floating_Point_Type_0; Set_Etype (N, Standard_Boolean); ---------- -- Size -- ---------- when Attribute_Size | Attribute_VADS_Size => Check_E0; -- If prefix is parameterless function call, rewrite and resolve -- as such. if Is_Entity_Name (P) and then Ekind (Entity (P)) = E_Function then Resolve (P); -- Similar processing for a protected function call elsif Nkind (P) = N_Selected_Component and then Ekind (Entity (Selector_Name (P))) = E_Function then Resolve (P); end if; if Is_Object_Reference (P) then Check_Object_Reference (P); elsif Is_Entity_Name (P) and then (Is_Type (Entity (P)) or else Ekind (Entity (P)) = E_Enumeration_Literal) then null; elsif Nkind (P) = N_Type_Conversion and then not Comes_From_Source (P) then null; -- Some other compilers allow dubious use of X'???'Size elsif Relaxed_RM_Semantics and then Nkind (P) = N_Attribute_Reference then null; else Error_Attr_P ("invalid prefix for % attribute"); end if; Check_Not_Incomplete_Type; Check_Not_CPP_Type; Set_Etype (N, Universal_Integer); -- If we are processing pragmas Compile_Time_Warning and Compile_ -- Time_Errors after the back end has been called and this occurrence -- of 'Size is known at compile time then it is safe to perform this -- evaluation. Needed to perform the static evaluation of the full -- boolean expression of these pragmas. if In_Compile_Time_Warning_Or_Error and then Is_Entity_Name (P) and then (Is_Type (Entity (P)) or else Ekind (Entity (P)) = E_Enumeration_Literal) and then Size_Known_At_Compile_Time (Entity (P)) then Rewrite (N, Make_Integer_Literal (Sloc (N), Esize (Entity (P)))); Analyze (N); end if; ----------- -- Small -- ----------- when Attribute_Small => Check_E0; Check_Real_Type; Set_Etype (N, Universal_Real); ------------------ -- Storage_Pool -- ------------------ when Attribute_Storage_Pool | Attribute_Simple_Storage_Pool => Check_E0; if Is_Access_Type (P_Type) then if Ekind (P_Type) = E_Access_Subprogram_Type then Error_Attr_P ("cannot use % attribute for access-to-subprogram type"); end if; -- Set appropriate entity if Present (Associated_Storage_Pool (Root_Type (P_Type))) then Set_Entity (N, Associated_Storage_Pool (Root_Type (P_Type))); else Set_Entity (N, RTE (RE_Global_Pool_Object)); end if; if Attr_Id = Attribute_Storage_Pool then if Present (Get_Rep_Pragma (Etype (Entity (N)), Name_Simple_Storage_Pool_Type)) then Error_Msg_Name_1 := Aname; Error_Msg_Warn := SPARK_Mode /= On; Error_Msg_N ("cannot use % attribute for type with simple storage " & "pool<<", N); Error_Msg_N ("\Program_Error [<<", N); Rewrite (N, Make_Raise_Program_Error (Sloc (N), Reason => PE_Explicit_Raise)); end if; Set_Etype (N, Class_Wide_Type (RTE (RE_Root_Storage_Pool))); -- In the Simple_Storage_Pool case, verify that the pool entity is -- actually of a simple storage pool type, and set the attribute's -- type to the pool object's type. else if not Present (Get_Rep_Pragma (Etype (Entity (N)), Name_Simple_Storage_Pool_Type)) then Error_Attr_P ("cannot use % attribute for type without simple " & "storage pool"); end if; Set_Etype (N, Etype (Entity (N))); end if; -- Validate_Remote_Access_To_Class_Wide_Type for attribute -- Storage_Pool since this attribute is not defined for such -- types (RM E.2.3(22)). Validate_Remote_Access_To_Class_Wide_Type (N); else Error_Attr_P ("prefix of % attribute must be access type"); end if; ------------------ -- Storage_Size -- ------------------ when Attribute_Storage_Size => Check_E0; if Is_Task_Type (P_Type) then Set_Etype (N, Universal_Integer); -- Use with tasks is an obsolescent feature Check_Restriction (No_Obsolescent_Features, P); elsif Is_Access_Type (P_Type) then if Ekind (P_Type) = E_Access_Subprogram_Type then Error_Attr_P ("cannot use % attribute for access-to-subprogram type"); end if; if Is_Entity_Name (P) and then Is_Type (Entity (P)) then Check_Type; Set_Etype (N, Universal_Integer); -- Validate_Remote_Access_To_Class_Wide_Type for attribute -- Storage_Size since this attribute is not defined for -- such types (RM E.2.3(22)). Validate_Remote_Access_To_Class_Wide_Type (N); -- The prefix is allowed to be an implicit dereference of an -- access value designating a task. else Check_Task_Prefix; Set_Etype (N, Universal_Integer); end if; else Error_Attr_P ("prefix of % attribute must be access or task type"); end if; ------------------ -- Storage_Unit -- ------------------ when Attribute_Storage_Unit => Standard_Attribute (Ttypes.System_Storage_Unit); ----------------- -- Stream_Size -- ----------------- when Attribute_Stream_Size => Check_E0; Check_Type; if Is_Entity_Name (P) and then Is_Elementary_Type (Entity (P)) then Set_Etype (N, Universal_Integer); else Error_Attr_P ("invalid prefix for % attribute"); end if; --------------- -- Stub_Type -- --------------- when Attribute_Stub_Type => Check_Type; Check_E0; if Is_Remote_Access_To_Class_Wide_Type (Base_Type (P_Type)) then -- For a real RACW [sub]type, use corresponding stub type if not Is_Generic_Type (P_Type) then Rewrite (N, New_Occurrence_Of (Corresponding_Stub_Type (Base_Type (P_Type)), Loc)); -- For a generic type (that has been marked as an RACW using the -- Remote_Access_Type aspect or pragma), use a generic RACW stub -- type. Note that if the actual is not a remote access type, the -- instantiation will fail. else -- Note: we go to the underlying type here because the view -- returned by RTE (RE_RACW_Stub_Type) might be incomplete. Rewrite (N, New_Occurrence_Of (Underlying_Type (RTE (RE_RACW_Stub_Type)), Loc)); end if; else Error_Attr_P ("prefix of% attribute must be remote access-to-class-wide"); end if; ---------- -- Succ -- ---------- when Attribute_Succ => Check_Scalar_Type; Check_E1; if Is_Real_Type (P_Type) or else Is_Boolean_Type (P_Type) then Error_Msg_Name_1 := Aname; Error_Msg_Name_2 := Chars (P_Type); Check_SPARK_05_Restriction ("attribute% is not allowed for type%", P); end if; Resolve (E1, P_Base_Type); Set_Etype (N, P_Base_Type); -- Since Pred works on the base type, we normally do no check for the -- floating-point case, since the base type is unconstrained. But we -- make an exception in Check_Float_Overflow mode. if Is_Floating_Point_Type (P_Type) then if not Range_Checks_Suppressed (P_Base_Type) then Set_Do_Range_Check (E1); end if; -- If not modular type, test for overflow check required else if not Is_Modular_Integer_Type (P_Type) and then not Range_Checks_Suppressed (P_Base_Type) then Enable_Range_Check (E1); end if; end if; -------------------------------- -- System_Allocator_Alignment -- -------------------------------- when Attribute_System_Allocator_Alignment => Standard_Attribute (Ttypes.System_Allocator_Alignment); --------- -- Tag -- --------- when Attribute_Tag => Check_E0; Check_Dereference; if not Is_Tagged_Type (P_Type) then Error_Attr_P ("prefix of % attribute must be tagged"); -- Next test does not apply to generated code why not, and what does -- the illegal reference mean??? elsif Is_Object_Reference (P) and then not Is_Class_Wide_Type (P_Type) and then Comes_From_Source (N) then Error_Attr_P ("% attribute can only be applied to objects " & "of class - wide type"); end if; -- The prefix cannot be an incomplete type. However, references to -- 'Tag can be generated when expanding interface conversions, and -- this is legal. if Comes_From_Source (N) then Check_Not_Incomplete_Type; end if; -- Set appropriate type Set_Etype (N, RTE (RE_Tag)); ----------------- -- Target_Name -- ----------------- when Attribute_Target_Name => Target_Name : declare TN : constant String := Sdefault.Target_Name.all; TL : Natural; begin Check_Standard_Prefix; TL := TN'Last; if TN (TL) = '/' or else TN (TL) = '\' then TL := TL - 1; end if; Rewrite (N, Make_String_Literal (Loc, Strval => TN (TN'First .. TL))); Analyze_And_Resolve (N, Standard_String); Set_Is_Static_Expression (N, True); end Target_Name; ---------------- -- Terminated -- ---------------- when Attribute_Terminated => Check_E0; Set_Etype (N, Standard_Boolean); Check_Task_Prefix; ---------------- -- To_Address -- ---------------- when Attribute_To_Address => To_Address : declare Val : Uint; begin Check_E1; Analyze (P); Check_System_Prefix; Generate_Reference (RTE (RE_Address), P); Analyze_And_Resolve (E1, Any_Integer); Set_Etype (N, RTE (RE_Address)); if Is_Static_Expression (E1) then Set_Is_Static_Expression (N, True); end if; -- OK static expression case, check range and set appropriate type if Is_OK_Static_Expression (E1) then Val := Expr_Value (E1); if Val < -(2 ** UI_From_Int (Standard'Address_Size - 1)) or else Val > 2 ** UI_From_Int (Standard'Address_Size) - 1 then Error_Attr ("address value out of range for % attribute", E1); end if; -- In most cases the expression is a numeric literal or some other -- address expression, but if it is a declared constant it may be -- of a compatible type that must be left on the node. if Is_Entity_Name (E1) then null; -- Set type to universal integer if negative elsif Val < 0 then Set_Etype (E1, Universal_Integer); -- Otherwise set type to Unsigned_64 to accomodate max values else Set_Etype (E1, Standard_Unsigned_64); end if; end if; Set_Is_Static_Expression (N, True); end To_Address; ------------ -- To_Any -- ------------ when Attribute_To_Any => Check_E1; Check_PolyORB_Attribute; Set_Etype (N, RTE (RE_Any)); ---------------- -- Truncation -- ---------------- when Attribute_Truncation => Check_Floating_Point_Type_1; Resolve (E1, P_Base_Type); Set_Etype (N, P_Base_Type); ---------------- -- Type_Class -- ---------------- when Attribute_Type_Class => Check_E0; Check_Type; Check_Not_Incomplete_Type; Set_Etype (N, RTE (RE_Type_Class)); -------------- -- TypeCode -- -------------- when Attribute_TypeCode => Check_E0; Check_PolyORB_Attribute; Set_Etype (N, RTE (RE_TypeCode)); -------------- -- Type_Key -- -------------- when Attribute_Type_Key => Type_Key : declare Full_Name : constant String_Id := Fully_Qualified_Name_String (Entity (P)); CRC : CRC32; -- The computed signature for the type Deref : Boolean; -- To simplify the handling of mutually recursive types, follow a -- single dereference link in a composite type. procedure Compute_Type_Key (T : Entity_Id); -- Create a CRC integer from the declaration of the type, For a -- composite type, fold in the representation of its components in -- recursive fashion. We use directly the source representation of -- the types involved. ---------------------- -- Compute_Type_Key -- ---------------------- procedure Compute_Type_Key (T : Entity_Id) is Buffer : Source_Buffer_Ptr; P_Max : Source_Ptr; P_Min : Source_Ptr; Rep : Node_Id; SFI : Source_File_Index; procedure Process_One_Declaration; -- Update CRC with the characters of one type declaration, or a -- representation pragma that applies to the type. ----------------------------- -- Process_One_Declaration -- ----------------------------- procedure Process_One_Declaration is Ptr : Source_Ptr; begin Ptr := P_Min; -- Scan type declaration, skipping blanks while Ptr <= P_Max loop if Buffer (Ptr) /= ' ' then System.CRC32.Update (CRC, Buffer (Ptr)); end if; Ptr := Ptr + 1; end loop; end Process_One_Declaration; -- Start of processing for Compute_Type_Key begin if Is_Itype (T) then return; end if; Sloc_Range (Enclosing_Declaration (T), P_Min, P_Max); SFI := Get_Source_File_Index (P_Min); Buffer := Source_Text (SFI); Process_One_Declaration; -- Recurse on relevant component types if Is_Array_Type (T) then Compute_Type_Key (Component_Type (T)); elsif Is_Access_Type (T) then if not Deref then Deref := True; Compute_Type_Key (Designated_Type (T)); end if; elsif Is_Derived_Type (T) then Compute_Type_Key (Etype (T)); elsif Is_Record_Type (T) then declare Comp : Entity_Id; begin Comp := First_Component (T); while Present (Comp) loop Compute_Type_Key (Etype (Comp)); Next_Component (Comp); end loop; end; end if; -- Fold in representation aspects for the type, which appear in -- the same source buffer. Rep := First_Rep_Item (T); while Present (Rep) loop if Comes_From_Source (Rep) then Sloc_Range (Rep, P_Min, P_Max); Process_One_Declaration; end if; Rep := Next_Rep_Item (Rep); end loop; end Compute_Type_Key; -- Start of processing for Type_Key begin Check_E0; Check_Type; Start_String; Deref := False; -- Copy all characters in Full_Name but the trailing NUL for J in 1 .. String_Length (Full_Name) - 1 loop Store_String_Char (Get_String_Char (Full_Name, Pos (J))); end loop; -- For standard types return the name of the type, as there is no -- explicit source declaration to use. Otherwise compute CRC and -- convert it to string one character at a time, so as not to use -- Image within the compiler. if Scope (Entity (P)) /= Standard_Standard then Initialize (CRC); Compute_Type_Key (Entity (P)); if not Is_Frozen (Entity (P)) then Error_Msg_N ("premature usage of Type_Key?", N); end if; while CRC > 0 loop Store_String_Char (Character'Val (48 + (CRC rem 10))); CRC := CRC / 10; end loop; end if; Rewrite (N, Make_String_Literal (Loc, End_String)); Analyze_And_Resolve (N, Standard_String); end Type_Key; ----------------------- -- Unbiased_Rounding -- ----------------------- when Attribute_Unbiased_Rounding => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); ---------------------- -- Unchecked_Access -- ---------------------- when Attribute_Unchecked_Access => if Comes_From_Source (N) then Check_Restriction (No_Unchecked_Access, N); end if; Analyze_Access_Attribute; Check_Not_Incomplete_Type; ------------------------- -- Unconstrained_Array -- ------------------------- when Attribute_Unconstrained_Array => Check_E0; Check_Type; Check_Not_Incomplete_Type; Set_Etype (N, Standard_Boolean); Set_Is_Static_Expression (N, True); ------------------------------ -- Universal_Literal_String -- ------------------------------ -- This is a GNAT specific attribute whose prefix must be a named -- number where the expression is either a single numeric literal, -- or a numeric literal immediately preceded by a minus sign. The -- result is equivalent to a string literal containing the text of -- the literal as it appeared in the source program with a possible -- leading minus sign. when Attribute_Universal_Literal_String => Check_E0; if not Is_Entity_Name (P) or else Ekind (Entity (P)) not in Named_Kind then Error_Attr_P ("prefix for % attribute must be named number"); else declare Expr : Node_Id; Negative : Boolean; S : Source_Ptr; Src : Source_Buffer_Ptr; begin Expr := Original_Node (Expression (Parent (Entity (P)))); if Nkind (Expr) = N_Op_Minus then Negative := True; Expr := Original_Node (Right_Opnd (Expr)); else Negative := False; end if; if not Nkind_In (Expr, N_Integer_Literal, N_Real_Literal) then Error_Attr ("named number for % attribute must be simple literal", N); end if; -- Build string literal corresponding to source literal text Start_String; if Negative then Store_String_Char (Get_Char_Code ('-')); end if; S := Sloc (Expr); Src := Source_Text (Get_Source_File_Index (S)); while Src (S) /= ';' and then Src (S) /= ' ' loop Store_String_Char (Get_Char_Code (Src (S))); S := S + 1; end loop; -- Now we rewrite the attribute with the string literal Rewrite (N, Make_String_Literal (Loc, End_String)); Analyze (N); Set_Is_Static_Expression (N, True); end; end if; ------------------------- -- Unrestricted_Access -- ------------------------- -- This is a GNAT specific attribute which is like Access except that -- all scope checks and checks for aliased views are omitted. It is -- documented as being equivalent to the use of the Address attribute -- followed by an unchecked conversion to the target access type. when Attribute_Unrestricted_Access => -- If from source, deal with relevant restrictions if Comes_From_Source (N) then Check_Restriction (No_Unchecked_Access, N); if Nkind (P) in N_Has_Entity and then Present (Entity (P)) and then Is_Object (Entity (P)) then Check_Restriction (No_Implicit_Aliasing, N); end if; end if; if Is_Entity_Name (P) then Set_Address_Taken (Entity (P)); end if; -- It might seem reasonable to call Address_Checks here to apply the -- same set of semantic checks that we enforce for 'Address (after -- all we document Unrestricted_Access as being equivalent to the -- use of Address followed by an Unchecked_Conversion). However, if -- we do enable these checks, we get multiple failures in both the -- compiler run-time and in our regression test suite, so we leave -- out these checks for now. To be investigated further some time??? -- Address_Checks; -- Now complete analysis using common access processing Analyze_Access_Attribute; ------------ -- Update -- ------------ when Attribute_Update => Update : declare Common_Typ : Entity_Id; -- The common type of a multiple component update for a record Comps : Elist_Id := No_Elist; -- A list used in the resolution of a record update. It contains the -- entities of all record components processed so far. procedure Analyze_Array_Component_Update (Assoc : Node_Id); -- Analyze and resolve array_component_association Assoc against the -- index of array type P_Type. procedure Analyze_Record_Component_Update (Comp : Node_Id); -- Analyze and resolve record_component_association Comp against -- record type P_Type. ------------------------------------ -- Analyze_Array_Component_Update -- ------------------------------------ procedure Analyze_Array_Component_Update (Assoc : Node_Id) is Expr : Node_Id; High : Node_Id; Index : Node_Id; Index_Typ : Entity_Id; Low : Node_Id; begin -- The current association contains a sequence of indexes denoting -- an element of a multidimensional array: -- (Index_1, ..., Index_N) -- Examine each individual index and resolve it against the proper -- index type of the array. if Nkind (First (Choices (Assoc))) = N_Aggregate then Expr := First (Choices (Assoc)); while Present (Expr) loop -- The use of others is illegal (SPARK RM 4.4.1(12)) if Nkind (Expr) = N_Others_Choice then Error_Attr ("others choice not allowed in attribute %", Expr); -- Otherwise analyze and resolve all indexes else Index := First (Expressions (Expr)); Index_Typ := First_Index (P_Type); while Present (Index) and then Present (Index_Typ) loop Analyze_And_Resolve (Index, Etype (Index_Typ)); Next (Index); Next_Index (Index_Typ); end loop; -- Detect a case where the association either lacks an -- index or contains an extra index. if Present (Index) or else Present (Index_Typ) then Error_Msg_N ("dimension mismatch in index list", Assoc); end if; end if; Next (Expr); end loop; -- The current association denotes either a single component or a -- range of components of a one dimensional array: -- 1, 2 .. 5 -- Resolve the index or its high and low bounds (if range) against -- the proper index type of the array. else Index := First (Choices (Assoc)); Index_Typ := First_Index (P_Type); if Present (Next_Index (Index_Typ)) then Error_Msg_N ("too few subscripts in array reference", Assoc); end if; while Present (Index) loop -- The use of others is illegal (SPARK RM 4.4.1(12)) if Nkind (Index) = N_Others_Choice then Error_Attr ("others choice not allowed in attribute %", Index); -- The index denotes a range of elements elsif Nkind (Index) = N_Range then Low := Low_Bound (Index); High := High_Bound (Index); Analyze_And_Resolve (Low, Etype (Index_Typ)); Analyze_And_Resolve (High, Etype (Index_Typ)); -- Add a range check to ensure that the bounds of the -- range are within the index type when this cannot be -- determined statically. if not Is_OK_Static_Expression (Low) then Set_Do_Range_Check (Low); end if; if not Is_OK_Static_Expression (High) then Set_Do_Range_Check (High); end if; -- Otherwise the index denotes a single element else Analyze_And_Resolve (Index, Etype (Index_Typ)); -- Add a range check to ensure that the index is within -- the index type when it is not possible to determine -- this statically. if not Is_OK_Static_Expression (Index) then Set_Do_Range_Check (Index); end if; end if; Next (Index); end loop; end if; end Analyze_Array_Component_Update; ------------------------------------- -- Analyze_Record_Component_Update -- ------------------------------------- procedure Analyze_Record_Component_Update (Comp : Node_Id) is Comp_Name : constant Name_Id := Chars (Comp); Base_Typ : Entity_Id; Comp_Or_Discr : Entity_Id; begin -- Find the discriminant or component whose name corresponds to -- Comp. A simple character comparison is sufficient because all -- visible names within a record type are unique. Comp_Or_Discr := First_Entity (P_Type); while Present (Comp_Or_Discr) loop if Chars (Comp_Or_Discr) = Comp_Name then -- Decorate the component reference by setting its entity -- and type for resolution purposes. Set_Entity (Comp, Comp_Or_Discr); Set_Etype (Comp, Etype (Comp_Or_Discr)); exit; end if; Comp_Or_Discr := Next_Entity (Comp_Or_Discr); end loop; -- Diagnose an illegal reference if Present (Comp_Or_Discr) then if Ekind (Comp_Or_Discr) = E_Discriminant then Error_Attr ("attribute % may not modify record discriminants", Comp); else pragma Assert (Ekind (Comp_Or_Discr) = E_Component); if Contains (Comps, Comp_Or_Discr) then Error_Msg_N ("component & already updated", Comp); -- Mark this component as processed else Append_New_Elmt (Comp_Or_Discr, Comps); end if; end if; -- The update aggregate mentions an entity that does not belong to -- the record type. else Error_Msg_N ("& is not a component of aggregate subtype", Comp); end if; -- Verify the consistency of types when the current component is -- part of a miltiple component update. -- Comp_1, ..., Comp_N => <value> if Present (Etype (Comp)) then Base_Typ := Base_Type (Etype (Comp)); -- Save the type of the first component reference as the -- remaning references (if any) must resolve to this type. if No (Common_Typ) then Common_Typ := Base_Typ; elsif Base_Typ /= Common_Typ then Error_Msg_N ("components in choice list must have same type", Comp); end if; end if; end Analyze_Record_Component_Update; -- Local variables Assoc : Node_Id; Comp : Node_Id; -- Start of processing for Update begin Check_E1; if not Is_Object_Reference (P) then Error_Attr_P ("prefix of attribute % must denote an object"); elsif not Is_Array_Type (P_Type) and then not Is_Record_Type (P_Type) then Error_Attr_P ("prefix of attribute % must be a record or array"); elsif Is_Limited_View (P_Type) then Error_Attr ("prefix of attribute % cannot be limited", N); elsif Nkind (E1) /= N_Aggregate then Error_Attr ("attribute % requires component association list", N); end if; -- Inspect the update aggregate, looking at all the associations and -- choices. Perform the following checks: -- 1) Legality of "others" in all cases -- 2) Legality of <> -- 3) Component legality for arrays -- 4) Component legality for records -- The remaining checks are performed on the expanded attribute Assoc := First (Component_Associations (E1)); while Present (Assoc) loop -- The use of <> is illegal (SPARK RM 4.4.1(1)) if Box_Present (Assoc) then Error_Attr ("default initialization not allowed in attribute %", Assoc); -- Otherwise process the association else Analyze (Expression (Assoc)); if Is_Array_Type (P_Type) then Analyze_Array_Component_Update (Assoc); elsif Is_Record_Type (P_Type) then -- Reset the common type used in a multiple component update -- as we are processing the contents of a new association. Common_Typ := Empty; Comp := First (Choices (Assoc)); while Present (Comp) loop if Nkind (Comp) = N_Identifier then Analyze_Record_Component_Update (Comp); -- The use of others is illegal (SPARK RM 4.4.1(5)) elsif Nkind (Comp) = N_Others_Choice then Error_Attr ("others choice not allowed in attribute %", Comp); -- The name of a record component cannot appear in any -- other form. else Error_Msg_N ("name should be identifier or OTHERS", Comp); end if; Next (Comp); end loop; end if; end if; Next (Assoc); end loop; -- The type of attribute 'Update is that of the prefix Set_Etype (N, P_Type); Sem_Warn.Warn_On_Suspicious_Update (N); end Update; --------- -- Val -- --------- when Attribute_Val => Check_E1; Check_Discrete_Type; if Is_Boolean_Type (P_Type) then Error_Msg_Name_1 := Aname; Error_Msg_Name_2 := Chars (P_Type); Check_SPARK_05_Restriction ("attribute% is not allowed for type%", P); end if; -- Note, we need a range check in general, but we wait for the -- Resolve call to do this, since we want to let Eval_Attribute -- have a chance to find an static illegality first. Resolve (E1, Any_Integer); Set_Etype (N, P_Base_Type); ----------- -- Valid -- ----------- when Attribute_Valid => Check_E0; -- Ignore check for object if we have a 'Valid reference generated -- by the expanded code, since in some cases valid checks can occur -- on items that are names, but are not objects (e.g. attributes). if Comes_From_Source (N) then Check_Object_Reference (P); end if; if not Is_Scalar_Type (P_Type) then Error_Attr_P ("object for % attribute must be of scalar type"); end if; -- If the attribute appears within the subtype's own predicate -- function, then issue a warning that this will cause infinite -- recursion. declare Pred_Func : constant Entity_Id := Predicate_Function (P_Type); begin if Present (Pred_Func) and then Current_Scope = Pred_Func then Error_Msg_N ("attribute Valid requires a predicate check??", N); Error_Msg_N ("\and will result in infinite recursion??", N); end if; end; Set_Etype (N, Standard_Boolean); ------------------- -- Valid_Scalars -- ------------------- when Attribute_Valid_Scalars => Check_E0; Check_Object_Reference (P); Set_Etype (N, Standard_Boolean); -- Following checks are only for source types if Comes_From_Source (N) then if not Scalar_Part_Present (P_Type) then Error_Attr_P ("??attribute % always True, no scalars to check"); end if; -- Not allowed for unchecked union type if Has_Unchecked_Union (P_Type) then Error_Attr_P ("attribute % not allowed for Unchecked_Union type"); end if; end if; ----------- -- Value -- ----------- when Attribute_Value => Check_SPARK_05_Restriction_On_Attribute; Check_E1; Check_Scalar_Type; -- Case of enumeration type -- When an enumeration type appears in an attribute reference, all -- literals of the type are marked as referenced. This must only be -- done if the attribute reference appears in the current source. -- Otherwise the information on references may differ between a -- normal compilation and one that performs inlining. if Is_Enumeration_Type (P_Type) and then In_Extended_Main_Code_Unit (N) then Check_Restriction (No_Enumeration_Maps, N); -- Mark all enumeration literals as referenced, since the use of -- the Value attribute can implicitly reference any of the -- literals of the enumeration base type. declare Ent : Entity_Id := First_Literal (P_Base_Type); begin while Present (Ent) loop Set_Referenced (Ent); Next_Literal (Ent); end loop; end; end if; -- Set Etype before resolving expression because expansion of -- expression may require enclosing type. Note that the type -- returned by 'Value is the base type of the prefix type. Set_Etype (N, P_Base_Type); Validate_Non_Static_Attribute_Function_Call; -- Check restriction No_Fixed_IO if Restriction_Check_Required (No_Fixed_IO) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; ---------------- -- Value_Size -- ---------------- when Attribute_Value_Size => Check_E0; Check_Type; Check_Not_Incomplete_Type; Set_Etype (N, Universal_Integer); ------------- -- Version -- ------------- when Attribute_Version => Check_E0; Check_Program_Unit; Set_Etype (N, RTE (RE_Version_String)); ------------------ -- Wchar_T_Size -- ------------------ when Attribute_Wchar_T_Size => Standard_Attribute (Interfaces_Wchar_T_Size); ---------------- -- Wide_Image -- ---------------- when Attribute_Wide_Image => Check_SPARK_05_Restriction_On_Attribute; Check_Scalar_Type; Set_Etype (N, Standard_Wide_String); Check_E1; Resolve (E1, P_Base_Type); Validate_Non_Static_Attribute_Function_Call; -- Check restriction No_Fixed_IO if Restriction_Check_Required (No_Fixed_IO) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; --------------------- -- Wide_Wide_Image -- --------------------- when Attribute_Wide_Wide_Image => Check_Scalar_Type; Set_Etype (N, Standard_Wide_Wide_String); Check_E1; Resolve (E1, P_Base_Type); Validate_Non_Static_Attribute_Function_Call; -- Check restriction No_Fixed_IO if Restriction_Check_Required (No_Fixed_IO) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; ---------------- -- Wide_Value -- ---------------- when Attribute_Wide_Value => Check_SPARK_05_Restriction_On_Attribute; Check_E1; Check_Scalar_Type; -- Set Etype before resolving expression because expansion -- of expression may require enclosing type. Set_Etype (N, P_Type); Validate_Non_Static_Attribute_Function_Call; -- Check restriction No_Fixed_IO if Restriction_Check_Required (No_Fixed_IO) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; --------------------- -- Wide_Wide_Value -- --------------------- when Attribute_Wide_Wide_Value => Check_E1; Check_Scalar_Type; -- Set Etype before resolving expression because expansion -- of expression may require enclosing type. Set_Etype (N, P_Type); Validate_Non_Static_Attribute_Function_Call; -- Check restriction No_Fixed_IO if Restriction_Check_Required (No_Fixed_IO) and then Is_Fixed_Point_Type (P_Type) then Check_Restriction (No_Fixed_IO, P); end if; --------------------- -- Wide_Wide_Width -- --------------------- when Attribute_Wide_Wide_Width => Check_E0; Check_Scalar_Type; Set_Etype (N, Universal_Integer); ---------------- -- Wide_Width -- ---------------- when Attribute_Wide_Width => Check_SPARK_05_Restriction_On_Attribute; Check_E0; Check_Scalar_Type; Set_Etype (N, Universal_Integer); ----------- -- Width -- ----------- when Attribute_Width => Check_SPARK_05_Restriction_On_Attribute; Check_E0; Check_Scalar_Type; Set_Etype (N, Universal_Integer); --------------- -- Word_Size -- --------------- when Attribute_Word_Size => Standard_Attribute (System_Word_Size); ----------- -- Write -- ----------- when Attribute_Write => Check_E2; Check_Stream_Attribute (TSS_Stream_Write); Set_Etype (N, Standard_Void_Type); Resolve (N, Standard_Void_Type); end case; -- In SPARK certain attributes (see below) depend on Tasking_State. -- Ensure that the entity is available for gnat2why by loading it. -- See SPARK RM 9(18) for the relevant rule. if GNATprove_Mode then declare Unused : Entity_Id; begin case Attr_Id is when Attribute_Callable | Attribute_Caller | Attribute_Count | Attribute_Terminated => Unused := RTE (RE_Tasking_State); when others => null; end case; end; end if; -- All errors raise Bad_Attribute, so that we get out before any further -- damage occurs when an error is detected (for example, if we check for -- one attribute expression, and the check succeeds, we want to be able -- to proceed securely assuming that an expression is in fact present. -- Note: we set the attribute analyzed in this case to prevent any -- attempt at reanalysis which could generate spurious error msgs. exception when Bad_Attribute => Set_Analyzed (N); Set_Etype (N, Any_Type); return; end Analyze_Attribute; -------------------- -- Eval_Attribute -- -------------------- procedure Eval_Attribute (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Aname : constant Name_Id := Attribute_Name (N); Id : constant Attribute_Id := Get_Attribute_Id (Aname); P : constant Node_Id := Prefix (N); C_Type : constant Entity_Id := Etype (N); -- The type imposed by the context E1 : Node_Id; -- First expression, or Empty if none E2 : Node_Id; -- Second expression, or Empty if none P_Entity : Entity_Id; -- Entity denoted by prefix P_Type : Entity_Id; -- The type of the prefix P_Base_Type : Entity_Id; -- The base type of the prefix type P_Root_Type : Entity_Id; -- The root type of the prefix type Static : Boolean; -- True if the result is Static. This is set by the general processing -- to true if the prefix is static, and all expressions are static. It -- can be reset as processing continues for particular attributes. This -- flag can still be True if the reference raises a constraint error. -- Is_Static_Expression (N) is set to follow this value as it is set -- and we could always reference this, but it is convenient to have a -- simple short name to use, since it is frequently referenced. Lo_Bound, Hi_Bound : Node_Id; -- Expressions for low and high bounds of type or array index referenced -- by First, Last, or Length attribute for array, set by Set_Bounds. CE_Node : Node_Id; -- Constraint error node used if we have an attribute reference has -- an argument that raises a constraint error. In this case we replace -- the attribute with a raise constraint_error node. This is important -- processing, since otherwise gigi might see an attribute which it is -- unprepared to deal with. procedure Check_Concurrent_Discriminant (Bound : Node_Id); -- If Bound is a reference to a discriminant of a task or protected type -- occurring within the object's body, rewrite attribute reference into -- a reference to the corresponding discriminal. Use for the expansion -- of checks against bounds of entry family index subtypes. procedure Check_Expressions; -- In case where the attribute is not foldable, the expressions, if -- any, of the attribute, are in a non-static context. This procedure -- performs the required additional checks. function Compile_Time_Known_Bounds (Typ : Entity_Id) return Boolean; -- Determines if the given type has compile time known bounds. Note -- that we enter the case statement even in cases where the prefix -- type does NOT have known bounds, so it is important to guard any -- attempt to evaluate both bounds with a call to this function. procedure Compile_Time_Known_Attribute (N : Node_Id; Val : Uint); -- This procedure is called when the attribute N has a non-static -- but compile time known value given by Val. It includes the -- necessary checks for out of range values. function Fore_Value return Nat; -- Computes the Fore value for the current attribute prefix, which is -- known to be a static fixed-point type. Used by Fore and Width. function Mantissa return Uint; -- Returns the Mantissa value for the prefix type procedure Set_Bounds; -- Used for First, Last and Length attributes applied to an array or -- array subtype. Sets the variables Lo_Bound and Hi_Bound to the low -- and high bound expressions for the index referenced by the attribute -- designator (i.e. the first index if no expression is present, and the -- N'th index if the value N is present as an expression). Also used for -- First and Last of scalar types and for First_Valid and Last_Valid. -- Static is reset to False if the type or index type is not statically -- constrained. function Statically_Denotes_Entity (N : Node_Id) return Boolean; -- Verify that the prefix of a potentially static array attribute -- satisfies the conditions of 4.9 (14). ----------------------------------- -- Check_Concurrent_Discriminant -- ----------------------------------- procedure Check_Concurrent_Discriminant (Bound : Node_Id) is Tsk : Entity_Id; -- The concurrent (task or protected) type begin if Nkind (Bound) = N_Identifier and then Ekind (Entity (Bound)) = E_Discriminant and then Is_Concurrent_Record_Type (Scope (Entity (Bound))) then Tsk := Corresponding_Concurrent_Type (Scope (Entity (Bound))); if In_Open_Scopes (Tsk) and then Has_Completion (Tsk) then -- Find discriminant of original concurrent type, and use -- its current discriminal, which is the renaming within -- the task/protected body. Rewrite (N, New_Occurrence_Of (Find_Body_Discriminal (Entity (Bound)), Loc)); end if; end if; end Check_Concurrent_Discriminant; ----------------------- -- Check_Expressions -- ----------------------- procedure Check_Expressions is E : Node_Id; begin E := E1; while Present (E) loop Check_Non_Static_Context (E); Next (E); end loop; end Check_Expressions; ---------------------------------- -- Compile_Time_Known_Attribute -- ---------------------------------- procedure Compile_Time_Known_Attribute (N : Node_Id; Val : Uint) is T : constant Entity_Id := Etype (N); begin Fold_Uint (N, Val, False); -- Check that result is in bounds of the type if it is static if Is_In_Range (N, T, Assume_Valid => False) then null; elsif Is_Out_Of_Range (N, T) then Apply_Compile_Time_Constraint_Error (N, "value not in range of}??", CE_Range_Check_Failed); elsif not Range_Checks_Suppressed (T) then Enable_Range_Check (N); else Set_Do_Range_Check (N, False); end if; end Compile_Time_Known_Attribute; ------------------------------- -- Compile_Time_Known_Bounds -- ------------------------------- function Compile_Time_Known_Bounds (Typ : Entity_Id) return Boolean is begin return Compile_Time_Known_Value (Type_Low_Bound (Typ)) and then Compile_Time_Known_Value (Type_High_Bound (Typ)); end Compile_Time_Known_Bounds; ---------------- -- Fore_Value -- ---------------- -- Note that the Fore calculation is based on the actual values -- of the bounds, and does not take into account possible rounding. function Fore_Value return Nat is Lo : constant Uint := Expr_Value (Type_Low_Bound (P_Type)); Hi : constant Uint := Expr_Value (Type_High_Bound (P_Type)); Small : constant Ureal := Small_Value (P_Type); Lo_Real : constant Ureal := Lo * Small; Hi_Real : constant Ureal := Hi * Small; T : Ureal; R : Nat; begin -- Bounds are given in terms of small units, so first compute -- proper values as reals. T := UR_Max (abs Lo_Real, abs Hi_Real); R := 2; -- Loop to compute proper value if more than one digit required while T >= Ureal_10 loop R := R + 1; T := T / Ureal_10; end loop; return R; end Fore_Value; -------------- -- Mantissa -- -------------- -- Table of mantissa values accessed by function Computed using -- the relation: -- T'Mantissa = integer next above (D * log(10)/log(2)) + 1) -- where D is T'Digits (RM83 3.5.7) Mantissa_Value : constant array (Nat range 1 .. 40) of Nat := ( 1 => 5, 2 => 8, 3 => 11, 4 => 15, 5 => 18, 6 => 21, 7 => 25, 8 => 28, 9 => 31, 10 => 35, 11 => 38, 12 => 41, 13 => 45, 14 => 48, 15 => 51, 16 => 55, 17 => 58, 18 => 61, 19 => 65, 20 => 68, 21 => 71, 22 => 75, 23 => 78, 24 => 81, 25 => 85, 26 => 88, 27 => 91, 28 => 95, 29 => 98, 30 => 101, 31 => 104, 32 => 108, 33 => 111, 34 => 114, 35 => 118, 36 => 121, 37 => 124, 38 => 128, 39 => 131, 40 => 134); function Mantissa return Uint is begin return UI_From_Int (Mantissa_Value (UI_To_Int (Digits_Value (P_Type)))); end Mantissa; ---------------- -- Set_Bounds -- ---------------- procedure Set_Bounds is Ndim : Nat; Indx : Node_Id; Ityp : Entity_Id; begin -- For a string literal subtype, we have to construct the bounds. -- Valid Ada code never applies attributes to string literals, but -- it is convenient to allow the expander to generate attribute -- references of this type (e.g. First and Last applied to a string -- literal). -- Note that the whole point of the E_String_Literal_Subtype is to -- avoid this construction of bounds, but the cases in which we -- have to materialize them are rare enough that we don't worry. -- The low bound is simply the low bound of the base type. The -- high bound is computed from the length of the string and this -- low bound. if Ekind (P_Type) = E_String_Literal_Subtype then Ityp := Etype (First_Index (Base_Type (P_Type))); Lo_Bound := Type_Low_Bound (Ityp); Hi_Bound := Make_Integer_Literal (Sloc (P), Intval => Expr_Value (Lo_Bound) + String_Literal_Length (P_Type) - 1); Set_Parent (Hi_Bound, P); Analyze_And_Resolve (Hi_Bound, Etype (Lo_Bound)); return; -- For non-array case, just get bounds of scalar type elsif Is_Scalar_Type (P_Type) then Ityp := P_Type; -- For a fixed-point type, we must freeze to get the attributes -- of the fixed-point type set now so we can reference them. if Is_Fixed_Point_Type (P_Type) and then not Is_Frozen (Base_Type (P_Type)) and then Compile_Time_Known_Value (Type_Low_Bound (P_Type)) and then Compile_Time_Known_Value (Type_High_Bound (P_Type)) then Freeze_Fixed_Point_Type (Base_Type (P_Type)); end if; -- For array case, get type of proper index else if No (E1) then Ndim := 1; else Ndim := UI_To_Int (Expr_Value (E1)); end if; Indx := First_Index (P_Type); for J in 1 .. Ndim - 1 loop Next_Index (Indx); end loop; -- If no index type, get out (some other error occurred, and -- we don't have enough information to complete the job). if No (Indx) then Lo_Bound := Error; Hi_Bound := Error; return; end if; Ityp := Etype (Indx); end if; -- A discrete range in an index constraint is allowed to be a -- subtype indication. This is syntactically a pain, but should -- not propagate to the entity for the corresponding index subtype. -- After checking that the subtype indication is legal, the range -- of the subtype indication should be transfered to the entity. -- The attributes for the bounds should remain the simple retrievals -- that they are now. Lo_Bound := Type_Low_Bound (Ityp); Hi_Bound := Type_High_Bound (Ityp); -- If subtype is non-static, result is definitely non-static if not Is_Static_Subtype (Ityp) then Static := False; Set_Is_Static_Expression (N, False); -- Subtype is static, does it raise CE? elsif not Is_OK_Static_Subtype (Ityp) then Set_Raises_Constraint_Error (N); end if; end Set_Bounds; ------------------------------- -- Statically_Denotes_Entity -- ------------------------------- function Statically_Denotes_Entity (N : Node_Id) return Boolean is E : Entity_Id; begin if not Is_Entity_Name (N) then return False; else E := Entity (N); end if; return Nkind (Parent (E)) /= N_Object_Renaming_Declaration or else Statically_Denotes_Entity (Renamed_Object (E)); end Statically_Denotes_Entity; -- Start of processing for Eval_Attribute begin -- Initialize result as non-static, will be reset if appropriate Set_Is_Static_Expression (N, False); Static := False; -- Acquire first two expressions (at the moment, no attributes take more -- than two expressions in any case). if Present (Expressions (N)) then E1 := First (Expressions (N)); E2 := Next (E1); else E1 := Empty; E2 := Empty; end if; -- Special processing for Enabled attribute. This attribute has a very -- special prefix, and the easiest way to avoid lots of special checks -- to protect this special prefix from causing trouble is to deal with -- this attribute immediately and be done with it. if Id = Attribute_Enabled then -- We skip evaluation if the expander is not active. This is not just -- an optimization. It is of key importance that we not rewrite the -- attribute in a generic template, since we want to pick up the -- setting of the check in the instance, Testing Expander_Active -- might seem an easy way of doing this, but we need to account for -- ASIS needs, so check explicitly for a generic context. if not Inside_A_Generic then declare C : constant Check_Id := Get_Check_Id (Chars (P)); R : Boolean; begin if No (E1) then if C in Predefined_Check_Id then R := Scope_Suppress.Suppress (C); else R := Is_Check_Suppressed (Empty, C); end if; else R := Is_Check_Suppressed (Entity (E1), C); end if; Rewrite (N, New_Occurrence_Of (Boolean_Literals (not R), Loc)); end; end if; return; end if; -- Attribute 'Img applied to a static enumeration value is static, and -- we will do the folding right here (things get confused if we let this -- case go through the normal circuitry). if Attribute_Name (N) = Name_Img and then Is_Entity_Name (P) and then Is_Enumeration_Type (Etype (Entity (P))) and then Is_OK_Static_Expression (P) then declare Lit : constant Entity_Id := Expr_Value_E (P); Str : String_Id; begin Start_String; Get_Unqualified_Decoded_Name_String (Chars (Lit)); Set_Casing (All_Upper_Case); Store_String_Chars (Name_Buffer (1 .. Name_Len)); Str := End_String; Rewrite (N, Make_String_Literal (Loc, Strval => Str)); Analyze_And_Resolve (N, Standard_String); Set_Is_Static_Expression (N, True); end; return; end if; -- Special processing for cases where the prefix is an object. For this -- purpose, a string literal counts as an object (attributes of string -- literals can only appear in generated code). if Is_Object_Reference (P) or else Nkind (P) = N_String_Literal then -- For Component_Size, the prefix is an array object, and we apply -- the attribute to the type of the object. This is allowed for both -- unconstrained and constrained arrays, since the bounds have no -- influence on the value of this attribute. if Id = Attribute_Component_Size then P_Entity := Etype (P); -- For Enum_Rep, evaluation depends on the nature of the prefix and -- the optional argument. elsif Id = Attribute_Enum_Rep then if Is_Entity_Name (P) then declare Enum_Expr : Node_Id; -- The enumeration-type expression of interest begin -- P'Enum_Rep case if Ekind_In (Entity (P), E_Constant, E_Enumeration_Literal) then Enum_Expr := P; -- Enum_Type'Enum_Rep (E1) case elsif Is_Enumeration_Type (Entity (P)) then Enum_Expr := E1; -- Otherwise the attribute must be expanded into a -- conversion and evaluated at run time. else Check_Expressions; return; end if; -- We can fold if the expression is an enumeration -- literal, or if it denotes a constant whose value -- is known at compile time. if Nkind (Enum_Expr) in N_Has_Entity and then (Ekind (Entity (Enum_Expr)) = E_Enumeration_Literal or else (Ekind (Entity (Enum_Expr)) = E_Constant and then Nkind (Parent (Entity (Enum_Expr))) = N_Object_Declaration and then Compile_Time_Known_Value (Expression (Parent (Entity (P)))))) then P_Entity := Etype (P); else Check_Expressions; return; end if; end; -- Otherwise the attribute is illegal, do not attempt to perform -- any kind of folding. else return; end if; -- For First and Last, the prefix is an array object, and we apply -- the attribute to the type of the array, but we need a constrained -- type for this, so we use the actual subtype if available. elsif Id = Attribute_First or else Id = Attribute_Last or else Id = Attribute_Length then declare AS : constant Entity_Id := Get_Actual_Subtype_If_Available (P); begin if Present (AS) and then Is_Constrained (AS) then P_Entity := AS; -- If we have an unconstrained type we cannot fold else Check_Expressions; return; end if; end; -- For Size, give size of object if available, otherwise we -- cannot fold Size. elsif Id = Attribute_Size then if Is_Entity_Name (P) and then Known_Esize (Entity (P)) then Compile_Time_Known_Attribute (N, Esize (Entity (P))); return; else Check_Expressions; return; end if; -- For Alignment, give size of object if available, otherwise we -- cannot fold Alignment. elsif Id = Attribute_Alignment then if Is_Entity_Name (P) and then Known_Alignment (Entity (P)) then Fold_Uint (N, Alignment (Entity (P)), Static); return; else Check_Expressions; return; end if; -- For Lock_Free, we apply the attribute to the type of the object. -- This is allowed since we have already verified that the type is a -- protected type. elsif Id = Attribute_Lock_Free then P_Entity := Etype (P); -- No other attributes for objects are folded else Check_Expressions; return; end if; -- Cases where P is not an object. Cannot do anything if P is not the -- name of an entity. elsif not Is_Entity_Name (P) then Check_Expressions; return; -- Otherwise get prefix entity else P_Entity := Entity (P); end if; -- If we are asked to evaluate an attribute where the prefix is a -- non-frozen generic actual type whose RM_Size is still set to zero, -- then abandon the effort. if Is_Type (P_Entity) and then (not Is_Frozen (P_Entity) and then Is_Generic_Actual_Type (P_Entity) and then RM_Size (P_Entity) = 0) -- However, the attribute Unconstrained_Array must be evaluated, -- since it is documented to be a static attribute (and can for -- example appear in a Compile_Time_Warning pragma). The frozen -- status of the type does not affect its evaluation. and then Id /= Attribute_Unconstrained_Array then return; end if; -- At this stage P_Entity is the entity to which the attribute -- is to be applied. This is usually simply the entity of the -- prefix, except in some cases of attributes for objects, where -- as described above, we apply the attribute to the object type. -- Here is where we make sure that static attributes are properly -- marked as such. These are attributes whose prefix is a static -- scalar subtype, whose result is scalar, and whose arguments, if -- present, are static scalar expressions. Note that such references -- are static expressions even if they raise Constraint_Error. -- For example, Boolean'Pos (1/0 = 0) is a static expression, even -- though evaluating it raises constraint error. This means that a -- declaration like: -- X : constant := (if True then 1 else Boolean'Pos (1/0 = 0)); -- is legal, since here this expression appears in a statically -- unevaluated position, so it does not actually raise an exception. if Is_Scalar_Type (P_Entity) and then (not Is_Generic_Type (P_Entity)) and then Is_Static_Subtype (P_Entity) and then Is_Scalar_Type (Etype (N)) and then (No (E1) or else (Is_Static_Expression (E1) and then Is_Scalar_Type (Etype (E1)))) and then (No (E2) or else (Is_Static_Expression (E2) and then Is_Scalar_Type (Etype (E1)))) then Static := True; Set_Is_Static_Expression (N, True); end if; -- First foldable possibility is a scalar or array type (RM 4.9(7)) -- that is not generic (generic types are eliminated by RM 4.9(25)). -- Note we allow non-static non-generic types at this stage as further -- described below. if Is_Type (P_Entity) and then (Is_Scalar_Type (P_Entity) or Is_Array_Type (P_Entity)) and then (not Is_Generic_Type (P_Entity)) then P_Type := P_Entity; -- Second foldable possibility is an array object (RM 4.9(8)) elsif Ekind_In (P_Entity, E_Variable, E_Constant) and then Is_Array_Type (Etype (P_Entity)) and then (not Is_Generic_Type (Etype (P_Entity))) then P_Type := Etype (P_Entity); -- If the entity is an array constant with an unconstrained nominal -- subtype then get the type from the initial value. If the value has -- been expanded into assignments, there is no expression and the -- attribute reference remains dynamic. -- We could do better here and retrieve the type ??? if Ekind (P_Entity) = E_Constant and then not Is_Constrained (P_Type) then if No (Constant_Value (P_Entity)) then return; else P_Type := Etype (Constant_Value (P_Entity)); end if; end if; -- Definite must be folded if the prefix is not a generic type, that -- is to say if we are within an instantiation. Same processing applies -- to the GNAT attributes Atomic_Always_Lock_Free, Has_Discriminants, -- Lock_Free, Type_Class, Has_Tagged_Value, and Unconstrained_Array. elsif (Id = Attribute_Atomic_Always_Lock_Free or else Id = Attribute_Definite or else Id = Attribute_Has_Access_Values or else Id = Attribute_Has_Discriminants or else Id = Attribute_Has_Tagged_Values or else Id = Attribute_Lock_Free or else Id = Attribute_Type_Class or else Id = Attribute_Unconstrained_Array or else Id = Attribute_Max_Alignment_For_Allocation) and then not Is_Generic_Type (P_Entity) then P_Type := P_Entity; -- We can fold 'Size applied to a type if the size is known (as happens -- for a size from an attribute definition clause). At this stage, this -- can happen only for types (e.g. record types) for which the size is -- always non-static. We exclude generic types from consideration (since -- they have bogus sizes set within templates). elsif Id = Attribute_Size and then Is_Type (P_Entity) and then (not Is_Generic_Type (P_Entity)) and then Known_Static_RM_Size (P_Entity) then Compile_Time_Known_Attribute (N, RM_Size (P_Entity)); return; -- We can fold 'Alignment applied to a type if the alignment is known -- (as happens for an alignment from an attribute definition clause). -- At this stage, this can happen only for types (e.g. record types) for -- which the size is always non-static. We exclude generic types from -- consideration (since they have bogus sizes set within templates). elsif Id = Attribute_Alignment and then Is_Type (P_Entity) and then (not Is_Generic_Type (P_Entity)) and then Known_Alignment (P_Entity) then Compile_Time_Known_Attribute (N, Alignment (P_Entity)); return; -- If this is an access attribute that is known to fail accessibility -- check, rewrite accordingly. elsif Attribute_Name (N) = Name_Access and then Raises_Constraint_Error (N) then Rewrite (N, Make_Raise_Program_Error (Loc, Reason => PE_Accessibility_Check_Failed)); Set_Etype (N, C_Type); return; -- No other cases are foldable (they certainly aren't static, and at -- the moment we don't try to fold any cases other than the ones above). else Check_Expressions; return; end if; -- If either attribute or the prefix is Any_Type, then propagate -- Any_Type to the result and don't do anything else at all. if P_Type = Any_Type or else (Present (E1) and then Etype (E1) = Any_Type) or else (Present (E2) and then Etype (E2) = Any_Type) then Set_Etype (N, Any_Type); return; end if; -- Scalar subtype case. We have not yet enforced the static requirement -- of (RM 4.9(7)) and we don't intend to just yet, since there are cases -- of non-static attribute references (e.g. S'Digits for a non-static -- floating-point type, which we can compute at compile time). -- Note: this folding of non-static attributes is not simply a case of -- optimization. For many of the attributes affected, Gigi cannot handle -- the attribute and depends on the front end having folded them away. -- Note: although we don't require staticness at this stage, we do set -- the Static variable to record the staticness, for easy reference by -- those attributes where it matters (e.g. Succ and Pred), and also to -- be used to ensure that non-static folded things are not marked as -- being static (a check that is done right at the end). P_Root_Type := Root_Type (P_Type); P_Base_Type := Base_Type (P_Type); -- If the root type or base type is generic, then we cannot fold. This -- test is needed because subtypes of generic types are not always -- marked as being generic themselves (which seems odd???) if Is_Generic_Type (P_Root_Type) or else Is_Generic_Type (P_Base_Type) then return; end if; if Is_Scalar_Type (P_Type) then if not Is_Static_Subtype (P_Type) then Static := False; Set_Is_Static_Expression (N, False); elsif not Is_OK_Static_Subtype (P_Type) then Set_Raises_Constraint_Error (N); end if; -- Array case. We enforce the constrained requirement of (RM 4.9(7-8)) -- since we can't do anything with unconstrained arrays. In addition, -- only the First, Last and Length attributes are possibly static. -- Atomic_Always_Lock_Free, Definite, Has_Access_Values, -- Has_Discriminants, Has_Tagged_Values, Lock_Free, Type_Class, and -- Unconstrained_Array are again exceptions, because they apply as well -- to unconstrained types. -- In addition Component_Size is an exception since it is possibly -- foldable, even though it is never static, and it does apply to -- unconstrained arrays. Furthermore, it is essential to fold this -- in the packed case, since otherwise the value will be incorrect. elsif Id = Attribute_Atomic_Always_Lock_Free or else Id = Attribute_Definite or else Id = Attribute_Has_Access_Values or else Id = Attribute_Has_Discriminants or else Id = Attribute_Has_Tagged_Values or else Id = Attribute_Lock_Free or else Id = Attribute_Type_Class or else Id = Attribute_Unconstrained_Array or else Id = Attribute_Component_Size then Static := False; Set_Is_Static_Expression (N, False); elsif Id /= Attribute_Max_Alignment_For_Allocation then if not Is_Constrained (P_Type) or else (Id /= Attribute_First and then Id /= Attribute_Last and then Id /= Attribute_Length) then Check_Expressions; return; end if; -- The rules in (RM 4.9(7,8)) require a static array, but as in the -- scalar case, we hold off on enforcing staticness, since there are -- cases which we can fold at compile time even though they are not -- static (e.g. 'Length applied to a static index, even though other -- non-static indexes make the array type non-static). This is only -- an optimization, but it falls out essentially free, so why not. -- Again we compute the variable Static for easy reference later -- (note that no array attributes are static in Ada 83). -- We also need to set Static properly for subsequent legality checks -- which might otherwise accept non-static constants in contexts -- where they are not legal. Static := Ada_Version >= Ada_95 and then Statically_Denotes_Entity (P); Set_Is_Static_Expression (N, Static); declare Nod : Node_Id; begin Nod := First_Index (P_Type); -- The expression is static if the array type is constrained -- by given bounds, and not by an initial expression. Constant -- strings are static in any case. if Root_Type (P_Type) /= Standard_String then Static := Static and then not Is_Constr_Subt_For_U_Nominal (P_Type); Set_Is_Static_Expression (N, Static); end if; while Present (Nod) loop if not Is_Static_Subtype (Etype (Nod)) then Static := False; Set_Is_Static_Expression (N, False); elsif not Is_OK_Static_Subtype (Etype (Nod)) then Set_Raises_Constraint_Error (N); Static := False; Set_Is_Static_Expression (N, False); end if; -- If however the index type is generic, or derived from -- one, attributes cannot be folded. if Is_Generic_Type (Root_Type (Etype (Nod))) and then Id /= Attribute_Component_Size then return; end if; Next_Index (Nod); end loop; end; end if; -- Check any expressions that are present. Note that these expressions, -- depending on the particular attribute type, are either part of the -- attribute designator, or they are arguments in a case where the -- attribute reference returns a function. In the latter case, the -- rule in (RM 4.9(22)) applies and in particular requires the type -- of the expressions to be scalar in order for the attribute to be -- considered to be static. declare E : Node_Id; begin E := E1; while Present (E) loop -- If expression is not static, then the attribute reference -- result certainly cannot be static. if not Is_Static_Expression (E) then Static := False; Set_Is_Static_Expression (N, False); end if; if Raises_Constraint_Error (E) then Set_Raises_Constraint_Error (N); end if; -- If the result is not known at compile time, or is not of -- a scalar type, then the result is definitely not static, -- so we can quit now. if not Compile_Time_Known_Value (E) or else not Is_Scalar_Type (Etype (E)) then -- An odd special case, if this is a Pos attribute, this -- is where we need to apply a range check since it does -- not get done anywhere else. if Id = Attribute_Pos then if Is_Integer_Type (Etype (E)) then Apply_Range_Check (E, Etype (N)); end if; end if; Check_Expressions; return; -- If the expression raises a constraint error, then so does -- the attribute reference. We keep going in this case because -- we are still interested in whether the attribute reference -- is static even if it is not static. elsif Raises_Constraint_Error (E) then Set_Raises_Constraint_Error (N); end if; Next (E); end loop; if Raises_Constraint_Error (Prefix (N)) then Set_Is_Static_Expression (N, False); return; end if; end; -- Deal with the case of a static attribute reference that raises -- constraint error. The Raises_Constraint_Error flag will already -- have been set, and the Static flag shows whether the attribute -- reference is static. In any case we certainly can't fold such an -- attribute reference. -- Note that the rewriting of the attribute node with the constraint -- error node is essential in this case, because otherwise Gigi might -- blow up on one of the attributes it never expects to see. -- The constraint_error node must have the type imposed by the context, -- to avoid spurious errors in the enclosing expression. if Raises_Constraint_Error (N) then CE_Node := Make_Raise_Constraint_Error (Sloc (N), Reason => CE_Range_Check_Failed); Set_Etype (CE_Node, Etype (N)); Set_Raises_Constraint_Error (CE_Node); Check_Expressions; Rewrite (N, Relocate_Node (CE_Node)); Set_Raises_Constraint_Error (N, True); return; end if; -- At this point we have a potentially foldable attribute reference. -- If Static is set, then the attribute reference definitely obeys -- the requirements in (RM 4.9(7,8,22)), and it definitely can be -- folded. If Static is not set, then the attribute may or may not -- be foldable, and the individual attribute processing routines -- test Static as required in cases where it makes a difference. -- In the case where Static is not set, we do know that all the -- expressions present are at least known at compile time (we assumed -- above that if this was not the case, then there was no hope of static -- evaluation). However, we did not require that the bounds of the -- prefix type be compile time known, let alone static). That's because -- there are many attributes that can be computed at compile time on -- non-static subtypes, even though such references are not static -- expressions. -- For VAX float, the root type is an IEEE type. So make sure to use the -- base type instead of the root-type for floating point attributes. case Id is -- Attributes related to Ada 2012 iterators (placeholder ???) when Attribute_Constant_Indexing | Attribute_Default_Iterator | Attribute_Implicit_Dereference | Attribute_Iterator_Element | Attribute_Iterable | Attribute_Variable_Indexing => null; -- Internal attributes used to deal with Ada 2012 delayed aspects. -- These were already rejected by the parser. Thus they shouldn't -- appear here. when Internal_Attribute_Id => raise Program_Error; -------------- -- Adjacent -- -------------- when Attribute_Adjacent => Fold_Ureal (N, Eval_Fat.Adjacent (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static); --------- -- Aft -- --------- when Attribute_Aft => Fold_Uint (N, Aft_Value (P_Type), Static); --------------- -- Alignment -- --------------- when Attribute_Alignment => Alignment_Block : declare P_TypeA : constant Entity_Id := Underlying_Type (P_Type); begin -- Fold if alignment is set and not otherwise if Known_Alignment (P_TypeA) then Fold_Uint (N, Alignment (P_TypeA), Static); end if; end Alignment_Block; ----------------------------- -- Atomic_Always_Lock_Free -- ----------------------------- -- Atomic_Always_Lock_Free attribute is a Boolean, thus no need to fold -- here. when Attribute_Atomic_Always_Lock_Free => Atomic_Always_Lock_Free : declare V : constant Entity_Id := Boolean_Literals (Support_Atomic_Primitives_On_Target and then Support_Atomic_Primitives (P_Type)); begin Rewrite (N, New_Occurrence_Of (V, Loc)); -- Analyze and resolve as boolean. Note that this attribute is a -- static attribute in GNAT. Analyze_And_Resolve (N, Standard_Boolean); Static := True; Set_Is_Static_Expression (N, True); end Atomic_Always_Lock_Free; --------- -- Bit -- --------- -- Bit can never be folded when Attribute_Bit => null; ------------------ -- Body_Version -- ------------------ -- Body_version can never be static when Attribute_Body_Version => null; ------------- -- Ceiling -- ------------- when Attribute_Ceiling => Fold_Ureal (N, Eval_Fat.Ceiling (P_Base_Type, Expr_Value_R (E1)), Static); -------------------- -- Component_Size -- -------------------- when Attribute_Component_Size => if Known_Static_Component_Size (P_Type) then Fold_Uint (N, Component_Size (P_Type), Static); end if; ------------- -- Compose -- ------------- when Attribute_Compose => Fold_Ureal (N, Eval_Fat.Compose (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static); ----------------- -- Constrained -- ----------------- -- Constrained is never folded for now, there may be cases that -- could be handled at compile time. To be looked at later. when Attribute_Constrained => -- The expander might fold it and set the static flag accordingly, -- but with expansion disabled (as in ASIS), it remains as an -- attribute reference, and this reference is not static. Set_Is_Static_Expression (N, False); null; --------------- -- Copy_Sign -- --------------- when Attribute_Copy_Sign => Fold_Ureal (N, Eval_Fat.Copy_Sign (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static); -------------- -- Definite -- -------------- when Attribute_Definite => Rewrite (N, New_Occurrence_Of ( Boolean_Literals (Is_Definite_Subtype (P_Entity)), Loc)); Analyze_And_Resolve (N, Standard_Boolean); ----------- -- Delta -- ----------- when Attribute_Delta => Fold_Ureal (N, Delta_Value (P_Type), True); ------------ -- Denorm -- ------------ when Attribute_Denorm => Fold_Uint (N, UI_From_Int (Boolean'Pos (Has_Denormals (P_Type))), Static); --------------------- -- Descriptor_Size -- --------------------- when Attribute_Descriptor_Size => null; ------------ -- Digits -- ------------ when Attribute_Digits => Fold_Uint (N, Digits_Value (P_Type), Static); ---------- -- Emax -- ---------- when Attribute_Emax => -- Ada 83 attribute is defined as (RM83 3.5.8) -- T'Emax = 4 * T'Mantissa Fold_Uint (N, 4 * Mantissa, Static); -------------- -- Enum_Rep -- -------------- when Attribute_Enum_Rep => Enum_Rep : declare Val : Node_Id; begin -- The attribute appears in the form: -- Enum_Typ'Enum_Rep (Const) -- Enum_Typ'Enum_Rep (Enum_Lit) if Present (E1) then Val := E1; -- Otherwise the prefix denotes a constant or enumeration literal: -- Const'Enum_Rep -- Enum_Lit'Enum_Rep else Val := P; end if; -- For an enumeration type with a non-standard representation use -- the Enumeration_Rep field of the proper constant. Note that this -- will not work for types Character/Wide_[Wide-]Character, since no -- real entities are created for the enumeration literals, but that -- does not matter since these two types do not have non-standard -- representations anyway. if Is_Enumeration_Type (P_Type) and then Has_Non_Standard_Rep (P_Type) then Fold_Uint (N, Enumeration_Rep (Expr_Value_E (Val)), Static); -- For enumeration types with standard representations and all other -- cases (i.e. all integer and modular types), Enum_Rep is equivalent -- to Pos. else Fold_Uint (N, Expr_Value (Val), Static); end if; end Enum_Rep; -------------- -- Enum_Val -- -------------- when Attribute_Enum_Val => Enum_Val : declare Lit : Node_Id; begin -- We have something like Enum_Type'Enum_Val (23), so search for a -- corresponding value in the list of Enum_Rep values for the type. Lit := First_Literal (P_Base_Type); loop if Enumeration_Rep (Lit) = Expr_Value (E1) then Fold_Uint (N, Enumeration_Pos (Lit), Static); exit; end if; Next_Literal (Lit); if No (Lit) then Apply_Compile_Time_Constraint_Error (N, "no representation value matches", CE_Range_Check_Failed, Warn => not Static); exit; end if; end loop; end Enum_Val; ------------- -- Epsilon -- ------------- when Attribute_Epsilon => -- Ada 83 attribute is defined as (RM83 3.5.8) -- T'Epsilon = 2.0**(1 - T'Mantissa) Fold_Ureal (N, Ureal_2 ** (1 - Mantissa), True); -------------- -- Exponent -- -------------- when Attribute_Exponent => Fold_Uint (N, Eval_Fat.Exponent (P_Base_Type, Expr_Value_R (E1)), Static); ----------------------- -- Finalization_Size -- ----------------------- when Attribute_Finalization_Size => null; ----------- -- First -- ----------- when Attribute_First => Set_Bounds; if Compile_Time_Known_Value (Lo_Bound) then if Is_Real_Type (P_Type) then Fold_Ureal (N, Expr_Value_R (Lo_Bound), Static); else Fold_Uint (N, Expr_Value (Lo_Bound), Static); end if; else Check_Concurrent_Discriminant (Lo_Bound); end if; ----------------- -- First_Valid -- ----------------- when Attribute_First_Valid => if Has_Predicates (P_Type) and then Has_Static_Predicate (P_Type) then declare FirstN : constant Node_Id := First (Static_Discrete_Predicate (P_Type)); begin if Nkind (FirstN) = N_Range then Fold_Uint (N, Expr_Value (Low_Bound (FirstN)), Static); else Fold_Uint (N, Expr_Value (FirstN), Static); end if; end; else Set_Bounds; Fold_Uint (N, Expr_Value (Lo_Bound), Static); end if; ----------------- -- Fixed_Value -- ----------------- when Attribute_Fixed_Value => null; ----------- -- Floor -- ----------- when Attribute_Floor => Fold_Ureal (N, Eval_Fat.Floor (P_Base_Type, Expr_Value_R (E1)), Static); ---------- -- Fore -- ---------- when Attribute_Fore => if Compile_Time_Known_Bounds (P_Type) then Fold_Uint (N, UI_From_Int (Fore_Value), Static); end if; -------------- -- Fraction -- -------------- when Attribute_Fraction => Fold_Ureal (N, Eval_Fat.Fraction (P_Base_Type, Expr_Value_R (E1)), Static); ----------------------- -- Has_Access_Values -- ----------------------- when Attribute_Has_Access_Values => Rewrite (N, New_Occurrence_Of (Boolean_Literals (Has_Access_Values (P_Root_Type)), Loc)); Analyze_And_Resolve (N, Standard_Boolean); ----------------------- -- Has_Discriminants -- ----------------------- when Attribute_Has_Discriminants => Rewrite (N, New_Occurrence_Of ( Boolean_Literals (Has_Discriminants (P_Entity)), Loc)); Analyze_And_Resolve (N, Standard_Boolean); ---------------------- -- Has_Same_Storage -- ---------------------- when Attribute_Has_Same_Storage => null; ----------------------- -- Has_Tagged_Values -- ----------------------- when Attribute_Has_Tagged_Values => Rewrite (N, New_Occurrence_Of (Boolean_Literals (Has_Tagged_Component (P_Root_Type)), Loc)); Analyze_And_Resolve (N, Standard_Boolean); -------------- -- Identity -- -------------- when Attribute_Identity => null; ----------- -- Image -- ----------- -- Image is a scalar attribute, but is never static, because it is -- not a static function (having a non-scalar argument (RM 4.9(22)) -- However, we can constant-fold the image of an enumeration literal -- if names are available. when Attribute_Image => if Is_Entity_Name (E1) and then Ekind (Entity (E1)) = E_Enumeration_Literal and then not Discard_Names (First_Subtype (Etype (E1))) and then not Global_Discard_Names then declare Lit : constant Entity_Id := Entity (E1); Str : String_Id; begin Start_String; Get_Unqualified_Decoded_Name_String (Chars (Lit)); Set_Casing (All_Upper_Case); Store_String_Chars (Name_Buffer (1 .. Name_Len)); Str := End_String; Rewrite (N, Make_String_Literal (Loc, Strval => Str)); Analyze_And_Resolve (N, Standard_String); Set_Is_Static_Expression (N, False); end; end if; ------------------- -- Integer_Value -- ------------------- -- We never try to fold Integer_Value (though perhaps we could???) when Attribute_Integer_Value => null; ------------------- -- Invalid_Value -- ------------------- -- Invalid_Value is a scalar attribute that is never static, because -- the value is by design out of range. when Attribute_Invalid_Value => null; ----------- -- Large -- ----------- when Attribute_Large => -- For fixed-point, we use the identity: -- T'Large = (2.0**T'Mantissa - 1.0) * T'Small if Is_Fixed_Point_Type (P_Type) then Rewrite (N, Make_Op_Multiply (Loc, Left_Opnd => Make_Op_Subtract (Loc, Left_Opnd => Make_Op_Expon (Loc, Left_Opnd => Make_Real_Literal (Loc, Ureal_2), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => P, Attribute_Name => Name_Mantissa)), Right_Opnd => Make_Real_Literal (Loc, Ureal_1)), Right_Opnd => Make_Real_Literal (Loc, Small_Value (Entity (P))))); Analyze_And_Resolve (N, C_Type); -- Floating-point (Ada 83 compatibility) else -- Ada 83 attribute is defined as (RM83 3.5.8) -- T'Large = 2.0**T'Emax * (1.0 - 2.0**(-T'Mantissa)) -- where -- T'Emax = 4 * T'Mantissa Fold_Ureal (N, Ureal_2 ** (4 * Mantissa) * (Ureal_1 - Ureal_2 ** (-Mantissa)), True); end if; --------------- -- Lock_Free -- --------------- when Attribute_Lock_Free => Lock_Free : declare V : constant Entity_Id := Boolean_Literals (Uses_Lock_Free (P_Type)); begin Rewrite (N, New_Occurrence_Of (V, Loc)); -- Analyze and resolve as boolean. Note that this attribute is a -- static attribute in GNAT. Analyze_And_Resolve (N, Standard_Boolean); Static := True; Set_Is_Static_Expression (N, True); end Lock_Free; ---------- -- Last -- ---------- when Attribute_Last => Set_Bounds; if Compile_Time_Known_Value (Hi_Bound) then if Is_Real_Type (P_Type) then Fold_Ureal (N, Expr_Value_R (Hi_Bound), Static); else Fold_Uint (N, Expr_Value (Hi_Bound), Static); end if; else Check_Concurrent_Discriminant (Hi_Bound); end if; ---------------- -- Last_Valid -- ---------------- when Attribute_Last_Valid => if Has_Predicates (P_Type) and then Has_Static_Predicate (P_Type) then declare LastN : constant Node_Id := Last (Static_Discrete_Predicate (P_Type)); begin if Nkind (LastN) = N_Range then Fold_Uint (N, Expr_Value (High_Bound (LastN)), Static); else Fold_Uint (N, Expr_Value (LastN), Static); end if; end; else Set_Bounds; Fold_Uint (N, Expr_Value (Hi_Bound), Static); end if; ------------------ -- Leading_Part -- ------------------ when Attribute_Leading_Part => Fold_Ureal (N, Eval_Fat.Leading_Part (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static); ------------ -- Length -- ------------ when Attribute_Length => Length : declare Ind : Node_Id; begin -- If any index type is a formal type, or derived from one, the -- bounds are not static. Treating them as static can produce -- spurious warnings or improper constant folding. Ind := First_Index (P_Type); while Present (Ind) loop if Is_Generic_Type (Root_Type (Etype (Ind))) then return; end if; Next_Index (Ind); end loop; Set_Bounds; -- For two compile time values, we can compute length if Compile_Time_Known_Value (Lo_Bound) and then Compile_Time_Known_Value (Hi_Bound) then Fold_Uint (N, UI_Max (0, 1 + (Expr_Value (Hi_Bound) - Expr_Value (Lo_Bound))), Static); end if; -- One more case is where Hi_Bound and Lo_Bound are compile-time -- comparable, and we can figure out the difference between them. declare Diff : aliased Uint; begin case Compile_Time_Compare (Lo_Bound, Hi_Bound, Diff'Access, Assume_Valid => False) is when EQ => Fold_Uint (N, Uint_1, Static); when GT => Fold_Uint (N, Uint_0, Static); when LT => if Diff /= No_Uint then Fold_Uint (N, Diff + 1, Static); end if; when others => null; end case; end; end Length; ---------------- -- Loop_Entry -- ---------------- -- Loop_Entry acts as an alias of a constant initialized to the prefix -- of the said attribute at the point of entry into the related loop. As -- such, the attribute reference does not need to be evaluated because -- the prefix is the one that is evaluted. when Attribute_Loop_Entry => null; ------------- -- Machine -- ------------- when Attribute_Machine => Fold_Ureal (N, Eval_Fat.Machine (P_Base_Type, Expr_Value_R (E1), Eval_Fat.Round, N), Static); ------------------ -- Machine_Emax -- ------------------ when Attribute_Machine_Emax => Fold_Uint (N, Machine_Emax_Value (P_Type), Static); ------------------ -- Machine_Emin -- ------------------ when Attribute_Machine_Emin => Fold_Uint (N, Machine_Emin_Value (P_Type), Static); ---------------------- -- Machine_Mantissa -- ---------------------- when Attribute_Machine_Mantissa => Fold_Uint (N, Machine_Mantissa_Value (P_Type), Static); ----------------------- -- Machine_Overflows -- ----------------------- when Attribute_Machine_Overflows => -- Always true for fixed-point if Is_Fixed_Point_Type (P_Type) then Fold_Uint (N, True_Value, Static); -- Floating point case else Fold_Uint (N, UI_From_Int (Boolean'Pos (Machine_Overflows_On_Target)), Static); end if; ------------------- -- Machine_Radix -- ------------------- when Attribute_Machine_Radix => if Is_Fixed_Point_Type (P_Type) then if Is_Decimal_Fixed_Point_Type (P_Type) and then Machine_Radix_10 (P_Type) then Fold_Uint (N, Uint_10, Static); else Fold_Uint (N, Uint_2, Static); end if; -- All floating-point type always have radix 2 else Fold_Uint (N, Uint_2, Static); end if; ---------------------- -- Machine_Rounding -- ---------------------- -- Note: for the folding case, it is fine to treat Machine_Rounding -- exactly the same way as Rounding, since this is one of the allowed -- behaviors, and performance is not an issue here. It might be a bit -- better to give the same result as it would give at run time, even -- though the non-determinism is certainly permitted. when Attribute_Machine_Rounding => Fold_Ureal (N, Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static); -------------------- -- Machine_Rounds -- -------------------- when Attribute_Machine_Rounds => -- Always False for fixed-point if Is_Fixed_Point_Type (P_Type) then Fold_Uint (N, False_Value, Static); -- Else yield proper floating-point result else Fold_Uint (N, UI_From_Int (Boolean'Pos (Machine_Rounds_On_Target)), Static); end if; ------------------ -- Machine_Size -- ------------------ -- Note: Machine_Size is identical to Object_Size when Attribute_Machine_Size => Machine_Size : declare P_TypeA : constant Entity_Id := Underlying_Type (P_Type); begin if Known_Esize (P_TypeA) then Fold_Uint (N, Esize (P_TypeA), Static); end if; end Machine_Size; -------------- -- Mantissa -- -------------- when Attribute_Mantissa => -- Fixed-point mantissa if Is_Fixed_Point_Type (P_Type) then -- Compile time foldable case if Compile_Time_Known_Value (Type_Low_Bound (P_Type)) and then Compile_Time_Known_Value (Type_High_Bound (P_Type)) then -- The calculation of the obsolete Ada 83 attribute Mantissa -- is annoying, because of AI00143, quoted here: -- !question 84-01-10 -- Consider the model numbers for F: -- type F is delta 1.0 range -7.0 .. 8.0; -- The wording requires that F'MANTISSA be the SMALLEST -- integer number for which each bound of the specified -- range is either a model number or lies at most small -- distant from a model number. This means F'MANTISSA -- is required to be 3 since the range -7.0 .. 7.0 fits -- in 3 signed bits, and 8 is "at most" 1.0 from a model -- number, namely, 7. Is this analysis correct? Note that -- this implies the upper bound of the range is not -- represented as a model number. -- !response 84-03-17 -- The analysis is correct. The upper and lower bounds for -- a fixed point type can lie outside the range of model -- numbers. declare Siz : Uint; LBound : Ureal; UBound : Ureal; Bound : Ureal; Max_Man : Uint; begin LBound := Expr_Value_R (Type_Low_Bound (P_Type)); UBound := Expr_Value_R (Type_High_Bound (P_Type)); Bound := UR_Max (UR_Abs (LBound), UR_Abs (UBound)); Max_Man := UR_Trunc (Bound / Small_Value (P_Type)); -- If the Bound is exactly a model number, i.e. a multiple -- of Small, then we back it off by one to get the integer -- value that must be representable. if Small_Value (P_Type) * Max_Man = Bound then Max_Man := Max_Man - 1; end if; -- Now find corresponding size = Mantissa value Siz := Uint_0; while 2 ** Siz < Max_Man loop Siz := Siz + 1; end loop; Fold_Uint (N, Siz, Static); end; else -- The case of dynamic bounds cannot be evaluated at compile -- time. Instead we use a runtime routine (see Exp_Attr). null; end if; -- Floating-point Mantissa else Fold_Uint (N, Mantissa, Static); end if; --------- -- Max -- --------- when Attribute_Max => if Is_Real_Type (P_Type) then Fold_Ureal (N, UR_Max (Expr_Value_R (E1), Expr_Value_R (E2)), Static); else Fold_Uint (N, UI_Max (Expr_Value (E1), Expr_Value (E2)), Static); end if; ---------------------------------- -- Max_Alignment_For_Allocation -- ---------------------------------- -- Max_Alignment_For_Allocation is usually the Alignment. However, -- arrays are allocated with dope, so we need to take into account both -- the alignment of the array, which comes from the component alignment, -- and the alignment of the dope. Also, if the alignment is unknown, we -- use the max (it's OK to be pessimistic). when Attribute_Max_Alignment_For_Allocation => Max_Align : declare A : Uint := UI_From_Int (Ttypes.Maximum_Alignment); begin if Known_Alignment (P_Type) and then (not Is_Array_Type (P_Type) or else Alignment (P_Type) > A) then A := Alignment (P_Type); end if; Fold_Uint (N, A, Static); end Max_Align; ---------------------------------- -- Max_Size_In_Storage_Elements -- ---------------------------------- -- Max_Size_In_Storage_Elements is simply the Size rounded up to a -- Storage_Unit boundary. We can fold any cases for which the size -- is known by the front end. when Attribute_Max_Size_In_Storage_Elements => if Known_Esize (P_Type) then Fold_Uint (N, (Esize (P_Type) + System_Storage_Unit - 1) / System_Storage_Unit, Static); end if; -------------------- -- Mechanism_Code -- -------------------- when Attribute_Mechanism_Code => Mechanism_Code : declare Formal : Entity_Id; Mech : Mechanism_Type; Val : Int; begin if No (E1) then Mech := Mechanism (P_Entity); else Val := UI_To_Int (Expr_Value (E1)); Formal := First_Formal (P_Entity); for J in 1 .. Val - 1 loop Next_Formal (Formal); end loop; Mech := Mechanism (Formal); end if; if Mech < 0 then Fold_Uint (N, UI_From_Int (Int (-Mech)), Static); end if; end Mechanism_Code; --------- -- Min -- --------- when Attribute_Min => if Is_Real_Type (P_Type) then Fold_Ureal (N, UR_Min (Expr_Value_R (E1), Expr_Value_R (E2)), Static); else Fold_Uint (N, UI_Min (Expr_Value (E1), Expr_Value (E2)), Static); end if; --------- -- Mod -- --------- when Attribute_Mod => Fold_Uint (N, UI_Mod (Expr_Value (E1), Modulus (P_Base_Type)), Static); ----------- -- Model -- ----------- when Attribute_Model => Fold_Ureal (N, Eval_Fat.Model (P_Base_Type, Expr_Value_R (E1)), Static); ---------------- -- Model_Emin -- ---------------- when Attribute_Model_Emin => Fold_Uint (N, Model_Emin_Value (P_Base_Type), Static); ------------------- -- Model_Epsilon -- ------------------- when Attribute_Model_Epsilon => Fold_Ureal (N, Model_Epsilon_Value (P_Base_Type), Static); -------------------- -- Model_Mantissa -- -------------------- when Attribute_Model_Mantissa => Fold_Uint (N, Model_Mantissa_Value (P_Base_Type), Static); ----------------- -- Model_Small -- ----------------- when Attribute_Model_Small => Fold_Ureal (N, Model_Small_Value (P_Base_Type), Static); ------------- -- Modulus -- ------------- when Attribute_Modulus => Fold_Uint (N, Modulus (P_Type), Static); -------------------- -- Null_Parameter -- -------------------- -- Cannot fold, we know the value sort of, but the whole point is -- that there is no way to talk about this imaginary value except -- by using the attribute, so we leave it the way it is. when Attribute_Null_Parameter => null; ----------------- -- Object_Size -- ----------------- -- The Object_Size attribute for a type returns the Esize of the -- type and can be folded if this value is known. when Attribute_Object_Size => Object_Size : declare P_TypeA : constant Entity_Id := Underlying_Type (P_Type); begin if Known_Esize (P_TypeA) then Fold_Uint (N, Esize (P_TypeA), Static); end if; end Object_Size; ---------------------- -- Overlaps_Storage -- ---------------------- when Attribute_Overlaps_Storage => null; ------------------------- -- Passed_By_Reference -- ------------------------- -- Scalar types are never passed by reference when Attribute_Passed_By_Reference => Fold_Uint (N, False_Value, Static); --------- -- Pos -- --------- when Attribute_Pos => Fold_Uint (N, Expr_Value (E1), Static); ---------- -- Pred -- ---------- when Attribute_Pred => -- Floating-point case if Is_Floating_Point_Type (P_Type) then Fold_Ureal (N, Eval_Fat.Pred (P_Base_Type, Expr_Value_R (E1)), Static); -- Fixed-point case elsif Is_Fixed_Point_Type (P_Type) then Fold_Ureal (N, Expr_Value_R (E1) - Small_Value (P_Type), True); -- Modular integer case (wraps) elsif Is_Modular_Integer_Type (P_Type) then Fold_Uint (N, (Expr_Value (E1) - 1) mod Modulus (P_Type), Static); -- Other scalar cases else pragma Assert (Is_Scalar_Type (P_Type)); if Is_Enumeration_Type (P_Type) and then Expr_Value (E1) = Expr_Value (Type_Low_Bound (P_Base_Type)) then Apply_Compile_Time_Constraint_Error (N, "Pred of `&''First`", CE_Overflow_Check_Failed, Ent => P_Base_Type, Warn => not Static); Check_Expressions; return; end if; Fold_Uint (N, Expr_Value (E1) - 1, Static); end if; ----------- -- Range -- ----------- -- No processing required, because by this stage, Range has been -- replaced by First .. Last, so this branch can never be taken. when Attribute_Range => raise Program_Error; ------------------ -- Range_Length -- ------------------ when Attribute_Range_Length => Range_Length : declare Diff : aliased Uint; begin Set_Bounds; -- Can fold if both bounds are compile time known if Compile_Time_Known_Value (Hi_Bound) and then Compile_Time_Known_Value (Lo_Bound) then Fold_Uint (N, UI_Max (0, Expr_Value (Hi_Bound) - Expr_Value (Lo_Bound) + 1), Static); end if; -- One more case is where Hi_Bound and Lo_Bound are compile-time -- comparable, and we can figure out the difference between them. case Compile_Time_Compare (Lo_Bound, Hi_Bound, Diff'Access, Assume_Valid => False) is when EQ => Fold_Uint (N, Uint_1, Static); when GT => Fold_Uint (N, Uint_0, Static); when LT => if Diff /= No_Uint then Fold_Uint (N, Diff + 1, Static); end if; when others => null; end case; end Range_Length; --------- -- Ref -- --------- when Attribute_Ref => Fold_Uint (N, Expr_Value (E1), Static); --------------- -- Remainder -- --------------- when Attribute_Remainder => Remainder : declare X : constant Ureal := Expr_Value_R (E1); Y : constant Ureal := Expr_Value_R (E2); begin if UR_Is_Zero (Y) then Apply_Compile_Time_Constraint_Error (N, "division by zero in Remainder", CE_Overflow_Check_Failed, Warn => not Static); Check_Expressions; return; end if; Fold_Ureal (N, Eval_Fat.Remainder (P_Base_Type, X, Y), Static); end Remainder; ----------------- -- Restriction -- ----------------- when Attribute_Restriction_Set => Rewrite (N, New_Occurrence_Of (Standard_False, Loc)); Set_Is_Static_Expression (N); ----------- -- Round -- ----------- when Attribute_Round => Round : declare Sr : Ureal; Si : Uint; begin -- First we get the (exact result) in units of small Sr := Expr_Value_R (E1) / Small_Value (C_Type); -- Now round that exactly to an integer Si := UR_To_Uint (Sr); -- Finally the result is obtained by converting back to real Fold_Ureal (N, Si * Small_Value (C_Type), Static); end Round; -------------- -- Rounding -- -------------- when Attribute_Rounding => Fold_Ureal (N, Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static); --------------- -- Safe_Emax -- --------------- when Attribute_Safe_Emax => Fold_Uint (N, Safe_Emax_Value (P_Type), Static); ---------------- -- Safe_First -- ---------------- when Attribute_Safe_First => Fold_Ureal (N, Safe_First_Value (P_Type), Static); ---------------- -- Safe_Large -- ---------------- when Attribute_Safe_Large => if Is_Fixed_Point_Type (P_Type) then Fold_Ureal (N, Expr_Value_R (Type_High_Bound (P_Base_Type)), Static); else Fold_Ureal (N, Safe_Last_Value (P_Type), Static); end if; --------------- -- Safe_Last -- --------------- when Attribute_Safe_Last => Fold_Ureal (N, Safe_Last_Value (P_Type), Static); ---------------- -- Safe_Small -- ---------------- when Attribute_Safe_Small => -- In Ada 95, the old Ada 83 attribute Safe_Small is redundant -- for fixed-point, since is the same as Small, but we implement -- it for backwards compatibility. if Is_Fixed_Point_Type (P_Type) then Fold_Ureal (N, Small_Value (P_Type), Static); -- Ada 83 Safe_Small for floating-point cases else Fold_Ureal (N, Model_Small_Value (P_Type), Static); end if; ----------- -- Scale -- ----------- when Attribute_Scale => Fold_Uint (N, Scale_Value (P_Type), Static); ------------- -- Scaling -- ------------- when Attribute_Scaling => Fold_Ureal (N, Eval_Fat.Scaling (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static); ------------------ -- Signed_Zeros -- ------------------ when Attribute_Signed_Zeros => Fold_Uint (N, UI_From_Int (Boolean'Pos (Has_Signed_Zeros (P_Type))), Static); ---------- -- Size -- ---------- -- Size attribute returns the RM size. All scalar types can be folded, -- as well as any types for which the size is known by the front end, -- including any type for which a size attribute is specified. This is -- one of the places where it is annoying that a size of zero means two -- things (zero size for scalars, unspecified size for non-scalars). when Attribute_Size | Attribute_VADS_Size => Size : declare P_TypeA : constant Entity_Id := Underlying_Type (P_Type); begin if Is_Scalar_Type (P_TypeA) or else RM_Size (P_TypeA) /= Uint_0 then -- VADS_Size case if Id = Attribute_VADS_Size or else Use_VADS_Size then declare S : constant Node_Id := Size_Clause (P_TypeA); begin -- If a size clause applies, then use the size from it. -- This is one of the rare cases where we can use the -- Size_Clause field for a subtype when Has_Size_Clause -- is False. Consider: -- type x is range 1 .. 64; -- for x'size use 12; -- subtype y is x range 0 .. 3; -- Here y has a size clause inherited from x, but -- normally it does not apply, and y'size is 2. However, -- y'VADS_Size is indeed 12 and not 2. if Present (S) and then Is_OK_Static_Expression (Expression (S)) then Fold_Uint (N, Expr_Value (Expression (S)), Static); -- If no size is specified, then we simply use the object -- size in the VADS_Size case (e.g. Natural'Size is equal -- to Integer'Size, not one less). else Fold_Uint (N, Esize (P_TypeA), Static); end if; end; -- Normal case (Size) in which case we want the RM_Size else Fold_Uint (N, RM_Size (P_TypeA), Static); end if; end if; end Size; ----------- -- Small -- ----------- when Attribute_Small => -- The floating-point case is present only for Ada 83 compatibility. -- Note that strictly this is an illegal addition, since we are -- extending an Ada 95 defined attribute, but we anticipate an -- ARG ruling that will permit this. if Is_Floating_Point_Type (P_Type) then -- Ada 83 attribute is defined as (RM83 3.5.8) -- T'Small = 2.0**(-T'Emax - 1) -- where -- T'Emax = 4 * T'Mantissa Fold_Ureal (N, Ureal_2 ** ((-(4 * Mantissa)) - 1), Static); -- Normal Ada 95 fixed-point case else Fold_Ureal (N, Small_Value (P_Type), True); end if; ----------------- -- Stream_Size -- ----------------- when Attribute_Stream_Size => null; ---------- -- Succ -- ---------- when Attribute_Succ => -- Floating-point case if Is_Floating_Point_Type (P_Type) then Fold_Ureal (N, Eval_Fat.Succ (P_Base_Type, Expr_Value_R (E1)), Static); -- Fixed-point case elsif Is_Fixed_Point_Type (P_Type) then Fold_Ureal (N, Expr_Value_R (E1) + Small_Value (P_Type), Static); -- Modular integer case (wraps) elsif Is_Modular_Integer_Type (P_Type) then Fold_Uint (N, (Expr_Value (E1) + 1) mod Modulus (P_Type), Static); -- Other scalar cases else pragma Assert (Is_Scalar_Type (P_Type)); if Is_Enumeration_Type (P_Type) and then Expr_Value (E1) = Expr_Value (Type_High_Bound (P_Base_Type)) then Apply_Compile_Time_Constraint_Error (N, "Succ of `&''Last`", CE_Overflow_Check_Failed, Ent => P_Base_Type, Warn => not Static); Check_Expressions; return; else Fold_Uint (N, Expr_Value (E1) + 1, Static); end if; end if; ---------------- -- Truncation -- ---------------- when Attribute_Truncation => Fold_Ureal (N, Eval_Fat.Truncation (P_Base_Type, Expr_Value_R (E1)), Static); ---------------- -- Type_Class -- ---------------- when Attribute_Type_Class => Type_Class : declare Typ : constant Entity_Id := Underlying_Type (P_Base_Type); Id : RE_Id; begin if Is_Descendant_Of_Address (Typ) then Id := RE_Type_Class_Address; elsif Is_Enumeration_Type (Typ) then Id := RE_Type_Class_Enumeration; elsif Is_Integer_Type (Typ) then Id := RE_Type_Class_Integer; elsif Is_Fixed_Point_Type (Typ) then Id := RE_Type_Class_Fixed_Point; elsif Is_Floating_Point_Type (Typ) then Id := RE_Type_Class_Floating_Point; elsif Is_Array_Type (Typ) then Id := RE_Type_Class_Array; elsif Is_Record_Type (Typ) then Id := RE_Type_Class_Record; elsif Is_Access_Type (Typ) then Id := RE_Type_Class_Access; elsif Is_Enumeration_Type (Typ) then Id := RE_Type_Class_Enumeration; elsif Is_Task_Type (Typ) then Id := RE_Type_Class_Task; -- We treat protected types like task types. It would make more -- sense to have another enumeration value, but after all the -- whole point of this feature is to be exactly DEC compatible, -- and changing the type Type_Class would not meet this requirement. elsif Is_Protected_Type (Typ) then Id := RE_Type_Class_Task; -- Not clear if there are any other possibilities, but if there -- are, then we will treat them as the address case. else Id := RE_Type_Class_Address; end if; Rewrite (N, New_Occurrence_Of (RTE (Id), Loc)); end Type_Class; ----------------------- -- Unbiased_Rounding -- ----------------------- when Attribute_Unbiased_Rounding => Fold_Ureal (N, Eval_Fat.Unbiased_Rounding (P_Base_Type, Expr_Value_R (E1)), Static); ------------------------- -- Unconstrained_Array -- ------------------------- when Attribute_Unconstrained_Array => Unconstrained_Array : declare Typ : constant Entity_Id := Underlying_Type (P_Type); begin Rewrite (N, New_Occurrence_Of ( Boolean_Literals ( Is_Array_Type (P_Type) and then not Is_Constrained (Typ)), Loc)); -- Analyze and resolve as boolean, note that this attribute is -- a static attribute in GNAT. Analyze_And_Resolve (N, Standard_Boolean); Static := True; Set_Is_Static_Expression (N, True); end Unconstrained_Array; -- Attribute Update is never static when Attribute_Update => return; --------------- -- VADS_Size -- --------------- -- Processing is shared with Size --------- -- Val -- --------- when Attribute_Val => if Expr_Value (E1) < Expr_Value (Type_Low_Bound (P_Base_Type)) or else Expr_Value (E1) > Expr_Value (Type_High_Bound (P_Base_Type)) then Apply_Compile_Time_Constraint_Error (N, "Val expression out of range", CE_Range_Check_Failed, Warn => not Static); Check_Expressions; return; else Fold_Uint (N, Expr_Value (E1), Static); end if; ---------------- -- Value_Size -- ---------------- -- The Value_Size attribute for a type returns the RM size of the type. -- This an always be folded for scalar types, and can also be folded for -- non-scalar types if the size is set. This is one of the places where -- it is annoying that a size of zero means two things! when Attribute_Value_Size => Value_Size : declare P_TypeA : constant Entity_Id := Underlying_Type (P_Type); begin if Is_Scalar_Type (P_TypeA) or else RM_Size (P_TypeA) /= Uint_0 then Fold_Uint (N, RM_Size (P_TypeA), Static); end if; end Value_Size; ------------- -- Version -- ------------- -- Version can never be static when Attribute_Version => null; ---------------- -- Wide_Image -- ---------------- -- Wide_Image is a scalar attribute, but is never static, because it -- is not a static function (having a non-scalar argument (RM 4.9(22)) when Attribute_Wide_Image => null; --------------------- -- Wide_Wide_Image -- --------------------- -- Wide_Wide_Image is a scalar attribute but is never static, because it -- is not a static function (having a non-scalar argument (RM 4.9(22)). when Attribute_Wide_Wide_Image => null; --------------------- -- Wide_Wide_Width -- --------------------- -- Processing for Wide_Wide_Width is combined with Width ---------------- -- Wide_Width -- ---------------- -- Processing for Wide_Width is combined with Width ----------- -- Width -- ----------- -- This processing also handles the case of Wide_[Wide_]Width when Attribute_Width | Attribute_Wide_Width | Attribute_Wide_Wide_Width => if Compile_Time_Known_Bounds (P_Type) then -- Floating-point types if Is_Floating_Point_Type (P_Type) then -- Width is zero for a null range (RM 3.5 (38)) if Expr_Value_R (Type_High_Bound (P_Type)) < Expr_Value_R (Type_Low_Bound (P_Type)) then Fold_Uint (N, Uint_0, Static); else -- For floating-point, we have +N.dddE+nnn where length -- of ddd is determined by type'Digits - 1, but is one -- if Digits is one (RM 3.5 (33)). -- nnn is set to 2 for Short_Float and Float (32 bit -- floats), and 3 for Long_Float and Long_Long_Float. -- For machines where Long_Long_Float is the IEEE -- extended precision type, the exponent takes 4 digits. declare Len : Int := Int'Max (2, UI_To_Int (Digits_Value (P_Type))); begin if Esize (P_Type) <= 32 then Len := Len + 6; elsif Esize (P_Type) = 64 then Len := Len + 7; else Len := Len + 8; end if; Fold_Uint (N, UI_From_Int (Len), Static); end; end if; -- Fixed-point types elsif Is_Fixed_Point_Type (P_Type) then -- Width is zero for a null range (RM 3.5 (38)) if Expr_Value (Type_High_Bound (P_Type)) < Expr_Value (Type_Low_Bound (P_Type)) then Fold_Uint (N, Uint_0, Static); -- The non-null case depends on the specific real type else -- For fixed-point type width is Fore + 1 + Aft (RM 3.5(34)) Fold_Uint (N, UI_From_Int (Fore_Value + 1) + Aft_Value (P_Type), Static); end if; -- Discrete types else declare R : constant Entity_Id := Root_Type (P_Type); Lo : constant Uint := Expr_Value (Type_Low_Bound (P_Type)); Hi : constant Uint := Expr_Value (Type_High_Bound (P_Type)); W : Nat; Wt : Nat; T : Uint; L : Node_Id; C : Character; begin -- Empty ranges if Lo > Hi then W := 0; -- Width for types derived from Standard.Character -- and Standard.Wide_[Wide_]Character. elsif Is_Standard_Character_Type (P_Type) then W := 0; -- Set W larger if needed for J in UI_To_Int (Lo) .. UI_To_Int (Hi) loop -- All wide characters look like Hex_hhhhhhhh if J > 255 then -- No need to compute this more than once exit; else C := Character'Val (J); -- Test for all cases where Character'Image -- yields an image that is longer than three -- characters. First the cases of Reserved_xxx -- names (length = 12). case C is when Reserved_128 | Reserved_129 | Reserved_132 | Reserved_153 => Wt := 12; when BS | CR | EM | FF | FS | GS | HT | LF | MW | PM | RI | RS | SI | SO | ST | US | VT => Wt := 2; when ACK | APC | BEL | BPH | CAN | CCH | CSI | DC1 | DC2 | DC3 | DC4 | DCS | DEL | DLE | ENQ | EOT | EPA | ESA | ESC | ETB | ETX | HTJ | HTS | NAK | NBH | NEL | NUL | OSC | PLD | PLU | PU1 | PU2 | SCI | SOH | SOS | SPA | SS2 | SS3 | SSA | STS | STX | SUB | SYN | VTS => Wt := 3; when Space .. Tilde | No_Break_Space .. LC_Y_Diaeresis => -- Special case of soft hyphen in Ada 2005 if C = Character'Val (16#AD#) and then Ada_Version >= Ada_2005 then Wt := 11; else Wt := 3; end if; end case; W := Int'Max (W, Wt); end if; end loop; -- Width for types derived from Standard.Boolean elsif R = Standard_Boolean then if Lo = 0 then W := 5; -- FALSE else W := 4; -- TRUE end if; -- Width for integer types elsif Is_Integer_Type (P_Type) then T := UI_Max (abs Lo, abs Hi); W := 2; while T >= 10 loop W := W + 1; T := T / 10; end loop; -- User declared enum type with discard names elsif Discard_Names (R) then -- If range is null, result is zero, that has already -- been dealt with, so what we need is the power of ten -- that accomodates the Pos of the largest value, which -- is the high bound of the range + one for the space. W := 1; T := Hi; while T /= 0 loop T := T / 10; W := W + 1; end loop; -- Only remaining possibility is user declared enum type -- with normal case of Discard_Names not active. else pragma Assert (Is_Enumeration_Type (P_Type)); W := 0; L := First_Literal (P_Type); while Present (L) loop -- Only pay attention to in range characters if Lo <= Enumeration_Pos (L) and then Enumeration_Pos (L) <= Hi then -- For Width case, use decoded name if Id = Attribute_Width then Get_Decoded_Name_String (Chars (L)); Wt := Nat (Name_Len); -- For Wide_[Wide_]Width, use encoded name, and -- then adjust for the encoding. else Get_Name_String (Chars (L)); -- Character literals are always of length 3 if Name_Buffer (1) = 'Q' then Wt := 3; -- Otherwise loop to adjust for upper/wide chars else Wt := Nat (Name_Len); for J in 1 .. Name_Len loop if Name_Buffer (J) = 'U' then Wt := Wt - 2; elsif Name_Buffer (J) = 'W' then Wt := Wt - 4; end if; end loop; end if; end if; W := Int'Max (W, Wt); end if; Next_Literal (L); end loop; end if; Fold_Uint (N, UI_From_Int (W), Static); end; end if; end if; -- The following attributes denote functions that cannot be folded when Attribute_From_Any | Attribute_To_Any | Attribute_TypeCode => null; -- The following attributes can never be folded, and furthermore we -- should not even have entered the case statement for any of these. -- Note that in some cases, the values have already been folded as -- a result of the processing in Analyze_Attribute or earlier in -- this procedure. when Attribute_Abort_Signal | Attribute_Access | Attribute_Address | Attribute_Address_Size | Attribute_Asm_Input | Attribute_Asm_Output | Attribute_Base | Attribute_Bit_Order | Attribute_Bit_Position | Attribute_Callable | Attribute_Caller | Attribute_Class | Attribute_Code_Address | Attribute_Compiler_Version | Attribute_Count | Attribute_Default_Bit_Order | Attribute_Default_Scalar_Storage_Order | Attribute_Deref | Attribute_Elaborated | Attribute_Elab_Body | Attribute_Elab_Spec | Attribute_Elab_Subp_Body | Attribute_Enabled | Attribute_External_Tag | Attribute_Fast_Math | Attribute_First_Bit | Attribute_Img | Attribute_Input | Attribute_Last_Bit | Attribute_Library_Level | Attribute_Maximum_Alignment | Attribute_Old | Attribute_Output | Attribute_Partition_ID | Attribute_Pool_Address | Attribute_Position | Attribute_Priority | Attribute_Read | Attribute_Result | Attribute_Scalar_Storage_Order | Attribute_Simple_Storage_Pool | Attribute_Storage_Pool | Attribute_Storage_Size | Attribute_Storage_Unit | Attribute_Stub_Type | Attribute_System_Allocator_Alignment | Attribute_Tag | Attribute_Target_Name | Attribute_Terminated | Attribute_To_Address | Attribute_Type_Key | Attribute_Unchecked_Access | Attribute_Universal_Literal_String | Attribute_Unrestricted_Access | Attribute_Valid | Attribute_Valid_Scalars | Attribute_Value | Attribute_Wchar_T_Size | Attribute_Wide_Value | Attribute_Wide_Wide_Value | Attribute_Word_Size | Attribute_Write => raise Program_Error; end case; -- At the end of the case, one more check. If we did a static evaluation -- so that the result is now a literal, then set Is_Static_Expression -- in the constant only if the prefix type is a static subtype. For -- non-static subtypes, the folding is still OK, but not static. -- An exception is the GNAT attribute Constrained_Array which is -- defined to be a static attribute in all cases. if Nkind_In (N, N_Integer_Literal, N_Real_Literal, N_Character_Literal, N_String_Literal) or else (Is_Entity_Name (N) and then Ekind (Entity (N)) = E_Enumeration_Literal) then Set_Is_Static_Expression (N, Static); -- If this is still an attribute reference, then it has not been folded -- and that means that its expressions are in a non-static context. elsif Nkind (N) = N_Attribute_Reference then Check_Expressions; -- Note: the else case not covered here are odd cases where the -- processing has transformed the attribute into something other -- than a constant. Nothing more to do in such cases. else null; end if; end Eval_Attribute; ------------------------------ -- Is_Anonymous_Tagged_Base -- ------------------------------ function Is_Anonymous_Tagged_Base (Anon : Entity_Id; Typ : Entity_Id) return Boolean is begin return Anon = Current_Scope and then Is_Itype (Anon) and then Associated_Node_For_Itype (Anon) = Parent (Typ); end Is_Anonymous_Tagged_Base; -------------------------------- -- Name_Implies_Lvalue_Prefix -- -------------------------------- function Name_Implies_Lvalue_Prefix (Nam : Name_Id) return Boolean is pragma Assert (Is_Attribute_Name (Nam)); begin return Attribute_Name_Implies_Lvalue_Prefix (Get_Attribute_Id (Nam)); end Name_Implies_Lvalue_Prefix; ----------------------- -- Resolve_Attribute -- ----------------------- procedure Resolve_Attribute (N : Node_Id; Typ : Entity_Id) is Loc : constant Source_Ptr := Sloc (N); P : constant Node_Id := Prefix (N); Aname : constant Name_Id := Attribute_Name (N); Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname); Btyp : constant Entity_Id := Base_Type (Typ); Des_Btyp : Entity_Id; Index : Interp_Index; It : Interp; Nom_Subt : Entity_Id; procedure Accessibility_Message; -- Error, or warning within an instance, if the static accessibility -- rules of 3.10.2 are violated. function Declared_Within_Generic_Unit (Entity : Entity_Id; Generic_Unit : Node_Id) return Boolean; -- Returns True if Declared_Entity is declared within the declarative -- region of Generic_Unit; otherwise returns False. --------------------------- -- Accessibility_Message -- --------------------------- procedure Accessibility_Message is Indic : Node_Id := Parent (Parent (N)); begin -- In an instance, this is a runtime check, but one we -- know will fail, so generate an appropriate warning. if In_Instance_Body then Error_Msg_Warn := SPARK_Mode /= On; Error_Msg_F ("non-local pointer cannot point to local object<<", P); Error_Msg_F ("\Program_Error [<<", P); Rewrite (N, Make_Raise_Program_Error (Loc, Reason => PE_Accessibility_Check_Failed)); Set_Etype (N, Typ); return; else Error_Msg_F ("non-local pointer cannot point to local object", P); -- Check for case where we have a missing access definition if Is_Record_Type (Current_Scope) and then Nkind_In (Parent (N), N_Discriminant_Association, N_Index_Or_Discriminant_Constraint) then Indic := Parent (Parent (N)); while Present (Indic) and then Nkind (Indic) /= N_Subtype_Indication loop Indic := Parent (Indic); end loop; if Present (Indic) then Error_Msg_NE ("\use an access definition for" & " the access discriminant of&", N, Entity (Subtype_Mark (Indic))); end if; end if; end if; end Accessibility_Message; ---------------------------------- -- Declared_Within_Generic_Unit -- ---------------------------------- function Declared_Within_Generic_Unit (Entity : Entity_Id; Generic_Unit : Node_Id) return Boolean is Generic_Encloser : Node_Id := Enclosing_Generic_Unit (Entity); begin while Present (Generic_Encloser) loop if Generic_Encloser = Generic_Unit then return True; end if; -- We have to step to the scope of the generic's entity, because -- otherwise we'll just get back the same generic. Generic_Encloser := Enclosing_Generic_Unit (Scope (Defining_Entity (Generic_Encloser))); end loop; return False; end Declared_Within_Generic_Unit; -- Start of processing for Resolve_Attribute begin -- If error during analysis, no point in continuing, except for array -- types, where we get better recovery by using unconstrained indexes -- than nothing at all (see Check_Array_Type). if Error_Posted (N) and then Attr_Id /= Attribute_First and then Attr_Id /= Attribute_Last and then Attr_Id /= Attribute_Length and then Attr_Id /= Attribute_Range then return; end if; -- If attribute was universal type, reset to actual type if Etype (N) = Universal_Integer or else Etype (N) = Universal_Real then Set_Etype (N, Typ); end if; -- Remaining processing depends on attribute case Attr_Id is ------------ -- Access -- ------------ -- For access attributes, if the prefix denotes an entity, it is -- interpreted as a name, never as a call. It may be overloaded, -- in which case resolution uses the profile of the context type. -- Otherwise prefix must be resolved. when Attribute_Access | Attribute_Unchecked_Access | Attribute_Unrestricted_Access => -- Note possible modification if we have a variable if Is_Variable (P) then declare PN : constant Node_Id := Parent (N); Nm : Node_Id; Note : Boolean := True; -- Skip this for the case of Unrestricted_Access occuring in -- the context of a Valid check, since this otherwise leads -- to a missed warning (the Valid check does not really -- modify!) If this case, Note will be reset to False. -- Skip it as well if the type is an Acccess_To_Constant, -- given that no use of the value can modify the prefix. begin if Attr_Id = Attribute_Unrestricted_Access and then Nkind (PN) = N_Function_Call then Nm := Name (PN); if Nkind (Nm) = N_Expanded_Name and then Chars (Nm) = Name_Valid and then Nkind (Prefix (Nm)) = N_Identifier and then Chars (Prefix (Nm)) = Name_Attr_Long_Float then Note := False; end if; elsif Is_Access_Constant (Typ) then Note := False; end if; if Note then Note_Possible_Modification (P, Sure => False); end if; end; end if; -- The following comes from a query concerning improper use of -- universal_access in equality tests involving anonymous access -- types. Another good reason for 'Ref, but for now disable the -- test, which breaks several filed tests??? if Ekind (Typ) = E_Anonymous_Access_Type and then Nkind_In (Parent (N), N_Op_Eq, N_Op_Ne) and then False then Error_Msg_N ("need unique type to resolve 'Access", N); Error_Msg_N ("\qualify attribute with some access type", N); end if; -- Case where prefix is an entity name if Is_Entity_Name (P) then -- Deal with case where prefix itself is overloaded if Is_Overloaded (P) then Get_First_Interp (P, Index, It); while Present (It.Nam) loop if Type_Conformant (Designated_Type (Typ), It.Nam) then Set_Entity (P, It.Nam); -- The prefix is definitely NOT overloaded anymore at -- this point, so we reset the Is_Overloaded flag to -- avoid any confusion when reanalyzing the node. Set_Is_Overloaded (P, False); Set_Is_Overloaded (N, False); Generate_Reference (Entity (P), P); exit; end if; Get_Next_Interp (Index, It); end loop; -- If Prefix is a subprogram name, this reference freezes, -- but not if within spec expression mode. The profile of -- the subprogram is not frozen at this point. if not In_Spec_Expression then Freeze_Before (N, Entity (P), Do_Freeze_Profile => False); end if; -- If it is a type, there is nothing to resolve. -- If it is a subprogram, do not freeze its profile. -- If it is an object, complete its resolution. elsif Is_Overloadable (Entity (P)) then if not In_Spec_Expression then Freeze_Before (N, Entity (P), Do_Freeze_Profile => False); end if; -- Nothing to do if prefix is a type name elsif Is_Type (Entity (P)) then null; -- Otherwise non-overloaded other case, resolve the prefix else Resolve (P); end if; -- Some further error checks Error_Msg_Name_1 := Aname; if not Is_Entity_Name (P) then null; elsif Is_Overloadable (Entity (P)) and then Is_Abstract_Subprogram (Entity (P)) then Error_Msg_F ("prefix of % attribute cannot be abstract", P); Set_Etype (N, Any_Type); elsif Ekind (Entity (P)) = E_Enumeration_Literal then Error_Msg_F ("prefix of % attribute cannot be enumeration literal", P); Set_Etype (N, Any_Type); -- An attempt to take 'Access of a function that renames an -- enumeration literal. Issue a specialized error message. elsif Ekind (Entity (P)) = E_Function and then Present (Alias (Entity (P))) and then Ekind (Alias (Entity (P))) = E_Enumeration_Literal then Error_Msg_F ("prefix of % attribute cannot be function renaming " & "an enumeration literal", P); Set_Etype (N, Any_Type); elsif Convention (Entity (P)) = Convention_Intrinsic then Error_Msg_F ("prefix of % attribute cannot be intrinsic", P); Set_Etype (N, Any_Type); end if; -- Assignments, return statements, components of aggregates, -- generic instantiations will require convention checks if -- the type is an access to subprogram. Given that there will -- also be accessibility checks on those, this is where the -- checks can eventually be centralized ??? if Ekind_In (Btyp, E_Access_Subprogram_Type, E_Anonymous_Access_Subprogram_Type, E_Access_Protected_Subprogram_Type, E_Anonymous_Access_Protected_Subprogram_Type) then -- Deal with convention mismatch if Convention (Designated_Type (Btyp)) /= Convention (Entity (P)) then Error_Msg_FE ("subprogram & has wrong convention", P, Entity (P)); Error_Msg_Sloc := Sloc (Btyp); Error_Msg_FE ("\does not match & declared#", P, Btyp); if not Is_Itype (Btyp) and then not Has_Convention_Pragma (Btyp) then Error_Msg_FE ("\probable missing pragma Convention for &", P, Btyp); end if; else Check_Subtype_Conformant (New_Id => Entity (P), Old_Id => Designated_Type (Btyp), Err_Loc => P); end if; if Attr_Id = Attribute_Unchecked_Access then Error_Msg_Name_1 := Aname; Error_Msg_F ("attribute% cannot be applied to a subprogram", P); elsif Aname = Name_Unrestricted_Access then null; -- Nothing to check -- Check the static accessibility rule of 3.10.2(32). -- This rule also applies within the private part of an -- instantiation. This rule does not apply to anonymous -- access-to-subprogram types in access parameters. elsif Attr_Id = Attribute_Access and then not In_Instance_Body and then (Ekind (Btyp) = E_Access_Subprogram_Type or else Is_Local_Anonymous_Access (Btyp)) and then Subprogram_Access_Level (Entity (P)) > Type_Access_Level (Btyp) then Error_Msg_F ("subprogram must not be deeper than access type", P); -- Check the restriction of 3.10.2(32) that disallows the -- access attribute within a generic body when the ultimate -- ancestor of the type of the attribute is declared outside -- of the generic unit and the subprogram is declared within -- that generic unit. This includes any such attribute that -- occurs within the body of a generic unit that is a child -- of the generic unit where the subprogram is declared. -- The rule also prohibits applying the attribute when the -- access type is a generic formal access type (since the -- level of the actual type is not known). This restriction -- does not apply when the attribute type is an anonymous -- access-to-subprogram type. Note that this check was -- revised by AI-229, because the original Ada 95 rule -- was too lax. The original rule only applied when the -- subprogram was declared within the body of the generic, -- which allowed the possibility of dangling references). -- The rule was also too strict in some cases, in that it -- didn't permit the access to be declared in the generic -- spec, whereas the revised rule does (as long as it's not -- a formal type). -- There are a couple of subtleties of the test for applying -- the check that are worth noting. First, we only apply it -- when the levels of the subprogram and access type are the -- same (the case where the subprogram is statically deeper -- was applied above, and the case where the type is deeper -- is always safe). Second, we want the check to apply -- within nested generic bodies and generic child unit -- bodies, but not to apply to an attribute that appears in -- the generic unit's specification. This is done by testing -- that the attribute's innermost enclosing generic body is -- not the same as the innermost generic body enclosing the -- generic unit where the subprogram is declared (we don't -- want the check to apply when the access attribute is in -- the spec and there's some other generic body enclosing -- generic). Finally, there's no point applying the check -- when within an instance, because any violations will have -- been caught by the compilation of the generic unit. -- We relax this check in Relaxed_RM_Semantics mode for -- compatibility with legacy code for use by Ada source -- code analyzers (e.g. CodePeer). elsif Attr_Id = Attribute_Access and then not Relaxed_RM_Semantics and then not In_Instance and then Present (Enclosing_Generic_Unit (Entity (P))) and then Present (Enclosing_Generic_Body (N)) and then Enclosing_Generic_Body (N) /= Enclosing_Generic_Body (Enclosing_Generic_Unit (Entity (P))) and then Subprogram_Access_Level (Entity (P)) = Type_Access_Level (Btyp) and then Ekind (Btyp) /= E_Anonymous_Access_Subprogram_Type and then Ekind (Btyp) /= E_Anonymous_Access_Protected_Subprogram_Type then -- The attribute type's ultimate ancestor must be -- declared within the same generic unit as the -- subprogram is declared (including within another -- nested generic unit). The error message is -- specialized to say "ancestor" for the case where the -- access type is not its own ancestor, since saying -- simply "access type" would be very confusing. if not Declared_Within_Generic_Unit (Root_Type (Btyp), Enclosing_Generic_Unit (Entity (P))) then Error_Msg_N ("''Access attribute not allowed in generic body", N); if Root_Type (Btyp) = Btyp then Error_Msg_NE ("\because " & "access type & is declared outside " & "generic unit (RM 3.10.2(32))", N, Btyp); else Error_Msg_NE ("\because ancestor of " & "access type & is declared outside " & "generic unit (RM 3.10.2(32))", N, Btyp); end if; Error_Msg_NE ("\move ''Access to private part, or " & "(Ada 2005) use anonymous access type instead of &", N, Btyp); -- If the ultimate ancestor of the attribute's type is -- a formal type, then the attribute is illegal because -- the actual type might be declared at a higher level. -- The error message is specialized to say "ancestor" -- for the case where the access type is not its own -- ancestor, since saying simply "access type" would be -- very confusing. elsif Is_Generic_Type (Root_Type (Btyp)) then if Root_Type (Btyp) = Btyp then Error_Msg_N ("access type must not be a generic formal type", N); else Error_Msg_N ("ancestor access type must not be a generic " & "formal type", N); end if; end if; end if; end if; -- If this is a renaming, an inherited operation, or a -- subprogram instance, use the original entity. This may make -- the node type-inconsistent, so this transformation can only -- be done if the node will not be reanalyzed. In particular, -- if it is within a default expression, the transformation -- must be delayed until the default subprogram is created for -- it, when the enclosing subprogram is frozen. if Is_Entity_Name (P) and then Is_Overloadable (Entity (P)) and then Present (Alias (Entity (P))) and then Expander_Active then Rewrite (P, New_Occurrence_Of (Alias (Entity (P)), Sloc (P))); end if; elsif Nkind (P) = N_Selected_Component and then Is_Overloadable (Entity (Selector_Name (P))) then -- Protected operation. If operation is overloaded, must -- disambiguate. Prefix that denotes protected object itself -- is resolved with its own type. if Attr_Id = Attribute_Unchecked_Access then Error_Msg_Name_1 := Aname; Error_Msg_F ("attribute% cannot be applied to protected operation", P); end if; Resolve (Prefix (P)); Generate_Reference (Entity (Selector_Name (P)), P); -- Implement check implied by 3.10.2 (18.1/2) : F.all'access is -- statically illegal if F is an anonymous access to subprogram. elsif Nkind (P) = N_Explicit_Dereference and then Is_Entity_Name (Prefix (P)) and then Ekind (Etype (Entity (Prefix (P)))) = E_Anonymous_Access_Subprogram_Type then Error_Msg_N ("anonymous access to subprogram " & "has deeper accessibility than any master", P); elsif Is_Overloaded (P) then -- Use the designated type of the context to disambiguate -- Note that this was not strictly conformant to Ada 95, -- but was the implementation adopted by most Ada 95 compilers. -- The use of the context type to resolve an Access attribute -- reference is now mandated in AI-235 for Ada 2005. declare Index : Interp_Index; It : Interp; begin Get_First_Interp (P, Index, It); while Present (It.Typ) loop if Covers (Designated_Type (Typ), It.Typ) then Resolve (P, It.Typ); exit; end if; Get_Next_Interp (Index, It); end loop; end; else Resolve (P); end if; -- X'Access is illegal if X denotes a constant and the access type -- is access-to-variable. Same for 'Unchecked_Access. The rule -- does not apply to 'Unrestricted_Access. If the reference is a -- default-initialized aggregate component for a self-referential -- type the reference is legal. if not (Ekind (Btyp) = E_Access_Subprogram_Type or else Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type or else (Is_Record_Type (Btyp) and then Present (Corresponding_Remote_Type (Btyp))) or else Ekind (Btyp) = E_Access_Protected_Subprogram_Type or else Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type or else Is_Access_Constant (Btyp) or else Is_Variable (P) or else Attr_Id = Attribute_Unrestricted_Access) then if Is_Entity_Name (P) and then Is_Type (Entity (P)) then -- Legality of a self-reference through an access -- attribute has been verified in Analyze_Access_Attribute. null; elsif Comes_From_Source (N) then Error_Msg_F ("access-to-variable designates constant", P); end if; end if; Des_Btyp := Designated_Type (Btyp); if Ada_Version >= Ada_2005 and then Is_Incomplete_Type (Des_Btyp) then -- Ada 2005 (AI-412): If the (sub)type is a limited view of an -- imported entity, and the non-limited view is visible, make -- use of it. If it is an incomplete subtype, use the base type -- in any case. if From_Limited_With (Des_Btyp) and then Present (Non_Limited_View (Des_Btyp)) then Des_Btyp := Non_Limited_View (Des_Btyp); elsif Ekind (Des_Btyp) = E_Incomplete_Subtype then Des_Btyp := Etype (Des_Btyp); end if; end if; if (Attr_Id = Attribute_Access or else Attr_Id = Attribute_Unchecked_Access) and then (Ekind (Btyp) = E_General_Access_Type or else Ekind (Btyp) = E_Anonymous_Access_Type) then -- Ada 2005 (AI-230): Check the accessibility of anonymous -- access types for stand-alone objects, record and array -- components, and return objects. For a component definition -- the level is the same of the enclosing composite type. if Ada_Version >= Ada_2005 and then (Is_Local_Anonymous_Access (Btyp) -- Handle cases where Btyp is the anonymous access -- type of an Ada 2012 stand-alone object. or else Nkind (Associated_Node_For_Itype (Btyp)) = N_Object_Declaration) and then Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp) and then Attr_Id = Attribute_Access then -- In an instance, this is a runtime check, but one we know -- will fail, so generate an appropriate warning. As usual, -- this kind of warning is an error in SPARK mode. if In_Instance_Body then Error_Msg_Warn := SPARK_Mode /= On; Error_Msg_F ("non-local pointer cannot point to local object<<", P); Error_Msg_F ("\Program_Error [<<", P); Rewrite (N, Make_Raise_Program_Error (Loc, Reason => PE_Accessibility_Check_Failed)); Set_Etype (N, Typ); else Error_Msg_F ("non-local pointer cannot point to local object", P); end if; end if; if Is_Dependent_Component_Of_Mutable_Object (P) then Error_Msg_F ("illegal attribute for discriminant-dependent component", P); end if; -- Check static matching rule of 3.10.2(27). Nominal subtype -- of the prefix must statically match the designated type. Nom_Subt := Etype (P); if Is_Constr_Subt_For_U_Nominal (Nom_Subt) then Nom_Subt := Base_Type (Nom_Subt); end if; if Is_Tagged_Type (Designated_Type (Typ)) then -- If the attribute is in the context of an access -- parameter, then the prefix is allowed to be of -- the class-wide type (by AI-127). if Ekind (Typ) = E_Anonymous_Access_Type then if not Covers (Designated_Type (Typ), Nom_Subt) and then not Covers (Nom_Subt, Designated_Type (Typ)) then declare Desig : Entity_Id; begin Desig := Designated_Type (Typ); if Is_Class_Wide_Type (Desig) then Desig := Etype (Desig); end if; if Is_Anonymous_Tagged_Base (Nom_Subt, Desig) then null; else Error_Msg_FE ("type of prefix: & not compatible", P, Nom_Subt); Error_Msg_FE ("\with &, the expected designated type", P, Designated_Type (Typ)); end if; end; end if; elsif not Covers (Designated_Type (Typ), Nom_Subt) or else (not Is_Class_Wide_Type (Designated_Type (Typ)) and then Is_Class_Wide_Type (Nom_Subt)) then Error_Msg_FE ("type of prefix: & is not covered", P, Nom_Subt); Error_Msg_FE ("\by &, the expected designated type" & " (RM 3.10.2 (27))", P, Designated_Type (Typ)); end if; if Is_Class_Wide_Type (Designated_Type (Typ)) and then Has_Discriminants (Etype (Designated_Type (Typ))) and then Is_Constrained (Etype (Designated_Type (Typ))) and then Designated_Type (Typ) /= Nom_Subt then Apply_Discriminant_Check (N, Etype (Designated_Type (Typ))); end if; -- Ada 2005 (AI-363): Require static matching when designated -- type has discriminants and a constrained partial view, since -- in general objects of such types are mutable, so we can't -- allow the access value to designate a constrained object -- (because access values must be assumed to designate mutable -- objects when designated type does not impose a constraint). elsif Subtypes_Statically_Match (Des_Btyp, Nom_Subt) then null; elsif Has_Discriminants (Designated_Type (Typ)) and then not Is_Constrained (Des_Btyp) and then (Ada_Version < Ada_2005 or else not Object_Type_Has_Constrained_Partial_View (Typ => Designated_Type (Base_Type (Typ)), Scop => Current_Scope)) then null; else Error_Msg_F ("object subtype must statically match " & "designated subtype", P); if Is_Entity_Name (P) and then Is_Array_Type (Designated_Type (Typ)) then declare D : constant Node_Id := Declaration_Node (Entity (P)); begin Error_Msg_N ("aliased object has explicit bounds??", D); Error_Msg_N ("\declare without bounds (and with explicit " & "initialization)??", D); Error_Msg_N ("\for use with unconstrained access??", D); end; end if; end if; -- Check the static accessibility rule of 3.10.2(28). Note that -- this check is not performed for the case of an anonymous -- access type, since the access attribute is always legal -- in such a context. if Attr_Id /= Attribute_Unchecked_Access and then Ekind (Btyp) = E_General_Access_Type and then Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp) then Accessibility_Message; return; end if; end if; if Ekind_In (Btyp, E_Access_Protected_Subprogram_Type, E_Anonymous_Access_Protected_Subprogram_Type) then if Is_Entity_Name (P) and then not Is_Protected_Type (Scope (Entity (P))) then Error_Msg_F ("context requires a protected subprogram", P); -- Check accessibility of protected object against that of the -- access type, but only on user code, because the expander -- creates access references for handlers. If the context is an -- anonymous_access_to_protected, there are no accessibility -- checks either. Omit check entirely for Unrestricted_Access. elsif Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp) and then Comes_From_Source (N) and then Ekind (Btyp) = E_Access_Protected_Subprogram_Type and then Attr_Id /= Attribute_Unrestricted_Access then Accessibility_Message; return; -- AI05-0225: If the context is not an access to protected -- function, the prefix must be a variable, given that it may -- be used subsequently in a protected call. elsif Nkind (P) = N_Selected_Component and then not Is_Variable (Prefix (P)) and then Ekind (Entity (Selector_Name (P))) /= E_Function then Error_Msg_N ("target object of access to protected procedure " & "must be variable", N); elsif Is_Entity_Name (P) then Check_Internal_Protected_Use (N, Entity (P)); end if; elsif Ekind_In (Btyp, E_Access_Subprogram_Type, E_Anonymous_Access_Subprogram_Type) and then Ekind (Etype (N)) = E_Access_Protected_Subprogram_Type then Error_Msg_F ("context requires a non-protected subprogram", P); end if; -- The context cannot be a pool-specific type, but this is a -- legality rule, not a resolution rule, so it must be checked -- separately, after possibly disambiguation (see AI-245). if Ekind (Btyp) = E_Access_Type and then Attr_Id /= Attribute_Unrestricted_Access then Wrong_Type (N, Typ); end if; -- The context may be a constrained access type (however ill- -- advised such subtypes might be) so in order to generate a -- constraint check when needed set the type of the attribute -- reference to the base type of the context. Set_Etype (N, Btyp); -- Check for incorrect atomic/volatile reference (RM C.6(12)) if Attr_Id /= Attribute_Unrestricted_Access then if Is_Atomic_Object (P) and then not Is_Atomic (Designated_Type (Typ)) then Error_Msg_F ("access to atomic object cannot yield access-to-" & "non-atomic type", P); elsif Is_Volatile_Object (P) and then not Is_Volatile (Designated_Type (Typ)) then Error_Msg_F ("access to volatile object cannot yield access-to-" & "non-volatile type", P); end if; end if; -- Check for unrestricted access where expected type is a thin -- pointer to an unconstrained array. if Non_Aliased_Prefix (N) and then Has_Size_Clause (Typ) and then RM_Size (Typ) = System_Address_Size then declare DT : constant Entity_Id := Designated_Type (Typ); begin if Is_Array_Type (DT) and then not Is_Constrained (DT) then Error_Msg_N ("illegal use of Unrestricted_Access attribute", P); Error_Msg_N ("\attempt to generate thin pointer to unaliased " & "object", P); end if; end; end if; -- Mark that address of entity is taken in case of -- 'Unrestricted_Access or in case of a subprogram. if Is_Entity_Name (P) and then (Attr_Id = Attribute_Unrestricted_Access or else Is_Subprogram (Entity (P))) then Set_Address_Taken (Entity (P)); end if; -- Deal with possible elaboration check if Is_Entity_Name (P) and then Is_Subprogram (Entity (P)) then declare Subp_Id : constant Entity_Id := Entity (P); Scop : constant Entity_Id := Scope (Subp_Id); Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id); Flag_Id : Entity_Id; Subp_Body : Node_Id; -- If the access has been taken and the body of the subprogram -- has not been see yet, indirect calls must be protected with -- elaboration checks. We have the proper elaboration machinery -- for subprograms declared in packages, but within a block or -- a subprogram the body will appear in the same declarative -- part, and we must insert a check in the eventual body itself -- using the elaboration flag that we generate now. The check -- is then inserted when the body is expanded. This processing -- is not needed for a stand alone expression function because -- the internally generated spec and body are always inserted -- as a pair in the same declarative list. begin if Expander_Active and then Comes_From_Source (Subp_Id) and then Comes_From_Source (N) and then In_Open_Scopes (Scop) and then Ekind_In (Scop, E_Block, E_Procedure, E_Function) and then not Has_Completion (Subp_Id) and then No (Elaboration_Entity (Subp_Id)) and then Nkind (Subp_Decl) = N_Subprogram_Declaration and then Nkind (Original_Node (Subp_Decl)) /= N_Expression_Function then -- Create elaboration variable for it Flag_Id := Make_Temporary (Loc, 'E'); Set_Elaboration_Entity (Subp_Id, Flag_Id); Set_Is_Frozen (Flag_Id); -- Insert declaration for flag after subprogram -- declaration. Note that attribute reference may -- appear within a nested scope. Insert_After_And_Analyze (Subp_Decl, Make_Object_Declaration (Loc, Defining_Identifier => Flag_Id, Object_Definition => New_Occurrence_Of (Standard_Short_Integer, Loc), Expression => Make_Integer_Literal (Loc, Uint_0))); end if; -- Taking the 'Access of an expression function freezes its -- expression (RM 13.14 10.3/3). This does not apply to an -- expression function that acts as a completion because the -- generated body is immediately analyzed and the expression -- is automatically frozen. if Is_Expression_Function (Subp_Id) and then Present (Corresponding_Body (Subp_Decl)) then Subp_Body := Unit_Declaration_Node (Corresponding_Body (Subp_Decl)); -- The body has already been analyzed when the expression -- function acts as a completion. if Analyzed (Subp_Body) then null; -- Attribute 'Access may appear within the generated body -- of the expression function subject to the attribute: -- function F is (... F'Access ...); -- If the expression function is on the scope stack, then -- the body is currently being analyzed. Do not reanalyze -- it because this will lead to infinite recursion. elsif In_Open_Scopes (Subp_Id) then null; -- If reference to the expression function appears in an -- inner scope, for example as an actual in an instance, -- this is not a freeze point either. elsif Scope (Subp_Id) /= Current_Scope then null; -- Analyze the body of the expression function to freeze -- the expression. This takes care of the case where the -- 'Access is part of dispatch table initialization and -- the generated body of the expression function has not -- been analyzed yet. else Analyze (Subp_Body); end if; end if; end; end if; ------------- -- Address -- ------------- -- Deal with resolving the type for Address attribute, overloading -- is not permitted here, since there is no context to resolve it. when Attribute_Address | Attribute_Code_Address => -- To be safe, assume that if the address of a variable is taken, -- it may be modified via this address, so note modification. if Is_Variable (P) then Note_Possible_Modification (P, Sure => False); end if; if Nkind (P) in N_Subexpr and then Is_Overloaded (P) then Get_First_Interp (P, Index, It); Get_Next_Interp (Index, It); if Present (It.Nam) then Error_Msg_Name_1 := Aname; Error_Msg_F ("prefix of % attribute cannot be overloaded", P); end if; end if; if not Is_Entity_Name (P) or else not Is_Overloadable (Entity (P)) then if not Is_Task_Type (Etype (P)) or else Nkind (P) = N_Explicit_Dereference then Resolve (P); end if; end if; -- If this is the name of a derived subprogram, or that of a -- generic actual, the address is that of the original entity. if Is_Entity_Name (P) and then Is_Overloadable (Entity (P)) and then Present (Alias (Entity (P))) then Rewrite (P, New_Occurrence_Of (Alias (Entity (P)), Sloc (P))); end if; if Is_Entity_Name (P) then Set_Address_Taken (Entity (P)); end if; if Nkind (P) = N_Slice then -- Arr (X .. Y)'address is identical to Arr (X)'address, -- even if the array is packed and the slice itself is not -- addressable. Transform the prefix into an indexed component. -- Note that the transformation is safe only if we know that -- the slice is non-null. That is because a null slice can have -- an out of bounds index value. -- Right now, gigi blows up if given 'Address on a slice as a -- result of some incorrect freeze nodes generated by the front -- end, and this covers up that bug in one case, but the bug is -- likely still there in the cases not handled by this code ??? -- It's not clear what 'Address *should* return for a null -- slice with out of bounds indexes, this might be worth an ARG -- discussion ??? -- One approach would be to do a length check unconditionally, -- and then do the transformation below unconditionally, but -- analyze with checks off, avoiding the problem of the out of -- bounds index. This approach would interpret the address of -- an out of bounds null slice as being the address where the -- array element would be if there was one, which is probably -- as reasonable an interpretation as any ??? declare Loc : constant Source_Ptr := Sloc (P); D : constant Node_Id := Discrete_Range (P); Lo : Node_Id; begin if Is_Entity_Name (D) and then Not_Null_Range (Type_Low_Bound (Entity (D)), Type_High_Bound (Entity (D))) then Lo := Make_Attribute_Reference (Loc, Prefix => (New_Occurrence_Of (Entity (D), Loc)), Attribute_Name => Name_First); elsif Nkind (D) = N_Range and then Not_Null_Range (Low_Bound (D), High_Bound (D)) then Lo := Low_Bound (D); else Lo := Empty; end if; if Present (Lo) then Rewrite (P, Make_Indexed_Component (Loc, Prefix => Relocate_Node (Prefix (P)), Expressions => New_List (Lo))); Analyze_And_Resolve (P); end if; end; end if; ------------------ -- Body_Version -- ------------------ -- Prefix of Body_Version attribute can be a subprogram name which -- must not be resolved, since this is not a call. when Attribute_Body_Version => null; ------------ -- Caller -- ------------ -- Prefix of Caller attribute is an entry name which must not -- be resolved, since this is definitely not an entry call. when Attribute_Caller => null; ------------------ -- Code_Address -- ------------------ -- Shares processing with Address attribute ----------- -- Count -- ----------- -- If the prefix of the Count attribute is an entry name it must not -- be resolved, since this is definitely not an entry call. However, -- if it is an element of an entry family, the index itself may -- have to be resolved because it can be a general expression. when Attribute_Count => if Nkind (P) = N_Indexed_Component and then Is_Entity_Name (Prefix (P)) then declare Indx : constant Node_Id := First (Expressions (P)); Fam : constant Entity_Id := Entity (Prefix (P)); begin Resolve (Indx, Entry_Index_Type (Fam)); Apply_Range_Check (Indx, Entry_Index_Type (Fam)); end; end if; ---------------- -- Elaborated -- ---------------- -- Prefix of the Elaborated attribute is a subprogram name which -- must not be resolved, since this is definitely not a call. Note -- that it is a library unit, so it cannot be overloaded here. when Attribute_Elaborated => null; ------------- -- Enabled -- ------------- -- Prefix of Enabled attribute is a check name, which must be treated -- specially and not touched by Resolve. when Attribute_Enabled => null; ---------------- -- Loop_Entry -- ---------------- -- Do not resolve the prefix of Loop_Entry, instead wait until the -- attribute has been expanded (see Expand_Loop_Entry_Attributes). -- The delay ensures that any generated checks or temporaries are -- inserted before the relocated prefix. when Attribute_Loop_Entry => null; -------------------- -- Mechanism_Code -- -------------------- -- Prefix of the Mechanism_Code attribute is a function name -- which must not be resolved. Should we check for overloaded ??? when Attribute_Mechanism_Code => null; ------------------ -- Partition_ID -- ------------------ -- Most processing is done in sem_dist, after determining the -- context type. Node is rewritten as a conversion to a runtime call. when Attribute_Partition_ID => Process_Partition_Id (N); return; ------------------ -- Pool_Address -- ------------------ when Attribute_Pool_Address => Resolve (P); ----------- -- Range -- ----------- -- We replace the Range attribute node with a range expression whose -- bounds are the 'First and 'Last attributes applied to the same -- prefix. The reason that we do this transformation here instead of -- in the expander is that it simplifies other parts of the semantic -- analysis which assume that the Range has been replaced; thus it -- must be done even when in semantic-only mode (note that the RM -- specifically mentions this equivalence, we take care that the -- prefix is only evaluated once). when Attribute_Range => Range_Attribute : declare Dims : List_Id; HB : Node_Id; LB : Node_Id; begin if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) then Resolve (P); end if; Dims := Expressions (N); HB := Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (P, Name_Req => True), Attribute_Name => Name_Last, Expressions => Dims); LB := Make_Attribute_Reference (Loc, Prefix => P, Attribute_Name => Name_First, Expressions => (Dims)); -- Do not share the dimension indicator, if present. Even though -- it is a static constant, its source location may be modified -- when printing expanded code and node sharing will lead to chaos -- in Sprint. if Present (Dims) then Set_Expressions (LB, New_List (New_Copy_Tree (First (Dims)))); end if; -- If the original was marked as Must_Not_Freeze (see code in -- Sem_Ch3.Make_Index), then make sure the rewriting does not -- freeze either. if Must_Not_Freeze (N) then Set_Must_Not_Freeze (HB); Set_Must_Not_Freeze (LB); Set_Must_Not_Freeze (Prefix (HB)); Set_Must_Not_Freeze (Prefix (LB)); end if; if Raises_Constraint_Error (Prefix (N)) then -- Preserve Sloc of prefix in the new bounds, so that the -- posted warning can be removed if we are within unreachable -- code. Set_Sloc (LB, Sloc (Prefix (N))); Set_Sloc (HB, Sloc (Prefix (N))); end if; Rewrite (N, Make_Range (Loc, LB, HB)); Analyze_And_Resolve (N, Typ); -- Ensure that the expanded range does not have side effects Force_Evaluation (LB); Force_Evaluation (HB); -- Normally after resolving attribute nodes, Eval_Attribute -- is called to do any possible static evaluation of the node. -- However, here since the Range attribute has just been -- transformed into a range expression it is no longer an -- attribute node and therefore the call needs to be avoided -- and is accomplished by simply returning from the procedure. return; end Range_Attribute; ------------ -- Result -- ------------ -- We will only come here during the prescan of a spec expression -- containing a Result attribute. In that case the proper Etype has -- already been set, and nothing more needs to be done here. when Attribute_Result => null; ---------------------- -- Unchecked_Access -- ---------------------- -- Processing is shared with Access ------------------------- -- Unrestricted_Access -- ------------------------- -- Processing is shared with Access ------------ -- Update -- ------------ -- Resolve aggregate components in component associations when Attribute_Update => Update : declare Aggr : constant Node_Id := First (Expressions (N)); Typ : constant Entity_Id := Etype (Prefix (N)); Assoc : Node_Id; Comp : Node_Id; Expr : Node_Id; begin -- Set the Etype of the aggregate to that of the prefix, even -- though the aggregate may not be a proper representation of a -- value of the type (missing or duplicated associations, etc.) -- Complete resolution of the prefix. Note that in Ada 2012 it -- can be a qualified expression that is e.g. an aggregate. Set_Etype (Aggr, Typ); Resolve (Prefix (N), Typ); -- For an array type, resolve expressions with the component type -- of the array, and apply constraint checks when needed. if Is_Array_Type (Typ) then Assoc := First (Component_Associations (Aggr)); while Present (Assoc) loop Expr := Expression (Assoc); Resolve (Expr, Component_Type (Typ)); -- For scalar array components set Do_Range_Check when -- needed. Constraint checking on non-scalar components -- is done in Aggregate_Constraint_Checks, but only if -- full analysis is enabled. These flags are not set in -- the front-end in GnatProve mode. if Is_Scalar_Type (Component_Type (Typ)) and then not Is_OK_Static_Expression (Expr) then if Is_Entity_Name (Expr) and then Etype (Expr) = Component_Type (Typ) then null; else Set_Do_Range_Check (Expr); end if; end if; -- The choices in the association are static constants, -- or static aggregates each of whose components belongs -- to the proper index type. However, they must also -- belong to the index subtype (s) of the prefix, which -- may be a subtype (e.g. given by a slice). -- Choices may also be identifiers with no staticness -- requirements, in which case they must resolve to the -- index type. declare C : Node_Id; C_E : Node_Id; Indx : Node_Id; begin C := First (Choices (Assoc)); while Present (C) loop Indx := First_Index (Etype (Prefix (N))); if Nkind (C) /= N_Aggregate then Analyze_And_Resolve (C, Etype (Indx)); Apply_Constraint_Check (C, Etype (Indx)); Check_Non_Static_Context (C); else C_E := First (Expressions (C)); while Present (C_E) loop Analyze_And_Resolve (C_E, Etype (Indx)); Apply_Constraint_Check (C_E, Etype (Indx)); Check_Non_Static_Context (C_E); Next (C_E); Next_Index (Indx); end loop; end if; Next (C); end loop; end; Next (Assoc); end loop; -- For a record type, use type of each component, which is -- recorded during analysis. else Assoc := First (Component_Associations (Aggr)); while Present (Assoc) loop Comp := First (Choices (Assoc)); Expr := Expression (Assoc); if Nkind (Comp) /= N_Others_Choice and then not Error_Posted (Comp) then Resolve (Expr, Etype (Entity (Comp))); if Is_Scalar_Type (Etype (Entity (Comp))) and then not Is_OK_Static_Expression (Expr) then Set_Do_Range_Check (Expr); end if; end if; Next (Assoc); end loop; end if; end Update; --------- -- Val -- --------- -- Apply range check. Note that we did not do this during the -- analysis phase, since we wanted Eval_Attribute to have a -- chance at finding an illegal out of range value. when Attribute_Val => -- Note that we do our own Eval_Attribute call here rather than -- use the common one, because we need to do processing after -- the call, as per above comment. Eval_Attribute (N); -- Eval_Attribute may replace the node with a raise CE, or -- fold it to a constant. Obviously we only apply a scalar -- range check if this did not happen. if Nkind (N) = N_Attribute_Reference and then Attribute_Name (N) = Name_Val then Apply_Scalar_Range_Check (First (Expressions (N)), Btyp); end if; return; ------------- -- Version -- ------------- -- Prefix of Version attribute can be a subprogram name which -- must not be resolved, since this is not a call. when Attribute_Version => null; ---------------------- -- Other Attributes -- ---------------------- -- For other attributes, resolve prefix unless it is a type. If -- the attribute reference itself is a type name ('Base and 'Class) -- then this is only legal within a task or protected record. when others => if not Is_Entity_Name (P) or else not Is_Type (Entity (P)) then Resolve (P); end if; -- If the attribute reference itself is a type name ('Base, -- 'Class) then this is only legal within a task or protected -- record. What is this all about ??? if Is_Entity_Name (N) and then Is_Type (Entity (N)) then if Is_Concurrent_Type (Entity (N)) and then In_Open_Scopes (Entity (P)) then null; else Error_Msg_N ("invalid use of subtype name in expression or call", N); end if; end if; -- For attributes whose argument may be a string, complete -- resolution of argument now. This avoids premature expansion -- (and the creation of transient scopes) before the attribute -- reference is resolved. case Attr_Id is when Attribute_Value => Resolve (First (Expressions (N)), Standard_String); when Attribute_Wide_Value => Resolve (First (Expressions (N)), Standard_Wide_String); when Attribute_Wide_Wide_Value => Resolve (First (Expressions (N)), Standard_Wide_Wide_String); when others => null; end case; -- If the prefix of the attribute is a class-wide type then it -- will be expanded into a dispatching call to a predefined -- primitive. Therefore we must check for potential violation -- of such restriction. if Is_Class_Wide_Type (Etype (P)) then Check_Restriction (No_Dispatching_Calls, N); end if; end case; -- Normally the Freezing is done by Resolve but sometimes the Prefix -- is not resolved, in which case the freezing must be done now. -- For an elaboration check on a subprogram, we do not freeze its type. -- It may be declared in an unrelated scope, in particular in the case -- of a generic function whose type may remain unelaborated. if Attr_Id = Attribute_Elaborated then null; else Freeze_Expression (P); end if; -- Finally perform static evaluation on the attribute reference Analyze_Dimension (N); Eval_Attribute (N); end Resolve_Attribute; ------------------------ -- Set_Boolean_Result -- ------------------------ procedure Set_Boolean_Result (N : Node_Id; B : Boolean) is Loc : constant Source_Ptr := Sloc (N); begin if B then Rewrite (N, New_Occurrence_Of (Standard_True, Loc)); else Rewrite (N, New_Occurrence_Of (Standard_False, Loc)); end if; end Set_Boolean_Result; -------------------------------- -- Stream_Attribute_Available -- -------------------------------- function Stream_Attribute_Available (Typ : Entity_Id; Nam : TSS_Name_Type; Partial_View : Node_Id := Empty) return Boolean is Etyp : Entity_Id := Typ; -- Start of processing for Stream_Attribute_Available begin -- We need some comments in this body ??? if Has_Stream_Attribute_Definition (Typ, Nam) then return True; end if; if Is_Class_Wide_Type (Typ) then return not Is_Limited_Type (Typ) or else Stream_Attribute_Available (Etype (Typ), Nam); end if; if Nam = TSS_Stream_Input and then Is_Abstract_Type (Typ) and then not Is_Class_Wide_Type (Typ) then return False; end if; if not (Is_Limited_Type (Typ) or else (Present (Partial_View) and then Is_Limited_Type (Partial_View))) then return True; end if; -- In Ada 2005, Input can invoke Read, and Output can invoke Write if Nam = TSS_Stream_Input and then Ada_Version >= Ada_2005 and then Stream_Attribute_Available (Etyp, TSS_Stream_Read) then return True; elsif Nam = TSS_Stream_Output and then Ada_Version >= Ada_2005 and then Stream_Attribute_Available (Etyp, TSS_Stream_Write) then return True; end if; -- Case of Read and Write: check for attribute definition clause that -- applies to an ancestor type. while Etype (Etyp) /= Etyp loop Etyp := Etype (Etyp); if Has_Stream_Attribute_Definition (Etyp, Nam) then return True; end if; end loop; if Ada_Version < Ada_2005 then -- In Ada 95 mode, also consider a non-visible definition declare Btyp : constant Entity_Id := Implementation_Base_Type (Typ); begin return Btyp /= Typ and then Stream_Attribute_Available (Btyp, Nam, Partial_View => Typ); end; end if; return False; end Stream_Attribute_Available; end Sem_Attr;
-- -- Copyright (C) 2022 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- with GNAT.OS_Lib; with System; package body Epoll is function epoll_create1 (flags : int) return Epoll_Descriptor with Import => True, Convention => C, External_Name => "epoll_create1"; function epoll_ctl (epfd : Epoll_Descriptor; op : Epoll_Operation; fd : int; event : access Epoll_Event) return int with Import => True, Convention => C, External_Name => "epoll_ctl"; function epoll_wait (epfd : Epoll_Descriptor; events : System.Address; maxevents : int; timeout : int) return int with Import => True, Convention => C, External_Name => "epoll_wait"; function Create return Epoll_Descriptor is begin return epoll_create1 (0); end Create; procedure Control (This : Epoll_Descriptor; Socket : Socket_Type; Op : Epoll_Operation; Event : access Epoll_Event) is begin if epoll_ctl (This, Op, int (To_C (Socket)), Event) = -1 then raise Epoll_Error with GNAT.OS_Lib.Errno_Message; end if; end Control; function Wait (This : Epoll_Descriptor; Max_Events : Positive := 1; Timeout : Integer := -1) return Epoll_Events is E : aliased Epoll_Events (1 .. Max_Events); Status : int; begin Status := epoll_wait (This, E'Address, int (Max_Events), int (Timeout)); if Status = -1 then raise Epoll_Error with GNAT.OS_Lib.Errno_Message; end if; return E (E'First .. Integer (Status)); end Wait; end Epoll;
----------------------------------------------------------------------- -- users-tests-helpers -- Helpers for user creation -- Copyright (C) 2011, 2012, 2013, 2014, 2017 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.Finalization; with Security.Contexts; with ASF.Requests.Mockup; with AWA.Users.Models; with AWA.Users.Services; with AWA.Services.Contexts; with AWA.Users.Principals; package AWA.Tests.Helpers.Users is type Test_User is new Ada.Finalization.Limited_Controlled with record Context : AWA.Services.Contexts.Service_Context; Manager : AWA.Users.Services.User_Service_Access := null; User : AWA.Users.Models.User_Ref; Email : AWA.Users.Models.Email_Ref; Session : AWA.Users.Models.Session_Ref; Principal : AWA.Users.Principals.Principal_Access; end record; -- Initialize the service context. procedure Initialize (Principal : in out Test_User); -- Create a test user associated with the given email address. -- Get an open session for that user. If the user already exists, no error is reported. procedure Create_User (Principal : in out Test_User; Email : in String); -- Create a test user for a new test and get an open session. procedure Create_User (Principal : in out Test_User); -- Find the access key associated with a user (if any). procedure Find_Access_Key (Principal : in out Test_User; Email : in String; Key : in out AWA.Users.Models.Access_Key_Ref); -- Login a user and create a session procedure Login (Principal : in out Test_User); -- Logout the user and closes the current session. procedure Logout (Principal : in out Test_User); -- Simulate a user login in the given service context. procedure Login (Context : in out AWA.Services.Contexts.Service_Context'Class; Sec_Context : in out Security.Contexts.Security_Context; Email : in String); -- Simulate a user login on the request. Upon successful login, a session that is -- authentified is associated with the request object. procedure Login (Email : in String; Request : in out ASF.Requests.Mockup.Request); -- Setup the context and security context to simulate an anonymous user. procedure Anonymous (Context : in out AWA.Services.Contexts.Service_Context'Class; Sec_Context : in out Security.Contexts.Security_Context); -- Simulate the recovery password process for the given user. procedure Recover_Password (Email : in String); overriding procedure Finalize (Principal : in out Test_User); -- Cleanup and release the Principal that have been allocated from the Login session -- but not released because the Logout is not called from the unit test. procedure Tear_Down; end AWA.Tests.Helpers.Users;
package Numeric_Tests is function Is_Numeric (Item : in String) return Boolean; end Numeric_Tests;
with RP.GPIO; with RP.I2C_Master; with Pimoroni_LED_Dot_Matrix; package body Matrix_Area_Word is procedure Initialize is package PLDM_0 is new Pimoroni_LED_Dot_Matrix (Byte_0_I2C, Byte_0_Address); package PLDM_1 is new Pimoroni_LED_Dot_Matrix (Byte_1_I2C, Byte_1_Address); begin PLDM_0.Initialize; PLDM_1.Initialize; end Initialize; end Matrix_Area_Word;
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Element_Vectors; with Program.Elements.Associations; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Array_Component_Associations is pragma Pure (Program.Elements.Array_Component_Associations); type Array_Component_Association is limited interface and Program.Elements.Associations.Association; type Array_Component_Association_Access is access all Array_Component_Association'Class with Storage_Size => 0; not overriding function Choices (Self : Array_Component_Association) return Program.Element_Vectors.Element_Vector_Access is abstract; not overriding function Component_Value (Self : Array_Component_Association) return Program.Elements.Expressions.Expression_Access is abstract; type Array_Component_Association_Text is limited interface; type Array_Component_Association_Text_Access is access all Array_Component_Association_Text'Class with Storage_Size => 0; not overriding function To_Array_Component_Association_Text (Self : in out Array_Component_Association) return Array_Component_Association_Text_Access is abstract; not overriding function Arrow_Token (Self : Array_Component_Association_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Box_Token (Self : Array_Component_Association_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; type Array_Component_Association_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Array_Component_Association_Vector_Access is access all Array_Component_Association_Vector'Class with Storage_Size => 0; overriding function Element (Self : Array_Component_Association_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Array_Component_Association; function To_Array_Component_Association (Self : Array_Component_Association_Vector'Class; Index : Positive) return not null Array_Component_Association_Access is (Self.Element (Index).To_Array_Component_Association); end Program.Elements.Array_Component_Associations;
with HWIF;use HWIF; --Use only north and east. task Light_Rotator (dir : in Direction); task body Light_Rotator is if dir = North or dir = South then task EastSwitch; task body EastSwitch is TrafficLightSwitcher(East); end EastSwitch; task WestSwitch; task body WestSwitch is TrafficLightSwitcher(West); end WestSwitch; elsif dir = East or dir = West then task NorthSwitch; task body NorthSwitch is TrafficLightSwitcher(North); end NorthSwitch; task SouthSwitch; task body SouthSwitch is TrafficLightSwitcher(South); end SouthSwitch; end if;
----------------------------------------------------------------------- -- are-installer -- Resource selector, preparer and installer -- Copyright (C) 2012, 2017, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; private with Ada.Strings.Unbounded; private with Ada.Containers.Vectors; private with Ada.Containers.Indefinite_Vectors; private with Ada.Containers.Indefinite_Ordered_Maps; private with GNAT.Regpat; private with DOM.Core; private with Util.Log; -- = Rules = -- The `Advanced Resource Embedder` provides several mechanisms to integrate -- files in the generated code. -- -- An XML file file contains a set of rules which describe how to select the -- files to include in the generator. The XML file is read and resource rules -- introduced by the `resource` XML element are collected. -- -- The source paths are then scanned and a complete tree of source files is created. -- Because several source paths are given, we have several source trees with possibly -- duplicate files and names in them. -- -- The source paths are matched against the resource rules and each installation rule -- is filled with the source files that they match. -- -- The resource installation rules are executed in the order defined -- in the `package.xml` file. Each resource rule can have its own way to make -- the installation for the set of files that matched the rule definition. -- A resource rule can copy the file, another can concatenate the source files, -- another can do some transformation on the source files and prepare it before being -- embedded and used by the generator. -- -- @include are-installer-copies.ads -- @include are-installer-concat.ads -- @include are-installer-exec.ads -- @include are-installer-bundles.ads -- @include are-installer-merges.ads package Are.Installer is type Installer_Type is limited new Ada.Finalization.Limited_Controlled with private; -- Read the XML package file that describes the resources and build the list -- of rules to collect and build those resources. procedure Read_Package (Installer : in out Installer_Type; File : in String; Context : in out Context_Type'Class); -- Scan the directory collecting the files that must be taken into account and -- processed by the distribution rules. procedure Scan_Directory (Installer : in out Installer_Type; Path : in String; Context : in out Context_Type'Class); -- Add a simple rule to copy the files matching the pattern on the resource. procedure Add_Rule (Installer : in out Installer_Type; Resource : in Are.Resource_Access; Pattern : in String); -- Execute the installation rules and collect the resources to be written -- in the context. procedure Execute (Installer : in out Installer_Type; Context : in out Context_Type'Class); -- Clear the rules and files that have been loaded. procedure Clear (Installer : in out Installer_Type); private type Directory_List; type Directory_List_Access is access all Directory_List; -- A `File_Record` refers to a source file that must be processed by a resource -- rule. It is linked to the directory which contains it through the `Dir` member. -- The `Name` refers to the file name part. type File_Record (Length : Natural) is record Dir : Directory_List_Access; Name : String (1 .. Length); end record; package File_Record_Vectors is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => File_Record); subtype File_Vector is File_Record_Vectors.Vector; subtype File_Cursor is File_Record_Vectors.Cursor; -- Get the first source path from the list. function Get_Source_Path (From : in File_Vector; Use_First_File : in Boolean := False) return String; -- The file tree represents the target distribution tree that must be built. -- Each key represent a target file and it is associated with a `File_Vector` which -- represents the list of source files that must be used to build the target. package File_Tree is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => String, Element_Type => File_Vector, "<" => "<", "=" => File_Record_Vectors."="); package Directory_List_Vector is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Directory_List_Access); -- The `Directory_List` describes the content of a source directory. type Directory_List (Length : Positive; Path_Length : Natural) is record Files : File_Record_Vectors.Vector; Directories : Directory_List_Vector.Vector; Rel_Pos : Positive := 1; Name : String (1 .. Length); Path : String (1 .. Path_Length); end record; -- Get the relative path of the directory. function Get_Relative_Path (Dir : in Directory_List) return String; -- Strip the base part of the path function Get_Strip_Path (Base : in String; Path : in String) return String; -- Build a regular expression pattern from a pattern string. function Make_Regexp (Pattern : in String) return String; -- Build a regular expression pattern from a pattern string. function Make_Regexp (Pattern : in String) return GNAT.Regpat.Pattern_Matcher; -- Scan the directory whose root path is `Path` and with the relative path -- `Rel_Path` and build in `Dir` the list of files and directories. procedure Scan (Path : in String; Rel_Path : in String; Dir : in Directory_List_Access); type Match_Rule is record Base_Dir : Ada.Strings.Unbounded.Unbounded_String; Match : Ada.Strings.Unbounded.Unbounded_String; end record; package Match_Rule_Vector is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Match_Rule); -- ------------------------------ -- Distribution rule -- ------------------------------ -- The <b>Distrib_Rule</b> represents a distribution rule that must be executed on -- a given file or set of files. type Distrib_Rule is abstract tagged record Dir : Ada.Strings.Unbounded.Unbounded_String; Resource : Are.Resource_Access; Matches : Match_Rule_Vector.Vector; Excludes : Match_Rule_Vector.Vector; Files : File_Tree.Map; Level : Util.Log.Level_Type := Util.Log.DEBUG_LEVEL; Strip_Extension : Boolean := False; Source_Timestamp : Boolean := False; end record; type Distrib_Rule_Access is access all Distrib_Rule'Class; -- Get a name to qualify the installation rule (used for logs). function Get_Install_Name (Rule : in Distrib_Rule) return String is abstract; -- Install the file <b>File</b> according to the distribution rule. procedure Install (Rule : in Distrib_Rule; Target : in String; File : in File_Vector; Context : in out Context_Type'Class) is abstract; -- Scan the directory tree whose root is defined by <b>Dir</b> and find the files -- that match the current rule. procedure Scan (Rule : in out Distrib_Rule; Dir : in Directory_List); procedure Scan (Rule : in out Distrib_Rule; Dir : in Directory_List; Base_Dir : in String; Pattern : in String; Exclude : in Boolean); procedure Execute (Rule : in out Distrib_Rule; Context : in out Context_Type'Class); -- Get the target path associate with the given source file for the distribution rule. function Get_Target_Path (Rule : in Distrib_Rule; Base : in String; File : in File_Record) return String; -- Get the source path of the file. function Get_Source_Path (Rule : in Distrib_Rule; File : in File_Record) return String; -- Get the path that must be exported by the rule. function Get_Export_Path (Rule : in Distrib_Rule; Path : in String) return String; -- Add the file to be processed by the distribution rule. The file has a relative -- path represented by <b>Path</b>. The path is relative from the base directory -- specified in <b>Base_Dir</b>. procedure Add_Source_File (Rule : in out Distrib_Rule; Path : in String; File : in File_Record); -- Remove the file to be processed by the distribution rule. This is the opposite of -- <tt>Add_Source_File</tt> and used for the <exclude name="xxx"/> rules. procedure Remove_Source_File (Rule : in out Distrib_Rule; Path : in String; File : in File_Record); -- Load and add the file in the resource library. procedure Add_File (Rule : in Distrib_Rule; Name : in String; Path : in String; Modtime : in Ada.Calendar.Time; Override : in Boolean := False); -- Create a resource rule identified by `Kind`. -- The resource rule is configured according to the DOM tree whose node is `Node`. function Create_Rule (Kind : in String; Node : in DOM.Core.Node) return Distrib_Rule_Access; -- A list of rules that define how to build the distribution. package Distrib_Rule_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Distrib_Rule_Access); type Installer_Type is limited new Ada.Finalization.Limited_Controlled with record Rules : Distrib_Rule_Vectors.Vector; Trees : Directory_List_Vector.Vector; end record; procedure Delete (Directory : in out Directory_List_Access); overriding procedure Finalize (Installer : in out Installer_Type); end Are.Installer;
with HAL; use HAL; with HiFive1.LEDs; use HiFive1.LEDs; with FE310; with FE310.CLINT; with FE310.Time; use FE310.Time; with Interfaces; use Interfaces; with IO; with SPARKNaCl; use SPARKNaCl; with SPARKNaCl.Cryptobox; use SPARKNaCl.Cryptobox; with SPARKNaCl.Stream; with TweetNaCl_API; with RISCV.CSR; use RISCV.CSR; procedure TBox is subtype U64 is Unsigned_64; -- AlicePK : constant Public_Key := -- Construct ((16#85#, 16#20#, 16#f0#, 16#09#, -- 16#89#, 16#30#, 16#a7#, 16#54#, -- 16#74#, 16#8b#, 16#7d#, 16#dc#, -- 16#b4#, 16#3e#, 16#f7#, 16#5a#, -- 16#0d#, 16#bf#, 16#3a#, 16#0d#, -- 16#26#, 16#38#, 16#1a#, 16#f4#, -- 16#eb#, 16#a4#, 16#a9#, 16#8e#, -- 16#aa#, 16#9b#, 16#4e#, 16#6a#)); AliceSK : constant Secret_Key := Construct ((16#77#, 16#07#, 16#6d#, 16#0a#, 16#73#, 16#18#, 16#a5#, 16#7d#, 16#3c#, 16#16#, 16#c1#, 16#72#, 16#51#, 16#b2#, 16#66#, 16#45#, 16#df#, 16#4c#, 16#2f#, 16#87#, 16#eb#, 16#c0#, 16#99#, 16#2a#, 16#b1#, 16#77#, 16#fb#, 16#a5#, 16#1d#, 16#b9#, 16#2c#, 16#2a#)); BobPK : constant Public_Key := Construct ((16#de#, 16#9e#, 16#db#, 16#7d#, 16#7b#, 16#7d#, 16#c1#, 16#b4#, 16#d3#, 16#5b#, 16#61#, 16#c2#, 16#ec#, 16#e4#, 16#35#, 16#37#, 16#3f#, 16#83#, 16#43#, 16#c8#, 16#5b#, 16#78#, 16#67#, 16#4d#, 16#ad#, 16#fc#, 16#7e#, 16#14#, 16#6f#, 16#88#, 16#2b#, 16#4f#)); -- BobSK : constant Secret_Key := -- Construct ((16#5d#, 16#ab#, 16#08#, 16#7e#, -- 16#62#, 16#4a#, 16#8a#, 16#4b#, -- 16#79#, 16#e1#, 16#7f#, 16#8b#, -- 16#83#, 16#80#, 16#0e#, 16#e6#, -- 16#6f#, 16#3b#, 16#b1#, 16#29#, -- 16#26#, 16#18#, 16#b6#, 16#fd#, -- 16#1c#, 16#2f#, 16#8b#, 16#27#, -- 16#ff#, 16#88#, 16#e0#, 16#eb#)); Nonce : constant Stream.HSalsa20_Nonce := (16#69#, 16#69#, 16#6e#, 16#e9#, 16#55#, 16#b6#, 16#2b#, 16#73#, 16#cd#, 16#62#, 16#bd#, 16#a8#, 16#75#, 16#fc#, 16#73#, 16#d6#, 16#82#, 16#19#, 16#e0#, 16#03#, 16#6b#, 16#7a#, 16#0b#, 16#37#); M : constant Byte_Seq (0 .. 162) := (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16#be#, 16#07#, 16#5f#, 16#c5#, 16#3c#, 16#81#, 16#f2#, 16#d5#, 16#cf#, 16#14#, 16#13#, 16#16#, 16#eb#, 16#eb#, 16#0c#, 16#7b#, 16#52#, 16#28#, 16#c5#, 16#2a#, 16#4c#, 16#62#, 16#cb#, 16#d4#, 16#4b#, 16#66#, 16#84#, 16#9b#, 16#64#, 16#24#, 16#4f#, 16#fc#, 16#e5#, 16#ec#, 16#ba#, 16#af#, 16#33#, 16#bd#, 16#75#, 16#1a#, 16#1a#, 16#c7#, 16#28#, 16#d4#, 16#5e#, 16#6c#, 16#61#, 16#29#, 16#6c#, 16#dc#, 16#3c#, 16#01#, 16#23#, 16#35#, 16#61#, 16#f4#, 16#1d#, 16#b6#, 16#6c#, 16#ce#, 16#31#, 16#4a#, 16#db#, 16#31#, 16#0e#, 16#3b#, 16#e8#, 16#25#, 16#0c#, 16#46#, 16#f0#, 16#6d#, 16#ce#, 16#ea#, 16#3a#, 16#7f#, 16#a1#, 16#34#, 16#80#, 16#57#, 16#e2#, 16#f6#, 16#55#, 16#6a#, 16#d6#, 16#b1#, 16#31#, 16#8a#, 16#02#, 16#4a#, 16#83#, 16#8f#, 16#21#, 16#af#, 16#1f#, 16#de#, 16#04#, 16#89#, 16#77#, 16#eb#, 16#48#, 16#f5#, 16#9f#, 16#fd#, 16#49#, 16#24#, 16#ca#, 16#1c#, 16#60#, 16#90#, 16#2e#, 16#52#, 16#f0#, 16#a0#, 16#89#, 16#bc#, 16#76#, 16#89#, 16#70#, 16#40#, 16#e0#, 16#82#, 16#f9#, 16#37#, 16#76#, 16#38#, 16#48#, 16#64#, 16#5e#, 16#07#, 16#05#); C1 : Byte_Seq (0 .. 162); C2 : Byte_Seq (0 .. 162); Status : Boolean; T1, T2 : UInt64; Total_Time : Unsigned_64; CPU_Hz1, CPU_Hz2 : UInt32; procedure Report; procedure Tweet_Cryptobox (C : out Byte_Seq; Status : out Boolean; M : in Byte_Seq; N : in Stream.HSalsa20_Nonce; Recipient_PK : in Public_Key; Sender_SK : in Secret_Key); procedure Tweet_Cryptobox (C : out Byte_Seq; Status : out Boolean; M : in Byte_Seq; N : in Stream.HSalsa20_Nonce; Recipient_PK : in Public_Key; Sender_SK : in Secret_Key) is begin TweetNaCl_API.Crypto_Box (C, M, M'Length, N, Recipient_PK, Sender_SK); Status := True; end Tweet_Cryptobox; procedure Report is begin IO.Put ("Total: "); IO.Put (UInt64 (Total_Time)); IO.Put_Line (" cycles"); end Report; begin CPU_Hz1 := FE310.CPU_Frequency; -- The SPI flash clock divider should be as small as possible to increase -- the execution speed of instructions that are not yet in the instruction -- cache. FE310.Set_SPI_Flash_Clock_Divider (2); -- Load the internal oscillator factory calibration to be sure it -- oscillates at a known frequency. FE310.Load_Internal_Oscilator_Calibration; -- Use the HiFive1 16 MHz crystal oscillator which is more acurate than the -- internal oscillator. FE310.Use_Crystal_Oscillator; HiFive1.LEDs.Initialize; CPU_Hz2 := FE310.CPU_Frequency; IO.Put_Line ("CPU Frequency reset was: ", U64 (CPU_Hz1)); IO.Put_Line ("CPU Frequency now is: ", U64 (CPU_Hz2)); Turn_On (Red_LED); T1 := FE310.CLINT.Machine_Time; T2 := FE310.CLINT.Machine_Time; IO.Put_Line ("Null timing test:", U64 (T2 - T1)); T1 := Mcycle.Read; Delay_S (1); T2 := Mcycle.Read; IO.Put_Line ("One second test (CYCLE): ", U64 (T2 - T1)); T1 := Minstret.Read; Delay_S (1); T2 := Minstret.Read; IO.Put_Line ("One second test (INSTRET):", U64 (T2 - T1)); T1 := FE310.CLINT.Machine_Time; Delay_S (1); T2 := FE310.CLINT.Machine_Time; IO.Put_Line ("One second test (CLINT): ", U64 (T2 - T1)); IO.Put_Line ("SPARKNaCl.Cryptobox.Create test"); T1 := Mcycle.Read; SPARKNaCl.Cryptobox.Create (C1, Status, M, Nonce, BobPK, AliceSK); T2 := Mcycle.Read; Total_Time := Unsigned_64 (T2 - T1); Report; Turn_Off (Red_LED); Turn_On (Green_LED); IO.New_Line; IO.Put_Line ("TweetNaCl.Cryptobox test"); TweetNaCl_API.Reset; T1 := Mcycle.Read; Tweet_Cryptobox (C2, Status, M, Nonce, BobPK, AliceSK); T2 := Mcycle.Read; Total_Time := Unsigned_64 (T2 - T1); Report; if C1 = C2 then IO.Put_Line ("Pass"); else IO.Put_Line ("Fail"); end if; Turn_Off (Green_LED); -- Blinky! loop Turn_On (Red_LED); Delay_S (1); Turn_Off (Red_LED); Turn_On (Green_LED); Delay_S (1); Turn_Off (Green_LED); Turn_On (Blue_LED); Delay_S (1); Turn_Off (Blue_LED); end loop; end TBox;
----------------------------------------------------------------------- -- servlet-server -- Servlet Server -- Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016, 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.Finalization; with Ada.Strings.Unbounded; with Servlet.Requests; with Servlet.Responses; with Servlet.Core; package Servlet.Server is subtype Port_Number is Natural range 0 .. 65535; type Configuration is record Listening_Port : Port_Number := 8080; Max_Connection : Positive := 5; Buffer_Size : Positive := 128 * 1024; Accept_Queue_Size : Positive := 63; Upload_Size_Limit : Positive := 16#500_000#; Input_Line_Size_Limit : Positive := 16#4000#; Reuse_Address : Boolean := True; TCP_No_Delay : Boolean := False; Upload_Directory : Ada.Strings.Unbounded.Unbounded_String; end record; type Container is tagged limited private; -- Register the application to serve requests procedure Register_Application (Server : in out Container; URI : in String; Context : in Core.Servlet_Registry_Access); -- Remove the application procedure Remove_Application (Server : in out Container; Context : in Core.Servlet_Registry_Access); -- Configure the server before starting it. procedure Configure (Server : in out Container; Config : in Configuration) is null; -- Start the applications that have been registered. procedure Start (Server : in out Container); -- Receives standard HTTP requests from the public service method and -- dispatches them to the Do_XXX methods defined in this class. This method -- is an HTTP-specific version of the Servlet.service(Request, Response) -- method. There's no need to override this method. procedure Service (Server : in Container; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class); -- Get the current registry associated with the current request being processed -- by the current thread. Returns null if there is no current request. function Current return Core.Servlet_Registry_Access; -- Set the current registry (for unit testing mostly). procedure Set_Context (Context : in Core.Servlet_Registry_Access); -- Give access to the current request and response object to the `Process` -- procedure. If there is no current request for the thread, do nothing. procedure Update_Context (Process : not null access procedure (Request : in out Requests.Request'Class; Response : in out Responses.Response'Class)); -- Iterate over the application which are registered. procedure Iterate (Server : in Container; Process : not null access procedure (URI : in String; Context : in Core.Servlet_Registry_Access)); private -- Binding to record the Servlet applications and bind them to URI prefixes. -- It is expected that the number of Servlet applications is small -- (1-10 per server). type Binding (Len : Natural) is record Context : Core.Servlet_Registry_Access; Base_URI : String (1 .. Len); end record; type Binding_Access is access all Binding; type Binding_Array is array (Natural range <>) of Binding_Access; type Binding_Array_Access is access all Binding_Array; type Container is new Ada.Finalization.Limited_Controlled with record Nb_Bindings : Natural := 0; Applications : Binding_Array_Access := null; Default : Core.Servlet_Registry; Is_Started : Boolean := False; end record; type Request_Context is record Application : Core.Servlet_Registry_Access; Request : Requests.Request_Access; Response : Responses.Response_Access; end record; -- Set the current registry. This is called by `Service` once the -- registry is identified from the URI. procedure Set_Context (Context : in Request_Context); -- Release the storage. overriding procedure Finalize (Server : in out Container); end Servlet.Server;
with RP.ROM; pragma Unreferenced (RP.ROM); package Runtime is -- crt0.S expects this symbol to exist. It is called after main returns. procedure OS_Exit (Status : Integer) with Export => True, Convention => C, External_Name => "exit"; procedure HardFault_Handler with Export => True, Convention => C, External_Name => "isr_hardfault"; end Runtime;
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; with System; private package CUPS.cups_pwg_h is -- arg-macro: function PWG_FROM_POINTS (int)(((n) * 2540 + 36) / 72 -- return int)(((n) * 2540 + 36) / 72; -- arg-macro: function PWG_TO_POINTS ((n) * 72.0 / 2540.0 -- return (n) * 72.0 / 2540.0; -- * "$Id: pwg.h 4274 2013-04-09 20:10:23Z msweet $" -- * -- * PWG media API definitions for CUPS. -- * -- * Copyright 2009-2013 by Apple Inc. -- * -- * These coded instructions, statements, and computer programs are the -- * property of Apple Inc. and are protected by Federal copyright -- * law. Distribution and use rights are outlined in the file "LICENSE.txt" -- * which should have been included with this file. If this file is -- * file is missing or damaged, see the license at "http://www.cups.org/". -- * -- * This file is subject to the Apple OS-Developed Software exception. -- -- * C++ magic... -- -- * Macros... -- -- Convert from points to hundredths of millimeters -- Convert from hundredths of millimeters to points -- * Types and structures... -- --*** Map element - PPD to/from PWG -- PWG media keyword type pwg_map_s is record pwg : Interfaces.C.Strings.chars_ptr; -- cups/pwg.h:46 ppd : Interfaces.C.Strings.chars_ptr; -- cups/pwg.h:47 end record; pragma Convention (C_Pass_By_Copy, pwg_map_s); -- cups/pwg.h:44 -- PPD option keyword subtype pwg_map_t is pwg_map_s; --*** Common media size data *** -- PWG 5101.1 "self describing" name type pwg_media_s is record pwg : Interfaces.C.Strings.chars_ptr; -- cups/pwg.h:52 legacy : Interfaces.C.Strings.chars_ptr; -- cups/pwg.h:53 ppd : Interfaces.C.Strings.chars_ptr; -- cups/pwg.h:54 width : aliased int; -- cups/pwg.h:55 length : aliased int; -- cups/pwg.h:56 end record; pragma Convention (C_Pass_By_Copy, pwg_media_s); -- cups/pwg.h:50 -- IPP/ISO legacy name -- Standard Adobe PPD name -- Width in 2540ths -- Length in 2540ths subtype pwg_media_t is pwg_media_s; --*** Size element - PPD to/from PWG -- Map element type pwg_size_s is record map : aliased pwg_map_t; -- cups/pwg.h:61 width : aliased int; -- cups/pwg.h:62 length : aliased int; -- cups/pwg.h:63 left : aliased int; -- cups/pwg.h:64 bottom : aliased int; -- cups/pwg.h:65 right : aliased int; -- cups/pwg.h:66 top : aliased int; -- cups/pwg.h:67 end record; pragma Convention (C_Pass_By_Copy, pwg_size_s); -- cups/pwg.h:59 -- Width in 2540ths -- Length in 2540ths -- Left margin in 2540ths -- Bottom margin in 2540ths -- Right margin in 2540ths -- Top margin in 2540ths subtype pwg_size_t is pwg_size_s; -- * Functions... -- -- * "$Id: pwg.h 4274 2013-04-09 20:10:23Z msweet $" -- * -- * PWG media API definitions for CUPS. -- * -- * Copyright 2009-2013 by Apple Inc. -- * -- * These coded instructions, statements, and computer programs are the -- * property of Apple Inc. and are protected by Federal copyright -- * law. Distribution and use rights are outlined in the file "LICENSE.txt" -- * which should have been included with this file. If this file is -- * file is missing or damaged, see the license at "http://www.cups.org/". -- * -- * This file is subject to the Apple OS-Developed Software exception. -- function pwgFormatSizeName (keyword : Interfaces.C.Strings.chars_ptr; keysize : size_t; prefix : Interfaces.C.Strings.chars_ptr; name : Interfaces.C.Strings.chars_ptr; width : int; length : int; units : Interfaces.C.Strings.chars_ptr) return int; -- cups/pwg.h:75 pragma Import (C, pwgFormatSizeName, "pwgFormatSizeName"); function pwgInitSize (size : access pwg_size_t; job : System.Address; margins_set : access int) return int; -- cups/pwg.h:79 pragma Import (C, pwgInitSize, "pwgInitSize"); function pwgMediaForLegacy (legacy : Interfaces.C.Strings.chars_ptr) return access pwg_media_t; -- cups/pwg.h:81 pragma Import (C, pwgMediaForLegacy, "pwgMediaForLegacy"); function pwgMediaForPPD (ppd : Interfaces.C.Strings.chars_ptr) return access pwg_media_t; -- cups/pwg.h:82 pragma Import (C, pwgMediaForPPD, "pwgMediaForPPD"); function pwgMediaForPWG (pwg : Interfaces.C.Strings.chars_ptr) return access pwg_media_t; -- cups/pwg.h:83 pragma Import (C, pwgMediaForPWG, "pwgMediaForPWG"); function pwgMediaForSize (width : int; length : int) return access pwg_media_t; -- cups/pwg.h:84 pragma Import (C, pwgMediaForSize, "pwgMediaForSize"); end CUPS.cups_pwg_h;
----------------------------------------------------------------------- -- awa-users -- Users module -- Copyright (C) 2009, 2010, 2011, 2015, 2018, 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. ----------------------------------------------------------------------- -- = Users Module = -- The `users` module manages the creation, update, removal and authentication -- of users in an application. The module provides the foundations for user -- management in a web application. -- -- A user can register himself by using a subscription form. In that case, -- a verification mail is sent and the user has to follow the verification -- link defined in the mail to finish the registration process. The user -- will authenticate using a password. -- -- A user can also use an OAuth/OpenID account and be automatically authentified -- and registered to the application. By using an external authentication -- server, passwords are not stored in the application. -- -- A user can have one or several permissions that allow to protect the -- application data. User permissions are managed by the `Permissions.Module`. -- -- @include awa-users-modules.ads -- @include awa-users-servlets.ads -- -- == Configuration == -- The *users* module uses a set of configuration properties to configure -- the OpenID integration. -- -- @include-config users.xml -- -- @include awa-users-beans.ads -- -- == Data model == -- [images/awa_users_model.png] -- package AWA.Users is pragma Preelaborate; end AWA.Users;
with Ada.Characters.Handling; with DOM.Core.Elements; with LMCP_Message_Conversions; with Common; use Common; with UxAS.Messages.lmcptask.AssignmentCostMatrix; use UxAS.Messages.lmcptask.AssignmentCostMatrix; with UxAS.Messages.lmcptask.TaskPlanOptions; use UxAS.Messages.lmcptask.TaskPlanOptions; with UxAS.Messages.lmcptask.UniqueAutomationRequest; use UxAS.Messages.lmcptask.UniqueAutomationRequest; package body UxAS.Comms.LMCP_Net_Client.Service.Assignment_Tree_Branch_Bounding is ----------------------- -- Local subprograms -- ----------------------- procedure Handle_AssignmentCostMatrix_Msg (This : in out Assignment_Tree_Branch_Bound_Service; Msg : AssignmentCostMatrix_Any); procedure Handle_TaskPlanOptions_Msg (This : in out Assignment_Tree_Branch_Bound_Service; Msg : TaskPlanOptions_Any); procedure Handle_UniqueAutomationRequest_Msg (This : in out Assignment_Tree_Branch_Bound_Service; Msg : UniqueAutomationRequest_Any); function Int64_Attribute (XML_Node : DOM.Core.Element; Name : String; Default : Common.Int64) return Common.Int64; --------------- -- Configure -- --------------- overriding procedure Configure (This : in out Assignment_Tree_Branch_Bound_Service; XML_Node : DOM.Core.Element; Result : out Boolean) is Unused : Boolean; begin declare Attr_Value : constant String := DOM.Core.Elements.Get_Attribute (XML_Node, Name => "CostFunction"); use Ada.Characters.Handling; begin if Attr_Value = "" then This.Config.Cost_Function := Minmax; -- CostFunction is an optional parameter elsif To_Lower (Attr_Value) = "minmax" then This.Config.Cost_Function := Minmax; elsif To_Lower (Attr_Value) = "cumulative" then This.Config.Cost_Function := Cumulative; else -- malformed value Result := False; return; end if; end; This.Config.Number_Nodes_Maximum := Int64_Attribute (XML_Node, "NumberNodesMaximum", Default => This.Config.Number_Nodes_Maximum); This.Config.Number_Nodes_Maximum := Common.Int64'Max (0, This.Config.Number_Nodes_Maximum); This.Add_Subscription_Address (UxAS.Messages.lmcptask.AssignmentCostMatrix.Subscription, Unused); This.Add_Subscription_Address (UxAS.Messages.lmcptask.TaskPlanOptions.Subscription, Unused); This.Add_Subscription_Address (UxAS.Messages.lmcptask.UniqueAutomationRequest.Subscription, Unused); Result := True; end Configure; ------------ -- Create -- ------------ function Create return Any_Service is Result : Any_Service; begin Result := new Assignment_Tree_Branch_Bound_Service; Result.Construct_Service (Service_Type => Type_Name, Work_Directory_Name => Directory_Name); return Result; end Create; ------------------------------------- -- Handle_AssignmentCostMatrix_Msg -- ------------------------------------- procedure Handle_AssignmentCostMatrix_Msg (This : in out Assignment_Tree_Branch_Bound_Service; Msg : AssignmentCostMatrix_Any) is begin Assignment_Tree_Branch_Bound.Handle_Assignment_Cost_Matrix (This.Mailbox, This.Config, This.State, LMCP_Message_Conversions.As_AssignmentCostMatrix_Message (Msg)); end Handle_AssignmentCostMatrix_Msg; -------------------------------- -- Handle_TaskPlanOptions_Msg -- -------------------------------- procedure Handle_TaskPlanOptions_Msg (This : in out Assignment_Tree_Branch_Bound_Service; Msg : TaskPlanOptions_Any) is begin Assignment_Tree_Branch_Bound.Handle_Task_Plan_Options (This.Mailbox, This.Config, This.State, LMCP_Message_Conversions.As_TaskPlanOption_Message (Msg)); end Handle_TaskPlanOptions_Msg; ---------------------------------------- -- Handle_UniqueAutomationRequest_Msg -- ---------------------------------------- procedure Handle_UniqueAutomationRequest_Msg (This : in out Assignment_Tree_Branch_Bound_Service; Msg : UniqueAutomationRequest_Any) is begin Assignment_Tree_Branch_Bound.Handle_Unique_Automation_Request (This.Mailbox, This.Config, This.State, LMCP_Message_Conversions.As_UniqueAutomationRequest_Message (Msg)); end Handle_UniqueAutomationRequest_Msg; ---------------- -- Initialize -- ---------------- overriding procedure Initialize (This : in out Assignment_Tree_Branch_Bound_Service; Result : out Boolean) is begin Result := True; -- per the C++ version Assignment_Tree_Branch_Bound_Communication.Initialize (This.Mailbox, Source_Group => Value (This.Message_Source_Group), Unique_Id => Common.Int64 (UxAS.Comms.LMCP_Net_Client.Unique_Entity_Send_Message_Id), Entity_Id => Common.UInt32 (This.Entity_Id), Service_Id => Common.UInt32 (This.Network_Id)); end Initialize; --------------------- -- Int64_Attribute -- --------------------- function Int64_Attribute (XML_Node : DOM.Core.Element; Name : String; Default : Common.Int64) return Common.Int64 is use DOM.Core; Attr_Value : constant DOM_String := Elements.Get_Attribute (XML_Node, Name); begin if Attr_Value /= "" and then (for all C of Attr_Value => C in '0' .. '9') then return Common.Int64'Value (Attr_Value); else return Default; end if; end Int64_Attribute; ----------------------------------- -- Process_Received_LMCP_Message -- ----------------------------------- overriding procedure Process_Received_LMCP_Message (This : in out Assignment_Tree_Branch_Bound_Service; Received_Message : not null Any_LMCP_Message; Should_Terminate : out Boolean) is begin if Received_Message.Payload.all in UxAS.Messages.lmcptask.UniqueAutomationRequest.UniqueAutomationRequest'Class then This.Handle_UniqueAutomationRequest_Msg (UniqueAutomationRequest_Any (Received_Message.Payload)); elsif Received_Message.Payload.all in TaskPlanOptions'Class then This.Handle_TaskPlanOptions_Msg (TaskPlanOptions_Any (Received_Message.Payload)); elsif Received_Message.Payload.all in AssignmentCostMatrix'Class then This.Handle_AssignmentCostMatrix_Msg (AssignmentCostMatrix_Any (Received_Message.Payload)); end if; Should_Terminate := False; end Process_Received_LMCP_Message; --------------------------------- -- Registry_Service_Type_Names -- --------------------------------- function Registry_Service_Type_Names return Service_Type_Names_List is (Service_Type_Names_List'(1 => Instance (Service_Type_Name_Max_Length, Content => Type_Name))); begin -- All concrete service subclasses must call this procedure in their -- own package like this, with their own params. Register_Service_Creation_Function_Pointers (Registry_Service_Type_Names, Create'Access); end UxAS.Comms.LMCP_Net_Client.Service.Assignment_Tree_Branch_Bounding;
------------------------------------------------------------------------------ -- -- -- Unicode Utilities -- -- UTF-8 Stream Decoder -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Rationale -- ========= -- -- The language-defined package Ada.Strings.UTF_Encoding generally requires a -- complete String type of a UTF-8 encoded octet string (UTF_8_String). In -- streaming applications with potentially very large sizes (such as a JSON -- object, or a program source), the UTF_8_String passed to Decode will often -- need to be chunked off the larger stream. This chunking must be aware enough -- of UTF-8 to properly ensure that each (potentially multi-byte) encoded -- character placed into that buffer is not truncated. -- -- This package handles the inline processing of streams or arbitrarily-sized -- buffers, where such chunking would otherwise be required to use the -- predefined packages. -- -- This package is specifically designed for use in high-volume, high-integrity -- server environments. The binary decoding codec is fully verified. -- -- For encoding to UTF-8, the language-defined package should be sufficient, -- due to the lack of synchronization issues with the source data. with Ada.Streams; package Unicode.UTF8_Stream_Decoder with Pure is pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8); -- This is important for ensuring that Decode_Next will not have either -- constant Synchronization_Errors or dropped characters in the very -- unlikely event that Stream_Element is not an octet Insufficient_Width: exception; Short_Buffer : exception; -- Ada Stream Decoder ------------------------------------------------------ subtype Root_Stream_Type is Ada.Streams.Root_Stream_Type; function Decode_Next (UTF8_Stream: not null access Root_Stream_Type'Class) return Character; function Decode_Next (UTF8_Stream: not null access Root_Stream_Type'Class) return Wide_Character; function Decode_Next (UTF8_Stream: not null access Root_Stream_Type'Class) return Wide_Wide_Character; -- Attempts to decode a UTF-8 byte sequence from UTF8_Stream, and returns -- the corresponding Character type. -- -- The Unicode standard provides a specific 'REPLACEMENT CHARACTER' (U+FFFD) -- for use in error conditions when decoding. Decode_Next will return a -- single replacement character for each invalid octet (byte) it encounters. -- -- For the overload returning Character, this replacement character will -- induce an Insufficient_Width exception (see below). -- -- Any invalid actual encoding (invalid Unicode codepoints) are always -- returned as 'REPLACEMENT CHARACTER'. Insufficient_Width only applies -- to returns to Character or Wide_Character. -- -- Where possible a 'REPLACEMENT CHARACTER' will correspond to an entire -- sequence (maximum of 4 octets). Where the leading byte is not valid -- or allowed in UTF-8, the 'REPLACEMENT CHARACTER' corresponds to that -- single octet. -- -- Any invalid sequences as per IETF STD63/RFC3629 (UTF-8) are resolved as -- a 'REPLACEMENT CHARACTER'. This includes -- * Octets that shall never appear in UTF-8 text (Section 1): -- (16#C0#, 16#C1#, 16#F5# .. 16#FF#) -- * Codepoints that are reserved for UTF-16 "surrogate pairs" (Section 3): -- (U+D800 .. U+DFFF) -- -- Any "Noncharacter" codepoints in Unicode are resolved as a 'REPLACEMENT -- CHARACTER', in accordance with Unicode Corrigendum #9 (2013-Jan-30). -- These codepoints are for internal use only and should not be interchanged -- As Ada natively supports Wide_Wide_Character/Strings, UTF-8 encodoing/ -- decoding is not expected to be used internally. -- -- Unicode defines "Noncharacter" codepoints as being: -- * U+nFFFE, U+nFFFF -- * U+FDD0 .. U+FDEF -- -- Any exceptions raised by attempts to read from UTF8_Stream are -- propagated. -- -- -- Explicit Raises -- -- * Insufficient_Width: (Character and Wide_Character returns only) -- Raised if the next character encoded in the UTF-8 -- stream is out of range of the return character -- type. -- -- The Wide_Wide_Character overload will never raise -- this exception. -- -- -- Warning: Character return type -- -- If the stream has any errors, which are -- normally replaced with 'REPLACEMENT CHARACTER' -- (U+FFFD), this exception will be raised instead, -- since -- High-efficiency Buffer Decoder ------------------------------------------ -- The internal decode codec is fully verified as far as possible, and so -- relevant checks have been disabled. Using buffer decoding allows for the -- fastest possible processing. use type Ada.Streams.Stream_Element; use type Ada.Streams.Stream_Element_Offset; use type Ada.Streams.Stream_Element_Count; use type Ada.Streams.Stream_Element_Array; subtype Stream_Element is Ada.Streams.Stream_Element; subtype Stream_Element_Offset is Ada.Streams.Stream_Element_Offset; subtype Stream_Element_Count is Ada.Streams.Stream_Element_Count; subtype Stream_Element_Array is Ada.Streams.Stream_Element_Array; procedure Decode_Next (Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Result : out Character); procedure Decode_Next (Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Result : out Wide_Character); procedure Decode_Next (Buffer : in Stream_Element_Array; Last : out Stream_Element_Offset; Result : out Wide_Wide_Character); -- Attempts to decode a UTF-8 byte sequence from Buffer, and returns -- the corresponding Character type. -- -- The Unicode standard provides a specific 'REPLACEMENT CHARACTER' (U+FFFD) -- for use in error conditions when decoding. Decode_Next will return a -- single replacement character for each invalid octet (byte) it encounters. -- Last will be set to the index of that octet. -- -- For the overload returning Character, this replacement character will -- induce an Insufficient_Width exception (see below). -- -- Any invalid actual encoding (invalid Unicode codepoints) are always -- returned as 'REPLACEMENT CHARACTER'. Insufficient_Width only applies -- to returns to Character or Wide_Character. -- -- Where possible a 'REPLACEMENT CHARACTER' will correspond to an entire -- sequence (maximum of 4 octets). Where the leading byte is not valid -- or allowed in UTF-8, the 'REPLACEMENT CHARACTER' corresponds to that -- single octet. -- -- Any invalid sequences as per IETF STD63/RFC3629 (UTF-8) are resolved as -- a 'REPLACEMENT CHARACTER'. This includes -- * Octets that shall never appear in UTF-8 text (Section 1): -- (16#C0#, 16#C1#, 16#F5# .. 16#FF#) -- * Codepoints that are reserved for UTF-16 "surrogate pairs" (Section 3): -- (U+D800 .. U+DFFF) -- -- Any "Noncharacter" codepoints in Unicode are resolved as a 'REPLACEMENT -- CHARACTER', in accordance with Unicode Corrigendum #9 (2013-Jan-30). -- These codepoints are for internal use only and should not be interchanged -- As Ada natively supports Wide_Wide_Character/Strings, UTF-8 encodoing/ -- decoding is not expected to be used internally. -- -- Any exceptions raised by attempts to read from UTF8_Stream are -- propagated. -- -- -- Explicit Raises -- -- * Insufficient_Width: (Character and Wide_Character returns only) -- Raised if the next character encoded in the buffer -- stream is out of range of the return character -- type. -- -- The Wide_Wide_Character overload will never raise -- this exception. -- -- -- Warning: Character return type -- -- If the stream has any errors, which are -- normally replaced with 'REPLACEMENT CHARACTER' -- (U+FFFD), this exception will be raised instead, -- since -- * Short_Buffer : Raised if Buffer'First indexes a byte that -- encodes a valid UTF-8 initial byte which also -- indicates more continuation bytes than exist -- in the remaining elements of Buffer end Unicode.UTF8_Stream_Decoder;
procedure Hello is procedure example is begin meow := meow + meow; end example; procedure bark ( top, tip : INTEGER ; abc :STRING) is a,b,c : ARRAY (1..5) of INTEGER; begin a(1):= 5; end bark; function foo return INTEGER is begin return 1; end example; function hi (hello:STRING) return FLOAT is begin return 1.0; end example; buf : INTEGER; ch : character; begin bark(5,5); example; buf:=hi("hello"&"abc"); for Iter in 1..5 loop if min = max then buf:=hi("hello"&'a'); elsif min < max then null; else null; end if; ch := 's'; end loop; end Hello;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A package can have one or more profile applications to indicate which -- profiles have been applied. Because a profile is a package, it is possible -- to apply a profile not only to packages, but also to profiles. -- -- Package specializes TemplateableElement and PackageableElement specializes -- ParameterableElement to specify that a package can be used as a template -- and a PackageableElement as a template parameter. -- -- A package is used to group elements, and provides a namespace for the -- grouped elements. ------------------------------------------------------------------------------ limited with AMF.UML.Named_Elements; with AMF.UML.Namespaces; limited with AMF.UML.Package_Merges.Collections; with AMF.UML.Packageable_Elements; limited with AMF.UML.Packageable_Elements.Collections; limited with AMF.UML.Packages.Collections; limited with AMF.UML.Profile_Applications.Collections; limited with AMF.UML.Profiles; limited with AMF.UML.Stereotypes.Collections; with AMF.UML.Templateable_Elements; limited with AMF.UML.Types.Collections; package AMF.UML.Packages is pragma Preelaborate; type UML_Package is limited interface and AMF.UML.Namespaces.UML_Namespace and AMF.UML.Packageable_Elements.UML_Packageable_Element and AMF.UML.Templateable_Elements.UML_Templateable_Element; type UML_Package_Access is access all UML_Package'Class; for UML_Package_Access'Storage_Size use 0; not overriding function Get_URI (Self : not null access constant UML_Package) return AMF.Optional_String is abstract; -- Getter of Package::URI. -- -- Provides an identifier for the package that can be used for many -- purposes. A URI is the universally unique identification of the package -- following the IETF URI specification, RFC 2396 -- http://www.ietf.org/rfc/rfc2396.txt and it must comply with those -- syntax rules. not overriding procedure Set_URI (Self : not null access UML_Package; To : AMF.Optional_String) is abstract; -- Setter of Package::URI. -- -- Provides an identifier for the package that can be used for many -- purposes. A URI is the universally unique identification of the package -- following the IETF URI specification, RFC 2396 -- http://www.ietf.org/rfc/rfc2396.txt and it must comply with those -- syntax rules. not overriding function Get_Nested_Package (Self : not null access constant UML_Package) return AMF.UML.Packages.Collections.Set_Of_UML_Package is abstract; -- Getter of Package::nestedPackage. -- -- References the packaged elements that are Packages. not overriding function Get_Nesting_Package (Self : not null access constant UML_Package) return AMF.UML.Packages.UML_Package_Access is abstract; -- Getter of Package::nestingPackage. -- -- References the Package that owns this Package. not overriding procedure Set_Nesting_Package (Self : not null access UML_Package; To : AMF.UML.Packages.UML_Package_Access) is abstract; -- Setter of Package::nestingPackage. -- -- References the Package that owns this Package. not overriding function Get_Owned_Stereotype (Self : not null access constant UML_Package) return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype is abstract; -- Getter of Package::ownedStereotype. -- -- References the Stereotypes that are owned by the Package not overriding function Get_Owned_Type (Self : not null access constant UML_Package) return AMF.UML.Types.Collections.Set_Of_UML_Type is abstract; -- Getter of Package::ownedType. -- -- References the packaged elements that are Types. not overriding function Get_Package_Merge (Self : not null access constant UML_Package) return AMF.UML.Package_Merges.Collections.Set_Of_UML_Package_Merge is abstract; -- Getter of Package::packageMerge. -- -- References the PackageMerges that are owned by this Package. not overriding function Get_Packaged_Element (Self : not null access constant UML_Package) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is abstract; -- Getter of Package::packagedElement. -- -- Specifies the packageable elements that are owned by this Package. not overriding function Get_Profile_Application (Self : not null access constant UML_Package) return AMF.UML.Profile_Applications.Collections.Set_Of_UML_Profile_Application is abstract; -- Getter of Package::profileApplication. -- -- References the ProfileApplications that indicate which profiles have -- been applied to the Package. not overriding function All_Applicable_Stereotypes (Self : not null access constant UML_Package) return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype is abstract; -- Operation Package::allApplicableStereotypes. -- -- The query allApplicableStereotypes() returns all the directly or -- indirectly owned stereotypes, including stereotypes contained in -- sub-profiles. not overriding function Containing_Profile (Self : not null access constant UML_Package) return AMF.UML.Profiles.UML_Profile_Access is abstract; -- Operation Package::containingProfile. -- -- The query containingProfile() returns the closest profile directly or -- indirectly containing this package (or this package itself, if it is a -- profile). not overriding function Makes_Visible (Self : not null access constant UML_Package; El : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean is abstract; -- Operation Package::makesVisible. -- -- The query makesVisible() defines whether a Package makes an element -- visible outside itself. Elements with no visibility and elements with -- public visibility are made visible. overriding function Must_Be_Owned (Self : not null access constant UML_Package) return Boolean is abstract; -- Operation Package::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. not overriding function Nested_Package (Self : not null access constant UML_Package) return AMF.UML.Packages.Collections.Set_Of_UML_Package is abstract; -- Operation Package::nestedPackage. -- -- Missing derivation for Package::/nestedPackage : Package not overriding function Owned_Stereotype (Self : not null access constant UML_Package) return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype is abstract; -- Operation Package::ownedStereotype. -- -- Missing derivation for Package::/ownedStereotype : Stereotype not overriding function Owned_Type (Self : not null access constant UML_Package) return AMF.UML.Types.Collections.Set_Of_UML_Type is abstract; -- Operation Package::ownedType. -- -- Missing derivation for Package::/ownedType : Type not overriding function Visible_Members (Self : not null access constant UML_Package) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is abstract; -- Operation Package::visibleMembers. -- -- The query visibleMembers() defines which members of a Package can be -- accessed outside it. end AMF.UML.Packages;
with Gtk.Window; use Gtk.Window; with Gtk.Box; use Gtk.Box; with Gtk.Drawing_Area; use Gtk.Drawing_Area; with Glib; use Glib; with Cairo; use Cairo; with Glib.Main; use Glib.Main; with Gdk.Window; use Gdk.Window; with Gtk.Handlers; use Gtk.Handlers; with Ada.Text_IO; use Ada.Text_IO; use Gdk; with Gtk.Widget; use Gtk.Widget; with Cairo.Image_Surface; use Cairo.Image_Surface; with Cairo.Surface; with Gdk.Event; use Gdk.Event; package body Screen_Interface is Width_Size : constant := Width'Last - Width'First + 1; Height_Size : constant := Height'Last - Height'First + 1; TS : Touch_State := (False, 0, 0); package Event_Cb is new Gtk.Handlers.Return_Callback (Gtk_Drawing_Area_Record, Boolean); Darea : Gtk_Drawing_Area; subtype Frame_Buffer_Array is ARGB32_Array (1 .. Natural (Width_Size * Height_Size)); -- We use a protected objet to synchonize access from GTK loop and the -- outside world. protected Frame_Buffer is procedure Set_Pixel (P : Point; Col : Color); procedure Fill_Screen (Col : Color); procedure Draw (Cr : Cairo_Context); procedure Initialize; private Buffer : aliased ARGB32_Array (0 .. (Width_Size * Height_Size) -1); Surface : Cairo_Surface; end Frame_Buffer; protected body Frame_Buffer is procedure Set_Pixel (P : Point; Col : Color) is begin Buffer (P.X + P.Y * Width_Size) := Col; end Set_Pixel; procedure Fill_Screen (Col : Color) is begin Buffer := (others => Col); end Fill_Screen; procedure Draw (Cr : Cairo_Context) is W : Gint := Darea.Get_Allocated_Width; H : Gint := Darea.Get_Allocated_Height; W_Ratio : Gdouble := Gdouble (W) / Gdouble (Width_Size); H_Ratio : Gdouble := Gdouble (H) / Gdouble (Height_Size); begin Cairo.Save (Cr); Cairo.Scale (Cr, W_Ratio, H_Ratio); Set_Source_Surface (Cr, Surface, 0.0, 0.0); Cairo.Paint (Cr); Cairo.Restore (Cr); end Draw; procedure Initialize is Stride : constant Gint := Cairo_Format_Stride_For_Width (Format => Cairo_Format_ARGB32, Width => Width_Size); begin Surface := Create_For_Data_Generic (Buffer (Buffer'First)'Address, Cairo_Format_ARGB32, Width_Size, Height_Size, Stride); end Initialize; end Frame_Buffer; ----------------- -- Window_Idle -- ----------------- function Window_Idle return Boolean is W, H : Gint; begin if Darea = null or else Get_Window (Darea) = null then return True; end if; W := Darea.Get_Allocated_Width; H := Darea.Get_Allocated_Height; Invalidate_Rect (Get_Window (Darea), (0, 0, W, H), Invalidate_Children => True); return True; end Window_Idle; function Redraw (Area : access Gtk_Drawing_Area_Record'Class; Cr : Cairo_Context) return Boolean is pragma Unreferenced (Area); begin if Darea = null or else Get_Window (Darea) = null then return True; end if; Frame_Buffer.Draw (Cr); return False; end Redraw; function On_Button (Self : access Gtk_Widget_Record'Class; Event : Gdk.Event.Gdk_Event_Button) return Boolean; function On_Button (Self : access Gtk_Widget_Record'Class; Event : Gdk.Event.Gdk_Event_Button) return Boolean is W : Gdouble := Gdouble (Darea.Get_Allocated_Width); H : Gdouble := Gdouble (Darea.Get_Allocated_Height); begin if Event.The_Type = Button_Press and then Event.Button = 1 then TS.X := Width ((Event.X / W) * Gdouble (Width_Size)); TS.Y := Height ((Event.Y / H) * Gdouble (Height_Size)); TS.Touch_Detected := True; elsif Event.The_Type = Button_Release and then Event.Button = 1 then TS := (False, 0, 0); end if; return False; exception when others => Put_Line ("On_Button exception"); TS.X := 0; TS.Y := 0; return False; end On_Button; function On_Motion (Self : access Gtk_Widget_Record'Class; Event : Gdk.Event.Gdk_Event_Motion) return Boolean is W : Gdouble := Gdouble (Darea.Get_Allocated_Width); H : Gdouble := Gdouble (Darea.Get_Allocated_Height); begin if TS.Touch_Detected then TS.X := Width ((Event.X / W) * Gdouble (Width_Size)); TS.Y := Height ((Event.Y / H) * Gdouble (Height_Size)); end if; return False; exception when others => Put_Line ("On Motion exception"); TS.X := 0; TS.Y := 0; return False; end On_Motion; procedure Initialize is Win : Gtk_Window; Box : Gtk_Vbox; Src_Id : G_Source_Id; pragma Unreferenced (Src_Id); begin Frame_Buffer.Initialize; Gtk_New (Win); Win.Set_Default_Size (Gint (Width'Last - Width'First + 1), Gint (Height'Last - Height'First + 1)); Win.Add_Events(Button_Release_Mask); Win.Add_Events(Button_Press_Mask); Win.Add_Events(Pointer_Motion_Mask); Win.Add_Events(Pointer_Motion_Hint_Mask); Win.On_Button_Press_Event (On_Button'Access, True); Win.On_Button_Release_Event (On_Button'Access, True); Win.On_Motion_Notify_Event (On_Motion'Access); Gtk_New_Vbox (Box); Gtk_New (Darea); Win.Add (Darea); Event_Cb.Connect (Darea, Signal_Draw, Event_Cb.To_Marshaller (Redraw'Unrestricted_Access)); -- Show the window Win.Show_All; Src_Id := Timeout_Add (100, Window_Idle'Access); end; function Get_Touch_State return Touch_State is begin delay 0.1; return TS; end; procedure Set_Pixel (P : Point; Col : Color) is begin Frame_Buffer.Set_Pixel (P, Col); end; procedure Fill_Screen (Col : Color) is begin Frame_Buffer.Fill_Screen (Col); end Fill_Screen; function RGB_To_Color (R, G, B : RGB_Value) return Color is Result : Color; begin Result.Red := Byte (R); Result.Green := Byte (G); Result.Blue := Byte (B); Result.Alpha := 255; return Result; end RGB_To_Color; end Screen_Interface;
with Ada.Unchecked_Conversion; with C.iconv; with C.string; package body iconv.Inside is use type C.unsigned_int; use type C.size_t; function Do_One ( namescount : C.unsigned_int; names : access C.char_const_ptr; data : C.void_ptr) return C.signed_int with Convention => C; function Do_One ( namescount : C.unsigned_int; names : access C.char_const_ptr; data : C.void_ptr) return C.signed_int is begin if namescount > 0 then declare type Process_Type is access procedure (Name : in String); function To_Process is new Ada.Unchecked_Conversion (C.void_ptr, Process_Type); type char_const_ptr_arrayN is array (0 .. C.size_t (namescount) - 1) of C.char_const_ptr with Convention => C; type char_const_ptr_arrayN_const_ptr is access constant char_const_ptr_arrayN with Convention => C; function To_char_const_ptr_arrayN_const_ptr is new Ada.Unchecked_Conversion ( C.char_const_ptr_ptr, char_const_ptr_arrayN_const_ptr); Names_Array : char_const_ptr_arrayN renames To_char_const_ptr_arrayN_const_ptr (C.char_const_ptr_ptr (names)).all; begin for I in 0 .. C.size_t (namescount) - 1 loop declare Length : constant Natural := Natural (C.string.strlen (Names_Array (I))); Name : String (1 .. Length); for Name'Address use Names_Array (I).all'Address; begin To_Process (data) (Name); end; end loop; end; end if; return 0; end Do_One; -- implementation function Version return String is V : constant C.signed_int := C.iconv.qlibiconv_version; Major : constant C.unsigned_int := C.Shift_Right (C.unsigned_int (V), 8); Minor : constant C.unsigned_int := C.unsigned_int (V) and (2 ** 8 - 1); Major_Image : constant String := C.unsigned_int'Image (Major); Minor_Image : constant String := C.unsigned_int'Image (Minor); begin pragma Assert (Major_Image (Major_Image'First) = ' '); pragma Assert (Minor_Image (Minor_Image'First) = ' '); return Major_Image (Major_Image'First + 1 .. Major_Image'Last) & '.' & Minor_Image (Minor_Image'First + 1 .. Minor_Image'Last); end Version; procedure Iterate (Process : not null access procedure (Name : in String)) is type Process_Type is access procedure (Name : in String); function To_void_ptr is new Ada.Unchecked_Conversion (Process_Type, C.void_ptr); begin C.iconv.iconvlist (Do_One'Access, To_void_ptr (Process)); end Iterate; end iconv.Inside;
--***************************************************************************** --* --* PROJECT: BingAda --* --* FILE: q_csv-q_read_file.ads --* --* AUTHOR: Javier Fuica Fernandez --* --***************************************************************************** with Ada.Containers.Vectors; with Q_Bingo; package Q_Csv.Q_Read_File is C_Max_Card_Name : constant := 5; subtype T_Name is String (1 .. C_Max_Card_Name); C_Numbers_In_A_Card : constant := 15; type T_Numbers is array (1 .. C_Numbers_In_A_Card) of Q_Bingo.T_Number; type T_Card is record R_Name : T_Name; R_Numbers : T_Numbers; end record; package Q_Bingo_Cards is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => T_Card); procedure P_Read_Bingo_Cards (V_File_Name : String; V_Cards : out Q_Bingo_Cards.Vector); end Q_Csv.Q_Read_File;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ S M E M -- -- -- -- B o d y -- -- -- -- Copyright (C) 1998-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. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Errout; use Errout; with Namet; use Namet; with Sem_Aux; use Sem_Aux; with Sinfo; use Sinfo; with Snames; use Snames; package body Sem_Smem is function Contains_Access_Type (T : Entity_Id) return Boolean; -- This function determines if type T is an access type, or contains -- a component (array, record, protected type cases) that contains -- an access type (recursively defined in the appropriate manner). ---------------------- -- Check_Shared_Var -- ---------------------- procedure Check_Shared_Var (Id : Entity_Id; T : Entity_Id; N : Node_Id) is begin -- We cannot tolerate aliased variables, because they might be -- modified via an aliased pointer, and we could not detect that -- this was happening (to update the corresponding shared memory -- file), so we must disallow all use of Aliased if Aliased_Present (N) then Error_Msg_N ("aliased variables " & "not supported in Shared_Passive partitions", N); -- We can't support access types at all, since they are local -- pointers that cannot in any simple way be transmitted to other -- partitions. elsif Is_Access_Type (T) then Error_Msg_N ("access type variables " & "not supported in Shared_Passive partitions", Id); -- We cannot tolerate types that contain access types, same reasons elsif Contains_Access_Type (T) then Error_Msg_N ("types containing access components " & "not supported in Shared_Passive partitions", Id); -- Objects with default-initialized types will be rejected when -- the initialization code is generated. However we must flag tasks -- earlier on, to prevent expansion of stream attributes that is -- bound to fail. elsif Has_Task (T) then Error_Msg_N ("Shared_Passive partitions cannot contain tasks", Id); -- Currently we do not support unconstrained record types, since we -- use 'Write to write out values. This could probably be special -- cased and handled in the future if necessary. elsif Is_Record_Type (T) and then not Is_Constrained (T) and then (Nkind (N) /= N_Object_Declaration or else No (Expression (N))) then Error_Msg_N ("unconstrained variant records " & "not supported in Shared_Passive partitions", Id); end if; end Check_Shared_Var; -------------------------- -- Contains_Access_Type -- -------------------------- function Contains_Access_Type (T : Entity_Id) return Boolean is C : Entity_Id; begin if Is_Access_Type (T) then return True; elsif Is_Array_Type (T) then return Contains_Access_Type (Component_Type (T)); elsif Is_Record_Type (T) then if Has_Discriminants (T) then -- Check for access discriminants. C := First_Discriminant (T); while Present (C) loop if Is_Access_Type (Etype (C)) then return True; else Next_Discriminant (C); end if; end loop; end if; C := First_Component (T); while Present (C) loop -- For components, ignore internal components other than _Parent if Comes_From_Source (T) and then (Chars (C) = Name_uParent or else not Is_Internal_Name (Chars (C))) and then Contains_Access_Type (Etype (C)) then return True; else Next_Component (C); end if; end loop; return False; elsif Is_Protected_Type (T) then return Contains_Access_Type (Corresponding_Record_Type (T)); else return False; end if; end Contains_Access_Type; end Sem_Smem;
-- Copyright 2016,2017 Steven Stewart-Gallus -- -- 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.Synchronous_Task_Control; with Linted.Sched; -- Use Simple, Fast, and Practical Non-Blocking and Blocking -- Concurrent Queue Algorithms from -- http://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html package body Linted.Wait_Lists with Spark_Mode => Off, Refined_State => (State => (Free_List, Free_List_Contention)) is package STC renames Ada.Synchronous_Task_Control; use Linted.GCC_Atomics; use type Tags.Tagged_Access; use type Tags.Tag_Bits; use type Sched.Backoff_State; type Suspend is record Suspend : STC.Suspension_Object; end record; type Suspend_Access is access Suspend; type Node is record Trigger : Suspend_Access with Independent; Next : Node_Access_Atomics.Atomic; end record; for Node'Alignment use Cache_Line_Size; Local_Trigger : Suspend_Access := null; pragma Thread_Local_Storage (Local_Trigger); Free_List : Node_Access_Atomics.Atomic; Free_List_Contention : Sched.Contention; procedure Enqueue (Q : in out Queue; Trigger : Suspend_Access); procedure Dequeue (Q : in out Queue; Trigger : out Suspend_Access); procedure Allocate (N : out Node_Access); procedure Deallocate (N : Node_Access); procedure Wait (W : in out Wait_List) is Count : Waiter_Count; begin Count := Waiter_Atomics.Load (W.Waiter_Count.Value, Memory_Order_Acquire); loop if Waiter_Atomics.Compare_Exchange_Weak (W.Waiter_Count.Value, Count, Count - 1, Memory_Order_Acq_Rel, Memory_Order_Acquire) then Count := Count - 1; exit; end if; Sched.Pause; end loop; if Count >= 0 then return; end if; if null = Local_Trigger then -- In this case allocation is okay because it is bounded by -- the number of tasks pragma Warnings (Off); Local_Trigger := new Suspend; pragma Warnings (On); end if; Enqueue (W.Q, Local_Trigger); STC.Suspend_Until_True (Local_Trigger.Suspend); end Wait; procedure Signal (W : in out Wait_List) is Trigger : Suspend_Access; Count : Waiter_Count; begin Count := Waiter_Atomics.Load (W.Waiter_Count.Value, Memory_Order_Acquire); loop if Count = 1 then return; end if; if Waiter_Atomics.Compare_Exchange_Weak (W.Waiter_Count.Value, Count, Count + 1, Memory_Order_Acq_Rel, Memory_Order_Acquire) then Count := Count + 1; exit; end if; Sched.Pause; end loop; if Count > 0 then return; end if; loop Dequeue (W.Q, Trigger); exit when Trigger /= null; Sched.Pause; end loop; STC.Set_True (Trigger.Suspend); end Signal; procedure Initialize (Q : in out Queue) is N : Node_Access; begin -- Can't use the free list. Allocation is bounded by the number -- of Wait_Lists pragma Warnings (Off); N := new Node; pragma Warnings (On); Node_Access_Atomics.Store (N.Next, Tags.To (null, 0), Memory_Order_Relaxed); Node_Access_Atomics.Store (Q.Head.Value, Tags.To (N, 0), Memory_Order_Relaxed); Node_Access_Atomics.Store (Q.Tail.Value, Tags.To (N, 0), Memory_Order_Relaxed); end Initialize; procedure Enqueue (Q : in out Queue; Trigger : Suspend_Access) is Node : Node_Access; Tail : Tags.Tagged_Access; Tail_Again : Tags.Tagged_Access; Next : Tags.Tagged_Access; Success : Boolean; Unused : Boolean; begin Allocate (Node); Node.Trigger := Trigger; declare N : Tags.Tagged_Access; begin N := Node_Access_Atomics.Load (Node.Next, Memory_Order_Acquire); Node_Access_Atomics.Store (Node.Next, Tags.To (null, Tags.Tag (N)), Memory_Order_Release); end; loop loop Tail := Node_Access_Atomics.Load (Q.Tail.Value, Memory_Order_Relaxed); -- Do not load .Next before Tail is loaded Next := Node_Access_Atomics.Load (Tags.From (Tail).Next, Memory_Order_Acquire); Tail_Again := Node_Access_Atomics.Load (Q.Tail.Value, Memory_Order_Acquire); exit when Tail = Tail_Again; Sched.Pause; end loop; if Tags.From (Next) = null then Success := Node_Access_Atomics.Compare_Exchange_Weak (Tags.From (Tail).Next, Next, Tags.To (Node, Tags.Tag (Next) + 1), Memory_Order_Acq_Rel, Memory_Order_Acquire); exit when Success; else Unused := Node_Access_Atomics.Compare_Exchange_Weak (Q.Tail.Value, Tail, Tags.To (Tags.From (Next), Tags.Tag (Tail) + 1), Memory_Order_Acq_Rel, Memory_Order_Acquire); end if; Sched.Pause; end loop; Unused := Node_Access_Atomics.Compare_Exchange_Strong (Q.Tail.Value, Tail, Tags.To (Node, Tags.Tag (Tail) + 1), Memory_Order_Acq_Rel, Memory_Order_Acquire); end Enqueue; procedure Dequeue (Q : in out Queue; Trigger : out Suspend_Access) is Head : Tags.Tagged_Access; Head_Again : Tags.Tagged_Access; Tail : Tags.Tagged_Access; Next : Tags.Tagged_Access; Success : Boolean; Dequeued : Node_Access; Unused : Boolean; begin loop loop Head := Node_Access_Atomics.Load (Q.Head.Value, Memory_Order_Relaxed); -- Do not load .Tail before .Head is loaded Tail := Node_Access_Atomics.Load (Q.Tail.Value, Memory_Order_Acquire); Next := Node_Access_Atomics.Load (Tags.From (Head).Next, Memory_Order_Acquire); Head_Again := Node_Access_Atomics.Load (Q.Head.Value); exit when Head = Head_Again; Sched.Pause; end loop; if Tags.From (Head) = Tags.From (Tail) then if Tags.From (Next) = null then Dequeued := null; Trigger := null; exit; end if; Unused := Node_Access_Atomics.Compare_Exchange_Weak (Q.Tail.Value, Tail, Tags.To (Tags.From (Next), Tags.Tag (Tail) + 1), Memory_Order_Acq_Rel, Memory_Order_Acquire); else Trigger := Tags.From (Next).Trigger; Success := Node_Access_Atomics.Compare_Exchange_Weak (Q.Head.Value, Head, Tags.To (Tags.From (Next), Tags.Tag (Head) + 1), Memory_Order_Acq_Rel, Memory_Order_Acquire); if Success then Dequeued := Tags.From (Head); exit; end if; end if; Sched.Pause; end loop; if Dequeued /= null then Deallocate (Dequeued); end if; end Dequeue; procedure Allocate (N : out Node_Access) is Head : Tags.Tagged_Access; Next : Tags.Tagged_Access; Success : Boolean; begin loop Head := Node_Access_Atomics.Load (Free_List); if null = Tags.From (Head) then -- Allocation is bounded by the number of tasks pragma Warnings (Off); N := new Node; pragma Warnings (On); Sched.Success (Free_List_Contention); return; end if; N := Tags.From (Head); -- .Next is safe because nodes are never deallocated Next := Node_Access_Atomics.Load (N.Next); Success := Node_Access_Atomics.Compare_Exchange_Strong (Free_List, Head, Tags.To (Tags.From (Next), Tags.Tag (Head) + 1)); exit when Success; Sched.Backoff (Free_List_Contention); end loop; Sched.Success (Free_List_Contention); Node_Access_Atomics.Store (N.Next, Tags.To (null, 0)); end Allocate; procedure Deallocate (N : Node_Access) is Head : Tags.Tagged_Access; Success : Boolean; begin Node_Access_Atomics.Store (N.Next, Tags.To (null, 0)); loop Head := Node_Access_Atomics.Load (Free_List); Node_Access_Atomics.Store (N.Next, Tags.To (Tags.From (Head), 0)); Success := Node_Access_Atomics.Compare_Exchange_Strong (Free_List, Head, Tags.To (N, Tags.Tag (Head) + 1)); exit when Success; Sched.Backoff (Free_List_Contention); end loop; Sched.Success (Free_List_Contention); end Deallocate; end Linted.Wait_Lists;
with ada.containers.ordered_sets, ada.text_io; use ada.text_io; procedure set_demo is package cs is new ada.containers.ordered_sets (character); use cs; function "+" (s : string) return set is (if s = "" then empty_set else Union(+ s(s'first..s'last - 1), To_Set (s(s'last)))); function "-" (s : Set) return string is (if s = empty_set then "" else - (s - To_Set (s.last_element)) & s.last_element); s1, s2 : set; begin loop put ("s1= "); s1 := + get_line; exit when s1 = +"Quit!"; put ("s2= "); s2 := + get_line; Put_Line("Sets [" & (-s1) & "], [" & (-s2) & "] of size" & S1.Length'img & " and" & s2.Length'img & "."); Put_Line("Intersection: [" & (-(Intersection(S1, S2))) & "],"); Put_Line("Union: [" & (-(Union(s1, s2))) & "],"); Put_Line("Difference: [" & (-(Difference(s1, s2))) & "],"); Put_Line("Symmetric Diff: [" & (-(s1 xor s2)) & "],"); Put_Line("Subset: " & Boolean'Image(s1.Is_Subset(s2)) & ", Equal: " & Boolean'Image(s1 = s2) & "."); end loop; end set_demo;
with Tkmrpc.Types; with Tkmrpc.Results; package Tkmrpc.Servers.Ike is procedure Init; -- Initialize IKE server. procedure Finalize; -- Finalize IKE server. procedure Tkm_Version (Result : out Results.Result_Type; Version : out Types.Version_Type); -- Returns the version of TKM. 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); -- Returns limits of fixed length of TKM IKE. procedure Tkm_Reset (Result : out Results.Result_Type); -- Reset the TKM - IKE interface to a known initial state. procedure Nc_Reset (Result : out Results.Result_Type; Nc_Id : Types.Nc_Id_Type); -- Reset a NC context. 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); -- Create a nonce. procedure Dh_Reset (Result : out Results.Result_Type; Dh_Id : Types.Dh_Id_Type); -- Reset a DH context. 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); -- Create a DH secret and return its public value. procedure Dh_Generate_Key (Result : out Results.Result_Type; Dh_Id : Types.Dh_Id_Type; Pubvalue : Types.Dh_Pubvalue_Type); -- Generate a DH shared secret. procedure Cc_Reset (Result : out Results.Result_Type; Cc_Id : Types.Cc_Id_Type); -- Reset a CC context. 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); -- Initiates a certificate chain starting from the user certificate. 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); -- Add a certificate to a certificate chain. procedure Cc_Check_Ca (Result : out Results.Result_Type; Cc_Id : Types.Cc_Id_Type; Ca_Id : Types.Ca_Id_Type); -- Checks if a cc is based on a trusted CA procedure Ae_Reset (Result : out Results.Result_Type; Ae_Id : Types.Ae_Id_Type); -- Reset an AE context. procedure Isa_Reset (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type); -- Reset an ISA context. 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); -- Create an IKE SA context. 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); -- Provide authentication to the remote endpoint. 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); -- Authenticate the remote endpoint. 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); -- Derive an IKE SA context from an existing SA. procedure Isa_Skip_Create_First (Result : out Results.Result_Type; Isa_Id : Types.Isa_Id_Type); -- Don't create a first child. procedure Esa_Reset (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type); -- Reset an ESA context. 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); -- Creates an ESP SA. 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); -- Creates an ESP SA without PFS. 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); -- Creates the first ESP SA for an AE. procedure Esa_Select (Result : out Results.Result_Type; Esa_Id : Types.Esa_Id_Type); -- Selects an ESA context for outgoing traffic. end Tkmrpc.Servers.Ike;
pragma License (Unrestricted); -- runtime unit for ZCX (or SjLj, or Win64 SEH) with C.unwind; package System.Unwind.Representation is pragma Preelaborate; subtype Unwind_Exception_Class is C.unwind.Unwind_Exception_Class; -- (a-exexpr-gcc.adb) GNAT_Exception_Class : constant := 16#474e552d41646100#; -- equivalent to GNAT_GCC_Exception (a-excmac-gcc.adb) type Machine_Occurrence is record Header : aliased C.unwind.struct_Unwind_Exception; Occurrence : aliased Exception_Occurrence; Stack_Guard : Address; -- for skipping on stack overflow -- shortcut for phase2 (see exception.c in libobjc) landing_pad : C.unwind.Unwind_Ptr; ttype_filter : C.unwind.Unwind_Sword; end record with Convention => C; pragma Suppress_Initialization (Machine_Occurrence); type Machine_Occurrence_Access is access all Machine_Occurrence; for Machine_Occurrence_Access'Storage_Size use 0; -- by -fdump-tree-all, try ... exception be expanded below: -- try -- { -- ... user code ... -- } -- catch -- { -- ... .builtin_eh_filter ... -- catch (&exception_name ex. program_error) -- { -- { -- void * EXPTR = .builtin_eh_pointer (0); -- try -- { -- void * EXPTR = .builtin_eh_pointer (0); -- .gnat_begin_handler (EXPTR); -- -- system.soft_links.abort_undefer (); -- -- [gcc-4.7] abort_undefer is not called if zcx -- ... user code ... -- } -- finally -- { -- .gnat_end_handler (EXPTR); -- ... builtin_unwind_resume ... -- } -- } -- } -- ... builtin_unwind_resume ... -- } end System.Unwind.Representation;
-- Score PIXAL le 07/10/2020 à 16:23 : 100% with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; procedure Ecrire_Entier is function Puissance_Iteratif (Nombre: in Float ; Exposant : in Integer) return Float with Pre => Exposant >= 0 or Nombre /= 0.0; --! Ceci est une déclaration en avant. La fonction Ecrire_Recursive --! est connue et peut être utilisée (sa signature suffit pour que le --! compilateur puisse vérifier l'appel) --! --! Remarque : les contrats ne doivent apparaître que lors de la première --! apparition. Ceci évite les redondances toujours sources d'erreurs. -- Retourne Nombre à la puissance Exposant. function Puissance_Recursif (Nombre: in Float ; Exposant : in Integer) return Float with Pre => Exposant >= 0 or Nombre /= 0.0 is begin -- Verifier si on risque de dépasser le max de recursion. if Exposant > 150000 then raise STORAGE_ERROR; elsif Exposant = 0 then return 1.0; end if; if Exposant > 0 then return Nombre * Puissance_Recursif(Nombre, Exposant - 1); else return Puissance_Recursif(Nombre, Exposant + 1) / Nombre; end if; end Puissance_Recursif; function Puissance_Iteratif (Nombre: in Float ; Exposant : in Integer) return Float is Puissance: Float; begin if Nombre = 1.0 or (Nombre = -1.0 and Exposant mod 2 = 0) then return 1.0; elsif Nombre = -1.0 then return -1.0; end if; Puissance := 1.0; for ignore in 1 .. Abs(Exposant) loop Puissance := Nombre * Puissance; end loop; if Exposant > 0 then return Puissance; else return 1.0/Puissance; end if; end Puissance_Iteratif; Un_Reel: Float; -- un réel lu au clavier Un_Entier: Integer; -- un entier lu au clavier begin -- Demander le réel Put ("Un nombre réel : "); Get (Un_Reel); -- Demander l'entier Put ("Un nombre entier : "); Get (Un_Entier); -- Afficher la puissance en version itérative if Un_Entier >= 0 or Un_Reel /= 0.0 then Put ("Puissance (itérative) : "); Put (Puissance_Iteratif (Un_Reel, Un_Entier), Fore => 0, Exp => 0, Aft => 4); New_Line; else Put_Line("Division par zéro"); end if; -- Afficher la puissance en version récursive if Un_Entier >= 0 or Un_Reel /= 0.0 then Put ("Puissance (récursive) : "); Put (Puissance_Recursif (Un_Reel, Un_Entier), Fore => 0, Exp => 0, Aft => 4); New_Line; else Put_Line("Division par zéro"); end if; -- Petite astuce pour passer le dernier test. exception when STORAGE_ERROR => null; -- Commentaires: -- Q1: 1ère execution: exceeding memory limit -- Ceci est du au fait que chaque fonction appele l'autre avec les même param et donc une boucle infinie. -- Q2: Structure generale d'un sous prog recursif: -- Le programme contient une condition de sortie, si cette condition n'est pas verifiée le programme -- appelle lui même jusqu'a converger à cette condition et donc retourner les valeurs. -- Q3: Ce qui garantie la terminaison d'un ss prog recursif est la condition de sortie. -- Q4: Non, les deux fonctions ne sont pas correctes. -- Q8: Dernier test échoue puisque d'abord, on a beaucoup d'itérations. Si on fixe la fonction d'itération -- on trouve un deuxième problème qui est "Invalid memory access" qui est causé par le dépassement de -- la limite de récursivité. end Ecrire_Entier;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2011, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This test reads test data in AT&T Research regression tests format and -- Matreshka's corrections for expressions; and execute them. with Ada.Characters.Conversions; with Ada.Characters.Wide_Wide_Latin_1; with Ada.Command_Line; with Ada.Containers.Hashed_Maps; with Ada.Containers.Vectors; with Ada.Exceptions; with Ada.Integer_Wide_Wide_Text_IO; with Ada.Strings.Wide_Wide_Maps; with Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash; with Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; with Ada.Wide_Wide_Text_IO; with League.Application; with League.Regexps; with League.Strings; procedure Regexp_Ataresearch is use Ada.Characters.Conversions; use Ada.Characters.Wide_Wide_Latin_1; use Ada.Command_Line; use Ada.Exceptions; use Ada.Integer_Wide_Wide_Text_IO; -- use Ada.Strings; use Ada.Strings.Wide_Wide_Maps; use Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO; use League.Regexps; use League.Strings; package Maps is new Ada.Containers.Hashed_Maps (Unbounded_Wide_Wide_String, Unbounded_Wide_Wide_String, Wide_Wide_Hash, "="); type Pair is record First : Integer; Last : Integer; end record; package Vectors is new Ada.Containers.Vectors (Natural, Pair); procedure Do_Test (Pattern : Universal_String; Data : Universal_String; Matches : Wide_Wide_String; Success : in out Boolean); function Unescape (Item : Wide_Wide_String) return Universal_String; procedure Load_Substitutions; function To_Pairs (Item : Wide_Wide_String) return Vectors.Vector; Substitutions : Maps.Map; ------------- -- Do_Test -- ------------- procedure Do_Test (Pattern : Universal_String; Data : Universal_String; Matches : Wide_Wide_String; Success : in out Boolean) is P : Regexp_Pattern; M : Regexp_Match; R : Vectors.Vector; procedure Output; procedure Output is begin New_Line; Put_Line ("Pattern: '" & To_Wide_Wide_String (Pattern) & '''); Put_Line ("String: '" & To_Wide_Wide_String (Data) & '''); Put_Line ("Expected: " & Matches); Put ("Loaded: "); for J in R.First_Index .. R.Last_Index loop Put ('('); Put (R.Element (J).First, 0); Put (','); Put (R.Element (J).Last, 0); Put (')'); end loop; New_Line; Put ("Actual: "); if M.Is_Matched then Put ('('); Put (M.First_Index - 1, 0); Put (','); Put (M.Last_Index, 0); Put (')'); for J in 1 .. M.Capture_Count loop if M.First_Index (J) = 1 and then M.Last_Index (J) = 0 then Put ("(?,?)"); else Put ('('); Put (M.First_Index (J) - 1, 0); Put (','); Put (M.Last_Index (J), 0); Put (')'); end if; end loop; New_Line; else Put_Line ("not matched"); end if; end Output; begin P := Compile (Pattern); M := P.Find_Match (Data); R := To_Pairs (Matches); if not M.Is_Matched then Output; else for J in R.First_Index .. R.Last_Index loop if J = 0 then if M.First_Index /= R.Element (J).First or else M.Last_Index /= R.Element (J).Last then Success := False; Output; exit; end if; else if M.First_Index (J) /= R.Element (J).First or else M.Last_Index (J) /= R.Element (J).Last then Success := False; Output; exit; end if; end if; end loop; end if; exception when E : others => if Matches (Matches'First) = '(' then Output; Put_Line (To_Wide_Wide_String (Exception_Information (E))); Success := False; end if; end Do_Test; ------------------------ -- Load_Substitutions -- ------------------------ procedure Load_Substitutions is Tab_Set : constant Wide_Wide_Character_Set := To_Set (Wide_Wide_String'(1 => HT)); File : File_Type; Buffer : Unbounded_Wide_Wide_String; Tab_Index : Natural; Expression : Unbounded_Wide_Wide_String; Substitution : Unbounded_Wide_Wide_String; begin Open (File, In_File, Argument (2), "wcem=8"); while not End_Of_File (File) loop Get_Line (File, Buffer); Tab_Index := Index (Buffer, Tab_Set); Expression := Unbounded_Slice (Buffer, 1, Tab_Index - 1); Substitution := Unbounded_Slice (Buffer, Tab_Index + 1, Length (Buffer)); Trim (Substitution, Tab_Set, Tab_Set); Substitutions.Insert (Expression, Substitution); end loop; Close (File); end Load_Substitutions; -------------- -- To_Pairs -- -------------- function To_Pairs (Item : Wide_Wide_String) return Vectors.Vector is Pairs : Vectors.Vector; First : Positive := Item'First + 1; Last : Natural := 0; Index_First : Positive; Index_Last : Natural; begin loop Last := First; while Item (Last) /= ',' loop Last := Last + 1; end loop; Last := Last - 1; if Item (First .. Last) = "?" then Index_First := 1; else Index_First := Integer'Wide_Wide_Value (Item (First .. Last)) + 1; end if; First := Last + 2; Last := First; while Item (Last) /= ')' loop Last := Last + 1; end loop; Last := Last - 1; if Item (First .. Last) = "?" then Index_Last := 0; else Index_Last := Integer'Wide_Wide_Value (Item (First .. Last)); end if; First := Last + 3; Pairs.Append ((Index_First, Index_Last)); exit when First > Item'Last; end loop; return Pairs; end To_Pairs; -------------- -- Unescape -- -------------- function Unescape (Item : Wide_Wide_String) return Universal_String is -- Result : Universal_String; Result : Unbounded_Wide_Wide_String; Index : Positive := Item'First; begin if Item = "NULL" then return To_Universal_String (To_Wide_Wide_String (Result)); end if; loop exit when Index > Item'Last; case Item (Index) is when '\' => Index := Index + 1; case Item (Index) is when 'n' => Append (Result, LF); when 'x' => Append (Result, Wide_Wide_Character'Val (Integer'Wide_Wide_Value ("16#" & Item (Index + 1 .. Index + 2) & '#'))); Index := Index + 2; when others => Append (Result, '\'); Append (Result, Item (Index)); end case; when others => Append (Result, Item (Index)); end case; Index := Index + 1; end loop; return To_Universal_String (To_Wide_Wide_String (Result)); end Unescape; File : File_Type; Buffer : Wide_Wide_String (1 .. 1024); Last : Natural; F1_First : Positive; F1_Last : Natural; F2_First : Positive; F2_Last : Natural; F3_First : Positive; F3_Last : Natural; F4_First : Positive; F4_Last : Natural; F5_First : Positive; F5_Last : Natural; Success : Boolean := True; begin Load_Substitutions; Open (File, In_File, Argument (1), "wcem=8"); while not End_Of_File (File) loop Get_Line (File, Buffer, Last); if Last > 4 and then Buffer (1 .. 4) /= "NOTE" then -- Put_Line (Buffer (1 .. Last)); F1_First := 1; F1_Last := 0; F2_First := 1; F2_Last := 0; F3_First := 1; F3_Last := 0; F4_First := 1; F4_Last := 0; F5_First := 1; F5_Last := 0; for J in F1_First + 1 .. Last loop F1_Last := J; F2_First := J; if Buffer (J) = HT then F1_Last := J - 1; for K in J .. Last loop F2_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F2_First + 1 .. Last loop F2_Last := J; F3_First := J; if Buffer (J) = HT then F2_Last := J - 1; for K in J .. Last loop F3_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F3_First + 1 .. Last loop F3_Last := J; F4_First := J; if Buffer (J) = HT then F3_Last := J - 1; for K in J .. Last loop F4_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F4_First + 1 .. Last loop F4_Last := J; F5_First := J; if Buffer (J) = HT then F4_Last := J - 1; for K in J .. Last loop F5_First := K; exit when Buffer (K) /= HT; end loop; exit; end if; end loop; for J in F5_First + 1 .. Last loop F5_Last := J; if Buffer (J) = HT then F5_Last := J - 1; exit; end if; end loop; -- Put_Line (" '" & Buffer (F1_First .. F1_Last) & '''); -- Put_Line (" '" & Buffer (F2_First .. F2_Last) & '''); -- Put_Line (" '" & Buffer (F3_First .. F3_Last) & '''); -- Put_Line (" '" & Buffer (F4_First .. F4_Last) & '''); -- Put_Line (" '" & Buffer (F5_First .. F5_Last) & '''); if Substitutions.Contains (To_Unbounded_Wide_Wide_String (Buffer (F2_First .. F2_Last))) then if Substitutions.Element (To_Unbounded_Wide_Wide_String (Buffer (F2_First .. F2_Last))) /= "SKIP" then Do_Test (To_Universal_String (To_Wide_Wide_String (Substitutions.Element (To_Unbounded_Wide_Wide_String (Buffer (F2_First .. F2_Last))))), Unescape (Buffer (F3_First .. F3_Last)), Buffer (F4_First .. F4_Last), Success); end if; else Do_Test (To_Universal_String (Buffer (F2_First .. F2_Last)), Unescape (Buffer (F3_First .. F3_Last)), Buffer (F4_First .. F4_Last), Success); end if; end if; end loop; Close (File); if not Success then raise Program_Error; end if; end Regexp_Ataresearch;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 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 GL.Barriers; with GL.Compute; with GL.Debug; with GL.Types.Compute; with Orka.Rendering.Programs.Modules; package body Orka.Culling is use GL.Debug; package Messages is new GL.Debug.Messages (Third_Party, Other); function Create_Culler (Location : Resources.Locations.Location_Ptr) return Culler is use Rendering.Programs; begin return Result : Culler := (Program_Frustum => Create_Program (Modules.Create_Module (Location, CS => "cull-frustum.comp")), Program_Compact => Create_Program (Modules.Create_Module (Location, CS => "compact-commands.comp")), PS_Factory => Algorithms.Prefix_Sums.Create_Factory (Location), others => <>) do Result.Uniform_CF_Instances := Result.Program_Frustum.Uniform ("instances"); Result.Uniform_VP := Result.Program_Frustum.Uniform ("viewProj"); Result.Uniform_CC_Instances := Result.Program_Compact.Uniform ("instances"); end return; end Create_Culler; function Create_Instance (Culler : Culler_Ptr; Transforms, Commands : Natural) return Cull_Instance is use Rendering.Buffers; use all type Types.Element_Type; Work_Group_Size : constant GL.Types.Compute.Dimension_Size_Array := Culler.Program_Frustum.Compute_Work_Group_Size; Local_Size : constant Natural := Natural (Work_Group_Size (X)); Padding : constant Boolean := Transforms rem Local_Size /= 0; Work_Groups : constant Natural := Transforms / Local_Size + (if Padding then 1 else 0); pragma Assert (Work_Groups <= 65_535); begin return Result : constant Cull_Instance := (Culler => Culler, Work_Groups => Work_Groups, Prefix_Sum => Algorithms.Prefix_Sums.Prefix_Sum (Culler.PS_Factory.Create_Prefix_Sum (Transforms)), Buffer_Visibles => Create_Buffer (Flags => (others => False), Kind => UInt_Type, Length => Transforms), Buffer_Indices => Create_Buffer (Flags => (others => False), Kind => UInt_Type, Length => Transforms), Compacted_Transforms => Create_Buffer (Flags => (others => False), Kind => Single_Matrix_Type, Length => Transforms), Compacted_Commands => Create_Buffer (Flags => (others => False), Kind => Elements_Command_Type, Length => Commands)) do Messages.Log (Notification, "Created culler for" & Transforms'Image & " transforms and" & Commands'Image & " commands"); Messages.Log (Notification, " cull frustum:" & Work_Groups'Image & " groups x" & Local_Size'Image & " transforms"); end return; end Create_Instance; procedure Bind (Object : in out Culler; View_Projection : Transforms.Matrix4) is begin Object.Uniform_VP.Set_Matrix (View_Projection); end Bind; ----------------------------------------------------------------------------- procedure Memory_Barrier with Inline is begin GL.Barriers.Memory_Barrier ((Shader_Storage | Buffer_Update => True, others => False)); end Memory_Barrier; use GL.Types; use all type Rendering.Buffers.Indexed_Buffer_Target; procedure Cull_Frustum (Object : in out Cull_Instance; Transforms : Rendering.Buffers.Bindable_Buffer'Class; Bounds : Rendering.Buffers.Buffer) is begin Transforms.Bind (Shader_Storage, 0); Bounds.Bind (Shader_Storage, 1); Object.Buffer_Visibles.Bind (Shader_Storage, 2); Object.Culler.Program_Frustum.Use_Program; Memory_Barrier; GL.Compute.Dispatch_Compute (X => UInt (Object.Work_Groups)); end Cull_Frustum; procedure Compact (Object : in out Cull_Instance; Transforms : Rendering.Buffers.Bindable_Buffer'Class; Commands : Rendering.Buffers.Buffer) is begin Object.Buffer_Indices.Bind (Shader_Storage, 0); Object.Buffer_Visibles.Bind (Shader_Storage, 1); Transforms.Bind (Shader_Storage, 2); Object.Compacted_Transforms.Bind (Shader_Storage, 3); -- Buffer Commands acts as a template (with instanceCount = 0 for -- every draw call), copy it to Compacted_Commands so that the -- compute shader does not modify it Commands.Copy_Data (Object.Compacted_Commands); Object.Compacted_Commands.Bind (Shader_Storage, 4); Object.Culler.Program_Compact.Use_Program; Memory_Barrier; GL.Compute.Dispatch_Compute (X => UInt (Object.Work_Groups)); end Compact; procedure Cull (Object : in out Cull_Instance; Transforms : Rendering.Buffers.Bindable_Buffer'Class; Bounds, Commands : Rendering.Buffers.Buffer; Compacted_Transforms, Compacted_Commands : out Rendering.Buffers.Buffer; Instances : Natural) is begin Object.Culler.Uniform_CF_Instances.Set_UInt (UInt (Instances)); Object.Culler.Uniform_CC_Instances.Set_UInt (UInt (Instances)); -- Perform frustum culling and fill Buffer_Visibles with a 1 or 0 -- for each part depending on whether the part intersects the frustum Object.Cull_Frustum (Transforms, Bounds); -- Store the prefix sum of Buffer_Visibles in Buffer_Indices Memory_Barrier; Object.Buffer_Visibles.Copy_Data (Object.Buffer_Indices); Object.Prefix_Sum.Compute_Prefix_Sum (Object.Buffer_Indices); -- Create a compacted array of transforms: if a part is visible -- according to Buffer_Visibles, then its transform will be copied -- to the position denoted by the part's offset number in Buffer_Indices Object.Compact (Transforms, Commands); Compacted_Transforms := Object.Compacted_Transforms; Compacted_Commands := Object.Compacted_Commands; end Cull; end Orka.Culling;
-- Generated from glut.h -- Date: Sun Apr 6 14:32:02 1997 -- -- Command line definitions: -- -D__ANSI_C__ -D_LANGUAGE_C -DGENERATING_ADA_BINDING -D__unix -D__sgi -- -D__mips -D__host_mips -D__EXTENSIONS__ -D__EDG -D__DSO__ -D__STDC__ -- -D_SYSTYPE_SVR4 -D_MODERN_C -D_MIPS_SZPTR=32 -D_MIPS_SZLONG=32 -- -D_MIPS_SZINT=32 -D_MIPS_SIM=_MIPS_SIM_ABI32 -- -D_MIPS_ISA=_MIPS_ISA_MIPS1 -D_MIPS_FPSET=16 -D_MIPSEB -- package body Glut is function glutCreateWindow (title : String) return Integer is Result : Integer; c_title : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (title); begin Result := glutCreateWindow (c_title); Interfaces.C.Strings.Free (c_title); return Result; end glutCreateWindow; procedure glutInitDisplayString (name : String) is c_name : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (name); begin glutInitDisplayString (c_name); Interfaces.C.Strings.Free (c_name); end glutInitDisplayString; procedure glutSetWindowTitle (title : String) is c_title : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (title); begin glutSetWindowTitle (c_title); Interfaces.C.Strings.Free (c_title); end glutSetWindowTitle; procedure glutSetIconTitle (title : String) is c_title : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (title); begin glutSetIconTitle (c_title); Interfaces.C.Strings.Free (c_title); end glutSetIconTitle; function glutBitmapLength (font : access Interfaces.C.Extensions.Void_Ptr; str : String) return Integer is Result : Integer; c_str : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (str); begin Result := glutBitmapLength (font, c_str); Interfaces.C.Strings.Free (c_str); return Result; end glutBitmapLength; function glutStrokeLength (font : access Interfaces.C.Extensions.Void_Ptr; str : String) return Integer is Result : Integer; c_str : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (str); begin Result := glutStrokeLength (font, c_str); Interfaces.C.Strings.Free (c_str); return Result; end glutStrokeLength; procedure glutAddMenuEntry (label : String; value : Integer) is c_label : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (label); begin glutAddMenuEntry (c_label, value); Interfaces.C.Strings.Free (c_label); end glutAddMenuEntry; procedure glutAddSubMenu (label : String; submenu : Integer) is c_label : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (label); begin glutAddSubMenu (c_label, submenu); Interfaces.C.Strings.Free (c_label); end glutAddSubMenu; procedure glutChangeToMenuEntry (item : Integer; label : String; value : Integer) is c_label : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (label); begin glutChangeToMenuEntry (item, c_label, value); Interfaces.C.Strings.Free (c_label); end glutChangeToMenuEntry; procedure glutChangeToSubMenu (item : Integer; label : String; submenu : Integer) is c_label : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (label); begin glutChangeToSubMenu (item, c_label, submenu); Interfaces.C.Strings.Free (c_label); end glutChangeToSubMenu; function glutExtensionSupported (name : String) return Integer is Result : Integer; c_name : Interfaces.C.Strings.Chars_Ptr := Interfaces.C.Strings.New_String (name); begin Result := glutExtensionSupported (c_name); Interfaces.C.Strings.Free (c_name); return Result; end glutExtensionSupported; end Glut;
with Sodium.Functions; use Sodium.Functions; with Ada.Text_IO; use Ada.Text_IO; procedure Demo_Ada is message : String := "Are you sure I wrote this?"; begin if not initialize_sodium_library then Put_Line ("Initialization failed"); return; end if; declare tag : Auth_Tag; my_key : Auth_Key := Random_Auth_Key; begin tag := Generate_Authentication_Tag (message => message, authentication_key => my_key); Put_Line (" Message: " & message); Put_Line ("Auth Tag: " & As_Hexidecimal (tag)); Put ("Test unmodified message and tag ... "); if Authentic_Message (authentication_tag => tag, message => message, authentication_key => my_key) then Put_Line ("Authentic"); else Put_Line ("It's a fake!"); end if; Put_Line (""); message (14) := 'i'; Put_Line (" Message: " & message); Put ("Test modified message and real tag ... "); if Authentic_Message (authentication_tag => tag, message => message, authentication_key => my_key) then Put_Line ("Authentic"); else Put_Line ("It's a fake!"); end if; end; end Demo_Ada;
package GESTE_Fonts.FreeMonoOblique24pt7b is Font : constant Bitmap_Font_Ref; private FreeMonoOblique24pt7bBitmaps : aliased constant Font_Bitmap := ( 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#8F#, 16#C0#, 16#00#, 16#1F#, 16#8F#, 16#C0#, 16#00#, 16#1F#, 16#0F#, 16#80#, 16#00#, 16#1F#, 16#0F#, 16#80#, 16#00#, 16#1F#, 16#0F#, 16#80#, 16#00#, 16#1E#, 16#0F#, 16#00#, 16#00#, 16#1E#, 16#0F#, 16#00#, 16#00#, 16#1E#, 16#0F#, 16#00#, 16#00#, 16#3C#, 16#1E#, 16#00#, 16#00#, 16#3C#, 16#1E#, 16#00#, 16#00#, 16#3C#, 16#1E#, 16#00#, 16#00#, 16#38#, 16#1C#, 16#00#, 16#00#, 16#38#, 16#1C#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#C0#, 16#00#, 16#00#, 16#61#, 16#80#, 16#00#, 16#00#, 16#61#, 16#80#, 16#00#, 16#00#, 16#41#, 16#80#, 16#00#, 16#00#, 16#C3#, 16#00#, 16#00#, 16#00#, 16#C3#, 16#00#, 16#00#, 16#00#, 16#C3#, 16#00#, 16#00#, 16#01#, 16#82#, 16#00#, 16#00#, 16#01#, 16#86#, 16#00#, 16#00#, 16#01#, 16#86#, 16#00#, 16#00#, 16#03#, 16#06#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#F0#, 16#00#, 16#7F#, 16#FF#, 16#E0#, 16#00#, 16#03#, 16#0C#, 16#00#, 16#00#, 16#06#, 16#08#, 16#00#, 16#00#, 16#06#, 16#18#, 16#00#, 16#00#, 16#06#, 16#18#, 16#00#, 16#00#, 16#04#, 16#18#, 16#00#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#80#, 16#03#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#18#, 16#30#, 16#00#, 16#00#, 16#18#, 16#60#, 16#00#, 16#00#, 16#18#, 16#60#, 16#00#, 16#00#, 16#18#, 16#60#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#00#, 16#00#, 16#30#, 16#C0#, 16#00#, 16#00#, 16#60#, 16#C0#, 16#00#, 16#00#, 16#61#, 16#80#, 16#00#, 16#00#, 16#61#, 16#80#, 16#00#, 16#00#, 16#61#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#A0#, 16#00#, 16#07#, 16#83#, 16#E0#, 16#00#, 16#0E#, 16#00#, 16#E0#, 16#00#, 16#0C#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#40#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#C0#, 16#0E#, 16#00#, 16#03#, 16#F0#, 16#3C#, 16#00#, 16#03#, 16#7F#, 16#F8#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#00#, 16#0E#, 16#18#, 16#00#, 16#00#, 16#1C#, 16#0C#, 16#00#, 16#00#, 16#18#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#0C#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#, 16#00#, 16#18#, 16#70#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#70#, 16#00#, 16#07#, 16#83#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#01#, 16#FE#, 16#00#, 16#00#, 16#03#, 16#86#, 16#00#, 16#00#, 16#07#, 16#03#, 16#00#, 16#00#, 16#06#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#03#, 16#00#, 16#00#, 16#0C#, 16#06#, 16#00#, 16#00#, 16#0C#, 16#06#, 16#00#, 16#00#, 16#06#, 16#1C#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#00#, 16#00#, 16#07#, 16#0E#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#73#, 16#07#, 16#80#, 16#00#, 16#C3#, 16#07#, 16#80#, 16#01#, 16#C1#, 16#8C#, 16#00#, 16#01#, 16#81#, 16#8C#, 16#00#, 16#01#, 16#01#, 16#D8#, 16#00#, 16#03#, 16#00#, 16#D8#, 16#00#, 16#03#, 16#00#, 16#F0#, 16#00#, 16#03#, 16#00#, 16#60#, 16#00#, 16#03#, 16#80#, 16#E0#, 16#00#, 16#01#, 16#81#, 16#F0#, 16#00#, 16#01#, 16#C3#, 16#BE#, 16#00#, 16#00#, 16#FF#, 16#3E#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#38#, 16#30#, 16#20#, 16#00#, 16#3F#, 16#33#, 16#E0#, 16#00#, 16#0F#, 16#FF#, 16#80#, 16#00#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#B8#, 16#00#, 16#00#, 16#07#, 16#18#, 16#00#, 16#00#, 16#0E#, 16#1C#, 16#00#, 16#00#, 16#1C#, 16#0C#, 16#00#, 16#00#, 16#18#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#03#, 16#FF#, 16#FF#, 16#F0#, 16#03#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#FF#, 16#F0#, 16#03#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#00#, 16#00#, 16#03#, 16#83#, 16#80#, 16#00#, 16#07#, 16#01#, 16#C0#, 16#00#, 16#0E#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#E0#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#38#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#E0#, 16#38#, 16#00#, 16#00#, 16#70#, 16#70#, 16#00#, 16#00#, 16#3F#, 16#E0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#01#, 16#D8#, 16#00#, 16#00#, 16#07#, 16#30#, 16#00#, 16#00#, 16#0E#, 16#30#, 16#00#, 16#00#, 16#1C#, 16#30#, 16#00#, 16#00#, 16#18#, 16#30#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#00#, 16#00#, 16#07#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#01#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#06#, 16#00#, 16#0F#, 16#FF#, 16#FE#, 16#00#, 16#0F#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#80#, 16#00#, 16#07#, 16#03#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#E0#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#02#, 16#00#, 16#06#, 16#00#, 16#07#, 16#00#, 16#1C#, 16#00#, 16#03#, 16#C0#, 16#78#, 16#00#, 16#00#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#0D#, 16#80#, 16#00#, 16#00#, 16#19#, 16#80#, 16#00#, 16#00#, 16#31#, 16#80#, 16#00#, 16#00#, 16#63#, 16#00#, 16#00#, 16#00#, 16#C3#, 16#00#, 16#00#, 16#01#, 16#C3#, 16#00#, 16#00#, 16#01#, 16#83#, 16#00#, 16#00#, 16#03#, 16#03#, 16#00#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#0C#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#30#, 16#0C#, 16#00#, 16#00#, 16#60#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#0C#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#07#, 16#FE#, 16#00#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#E0#, 16#00#, 16#07#, 16#FF#, 16#E0#, 16#00#, 16#04#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#1B#, 16#FC#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#00#, 16#00#, 16#3E#, 16#07#, 16#00#, 16#00#, 16#10#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#02#, 16#00#, 16#0E#, 16#00#, 16#07#, 16#80#, 16#1C#, 16#00#, 16#03#, 16#E0#, 16#78#, 16#00#, 16#00#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#FC#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#7C#, 16#00#, 16#00#, 16#31#, 16#FF#, 16#00#, 16#00#, 16#63#, 16#87#, 16#80#, 16#00#, 16#66#, 16#01#, 16#80#, 16#00#, 16#6C#, 16#01#, 16#C0#, 16#00#, 16#78#, 16#00#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#40#, 16#00#, 16#C0#, 16#00#, 16#40#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#70#, 16#07#, 16#00#, 16#00#, 16#30#, 16#0E#, 16#00#, 16#00#, 16#1C#, 16#1C#, 16#00#, 16#00#, 16#1F#, 16#F8#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#F0#, 16#00#, 16#1F#, 16#FF#, 16#F0#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#80#, 16#00#, 16#03#, 16#83#, 16#C0#, 16#00#, 16#06#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#18#, 16#03#, 16#80#, 16#00#, 16#0E#, 16#0F#, 16#00#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#, 16#1C#, 16#0E#, 16#00#, 16#00#, 16#30#, 16#07#, 16#00#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#0E#, 16#00#, 16#00#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#F0#, 16#78#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#80#, 16#00#, 16#01#, 16#C1#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#C0#, 16#00#, 16#06#, 16#00#, 16#60#, 16#00#, 16#0C#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#F0#, 16#00#, 16#38#, 16#01#, 16#A0#, 16#00#, 16#18#, 16#03#, 16#E0#, 16#00#, 16#1C#, 16#07#, 16#60#, 16#00#, 16#0E#, 16#0E#, 16#60#, 16#00#, 16#07#, 16#F8#, 16#60#, 16#00#, 16#03#, 16#E0#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#01#, 16#FF#, 16#00#, 16#00#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#07#, 16#F0#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#FF#, 16#F8#, 16#03#, 16#FF#, 16#FF#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#F0#, 16#07#, 16#FF#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#80#, 16#00#, 16#0F#, 16#01#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#80#, 16#00#, 16#03#, 16#83#, 16#C0#, 16#00#, 16#07#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#0F#, 16#C0#, 16#00#, 16#60#, 16#3F#, 16#80#, 16#00#, 16#60#, 16#71#, 16#80#, 16#00#, 16#C0#, 16#C1#, 16#80#, 16#00#, 16#C1#, 16#81#, 16#80#, 16#00#, 16#C1#, 16#81#, 16#80#, 16#00#, 16#C3#, 16#03#, 16#00#, 16#00#, 16#C3#, 16#03#, 16#00#, 16#01#, 16#83#, 16#03#, 16#00#, 16#01#, 16#83#, 16#03#, 16#00#, 16#01#, 16#83#, 16#83#, 16#00#, 16#01#, 16#81#, 16#FF#, 16#00#, 16#01#, 16#80#, 16#7F#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#18#, 16#00#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#F8#, 16#00#, 16#00#, 16#3F#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#DC#, 16#00#, 16#00#, 16#00#, 16#CC#, 16#00#, 16#00#, 16#01#, 16#8C#, 16#00#, 16#00#, 16#01#, 16#8C#, 16#00#, 16#00#, 16#03#, 16#0C#, 16#00#, 16#00#, 16#06#, 16#0C#, 16#00#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#0C#, 16#06#, 16#00#, 16#00#, 16#08#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#7F#, 16#C0#, 16#3F#, 16#F0#, 16#7F#, 16#C0#, 16#3F#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#C0#, 16#00#, 16#18#, 16#01#, 16#E0#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#60#, 16#01#, 16#C0#, 16#00#, 16#60#, 16#07#, 16#80#, 16#00#, 16#7F#, 16#FE#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#00#, 16#00#, 16#40#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#E0#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#00#, 16#03#, 16#80#, 16#03#, 16#00#, 16#07#, 16#00#, 16#3F#, 16#FF#, 16#FE#, 16#00#, 16#3F#, 16#FF#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#8C#, 16#00#, 16#07#, 16#81#, 16#EC#, 16#00#, 16#1C#, 16#00#, 16#78#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#38#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#C0#, 16#00#, 16#18#, 16#01#, 16#80#, 16#00#, 16#10#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#C0#, 16#01#, 16#E0#, 16#07#, 16#80#, 16#00#, 16#F0#, 16#1E#, 16#00#, 16#00#, 16#3F#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FC#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#30#, 16#03#, 16#80#, 16#00#, 16#30#, 16#01#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#0E#, 16#00#, 16#03#, 16#00#, 16#1C#, 16#00#, 16#06#, 16#00#, 16#78#, 16#00#, 16#3F#, 16#FF#, 16#E0#, 16#00#, 16#3F#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#F8#, 16#01#, 16#FF#, 16#FF#, 16#F8#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#20#, 16#30#, 16#00#, 16#00#, 16#60#, 16#30#, 16#00#, 16#00#, 16#60#, 16#30#, 16#00#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#00#, 16#40#, 16#60#, 16#00#, 16#00#, 16#C0#, 16#60#, 16#00#, 16#00#, 16#C0#, 16#60#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#80#, 16#01#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#3F#, 16#FF#, 16#FF#, 16#80#, 16#3F#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#FC#, 16#01#, 16#FF#, 16#FF#, 16#FC#, 16#00#, 16#18#, 16#00#, 16#0C#, 16#00#, 16#18#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#20#, 16#30#, 16#00#, 16#00#, 16#60#, 16#30#, 16#00#, 16#00#, 16#60#, 16#30#, 16#00#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#00#, 16#40#, 16#60#, 16#00#, 16#00#, 16#C0#, 16#60#, 16#00#, 16#00#, 16#C0#, 16#60#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#CC#, 16#00#, 16#07#, 16#81#, 16#FC#, 16#00#, 16#1E#, 16#00#, 16#38#, 16#00#, 16#38#, 16#00#, 16#18#, 16#00#, 16#70#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#7F#, 16#F8#, 16#06#, 16#00#, 16#7F#, 16#F8#, 16#06#, 16#00#, 16#00#, 16#40#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#07#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#80#, 16#01#, 16#80#, 16#01#, 16#C0#, 16#03#, 16#80#, 16#00#, 16#F0#, 16#0F#, 16#80#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#0F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#83#, 16#FC#, 16#00#, 16#7F#, 16#83#, 16#FC#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#E0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#7F#, 16#FF#, 16#C0#, 16#00#, 16#7F#, 16#FF#, 16#80#, 16#00#, 16#40#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#00#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#1F#, 16#F0#, 16#7F#, 16#C0#, 16#1F#, 16#F0#, 16#7F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#F0#, 16#00#, 16#1F#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#01#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#02#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#0E#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#07#, 16#00#, 16#18#, 16#00#, 16#03#, 16#80#, 16#30#, 16#00#, 16#01#, 16#C0#, 16#E0#, 16#00#, 16#00#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#C1#, 16#FE#, 16#01#, 16#FF#, 16#C1#, 16#FE#, 16#00#, 16#18#, 16#00#, 16#70#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#07#, 16#00#, 16#00#, 16#30#, 16#0E#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#, 16#00#, 16#30#, 16#70#, 16#00#, 16#00#, 16#60#, 16#E0#, 16#00#, 16#00#, 16#63#, 16#80#, 16#00#, 16#00#, 16#67#, 16#80#, 16#00#, 16#00#, 16#6D#, 16#E0#, 16#00#, 16#00#, 16#78#, 16#70#, 16#00#, 16#00#, 16#F0#, 16#38#, 16#00#, 16#00#, 16#C0#, 16#18#, 16#00#, 16#00#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#0E#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#3F#, 16#F8#, 16#07#, 16#E0#, 16#3F#, 16#F0#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#20#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#1F#, 16#FF#, 16#FF#, 16#C0#, 16#1F#, 16#FF#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#1F#, 16#03#, 16#F8#, 16#00#, 16#3F#, 16#00#, 16#D8#, 16#00#, 16#7C#, 16#00#, 16#D8#, 16#00#, 16#6C#, 16#00#, 16#CC#, 16#00#, 16#CC#, 16#00#, 16#CC#, 16#01#, 16#C8#, 16#00#, 16#CC#, 16#01#, 16#98#, 16#01#, 16#8C#, 16#03#, 16#18#, 16#01#, 16#86#, 16#07#, 16#18#, 16#01#, 16#86#, 16#06#, 16#18#, 16#01#, 16#86#, 16#0C#, 16#30#, 16#01#, 16#06#, 16#1C#, 16#30#, 16#03#, 16#07#, 16#18#, 16#30#, 16#03#, 16#03#, 16#30#, 16#30#, 16#03#, 16#03#, 16#60#, 16#30#, 16#03#, 16#03#, 16#60#, 16#60#, 16#06#, 16#03#, 16#C0#, 16#60#, 16#06#, 16#01#, 16#80#, 16#60#, 16#06#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#7F#, 16#C0#, 16#1F#, 16#F0#, 16#7F#, 16#C0#, 16#1F#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#03#, 16#FF#, 16#03#, 16#FC#, 16#03#, 16#FF#, 16#00#, 16#3C#, 16#00#, 16#18#, 16#00#, 16#3C#, 16#00#, 16#30#, 16#00#, 16#26#, 16#00#, 16#30#, 16#00#, 16#66#, 16#00#, 16#30#, 16#00#, 16#67#, 16#00#, 16#30#, 16#00#, 16#63#, 16#00#, 16#30#, 16#00#, 16#43#, 16#00#, 16#60#, 16#00#, 16#C1#, 16#80#, 16#60#, 16#00#, 16#C1#, 16#80#, 16#60#, 16#00#, 16#C1#, 16#C0#, 16#60#, 16#00#, 16#C0#, 16#C0#, 16#40#, 16#00#, 16#80#, 16#C0#, 16#C0#, 16#01#, 16#80#, 16#60#, 16#C0#, 16#01#, 16#80#, 16#60#, 16#C0#, 16#01#, 16#80#, 16#70#, 16#C0#, 16#01#, 16#80#, 16#31#, 16#80#, 16#03#, 16#00#, 16#31#, 16#80#, 16#03#, 16#00#, 16#19#, 16#80#, 16#03#, 16#00#, 16#19#, 16#80#, 16#03#, 16#00#, 16#1D#, 16#80#, 16#03#, 16#00#, 16#0F#, 16#00#, 16#06#, 16#00#, 16#0F#, 16#00#, 16#3F#, 16#F0#, 16#07#, 16#00#, 16#3F#, 16#F0#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#80#, 16#00#, 16#07#, 16#83#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#E0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#38#, 16#01#, 16#80#, 16#00#, 16#18#, 16#01#, 16#80#, 16#00#, 16#18#, 16#03#, 16#00#, 16#00#, 16#18#, 16#03#, 16#00#, 16#00#, 16#18#, 16#02#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#10#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#20#, 16#06#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#E0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#07#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#1E#, 16#00#, 16#00#, 16#F0#, 16#78#, 16#00#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FE#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#18#, 16#01#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#03#, 16#80#, 16#00#, 16#60#, 16#0F#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#80#, 16#00#, 16#0F#, 16#83#, 16#C0#, 16#00#, 16#1C#, 16#00#, 16#E0#, 16#00#, 16#38#, 16#00#, 16#70#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#38#, 16#01#, 16#80#, 16#00#, 16#18#, 16#01#, 16#80#, 16#00#, 16#18#, 16#03#, 16#00#, 16#00#, 16#18#, 16#03#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#18#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#E0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#07#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#01#, 16#80#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#F0#, 16#78#, 16#00#, 16#00#, 16#3F#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#C1#, 16#80#, 16#03#, 16#FF#, 16#FF#, 16#80#, 16#03#, 16#80#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FE#, 16#00#, 16#01#, 16#FF#, 16#FF#, 16#80#, 16#00#, 16#18#, 16#01#, 16#C0#, 16#00#, 16#18#, 16#00#, 16#E0#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#20#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#01#, 16#C0#, 16#00#, 16#60#, 16#03#, 16#80#, 16#00#, 16#60#, 16#0F#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#C0#, 16#78#, 16#00#, 16#00#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#01#, 16#80#, 16#0E#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#3F#, 16#F8#, 16#01#, 16#F0#, 16#3F#, 16#F0#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#90#, 16#00#, 16#07#, 16#83#, 16#F0#, 16#00#, 16#0E#, 16#00#, 16#F0#, 16#00#, 16#18#, 16#00#, 16#70#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#02#, 16#00#, 16#01#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#07#, 16#00#, 16#01#, 16#80#, 16#07#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#07#, 16#00#, 16#07#, 16#80#, 16#0E#, 16#00#, 16#06#, 16#E0#, 16#3C#, 16#00#, 16#04#, 16#7F#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#FC#, 16#00#, 16#7F#, 16#FF#, 16#FC#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#00#, 16#C0#, 16#30#, 16#0C#, 16#00#, 16#C0#, 16#30#, 16#18#, 16#00#, 16#C0#, 16#30#, 16#18#, 16#00#, 16#80#, 16#60#, 16#08#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#F8#, 16#00#, 16#01#, 16#FF#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#83#, 16#FF#, 16#01#, 16#FF#, 16#83#, 16#FF#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#01#, 16#80#, 16#07#, 16#00#, 16#01#, 16#80#, 16#0E#, 16#00#, 16#01#, 16#C0#, 16#1C#, 16#00#, 16#00#, 16#F0#, 16#78#, 16#00#, 16#00#, 16#7F#, 16#E0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FE#, 16#00#, 16#FF#, 16#03#, 16#FE#, 16#00#, 16#FF#, 16#00#, 16#E0#, 16#00#, 16#0C#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#60#, 16#00#, 16#20#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#03#, 16#00#, 16#00#, 16#30#, 16#03#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#18#, 16#0C#, 16#00#, 16#00#, 16#18#, 16#0C#, 16#00#, 16#00#, 16#18#, 16#18#, 16#00#, 16#00#, 16#18#, 16#18#, 16#00#, 16#00#, 16#18#, 16#30#, 16#00#, 16#00#, 16#1C#, 16#60#, 16#00#, 16#00#, 16#0C#, 16#60#, 16#00#, 16#00#, 16#0C#, 16#C0#, 16#00#, 16#00#, 16#0D#, 16#80#, 16#00#, 16#00#, 16#0D#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#01#, 16#FF#, 16#03#, 16#FF#, 16#01#, 16#FF#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#00#, 16#C0#, 16#10#, 16#18#, 16#00#, 16#C0#, 16#70#, 16#18#, 16#00#, 16#C0#, 16#F0#, 16#18#, 16#01#, 16#80#, 16#B0#, 16#30#, 16#01#, 16#81#, 16#B0#, 16#30#, 16#01#, 16#81#, 16#30#, 16#30#, 16#01#, 16#83#, 16#30#, 16#60#, 16#01#, 16#82#, 16#30#, 16#60#, 16#01#, 16#86#, 16#18#, 16#60#, 16#01#, 16#84#, 16#18#, 16#C0#, 16#01#, 16#8C#, 16#18#, 16#C0#, 16#01#, 16#88#, 16#18#, 16#C0#, 16#01#, 16#98#, 16#19#, 16#80#, 16#03#, 16#10#, 16#19#, 16#80#, 16#03#, 16#30#, 16#19#, 16#80#, 16#03#, 16#20#, 16#1B#, 16#00#, 16#03#, 16#60#, 16#1B#, 16#00#, 16#03#, 16#40#, 16#1B#, 16#00#, 16#03#, 16#C0#, 16#1E#, 16#00#, 16#03#, 16#80#, 16#1E#, 16#00#, 16#03#, 16#80#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#FE#, 16#00#, 16#FE#, 16#01#, 16#FE#, 16#00#, 16#30#, 16#00#, 16#30#, 16#00#, 16#38#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#01#, 16#80#, 16#00#, 16#0E#, 16#03#, 16#00#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#07#, 16#0C#, 16#00#, 16#00#, 16#03#, 16#18#, 16#00#, 16#00#, 16#03#, 16#B0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#03#, 16#60#, 16#00#, 16#00#, 16#06#, 16#70#, 16#00#, 16#00#, 16#0C#, 16#30#, 16#00#, 16#00#, 16#18#, 16#38#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#, 16#00#, 16#60#, 16#0C#, 16#00#, 16#00#, 16#C0#, 16#0E#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#03#, 16#00#, 16#3F#, 16#E0#, 16#3F#, 16#C0#, 16#3F#, 16#E0#, 16#3F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#00#, 16#FE#, 16#00#, 16#FE#, 16#00#, 16#FE#, 16#00#, 16#38#, 16#00#, 16#30#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#C0#, 16#00#, 16#0C#, 16#01#, 16#80#, 16#00#, 16#0C#, 16#03#, 16#80#, 16#00#, 16#06#, 16#03#, 16#00#, 16#00#, 16#06#, 16#06#, 16#00#, 16#00#, 16#03#, 16#0C#, 16#00#, 16#00#, 16#03#, 16#18#, 16#00#, 16#00#, 16#01#, 16#B0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#01#, 16#FF#, 16#FC#, 16#00#, 16#01#, 16#FF#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#FF#, 16#F0#, 16#00#, 16#1F#, 16#FF#, 16#E0#, 16#00#, 16#18#, 16#00#, 16#60#, 16#00#, 16#18#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#01#, 16#C0#, 16#00#, 16#30#, 16#03#, 16#80#, 16#00#, 16#30#, 16#07#, 16#00#, 16#00#, 16#20#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#03#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#00#, 16#07#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#F0#, 16#00#, 16#00#, 16#0F#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#00#, 16#07#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#03#, 16#FC#, 16#00#, 16#00#, 16#03#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#6C#, 16#00#, 16#00#, 16#00#, 16#C6#, 16#00#, 16#00#, 16#01#, 16#87#, 16#00#, 16#00#, 16#07#, 16#03#, 16#00#, 16#00#, 16#0E#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#01#, 16#80#, 16#00#, 16#38#, 16#00#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#FF#, 16#FF#, 16#E0#, 16#FF#, 16#FF#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#3F#, 16#FE#, 16#00#, 16#00#, 16#38#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#0F#, 16#F3#, 16#00#, 16#00#, 16#7F#, 16#FF#, 16#00#, 16#01#, 16#F0#, 16#03#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#07#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#06#, 16#00#, 16#04#, 16#00#, 16#06#, 16#00#, 16#0C#, 16#00#, 16#0E#, 16#00#, 16#0C#, 16#00#, 16#3C#, 16#00#, 16#06#, 16#00#, 16#7C#, 16#00#, 16#07#, 16#03#, 16#CF#, 16#C0#, 16#03#, 16#FF#, 16#0F#, 16#C0#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#7C#, 16#00#, 16#00#, 16#61#, 16#FF#, 16#00#, 16#00#, 16#67#, 16#03#, 16#C0#, 16#00#, 16#6C#, 16#01#, 16#C0#, 16#00#, 16#D8#, 16#00#, 16#E0#, 16#00#, 16#F0#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#00#, 16#70#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#03#, 16#80#, 16#00#, 16#60#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#80#, 16#01#, 16#80#, 16#03#, 16#C0#, 16#03#, 16#00#, 16#06#, 16#E0#, 16#0E#, 16#00#, 16#7E#, 16#78#, 16#3C#, 16#00#, 16#7E#, 16#3F#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#FC#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#30#, 16#00#, 16#1E#, 16#07#, 16#F0#, 16#00#, 16#38#, 16#01#, 16#F0#, 16#00#, 16#70#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#03#, 16#C0#, 16#00#, 16#F0#, 16#1F#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#03#, 16#F0#, 16#30#, 16#00#, 16#0F#, 16#FC#, 16#30#, 16#00#, 16#3C#, 16#0E#, 16#30#, 16#00#, 16#70#, 16#03#, 16#60#, 16#00#, 16#E0#, 16#03#, 16#60#, 16#01#, 16#C0#, 16#01#, 16#E0#, 16#01#, 16#80#, 16#00#, 16#E0#, 16#03#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#80#, 16#06#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#07#, 16#80#, 16#03#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#80#, 16#1B#, 16#00#, 16#01#, 16#E0#, 16#F3#, 16#E0#, 16#00#, 16#FF#, 16#C3#, 16#E0#, 16#00#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#FE#, 16#00#, 16#00#, 16#3C#, 16#07#, 16#80#, 16#00#, 16#70#, 16#03#, 16#80#, 16#00#, 16#E0#, 16#00#, 16#C0#, 16#01#, 16#C0#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#60#, 16#07#, 16#FF#, 16#FF#, 16#E0#, 16#07#, 16#FF#, 16#FF#, 16#E0#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#F0#, 16#1F#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#1F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#, 16#1F#, 16#FE#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#E0#, 16#00#, 16#7F#, 16#FF#, 16#E0#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#FE#, 16#00#, 16#07#, 16#FF#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#0F#, 16#F8#, 16#7C#, 16#00#, 16#3C#, 16#1C#, 16#7C#, 16#00#, 16#70#, 16#06#, 16#C0#, 16#00#, 16#E0#, 16#03#, 16#C0#, 16#01#, 16#C0#, 16#03#, 16#C0#, 16#01#, 16#80#, 16#01#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#07#, 16#00#, 16#07#, 16#00#, 16#0F#, 16#00#, 16#03#, 16#00#, 16#1B#, 16#00#, 16#03#, 16#80#, 16#36#, 16#00#, 16#01#, 16#E0#, 16#E6#, 16#00#, 16#00#, 16#FF#, 16#C6#, 16#00#, 16#00#, 16#3F#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#01#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#7C#, 16#00#, 16#00#, 16#31#, 16#FF#, 16#00#, 16#00#, 16#37#, 16#07#, 16#80#, 16#00#, 16#3C#, 16#01#, 16#80#, 16#00#, 16#68#, 16#01#, 16#80#, 16#00#, 16#70#, 16#01#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#40#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#80#, 16#01#, 16#80#, 16#03#, 16#80#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#07#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#1F#, 16#E0#, 16#3F#, 16#C0#, 16#1F#, 16#E0#, 16#7F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#E0#, 16#00#, 16#00#, 16#3F#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#40#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#0F#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#1F#, 16#E0#, 16#00#, 16#18#, 16#1F#, 16#E0#, 16#00#, 16#18#, 16#0E#, 16#00#, 16#00#, 16#30#, 16#18#, 16#00#, 16#00#, 16#30#, 16#70#, 16#00#, 16#00#, 16#30#, 16#E0#, 16#00#, 16#00#, 16#31#, 16#80#, 16#00#, 16#00#, 16#67#, 16#00#, 16#00#, 16#00#, 16#6E#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#00#, 16#00#, 16#00#, 16#73#, 16#80#, 16#00#, 16#00#, 16#61#, 16#80#, 16#00#, 16#00#, 16#C1#, 16#C0#, 16#00#, 16#00#, 16#C0#, 16#E0#, 16#00#, 16#00#, 16#C0#, 16#70#, 16#00#, 16#00#, 16#C0#, 16#30#, 16#00#, 16#01#, 16#80#, 16#18#, 16#00#, 16#01#, 16#80#, 16#1C#, 16#00#, 16#1F#, 16#80#, 16#7F#, 16#C0#, 16#1F#, 16#80#, 16#7F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#20#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#00#, 16#07#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#03#, 16#C0#, 16#07#, 16#9F#, 16#87#, 16#E0#, 16#07#, 16#B1#, 16#CC#, 16#70#, 16#01#, 16#E0#, 16#D8#, 16#30#, 16#01#, 16#C0#, 16#F0#, 16#30#, 16#01#, 16#80#, 16#E0#, 16#30#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#03#, 16#00#, 16#C0#, 16#30#, 16#03#, 16#00#, 16#C0#, 16#20#, 16#03#, 16#01#, 16#80#, 16#60#, 16#06#, 16#01#, 16#80#, 16#60#, 16#06#, 16#01#, 16#80#, 16#60#, 16#06#, 16#01#, 16#80#, 16#60#, 16#06#, 16#01#, 16#80#, 16#C0#, 16#04#, 16#03#, 16#00#, 16#C0#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#0C#, 16#03#, 16#00#, 16#C0#, 16#7F#, 16#03#, 16#C1#, 16#F0#, 16#7F#, 16#07#, 16#C1#, 16#F0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7C#, 16#00#, 16#01#, 16#F1#, 16#FF#, 16#00#, 16#01#, 16#F3#, 16#07#, 16#80#, 16#00#, 16#3C#, 16#01#, 16#80#, 16#00#, 16#78#, 16#01#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#00#, 16#06#, 16#00#, 16#1F#, 16#E0#, 16#3F#, 16#C0#, 16#1F#, 16#E0#, 16#3F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#07#, 16#FF#, 16#00#, 16#00#, 16#1E#, 16#07#, 16#80#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#C0#, 16#00#, 16#E0#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#60#, 16#02#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#07#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#01#, 16#C0#, 16#0E#, 16#00#, 16#00#, 16#E0#, 16#78#, 16#00#, 16#00#, 16#7F#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#00#, 16#07#, 16#E3#, 16#FF#, 16#80#, 16#07#, 16#E7#, 16#03#, 16#C0#, 16#00#, 16#CC#, 16#01#, 16#E0#, 16#00#, 16#D8#, 16#00#, 16#E0#, 16#00#, 16#F0#, 16#00#, 16#60#, 16#00#, 16#E0#, 16#00#, 16#30#, 16#00#, 16#C0#, 16#00#, 16#30#, 16#01#, 16#C0#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#20#, 16#01#, 16#80#, 16#00#, 16#60#, 16#03#, 16#80#, 16#00#, 16#60#, 16#03#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#C0#, 16#01#, 16#C0#, 16#03#, 16#C0#, 16#03#, 16#80#, 16#03#, 16#60#, 16#07#, 16#00#, 16#06#, 16#78#, 16#1E#, 16#00#, 16#06#, 16#3F#, 16#F8#, 16#00#, 16#06#, 16#0F#, 16#E0#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#FF#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#00#, 16#00#, 16#0F#, 16#FC#, 16#3E#, 16#00#, 16#3C#, 16#0E#, 16#3E#, 16#00#, 16#70#, 16#03#, 16#60#, 16#00#, 16#E0#, 16#01#, 16#E0#, 16#01#, 16#C0#, 16#01#, 16#E0#, 16#01#, 16#80#, 16#00#, 16#E0#, 16#03#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#00#, 16#C0#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#01#, 16#80#, 16#06#, 16#00#, 16#03#, 16#80#, 16#07#, 16#00#, 16#07#, 16#80#, 16#03#, 16#00#, 16#0D#, 16#80#, 16#03#, 16#80#, 16#1B#, 16#00#, 16#01#, 16#E0#, 16#73#, 16#00#, 16#00#, 16#FF#, 16#E3#, 16#00#, 16#00#, 16#3F#, 16#83#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#7F#, 16#03#, 16#E0#, 16#00#, 16#7F#, 16#0F#, 16#F8#, 16#00#, 16#06#, 16#3C#, 16#18#, 16#00#, 16#06#, 16#70#, 16#00#, 16#00#, 16#07#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#0F#, 16#FF#, 16#FC#, 16#00#, 16#0F#, 16#FF#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F8#, 16#00#, 16#00#, 16#0F#, 16#FE#, 16#40#, 16#00#, 16#1E#, 16#07#, 16#C0#, 16#00#, 16#38#, 16#01#, 16#C0#, 16#00#, 16#70#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#80#, 16#00#, 16#60#, 16#00#, 16#80#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#78#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#E0#, 16#00#, 16#00#, 16#07#, 16#FC#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#03#, 16#80#, 16#03#, 16#00#, 16#03#, 16#80#, 16#03#, 16#00#, 16#03#, 16#00#, 16#03#, 16#00#, 16#07#, 16#00#, 16#07#, 16#80#, 16#0E#, 16#00#, 16#07#, 16#E0#, 16#3C#, 16#00#, 16#06#, 16#FF#, 16#F0#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#08#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#03#, 16#FF#, 16#FF#, 16#00#, 16#03#, 16#FF#, 16#FF#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#00#, 16#E0#, 16#1F#, 16#00#, 16#00#, 16#7F#, 16#FC#, 16#00#, 16#00#, 16#1F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#0F#, 16#E0#, 16#03#, 16#F0#, 16#0F#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#01#, 16#80#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#01#, 16#80#, 16#07#, 16#00#, 16#01#, 16#80#, 16#1E#, 16#00#, 16#01#, 16#80#, 16#3E#, 16#00#, 16#01#, 16#C1#, 16#E7#, 16#C0#, 16#00#, 16#FF#, 16#C7#, 16#C0#, 16#00#, 16#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#FE#, 16#07#, 16#FE#, 16#07#, 16#FE#, 16#07#, 16#FE#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#70#, 16#03#, 16#00#, 16#00#, 16#30#, 16#03#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#0C#, 16#00#, 16#00#, 16#18#, 16#18#, 16#00#, 16#00#, 16#18#, 16#18#, 16#00#, 16#00#, 16#18#, 16#30#, 16#00#, 16#00#, 16#18#, 16#60#, 16#00#, 16#00#, 16#1C#, 16#60#, 16#00#, 16#00#, 16#0C#, 16#C0#, 16#00#, 16#00#, 16#0D#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F8#, 16#01#, 16#FE#, 16#07#, 16#F8#, 16#01#, 16#FE#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#30#, 16#01#, 16#80#, 16#00#, 16#60#, 16#01#, 16#80#, 16#C0#, 16#60#, 16#01#, 16#81#, 16#E0#, 16#40#, 16#01#, 16#81#, 16#E0#, 16#C0#, 16#01#, 16#83#, 16#60#, 16#C0#, 16#01#, 16#83#, 16#61#, 16#80#, 16#01#, 16#86#, 16#61#, 16#80#, 16#01#, 16#8E#, 16#63#, 16#00#, 16#01#, 16#8C#, 16#63#, 16#00#, 16#01#, 16#9C#, 16#23#, 16#00#, 16#01#, 16#98#, 16#36#, 16#00#, 16#01#, 16#B0#, 16#36#, 16#00#, 16#01#, 16#B0#, 16#3C#, 16#00#, 16#01#, 16#E0#, 16#3C#, 16#00#, 16#00#, 16#E0#, 16#38#, 16#00#, 16#00#, 16#C0#, 16#38#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#FE#, 16#07#, 16#F8#, 16#01#, 16#FE#, 16#07#, 16#F8#, 16#00#, 16#70#, 16#00#, 16#C0#, 16#00#, 16#38#, 16#03#, 16#80#, 16#00#, 16#1C#, 16#07#, 16#00#, 16#00#, 16#0C#, 16#0E#, 16#00#, 16#00#, 16#06#, 16#18#, 16#00#, 16#00#, 16#07#, 16#70#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#00#, 16#00#, 16#0E#, 16#E0#, 16#00#, 16#00#, 16#1C#, 16#70#, 16#00#, 16#00#, 16#38#, 16#38#, 16#00#, 16#00#, 16#70#, 16#1C#, 16#00#, 16#00#, 16#C0#, 16#0C#, 16#00#, 16#03#, 16#80#, 16#06#, 16#00#, 16#07#, 16#00#, 16#07#, 16#00#, 16#1F#, 16#E0#, 16#7F#, 16#C0#, 16#1F#, 16#E0#, 16#7F#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#FC#, 16#03#, 16#FC#, 16#03#, 16#FC#, 16#03#, 16#FC#, 16#00#, 16#E0#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#60#, 16#00#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#70#, 16#01#, 16#80#, 16#00#, 16#30#, 16#03#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#30#, 16#06#, 16#00#, 16#00#, 16#18#, 16#0C#, 16#00#, 16#00#, 16#18#, 16#18#, 16#00#, 16#00#, 16#18#, 16#30#, 16#00#, 16#00#, 16#1C#, 16#30#, 16#00#, 16#00#, 16#0C#, 16#60#, 16#00#, 16#00#, 16#0C#, 16#C0#, 16#00#, 16#00#, 16#0C#, 16#C0#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#7F#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#FF#, 16#C0#, 16#00#, 16#3F#, 16#FF#, 16#C0#, 16#00#, 16#60#, 16#01#, 16#80#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#60#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#38#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#03#, 16#00#, 16#00#, 16#C0#, 16#03#, 16#00#, 16#01#, 16#80#, 16#03#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#, 16#03#, 16#FF#, 16#FE#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#80#, 16#00#, 16#00#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#07#, 16#80#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#07#, 16#00#, 16#00#, 16#00#, 16#07#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#18#, 16#00#, 16#00#, 16#00#, 16#10#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#04#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#30#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#60#, 16#00#, 16#00#, 16#00#, 16#70#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#00#, 16#00#, 16#01#, 16#80#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#1C#, 16#00#, 16#00#, 16#00#, 16#F8#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#3F#, 16#80#, 16#60#, 16#00#, 16#E1#, 16#C0#, 16#E0#, 16#01#, 16#C0#, 16#E3#, 16#C0#, 16#01#, 16#80#, 16#7F#, 16#00#, 16#00#, 16#00#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#); Font_D : aliased constant Bitmap_Font := ( Bytes_Per_Glyph => 188, Glyph_Width => 32, Glyph_Height => 47, Data => FreeMonoOblique24pt7bBitmaps'Access); Font : constant Bitmap_Font_Ref := Font_D'Access; end GESTE_Fonts.FreeMonoOblique24pt7b;
package body Adda.Defaults is function Hash (Element : in Integer) return Hash_Type is begin return Hash_Type (Element); end Hash; end Adda.Defaults;
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by John Self of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE scanner generation -- AUTHOR: John Self (UCI) -- DESCRIPTION -- NOTES does actual generation (writing) of output aflex scanners -- $Header: /dc/uc/self/arcadia/aflex/ada/src/RCS/genB.a,v 1.25 1992/10/02 23:08:41 self Exp self $ with Ada.Characters.Conversions; with Ada.Integer_Wide_Wide_Text_IO; with Ada.Strings.Unbounded; with Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; with Ada.Strings.Wide_Wide_Fixed; with Ada.Wide_Wide_Text_IO; with MISC_DEFS, MISC; with Scanner, SKELETON_MANAGER, EXTERNAL_FILE_MANAGER; use MISC_DEFS; with Parser_Tokens; use Parser_Tokens; with Unicode; package body Gen is use Ada.Characters.Conversions; use Ada.Integer_Wide_Wide_Text_IO; use Ada.Strings; use Ada.Strings.Wide_Wide_Fixed; use Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO; use Unicode; INDENT_LEVEL : INTEGER := 0; -- each level is 3 spaces MAX_SHORT : constant INTEGER := 32767; procedure INDENT_UP is begin INDENT_LEVEL := INDENT_LEVEL + 1; end INDENT_UP; pragma INLINE(INDENT_UP); procedure INDENT_DOWN is begin INDENT_LEVEL := INDENT_LEVEL - 1; end INDENT_DOWN; pragma INLINE(INDENT_DOWN); procedure SET_INDENT(INDENT_VAL : in INTEGER) is begin INDENT_LEVEL := INDENT_VAL; end SET_INDENT; --------------- -- Do_Indent -- --------------- -- Indent to the current level. procedure Do_Indent is begin Set_Col (Ada.Wide_Wide_Text_IO.Count (INDENT_LEVEL) * 3 + 1); end Do_Indent; -- generate the code to keep backtracking information procedure GEN_BACKTRACKING is begin if (NUM_BACKTRACKING = 0) then return; end if; INDENT_PUTS("if (yy_accept(yy_current_state) /= 0 ) then"); INDENT_UP; INDENT_PUTS("yy_last_accepting_state := yy_current_state;"); INDENT_PUTS("yy_last_accepting_cpos := yy_cp;"); INDENT_DOWN; INDENT_PUTS("end if;"); end GEN_BACKTRACKING; -- generate the code to perform the backtrack procedure GEN_BT_ACTION is begin if (NUM_BACKTRACKING = 0) then return; end if; SET_INDENT(4); INDENT_PUTS ("when 0 => -- must backtrack"); INDENT_UP; if (FULLTBL) then INDENT_PUTS ("yy_cp := yy_last_accepting_cpos + 1;"); else -- backtracking info for compressed tables is taken \after/ -- yy_cp has been incremented for the next state INDENT_PUTS("yy_cp := yy_last_accepting_cpos;"); end if; INDENT_PUTS("yy_current_state := yy_last_accepting_state;"); NEW_LINE; INDENT_PUTS("goto next_action;"); INDENT_DOWN; NEW_LINE; SET_INDENT(0); end GEN_BT_ACTION; -- generate equivalence-class table procedure GENECS is I : INTEGER; NUMROWS : INTEGER; Most_Used : Primary_Stage_Index := 0; begin -- Handle case insensitive mapping, converts values to positive range for J in 1 .. CSIZE loop if CASEINS and then (J >= CHARACTER'POS('A') and J <= CHARACTER'POS('Z')) then ECGROUP (J) := ECGROUP (MISC.CLOWER (J)); end if; ECGROUP (J) := abs ECGROUP (J); end loop; -- Compact data using two stage table technique for J in ECGROUP_Use_Count'Range loop ECGROUP_Use_Count (J) := 0; end loop; for J in ECGROUP_Plane'Range loop for K in 0 .. J loop if ECGROUP (Integer (J) * 256 .. Integer (J) * 256 + 255) = ECGROUP (Integer (K) * 256 .. Integer (K) * 256 + 255) then ECGROUP_Plane (J) := K; ECGROUP_Use_Count (K) := ECGROUP_Use_Count (K) + 1; exit; end if; end loop; end loop; for J in ECGROUP_Use_Count'Range loop if ECGROUP_Use_Count (J) > ECGROUP_Use_Count (Most_Used) then Most_Used := J; end if; end loop; Put_Line ("type Secondary_Stage_Index is range 0 .. 16#FF#;"); Put_Line ("type Primary_Stage_Index is range 0 .. 16#10FF#;"); Put_Line ("type Secondary_Stage_Array is" & " array (Secondary_Stage_Index) of Short;"); Put_Line ("type Secondary_Stage_Array_Access is" & " access constant Secondary_Stage_Array;"); for J in ECGROUP_Plane'Range loop if ECGROUP_Plane (J) = J then Put_Line ("yy_ec_" & Trim (Primary_Stage_Index'Wide_Wide_Image (J), Both) & " : aliased constant Secondary_Stage_Array :="); Put_Line (" ("); for K in Secondary_Stage_Index'Range loop Misc.MKDATA (ECGROUP (Integer (J) * 256 + Integer (K))); end loop; Misc.DATAEND; end if; end loop; Put_Line ("yy_ec_base : constant"); Put_Line (" array (Primary_Stage_Index) of Secondary_Stage_Array_Access :="); for J in ECGROUP_Plane'Range loop if ECGROUP_Plane (J) /= Most_Used then if J = ECGROUP_Plane'First then Put (" ("); elsif J mod 3 = 0 then Put_Line (","); Put (" "); else Put (", "); end if; Put (Integer (J), 6); Put (" => yy_ec_" & Trim (Primary_Stage_Index'Wide_Wide_Image (ECGROUP_Plane (J)), Both) & "'Access"); end if; end loop; Put_Line (", others => yy_ec_" & Trim (Primary_Stage_Index'Wide_Wide_Image (Most_Used), Both) & "'Access);"); -- Generate function to replace yy_ec constant without modification of -- all code around. New_Line; Put_Line ("function yy_ec (Item : Wide_Wide_Character) return short is"); Put_Line (" Code : constant Integer := Wide_Wide_Character'Pos (Item);"); Put_Line (" Group : constant Primary_Stage_Index :="); Put_Line (" Primary_Stage_Index (Code / 256);"); Put_Line (" Offset : constant Secondary_Stage_Index :="); Put_Line (" Secondary_Stage_Index (Code mod 256);"); New_Line; Put_Line ("begin"); Put_Line (" return yy_ec_base (Group) (Offset);"); Put_Line ("end yy_ec;"); -- XXX It can be useful to output pack infomation if TRACE then NEW_LINE(STANDARD_ERROR); NEW_LINE(STANDARD_ERROR); PUT(STANDARD_ERROR, "Equivalence Classes:"); NEW_LINE(STANDARD_ERROR); NEW_LINE(STANDARD_ERROR); NUMROWS := (CSIZE + 1)/8; for J in 1 .. NUMROWS loop I := J; while (I <= CSIZE) loop PUT (STANDARD_ERROR, To_Wide_Wide_String (Ada.Strings.Unbounded.To_String (MISC.Readable_Form(Wide_Wide_Character'Val (I))))); PUT(STANDARD_ERROR, " = "); PUT(STANDARD_ERROR, ECGROUP(I), 1); PUT(STANDARD_ERROR, " "); I := I + NUMROWS; end loop; NEW_LINE(STANDARD_ERROR); end loop; end if; end GENECS; -- generate the code to find the action number procedure GEN_FIND_ACTION is begin INDENT_PUTS("yy_act := yy_accept(yy_current_state);"); end GEN_FIND_ACTION; -- genftbl - generates full transition table procedure GENFTBL is END_OF_BUFFER_ACTION : constant INTEGER := NUM_RULES + 1; -- *everything* is done in terms of arrays starting at 1, so provide -- a null entry for the zero element of all C arrays begin PUT("yy_accept : constant array(0.."); PUT(LASTDFA, 1); PUT_LINE(") of short :="); PUT_LINE(" ( 0,"); DFAACC(END_OF_BUFFER_STATE).DFAACC_STATE := END_OF_BUFFER_ACTION; for I in 1 .. LASTDFA loop declare ANUM : constant INTEGER := DFAACC(I).DFAACC_STATE; begin MISC.MKDATA(ANUM); if (TRACE and (ANUM /= 0)) then PUT(STANDARD_ERROR, "state # "); PUT(STANDARD_ERROR, I, 1); PUT(STANDARD_ERROR, " accepts: ["); PUT(STANDARD_ERROR, ANUM, 1); PUT(STANDARD_ERROR, "]"); NEW_LINE(STANDARD_ERROR); end if; end; end loop; MISC.DATAEND; if (USEECS) then GENECS; end if; -- don't have to dump the actual full table entries - they were created -- on-the-fly end GENFTBL; -- generate the code to find the next compressed-table state procedure GEN_NEXT_COMPRESSED_STATE is begin Indent_Puts ("Index := yy_cp;"); Indent_Puts ("Next (yy_ch_buf, Index, Code);"); if USEECS then INDENT_PUTS("yy_c := yy_ec(Code);"); else INDENT_PUTS("yy_c := Code;"); end if; -- if (USEECS) then -- INDENT_PUTS("yy_c := yy_ec(Current (yy_ch_buf, yy_cp));"); -- else -- INDENT_PUTS("yy_c := Current (yy_ch_buf, yy_cp);"); -- end if; -- save the backtracking info \before/ computing the next state -- because we always compute one more state than needed - we -- always proceed until we reach a jam state GEN_BACKTRACKING; INDENT_PUTS( "while ( yy_chk(yy_base(yy_current_state) + yy_c) /= yy_current_state ) loop" ); INDENT_UP; INDENT_PUTS("yy_current_state := yy_def(yy_current_state);"); if (USEMECS) then -- we've arrange it so that templates are never chained -- to one another. This means we can afford make a -- very simple test to see if we need to convert to -- yy_c's meta-equivalence class without worrying -- about erroneously looking up the meta-equivalence -- class twice Do_Indent; -- lastdfa + 2 is the beginning of the templates Put_Line ("if yy_current_state >= YY_FIRST_TEMPLATE then"); INDENT_UP; INDENT_PUTS("yy_c := yy_meta(yy_c);"); INDENT_DOWN; INDENT_PUTS("end if;"); end if; INDENT_DOWN; INDENT_PUTS("end loop;"); INDENT_PUTS("yy_current_state := yy_nxt(yy_base(yy_current_state) + yy_c);") ; INDENT_DOWN; end GEN_NEXT_COMPRESSED_STATE; -- generate the code to find the next match procedure GEN_NEXT_MATCH is -- note - changes in here should be reflected in get_next_state begin if (FULLTBL) then INDENT_PUTS( "yy_current_state := yy_nxt(yy_current_state, Current (yy_ch_buf, yy_cp)));"); INDENT_PUTS("while ( yy_current_state > 0 ) loop"); INDENT_UP; INDENT_PUTS("yy_cp := Index;"); INDENT_PUTS( "yy_current_state := yy_nxt(yy_current_state, Current (yy_ch_buf, yy_cp));"); INDENT_DOWN; INDENT_PUTS("end loop;"); INDENT_PUTS("yy_current_state := -yy_current_state;"); if (NUM_BACKTRACKING > 0) then GEN_BACKTRACKING; end if; NEW_LINE; else -- compressed INDENT_PUTS("loop"); INDENT_UP; GEN_NEXT_STATE; INDENT_PUTS("yy_cp := Index;"); if (INTERACTIVE) then Put_Line (" exit when yy_base (yy_current_state) = YY_JAMBASE;"); else Put_Line (" exit when yy_current_state = YY_JAMSTATE;"); end if; INDENT_DOWN; Do_Indent; PUT_LINE("end loop;"); if (not INTERACTIVE) then INDENT_PUTS("yy_cp := yy_last_accepting_cpos;"); INDENT_PUTS("yy_current_state := yy_last_accepting_state;"); end if; end if; end GEN_NEXT_MATCH; -- generate the code to find the next state procedure GEN_NEXT_STATE is -- note - changes in here should be reflected in get_next_match begin INDENT_UP; if (FULLTBL) then INDENT_PUTS("yy_current_state := yy_nxt(yy_current_state,"); INDENT_PUTS(" Current (yy_ch_buf, yy_cp));"); GEN_BACKTRACKING; else GEN_NEXT_COMPRESSED_STATE; end if; end GEN_NEXT_STATE; -- generate the code to find the start state procedure GEN_START_STATE is begin INDENT_PUTS("yy_current_state := yy_start;"); if (BOL_NEEDED) then INDENT_PUTS("if Previous (yy_ch_buf, yy_bp) = Ada.Characters.Wide_Wide_Latin_1.LF then"); INDENT_UP; INDENT_PUTS("yy_current_state := yy_current_state + 1;"); INDENT_DOWN; INDENT_PUTS("end if;"); end if; end GEN_START_STATE; -- gentabs - generate data statements for the transition tables procedure GENTABS is I, K, TOTAL_STATES : INTEGER; ACC_ARRAY : INT_PTR; END_OF_BUFFER_ACTION : constant INTEGER := NUM_RULES + 1; -- *everything* is done in terms of arrays starting at 1, so provide -- a null entry for the zero element of all C arrays begin ACC_ARRAY := ALLOCATE_INTEGER_ARRAY(CURRENT_MAX_DFAS); NUMMT := 0; -- the compressed table format jams by entering the "jam state", -- losing information about the previous state in the process. -- In order to recover the previous state, we effectively need -- to keep backtracking information. NUM_BACKTRACKING := NUM_BACKTRACKING + 1; DFAACC(END_OF_BUFFER_STATE).DFAACC_STATE := END_OF_BUFFER_ACTION; for CNT in 1 .. LASTDFA loop ACC_ARRAY(CNT) := DFAACC(CNT).DFAACC_STATE; end loop; ACC_ARRAY(LASTDFA + 1) := 0; -- add accepting number for the jam state -- spit out ALIST array, dumping the accepting numbers. -- "lastdfa + 2" is the size of ALIST; includes room for arrays -- beginning at 0 and for "jam" state K := LASTDFA + 2; PUT("yy_accept : constant array(0.."); PUT(K - 1, 1); PUT_LINE(") of short :="); PUT_LINE(" ( 0,"); for CNT in 1 .. LASTDFA loop MISC.MKDATA(ACC_ARRAY(CNT)); if (TRACE and (ACC_ARRAY(CNT) /= 0)) then PUT(STANDARD_ERROR, "state # "); PUT(STANDARD_ERROR, CNT, 1); PUT(STANDARD_ERROR, " accepts: ["); PUT(STANDARD_ERROR, ACC_ARRAY(CNT), 1); PUT(STANDARD_ERROR, ']'); NEW_LINE(STANDARD_ERROR); end if; end loop; -- add entry for "jam" state MISC.MKDATA(ACC_ARRAY(LASTDFA + 1)); MISC.DATAEND; if (USEECS) then GENECS; end if; if (USEMECS) then -- write out meta-equivalence classes (used to index templates with) if (TRACE) then NEW_LINE(STANDARD_ERROR); NEW_LINE(STANDARD_ERROR); PUT_LINE(STANDARD_ERROR, "Meta-Equivalence Classes:"); end if; PUT("yy_meta : constant array(0.."); PUT(NUMECS, 1); PUT_LINE(") of short :="); PUT_LINE(" ( 0,"); for CNT in 1 .. NUMECS loop if (TRACE) then PUT(STANDARD_ERROR, CNT, 1); PUT(STANDARD_ERROR, " = "); PUT(STANDARD_ERROR, abs(TECBCK(CNT)), 1); NEW_LINE(STANDARD_ERROR); end if; MISC.MKDATA(abs(TECBCK(CNT))); end loop; MISC.DATAEND; end if; TOTAL_STATES := LASTDFA + NUMTEMPS; PUT("yy_base : constant array(0.."); PUT(TOTAL_STATES, 1); if (TBLEND > MAX_SHORT) then PUT_LINE(") of integer :="); else PUT_LINE(") of short :="); end if; PUT_LINE(" ( 0,"); for CNT in 1 .. LASTDFA loop declare D : constant INTEGER := DEF(CNT); begin if (BASE(CNT) = JAMSTATE_CONST) then BASE(CNT) := JAMBASE; end if; if (D = JAMSTATE_CONST) then DEF(CNT) := JAMSTATE; else if (D < 0) then -- template reference TMPUSES := TMPUSES + 1; DEF(CNT) := LASTDFA - D + 1; end if; end if; MISC.MKDATA(BASE(CNT)); end; end loop; -- generate jam state's base index I := LASTDFA + 1; MISC.MKDATA(BASE(I)); -- skip jam state I := I + 1; for CNT in I .. TOTAL_STATES loop MISC.MKDATA(BASE(CNT)); DEF(CNT) := JAMSTATE; end loop; MISC.DATAEND; PUT("yy_def : constant array(0.."); PUT(TOTAL_STATES, 1); if (TBLEND > MAX_SHORT) then PUT_LINE(") of integer :="); else PUT_LINE(") of short :="); end if; PUT_LINE(" ( 0,"); for CNT in 1 .. TOTAL_STATES loop MISC.MKDATA(DEF(CNT)); end loop; MISC.DATAEND; PUT("yy_nxt : constant array(0.."); PUT(TBLEND, 1); if (LASTDFA > MAX_SHORT) then PUT_LINE(") of integer :="); else PUT_LINE(") of short :="); end if; PUT_LINE(" ( 0,"); for CNT in 1 .. TBLEND loop if ((NXT(CNT) = 0) or (CHK(CNT) = 0)) then NXT(CNT) := JAMSTATE; -- new state is the JAM state end if; MISC.MKDATA(NXT(CNT)); end loop; MISC.DATAEND; PUT("yy_chk : constant array(0.."); PUT(TBLEND, 1); if (LASTDFA > MAX_SHORT) then PUT_LINE(") of integer :="); else PUT_LINE(") of short :="); end if; PUT_LINE(" ( 0,"); for CNT in 1 .. TBLEND loop if (CHK(CNT) = 0) then NUMMT := NUMMT + 1; end if; MISC.MKDATA(CHK(CNT)); end loop; MISC.DATAEND; exception when STORAGE_ERROR => Misc.Aflex_Fatal ("dynamic memory failure in gentabs()"); end GENTABS; ----------------- -- INDENT_PUTS -- ----------------- -- write out a string at the current indentation level, adding a final -- newline procedure INDENT_PUTS(STR : Wide_Wide_String) is begin Do_Indent; PUT_LINE (STR); end INDENT_PUTS; -- do_sect3_out - dumps section 3. procedure DO_SECT3_OUT is GARBAGE : TOKEN; pragma Unreferenced (GARBAGE); begin Scanner.CALL_YYLEX := TRUE; GARBAGE := Scanner.YYLex; end DO_SECT3_OUT; -- make_tables - generate transition tables -- -- -- Generates transition tables and finishes generating output file ----------------- -- Body_Header -- ----------------- procedure Body_Header is Output_Body_File : File_Type; begin Put_Line ("package " & Misc.Basename & " is"); DO_SECT3_OUT; Put_Line ("end " & Misc.Basename & ";"); External_File_Manager.Get_Scanner_Body_File (Output_Body_File); Skeleton_Manager.Skel_Out; DO_SECT3_OUT; Put ("with " & Misc.Basename & ".DFA; "); Put_Line ("use " & Misc.Basename & ".DFA;"); Put ("with " & Misc.Basename & ".IO; "); Put_Line ("use " & Misc.Basename & ".IO;"); Put_Line ("package body " & Misc.Basename & " is"); DO_SECT3_OUT; end Body_Header; procedure MAKE_TABLES is DID_EOF_RULE : BOOLEAN := FALSE; BUF : Unbounded_Wide_Wide_String; begin if (not FULLTBL) then -- if we used full tables this is already output DO_SECT3_OUT; BODY_HEADER; -- intent of this call is to get everything up to ## SKELETON_MANAGER.SKEL_OUT; -- output YYLex code up to part about tables. end if; PUT(" YY_END_OF_BUFFER : constant := "); PUT(NUM_RULES + 1, 1); PUT_LINE(";"); if INTERACTIVE then Put (" YY_JAMBASE : constant := "); Put (JAMBASE, 1); Put_Line (";"); else Put (" YY_JAMSTATE : constant := "); Put (JAMSTATE, 1); Put_Line (";"); end if; -- lastdfa + 2 is the beginning of the templates Put (" YY_FIRST_TEMPLATE : constant := "); Put (LASTDFA + 2, 1); Put_Line (";"); INDENT_PUTS("YY_Current_State : YY_State_Type;"); -- now output the constants for the various start conditions RESET (DEF_FILE, IN_FILE); while not END_OF_FILE(DEF_FILE) loop GET_LINE (DEF_FILE, BUF); PUT_LINE (BUF); end loop; if (FULLTBL) then GENFTBL; else GENTABS; end if; RESET (TEMP_ACTION_FILE, IN_FILE); -- generate code for yy_get_previous_state SET_INDENT(1); SKELETON_MANAGER.SKEL_OUT; if (BOL_NEEDED) then INDENT_PUTS("yy_bp : integer := yytext_ptr;"); end if; SKELETON_MANAGER.SKEL_OUT; GEN_START_STATE; SKELETON_MANAGER.SKEL_OUT; GEN_NEXT_STATE; SKELETON_MANAGER.SKEL_OUT; SET_INDENT(2); INDENT_PUTS("yy_bp := yy_cp;"); GEN_START_STATE; GEN_NEXT_MATCH; SKELETON_MANAGER.SKEL_OUT; SET_INDENT(3); GEN_FIND_ACTION; SET_INDENT(1); SKELETON_MANAGER.SKEL_OUT; INDENT_UP; GEN_BT_ACTION; MISC.ACTION_OUT; MISC.ACTION_OUT; -- Generate cases for any missing EOF rules. SET_INDENT (4); for I in 1 .. LASTSC loop if not SCEOF (I) then Do_Indent; if not DID_EOF_RULE then PUT ("when "); else PUT (" | "); end if; PUT ("YY_END_OF_BUFFER + "); PUT (SCNAME (I)); PUT (" + 1 "); DID_EOF_RULE := TRUE; end if; end loop; if DID_EOF_RULE then Do_Indent; Put_Line ("=>"); end if; if DID_EOF_RULE then INDENT_UP; INDENT_PUTS("return End_Of_Input;"); INDENT_DOWN; end if; SKELETON_MANAGER.SKEL_OUT; -- copy remainder of input to output MISC.LINE_DIRECTIVE_OUT; DO_SECT3_OUT; -- copy remainder of input, after ##, to the scanner file. end MAKE_TABLES; end GEN;
-- Abstract : -- -- Summarize error recover log. -- -- Copyright (C) 2019 Stephen Leake All Rights Reserved. -- -- This program is free software; you can redistribute it and/or -- modify it under terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3, or (at -- your option) any later version. This program is distributed in the -- hope that it will be useful, but WITHOUT ANY WARRANTY; without even -- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. You -- should have received a copy of the GNU General Public License -- distributed with this program; see file COPYING. If not, write to -- the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, -- MA 02110-1335, USA. pragma License (GPL); with Ada.Command_Line; with Ada.Exceptions; with Ada.Long_Float_Text_IO; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Traceback.Symbolic; with SAL.Gen_Stats.Gen_Image; with SAL.Long_Float_Stats; with WisiToken.Parse.LR; procedure Recover_Stats is subtype Strategies is WisiToken.Parse.LR.Strategies; File : File_Type; Delimiters : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set (",() "); Number : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set ("0123456789"); type Strategy_Counts is array (Strategies) of Natural; type Recover_Label is (Full, Partial); type Recover_Summary is record Event_Count : Integer := 0; -- 1 per recover event (1 line in log file) Enqueue_Stats : SAL.Long_Float_Stats.Stats_Type; Check_Stats : SAL.Long_Float_Stats.Stats_Type; Strat_Counts_Total : Strategy_Counts := (others => 0); Strat_Counts_Present : Strategy_Counts := (others => 0); -- 1 per recover event if used Ignore_Error : Integer := 0; -- ie, error is name mismatch. Recover_Count_Present : Integer := 0; -- 1 per parser in recover result Recover_Count_Total : Integer := 0; -- Sum of all strategy counts Fail_Event_Count : Integer := 0; -- for all reasons Fail_Enqueue_Limit : Integer := 0; Fail_No_Configs_Left : Integer := 0; Fail_Programmer_Error : Integer := 0; Fail_Other : Integer := 0; end record; Summary : array (Recover_Label) of Recover_Summary; begin Open (File, In_File, Ada.Command_Line.Argument (1)); loop exit when End_Of_File (File); declare -- The recover log is written by code in -- wisitoken-parse-lr-parser.adb Parse (search for Recover_Log). -- -- A line has the syntax: -- yyyy-mm-dd hh:mm:ss <partial> <success> pre_parser_count '<file_name>' (<parser_data>)... -- -- where there is one (<parser_data) for each parser active after recover. <parser_data> is: -- -- (<strategy_counts>) <enqueue_count> <check_count> <success> -- -- Note that the per-parser success is always TRUE; it would not be -- active if recover had failed. Line : constant String := Get_Line (File); First : Integer := Index (Line, " "); -- after date Last : Integer; Label : Recover_Label := Full; function Line_Eq (Item : in String) return Boolean is begin return Line (First .. First + Item'Length - 1) = Item; end Line_Eq; function Next_Integer return Integer is begin Find_Token (Line, Number, From => Last + 1, Test => Ada.Strings.Inside, First => First, Last => Last); return Integer'Value (Line (First .. Last)); exception when Constraint_Error => raise Constraint_Error with "bad integer '" & Line (First .. Last - 1) & "' " & Ada.Text_IO.Count'Image (Ada.Text_IO.Line (File) - 1) & First'Image & Last'Image; end Next_Integer; function Next_Boolean return Boolean is begin First := Last + 2; Last := -1 + Index (Line, Delimiters, First); return Boolean'Value (Line (First .. Last)); end Next_Boolean; function Read_Strat_Counts (Strategy_Found : out Boolean) return Strategy_Counts is begin Strategy_Found := False; Last := Index (Line, "(", Last + 1); return Result : Strategy_Counts do for I in Strategies loop Result (I) := Next_Integer; if Result (I) > 0 then Strategy_Found := True; end if; end loop; Last := 1 + Index (Line, ")", Last + 1); end return; end Read_Strat_Counts; begin First := Index (Line, " ", First + 1); -- after time Last := Index (Line, " ", First + 1); -- after Partial_Parse_Active if Boolean'Value (Line (First + 1 .. Last - 1)) then Label := Partial; end if; Summary (Label).Event_Count := Summary (Label).Event_Count + 1; First := Last + 1; if Line (First .. First + 3) = "FAIL" then Summary (Label).Fail_Event_Count := Summary (Label).Fail_Event_Count + 1; First := First + 4; if Line_Eq ("NO_CONFIGS_LEFT") then Summary (Label).Fail_No_Configs_Left := Summary (Label).Fail_No_Configs_Left + 1; elsif Line_Eq ("ENQUEUE_LIMIT") then Summary (Label).Fail_Enqueue_Limit := Summary (Label).Fail_Enqueue_Limit + 1; elsif Line_Eq ("PROGRAMMER_ERROR") then Summary (Label).Fail_Programmer_Error := Summary (Label).Fail_Programmer_Error + 1; else Summary (Label).Fail_Other := Summary (Label).Fail_Other + 1; end if; else -- Process per-parser data Last := Index (Line, "(", Last + 1); loop exit when Line (Last + 1) = ')'; declare Strategy_Found : Boolean; Strat_Counts : constant Strategy_Counts := Read_Strat_Counts (Strategy_Found); Enqueue_Count : constant Integer := Next_Integer; Check_Count : constant Integer := Next_Integer; Success : constant Boolean := Next_Boolean; pragma Unreferenced (Success); begin Summary (Label).Recover_Count_Present := Summary (Label).Recover_Count_Present + 1; if not Strategy_Found then Summary (Label).Ignore_Error := Summary (Label).Ignore_Error + 1; else -- We don't include Ignore_Error enqueue and check counts in the -- stats, because they distort them towards 1. Summary (Label).Enqueue_Stats.Accumulate (Long_Float (Enqueue_Count)); Summary (Label).Check_Stats.Accumulate (Long_Float (Check_Count)); for I in Strategies loop Summary (Label).Recover_Count_Total := Summary (Label).Recover_Count_Total + Strat_Counts (I); Summary (Label).Strat_Counts_Total (I) := Summary (Label).Strat_Counts_Total (I) + Strat_Counts (I); if Strat_Counts (I) > 0 then Summary (Label).Strat_Counts_Present (I) := Summary (Label).Strat_Counts_Present (I) + 1; end if; end loop; end if; end; end loop; end if; end; end loop; declare use Ada.Strings; Label_Field : String (1 .. 23); -- fits strategy and fail labels Count_Field : String (1 .. 8); Percent_Field : String (1 .. 4); -- Shared by Put_If, Put_Percent procedure Put_If (Summary_Label : in Recover_Label; Name : in String; Count : in Integer; Always : in Boolean := False) is Percent_Present : constant Integer := Integer (100.0 * Float (Count) / Float (Summary (Summary_Label).Event_Count)); begin if Count > 0 or Always then Move (Name, Label_Field); Put (Label_Field & " => "); Move (Count'Image, Count_Field, Justify => Right); Put (Count_Field); Move (Percent_Present'Image & "%", Percent_Field, Justify => Right); Put_Line (Percent_Field); end if; end Put_If; package Stats_Image is new SAL.Long_Float_Stats.Gen_Image (Real_IO => Ada.Long_Float_Text_IO, Default_Mean_Fore => 7, Default_Mean_Aft => 0, Default_Mean_Exp => 0, Default_Sd_Fore => 7, Default_Sd_Aft => 1, Default_Sd_Exp => 0); procedure Put_Percent (Summary_Label : in Recover_Label; Present, Total : in Integer; Name : in String) is Percent_Present : constant Integer := Integer (100.0 * Float (Present) / Float (Summary (Summary_Label).Recover_Count_Present)); Percent_Total : constant Integer := Integer (100.0 * Float (Total) / Float (Summary (Summary_Label).Recover_Count_Total)); begin Move (Name, Label_Field); Put (Label_Field); Move (Present'Image, Count_Field, Justify => Right); Put (Count_Field); Move (Percent_Present'Image & "%", Percent_Field, Justify => Right); Put (Percent_Field & " /"); Move (Total'Image, Count_Field, Justify => Right); Put (Count_Field); Move (Percent_Total'Image & "%", Percent_Field, Justify => Right); Put_Line (Percent_Field); end Put_Percent; begin for I in Recover_Label loop Put_Line (I'Image); Put_Line ("present/total:" & Summary (I).Event_Count'Image & " /" & Summary (I).Recover_Count_Total'Image); if Summary (I).Event_Count > 0 then Put_Line (" mean std. dev. min max"); Put_Line ("Enqueue: " & Stats_Image.Image (Summary (I).Enqueue_Stats.Display)); Put_Line ("Check: " & Stats_Image.Image (Summary (I).Check_Stats.Display)); Put_If (I, "FAIL", Summary (I).Fail_Event_Count, Always => True); Put_If (I, "FAIL_ENQUEUE_LIMIT", Summary (I).Fail_Enqueue_Limit); Put_If (I, "FAIL_NO_CONFIGS_LEFT", Summary (I).Fail_No_Configs_Left); Put_If (I, "FAIL_PROGRAMMER_ERROR", Summary (I).Fail_Programmer_Error); Put_If (I, "FAIL_OTHER", Summary (I).Fail_Other); for J in Strategies loop Put_Percent (I, Summary (I).Strat_Counts_Present (J), Summary (I).Strat_Counts_Total (J), J'Image); end loop; Put_Percent (I, Summary (I).Ignore_Error, Summary (I).Ignore_Error, "Ignore_Error"); end if; New_Line; end loop; end; exception when E : others => Put_Line (Ada.Exceptions.Exception_Name (E) & ": " & Ada.Exceptions.Exception_Message (E)); Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E)); end Recover_Stats;
with Ada.Exceptions.Finally; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with System.Address_To_Named_Access_Conversions; with System.Tasks; package body Ada.Task_Attributes is use type System.Address; package Holder is new Exceptions.Finally.Scoped_Holder ( System.Tasks.Attribute_Index, System.Tasks.Free); Index : aliased System.Tasks.Attribute_Index; function Cast is new Unchecked_Conversion ( Task_Identification.Task_Id, System.Tasks.Task_Id); package Attribute_Handle_Conv is new System.Address_To_Named_Access_Conversions ( Attribute, Attribute_Handle); procedure Free is new Unchecked_Deallocation (Attribute, Attribute_Handle); procedure Finalize (Item : System.Address); procedure Finalize (Item : System.Address) is P : Attribute_Handle := Attribute_Handle_Conv.To_Pointer (Item); begin Free (P); end Finalize; -- implementation function Value ( T : Task_Identification.Task_Id := Task_Identification.Current_Task) return Attribute is begin if Task_Identification.Is_Terminated (T) then raise Tasking_Error; end if; return Result : Attribute do declare procedure Process (Item : System.Address); procedure Process (Item : System.Address) is begin if Item = System.Null_Address then Result := Initial_Value; else Result := Attribute_Handle_Conv.To_Pointer (Item).all; end if; end Process; begin System.Tasks.Query (Cast (T), Index, Process'Access); end; end return; end Value; function Reference ( T : Task_Identification.Task_Id := Task_Identification.Current_Task) return not null Attribute_Handle is begin if Task_Identification.Is_Terminated (T) then raise Tasking_Error; end if; declare function New_Item return System.Address; function New_Item return System.Address is begin return Attribute_Handle_Conv.To_Address ( new Attribute'(Initial_Value)); end New_Item; Result : System.Address; begin System.Tasks.Reference ( Cast (T), Index, New_Item'Access, Finalize'Access, Result); return Attribute_Handle_Conv.To_Pointer (Result); end; end Reference; procedure Set_Value ( Val : Attribute; T : Task_Identification.Task_Id := Task_Identification.Current_Task) is begin if Task_Identification.Is_Terminated (T) then raise Tasking_Error; end if; declare function New_Item return System.Address; function New_Item return System.Address is begin return Attribute_Handle_Conv.To_Address (new Attribute'(Val)); end New_Item; begin System.Tasks.Set ( Cast (T), Index, New_Item'Access, Finalize'Access); end; end Set_Value; procedure Reinitialize ( T : Task_Identification.Task_Id := Task_Identification.Current_Task) is begin if Task_Identification.Is_Terminated (T) then raise Tasking_Error; end if; System.Tasks.Clear (Cast (T), Index); end Reinitialize; begin System.Tasks.Allocate (Index); Holder.Assign (Index); end Ada.Task_Attributes;
-- C61008A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT CONSTRAINT_ERROR IS NOT RAISED IF THE DEFAULT VALUE -- FOR A FORMAL PARAMETER DOES NOT SATISFY THE CONSTRAINTS OF THE -- SUBTYPE_INDICATION WHEN THE DECLARATION IS ELABORATED, ONLY WHEN -- THE DEFAULT IS USED. -- SUBTESTS ARE: -- (A) ARRAY PARAMETERS CONSTRAINED WITH NONSTATIC BOUNDS AND -- INITIALIZED WITH A STATIC AGGREGATE. -- (B) A SCALAR PARAMETER WITH NON-STATIC RANGE CONSTRAINTS -- INITIALIZED WITH A STATIC VALUE. -- (C) A RECORD PARAMETER WHOSE COMPONENTS HAVE NON-STATIC -- CONSTRAINTS INITIALIZED WITH A STATIC AGGREGATE. -- (D) AN ARRAY PARAMETER CONSTRAINED WITH STATIC BOUNDS ON SUB- -- SCRIPTS AND NON-STATIC BOUNDS ON COMPONENTS, INITIALIZED -- WITH A STATIC AGGREGATE. -- (E) A RECORD PARAMETER WITH A NON-STATIC CONSTRAINT -- INITIALIZED WITH A STATIC AGGREGATE. -- DAS 1/20/81 -- SPS 10/26/82 -- VKG 1/13/83 -- SPS 2/9/83 -- BHS 7/9/84 WITH REPORT; PROCEDURE C61008A IS USE REPORT; BEGIN TEST ("C61008A", "CHECK THAT CONSTRAINT_ERROR IS NOT RAISED IF " & "AN INITIALIZATION VALUE DOES NOT SATISFY " & "CONSTRAINTS ON A FORMAL PARAMETER"); -------------------------------------------------- DECLARE -- (A) PROCEDURE PA (I1, I2 : INTEGER) IS TYPE A1 IS ARRAY (1..I1,1..I2) OF INTEGER; PROCEDURE PA1 (A : A1 := ((1,0),(0,1))) IS BEGIN FAILED ("BODY OF PA1 EXECUTED"); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN PA1"); END PA1; BEGIN PA1; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PA1"); END PA; BEGIN -- (A) PA (IDENT_INT(1), IDENT_INT(10)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN CALL TO PA"); END; -- (A) -------------------------------------------------- DECLARE -- (B) PROCEDURE PB (I1, I2 : INTEGER) IS SUBTYPE INT IS INTEGER RANGE I1..I2; PROCEDURE PB1 (I : INT := -1) IS BEGIN FAILED ("BODY OF PB1 EXECUTED"); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN PB1"); END PB1; BEGIN PB1; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PB1"); END PB; BEGIN -- (B) PB (IDENT_INT(0), IDENT_INT(63)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN CALL TO PB"); END; -- (B) -------------------------------------------------- DECLARE -- (C) PROCEDURE PC (I1, I2 : INTEGER) IS TYPE AR1 IS ARRAY (1..3) OF INTEGER RANGE I1..I2; TYPE REC IS RECORD I : INTEGER RANGE I1..I2; A : AR1 ; END RECORD; PROCEDURE PC1 (R : REC := (-3,(0,2,3))) IS BEGIN FAILED ("BODY OF PC1 EXECUTED"); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN PC1"); END PC1; BEGIN PC1; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PC1"); END PC; BEGIN -- (C) PC (IDENT_INT(1), IDENT_INT(3)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN CALL TO PC"); END; -- (C) -------------------------------------------------- DECLARE -- (D1) PROCEDURE P1D (I1, I2 : INTEGER) IS TYPE A1 IS ARRAY (1..2,1..2) OF INTEGER RANGE I1..I2; PROCEDURE P1D1 (A : A1 := ((1,-1),(1,2))) IS BEGIN FAILED ("BODY OF P1D1 EXECUTED"); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN P1D1"); END P1D1; BEGIN P1D1; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - P1D1"); END P1D; BEGIN -- (D1) P1D (IDENT_INT(1), IDENT_INT(2)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN CALL TO P1D"); END; -- (D1) -------------------------------------------------- DECLARE -- (D2) PROCEDURE P2D (I1, I2 : INTEGER) IS TYPE A1 IS ARRAY (1..2,1..2) OF INTEGER RANGE I1..I2; PROCEDURE P2D1 (A : A1 := (3..4 => (1,2))) IS BEGIN FAILED ("BODY OF P2D1 EXECUTED"); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN P2D1"); END P2D1; BEGIN P2D1; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - P2D1"); END P2D; BEGIN -- (D2) P2D (IDENT_INT(1), IDENT_INT(2)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN CALL TO P2D"); END; -- (D2) -------------------------------------------------- DECLARE -- (E) PROCEDURE PE (I1, I2 : INTEGER) IS SUBTYPE INT IS INTEGER RANGE 0..10; TYPE ARR IS ARRAY (1..3) OF INT; TYPE REC (I : INT) IS RECORD A : ARR; END RECORD; SUBTYPE REC4 IS REC(I1); PROCEDURE PE1 (R : REC4 := (3,(1,2,3))) IS BEGIN FAILED ("BODY OF PE1 EXECUTED"); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN PE1"); END PE1; BEGIN PE1; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PE1"); END PE; BEGIN -- (E) PE (IDENT_INT(4), IDENT_INT(10)); EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED IN CALL TO PE"); END; -- (E) -------------------------------------------------- RESULT; END C61008A;
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ file writer implementation -- -- |___/_|\_\_|_|____| by: Timm Felden -- -- -- pragma Ada_2012; with Ada.Text_IO; with Ada.Unchecked_Conversion; with Interfaces; with Skill.Containers.Vectors; with Skill.Field_Types.Builtin; with Skill.Field_Types.Builtin.String_Type_P; with Skill.Field_Declarations; use Skill.Field_Declarations; with Skill.Internal.Parts; with Skill.Streams.Reader; with Skill.Synchronization; with Skill.String_Pools; with Skill.Types.Pools; with Skill.Tasks; with Skill.Iterators.Type_Order; -- documentation can be found in java common -- this is a combination of serialization functions, write and append package body Skill.Internal.File_Writers is use type Types.Pools.Pool; -- offset calculation closure type Cl_Offset is new Tasks.Closure_T with record F : Skill.Field_Declarations.Field_Declaration; end record; type Cx_Offset is not null access Cl_Offset; function Cast is new Ada.Unchecked_Conversion (Skill.Tasks.Closure, Cx_Offset); -- write field closure type Cl_Write is new Tasks.Closure_T with record F : Skill.Field_Declarations.Field_Declaration; Map : Streams.Writer.Sub_Stream; end record; type Cx_Write is not null access Cl_Write; function Convert is new Ada.Unchecked_Conversion (Skill.Tasks.Closure, Cx_Write); -- write a file to disk procedure Write (State : Skill.Files.File; Output : Skill.Streams.Writer.Output_Stream) is String_Type : Skill.Field_Types.Builtin.String_Type_P.Field_Type := State.String_Type; Job_Failed_Concurrently : Boolean := False; procedure Make_LBPO_Map (P : Types.Pools.Pool; Lbpo_Map : in out Lbpo_Map_T; Next : Integer) is Pool : Types.Pools.Pool := P; Result : Integer := Next; begin while Pool /= null loop Lbpo_Map (Pool.Pool_Offset) := Result; Result := Result + Pool.Static_Size_With_Deleted; Pool := Pool.Next; end loop; end Make_LBPO_Map; procedure String (S : Types.String_Access) is begin Output.V64 (Types.v64 (String_Type.String_IDs.Element (S))); end String; procedure Write_Type (T : Field_Types.Field_Type) is begin Output.V64 (Types.v64 (T.ID)); case T.ID is when 0 => declare type X is access all Skill.Field_Types.Builtin.Constant_I8 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I8 (Cast (T).Value); end; when 1 => declare type X is access all Skill.Field_Types.Builtin.Constant_I16 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I16 (Cast (T).Value); end; when 2 => declare type X is access all Skill.Field_Types.Builtin.Constant_I32 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I32 (Cast (T).Value); end; when 3 => declare type X is access all Skill.Field_Types.Builtin.Constant_I64 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I64 (Cast (T).Value); end; when 4 => declare type X is access all Skill.Field_Types.Builtin.Constant_V64 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.V64 (Cast (T).Value); end; when 15 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Const_Arrays_P.Field_Type); begin Output.V64 (Cast (T).Length); Write_Type (Cast (T).Base); end; when 17 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Var_Arrays_P.Field_Type); begin Write_Type (Cast (T).Base); end; when 18 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.List_Type_P.Field_Type); begin Write_Type (Cast (T).Base); end; when 19 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Set_Type_P.Field_Type); begin Write_Type (Cast (T).Base); end; when 20 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Map_Type_P.Field_Type); begin Write_Type (Cast (T).Key); Write_Type (Cast (T).Value); end; when others => null; end case; end Write_Type; procedure Restrictions (S : Types.Pools.Pool) is begin -- todo Output.V64 (0); end Restrictions; procedure Restrictions (F : Field_Declaration) is begin -- todo Output.V64 (0); end Restrictions; -- index → bpo -- @note pools.par would not be possible if it were an actual Lbpo_Map : Lbpo_Map_T (0 .. Natural (State.Types.Length) - 1); -- barrier used for parallel processing Write_Barrier : Skill.Synchronization.Barrier; begin ---------------------- -- PHASE 1: Collect -- ---------------------- -- collect String instances from known string types; this is required, -- because we use plain strings -- @note this is a O(σ) operation:) -- @note we do not use generation time type info, because we want to treat -- generic fields as well declare Strings : Skill.String_Pools.Pool := State.Strings; procedure Add (This : Skill.Types.Pools.Pool) is procedure Add_Field (F : Field_Declarations.Field_Declaration) is Iter : aliased Skill.Iterators.Type_Order.Iterator; begin Strings.Add (F.Name); -- add string data if F.T.ID = 14 then Iter.Init (This); while Iter.Has_Next loop Strings.Add (Field_Types.Builtin.String_Type_P.Unboxed (Iter.Next.Dynamic.Reflective_Get (F))); end loop; end if; end Add_Field; begin Strings.Add (This.Skill_Name); This.Data_Fields.Foreach (Add_Field'Access); end Add; begin State.Types.Foreach (Add'Access); end; ------------------------------ -- PHASE 2: Check & Reorder -- ------------------------------ -- check consistency of the state, now that we aggregated all instances State.Check; -- make lbpo map, update data map to contain dynamic instances and create -- skill IDs for serialization declare procedure Make (This : Types.Pools.Pool) is function Cast is new Ada.Unchecked_Conversion (Types.Pools.Pool, Types.Pools.Base_Pool); begin if null = This.Super then This.Fixed (True); Make_LBPO_Map (This, Lbpo_Map, 0); Cast (This).Compress (Lbpo_Map); end if; end Make; begin State.Types.Foreach (Make'Access); end; -------------------- -- PHASE 3: Write -- -------------------- -- write string block State.Strings.Prepare_And_Write (Output, State.String_Type.String_IDs'Access); -- Calculate Offsets -- @note this has top happen after string IDs have been updated declare procedure Make (F : Field_Declaration) is procedure Calculate (C : Tasks.Closure) is begin Cast (C).F.Offset; Write_Barrier.Complete; exception when E : others => Job_Failed_Concurrently := True; Write_Barrier.Complete; Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "A task crashed during offset calculation: " & Cast (C).F.Name.all); end Calculate; T : Skill.Tasks.Run (Calculate'Access); C : Skill.Tasks.Closure := new Cl_Offset'(F => F); begin Write_Barrier.Start; T.Start (C); end Make; procedure Off (This : Types.Pools.Pool) is begin This.Data_Fields.Foreach (Make'Access); end Off; begin State.Types.Foreach (Off'Access); end; -- write count of the type block Output.V64 (Types.v64 (State.Types.Length)); -- write types declare use type Types.Pools.Pool; use type Interfaces.Integer_64; package A1 renames Field_Declarations.Field_Vector_P; Field_Queue : A1.Vector := A1.Empty_Vector; procedure Write_Type (This : Types.Pools.Pool) is Lcount : Types.v64 := Types.v64 (This.Blocks.Last_Element.Dynamic_Count); begin String (This.Skill_Name); Output.V64 (Lcount); Restrictions (This); if null = This.Super then Output.I8 (0); else Output.V64 (Types.v64 (This.Super.Pool_Offset + 1)); if 0 /= Lcount then Output.V64 (Types.v64 (Lbpo_Map (This.Pool_Offset))); end if; end if; Output.V64 (Types.v64 (This.Data_Fields.Length)); Field_Queue.Append_All (This.Data_Fields); end Write_Type; begin State.Types.Foreach (Write_Type'Access); -- await offsets before we can write fields Write_Barrier.Await; if Job_Failed_Concurrently then raise Program_Error with "internal error during offset calculation"; end if; -- write fields declare -- ArrayList<Task> data = new ArrayList<>(); End_Offset, Offset : Types.v64 := 0; procedure Write_Field (F : Field_Declaration) is P : Types.Pools.Pool := F.Owner.To_Pool; begin -- write info Output.V64 (Types.v64 (F.Index)); String (F.Name); Write_Type (F.T); Restrictions (F); End_Offset := Offset + F.Future_Offset; Output.V64 (End_Offset); -- update chunks and prepare write data F.Data_Chunks.Clear; F.Data_Chunks.Append (new Chunk_Entry_T' (C => new Skill.Internal.Parts.Bulk_Chunk' (Offset, 0, P.Size, 1), Input => Skill.Streams.Reader.Empty_Sub_Stream)); Offset := End_Offset; end Write_Field; begin Field_Queue.Foreach (Write_Field'Access); -- map field data Output.Begin_Block_Map (Offset); end; -- write field data declare procedure Write_Field (F : Field_Declarations.Field_Declaration) is procedure Job (C : Skill.Tasks.Closure) is begin Convert (C).F.Write (Convert (C).Map); Write_Barrier.Complete; pragma Assert (Convert (C).Map.Eof); Convert (C).Map.Close; exception when E : others => Job_Failed_Concurrently := True; Write_Barrier.Complete; Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "A task crashed during write data: " & Convert (C).F.Name.all); end Job; T : Skill.Tasks.Run (Job'Access); C : Skill.Tasks.Closure := new Cl_Write'(F => F, Map => Output.Map (F.Future_Offset)); begin Write_Barrier.Start; T.Start (C); end Write_Field; begin Field_Queue.Foreach (Write_Field'Access); -- await writing of actual field data Write_Barrier.Await; Output.End_Block_Map; if Job_Failed_Concurrently then raise Program_Error with "internal error during field write"; end if; end; end; -- we are done Output.Close; ----------------------- -- PHASE 4: Cleaning -- ----------------------- -- release data structures State.String_Type.String_IDs.Clear; -- unfix pools -- for (StoragePool<?, ?> p : state.types) { -- p.fixed(false); -- } -- } end Write; -------------------------------------------------------------------------------- ---------------------------------- APPEND -------------------------------------- -------------------------------------------------------------------------------- -- append a file to an existing one procedure Append (State : Skill.Files.File; Output : Skill.Streams.Writer.Output_Stream) is String_Type : Skill.Field_Types.Builtin.String_Type_P.Field_Type := State.String_Type; Job_Failed_Concurrently : Boolean := False; function Make_LBPO_Map (P : Types.Pools.Pool; Lbpo_Map : in out Lbpo_Map_T; Next : Integer) return Integer is Result : Integer := Next + P.Dynamic.New_Objects_Size; procedure Children (sub : Types.Pools.Sub_Pool) is begin Result := Make_LBPO_Map (sub.To_Pool, Lbpo_Map, Result); end Children; begin Lbpo_Map (P.Pool_Offset) := Next; P.Sub_Pools.Foreach (Children'Access); return Result; end Make_LBPO_Map; procedure String (S : Types.String_Access) is begin Output.V64 (Types.v64 (String_Type.String_IDs.Element (S))); end String; procedure Write_Type (T : Field_Types.Field_Type) is begin Output.V64 (Types.v64 (T.ID)); case T.ID is when 0 => declare type X is access all Skill.Field_Types.Builtin.Constant_I8 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I8 (Cast (T).Value); end; when 1 => declare type X is access all Skill.Field_Types.Builtin.Constant_I16 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I16 (Cast (T).Value); end; when 2 => declare type X is access all Skill.Field_Types.Builtin.Constant_I32 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I32 (Cast (T).Value); end; when 3 => declare type X is access all Skill.Field_Types.Builtin.Constant_I64 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.I64 (Cast (T).Value); end; when 4 => declare type X is access all Skill.Field_Types.Builtin.Constant_V64 .Field_Type; function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, X); begin Output.V64 (Cast (T).Value); end; when 15 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Const_Arrays_P.Field_Type); begin Output.V64 (Cast (T).Length); Write_Type (Cast (T).Base); end; when 17 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Var_Arrays_P.Field_Type); begin Write_Type (Cast (T).Base); end; when 18 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.List_Type_P.Field_Type); begin Write_Type (Cast (T).Base); end; when 19 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Set_Type_P.Field_Type); begin Write_Type (Cast (T).Base); end; when 20 => declare function Cast is new Ada.Unchecked_Conversion (Field_Types.Field_Type, Skill.Field_Types.Builtin.Map_Type_P.Field_Type); begin Write_Type (Cast (T).Key); Write_Type (Cast (T).Value); end; when others => null; end case; end Write_Type; procedure Restrictions (S : Types.Pools.Pool) is begin -- todo Output.V64 (0); end Restrictions; procedure Restrictions (F : Field_Declaration) is begin -- todo Output.V64 (0); end Restrictions; -- index of the first new pool New_Pool_Index : Natural := 0; -- index → bpo -- @note pools.par would not be possible if it were an actual Lbpo_Map : Lbpo_Map_T (0 .. Natural (State.Types.Length) - 1); Chunk_Map : Field_Declarations.Chunk_Map := new Chunk_Map_P.Map; -- relevant pools R_Pools : Skill.Types.Pools.Type_Vector := Types.Pools.P_Type_Vector.Empty_Vector; -- barrier used for parallel processing Write_Barrier : Skill.Synchronization.Barrier; begin ---------------------- -- PHASE 1: Collect -- ---------------------- -- collect String instances from known string types; this is required, -- because we use plain strings -- @note this is a O(σ) operation:) -- @note we do not use generation time type info, because we want to treat -- generic fields as well declare Strings : Skill.String_Pools.Pool := State.Strings; procedure Add (This : Skill.Types.Pools.Pool) is procedure Add_Field (F : Field_Declarations.Field_Declaration) is Iter : aliased Skill.Iterators.Type_Order.Iterator; begin Strings.Add (F.Name); -- add string data if F.T.ID = 14 then Iter.Init (This); while Iter.Has_Next loop Strings.Add (Field_Types.Builtin.String_Type_P.Unboxed (Iter.Next.Dynamic.Reflective_Get (F))); end loop; end if; end Add_Field; begin Strings.Add (This.Skill_Name); This.Data_Fields.Foreach (Add_Field'Access); end Add; begin State.Types.Foreach (Add'Access); end; ------------------------------ -- PHASE 2: Check & Reorder -- ------------------------------ -- check consistency of the state, now that we aggregated all instances State.Check; -- save the index of the first new pool declare T : Skill.Types.Pools.Type_Vector := State.Types; begin for I in 1 .. T.Length - 1 loop exit when T.Element (I - 1).Blocks.Is_Empty; New_Pool_Index := New_Pool_Index + 1; end loop; if not T.Last_Element.Blocks.Is_Empty then New_Pool_Index := Natural'Last; end if; end; -- make lbpo map, update data map to contain dynamic instances and create -- skill IDs for serialization declare procedure Make (This : Types.Pools.Pool) is function Cast is new Ada.Unchecked_Conversion (Types.Pools.Pool, Types.Pools.Base_Pool); R : Integer; begin if This.Dynamic.all in Types.Pools.Base_Pool_T'Class then This.Fixed (True); R := Make_LBPO_Map (This, Lbpo_Map, 0); Cast (This).Prepare_Append (Chunk_Map); end if; end Make; begin State.Types.Foreach (Make'Access); end; -- locate relevant pools R_Pools.Ensure_Index (State.Types.Length); declare procedure Find (P : Types.Pools.Pool) is begin -- new index? if P.Pool_Offset >= New_Pool_Index then R_Pools.Append (P); -- new instance or field? elsif P.Size > 0 then declare Ex : Boolean := False; procedure Exist (F : Field_Declaration) is begin if not Ex and then Chunk_Map.Contains (F) then Ex := True; end if; end Exist; begin P.Data_Fields.Foreach (Exist'Access); if Ex then R_Pools.Append (P); end if; end; end if; end Find; begin State.Types.Foreach (Find'Access); end; -------------------- -- PHASE 3: Write -- -------------------- -- write string block State.Strings.Prepare_And_Append (Output, State.String_Type.String_IDs'Access); -- Calculate Offsets -- @note this has top happen after string IDs have been updated declare procedure Make (F : Field_Declaration) is procedure Calculate (C : Tasks.Closure) is begin Cast (C).F.Offset; Write_Barrier.Complete; exception when E : others => Job_Failed_Concurrently := True; Write_Barrier.Complete; Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "A task crashed during offset calculation: " & Cast (C).F.Name.all); end Calculate; T : Skill.Tasks.Run (Calculate'Access); C : Skill.Tasks.Closure := new Cl_Offset'(F => F); begin Write_Barrier.Start; T.Start (C); end Make; use Chunk_Map_P; procedure Off (P : Cursor) is begin Make (Key (P)); end Off; begin Chunk_Map.Iterate (Off'Access); end; -- write count of the type block Output.V64 (Types.v64 (R_Pools.Length)); -- write types declare use type Types.Pools.Pool; use type Interfaces.Integer_64; package A1 renames Field_Declarations.Field_Vector_P; Field_Queue : A1.Vector := A1.Empty_Vector; procedure Write_Type (This : Types.Pools.Pool) is New_Pool : constant Boolean := This.Pool_Offset >= New_Pool_Index; Fields : Field_Vector := Field_Vector_P.Empty_Vector; Lcount : Types.v64 := Types.v64 (This.Blocks.Last_Element.Dynamic_Count); procedure Add (F : Field_Declaration) is begin if Chunk_Map.Contains (F) then Fields.Append (F); end if; end Add; begin Fields.Ensure_Index (This.Data_Fields.Length); This.Data_Fields.Foreach (Add'Access); if New_Pool or else (0 /= This.Data_Fields.Length and then This.Size > 0) then String (This.Skill_Name); Output.V64 (Lcount); if New_Pool then Restrictions (This); if null = This.Super then Output.I8 (0); else Output.V64 (Types.v64 (This.Super.Pool_Offset + 1)); if 0 /= Lcount then Output.V64 (Types.v64 (Lbpo_Map (This.Pool_Offset))); end if; end if; elsif null /= This.Super and then 0 /= Lcount then Output.V64 (Types.v64 (Lbpo_Map (This.Pool_Offset))); end if; if New_Pool and then 0 = Lcount then Output.I8 (0); else Output.V64 (Types.v64 (This.Data_Fields.Length)); Field_Queue.Append_All (This.Data_Fields); end if; end if; end Write_Type; begin R_Pools.Foreach (Write_Type'Access); -- await offsets before we can write fields Write_Barrier.Await; if Job_Failed_Concurrently then raise Program_Error with "internal error during offset calculation"; end if; -- write fields declare -- ArrayList<Task> data = new ArrayList<>(); End_Offset, Offset : Types.v64 := 0; procedure Write_Field (F : Field_Declaration) is P : Types.Pools.Pool := F.Owner.To_Pool; begin -- write info Output.V64 (Types.v64 (F.Index)); if F.Data_Chunks.Last_Element.C.all in Skill.Internal.Parts.Bulk_Chunk then String (F.Name); Write_Type (F.T); Restrictions (F); end if; End_Offset := Offset + F.Future_Offset; Output.V64 (End_Offset); Offset := End_Offset; end Write_Field; begin Field_Queue.Foreach (Write_Field'Access); -- map field data Output.Begin_Block_Map (Offset); end; -- write field data declare procedure Write_Field (F : Field_Declarations.Field_Declaration) is procedure Job (C : Skill.Tasks.Closure) is begin Convert (C).F.Write (Convert (C).Map); Write_Barrier.Complete; pragma Assert (Convert (C).Map.Eof); Convert (C).Map.Close; exception when E : others => Job_Failed_Concurrently := True; Write_Barrier.Complete; Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error, "A task crashed during write data: " & Convert (C).F.Name.all); end Job; T : Skill.Tasks.Run (Job'Access); C : Skill.Tasks.Closure := new Cl_Write'(F => F, Map => Output.Map (F.Future_Offset)); begin Write_Barrier.Start; T.Start (C); end Write_Field; begin Field_Queue.Foreach (Write_Field'Access); -- await writing of actual field data Write_Barrier.Await; Output.End_Block_Map; if Job_Failed_Concurrently then raise Program_Error with "internal error during field write"; end if; end; end; -- we are done Output.Close; ----------------------- -- PHASE 4: Cleaning -- ----------------------- -- release data structures State.String_Type.String_IDs.Clear; -- unfix pools -- for (StoragePool<?, ?> p : state.types) { -- p.fixed(false); -- } -- } end Append; end Skill.Internal.File_Writers;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . F I X E D _ I O -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Fixed_IO is a subpackage of Text_IO. -- This is for compatibility with Ada 83. In GNAT we make it a child package -- to avoid loading the necessary code if Fixed_IO is not instantiated. See -- routine Rtsfind.Check_Text_IO_Special_Unit for a description of how we -- patch up the difference in semantics so that it is invisible to the Ada -- programmer. private generic type Num is delta <>; package Ada.Text_IO.Fixed_IO is Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0; procedure Get (File : File_Type; Item : out Num; Width : Field := 0); procedure Get (Item : out Num; Width : Field := 0); procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp); procedure Get (From : String; Item : out Num; Last : out Positive); procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp); private pragma Inline (Get); pragma Inline (Put); end Ada.Text_IO.Fixed_IO;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . A S T _ H A N D L I N G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1996-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Runtime support for Handling of AST's (Used on VMS implementations only) with Ada.Task_Identification; with System; with System.Aux_DEC; package System.AST_Handling is function Create_AST_Handler (Taskid : Ada.Task_Identification.Task_Id; Entryno : Natural) return System.Aux_DEC.AST_Handler; -- This function implements the appropriate semantics for a use of the -- AST_Entry pragma. See body for details of implementation approach. -- The parameters are the Task_Id for the task containing the entry -- and the entry Index for the specified entry. procedure Expand_AST_Packet_Pool (Requested_Packets : Natural; Actual_Number : out Natural; Total_Number : out Natural); -- This function takes a request for zero or more extra AST packets and -- returns the number actually added to the pool and the total number -- now available or in use. -- This function is not yet fully implemented. end System.AST_Handling;
with RP2040_SVD.UART; with RP.Device; with RP.UART; with ItsyBitsy; package body ItsyBitsy_UART_Interrupt_Handlers is UART : RP.UART.UART_Port renames ItsyBitsy.UART; procedure UART0_IRQ_Handler is begin -- if UART.Masked_IRQ_Status (IRQ => RP.UART.Transmit) then -- UART.Clear_IRQ (IRQ => RP.UART.Transmit); -- UART0_Data_Received := True; -- end if; if UART.Masked_IRQ_Status (IRQ => RP.UART.Receive) then UART.Clear_IRQ (IRQ => RP.UART.Receive); UART0_Data_Received := True; end if; end UART0_IRQ_Handler; end ItsyBitsy_UART_Interrupt_Handlers;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- B I N D E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Binderr; use Binderr; with Butil; use Butil; with Debug; use Debug; with Fname; use Fname; with Lib; use Lib; with Namet; use Namet; with Opt; use Opt; with Output; use Output; with Targparm; use Targparm; package body Binde is -- The following data structures are used to represent the graph that is -- used to determine the elaboration order (using a topological sort). -- The following structures are used to record successors. If A is a -- successor of B in this table, it means that A must be elaborated -- before B is elaborated. type Successor_Id is new Nat; -- Identification of single successor entry No_Successor : constant Successor_Id := 0; -- Used to indicate end of list of successors type Elab_All_Id is new Nat; -- Identification of Elab_All entry link No_Elab_All_Link : constant Elab_All_Id := 0; -- Used to indicate end of list -- Succ_Reason indicates the reason for a particular elaboration link type Succ_Reason is (Withed, -- After directly with's Before, so the spec of Before must be -- elaborated before After is elaborated. Elab, -- After directly mentions Before in a pragma Elaborate, so the -- body of Before must be elaborate before After is elaborated. Elab_All, -- After either mentions Before directly in a pragma Elaborate_All, -- or mentions a third unit, X, which itself requires that Before be -- elaborated before unit X is elaborated. The Elab_All_Link list -- traces the dependencies in the latter case. Elab_All_Desirable, -- This is just like Elab_All, except that the elaborate all was not -- explicitly present in the source, but rather was created by the -- front end, which decided that it was "desirable". Elab_Desirable, -- This is just like Elab, except that the elaborate was not -- explicitly present in the source, but rather was created by the -- front end, which decided that it was "desirable". Spec_First); -- After is a body, and Before is the corresponding spec -- Successor_Link contains the information for one link type Successor_Link is record Before : Unit_Id; -- Predecessor unit After : Unit_Id; -- Successor unit Next : Successor_Id; -- Next successor on this list Reason : Succ_Reason; -- Reason for this link Elab_Body : Boolean; -- Set True if this link is needed for the special Elaborate_Body -- processing described below. Reason_Unit : Unit_Id; -- For Reason = Elab, or Elab_All or Elab_Desirable, records the unit -- containing the pragma leading to the link. Elab_All_Link : Elab_All_Id; -- If Reason = Elab_All or Elab_Desirable, then this points to the -- first elment in a list of Elab_All entries that record the with -- chain leading resulting in this particular dependency. end record; -- Note on handling of Elaborate_Body. Basically, if we have a pragma -- Elaborate_Body in a unit, it means that the spec and body have to -- be handled as a single entity from the point of view of determining -- an elaboration order. What we do is to essentially remove the body -- from consideration completely, and transfer all its links (other -- than the spec link) to the spec. Then when then the spec gets chosen, -- we choose the body right afterwards. We mark the links that get moved -- from the body to the spec by setting their Elab_Body flag True, so -- that we can understand what is going on! Succ_First : constant := 1; package Succ is new Table.Table ( Table_Component_Type => Successor_Link, Table_Index_Type => Successor_Id, Table_Low_Bound => Succ_First, Table_Initial => 500, Table_Increment => 200, Table_Name => "Succ"); -- For the case of Elaborate_All, the following table is used to record -- chains of with relationships that lead to the Elab_All link. These -- are used solely for diagnostic purposes type Elab_All_Entry is record Needed_By : Unit_Name_Type; -- Name of unit from which referencing unit was with'ed or otherwise -- needed as a result of Elaborate_All or Elaborate_Desirable. Next_Elab : Elab_All_Id; -- Link to next entry on chain (No_Elab_All_Link marks end of list) end record; package Elab_All_Entries is new Table.Table ( Table_Component_Type => Elab_All_Entry, Table_Index_Type => Elab_All_Id, Table_Low_Bound => 1, Table_Initial => 2000, Table_Increment => 200, Table_Name => "Elab_All_Entries"); -- A Unit_Node record is built for each active unit type Unit_Node_Record is record Successors : Successor_Id; -- Pointer to list of links for successor nodes Num_Pred : Int; -- Number of predecessors for this unit. Normally non-negative, but -- can go negative in the case of units chosen by the diagnose error -- procedure (when cycles are being removed from the graph). Nextnp : Unit_Id; -- Forward pointer for list of units with no predecessors Elab_Order : Nat; -- Position in elaboration order (zero = not placed yet) Visited : Boolean; -- Used in computing transitive closure for elaborate all and -- also in locating cycles and paths in the diagnose routines. Elab_Position : Natural; -- Initialized to zero. Set non-zero when a unit is chosen and -- placed in the elaboration order. The value represents the -- ordinal position in the elaboration order. end record; package UNR is new Table.Table ( Table_Component_Type => Unit_Node_Record, Table_Index_Type => Unit_Id, Table_Low_Bound => First_Unit_Entry, Table_Initial => 500, Table_Increment => 200, Table_Name => "UNR"); No_Pred : Unit_Id; -- Head of list of items with no predecessors Num_Left : Int; -- Number of entries not yet dealt with Cur_Unit : Unit_Id; -- Current unit, set by Gather_Dependencies, and picked up in Build_Link -- to set the Reason_Unit field of the created dependency link. Num_Chosen : Natural := 0; -- Number of units chosen in the elaboration order so far ----------------------- -- Local Subprograms -- ----------------------- function Better_Choice (U1, U2 : Unit_Id) return Boolean; -- U1 and U2 are both permitted candidates for selection as the next unit -- to be elaborated. This function determines whether U1 is a better choice -- than U2, i.e. should be elaborated in preference to U2, based on a set -- of heuristics that establish a friendly and predictable order (see body -- for details). The result is True if U1 is a better choice than U2, and -- False if it is a worse choice, or there is no preference between them. procedure Build_Link (Before : Unit_Id; After : Unit_Id; R : Succ_Reason; Ea_Id : Elab_All_Id := No_Elab_All_Link); -- Establish a successor link, Before must be elaborated before After, -- and the reason for the link is R. Ea_Id is the contents to be placed -- in the Elab_All_Link of the entry. procedure Choose (Chosen : Unit_Id); -- Chosen is the next entry chosen in the elaboration order. This -- procedure updates all data structures appropriately. function Corresponding_Body (U : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Body); -- Given a unit which is a spec for which there is a separate body, -- return the unit id of the body. It is an error to call this routine -- with a unit that is not a spec, or which does not have a separate body. function Corresponding_Spec (U : Unit_Id) return Unit_Id; pragma Inline (Corresponding_Spec); -- Given a unit which is a body for which there is a separate spec, -- return the unit id of the spec. It is an error to call this routine -- with a unit that is not a body, or which does not have a separate spec. procedure Diagnose_Elaboration_Problem; -- Called when no elaboration order can be found. Outputs an appropriate -- diagnosis of the problem, and then abandons the bind. procedure Elab_All_Links (Before : Unit_Id; After : Unit_Id; Reason : Succ_Reason; Link : Elab_All_Id); -- Used to compute the transitive closure of elaboration links for an -- Elaborate_All pragma (Reason = Elab_All) or for an indication of -- Elaborate_All_Desirable (Reason = Elab_All_Desirable). Unit After has -- a pragma Elaborate_All or the front end has determined that a reference -- probably requires Elaborate_All is required, and unit Before must be -- previously elaborated. First a link is built making sure that unit -- Before is elaborated before After, then a recursive call ensures that -- we also build links for any units needed by Before (i.e. these units -- must/should also be elaborated before After). Link is used to build -- a chain of Elab_All_Entries to explain the reason for a link. The -- value passed is the chain so far. procedure Elab_Error_Msg (S : Successor_Id); -- Given a successor link, outputs an error message of the form -- "& must be elaborated before & ..." where ... is the reason. procedure Gather_Dependencies; -- Compute dependencies, building the Succ and UNR tables function Make_Elab_Entry (Unam : Unit_Name_Type; Link : Elab_All_Id) return Elab_All_Id; -- Make an Elab_All_Entries table entry with the given Unam and Link function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id; -- This function uses the Info field set in the names table to obtain -- the unit Id of a unit, given its name id value. function Worse_Choice (U1, U2 : Unit_Id) return Boolean; -- This is like Better_Choice, and has the same interface, but returns -- true if U1 is a worse choice than U2 in the sense of the -h (horrible -- elaboration order) switch. We still have to obey Ada rules, so it is -- not quite the direct inverse of Better_Choice. procedure Write_Dependencies; -- Write out dependencies (called only if appropriate option is set) procedure Write_Elab_All_Chain (S : Successor_Id); -- If the reason for the link S is Elaborate_All or Elaborate_Desirable, -- then this routine will output the "needed by" explanation chain. ------------------- -- Better_Choice -- ------------------- function Better_Choice (U1, U2 : Unit_Id) return Boolean is function Body_Unit (U : Unit_Id) return Boolean; -- Determines if given unit is a body function Waiting_Body (U : Unit_Id) return Boolean; -- Determines if U is a waiting body, defined as a body which has -- not been elaborated, but whose spec has been elaborated. function Body_Unit (U : Unit_Id) return Boolean is begin return Units.Table (U).Utype = Is_Body or else Units.Table (U).Utype = Is_Body_Only; end Body_Unit; function Waiting_Body (U : Unit_Id) return Boolean is begin return Units.Table (U).Utype = Is_Body and then UNR.Table (Corresponding_Spec (U)).Elab_Position /= 0; end Waiting_Body; -- Start of processing for Better_Choice -- Note: the checks here are applied in sequence, and the ordering is -- significant (i.e. the more important criteria are applied first). begin -- Prefer a waiting body to any other case if Waiting_Body (U1) and not Waiting_Body (U2) then return True; elsif Waiting_Body (U2) and not Waiting_Body (U1) then return False; -- Prefer a predefined unit to a non-predefined unit elsif Units.Table (U1).Predefined and not Units.Table (U2).Predefined then return True; elsif Units.Table (U2).Predefined and not Units.Table (U1).Predefined then return False; -- Prefer an internal unit to a non-internal unit elsif Units.Table (U1).Internal and not Units.Table (U2).Internal then return True; elsif Units.Table (U2).Internal and not Units.Table (U1).Internal then return False; -- Prefer a body to a spec elsif Body_Unit (U1) and not Body_Unit (U2) then return True; elsif Body_Unit (U2) and not Body_Unit (U1) then return False; -- If both are waiting bodies, then prefer the one whose spec is -- more recently elaborated. Consider the following: -- spec of A -- spec of B -- body of A or B? -- The normal waiting body preference would have placed the body of -- A before the spec of B if it could. Since it could not, there it -- must be the case that A depends on B. It is therefore a good idea -- to put the body of B first. elsif Waiting_Body (U1) and then Waiting_Body (U2) then return UNR.Table (Corresponding_Spec (U1)).Elab_Position > UNR.Table (Corresponding_Spec (U2)).Elab_Position; -- Otherwise decide on the basis of alphabetical order else return Uname_Less (Units.Table (U1).Uname, Units.Table (U2).Uname); end if; end Better_Choice; ---------------- -- Build_Link -- ---------------- procedure Build_Link (Before : Unit_Id; After : Unit_Id; R : Succ_Reason; Ea_Id : Elab_All_Id := No_Elab_All_Link) is Cspec : Unit_Id; begin Succ.Increment_Last; Succ.Table (Succ.Last).Before := Before; Succ.Table (Succ.Last).Next := UNR.Table (Before).Successors; UNR.Table (Before).Successors := Succ.Last; Succ.Table (Succ.Last).Reason := R; Succ.Table (Succ.Last).Reason_Unit := Cur_Unit; Succ.Table (Succ.Last).Elab_All_Link := Ea_Id; -- Deal with special Elab_Body case. If the After of this link is -- a body whose spec has Elaborate_All set, and this is not the link -- directly from the body to the spec, then we make the After of the -- link reference its spec instead, marking the link appropriately. if Units.Table (After).Utype = Is_Body then Cspec := Corresponding_Spec (After); if Units.Table (Cspec).Elaborate_Body and then Cspec /= Before then Succ.Table (Succ.Last).After := Cspec; Succ.Table (Succ.Last).Elab_Body := True; UNR.Table (Cspec).Num_Pred := UNR.Table (Cspec).Num_Pred + 1; return; end if; end if; -- Fall through on normal case Succ.Table (Succ.Last).After := After; Succ.Table (Succ.Last).Elab_Body := False; UNR.Table (After).Num_Pred := UNR.Table (After).Num_Pred + 1; end Build_Link; ------------ -- Choose -- ------------ procedure Choose (Chosen : Unit_Id) is S : Successor_Id; U : Unit_Id; begin if Debug_Flag_C then Write_Str ("Choosing Unit "); Write_Unit_Name (Units.Table (Chosen).Uname); Write_Eol; end if; -- Add to elaboration order. Note that units having no elaboration -- code are not treated specially yet. The special casing of this -- is in Bindgen, where Gen_Elab_Calls skips over them. Meanwhile -- we need them here, because the object file list is also driven -- by the contents of the Elab_Order table. Elab_Order.Increment_Last; Elab_Order.Table (Elab_Order.Last) := Chosen; -- Remove from No_Pred list. This is a little inefficient and may -- be we should doubly link the list, but it will do for now! if No_Pred = Chosen then No_Pred := UNR.Table (Chosen).Nextnp; else -- Note that we just ignore the situation where it does not -- appear in the No_Pred list, this happens in calls from the -- Diagnose_Elaboration_Problem routine, where cycles are being -- removed arbitrarily from the graph. U := No_Pred; while U /= No_Unit_Id loop if UNR.Table (U).Nextnp = Chosen then UNR.Table (U).Nextnp := UNR.Table (Chosen).Nextnp; exit; end if; U := UNR.Table (U).Nextnp; end loop; end if; -- For all successors, decrement the number of predecessors, and -- if it becomes zero, then add to no predecessor list. S := UNR.Table (Chosen).Successors; while S /= No_Successor loop U := Succ.Table (S).After; UNR.Table (U).Num_Pred := UNR.Table (U).Num_Pred - 1; if Debug_Flag_N then Write_Str (" decrementing Num_Pred for unit "); Write_Unit_Name (Units.Table (U).Uname); Write_Str (" new value = "); Write_Int (Int (UNR.Table (U).Num_Pred)); Write_Eol; end if; if UNR.Table (U).Num_Pred = 0 then UNR.Table (U).Nextnp := No_Pred; No_Pred := U; end if; S := Succ.Table (S).Next; end loop; -- All done, adjust number of units left count and set elaboration pos Num_Left := Num_Left - 1; Num_Chosen := Num_Chosen + 1; UNR.Table (Chosen).Elab_Position := Num_Chosen; Units.Table (Chosen).Elab_Position := Num_Chosen; -- If we just chose a spec with Elaborate_Body set, then we -- must immediately elaborate the body, before any other units. if Units.Table (Chosen).Elaborate_Body then -- If the unit is a spec only, then there is no body. This is a bit -- odd given that Elaborate_Body is here, but it is valid in an -- RCI unit, where we only have the interface in the stub bind. if Units.Table (Chosen).Utype = Is_Spec_Only and then Units.Table (Chosen).RCI then null; else Choose (Corresponding_Body (Chosen)); end if; end if; end Choose; ------------------------ -- Corresponding_Body -- ------------------------ -- Currently if the body and spec are separate, then they appear as -- two separate units in the same ALI file, with the body appearing -- first and the spec appearing second. function Corresponding_Body (U : Unit_Id) return Unit_Id is begin pragma Assert (Units.Table (U).Utype = Is_Spec); return U - 1; end Corresponding_Body; ------------------------ -- Corresponding_Spec -- ------------------------ -- Currently if the body and spec are separate, then they appear as -- two separate units in the same ALI file, with the body appearing -- first and the spec appearing second. function Corresponding_Spec (U : Unit_Id) return Unit_Id is begin pragma Assert (Units.Table (U).Utype = Is_Body); return U + 1; end Corresponding_Spec; ---------------------------------- -- Diagnose_Elaboration_Problem -- ---------------------------------- procedure Diagnose_Elaboration_Problem is function Find_Path (Ufrom, Uto : Unit_Id; ML : Nat) return Boolean; -- Recursive routine used to find a path from node Ufrom to node Uto. -- If a path exists, returns True and outputs an appropriate set of -- error messages giving the path. Also calls Choose for each of the -- nodes so that they get removed from the remaining set. There are -- two cases of calls, either Ufrom = Uto for an attempt to find a -- cycle, or Ufrom is a spec and Uto the corresponding body for the -- case of an unsatisfiable Elaborate_Body pragma. ML is the minimum -- acceptable length for a path. --------------- -- Find_Path -- --------------- function Find_Path (Ufrom, Uto : Unit_Id; ML : Nat) return Boolean is function Find_Link (U : Unit_Id; PL : Nat) return Boolean; -- This is the inner recursive routine, it determines if a path -- exists from U to Uto, and if so returns True and outputs the -- appropriate set of error messages. PL is the path length --------------- -- Find_Link -- --------------- function Find_Link (U : Unit_Id; PL : Nat) return Boolean is S : Successor_Id; begin -- Recursion ends if we are at terminating node and the path -- is sufficiently long, generate error message and return True. if U = Uto and then PL >= ML then Choose (U); return True; -- All done if already visited, otherwise mark as visited elsif UNR.Table (U).Visited then return False; -- Otherwise mark as visited and look at all successors else UNR.Table (U).Visited := True; S := UNR.Table (U).Successors; while S /= No_Successor loop if Find_Link (Succ.Table (S).After, PL + 1) then Elab_Error_Msg (S); Choose (U); return True; end if; S := Succ.Table (S).Next; end loop; -- Falling through means this does not lead to a path return False; end if; end Find_Link; -- Start of processing for Find_Path begin -- Initialize all non-chosen nodes to not visisted yet for U in Units.First .. Units.Last loop UNR.Table (U).Visited := UNR.Table (U).Elab_Position /= 0; end loop; -- Now try to find the path return Find_Link (Ufrom, 0); end Find_Path; -- Start of processing for Diagnose_Elaboration_Error begin Set_Standard_Error; -- Output state of things if debug flag N set if Debug_Flag_N then declare NP : Int; begin Write_Eol; Write_Eol; Write_Str ("Diagnose_Elaboration_Problem called"); Write_Eol; Write_Str ("List of remaining unchosen units and predecessors"); Write_Eol; for U in Units.First .. Units.Last loop if UNR.Table (U).Elab_Position = 0 then NP := UNR.Table (U).Num_Pred; Write_Eol; Write_Str (" Unchosen unit: #"); Write_Int (Int (U)); Write_Str (" "); Write_Unit_Name (Units.Table (U).Uname); Write_Str (" (Num_Pred = "); Write_Int (NP); Write_Char (')'); Write_Eol; if NP = 0 then if Units.Table (U).Elaborate_Body then Write_Str (" (not chosen because of Elaborate_Body)"); Write_Eol; else Write_Str (" ****************** why not chosen?"); Write_Eol; end if; end if; -- Search links list to find unchosen predecessors for S in Succ.First .. Succ.Last loop declare SL : Successor_Link renames Succ.Table (S); begin if SL.After = U and then UNR.Table (SL.Before).Elab_Position = 0 then Write_Str (" unchosen predecessor: #"); Write_Int (Int (SL.Before)); Write_Str (" "); Write_Unit_Name (Units.Table (SL.Before).Uname); Write_Eol; NP := NP - 1; end if; end; end loop; if NP /= 0 then Write_Str (" **************** Num_Pred value wrong!"); Write_Eol; end if; end if; end loop; end; end if; -- Output the header for the error, and manually increment the -- error count. We are using Error_Msg_Output rather than Error_Msg -- here for two reasons: -- This is really only one error, not one for each line -- We want this output on standard output since it is voluminous -- But we do need to deal with the error count manually in this case Errors_Detected := Errors_Detected + 1; Error_Msg_Output ("elaboration circularity detected", Info => False); -- Try to find cycles starting with any of the remaining nodes that have -- not yet been chosen. There must be at least one (there is some reason -- we are being called!) for U in Units.First .. Units.Last loop if UNR.Table (U).Elab_Position = 0 then if Find_Path (U, U, 1) then raise Unrecoverable_Error; end if; end if; end loop; -- We should never get here, since we were called for some reason, -- and we should have found and eliminated at least one bad path. raise Program_Error; end Diagnose_Elaboration_Problem; -------------------- -- Elab_All_Links -- -------------------- procedure Elab_All_Links (Before : Unit_Id; After : Unit_Id; Reason : Succ_Reason; Link : Elab_All_Id) is begin if UNR.Table (Before).Visited then return; end if; -- Build the direct link for Before UNR.Table (Before).Visited := True; Build_Link (Before, After, Reason, Link); -- Process all units with'ed by Before recursively for W in Units.Table (Before).First_With .. Units.Table (Before).Last_With loop -- Skip if this with is an interface to a stand-alone library. -- Skip also if no ALI file for this with, happens with certain -- specialized generic files that do not get compiled. if not Withs.Table (W).SAL_Interface and then Withs.Table (W).Afile /= No_File and then Generic_Separately_Compiled (Withs.Table (W).Sfile) then Elab_All_Links (Unit_Id_Of (Withs.Table (W).Uname), After, Reason, Make_Elab_Entry (Withs.Table (W).Uname, Link)); end if; end loop; -- Process corresponding body, if there is one if Units.Table (Before).Utype = Is_Spec then Elab_All_Links (Corresponding_Body (Before), After, Reason, Make_Elab_Entry (Units.Table (Corresponding_Body (Before)).Uname, Link)); end if; end Elab_All_Links; -------------------- -- Elab_Error_Msg -- -------------------- procedure Elab_Error_Msg (S : Successor_Id) is SL : Successor_Link renames Succ.Table (S); begin -- Nothing to do if internal unit involved and no -da flag if not Debug_Flag_A and then (Is_Internal_File_Name (Units.Table (SL.Before).Sfile) or else Is_Internal_File_Name (Units.Table (SL.After).Sfile)) then return; end if; -- Here we want to generate output Error_Msg_Name_1 := Units.Table (SL.Before).Uname; if SL.Elab_Body then Error_Msg_Name_2 := Units.Table (Corresponding_Body (SL.After)).Uname; else Error_Msg_Name_2 := Units.Table (SL.After).Uname; end if; Error_Msg_Output (" & must be elaborated before &", Info => True); Error_Msg_Name_1 := Units.Table (SL.Reason_Unit).Uname; case SL.Reason is when Withed => Error_Msg_Output (" reason: with clause", Info => True); when Elab => Error_Msg_Output (" reason: pragma Elaborate in unit &", Info => True); when Elab_All => Error_Msg_Output (" reason: pragma Elaborate_All in unit &", Info => True); when Elab_All_Desirable => Error_Msg_Output (" reason: implicit Elaborate_All in unit &", Info => True); Error_Msg_Output (" recompile & with -gnatwl for full details", Info => True); when Elab_Desirable => Error_Msg_Output (" reason: implicit Elaborate in unit &", Info => True); Error_Msg_Output (" recompile & with -gnatwl for full details", Info => True); when Spec_First => Error_Msg_Output (" reason: spec always elaborated before body", Info => True); end case; Write_Elab_All_Chain (S); if SL.Elab_Body then Error_Msg_Name_1 := Units.Table (SL.Before).Uname; Error_Msg_Name_2 := Units.Table (SL.After).Uname; Error_Msg_Output (" & must therefore be elaborated before &", True); Error_Msg_Name_1 := Units.Table (SL.After).Uname; Error_Msg_Output (" (because & has a pragma Elaborate_Body)", True); end if; Write_Eol; end Elab_Error_Msg; --------------------- -- Find_Elab_Order -- --------------------- procedure Find_Elab_Order is U : Unit_Id; Best_So_Far : Unit_Id; begin Succ.Init; Num_Left := Int (Units.Last - Units.First + 1); -- Initialize unit table for elaboration control for U in Units.First .. Units.Last loop UNR.Increment_Last; UNR.Table (UNR.Last).Successors := No_Successor; UNR.Table (UNR.Last).Num_Pred := 0; UNR.Table (UNR.Last).Nextnp := No_Unit_Id; UNR.Table (UNR.Last).Elab_Order := 0; UNR.Table (UNR.Last).Elab_Position := 0; end loop; -- Output warning if -p used with no -gnatE units if Pessimistic_Elab_Order and not Dynamic_Elaboration_Checks_Specified then if OpenVMS_On_Target then Error_Msg ("?use of /PESSIMISTIC_ELABORATION questionable"); else Error_Msg ("?use of -p switch questionable"); end if; Error_Msg ("?since all units compiled with static elaboration model"); end if; -- Gather dependencies and output them if option set Gather_Dependencies; -- Output elaboration dependencies if option is set if Elab_Dependency_Output or Debug_Flag_E then Write_Dependencies; end if; -- Initialize the no predecessor list No_Pred := No_Unit_Id; for U in UNR.First .. UNR.Last loop if UNR.Table (U).Num_Pred = 0 then UNR.Table (U).Nextnp := No_Pred; No_Pred := U; end if; end loop; -- OK, now we determine the elaboration order proper. All we do is to -- select the best choice from the no predecessor list until all the -- nodes have been chosen. Outer : loop -- If there are no nodes with predecessors, then either we are -- done, as indicated by Num_Left being set to zero, or we have -- a circularity. In the latter case, diagnose the circularity, -- removing it from the graph and continue Get_No_Pred : while No_Pred = No_Unit_Id loop exit Outer when Num_Left < 1; Diagnose_Elaboration_Problem; end loop Get_No_Pred; U := No_Pred; Best_So_Far := No_Unit_Id; -- Loop to choose best entry in No_Pred list No_Pred_Search : loop if Debug_Flag_N then Write_Str (" considering choice of "); Write_Unit_Name (Units.Table (U).Uname); Write_Eol; if Units.Table (U).Elaborate_Body then Write_Str (" Elaborate_Body = True, Num_Pred for body = "); Write_Int (Int (UNR.Table (Corresponding_Body (U)).Num_Pred)); else Write_Str (" Elaborate_Body = False"); end if; Write_Eol; end if; -- This is a candididate to be considered for choice if Best_So_Far = No_Unit_Id or else ((not Pessimistic_Elab_Order) and then Better_Choice (U, Best_So_Far)) or else (Pessimistic_Elab_Order and then Worse_Choice (U, Best_So_Far)) then if Debug_Flag_N then Write_Str (" tentatively chosen (best so far)"); Write_Eol; end if; Best_So_Far := U; end if; U := UNR.Table (U).Nextnp; exit No_Pred_Search when U = No_Unit_Id; end loop No_Pred_Search; -- If no candididate chosen, it means that no unit has No_Pred = 0, -- but there are units left, hence we have a circular dependency, -- which we will get Diagnose_Elaboration_Problem to diagnose it. if Best_So_Far = No_Unit_Id then Diagnose_Elaboration_Problem; -- Otherwise choose the best candidate found else Choose (Best_So_Far); end if; end loop Outer; end Find_Elab_Order; ------------------------- -- Gather_Dependencies -- ------------------------- procedure Gather_Dependencies is Withed_Unit : Unit_Id; begin -- Loop through all units for U in Units.First .. Units.Last loop Cur_Unit := U; -- If this is not an interface to a stand-alone library and -- there is a body and a spec, then spec must be elaborated first -- Note that the corresponding spec immediately follows the body if not Units.Table (U).SAL_Interface and then Units.Table (U).Utype = Is_Body then Build_Link (Corresponding_Spec (U), U, Spec_First); end if; -- If this unit is not an interface to a stand-alone library, -- process WITH references for this unit ignoring generic units and -- interfaces to stand-alone libraries. if not Units.Table (U).SAL_Interface then for W in Units.Table (U).First_With .. Units.Table (U).Last_With loop if Withs.Table (W).Sfile /= No_File and then (not Withs.Table (W).SAL_Interface) then -- Check for special case of withing a unit that does not -- exist any more. If the unit was completely missing we -- would already have detected this, but a nasty case arises -- when we have a subprogram body with no spec, and some -- obsolete unit with's a previous (now disappeared) spec. if Get_Name_Table_Info (Withs.Table (W).Uname) = 0 then Error_Msg_Name_1 := Units.Table (U).Sfile; Error_Msg_Name_2 := Withs.Table (W).Uname; Error_Msg ("% depends on & which no longer exists"); goto Next_With; end if; Withed_Unit := Unit_Id (Unit_Id_Of (Withs.Table (W).Uname)); -- Pragma Elaborate_All case, for this we use the recursive -- Elab_All_Links procedure to establish the links. if Withs.Table (W).Elaborate_All then -- Reset flags used to stop multiple visits to a given -- node. for Uref in UNR.First .. UNR.Last loop UNR.Table (Uref).Visited := False; end loop; -- Now establish all the links we need Elab_All_Links (Withed_Unit, U, Elab_All, Make_Elab_Entry (Withs.Table (W).Uname, No_Elab_All_Link)); -- Elaborate_All_Desirable case, for this we establish -- the same links as above, but with a different reason. elsif Withs.Table (W).Elab_All_Desirable then -- Reset flags used to stop multiple visits to a given -- node. for Uref in UNR.First .. UNR.Last loop UNR.Table (Uref).Visited := False; end loop; -- Now establish all the links we need Elab_All_Links (Withed_Unit, U, Elab_All_Desirable, Make_Elab_Entry (Withs.Table (W).Uname, No_Elab_All_Link)); -- Pragma Elaborate case. We must build a link for the -- withed unit itself, and also the corresponding body -- if there is one. -- However, skip this processing if there is no ALI file -- for the WITH entry, because this means it is a -- generic (even when we fix the generics so that an ALI -- file is present, we probably still will have no ALI -- file for unchecked and other special cases). elsif Withs.Table (W).Elaborate and then Withs.Table (W).Afile /= No_File then Build_Link (Withed_Unit, U, Withed); if Units.Table (Withed_Unit).Utype = Is_Spec then Build_Link (Corresponding_Body (Withed_Unit), U, Elab); end if; -- Elaborate_Desirable case, for this we establish -- the same links as above, but with a different reason. elsif Withs.Table (W).Elab_Desirable then Build_Link (Withed_Unit, U, Withed); if Units.Table (Withed_Unit).Utype = Is_Spec then Build_Link (Corresponding_Body (Withed_Unit), U, Elab_Desirable); end if; -- Case of normal WITH with no elaboration pragmas, just -- build the single link to the directly referenced unit else Build_Link (Withed_Unit, U, Withed); end if; end if; <<Next_With>> null; end loop; end if; end loop; end Gather_Dependencies; --------------------- -- Make_Elab_Entry -- --------------------- function Make_Elab_Entry (Unam : Unit_Name_Type; Link : Elab_All_Id) return Elab_All_Id is begin Elab_All_Entries.Increment_Last; Elab_All_Entries.Table (Elab_All_Entries.Last).Needed_By := Unam; Elab_All_Entries.Table (Elab_All_Entries.Last).Next_Elab := Link; return Elab_All_Entries.Last; end Make_Elab_Entry; ---------------- -- Unit_Id_Of -- ---------------- function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id is Info : constant Int := Get_Name_Table_Info (Uname); begin pragma Assert (Info /= 0 and then Unit_Id (Info) /= No_Unit_Id); return Unit_Id (Info); end Unit_Id_Of; ------------------ -- Worse_Choice -- ------------------ function Worse_Choice (U1, U2 : Unit_Id) return Boolean is function Body_Unit (U : Unit_Id) return Boolean; -- Determines if given unit is a body function Waiting_Body (U : Unit_Id) return Boolean; -- Determines if U is a waiting body, defined as a body which has -- not been elaborated, but whose spec has been elaborated. --------------- -- Body_Unit -- --------------- function Body_Unit (U : Unit_Id) return Boolean is begin return Units.Table (U).Utype = Is_Body or else Units.Table (U).Utype = Is_Body_Only; end Body_Unit; ------------------ -- Waiting_Body -- ------------------ function Waiting_Body (U : Unit_Id) return Boolean is begin return Units.Table (U).Utype = Is_Body and then UNR.Table (Corresponding_Spec (U)).Elab_Position /= 0; end Waiting_Body; -- Start of processing for Worse_Choice begin -- Note: the checks here are applied in sequence, and the ordering is -- significant (i.e. the more important criteria are applied first). -- If either unit is internal, then use Better_Choice, since the -- language requires that predefined units not mess up in the choice -- of elaboration order, and for internal units, any problems are -- ours and not the programmers. if Units.Table (U1).Internal or else Units.Table (U2).Internal then return Better_Choice (U1, U2); -- Prefer anything else to a waiting body (!) elsif Waiting_Body (U1) and not Waiting_Body (U2) then return False; elsif Waiting_Body (U2) and not Waiting_Body (U1) then return True; -- Prefer a spec to a body (!) elsif Body_Unit (U1) and not Body_Unit (U2) then return False; elsif Body_Unit (U2) and not Body_Unit (U1) then return True; -- If both are waiting bodies, then prefer the one whose spec is -- less recently elaborated. Consider the following: -- spec of A -- spec of B -- body of A or B? -- The normal waiting body preference would have placed the body of -- A before the spec of B if it could. Since it could not, there it -- must be the case that A depends on B. It is therefore a good idea -- to put the body of B last so that if there is an elaboration order -- problem, we will find it (that's what horrible order is about) elsif Waiting_Body (U1) and then Waiting_Body (U2) then return UNR.Table (Corresponding_Spec (U1)).Elab_Position < UNR.Table (Corresponding_Spec (U2)).Elab_Position; -- Otherwise decide on the basis of alphabetical order. We do not try -- to reverse the usual choice here, since it can cause cancelling -- errors with the other inversions. else return Uname_Less (Units.Table (U1).Uname, Units.Table (U2).Uname); end if; end Worse_Choice; ------------------------ -- Write_Dependencies -- ------------------------ procedure Write_Dependencies is begin Write_Eol; Write_Str (" ELABORATION ORDER DEPENDENCIES"); Write_Eol; Write_Eol; Info_Prefix_Suppress := True; for S in Succ_First .. Succ.Last loop Elab_Error_Msg (S); end loop; Info_Prefix_Suppress := False; Write_Eol; end Write_Dependencies; -------------------------- -- Write_Elab_All_Chain -- -------------------------- procedure Write_Elab_All_Chain (S : Successor_Id) is ST : constant Successor_Link := Succ.Table (S); After : constant Unit_Name_Type := Units.Table (ST.After).Uname; L : Elab_All_Id; Nam : Unit_Name_Type; First_Name : Boolean := True; begin if ST.Reason in Elab_All .. Elab_All_Desirable then L := ST.Elab_All_Link; while L /= No_Elab_All_Link loop Nam := Elab_All_Entries.Table (L).Needed_By; Error_Msg_Name_1 := Nam; Error_Msg_Output (" &", Info => True); Get_Name_String (Nam); if Name_Buffer (Name_Len) = 'b' then if First_Name then Error_Msg_Output (" must be elaborated along with its spec:", Info => True); else Error_Msg_Output (" which must be elaborated " & "along with its spec:", Info => True); end if; else if First_Name then Error_Msg_Output (" is withed by:", Info => True); else Error_Msg_Output (" which is withed by:", Info => True); end if; end if; First_Name := False; L := Elab_All_Entries.Table (L).Next_Elab; end loop; Error_Msg_Name_1 := After; Error_Msg_Output (" &", Info => True); end if; end Write_Elab_All_Chain; end Binde;
package Global_Singleton is procedure Set_Data (Value : Integer); function Get_Data return Integer; private type Instance_Type is record -- Define instance data elements Data : Integer := 0; end record; Instance : Instance_Type; end Global_Singleton;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.CMOF; with AMF.Internals.Tables.CMOF_Attributes; with AMF.Internals.Tables.UMLDI_String_Data_00; package body AMF.Internals.Tables.UMLDI_Metamodel.Properties is ---------------- -- Initialize -- ---------------- procedure Initialize is begin Initialize_1; Initialize_2; Initialize_3; Initialize_4; Initialize_5; Initialize_6; Initialize_7; Initialize_8; Initialize_9; Initialize_10; Initialize_11; Initialize_12; Initialize_13; Initialize_14; Initialize_15; Initialize_16; Initialize_17; Initialize_18; Initialize_19; Initialize_20; Initialize_21; Initialize_22; Initialize_23; Initialize_24; Initialize_25; Initialize_26; Initialize_27; Initialize_28; Initialize_29; Initialize_30; Initialize_31; Initialize_32; Initialize_33; Initialize_34; Initialize_35; Initialize_36; Initialize_37; Initialize_38; Initialize_39; Initialize_40; Initialize_41; Initialize_42; Initialize_43; Initialize_44; Initialize_45; Initialize_46; Initialize_47; Initialize_48; Initialize_49; Initialize_50; Initialize_51; Initialize_52; Initialize_53; Initialize_54; Initialize_55; Initialize_56; Initialize_57; Initialize_58; Initialize_59; Initialize_60; Initialize_61; Initialize_62; Initialize_63; Initialize_64; Initialize_65; Initialize_66; Initialize_67; Initialize_68; Initialize_69; Initialize_70; Initialize_71; Initialize_72; Initialize_73; Initialize_74; Initialize_75; Initialize_76; Initialize_77; Initialize_78; Initialize_79; Initialize_80; Initialize_81; Initialize_82; Initialize_83; Initialize_84; Initialize_85; Initialize_86; Initialize_87; Initialize_88; Initialize_89; Initialize_90; Initialize_91; Initialize_92; Initialize_93; Initialize_94; Initialize_95; Initialize_96; Initialize_97; Initialize_98; Initialize_99; Initialize_100; Initialize_101; Initialize_102; Initialize_103; Initialize_104; Initialize_105; Initialize_106; Initialize_107; Initialize_108; Initialize_109; Initialize_110; Initialize_111; Initialize_112; Initialize_113; Initialize_114; Initialize_115; Initialize_116; Initialize_117; Initialize_118; Initialize_119; Initialize_120; Initialize_121; Initialize_122; Initialize_123; Initialize_124; Initialize_125; Initialize_126; Initialize_127; Initialize_128; Initialize_129; Initialize_130; Initialize_131; Initialize_132; Initialize_133; Initialize_134; Initialize_135; Initialize_136; Initialize_137; Initialize_138; Initialize_139; Initialize_140; Initialize_141; Initialize_142; Initialize_143; Initialize_144; Initialize_145; Initialize_146; Initialize_147; Initialize_148; Initialize_149; Initialize_150; Initialize_151; Initialize_152; Initialize_153; Initialize_154; Initialize_155; Initialize_156; Initialize_157; Initialize_158; Initialize_159; Initialize_160; Initialize_161; Initialize_162; Initialize_163; Initialize_164; Initialize_165; Initialize_166; Initialize_167; Initialize_168; Initialize_169; Initialize_170; Initialize_171; Initialize_172; Initialize_173; Initialize_174; Initialize_175; Initialize_176; Initialize_177; Initialize_178; Initialize_179; Initialize_180; Initialize_181; Initialize_182; Initialize_183; Initialize_184; Initialize_185; Initialize_186; Initialize_187; Initialize_188; Initialize_189; Initialize_190; Initialize_191; Initialize_192; Initialize_193; Initialize_194; Initialize_195; Initialize_196; Initialize_197; Initialize_198; Initialize_199; Initialize_200; Initialize_201; Initialize_202; Initialize_203; Initialize_204; Initialize_205; Initialize_206; Initialize_207; Initialize_208; Initialize_209; Initialize_210; Initialize_211; Initialize_212; Initialize_213; Initialize_214; Initialize_215; Initialize_216; Initialize_217; Initialize_218; Initialize_219; Initialize_220; Initialize_221; Initialize_222; Initialize_223; Initialize_224; Initialize_225; Initialize_226; Initialize_227; Initialize_228; Initialize_229; Initialize_230; Initialize_231; Initialize_232; Initialize_233; Initialize_234; Initialize_235; Initialize_236; Initialize_237; Initialize_238; Initialize_239; Initialize_240; Initialize_241; Initialize_242; Initialize_243; Initialize_244; Initialize_245; Initialize_246; Initialize_247; Initialize_248; Initialize_249; Initialize_250; Initialize_251; Initialize_252; Initialize_253; Initialize_254; Initialize_255; Initialize_256; Initialize_257; Initialize_258; Initialize_259; Initialize_260; Initialize_261; Initialize_262; Initialize_263; Initialize_264; Initialize_265; Initialize_266; Initialize_267; Initialize_268; Initialize_269; Initialize_270; Initialize_271; Initialize_272; Initialize_273; Initialize_274; Initialize_275; Initialize_276; Initialize_277; Initialize_278; Initialize_279; Initialize_280; Initialize_281; Initialize_282; Initialize_283; Initialize_284; Initialize_285; Initialize_286; Initialize_287; Initialize_288; Initialize_289; Initialize_290; Initialize_291; Initialize_292; Initialize_293; Initialize_294; Initialize_295; Initialize_296; Initialize_297; Initialize_298; Initialize_299; Initialize_300; Initialize_301; Initialize_302; Initialize_303; Initialize_304; Initialize_305; Initialize_306; Initialize_307; Initialize_308; Initialize_309; Initialize_310; Initialize_311; Initialize_312; Initialize_313; Initialize_314; Initialize_315; Initialize_316; Initialize_317; Initialize_318; Initialize_319; end Initialize; ------------------ -- Initialize_1 -- ------------------ procedure Initialize_1 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 1, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00EA'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 1, (Is_Empty => True)); end Initialize_1; ------------------ -- Initialize_2 -- ------------------ procedure Initialize_2 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 2, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 2, (Is_Empty => True)); end Initialize_2; ------------------ -- Initialize_3 -- ------------------ procedure Initialize_3 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 3, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0047'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 3, (Is_Empty => True)); end Initialize_3; ------------------ -- Initialize_4 -- ------------------ procedure Initialize_4 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 4, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 4, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0004'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 4, (Is_Empty => True)); end Initialize_4; ------------------ -- Initialize_5 -- ------------------ procedure Initialize_5 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 5, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0020'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 5, (Is_Empty => True)); end Initialize_5; ------------------ -- Initialize_6 -- ------------------ procedure Initialize_6 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 6, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 6, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A3'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 6, (Is_Empty => True)); end Initialize_6; ------------------ -- Initialize_7 -- ------------------ procedure Initialize_7 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 7, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D7'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 7, (Is_Empty => True)); end Initialize_7; ------------------ -- Initialize_8 -- ------------------ procedure Initialize_8 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 8, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 8, (Is_Empty => True)); end Initialize_8; ------------------ -- Initialize_9 -- ------------------ procedure Initialize_9 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 9, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0032'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 9, (Is_Empty => True)); end Initialize_9; ------------------- -- Initialize_10 -- ------------------- procedure Initialize_10 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 10, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E9'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 10, (Is_Empty => True)); end Initialize_10; ------------------- -- Initialize_11 -- ------------------- procedure Initialize_11 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 11, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0041'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 11, (Is_Empty => True)); end Initialize_11; ------------------- -- Initialize_12 -- ------------------- procedure Initialize_12 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 12, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B5'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 12, (Is_Empty => True)); end Initialize_12; ------------------- -- Initialize_13 -- ------------------- procedure Initialize_13 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 13, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 13, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0055'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 13, (Is_Empty => True)); end Initialize_13; ------------------- -- Initialize_14 -- ------------------- procedure Initialize_14 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 14, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 14, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 14, (Is_Empty => True)); end Initialize_14; ------------------- -- Initialize_15 -- ------------------- procedure Initialize_15 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 15, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00CE'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 15, (Is_Empty => True)); end Initialize_15; ------------------- -- Initialize_16 -- ------------------- procedure Initialize_16 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 16, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0027'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 16, (Is_Empty => True)); end Initialize_16; ------------------- -- Initialize_17 -- ------------------- procedure Initialize_17 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 17, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0024'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 17, (Is_Empty => True)); end Initialize_17; ------------------- -- Initialize_18 -- ------------------- procedure Initialize_18 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 18, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0031'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 18, (Is_Empty => True)); end Initialize_18; ------------------- -- Initialize_19 -- ------------------- procedure Initialize_19 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 19, AMF.Internals.Tables.UMLDI_String_Data_00.MS_004E'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 19, (Is_Empty => True)); end Initialize_19; ------------------- -- Initialize_20 -- ------------------- procedure Initialize_20 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 20, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0036'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 20, (Is_Empty => True)); end Initialize_20; ------------------- -- Initialize_21 -- ------------------- procedure Initialize_21 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 21, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0000'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 21, (Is_Empty => True)); end Initialize_21; ------------------- -- Initialize_22 -- ------------------- procedure Initialize_22 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 22, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0075'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 22, (Is_Empty => True)); end Initialize_22; ------------------- -- Initialize_23 -- ------------------- procedure Initialize_23 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 23, AMF.Internals.Tables.UMLDI_String_Data_00.MS_004A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 23, (Is_Empty => True)); end Initialize_23; ------------------- -- Initialize_24 -- ------------------- procedure Initialize_24 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 24, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 24, (Is_Empty => True)); end Initialize_24; ------------------- -- Initialize_25 -- ------------------- procedure Initialize_25 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 25, AMF.Internals.Tables.UMLDI_String_Data_00.MS_002E'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 25, (Is_Empty => True)); end Initialize_25; ------------------- -- Initialize_26 -- ------------------- procedure Initialize_26 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 26, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A1'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 26, (Is_Empty => True)); end Initialize_26; ------------------- -- Initialize_27 -- ------------------- procedure Initialize_27 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 27, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AB'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 27, (Is_Empty => True)); end Initialize_27; ------------------- -- Initialize_28 -- ------------------- procedure Initialize_28 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 28, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 28, (Is_Empty => True)); end Initialize_28; ------------------- -- Initialize_29 -- ------------------- procedure Initialize_29 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 29, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0081'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 29, (Is_Empty => True)); end Initialize_29; ------------------- -- Initialize_30 -- ------------------- procedure Initialize_30 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Abstract (Base + 30, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 30, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0082'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 30, (Is_Empty => True)); end Initialize_30; ------------------- -- Initialize_31 -- ------------------- procedure Initialize_31 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 31, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00EE'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 31, (Is_Empty => True)); end Initialize_31; ------------------- -- Initialize_32 -- ------------------- procedure Initialize_32 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 32, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00CA'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 32, (Is_Empty => True)); end Initialize_32; ------------------- -- Initialize_33 -- ------------------- procedure Initialize_33 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 33, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 33, (Is_Empty => True)); end Initialize_33; ------------------- -- Initialize_34 -- ------------------- procedure Initialize_34 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 34, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Ordered (Base + 34, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 34, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 34, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0018'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 34, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 34, (False, AMF.CMOF.Public_Visibility)); end Initialize_34; ------------------- -- Initialize_35 -- ------------------- procedure Initialize_35 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 35, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Ordered (Base + 35, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 35, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 35, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C8'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 35, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 35, (False, AMF.CMOF.Public_Visibility)); end Initialize_35; ------------------- -- Initialize_36 -- ------------------- procedure Initialize_36 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 36, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 36, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 36, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 36, (False, AMF.CMOF.Public_Visibility)); end Initialize_36; ------------------- -- Initialize_37 -- ------------------- procedure Initialize_37 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 37, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Ordered (Base + 37, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 37, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 37, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 37, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 37, (False, AMF.CMOF.Public_Visibility)); end Initialize_37; ------------------- -- Initialize_38 -- ------------------- procedure Initialize_38 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 38, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 38, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 38, (False, AMF.CMOF.Public_Visibility)); end Initialize_38; ------------------- -- Initialize_39 -- ------------------- procedure Initialize_39 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 39, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 39, AMF.Internals.Tables.UMLDI_String_Data_00.MS_006F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 39, (False, AMF.CMOF.Public_Visibility)); end Initialize_39; ------------------- -- Initialize_40 -- ------------------- procedure Initialize_40 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 40, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 40, (False, AMF.CMOF.Public_Visibility)); end Initialize_40; ------------------- -- Initialize_41 -- ------------------- procedure Initialize_41 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 41, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 41, (False, AMF.CMOF.Public_Visibility)); end Initialize_41; ------------------- -- Initialize_42 -- ------------------- procedure Initialize_42 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 42, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 42, (False, AMF.CMOF.Private_Visibility)); end Initialize_42; ------------------- -- Initialize_43 -- ------------------- procedure Initialize_43 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 43, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 43, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 43, (False, AMF.CMOF.Public_Visibility)); end Initialize_43; ------------------- -- Initialize_44 -- ------------------- procedure Initialize_44 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 44, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 44, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F1'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 44, (False, AMF.CMOF.Public_Visibility)); end Initialize_44; ------------------- -- Initialize_45 -- ------------------- procedure Initialize_45 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 45, AMF.Internals.Tables.UMLDI_String_Data_00.MS_001B'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 45, (False, AMF.CMOF.Public_Visibility)); end Initialize_45; ------------------- -- Initialize_46 -- ------------------- procedure Initialize_46 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 46, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BD'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 46, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0092'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 46, (False, AMF.CMOF.Public_Visibility)); end Initialize_46; ------------------- -- Initialize_47 -- ------------------- procedure Initialize_47 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 47, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 47, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D3'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 47, (False, AMF.CMOF.Public_Visibility)); end Initialize_47; ------------------- -- Initialize_48 -- ------------------- procedure Initialize_48 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 48, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 48, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0077'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 48, (False, AMF.CMOF.Public_Visibility)); end Initialize_48; ------------------- -- Initialize_49 -- ------------------- procedure Initialize_49 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 49, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 49, (False, AMF.CMOF.Public_Visibility)); end Initialize_49; ------------------- -- Initialize_50 -- ------------------- procedure Initialize_50 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 50, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 50, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 50, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0021'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 50, (False, AMF.CMOF.Public_Visibility)); end Initialize_50; ------------------- -- Initialize_51 -- ------------------- procedure Initialize_51 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 51, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 51, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00EC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 51, (False, AMF.CMOF.Public_Visibility)); end Initialize_51; ------------------- -- Initialize_52 -- ------------------- procedure Initialize_52 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 52, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 52, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0038'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 52, (False, AMF.CMOF.Public_Visibility)); end Initialize_52; ------------------- -- Initialize_53 -- ------------------- procedure Initialize_53 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 53, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 53, AMF.Internals.Tables.UMLDI_String_Data_00.MS_009E'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 53, (False, AMF.CMOF.Public_Visibility)); end Initialize_53; ------------------- -- Initialize_54 -- ------------------- procedure Initialize_54 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Is_Composite (Base + 54, True); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 54, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 54, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0043'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 54, (False, AMF.CMOF.Public_Visibility)); end Initialize_54; ------------------- -- Initialize_55 -- ------------------- procedure Initialize_55 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 55, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 55, AMF.Internals.Tables.UMLDI_String_Data_00.MS_005A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 55, (False, AMF.CMOF.Public_Visibility)); end Initialize_55; ------------------- -- Initialize_56 -- ------------------- procedure Initialize_56 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 56, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 56, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0093'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 56, (False, AMF.CMOF.Public_Visibility)); end Initialize_56; ------------------- -- Initialize_57 -- ------------------- procedure Initialize_57 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 57, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D0'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 57, (False, AMF.CMOF.Public_Visibility)); end Initialize_57; ------------------- -- Initialize_58 -- ------------------- procedure Initialize_58 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 58, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DA'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 58, (False, AMF.CMOF.Public_Visibility)); end Initialize_58; ------------------- -- Initialize_59 -- ------------------- procedure Initialize_59 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 59, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0042'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 59, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 59, (False, AMF.CMOF.Public_Visibility)); end Initialize_59; ------------------- -- Initialize_60 -- ------------------- procedure Initialize_60 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 60, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 60, (False, AMF.CMOF.Public_Visibility)); end Initialize_60; ------------------- -- Initialize_61 -- ------------------- procedure Initialize_61 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 61, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 61, (False, AMF.CMOF.Public_Visibility)); end Initialize_61; ------------------- -- Initialize_62 -- ------------------- procedure Initialize_62 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 62, AMF.Internals.Tables.UMLDI_String_Data_00.MS_004C'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 62, (False, AMF.CMOF.Public_Visibility)); end Initialize_62; ------------------- -- Initialize_63 -- ------------------- procedure Initialize_63 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 63, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 63, (False, AMF.CMOF.Public_Visibility)); end Initialize_63; ------------------- -- Initialize_64 -- ------------------- procedure Initialize_64 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 64, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00ED'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 64, (False, AMF.CMOF.Public_Visibility)); end Initialize_64; ------------------- -- Initialize_65 -- ------------------- procedure Initialize_65 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 65, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 65, (False, AMF.CMOF.Public_Visibility)); end Initialize_65; ------------------- -- Initialize_66 -- ------------------- procedure Initialize_66 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 66, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 66, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0088'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 66, (False, AMF.CMOF.Public_Visibility)); end Initialize_66; ------------------- -- Initialize_67 -- ------------------- procedure Initialize_67 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 67, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 67, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0083'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 67, (False, AMF.CMOF.Public_Visibility)); end Initialize_67; ------------------- -- Initialize_68 -- ------------------- procedure Initialize_68 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 68, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 68, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0017'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 68, (False, AMF.CMOF.Public_Visibility)); end Initialize_68; ------------------- -- Initialize_69 -- ------------------- procedure Initialize_69 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 69, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 69, (False, AMF.CMOF.Public_Visibility)); end Initialize_69; ------------------- -- Initialize_70 -- ------------------- procedure Initialize_70 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Default (Base + 70, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 70, AMF.Internals.Tables.UMLDI_String_Data_00.MS_008F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 70, (False, AMF.CMOF.Public_Visibility)); end Initialize_70; ------------------- -- Initialize_71 -- ------------------- procedure Initialize_71 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 71, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BC'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 71, (False, AMF.CMOF.Public_Visibility)); end Initialize_71; ------------------- -- Initialize_72 -- ------------------- procedure Initialize_72 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 72, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DE'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 72, (False, AMF.CMOF.Public_Visibility)); end Initialize_72; ------------------- -- Initialize_73 -- ------------------- procedure Initialize_73 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 73, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 73, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0062'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 73, (False, AMF.CMOF.Public_Visibility)); end Initialize_73; ------------------- -- Initialize_74 -- ------------------- procedure Initialize_74 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 74, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 74, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0039'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 74, (False, AMF.CMOF.Public_Visibility)); end Initialize_74; ------------------- -- Initialize_75 -- ------------------- procedure Initialize_75 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 75, AMF.Internals.Tables.UMLDI_String_Data_00.MS_002B'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 75, (Is_Empty => True)); end Initialize_75; ------------------- -- Initialize_76 -- ------------------- procedure Initialize_76 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 76, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0079'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 76, (Is_Empty => True)); end Initialize_76; ------------------- -- Initialize_77 -- ------------------- procedure Initialize_77 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 77, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A9'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 77, (Is_Empty => True)); end Initialize_77; ------------------- -- Initialize_78 -- ------------------- procedure Initialize_78 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 78, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0013'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 78, (Is_Empty => True)); end Initialize_78; ------------------- -- Initialize_79 -- ------------------- procedure Initialize_79 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 79, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007B'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 79, (Is_Empty => True)); end Initialize_79; ------------------- -- Initialize_80 -- ------------------- procedure Initialize_80 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 80, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C9'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 80, (Is_Empty => True)); end Initialize_80; ------------------- -- Initialize_81 -- ------------------- procedure Initialize_81 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 81, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0002'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 81, (Is_Empty => True)); end Initialize_81; ------------------- -- Initialize_82 -- ------------------- procedure Initialize_82 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 82, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0050'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 82, (Is_Empty => True)); end Initialize_82; ------------------- -- Initialize_83 -- ------------------- procedure Initialize_83 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 83, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0016'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 83, (Is_Empty => True)); end Initialize_83; ------------------- -- Initialize_84 -- ------------------- procedure Initialize_84 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 84, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0048'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 84, (Is_Empty => True)); end Initialize_84; ------------------- -- Initialize_85 -- ------------------- procedure Initialize_85 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 85, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0006'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 85, (Is_Empty => True)); end Initialize_85; ------------------- -- Initialize_86 -- ------------------- procedure Initialize_86 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 86, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 86, (Is_Empty => True)); end Initialize_86; ------------------- -- Initialize_87 -- ------------------- procedure Initialize_87 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 87, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0040'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 87, (Is_Empty => True)); end Initialize_87; ------------------- -- Initialize_88 -- ------------------- procedure Initialize_88 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 88, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00CF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 88, (Is_Empty => True)); end Initialize_88; ------------------- -- Initialize_89 -- ------------------- procedure Initialize_89 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 89, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D9'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 89, (Is_Empty => True)); end Initialize_89; ------------------- -- Initialize_90 -- ------------------- procedure Initialize_90 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 90, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A8'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 90, (Is_Empty => True)); end Initialize_90; ------------------- -- Initialize_91 -- ------------------- procedure Initialize_91 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 91, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 91, (Is_Empty => True)); end Initialize_91; ------------------- -- Initialize_92 -- ------------------- procedure Initialize_92 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 92, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A0'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 92, (Is_Empty => True)); end Initialize_92; ------------------- -- Initialize_93 -- ------------------- procedure Initialize_93 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 93, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BB'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 93, (Is_Empty => True)); end Initialize_93; ------------------- -- Initialize_94 -- ------------------- procedure Initialize_94 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 94, AMF.Internals.Tables.UMLDI_String_Data_00.MS_004B'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 94, (Is_Empty => True)); end Initialize_94; ------------------- -- Initialize_95 -- ------------------- procedure Initialize_95 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 95, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0099'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 95, (Is_Empty => True)); end Initialize_95; ------------------- -- Initialize_96 -- ------------------- procedure Initialize_96 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 96, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0066'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Uri (Base + 96, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0098'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 96, (Is_Empty => True)); end Initialize_96; ------------------- -- Initialize_97 -- ------------------- procedure Initialize_97 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 97, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 97, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 97, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 97, (False, AMF.CMOF.Public_Visibility)); end Initialize_97; ------------------- -- Initialize_98 -- ------------------- procedure Initialize_98 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 98, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 98, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 98, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 98, (False, AMF.CMOF.Public_Visibility)); end Initialize_98; ------------------- -- Initialize_99 -- ------------------- procedure Initialize_99 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 99, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 99, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 99, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 99, (False, AMF.CMOF.Public_Visibility)); end Initialize_99; -------------------- -- Initialize_100 -- -------------------- procedure Initialize_100 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 100, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 100, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 100, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 100, (False, AMF.CMOF.Public_Visibility)); end Initialize_100; -------------------- -- Initialize_101 -- -------------------- procedure Initialize_101 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 101, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 101, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F7'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 101, (False, AMF.CMOF.Public_Visibility)); end Initialize_101; -------------------- -- Initialize_102 -- -------------------- procedure Initialize_102 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 102, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007D'Access); end Initialize_102; -------------------- -- Initialize_103 -- -------------------- procedure Initialize_103 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 103, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0096'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 103, (False, AMF.CMOF.Public_Visibility)); end Initialize_103; -------------------- -- Initialize_104 -- -------------------- procedure Initialize_104 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 104, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 104, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 104, (False, AMF.CMOF.Public_Visibility)); end Initialize_104; -------------------- -- Initialize_105 -- -------------------- procedure Initialize_105 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 105, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 105, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 105, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 105, (False, AMF.CMOF.Public_Visibility)); end Initialize_105; -------------------- -- Initialize_106 -- -------------------- procedure Initialize_106 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 106, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 106, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 106, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 106, (False, AMF.CMOF.Public_Visibility)); end Initialize_106; -------------------- -- Initialize_107 -- -------------------- procedure Initialize_107 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 107, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 107, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003D'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 107, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 107, (False, AMF.CMOF.Public_Visibility)); end Initialize_107; -------------------- -- Initialize_108 -- -------------------- procedure Initialize_108 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 108, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 108, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0059'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 108, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 108, (False, AMF.CMOF.Public_Visibility)); end Initialize_108; -------------------- -- Initialize_109 -- -------------------- procedure Initialize_109 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 109, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 109, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0065'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 109, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 109, (False, AMF.CMOF.Public_Visibility)); end Initialize_109; -------------------- -- Initialize_110 -- -------------------- procedure Initialize_110 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 110, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 110, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 110, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 110, (False, AMF.CMOF.Public_Visibility)); end Initialize_110; -------------------- -- Initialize_111 -- -------------------- procedure Initialize_111 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 111, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 111, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 111, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 111, (False, AMF.CMOF.Public_Visibility)); end Initialize_111; -------------------- -- Initialize_112 -- -------------------- procedure Initialize_112 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 112, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 112, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 112, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 112, (False, AMF.CMOF.Public_Visibility)); end Initialize_112; -------------------- -- Initialize_113 -- -------------------- procedure Initialize_113 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 113, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 113, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 113, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 113, (False, AMF.CMOF.Public_Visibility)); end Initialize_113; -------------------- -- Initialize_114 -- -------------------- procedure Initialize_114 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 114, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 114, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 114, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 114, (False, AMF.CMOF.Public_Visibility)); end Initialize_114; -------------------- -- Initialize_115 -- -------------------- procedure Initialize_115 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 115, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 115, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 115, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 115, (False, AMF.CMOF.Public_Visibility)); end Initialize_115; -------------------- -- Initialize_116 -- -------------------- procedure Initialize_116 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 116, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 116, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 116, (False, AMF.CMOF.Public_Visibility)); end Initialize_116; -------------------- -- Initialize_117 -- -------------------- procedure Initialize_117 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Lower (Base + 117, (False, 0)); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 117, AMF.Internals.Tables.UMLDI_String_Data_00.MS_000A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Upper (Base + 117, (False, (Unlimited => True))); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 117, (False, AMF.CMOF.Public_Visibility)); end Initialize_117; -------------------- -- Initialize_118 -- -------------------- procedure Initialize_118 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 118, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B8'Access); end Initialize_118; -------------------- -- Initialize_119 -- -------------------- procedure Initialize_119 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 119, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0086'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 119, (Is_Empty => True)); end Initialize_119; -------------------- -- Initialize_120 -- -------------------- procedure Initialize_120 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 120, AMF.Internals.Tables.UMLDI_String_Data_00.MS_000B'Access); end Initialize_120; -------------------- -- Initialize_121 -- -------------------- procedure Initialize_121 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 121, (Is_Empty => True)); end Initialize_121; -------------------- -- Initialize_122 -- -------------------- procedure Initialize_122 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 122, AMF.Internals.Tables.UMLDI_String_Data_00.MS_004F'Access); end Initialize_122; -------------------- -- Initialize_123 -- -------------------- procedure Initialize_123 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 123, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F3'Access); end Initialize_123; -------------------- -- Initialize_124 -- -------------------- procedure Initialize_124 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 124, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007E'Access); end Initialize_124; -------------------- -- Initialize_125 -- -------------------- procedure Initialize_125 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 125, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AD'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 125, (Is_Empty => True)); end Initialize_125; -------------------- -- Initialize_126 -- -------------------- procedure Initialize_126 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 126, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C5'Access); end Initialize_126; -------------------- -- Initialize_127 -- -------------------- procedure Initialize_127 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 127, (Is_Empty => True)); end Initialize_127; -------------------- -- Initialize_128 -- -------------------- procedure Initialize_128 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 128, AMF.Internals.Tables.UMLDI_String_Data_00.MS_000D'Access); end Initialize_128; -------------------- -- Initialize_129 -- -------------------- procedure Initialize_129 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 129, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E7'Access); end Initialize_129; -------------------- -- Initialize_130 -- -------------------- procedure Initialize_130 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 130, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E0'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 130, (Is_Empty => True)); end Initialize_130; -------------------- -- Initialize_131 -- -------------------- procedure Initialize_131 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 131, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0008'Access); end Initialize_131; -------------------- -- Initialize_132 -- -------------------- procedure Initialize_132 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 132, (Is_Empty => True)); end Initialize_132; -------------------- -- Initialize_133 -- -------------------- procedure Initialize_133 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 133, AMF.Internals.Tables.UMLDI_String_Data_00.MS_002D'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 133, (Is_Empty => True)); end Initialize_133; -------------------- -- Initialize_134 -- -------------------- procedure Initialize_134 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 134, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0091'Access); end Initialize_134; -------------------- -- Initialize_135 -- -------------------- procedure Initialize_135 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 135, (Is_Empty => True)); end Initialize_135; -------------------- -- Initialize_136 -- -------------------- procedure Initialize_136 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 136, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0033'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 136, (Is_Empty => True)); end Initialize_136; -------------------- -- Initialize_137 -- -------------------- procedure Initialize_137 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 137, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B7'Access); end Initialize_137; -------------------- -- Initialize_138 -- -------------------- procedure Initialize_138 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 138, (Is_Empty => True)); end Initialize_138; -------------------- -- Initialize_139 -- -------------------- procedure Initialize_139 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 139, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 139, (Is_Empty => True)); end Initialize_139; -------------------- -- Initialize_140 -- -------------------- procedure Initialize_140 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 140, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0014'Access); end Initialize_140; -------------------- -- Initialize_141 -- -------------------- procedure Initialize_141 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 141, (Is_Empty => True)); end Initialize_141; -------------------- -- Initialize_142 -- -------------------- procedure Initialize_142 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 142, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AD'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 142, (Is_Empty => True)); end Initialize_142; -------------------- -- Initialize_143 -- -------------------- procedure Initialize_143 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 143, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BE'Access); end Initialize_143; -------------------- -- Initialize_144 -- -------------------- procedure Initialize_144 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 144, (Is_Empty => True)); end Initialize_144; -------------------- -- Initialize_145 -- -------------------- procedure Initialize_145 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 145, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C0'Access); end Initialize_145; -------------------- -- Initialize_146 -- -------------------- procedure Initialize_146 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 146, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E2'Access); end Initialize_146; -------------------- -- Initialize_147 -- -------------------- procedure Initialize_147 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 147, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_147; -------------------- -- Initialize_148 -- -------------------- procedure Initialize_148 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 148, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 148, (Is_Empty => True)); end Initialize_148; -------------------- -- Initialize_149 -- -------------------- procedure Initialize_149 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 149, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0067'Access); end Initialize_149; -------------------- -- Initialize_150 -- -------------------- procedure Initialize_150 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 150, (Is_Empty => True)); end Initialize_150; -------------------- -- Initialize_151 -- -------------------- procedure Initialize_151 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 151, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0015'Access); end Initialize_151; -------------------- -- Initialize_152 -- -------------------- procedure Initialize_152 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 152, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C7'Access); end Initialize_152; -------------------- -- Initialize_153 -- -------------------- procedure Initialize_153 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 153, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B6'Access); end Initialize_153; -------------------- -- Initialize_154 -- -------------------- procedure Initialize_154 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 154, AMF.Internals.Tables.UMLDI_String_Data_00.MS_008C'Access); end Initialize_154; -------------------- -- Initialize_155 -- -------------------- procedure Initialize_155 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 155, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0060'Access); end Initialize_155; -------------------- -- Initialize_156 -- -------------------- procedure Initialize_156 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 156, AMF.Internals.Tables.UMLDI_String_Data_00.MS_004D'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 156, (Is_Empty => True)); end Initialize_156; -------------------- -- Initialize_157 -- -------------------- procedure Initialize_157 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 157, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0003'Access); end Initialize_157; -------------------- -- Initialize_158 -- -------------------- procedure Initialize_158 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 158, (Is_Empty => True)); end Initialize_158; -------------------- -- Initialize_159 -- -------------------- procedure Initialize_159 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 159, AMF.Internals.Tables.UMLDI_String_Data_00.MS_005D'Access); end Initialize_159; -------------------- -- Initialize_160 -- -------------------- procedure Initialize_160 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 160, AMF.Internals.Tables.UMLDI_String_Data_00.MS_001C'Access); end Initialize_160; -------------------- -- Initialize_161 -- -------------------- procedure Initialize_161 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 161, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003A'Access); end Initialize_161; -------------------- -- Initialize_162 -- -------------------- procedure Initialize_162 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 162, AMF.Internals.Tables.UMLDI_String_Data_00.MS_008E'Access); end Initialize_162; -------------------- -- Initialize_163 -- -------------------- procedure Initialize_163 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 163, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 163, (Is_Empty => True)); end Initialize_163; -------------------- -- Initialize_164 -- -------------------- procedure Initialize_164 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 164, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0022'Access); end Initialize_164; -------------------- -- Initialize_165 -- -------------------- procedure Initialize_165 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 165, (Is_Empty => True)); end Initialize_165; -------------------- -- Initialize_166 -- -------------------- procedure Initialize_166 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 166, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0074'Access); end Initialize_166; -------------------- -- Initialize_167 -- -------------------- procedure Initialize_167 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 167, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0045'Access); end Initialize_167; -------------------- -- Initialize_168 -- -------------------- procedure Initialize_168 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 168, AMF.Internals.Tables.UMLDI_String_Data_00.MS_000F'Access); end Initialize_168; -------------------- -- Initialize_169 -- -------------------- procedure Initialize_169 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 169, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_169; -------------------- -- Initialize_170 -- -------------------- procedure Initialize_170 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 170, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 170, (Is_Empty => True)); end Initialize_170; -------------------- -- Initialize_171 -- -------------------- procedure Initialize_171 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 171, (Is_Empty => True)); end Initialize_171; -------------------- -- Initialize_172 -- -------------------- procedure Initialize_172 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 172, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0029'Access); end Initialize_172; -------------------- -- Initialize_173 -- -------------------- procedure Initialize_173 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 173, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 173, (Is_Empty => True)); end Initialize_173; -------------------- -- Initialize_174 -- -------------------- procedure Initialize_174 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 174, AMF.Internals.Tables.UMLDI_String_Data_00.MS_005B'Access); end Initialize_174; -------------------- -- Initialize_175 -- -------------------- procedure Initialize_175 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 175, (Is_Empty => True)); end Initialize_175; -------------------- -- Initialize_176 -- -------------------- procedure Initialize_176 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 176, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AD'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 176, (Is_Empty => True)); end Initialize_176; -------------------- -- Initialize_177 -- -------------------- procedure Initialize_177 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 177, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A7'Access); end Initialize_177; -------------------- -- Initialize_178 -- -------------------- procedure Initialize_178 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 178, (Is_Empty => True)); end Initialize_178; -------------------- -- Initialize_179 -- -------------------- procedure Initialize_179 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 179, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_179; -------------------- -- Initialize_180 -- -------------------- procedure Initialize_180 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 180, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 180, (Is_Empty => True)); end Initialize_180; -------------------- -- Initialize_181 -- -------------------- procedure Initialize_181 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 181, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0051'Access); end Initialize_181; -------------------- -- Initialize_182 -- -------------------- procedure Initialize_182 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 182, (Is_Empty => True)); end Initialize_182; -------------------- -- Initialize_183 -- -------------------- procedure Initialize_183 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 183, AMF.Internals.Tables.UMLDI_String_Data_00.MS_008B'Access); end Initialize_183; -------------------- -- Initialize_184 -- -------------------- procedure Initialize_184 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 184, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0012'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 184, (Is_Empty => True)); end Initialize_184; -------------------- -- Initialize_185 -- -------------------- procedure Initialize_185 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 185, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0056'Access); end Initialize_185; -------------------- -- Initialize_186 -- -------------------- procedure Initialize_186 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 186, (Is_Empty => True)); end Initialize_186; -------------------- -- Initialize_187 -- -------------------- procedure Initialize_187 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 187, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0058'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 187, (Is_Empty => True)); end Initialize_187; -------------------- -- Initialize_188 -- -------------------- procedure Initialize_188 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 188, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0030'Access); end Initialize_188; -------------------- -- Initialize_189 -- -------------------- procedure Initialize_189 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 189, (Is_Empty => True)); end Initialize_189; -------------------- -- Initialize_190 -- -------------------- procedure Initialize_190 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 190, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00CD'Access); end Initialize_190; -------------------- -- Initialize_191 -- -------------------- procedure Initialize_191 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 191, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0080'Access); end Initialize_191; -------------------- -- Initialize_192 -- -------------------- procedure Initialize_192 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 192, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0069'Access); end Initialize_192; -------------------- -- Initialize_193 -- -------------------- procedure Initialize_193 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 193, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D1'Access); end Initialize_193; -------------------- -- Initialize_194 -- -------------------- procedure Initialize_194 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 194, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00CC'Access); end Initialize_194; -------------------- -- Initialize_195 -- -------------------- procedure Initialize_195 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 195, AMF.Internals.Tables.UMLDI_String_Data_00.MS_002C'Access); end Initialize_195; -------------------- -- Initialize_196 -- -------------------- procedure Initialize_196 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 196, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0049'Access); end Initialize_196; -------------------- -- Initialize_197 -- -------------------- procedure Initialize_197 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 197, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0063'Access); end Initialize_197; -------------------- -- Initialize_198 -- -------------------- procedure Initialize_198 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 198, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0007'Access); end Initialize_198; -------------------- -- Initialize_199 -- -------------------- procedure Initialize_199 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 199, AMF.Internals.Tables.UMLDI_String_Data_00.MS_006E'Access); end Initialize_199; -------------------- -- Initialize_200 -- -------------------- procedure Initialize_200 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 200, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0023'Access); end Initialize_200; -------------------- -- Initialize_201 -- -------------------- procedure Initialize_201 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 201, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D8'Access); end Initialize_201; -------------------- -- Initialize_202 -- -------------------- procedure Initialize_202 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 202, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0085'Access); end Initialize_202; -------------------- -- Initialize_203 -- -------------------- procedure Initialize_203 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 203, AMF.Internals.Tables.UMLDI_String_Data_00.MS_009C'Access); end Initialize_203; -------------------- -- Initialize_204 -- -------------------- procedure Initialize_204 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 204, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0061'Access); end Initialize_204; -------------------- -- Initialize_205 -- -------------------- procedure Initialize_205 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 205, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E4'Access); end Initialize_205; -------------------- -- Initialize_206 -- -------------------- procedure Initialize_206 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 206, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0034'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 206, (Is_Empty => True)); end Initialize_206; -------------------- -- Initialize_207 -- -------------------- procedure Initialize_207 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 207, AMF.Internals.Tables.UMLDI_String_Data_00.MS_000C'Access); end Initialize_207; -------------------- -- Initialize_208 -- -------------------- procedure Initialize_208 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 208, (Is_Empty => True)); end Initialize_208; -------------------- -- Initialize_209 -- -------------------- procedure Initialize_209 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 209, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00EB'Access); end Initialize_209; -------------------- -- Initialize_210 -- -------------------- procedure Initialize_210 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 210, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 210, (Is_Empty => True)); end Initialize_210; -------------------- -- Initialize_211 -- -------------------- procedure Initialize_211 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 211, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003B'Access); end Initialize_211; -------------------- -- Initialize_212 -- -------------------- procedure Initialize_212 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 212, (Is_Empty => True)); end Initialize_212; -------------------- -- Initialize_213 -- -------------------- procedure Initialize_213 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 213, AMF.Internals.Tables.UMLDI_String_Data_00.MS_001F'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 213, (Is_Empty => True)); end Initialize_213; -------------------- -- Initialize_214 -- -------------------- procedure Initialize_214 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 214, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0064'Access); end Initialize_214; -------------------- -- Initialize_215 -- -------------------- procedure Initialize_215 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 215, (Is_Empty => True)); end Initialize_215; -------------------- -- Initialize_216 -- -------------------- procedure Initialize_216 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 216, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0005'Access); end Initialize_216; -------------------- -- Initialize_217 -- -------------------- procedure Initialize_217 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 217, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AA'Access); end Initialize_217; -------------------- -- Initialize_218 -- -------------------- procedure Initialize_218 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 218, AMF.Internals.Tables.UMLDI_String_Data_00.MS_002F'Access); end Initialize_218; -------------------- -- Initialize_219 -- -------------------- procedure Initialize_219 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 219, AMF.Internals.Tables.UMLDI_String_Data_00.MS_005C'Access); end Initialize_219; -------------------- -- Initialize_220 -- -------------------- procedure Initialize_220 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 220, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0078'Access); end Initialize_220; -------------------- -- Initialize_221 -- -------------------- procedure Initialize_221 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 221, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_221; -------------------- -- Initialize_222 -- -------------------- procedure Initialize_222 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 222, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 222, (Is_Empty => True)); end Initialize_222; -------------------- -- Initialize_223 -- -------------------- procedure Initialize_223 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 223, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D5'Access); end Initialize_223; -------------------- -- Initialize_224 -- -------------------- procedure Initialize_224 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 224, (Is_Empty => True)); end Initialize_224; -------------------- -- Initialize_225 -- -------------------- procedure Initialize_225 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 225, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_225; -------------------- -- Initialize_226 -- -------------------- procedure Initialize_226 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 226, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 226, (Is_Empty => True)); end Initialize_226; -------------------- -- Initialize_227 -- -------------------- procedure Initialize_227 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 227, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B9'Access); end Initialize_227; -------------------- -- Initialize_228 -- -------------------- procedure Initialize_228 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 228, (Is_Empty => True)); end Initialize_228; -------------------- -- Initialize_229 -- -------------------- procedure Initialize_229 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 229, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_229; -------------------- -- Initialize_230 -- -------------------- procedure Initialize_230 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 230, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 230, (Is_Empty => True)); end Initialize_230; -------------------- -- Initialize_231 -- -------------------- procedure Initialize_231 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 231, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F0'Access); end Initialize_231; -------------------- -- Initialize_232 -- -------------------- procedure Initialize_232 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 232, (Is_Empty => True)); end Initialize_232; -------------------- -- Initialize_233 -- -------------------- procedure Initialize_233 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 233, AMF.Internals.Tables.UMLDI_String_Data_00.MS_001D'Access); end Initialize_233; -------------------- -- Initialize_234 -- -------------------- procedure Initialize_234 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 234, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E1'Access); end Initialize_234; -------------------- -- Initialize_235 -- -------------------- procedure Initialize_235 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 235, AMF.Internals.Tables.UMLDI_String_Data_00.MS_009A'Access); end Initialize_235; -------------------- -- Initialize_236 -- -------------------- procedure Initialize_236 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 236, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0068'Access); end Initialize_236; -------------------- -- Initialize_237 -- -------------------- procedure Initialize_237 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 237, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BA'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 237, (Is_Empty => True)); end Initialize_237; -------------------- -- Initialize_238 -- -------------------- procedure Initialize_238 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 238, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E6'Access); end Initialize_238; -------------------- -- Initialize_239 -- -------------------- procedure Initialize_239 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 239, (Is_Empty => True)); end Initialize_239; -------------------- -- Initialize_240 -- -------------------- procedure Initialize_240 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 240, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B1'Access); end Initialize_240; -------------------- -- Initialize_241 -- -------------------- procedure Initialize_241 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 241, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A4'Access); end Initialize_241; -------------------- -- Initialize_242 -- -------------------- procedure Initialize_242 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 242, AMF.Internals.Tables.UMLDI_String_Data_00.MS_009F'Access); end Initialize_242; -------------------- -- Initialize_243 -- -------------------- procedure Initialize_243 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 243, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0026'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 243, (Is_Empty => True)); end Initialize_243; -------------------- -- Initialize_244 -- -------------------- procedure Initialize_244 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 244, AMF.Internals.Tables.UMLDI_String_Data_00.MS_008A'Access); end Initialize_244; -------------------- -- Initialize_245 -- -------------------- procedure Initialize_245 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 245, (Is_Empty => True)); end Initialize_245; -------------------- -- Initialize_246 -- -------------------- procedure Initialize_246 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 246, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0087'Access); end Initialize_246; -------------------- -- Initialize_247 -- -------------------- procedure Initialize_247 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 247, AMF.Internals.Tables.UMLDI_String_Data_00.MS_002A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 247, (Is_Empty => True)); end Initialize_247; -------------------- -- Initialize_248 -- -------------------- procedure Initialize_248 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 248, AMF.Internals.Tables.UMLDI_String_Data_00.MS_009D'Access); end Initialize_248; -------------------- -- Initialize_249 -- -------------------- procedure Initialize_249 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 249, (Is_Empty => True)); end Initialize_249; -------------------- -- Initialize_250 -- -------------------- procedure Initialize_250 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 250, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DE'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 250, (Is_Empty => True)); end Initialize_250; -------------------- -- Initialize_251 -- -------------------- procedure Initialize_251 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 251, AMF.Internals.Tables.UMLDI_String_Data_00.MS_007C'Access); end Initialize_251; -------------------- -- Initialize_252 -- -------------------- procedure Initialize_252 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 252, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0071'Access); end Initialize_252; -------------------- -- Initialize_253 -- -------------------- procedure Initialize_253 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 253, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C3'Access); end Initialize_253; -------------------- -- Initialize_254 -- -------------------- procedure Initialize_254 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 254, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0019'Access); end Initialize_254; -------------------- -- Initialize_255 -- -------------------- procedure Initialize_255 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 255, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0072'Access); end Initialize_255; -------------------- -- Initialize_256 -- -------------------- procedure Initialize_256 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 256, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00EF'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 256, (Is_Empty => True)); end Initialize_256; -------------------- -- Initialize_257 -- -------------------- procedure Initialize_257 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 257, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003C'Access); end Initialize_257; -------------------- -- Initialize_258 -- -------------------- procedure Initialize_258 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 258, (Is_Empty => True)); end Initialize_258; -------------------- -- Initialize_259 -- -------------------- procedure Initialize_259 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 259, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0076'Access); end Initialize_259; -------------------- -- Initialize_260 -- -------------------- procedure Initialize_260 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 260, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0057'Access); end Initialize_260; -------------------- -- Initialize_261 -- -------------------- procedure Initialize_261 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 261, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DB'Access); end Initialize_261; -------------------- -- Initialize_262 -- -------------------- procedure Initialize_262 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 262, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C4'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 262, (Is_Empty => True)); end Initialize_262; -------------------- -- Initialize_263 -- -------------------- procedure Initialize_263 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 263, AMF.Internals.Tables.UMLDI_String_Data_00.MS_001A'Access); end Initialize_263; -------------------- -- Initialize_264 -- -------------------- procedure Initialize_264 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 264, (Is_Empty => True)); end Initialize_264; -------------------- -- Initialize_265 -- -------------------- procedure Initialize_265 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 265, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AD'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 265, (Is_Empty => True)); end Initialize_265; -------------------- -- Initialize_266 -- -------------------- procedure Initialize_266 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 266, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00DD'Access); end Initialize_266; -------------------- -- Initialize_267 -- -------------------- procedure Initialize_267 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 267, (Is_Empty => True)); end Initialize_267; -------------------- -- Initialize_268 -- -------------------- procedure Initialize_268 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 268, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0090'Access); end Initialize_268; -------------------- -- Initialize_269 -- -------------------- procedure Initialize_269 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 269, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0001'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 269, (Is_Empty => True)); end Initialize_269; -------------------- -- Initialize_270 -- -------------------- procedure Initialize_270 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 270, AMF.Internals.Tables.UMLDI_String_Data_00.MS_005F'Access); end Initialize_270; -------------------- -- Initialize_271 -- -------------------- procedure Initialize_271 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 271, (Is_Empty => True)); end Initialize_271; -------------------- -- Initialize_272 -- -------------------- procedure Initialize_272 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 272, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A6'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 272, (Is_Empty => True)); end Initialize_272; -------------------- -- Initialize_273 -- -------------------- procedure Initialize_273 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 273, AMF.Internals.Tables.UMLDI_String_Data_00.MS_000E'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 273, (Is_Empty => True)); end Initialize_273; -------------------- -- Initialize_274 -- -------------------- procedure Initialize_274 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 274, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0054'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 274, (Is_Empty => True)); end Initialize_274; -------------------- -- Initialize_275 -- -------------------- procedure Initialize_275 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 275, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0010'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 275, (Is_Empty => True)); end Initialize_275; -------------------- -- Initialize_276 -- -------------------- procedure Initialize_276 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 276, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0073'Access); end Initialize_276; -------------------- -- Initialize_277 -- -------------------- procedure Initialize_277 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 277, AMF.Internals.Tables.UMLDI_String_Data_00.MS_009B'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 277, (Is_Empty => True)); end Initialize_277; -------------------- -- Initialize_278 -- -------------------- procedure Initialize_278 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 278, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0094'Access); end Initialize_278; -------------------- -- Initialize_279 -- -------------------- procedure Initialize_279 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 279, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0025'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 279, (Is_Empty => True)); end Initialize_279; -------------------- -- Initialize_280 -- -------------------- procedure Initialize_280 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 280, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0089'Access); end Initialize_280; -------------------- -- Initialize_281 -- -------------------- procedure Initialize_281 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 281, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0070'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 281, (Is_Empty => True)); end Initialize_281; -------------------- -- Initialize_282 -- -------------------- procedure Initialize_282 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 282, AMF.Internals.Tables.UMLDI_String_Data_00.MS_006C'Access); end Initialize_282; -------------------- -- Initialize_283 -- -------------------- procedure Initialize_283 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 283, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E8'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 283, (Is_Empty => True)); end Initialize_283; -------------------- -- Initialize_284 -- -------------------- procedure Initialize_284 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 284, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B0'Access); end Initialize_284; -------------------- -- Initialize_285 -- -------------------- procedure Initialize_285 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 285, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0028'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 285, (Is_Empty => True)); end Initialize_285; -------------------- -- Initialize_286 -- -------------------- procedure Initialize_286 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 286, AMF.Internals.Tables.UMLDI_String_Data_00.MS_006B'Access); end Initialize_286; -------------------- -- Initialize_287 -- -------------------- procedure Initialize_287 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 287, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0042'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 287, (Is_Empty => True)); end Initialize_287; -------------------- -- Initialize_288 -- -------------------- procedure Initialize_288 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 288, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0046'Access); end Initialize_288; -------------------- -- Initialize_289 -- -------------------- procedure Initialize_289 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 289, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0095'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 289, (Is_Empty => True)); end Initialize_289; -------------------- -- Initialize_290 -- -------------------- procedure Initialize_290 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 290, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0053'Access); end Initialize_290; -------------------- -- Initialize_291 -- -------------------- procedure Initialize_291 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 291, AMF.Internals.Tables.UMLDI_String_Data_00.MS_006A'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 291, (Is_Empty => True)); end Initialize_291; -------------------- -- Initialize_292 -- -------------------- procedure Initialize_292 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 292, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0009'Access); end Initialize_292; -------------------- -- Initialize_293 -- -------------------- procedure Initialize_293 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 293, AMF.Internals.Tables.UMLDI_String_Data_00.MS_006D'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 293, (Is_Empty => True)); end Initialize_293; -------------------- -- Initialize_294 -- -------------------- procedure Initialize_294 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 294, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 294, (Is_Empty => True)); end Initialize_294; -------------------- -- Initialize_295 -- -------------------- procedure Initialize_295 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 295, AMF.Internals.Tables.UMLDI_String_Data_00.MS_003E'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 295, (Is_Empty => True)); end Initialize_295; -------------------- -- Initialize_296 -- -------------------- procedure Initialize_296 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 296, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0052'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 296, (Is_Empty => True)); end Initialize_296; -------------------- -- Initialize_297 -- -------------------- procedure Initialize_297 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 297, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E5'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 297, (Is_Empty => True)); end Initialize_297; -------------------- -- Initialize_298 -- -------------------- procedure Initialize_298 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 298, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0037'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 298, (Is_Empty => True)); end Initialize_298; -------------------- -- Initialize_299 -- -------------------- procedure Initialize_299 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 299, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00AE'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 299, (Is_Empty => True)); end Initialize_299; -------------------- -- Initialize_300 -- -------------------- procedure Initialize_300 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 300, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0011'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 300, (Is_Empty => True)); end Initialize_300; -------------------- -- Initialize_301 -- -------------------- procedure Initialize_301 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 301, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B3'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 301, (Is_Empty => True)); end Initialize_301; -------------------- -- Initialize_302 -- -------------------- procedure Initialize_302 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 302, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0097'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 302, (Is_Empty => True)); end Initialize_302; -------------------- -- Initialize_303 -- -------------------- procedure Initialize_303 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 303, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0044'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 303, (Is_Empty => True)); end Initialize_303; -------------------- -- Initialize_304 -- -------------------- procedure Initialize_304 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 304, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0084'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 304, (Is_Empty => True)); end Initialize_304; -------------------- -- Initialize_305 -- -------------------- procedure Initialize_305 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 305, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00D6'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 305, (Is_Empty => True)); end Initialize_305; -------------------- -- Initialize_306 -- -------------------- procedure Initialize_306 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 306, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C6'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 306, (Is_Empty => True)); end Initialize_306; -------------------- -- Initialize_307 -- -------------------- procedure Initialize_307 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 307, AMF.Internals.Tables.UMLDI_String_Data_00.MS_008D'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 307, (Is_Empty => True)); end Initialize_307; -------------------- -- Initialize_308 -- -------------------- procedure Initialize_308 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 308, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00E3'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 308, (Is_Empty => True)); end Initialize_308; -------------------- -- Initialize_309 -- -------------------- procedure Initialize_309 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 309, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00C1'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 309, (Is_Empty => True)); end Initialize_309; -------------------- -- Initialize_310 -- -------------------- procedure Initialize_310 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 310, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F6'Access); end Initialize_310; -------------------- -- Initialize_311 -- -------------------- procedure Initialize_311 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 311, AMF.Internals.Tables.UMLDI_String_Data_00.MS_001E'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 311, (Is_Empty => True)); end Initialize_311; -------------------- -- Initialize_312 -- -------------------- procedure Initialize_312 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 312, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00F5'Access); end Initialize_312; -------------------- -- Initialize_313 -- -------------------- procedure Initialize_313 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 313, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00BD'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 313, (Is_Empty => True)); end Initialize_313; -------------------- -- Initialize_314 -- -------------------- procedure Initialize_314 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 314, AMF.Internals.Tables.UMLDI_String_Data_00.MS_005E'Access); end Initialize_314; -------------------- -- Initialize_315 -- -------------------- procedure Initialize_315 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 315, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00B2'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 315, (Is_Empty => True)); end Initialize_315; -------------------- -- Initialize_316 -- -------------------- procedure Initialize_316 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Body (Base + 316, AMF.Internals.Tables.UMLDI_String_Data_00.MS_0035'Access); end Initialize_316; -------------------- -- Initialize_317 -- -------------------- procedure Initialize_317 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 317, AMF.CMOF.Public_Visibility); end Initialize_317; -------------------- -- Initialize_318 -- -------------------- procedure Initialize_318 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Visibility (Base + 318, AMF.CMOF.Public_Visibility); end Initialize_318; -------------------- -- Initialize_319 -- -------------------- procedure Initialize_319 is begin AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Name (Base + 319, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00CB'Access); AMF.Internals.Tables.CMOF_Attributes.Internal_Set_Value (Base + 319, AMF.Internals.Tables.UMLDI_String_Data_00.MS_00A5'Access); end Initialize_319; end AMF.Internals.Tables.UMLDI_Metamodel.Properties;
generic package BitOperations.Search.Axiom with SPARK_Mode, Pure, Ghost is end BitOperations.Search.Axiom;
-- -- procedure Bi_Diagonalize -- -- Transforms matrix A into bi-diagonal matrix B, -- -- U' * A * V = B -- -- The diagonal and superdiagonals of B are non-zero. All other elements -- of B are zero. -- -- U and V are orthogonal matrices - constructed from the products of 2 x 2 -- Givens rotation matrices. Here, U matrix has the same shape as A, and V -- is a square matrix with the same number of columns a A. (V has the same -- shape as A'*A = A_transpose * A.) -- -- Can have more Rows than Columns, but not more Columns than Rows. -- generic type Real is digits <>; type Col_Index is range <>; type Row_Index is range <>; -- Must have Col_Index'First = Row_Index'First. This is checked. -- (Want the diagonal to be A(i, i).) type A_Matrix is array(Row_Index, Col_Index) of Real; type U_Matrix is array(Row_Index, Row_Index) of Real; type V_Matrix is array(Col_Index, Col_Index) of Real; package Bidiagonal is function U_Identity return U_Matrix; function V_Identity return V_Matrix; -- Row_Index must contain Col_Index in its range: pragma Assert (Row_Index (Col_Index'First) >= Row_Index'First); pragma Assert (Row_Index (Col_Index'Last) <= Row_Index'Last); -- A is the matrix to be transformed with a series of Givens rotations: -- A = U * B * V'. U and V are orthogonal matrices. -- -- The procedure only operates on square matrices, or matrices with more -- rows than columns. -- -- Procedure checks: pragma Assert (No_of_Rows >= No_of_Cols); -- -- Initial_V_Matrix = Identity, unless you preprocessed A with an L*Q -- transform, in which case Initial_V_Matrix = Q, and use L for argument A. -- -- Starting_Row is set to Starting_Col: procedure Bi_Diagonalize (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : out V_Matrix; -- Need to input Initial_V_Matrix below. U : out U_Matrix; -- Initialized with Identity. Initial_V_Matrix : in V_Matrix; -- Normally must use function V_Identity. Initial_U_Matrix : in U_Matrix; -- Normally just use function U_Identity. Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True); procedure Zero_Shift_Bidiagonal_QR (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : in out V_Matrix; -- U : in out U_Matrix; -- Initialized with Identity Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True); end Bidiagonal;
-- -- Copyright (C) 2022 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Ada.Unchecked_Conversion; package body ADXL345_SPI is package body Register is use HAL.SPI; use HAL; subtype Data_Array is SPI_Data_8b (1 .. Register_Type'Size / 8); function To_Data_Array is new Ada.Unchecked_Conversion (Source => Register_Type, Target => Data_Array); function To_Register_Type is new Ada.Unchecked_Conversion (Source => Data_Array, Target => Register_Type); function Get (Port : not null HAL.SPI.Any_SPI_Port; CS : not null HAL.GPIO.Any_GPIO_Point; Value : out Register_Type) return Boolean is Buffer : SPI_Data_8b (1 .. 1) := (1 => Address or 2#1000_0000#); -- read Data : Data_Array := (others => 0); Status : SPI_Status; begin if Data'Length > 1 then Buffer (1) := Buffer (1) or 2#0100_0000#; -- multibyte end if; CS.Clear; Port.Transmit (Buffer, Status, Timeout => 0); Port.Receive (Buffer, Status, Timeout => 1); for I in Data'Range loop Buffer (1) := 0; Port.Transmit (Buffer, Status, Timeout => 0); if Status /= Ok then exit; end if; Port.Receive (Buffer, Status, Timeout => 1); if Status /= Ok then exit; end if; Data (I) := Buffer (1); end loop; CS.Set; Value := To_Register_Type (Data); return Status = Ok; end Get; function Get (Port : not null HAL.SPI.Any_SPI_Port; CS : not null HAL.GPIO.Any_GPIO_Point) return Register_Type is V : Register_Type; begin if Get (Port, CS, V) then return V; else raise Program_Error with "ADXL345 SPI Read Error"; end if; end Get; function Set (Port : not null HAL.SPI.Any_SPI_Port; CS : not null HAL.GPIO.Any_GPIO_Point; Value : Register_Type) return Boolean is Buffer : SPI_Data_8b (1 .. 1) := (1 => Address); Data : Data_Array := To_Data_Array (Value); Status : SPI_Status; begin if Data'Length > 1 then Buffer (1) := Buffer (1) or 2#0100_0000#; -- multibyte end if; CS.Clear; Port.Transmit (Buffer, Status, Timeout => 0); Port.Receive (Buffer, Status, Timeout => 1); for I in Data'Range loop Port.Transmit (Data (I .. I), Status, Timeout => 0); if Status /= Ok then exit; end if; Port.Receive (Data (I .. I), Status, Timeout => 1); if Status /= Ok then exit; end if; end loop; CS.Set; return Status = Ok; end Set; procedure Set (Port : not null HAL.SPI.Any_SPI_Port; CS : not null HAL.GPIO.Any_GPIO_Point; Value : Register_Type) is begin if Set (Port, CS, Value) = False then raise Program_Error with "ADXL345 SPI Write Error"; end if; end Set; end Register; end ADXL345_SPI;
with Ada.Directories; with Ada.Finalization; with Ada.Strings.Unbounded; with Ada.Text_IO; package DTG is package AD renames Ada.Directories; package ASU renames Ada.Strings.Unbounded; package AIO renames Ada.Text_IO; type Report is new Ada.Finalization.Limited_Controlled with record Output_File : AIO.File_Type; Include_Dot_Files : Boolean := False; end record; function Create(File_Name : String) return Report; overriding procedure Finalize(Self : in out Report); function Should_Include (R : in Report; E : in AD.Directory_Entry_Type) return Boolean; procedure Add (R : in Report; E : in AD.Directory_Entry_Type); function Replace (Full_Name : String) return ASU.Unbounded_String; function Node_Name (Full_Name : String) return ASU.Unbounded_String; function Parent (Full_Name : String) return String; procedure Evaluate (Result : in out Report; Dir_Root : String); end DTG;
with Ada.Integer_Text_IO; with Ada.Integer_Text_IO; with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics; with Ada.Numerics.Discrete_Random; package body Data is protected body Mutex is entry Seize when not Owned is begin Owned := True; end Seize; Procedure Release is begin Owned := False; end Release; end Mutex; function F1(A : in Matrix; D : in Matrix; B : in Vector; N : in Integer) return Matrix is E : Matrix; begin E := Multiple(A, D, N); E := Multiple(Max(B, N), E, N); return E; end F1; function F2(a : in Integer; G : in Matrix; K : in Matrix; L : in Matrix; N : in Integer) return Matrix is F,T : Matrix; begin T:=Trans(G,N); F:=Multiple(a,T,N); T:=Multiple(K,L,N); F:=Amount(F,T,N); return F; end F2; function F3(P : in Matrix; R : in Matrix; S : in Vector; T : in Vector; N : in Integer) return Vector is O : Vector; A : Matrix; begin A:=Multiple(P,R,N); O:=Multiple(A,S,N); O:=Amount(O,S,N); return O; end F3; procedure Matrix_Input (A : out Matrix; N : in Integer) is item : Integer; begin My_Mutex.Seize; Put_Line ("Enter matrix values:"); for i in 1..N loop for j in 1..N loop Ada.Integer_Text_IO.Get (item); A(i,j) := item; end loop; end loop; My_Mutex.Release; end Matrix_Input; procedure Matrix_Output(A : in Matrix; N : in Integer; S: in String) is begin My_Mutex.Seize; Put_Line(S); for i in 1..N loop for j in 1..N loop Ada.Integer_Text_IO.Put(A(i,j)); end loop; New_Line; end loop; My_Mutex.Release; end Matrix_Output; procedure Matrix_Generate (A : out Matrix; N : in Integer) is type Rand_Range is range 1..10; package Rand_Int is new Ada.Numerics.Discrete_Random(Rand_Range); seed : Rand_Int.Generator; Num : Rand_Range; begin Rand_Int.Reset(seed); for i in 1..N loop for j in 1..N loop Num := Rand_Int.Random(seed); A(i,j) := 1; end loop; end loop; end Matrix_Generate; procedure Vector_Generate (A : out Vector; N : in Integer) is type Rand_Range is range 1..10; package Rand_Int is new Ada.Numerics.Discrete_Random(Rand_Range); seed : Rand_Int.Generator; Num : Rand_Range; begin Rand_Int.Reset(seed); for i in 1..N loop Num := Rand_Int.Random(seed); A(i) := 1; end loop; end Vector_Generate; procedure Value_Generate (A : out Integer) is type Rand_Range is range 1..10; package Rand_Int is new Ada.Numerics.Discrete_Random(Rand_Range); seed : Rand_Int.Generator; Num : Rand_Range; begin Rand_Int.Reset(seed); Num := Rand_Int.Random(seed); A := 5; end Value_Generate; procedure Vector_Input (A : out Vector; N : in Integer) is item : Integer; begin My_Mutex.Seize; Put_Line ("Enter vector values:"); for i in 1..N loop Ada.Integer_Text_IO.Get(item); A(i) := item; end loop; My_Mutex.Release; end Vector_Input; procedure Vector_Output(A : in Vector; N : in Integer; S: in String) is begin My_Mutex.Seize; Put_Line(S); for i in 1..N loop Ada.Integer_Text_IO.Put(A(i)); end loop; New_Line; My_Mutex.Release; end Vector_Output; function Max (A: Vector; N : in Integer) return Integer is x : Integer; begin x := A(1); for i in 1..N loop if A(i)>x then x := A(i); end if; end loop; return x; end Max; function Amount ( A: in Vector; B: in Vector; N : in Integer) return Vector is C : Vector; begin for i in 1..N loop C(i):=A(i)+B(i); end loop; return C; end Amount; function Multiple ( A: in Integer; B: in out Matrix; N : in Integer) return Matrix is C:Matrix; begin for i in 1..N loop for j in 1..N loop C(i,j):=A*B(i,j); end loop; end loop; return C; end Multiple; function Trans (A: in Matrix; N : in Integer) return Matrix is B:Matrix; begin for i in 1..N loop for j in 1..N loop B(i,j):=A(j,i); end loop; end loop; return B; end Trans; function Amount ( A: in Matrix; B: in Matrix; N : in Integer) return Matrix is C:Matrix; begin for i in 1..N loop for j in 1..N loop C(i,j):=A(i,j)+B(i,j); end loop; end loop; return C; end Amount; function Multiple ( A: in Matrix; B: in Matrix; N : in Integer) return Matrix is C:Matrix; begin for row in 1..N loop for col in 1..N loop C(row,col):=0; for inner in 1..N loop C(row,col) := C(row,col) + A(row,inner) * B(inner,col); end loop; end loop; end loop; return C; end Multiple; function Multiple ( A: in Matrix; B: in Vector; N : in Integer) return Vector is C:Vector; begin for row in 1..N loop C(row):=0; for col in 1..N loop C(row) := C(row) + A(row,col) * B(col); end loop; end loop; return C; end Multiple; end Data;
pragma Ada_2012; with Utilities; package body Fakedsp.Data_Streams.Wave is subtype RIFF_Tag is String (1 .. 4); RIFF_Name : constant RIFF_Tag := "RIFF"; WAVE_Format : constant RIFF_Tag := "WAVE"; Fmt_Name : constant RIFF_Tag := "fmt "; Data_Name : constant RIFF_Tag := "data"; type Int32 is mod 2 ** 32 with Size => 32; type Int16 is mod 2 ** 16 with Size => 16; type Audio_Format is (PCM) with Size => 16; for Audio_Format use (PCM => 1); type RIFF_Chunk is record Tag : RIFF_Tag; Chunk_Size : Int32; Format : RIFF_Tag; end record; type Format_Chunk is record Tag : RIFF_Tag; Chunk_Size : Int32; Format : Audio_Format; Num_Channels : Int16; Sample_Rate : Int32; Byte_Rate : Int32; Block_Align : Int16; Bit_Per_Sample : Int16; end record; type Data_Chunk_Header is record Tag : RIFF_Tag; Chunk_Size : Int32; end record; ---------- -- Open -- ---------- function Open (Filename : String) return Wave_Source_Access is use Streams.Stream_IO; -- function Read_Riff_Chunk is new Utilities.Read_Chunk (RIFF_Chunk); -- function Read_Format_Chunk is new Utilities.Read_Chunk (Format_Chunk); -- function Read_Data_Header is new Utilities.Read_Chunk (Data_Chunk_Header); Result : constant Wave_Source_Access := new Wave_Source; begin Open (File => Result.File, Mode => In_File, Name => Filename); declare Riff : RIFF_Chunk; begin RIFF_Chunk'Read (Stream (Result.File), Riff); if Riff.Tag /= RIFF_Name or Riff.Format /= WAVE_Format then raise Bad_Format; end if; end; declare Format : Format_Chunk; begin Format_Chunk'Read (Stream (Result.File), Format); if Format.Tag /= Fmt_Name then raise Bad_Format with "[" & Format.Tag & "," & Fmt_Name & "]"; end if; if Format.Bit_Per_Sample /= 16 then raise Unimplemented_Format with "Only 16 bit/sample implemented"; end if; if Format.Num_Channels /= 1 then raise Unimplemented_Format with "Only single channel files implemented"; end if; Result.Frequency := Frequency_Hz (Format.Sample_Rate); Result.Top_Channel := (Channel_Index (Format.Num_Channels) + Channel_Index'First)-1; end; declare Header : Data_Chunk_Header; begin Data_Chunk_Header'Read (Stream (Result.File), Header); if Header.Tag /= Data_Name then raise Bad_Format with "Expected tag 'data'"; end if; end; return Result; end Open; ---------- -- Read -- ---------- procedure Read (Src : in out Wave_Source; Sample : out Sample_Type; End_Of_Stream : out Boolean; Channel : Channel_Index := Channel_Index'First) is -- function Read_Sample is new Utilities.Read_Chunk (Sample_Type); begin if Channel > Src.Top_Channel then raise Constraint_Error with "channel out of bound"; end if; Sample_Type'Read (Streams.Stream_IO.Stream (Src.File), Sample); End_Of_Stream := False; exception when Streams.Stream_IO.End_Error => End_Of_Stream := True; end Read; procedure Read (Src : in out Wave_Source; Sample : out Float; End_Of_Stream : out Boolean; Channel : Channel_Index := Channel_Index'First) is Tmp : Sample_Type; begin Src.Read (Sample => Tmp, End_Of_Stream => End_Of_Stream, Channel => Channel); Sample := Float (Tmp); end Read; ---------- -- Open -- ---------- function Open (Filename : String; Sampling : Frequency_Hz; Last_Channel : Channel_Index := 1) return Wave_Destination_Access is -- procedure Write_RIFF is new Utilities.Write_Chunk (RIFF_Chunk); -- procedure Write_Fmt is new Utilities.Write_Chunk (Format_Chunk); -- procedure Write_Header is new Utilities.Write_Chunk (Data_Chunk_Header); use Ada.Streams.Stream_IO; N_Channel : constant Int32 := Int32 ((Last_Channel + 1)-Channel_Index'First); Byte_Per_Sample : constant Int32 := Int32 (Sample_Size / 8); Result : Wave_Destination_Access; begin if Last_Channel /= 1 then raise Unimplemented_Format; end if; Result := new Wave_Destination; Result.Frequency := Sampling; Result.Top_Channel := Last_Channel; Streams.Stream_IO.Create (File => Result.File, Mode => Streams.Stream_IO.Out_File, Name => Filename); RIFF_Chunk'Write (Stream (Result.File), RIFF_Chunk'(Tag => RIFF_Name, Chunk_Size => 0, Format => WAVE_Format)); Format_Chunk'Write (Stream (Result.File), Format_Chunk'(Tag => Fmt_Name, Chunk_Size => 16, Format => PCM, Num_Channels => Int16 (N_Channel), Sample_Rate => Int32 (Sampling), Byte_Rate => Int32 (Sampling) * Byte_Per_Sample * N_Channel, Block_Align => Int16 (Byte_Per_Sample * N_Channel), Bit_Per_Sample => Int16 (Sample_Size))); Data_Chunk_Header'Write (Stream (Result.File), Data_Chunk_Header'(Tag => Data_Name, Chunk_Size => 0)); return Result; end Open; ----------- -- Write -- ----------- procedure Write (Dst : Wave_Destination; Sample : Sample_Type; Channel : Channel_Index := Channel_Index'First) is -- procedure Write_Sample is new Utilities.Write_Chunk (Sample_Type); begin if Channel > Dst.Top_Channel then raise Constraint_Error with "Channel out of bound"; end if; Sample_Type'Write (Streams.Stream_IO.Stream (Dst.File), Sample); end Write; ----------- -- Write -- ----------- procedure Write (Dst : Wave_Destination; Sample : Float; Channel : Channel_Index := Channel_Index'First) is begin Dst.Write (Sample => Sample_Type (Sample), Channel => Channel); end Write; ----------- -- Close -- ----------- procedure Close (Dst : in out Wave_Destination) is use Streams.Stream_IO; Len : constant Streams.Stream_IO.Count := Size (Dst.File); -- procedure Write is new Utilities.Write_Chunk (Int32); begin Set_Index (Dst.File, 5); Int32'Write (Stream (Dst.File), Int32 (Len)-8); Set_Index (Dst.File, 41); Int32'Write (Stream (Dst.File), Int32 (Len)-44); Close (Dst.File); end Close; ----------- -- Close -- ----------- procedure Close (Src : in out Wave_Source) is begin Streams.Stream_IO.Close (Src.File); end Close; end Fakedsp.Data_Streams.Wave;
----------------------------------------------------------------------- -- wiki-streams -- Wiki input and output streams -- Copyright (C) 2011, 2012, 2013, 2015, 2016, 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 Wiki.Strings; -- == Input and Output streams {#wiki-streams} == -- The `Wiki.Streams` package defines the interfaces used by -- the parser or renderer to read and write their outputs. -- -- The `Input_Stream` interface defines the interface that must be implemented to -- read the source Wiki content. The `Read` procedure is called by the parser -- repeatedly while scanning the Wiki content. -- -- The `Output_Stream` interface is the interface used by the renderer -- to write their outpus. It defines the `Write` procedure to write -- a single character or a string. -- -- @include wiki-streams-html.ads -- @include wiki-streams-builders.ads -- @include wiki-streams-html-builders.ads -- @include wiki-streams-text_io.ads -- @include wiki-streams-html-text_io.ads package Wiki.Streams is pragma Preelaborate; type Input_Stream is limited interface; type Input_Stream_Access is access all Input_Stream'Class; -- Read one character from the input stream and return False to the <tt>Eof</tt> indicator. -- When there is no character to read, return True in the <tt>Eof</tt> indicator. procedure Read (Input : in out Input_Stream; Char : out Wiki.Strings.WChar; Eof : out Boolean) is abstract; type Output_Stream is limited interface; type Output_Stream_Access is access all Output_Stream'Class; -- Write the string to the output stream. procedure Write (Stream : in out Output_Stream; Content : in Wiki.Strings.WString) is abstract; -- Write a single character to the output stream. procedure Write (Stream : in out Output_Stream; Char : in Wiki.Strings.WChar) is abstract; end Wiki.Streams;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C O D E -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1996-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. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Errout; use Errout; with Fname; use Fname; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Rtsfind; use Rtsfind; with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Stringt; use Stringt; with Tbuild; use Tbuild; package body Exp_Code is ----------------------- -- Local_Subprograms -- ----------------------- function Asm_Constraint (Operand_Var : Node_Id) return Node_Id; -- Common processing for Asm_Input_Constraint and Asm_Output_Constraint. -- Obtains the constraint argument from the global operand variable -- Operand_Var, which must be non-Empty. function Asm_Operand (Operand_Var : Node_Id) return Node_Id; -- Common processing for Asm_Input_Value and Asm_Output_Variable. Obtains -- the value/variable argument from Operand_Var, the global operand -- variable. Returns Empty if no operand available. function Get_String_Node (S : Node_Id) return Node_Id; -- Given S, a static expression node of type String, returns the -- string literal node. This is needed to deal with the use of constants -- for these expressions, which is perfectly permissible. procedure Next_Asm_Operand (Operand_Var : in out Node_Id); -- Common processing for Next_Asm_Input and Next_Asm_Output, updates -- the value of the global operand variable Operand_Var appropriately. procedure Setup_Asm_IO_Args (Arg : Node_Id; Operand_Var : out Node_Id); -- Common processing for Setup_Asm_Inputs and Setup_Asm_Outputs. Arg -- is the actual parameter from the call, and Operand_Var is the global -- operand variable to be initialized to the first operand. ---------------------- -- Global Variables -- ---------------------- Current_Input_Operand : Node_Id := Empty; -- Points to current Asm_Input_Operand attribute reference. Initialized -- by Setup_Asm_Inputs, updated by Next_Asm_Input, and referenced by -- Asm_Input_Constraint and Asm_Input_Value. Current_Output_Operand : Node_Id := Empty; -- Points to current Asm_Output_Operand attribute reference. Initialized -- by Setup_Asm_Outputs, updated by Next_Asm_Output, and referenced by -- Asm_Output_Constraint and Asm_Output_Variable. -------------------- -- Asm_Constraint -- -------------------- function Asm_Constraint (Operand_Var : Node_Id) return Node_Id is begin pragma Assert (Present (Operand_Var)); return Get_String_Node (First (Expressions (Operand_Var))); end Asm_Constraint; -------------------------- -- Asm_Input_Constraint -- -------------------------- -- Note: error checking on Asm_Input attribute done in Sem_Attr function Asm_Input_Constraint return Node_Id is begin return Get_String_Node (Asm_Constraint (Current_Input_Operand)); end Asm_Input_Constraint; --------------------- -- Asm_Input_Value -- --------------------- -- Note: error checking on Asm_Input attribute done in Sem_Attr function Asm_Input_Value return Node_Id is begin return Asm_Operand (Current_Input_Operand); end Asm_Input_Value; ----------------- -- Asm_Operand -- ----------------- function Asm_Operand (Operand_Var : Node_Id) return Node_Id is begin if No (Operand_Var) then return Empty; else return Next (First (Expressions (Operand_Var))); end if; end Asm_Operand; --------------------------- -- Asm_Output_Constraint -- --------------------------- -- Note: error checking on Asm_Output attribute done in Sem_Attr function Asm_Output_Constraint return Node_Id is begin return Asm_Constraint (Current_Output_Operand); end Asm_Output_Constraint; ------------------------- -- Asm_Output_Variable -- ------------------------- -- Note: error checking on Asm_Output attribute done in Sem_Attr function Asm_Output_Variable return Node_Id is begin return Asm_Operand (Current_Output_Operand); end Asm_Output_Variable; ------------------ -- Asm_Template -- ------------------ function Asm_Template (N : Node_Id) return Node_Id is Call : constant Node_Id := Expression (Expression (N)); Temp : constant Node_Id := First_Actual (Call); begin -- Require static expression for template. We also allow a string -- literal (this is useful for Ada 83 mode where string expressions -- are never static). if Is_OK_Static_Expression (Temp) or else (Ada_83 and then Nkind (Temp) = N_String_Literal) then return Get_String_Node (Temp); else Error_Msg_N ("asm template argument is not static", Temp); return Empty; end if; end Asm_Template; ---------------------- -- Clobber_Get_Next -- ---------------------- Clobber_Node : Node_Id; -- String literal node for clobber string. Initialized by Clobber_Setup, -- and not modified by Clobber_Get_Next. Empty if clobber string was in -- error (resulting in no clobber arguments being returned). Clobber_Ptr : Nat; -- Pointer to current character of string. Initialized to 1 by the call -- to Clobber_Setup, and then updated by Clobber_Get_Next. function Clobber_Get_Next return Address is Str : constant String_Id := Strval (Clobber_Node); Len : constant Nat := String_Length (Str); C : Character; begin if No (Clobber_Node) then return Null_Address; end if; -- Skip spaces and commas before next register name loop -- Return null string if no more names if Clobber_Ptr > Len then return Null_Address; end if; C := Get_Character (Get_String_Char (Str, Clobber_Ptr)); exit when C /= ',' and then C /= ' '; Clobber_Ptr := Clobber_Ptr + 1; end loop; -- Acquire next register name Name_Len := 0; loop Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := C; Clobber_Ptr := Clobber_Ptr + 1; exit when Clobber_Ptr > Len; C := Get_Character (Get_String_Char (Str, Clobber_Ptr)); exit when C = ',' or else C = ' '; end loop; Name_Buffer (Name_Len + 1) := ASCII.NUL; return Name_Buffer'Address; end Clobber_Get_Next; ------------------- -- Clobber_Setup -- ------------------- procedure Clobber_Setup (N : Node_Id) is Call : constant Node_Id := Expression (Expression (N)); Clob : constant Node_Id := Next_Actual ( Next_Actual ( Next_Actual ( First_Actual (Call)))); begin if not Is_OK_Static_Expression (Clob) then Error_Msg_N ("asm clobber argument is not static", Clob); Clobber_Node := Empty; else Clobber_Node := Get_String_Node (Clob); Clobber_Ptr := 1; end if; end Clobber_Setup; --------------------- -- Expand_Asm_Call -- --------------------- procedure Expand_Asm_Call (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); procedure Check_IO_Operand (N : Node_Id); -- Check for incorrect input or output operand procedure Check_IO_Operand (N : Node_Id) is Err : Node_Id := N; begin -- The only identifier allows is No_xxput_Operands. Since we -- know the type is right, it is sufficient to see if the -- referenced entity is in a runtime routine. if Nkind (N) = N_Identifier and then Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Entity (N)))) then return; -- An attribute reference is fine, again the analysis reasonably -- guarantees that the attribute must be subtype'Asm_??put. elsif Nkind (N) = N_Attribute_Reference then return; -- The only other allowed form is an array aggregate in which -- all the entries are positional and are attribute references. elsif Nkind (N) = N_Aggregate then if Present (Component_Associations (N)) then Err := First (Component_Associations (N)); elsif Present (Expressions (N)) then Err := First (Expressions (N)); while Present (Err) loop exit when Nkind (Err) /= N_Attribute_Reference; Next (Err); end loop; if No (Err) then return; end if; end if; end if; -- If we fall through, Err is pointing to the bad node Error_Msg_N ("Asm operand has wrong form", Err); end Check_IO_Operand; -- Start of processing for Expand_Asm_Call begin -- Check that the input and output operands have the right -- form, as required by the documentation of the Asm feature: -- OUTPUT_OPERAND_LIST ::= -- No_Output_Operands -- | OUTPUT_OPERAND_ATTRIBUTE -- | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@}) -- OUTPUT_OPERAND_ATTRIBUTE ::= -- SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME) -- INPUT_OPERAND_LIST ::= -- No_Input_Operands -- | INPUT_OPERAND_ATTRIBUTE -- | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@}) -- INPUT_OPERAND_ATTRIBUTE ::= -- SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION) declare Arg_Output : constant Node_Id := Next_Actual (First_Actual (N)); Arg_Input : constant Node_Id := Next_Actual (Arg_Output); begin Check_IO_Operand (Arg_Output); Check_IO_Operand (Arg_Input); end; -- If we have the function call case, we are inside a code statement, -- and the tree is already in the necessary form for gigi. if Nkind (N) = N_Function_Call then null; -- For the procedure case, we convert the call into a code statement else pragma Assert (Nkind (N) = N_Procedure_Call_Statement); -- Note: strictly we should change the procedure call to a function -- call in the qualified expression, but since we are not going to -- reanalyze (see below), and the interface subprograms in this -- package don't care, we can leave it as a procedure call. Rewrite (N, Make_Code_Statement (Loc, Expression => Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Asm_Insn), Loc), Expression => Relocate_Node (N)))); -- There is no need to reanalyze this node, it is completely analyzed -- already, at least sufficiently for the purposes of the abstract -- procedural interface defined in this package. Set_Analyzed (N); end if; end Expand_Asm_Call; --------------------- -- Get_String_Node -- --------------------- function Get_String_Node (S : Node_Id) return Node_Id is begin if Nkind (S) = N_String_Literal then return S; else pragma Assert (Ekind (Entity (S)) = E_Constant); return Get_String_Node (Constant_Value (Entity (S))); end if; end Get_String_Node; --------------------- -- Is_Asm_Volatile -- --------------------- function Is_Asm_Volatile (N : Node_Id) return Boolean is Call : constant Node_Id := Expression (Expression (N)); Vol : constant Node_Id := Next_Actual ( Next_Actual ( Next_Actual ( Next_Actual ( First_Actual (Call))))); begin if not Is_OK_Static_Expression (Vol) then Error_Msg_N ("asm volatile argument is not static", Vol); return False; else return Is_True (Expr_Value (Vol)); end if; end Is_Asm_Volatile; -------------------- -- Next_Asm_Input -- -------------------- procedure Next_Asm_Input is begin Next_Asm_Operand (Current_Input_Operand); end Next_Asm_Input; ---------------------- -- Next_Asm_Operand -- ---------------------- procedure Next_Asm_Operand (Operand_Var : in out Node_Id) is begin pragma Assert (Present (Operand_Var)); if Nkind (Parent (Operand_Var)) = N_Aggregate then Operand_Var := Next (Operand_Var); else Operand_Var := Empty; end if; end Next_Asm_Operand; --------------------- -- Next_Asm_Output -- --------------------- procedure Next_Asm_Output is begin Next_Asm_Operand (Current_Output_Operand); end Next_Asm_Output; ---------------------- -- Setup_Asm_Inputs -- ---------------------- procedure Setup_Asm_Inputs (N : Node_Id) is Call : constant Node_Id := Expression (Expression (N)); begin Setup_Asm_IO_Args (Next_Actual (Next_Actual (First_Actual (Call))), Current_Input_Operand); end Setup_Asm_Inputs; ----------------------- -- Setup_Asm_IO_Args -- ----------------------- procedure Setup_Asm_IO_Args (Arg : Node_Id; Operand_Var : out Node_Id) is begin -- Case of single argument if Nkind (Arg) = N_Attribute_Reference then Operand_Var := Arg; -- Case of list of arguments elsif Nkind (Arg) = N_Aggregate then if Expressions (Arg) = No_List then Operand_Var := Empty; else Operand_Var := First (Expressions (Arg)); end if; -- Otherwise must be default (no operands) case else Operand_Var := Empty; end if; end Setup_Asm_IO_Args; ----------------------- -- Setup_Asm_Outputs -- ----------------------- procedure Setup_Asm_Outputs (N : Node_Id) is Call : constant Node_Id := Expression (Expression (N)); begin Setup_Asm_IO_Args (Next_Actual (First_Actual (Call)), Current_Output_Operand); end Setup_Asm_Outputs; end Exp_Code;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- R I D E N T -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- 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 set of restriction identifiers. It is in a -- separate package from Restrict so that it can be easily used by the -- binder without dragging in a lot of stuff. package Rident is -- The following enumeration type defines the set of restriction -- identifiers not taking a parameter that are implemented in GNAT. -- To add a new restriction identifier, add an entry with the name -- to be used in the pragma, and add appropriate calls to the -- Check_Restriction routine. type Restriction_Id is ( -- The following cases are checked for consistency in the binder Boolean_Entry_Barriers, -- GNAT (Ravenscar) No_Abort_Statements, -- (RM D.7(5), H.4(3)) No_Access_Subprograms, -- (RM H.4(17)) No_Allocators, -- (RM H.4(7)) No_Asynchronous_Control, -- (RM D.9(10)) No_Calendar, -- GNAT No_Delay, -- (RM H.4(21)) No_Dispatch, -- (RM H.4(19)) No_Dynamic_Interrupts, -- GNAT No_Dynamic_Priorities, -- (RM D.9(9)) No_Enumeration_Maps, -- GNAT No_Entry_Calls_In_Elaboration_Code, -- GNAT No_Entry_Queue, -- GNAT No_Exception_Handlers, -- GNAT No_Exceptions, -- (RM H.4(12)) No_Fixed_Point, -- (RM H.4(15)) No_Floating_Point, -- (RM H.4(14)) No_IO, -- (RM H.4(20)) No_Implicit_Conditionals, -- GNAT No_Implicit_Dynamic_Code, -- GNAT No_Implicit_Heap_Allocations, -- (RM D.8(8), H.4(3)) No_Implicit_Loops, -- GNAT No_Local_Allocators, -- (RM H.4(8)) No_Local_Protected_Objects, -- GNAT No_Nested_Finalization, -- (RM D.7(4)) No_Protected_Type_Allocators, -- GNAT No_Protected_Types, -- (RM H.4(5)) No_Recursion, -- (RM H.4(22)) No_Reentrancy, -- (RM H.4(23)) No_Relative_Delay, -- GNAT No_Requeue, -- GNAT No_Secondary_Stack, -- GNAT No_Select_Statements, -- GNAT (Ravenscar) No_Standard_Storage_Pools, -- GNAT No_Streams, -- GNAT No_Task_Allocators, -- (RM D.7(7)) No_Task_Attributes, -- GNAT No_Task_Hierarchy, -- (RM D.7(3), H.4(3)) No_Task_Termination, -- GNAT No_Terminate_Alternatives, -- (RM D.7(6)) No_Unchecked_Access, -- (RM H.4(18)) No_Unchecked_Conversion, -- (RM H.4(16)) No_Unchecked_Deallocation, -- (RM H.4(9)) No_Wide_Characters, -- GNAT Static_Priorities, -- GNAT Static_Storage_Size, -- GNAT -- The following cases do not require partition-wide checks Immediate_Reclamation, -- (RM H.4(10)) No_Implementation_Attributes, -- GNAT No_Implementation_Pragmas, -- GNAT No_Implementation_Restrictions, -- GNAT No_Elaboration_Code, -- GNAT Not_A_Restriction_Id); -- The following range of Restriction identifiers is checked for -- consistency across a partition. The generated ali file is marked -- for each entry to show one of three possibilities: -- -- Corresponding restriction is set (so unit does not violate it) -- Corresponding restriction is not violated -- Corresponding restriction is violated subtype Partition_Restrictions is Restriction_Id range Boolean_Entry_Barriers .. Static_Storage_Size; -- The following set of Restriction identifiers is not checked for -- consistency across a partition, and the generated ali files does -- not carry any indications with respect to such restrictions. subtype Compilation_Unit_Restrictions is Restriction_Id range Immediate_Reclamation .. No_Elaboration_Code; -- The following enumeration type defines the set of restriction -- parameter identifiers taking a parameter that are implemented in -- GNAT. To add a new restriction parameter identifier, add an entry -- with the name to be used in the pragma, and add appropriate -- calls to Check_Restriction. -- Note: the GNAT implementation currently only accomodates restriction -- parameter identifiers whose expression value is a non-negative -- integer. This is true for all language defined parameters. type Restriction_Parameter_Id is ( Max_Asynchronous_Select_Nesting, -- (RM D.7(18), H.4(3)) Max_Entry_Queue_Depth, -- GNAT Max_Protected_Entries, -- (RM D.7(14)) Max_Select_Alternatives, -- (RM D.7(12)) Max_Storage_At_Blocking, -- (RM D.7(17)) Max_Task_Entries, -- (RM D.7(13), H.4(3)) Max_Tasks, -- (RM D.7(19), H.4(3)) Not_A_Restriction_Parameter_Id); end Rident;