content
stringlengths
23
1.05M
-- { dg-do compile } -- { dg-options "-gnatws" } with System.Machine_Code; use System.Machine_Code; procedure machine_code1 is A_Float : Float; An_Other_Float : Float := -99999.0; begin An_Other_Float := An_Other_Float - A_Float; Asm("", Inputs => (Float'Asm_Input ("m", A_Float))); end;
with AdaBase; with Connect; with Ada.Text_IO; with AdaBase.Results.Sets; procedure Stored_Procs is package CON renames Connect; package TIO renames Ada.Text_IO; package ARS renames AdaBase.Results.Sets; stmt_acc : CON.Stmt_Type_access; procedure dump_result; procedure dump_result is function pad (S : String) return String; function pad (S : String) return String is field : String (1 .. 15) := (others => ' '); len : Natural := S'Length; begin field (1 .. len) := S; return field; end pad; row : ARS.Datarow; numcols : constant Natural := stmt_acc.column_count; begin for c in Natural range 1 .. numcols loop TIO.Put (pad (stmt_acc.column_name (c))); end loop; TIO.Put_Line (""); for c in Natural range 1 .. numcols loop TIO.Put ("============== "); end loop; TIO.Put_Line (""); loop row := stmt_acc.fetch_next; exit when row.data_exhausted; for c in Natural range 1 .. numcols loop TIO.Put (pad (row.column (c).as_string)); end loop; TIO.Put_Line (""); end loop; TIO.Put_Line (""); end dump_result; set_fetched : Boolean; set_present : Boolean; begin CON.connect_database; declare stmt : aliased CON.Stmt_Type := CON.DR.call_stored_procedure ("multiple_rowsets", ""); begin set_fetched := stmt.successful; stmt_acc := stmt'Unchecked_Access; loop if set_fetched then dump_result; end if; stmt.fetch_next_set (set_present, set_fetched); exit when not set_present; end loop; end; CON.DR.disconnect; end Stored_Procs;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-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. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; with Namet; use Namet; with Output; use Output; with Osint; use Osint; with Prj.Attr; with Prj.Env; with Prj.Err; use Prj.Err; with Snames; use Snames; with Uintp; use Uintp; with GNAT.Case_Util; use GNAT.Case_Util; package body Prj is Initial_Buffer_Size : constant := 100; -- Initial size for extensible buffer used in Add_To_Buffer The_Empty_String : Name_Id; Name_C_Plus_Plus : Name_Id; Default_Ada_Spec_Suffix_Id : Name_Id; Default_Ada_Body_Suffix_Id : Name_Id; Slash_Id : Name_Id; -- Initialized in Prj.Initialized, then never modified subtype Known_Casing is Casing_Type range All_Upper_Case .. Mixed_Case; The_Casing_Images : constant array (Known_Casing) of String_Access := (All_Lower_Case => new String'("lowercase"), All_Upper_Case => new String'("UPPERCASE"), Mixed_Case => new String'("MixedCase")); Initialized : Boolean := False; Standard_Dot_Replacement : constant Name_Id := First_Name_Id + Character'Pos ('-'); Std_Naming_Data : Naming_Data := (Dot_Replacement => Standard_Dot_Replacement, Dot_Repl_Loc => No_Location, Casing => All_Lower_Case, Spec_Suffix => No_Array_Element, Ada_Spec_Suffix => No_Name, Spec_Suffix_Loc => No_Location, Impl_Suffixes => No_Impl_Suffixes, Supp_Suffixes => No_Supp_Language_Index, Body_Suffix => No_Array_Element, Ada_Body_Suffix => No_Name, Body_Suffix_Loc => No_Location, Separate_Suffix => No_Name, Sep_Suffix_Loc => No_Location, Specs => No_Array_Element, Bodies => No_Array_Element, Specification_Exceptions => No_Array_Element, Implementation_Exceptions => No_Array_Element); Project_Empty : Project_Data := (Externally_Built => False, Languages => No_Languages, Supp_Languages => No_Supp_Language_Index, First_Referred_By => No_Project, Name => No_Name, Display_Name => No_Name, Path_Name => No_Name, Display_Path_Name => No_Name, Virtual => False, Location => No_Location, Mains => Nil_String, Directory => No_Name, Display_Directory => No_Name, Dir_Path => null, Library => False, Library_Dir => No_Name, Display_Library_Dir => No_Name, Library_Src_Dir => No_Name, Display_Library_Src_Dir => No_Name, Library_ALI_Dir => No_Name, Display_Library_ALI_Dir => No_Name, Library_Name => No_Name, Library_Kind => Static, Lib_Internal_Name => No_Name, Standalone_Library => False, Lib_Interface_ALIs => Nil_String, Lib_Auto_Init => False, Symbol_Data => No_Symbols, Ada_Sources_Present => True, Other_Sources_Present => True, Sources => Nil_String, First_Other_Source => No_Other_Source, Last_Other_Source => No_Other_Source, Imported_Directories_Switches => null, Include_Path => null, Include_Data_Set => False, Source_Dirs => Nil_String, Known_Order_Of_Source_Dirs => True, Object_Directory => No_Name, Display_Object_Dir => No_Name, Library_TS => Empty_Time_Stamp, Exec_Directory => No_Name, Display_Exec_Dir => No_Name, Extends => No_Project, Extended_By => No_Project, Naming => Std_Naming_Data, First_Language_Processing => Default_First_Language_Processing_Data, Supp_Language_Processing => No_Supp_Language_Index, Default_Linker => No_Name, Default_Linker_Path => No_Name, Decl => No_Declarations, Imported_Projects => Empty_Project_List, All_Imported_Projects => Empty_Project_List, Ada_Include_Path => null, Ada_Objects_Path => null, Include_Path_File => No_Name, Objects_Path_File_With_Libs => No_Name, Objects_Path_File_Without_Libs => No_Name, Config_File_Name => No_Name, Config_File_Temp => False, Config_Checked => False, Language_Independent_Checked => False, Checked => False, Seen => False, Need_To_Build_Lib => False, Depth => 0, Unkept_Comments => False); ----------------------- -- Add_Language_Name -- ----------------------- procedure Add_Language_Name (Name : Name_Id) is begin Last_Language_Index := Last_Language_Index + 1; Language_Indexes.Set (Name, Last_Language_Index); Language_Names.Increment_Last; Language_Names.Table (Last_Language_Index) := Name; end Add_Language_Name; ------------------- -- Add_To_Buffer -- ------------------- procedure Add_To_Buffer (S : String; To : in out String_Access; Last : in out Natural) is begin if To = null then To := new String (1 .. Initial_Buffer_Size); Last := 0; end if; -- If Buffer is too small, double its size while Last + S'Length > To'Last loop declare New_Buffer : constant String_Access := new String (1 .. 2 * Last); begin New_Buffer (1 .. Last) := To (1 .. Last); Free (To); To := New_Buffer; end; end loop; To (Last + 1 .. Last + S'Length) := S; Last := Last + S'Length; end Add_To_Buffer; ----------------------------- -- Default_Ada_Body_Suffix -- ----------------------------- function Default_Ada_Body_Suffix return Name_Id is begin return Default_Ada_Body_Suffix_Id; end Default_Ada_Body_Suffix; ----------------------------- -- Default_Ada_Spec_Suffix -- ----------------------------- function Default_Ada_Spec_Suffix return Name_Id is begin return Default_Ada_Spec_Suffix_Id; end Default_Ada_Spec_Suffix; --------------------------- -- Display_Language_Name -- --------------------------- procedure Display_Language_Name (Language : Language_Index) is begin Get_Name_String (Language_Names.Table (Language)); To_Upper (Name_Buffer (1 .. 1)); Write_Str (Name_Buffer (1 .. Name_Len)); end Display_Language_Name; ------------------- -- Empty_Project -- ------------------- function Empty_Project (Tree : Project_Tree_Ref) return Project_Data is Value : Project_Data; begin Prj.Initialize (Tree => No_Project_Tree); Value := Project_Empty; Value.Naming := Tree.Private_Part.Default_Naming; return Value; end Empty_Project; ------------------ -- Empty_String -- ------------------ function Empty_String return Name_Id is begin return The_Empty_String; end Empty_String; ------------ -- Expect -- ------------ procedure Expect (The_Token : Token_Type; Token_Image : String) is begin if Token /= The_Token then Error_Msg (Token_Image & " expected", Token_Ptr); end if; end Expect; -------------------------------- -- For_Every_Project_Imported -- -------------------------------- procedure For_Every_Project_Imported (By : Project_Id; In_Tree : Project_Tree_Ref; With_State : in out State) is procedure Recursive_Check (Project : Project_Id); -- Check if a project has already been seen. If not seen, mark it as -- Seen, Call Action, and check all its imported projects. --------------------- -- Recursive_Check -- --------------------- procedure Recursive_Check (Project : Project_Id) is List : Project_List; begin if not In_Tree.Projects.Table (Project).Seen then In_Tree.Projects.Table (Project).Seen := True; Action (Project, With_State); List := In_Tree.Projects.Table (Project).Imported_Projects; while List /= Empty_Project_List loop Recursive_Check (In_Tree.Project_Lists.Table (List).Project); List := In_Tree.Project_Lists.Table (List).Next; end loop; end if; end Recursive_Check; -- Start of processing for For_Every_Project_Imported begin for Project in Project_Table.First .. Project_Table.Last (In_Tree.Projects) loop In_Tree.Projects.Table (Project).Seen := False; end loop; Recursive_Check (Project => By); end For_Every_Project_Imported; ---------- -- Hash -- ---------- function Hash (Name : Name_Id) return Header_Num is begin return Hash (Get_Name_String (Name)); end Hash; ----------- -- Image -- ----------- function Image (Casing : Casing_Type) return String is begin return The_Casing_Images (Casing).all; end Image; ---------------- -- Initialize -- ---------------- procedure Initialize (Tree : Project_Tree_Ref) is begin if not Initialized then Initialized := True; Uintp.Initialize; Name_Len := 0; The_Empty_String := Name_Find; Empty_Name := The_Empty_String; Name_Len := 4; Name_Buffer (1 .. 4) := ".ads"; Default_Ada_Spec_Suffix_Id := Name_Find; Name_Len := 4; Name_Buffer (1 .. 4) := ".adb"; Default_Ada_Body_Suffix_Id := Name_Find; Name_Len := 1; Name_Buffer (1) := '/'; Slash_Id := Name_Find; Name_Len := 3; Name_Buffer (1 .. 3) := "c++"; Name_C_Plus_Plus := Name_Find; Std_Naming_Data.Ada_Spec_Suffix := Default_Ada_Spec_Suffix; Std_Naming_Data.Ada_Body_Suffix := Default_Ada_Body_Suffix; Std_Naming_Data.Separate_Suffix := Default_Ada_Body_Suffix; Project_Empty.Naming := Std_Naming_Data; Prj.Env.Initialize; Prj.Attr.Initialize; Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project)); Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends)); Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External)); Language_Indexes.Reset; Last_Language_Index := No_Language_Index; Language_Names.Init; Add_Language_Name (Name_Ada); Add_Language_Name (Name_C); Add_Language_Name (Name_C_Plus_Plus); end if; if Tree /= No_Project_Tree then Reset (Tree); end if; end Initialize; ---------------- -- Is_Present -- ---------------- function Is_Present (Language : Language_Index; In_Project : Project_Data; In_Tree : Project_Tree_Ref) return Boolean is begin case Language is when No_Language_Index => return False; when First_Language_Indexes => return In_Project.Languages (Language); when others => declare Supp : Supp_Language; Supp_Index : Supp_Language_Index := In_Project.Supp_Languages; begin while Supp_Index /= No_Supp_Language_Index loop Supp := In_Tree.Present_Languages.Table (Supp_Index); if Supp.Index = Language then return Supp.Present; end if; Supp_Index := Supp.Next; end loop; return False; end; end case; end Is_Present; --------------------------------- -- Language_Processing_Data_Of -- --------------------------------- function Language_Processing_Data_Of (Language : Language_Index; In_Project : Project_Data; In_Tree : Project_Tree_Ref) return Language_Processing_Data is begin case Language is when No_Language_Index => return Default_Language_Processing_Data; when First_Language_Indexes => return In_Project.First_Language_Processing (Language); when others => declare Supp : Supp_Language_Data; Supp_Index : Supp_Language_Index := In_Project.Supp_Language_Processing; begin while Supp_Index /= No_Supp_Language_Index loop Supp := In_Tree.Supp_Languages.Table (Supp_Index); if Supp.Index = Language then return Supp.Data; end if; Supp_Index := Supp.Next; end loop; return Default_Language_Processing_Data; end; end case; end Language_Processing_Data_Of; ------------------------------------ -- Register_Default_Naming_Scheme -- ------------------------------------ procedure Register_Default_Naming_Scheme (Language : Name_Id; Default_Spec_Suffix : Name_Id; Default_Body_Suffix : Name_Id; In_Tree : Project_Tree_Ref) is Lang : Name_Id; Suffix : Array_Element_Id; Found : Boolean := False; Element : Array_Element; begin -- Get the language name in small letters Get_Name_String (Language); Name_Buffer (1 .. Name_Len) := To_Lower (Name_Buffer (1 .. Name_Len)); Lang := Name_Find; Suffix := In_Tree.Private_Part.Default_Naming.Spec_Suffix; Found := False; -- Look for an element of the spec sufix array indexed by the language -- name. If one is found, put the default value. while Suffix /= No_Array_Element and then not Found loop Element := In_Tree.Array_Elements.Table (Suffix); if Element.Index = Lang then Found := True; Element.Value.Value := Default_Spec_Suffix; In_Tree.Array_Elements.Table (Suffix) := Element; else Suffix := Element.Next; end if; end loop; -- If none can be found, create a new one if not Found then Element := (Index => Lang, Src_Index => 0, Index_Case_Sensitive => False, Value => (Project => No_Project, Kind => Single, Location => No_Location, Default => False, Value => Default_Spec_Suffix, Index => 0), Next => In_Tree.Private_Part.Default_Naming.Spec_Suffix); Array_Element_Table.Increment_Last (In_Tree.Array_Elements); In_Tree.Array_Elements.Table (Array_Element_Table.Last (In_Tree.Array_Elements)) := Element; In_Tree.Private_Part.Default_Naming.Spec_Suffix := Array_Element_Table.Last (In_Tree.Array_Elements); end if; Suffix := In_Tree.Private_Part.Default_Naming.Body_Suffix; Found := False; -- Look for an element of the body sufix array indexed by the language -- name. If one is found, put the default value. while Suffix /= No_Array_Element and then not Found loop Element := In_Tree.Array_Elements.Table (Suffix); if Element.Index = Lang then Found := True; Element.Value.Value := Default_Body_Suffix; In_Tree.Array_Elements.Table (Suffix) := Element; else Suffix := Element.Next; end if; end loop; -- If none can be found, create a new one if not Found then Element := (Index => Lang, Src_Index => 0, Index_Case_Sensitive => False, Value => (Project => No_Project, Kind => Single, Location => No_Location, Default => False, Value => Default_Body_Suffix, Index => 0), Next => In_Tree.Private_Part.Default_Naming.Body_Suffix); Array_Element_Table.Increment_Last (In_Tree.Array_Elements); In_Tree.Array_Elements.Table (Array_Element_Table.Last (In_Tree.Array_Elements)) := Element; In_Tree.Private_Part.Default_Naming.Body_Suffix := Array_Element_Table.Last (In_Tree.Array_Elements); end if; end Register_Default_Naming_Scheme; ----------- -- Reset -- ----------- procedure Reset (Tree : Project_Tree_Ref) is begin Prj.Env.Initialize; Present_Language_Table.Init (Tree.Present_Languages); Supp_Suffix_Table.Init (Tree.Supp_Suffixes); Name_List_Table.Init (Tree.Name_Lists); Supp_Language_Table.Init (Tree.Supp_Languages); Other_Source_Table.Init (Tree.Other_Sources); String_Element_Table.Init (Tree.String_Elements); Variable_Element_Table.Init (Tree.Variable_Elements); Array_Element_Table.Init (Tree.Array_Elements); Array_Table.Init (Tree.Arrays); Package_Table.Init (Tree.Packages); Project_List_Table.Init (Tree.Project_Lists); Project_Table.Init (Tree.Projects); Unit_Table.Init (Tree.Units); Units_Htable.Reset (Tree.Units_HT); Files_Htable.Reset (Tree.Files_HT); Naming_Table.Init (Tree.Private_Part.Namings); Naming_Table.Increment_Last (Tree.Private_Part.Namings); Tree.Private_Part.Namings.Table (Naming_Table.Last (Tree.Private_Part.Namings)) := Std_Naming_Data; Path_File_Table.Init (Tree.Private_Part.Path_Files); Source_Path_Table.Init (Tree.Private_Part.Source_Paths); Object_Path_Table.Init (Tree.Private_Part.Object_Paths); Tree.Private_Part.Default_Naming := Std_Naming_Data; Register_Default_Naming_Scheme (Language => Name_Ada, Default_Spec_Suffix => Default_Ada_Spec_Suffix, Default_Body_Suffix => Default_Ada_Body_Suffix, In_Tree => Tree); end Reset; ------------------------ -- Same_Naming_Scheme -- ------------------------ function Same_Naming_Scheme (Left, Right : Naming_Data) return Boolean is begin return Left.Dot_Replacement = Right.Dot_Replacement and then Left.Casing = Right.Casing and then Left.Ada_Spec_Suffix = Right.Ada_Spec_Suffix and then Left.Ada_Body_Suffix = Right.Ada_Body_Suffix and then Left.Separate_Suffix = Right.Separate_Suffix; end Same_Naming_Scheme; --------- -- Set -- --------- procedure Set (Language : Language_Index; Present : Boolean; In_Project : in out Project_Data; In_Tree : Project_Tree_Ref) is begin case Language is when No_Language_Index => null; when First_Language_Indexes => In_Project.Languages (Language) := Present; when others => declare Supp : Supp_Language; Supp_Index : Supp_Language_Index := In_Project.Supp_Languages; begin while Supp_Index /= No_Supp_Language_Index loop Supp := In_Tree.Present_Languages.Table (Supp_Index); if Supp.Index = Language then In_Tree.Present_Languages.Table (Supp_Index).Present := Present; return; end if; Supp_Index := Supp.Next; end loop; Supp := (Index => Language, Present => Present, Next => In_Project.Supp_Languages); Present_Language_Table.Increment_Last (In_Tree.Present_Languages); Supp_Index := Present_Language_Table.Last (In_Tree.Present_Languages); In_Tree.Present_Languages.Table (Supp_Index) := Supp; In_Project.Supp_Languages := Supp_Index; end; end case; end Set; procedure Set (Language_Processing : Language_Processing_Data; For_Language : Language_Index; In_Project : in out Project_Data; In_Tree : Project_Tree_Ref) is begin case For_Language is when No_Language_Index => null; when First_Language_Indexes => In_Project.First_Language_Processing (For_Language) := Language_Processing; when others => declare Supp : Supp_Language_Data; Supp_Index : Supp_Language_Index := In_Project.Supp_Language_Processing; begin while Supp_Index /= No_Supp_Language_Index loop Supp := In_Tree.Supp_Languages.Table (Supp_Index); if Supp.Index = For_Language then In_Tree.Supp_Languages.Table (Supp_Index).Data := Language_Processing; return; end if; Supp_Index := Supp.Next; end loop; Supp := (Index => For_Language, Data => Language_Processing, Next => In_Project.Supp_Language_Processing); Supp_Language_Table.Increment_Last (In_Tree.Supp_Languages); Supp_Index := Supp_Language_Table.Last (In_Tree.Supp_Languages); In_Tree.Supp_Languages.Table (Supp_Index) := Supp; In_Project.Supp_Language_Processing := Supp_Index; end; end case; end Set; procedure Set (Suffix : Name_Id; For_Language : Language_Index; In_Project : in out Project_Data; In_Tree : Project_Tree_Ref) is begin case For_Language is when No_Language_Index => null; when First_Language_Indexes => In_Project.Naming.Impl_Suffixes (For_Language) := Suffix; when others => declare Supp : Supp_Suffix; Supp_Index : Supp_Language_Index := In_Project.Naming.Supp_Suffixes; begin while Supp_Index /= No_Supp_Language_Index loop Supp := In_Tree.Supp_Suffixes.Table (Supp_Index); if Supp.Index = For_Language then In_Tree.Supp_Suffixes.Table (Supp_Index).Suffix := Suffix; return; end if; Supp_Index := Supp.Next; end loop; Supp := (Index => For_Language, Suffix => Suffix, Next => In_Project.Naming.Supp_Suffixes); Supp_Suffix_Table.Increment_Last (In_Tree.Supp_Suffixes); Supp_Index := Supp_Suffix_Table.Last (In_Tree.Supp_Suffixes); In_Tree.Supp_Suffixes.Table (Supp_Index) := Supp; In_Project.Naming.Supp_Suffixes := Supp_Index; end; end case; end Set; ----------- -- Slash -- ----------- function Slash return Name_Id is begin return Slash_Id; end Slash; -------------------------- -- Standard_Naming_Data -- -------------------------- function Standard_Naming_Data (Tree : Project_Tree_Ref := No_Project_Tree) return Naming_Data is begin if Tree = No_Project_Tree then Prj.Initialize (Tree => No_Project_Tree); return Std_Naming_Data; else return Tree.Private_Part.Default_Naming; end if; end Standard_Naming_Data; --------------- -- Suffix_Of -- --------------- function Suffix_Of (Language : Language_Index; In_Project : Project_Data; In_Tree : Project_Tree_Ref) return Name_Id is begin case Language is when No_Language_Index => return No_Name; when First_Language_Indexes => return In_Project.Naming.Impl_Suffixes (Language); when others => declare Supp : Supp_Suffix; Supp_Index : Supp_Language_Index := In_Project.Naming.Supp_Suffixes; begin while Supp_Index /= No_Supp_Language_Index loop Supp := In_Tree.Supp_Suffixes.Table (Supp_Index); if Supp.Index = Language then return Supp.Suffix; end if; Supp_Index := Supp.Next; end loop; return No_Name; end; end case; end Suffix_Of; ----------- -- Value -- ----------- function Value (Image : String) return Casing_Type is begin for Casing in The_Casing_Images'Range loop if To_Lower (Image) = To_Lower (The_Casing_Images (Casing).all) then return Casing; end if; end loop; raise Constraint_Error; end Value; begin -- Make sure that the standard project file extension is compatible -- with canonical case file naming. Canonical_Case_File_Name (Project_File_Extension); end Prj;
procedure Div ( Dividend : in out Long_Number; Last : in out Natural; Remainder : out Unsigned_32; Divisor : Unsigned_32 ) is Div : constant Unsigned_64 := Unsigned_64 (Divisor); Accum : Unsigned_64 := 0; Size : Natural := 0; begin for Index in reverse Dividend'First..Last loop Accum := Accum * 2**32 + Unsigned_64 (Dividend (Index)); Dividend (Index) := Unsigned_32 (Accum / Div); if Size = 0 and then Dividend (Index) /= 0 then Size := Index; end if; Accum := Accum mod Div; end loop; Remainder := Unsigned_32 (Accum); Last := Size; end Div;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; with Vecteurs_Creux; use Vecteurs_Creux; -- Exemple d'utilisation des vecteurs creux. procedure Exemple_Vecteurs_Creux is V : T_Vecteur_Creux; Epsilon: constant Float := 1.0e-5; begin Put_Line ("Début du scénario"); -- Initialiser V ne marchera pas car on n'a encore modifié Est_Nul. Initialiser(V); Afficher(V); New_Line; pragma Assert(Est_Nul(V) = True); Detruire(V); pragma Assert(Composante_Recursif(V, 18) = 0.0); pragma Assert(Composante_Iteratif(V, 18) = 0.0); Modifier(V, 18, 1.0); Modifier(V, 2, 3.0); Modifier(V, 5, 11.0); Afficher(V); pragma Assert(Composante_Recursif(V, 18) = 1.0); pragma Assert(Composante_Iteratif(V, 2) = 3.0); Put_Line ("Fin du scénario"); end Exemple_Vecteurs_Creux;
with Ada.Text_IO; with Dotenv; package body Load_Environment_Variables is begin Ada.Text_IO.Put_Line ("Load Environment Variables"); Dotenv.Config; end Load_Environment_Variables;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P A R -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. 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. -- -- -- ------------------------------------------------------------------------------ -- The Par function and its subunits contains all the parsing routines -- for the top down recursive descent parser that constructs the parse tree with Types; use Types; function Par (Configuration_Pragmas : Boolean) return List_Id; -- Top level parsing routine. There are two cases: -- -- If Configuration_Pragmas is False, Par parses a compilation unit in the -- current source file and sets the Cunit, Cunit_Entity and Unit_Name fields -- of the units table entry for Current_Source_Unit. On return the parse tree -- is complete, and decorated with any required implicit label declarations. -- The value returned in this case is always No_List. -- -- If Configuration_Pragmas is True, Par parses a list of configuration -- pragmas from the current source file, and returns the list of pragmas.
with AUnit.Run; with AUnit.Reporter.Text; with GStreamer.tests.Rtsp_Suit; procedure Gstreamer.Tests.Main is Reporter : AUnit.Reporter.Text.Text_Reporter; procedure run_Tests is new AUnit.Run.Test_Runner(GStreamer.tests.Rtsp_Suit.Suit); begin Run_Tests (Reporter); end;
----------------------------------------------------------------------- -- wiki-filters-collectors -- Wiki word and link collectors -- Copyright (C) 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. ----------------------------------------------------------------------- package body Wiki.Filters.Collectors is procedure Add_String (Into : in out WString_Maps.Map; Item : in Wiki.Strings.WString); procedure Add_String (Into : in out WString_Maps.Map; Item : in Wiki.Strings.WString) is procedure Increment (Key : in Wiki.Strings.WString; Value : in out Natural); procedure Increment (Key : in Wiki.Strings.WString; Value : in out Natural) is pragma Unreferenced (Key); begin Value := Value + 1; end Increment; Pos : constant WString_Maps.Cursor := Into.Find (Item); begin if WString_Maps.Has_Element (Pos) then Into.Update_Element (Pos, Increment'Access); else Into.Insert (Item, 1); end if; end Add_String; function Find (Map : in Collector_Type; Item : in Wiki.Strings.WString) return Cursor is begin return Map.Items.Find (Item); end Find; function Contains (Map : in Collector_Type; Item : in Wiki.Strings.WString) return Boolean is begin return Map.Items.Contains (Item); end Contains; procedure Iterate (Map : in Collector_Type; Process : not null access procedure (Pos : in Cursor)) is begin Map.Items.Iterate (Process); end Iterate; procedure Collect_Attribute (Filter : in out Collector_Type; Attributes : in Wiki.Attributes.Attribute_List; Name : in String) is Value : constant Wiki.Strings.WString := Wiki.Attributes.Get_Attribute (Attributes, Name); begin if Value'Length > 0 then Add_String (Filter.Items, Value); end if; end Collect_Attribute; -- ------------------------------ -- Word Collector type -- ------------------------------ procedure Collect_Words (Filter : in out Word_Collector_Type; Content : in Wiki.Strings.WString) is Pos : Natural := Content'First; Start : Natural := Content'First; C : Wiki.Strings.WChar; begin while Pos <= Content'Last loop C := Content (Pos); if Wiki.Strings.Is_Alphanumeric (C) then null; else if Start + 1 < Pos - 1 then Add_String (Filter.Items, Content (Start .. Pos - 1)); end if; Start := Pos + 1; end if; Pos := Pos + 1; end loop; if Start < Content'Last then Add_String (Filter.Items, Content (Start .. Content'Last)); end if; end Collect_Words; -- ------------------------------ -- Add a text content with the given format to the document. -- ------------------------------ procedure Add_Text (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map) is begin Filter.Collect_Words (Text); Filter_Type (Filter).Add_Text (Document, Text, Format); end Add_Text; -- ------------------------------ -- Add a section header with the given level in the document. -- ------------------------------ procedure Add_Header (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Header : in Wiki.Strings.WString; Level : in Natural) is begin Filter.Collect_Words (Header); Filter_Type (Filter).Add_Header (Document, Header, Level); end Add_Header; -- ------------------------------ -- Add a link. -- ------------------------------ procedure Add_Link (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Filter_Type (Filter).Add_Link (Document, Name, Attributes); end Add_Link; -- ------------------------------ -- Add an image. -- ------------------------------ procedure Add_Image (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Filter_Type (Filter).Add_Image (Document, Name, Attributes); end Add_Image; -- ------------------------------ -- Add a quote. -- ------------------------------ procedure Add_Quote (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Filter_Type (Filter).Add_Quote (Document, Name, Attributes); end Add_Quote; -- ------------------------------ -- Add a text block that is pre-formatted. -- ------------------------------ procedure Add_Preformatted (Filter : in out Word_Collector_Type; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Strings.WString) is begin Filter.Collect_Words (Text); Filter_Type (Filter).Add_Preformatted (Document, Text, Format); end Add_Preformatted; -- ------------------------------ -- Add a link. -- ------------------------------ overriding procedure Add_Link (Filter : in out Link_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Collect_Attribute (Filter, Attributes, "href"); Filter_Type (Filter).Add_Link (Document, Name, Attributes); end Add_Link; -- ------------------------------ -- Push a HTML node with the given tag to the document. -- ------------------------------ overriding procedure Push_Node (Filter : in out Link_Collector_Type; Document : in out Wiki.Documents.Document; Tag : in Wiki.Html_Tag; Attributes : in out Wiki.Attributes.Attribute_List) is begin if Tag = A_TAG then Collect_Attribute (Filter, Attributes, "href"); end if; Filter_Type (Filter).Push_Node (Document, Tag, Attributes); end Push_Node; -- ------------------------------ -- Add an image. -- ------------------------------ overriding procedure Add_Image (Filter : in out Image_Collector_Type; Document : in out Wiki.Documents.Document; Name : in Wiki.Strings.WString; Attributes : in out Wiki.Attributes.Attribute_List) is begin Collect_Attribute (Filter, Attributes, "src"); Filter_Type (Filter).Add_Image (Document, Name, Attributes); end Add_Image; -- ------------------------------ -- Push a HTML node with the given tag to the document. -- ------------------------------ overriding procedure Push_Node (Filter : in out Image_Collector_Type; Document : in out Wiki.Documents.Document; Tag : in Wiki.Html_Tag; Attributes : in out Wiki.Attributes.Attribute_List) is begin if Tag = IMG_TAG then Collect_Attribute (Filter, Attributes, "src"); end if; Filter_Type (Filter).Push_Node (Document, Tag, Attributes); end Push_Node; end Wiki.Filters.Collectors;
-- { dg-do compile } with Limited_With3_Pkg3; package body Limited_With3 is procedure Dummy is begin null; end; end Limited_With3;
with Ada.Text_IO; with BigInteger; package body Problem_55 is package IO renames Ada.Text_IO; type Lychrel is (Unknown, True, False); Is_Lychrel_Cache : Array (Long_Long_Integer range 1 .. 10_000) of Lychrel := (others => Unknown); function Reverse_String(input : string) return String is result : string(input'Range); begin for i in input'range loop result(result'Last - i + input'First) := input(i); end loop; return result; end Reverse_String; function Is_Lychrel(num : Integer) return Boolean is function "+"(left, right : BigInteger.BigInt) return BigInteger.BigInt renames BigInteger."+"; function Check_Lychrel(num : BigInteger.BigInt; count : Positive) return Lychrel is procedure Reverse_Big_Int(reversed : out BigInteger.BigInt; same : out Boolean) is str : constant String := BigInteger.ToString(num); rev : constant String := Reverse_String(str); begin if str = rev then same := True; else same := False; reversed := BigInteger.Create(rev); end if; end; reversed : BigInteger.BigInt; same : Boolean; begin if count = 50 then return False; else Reverse_Big_Int(reversed, same); if same then return True; else return Check_Lychrel(reversed + num, count + 1); end if; end if; end Check_Lychrel; function Check_Lychrel(num : Long_Long_Integer; count : Natural) return Lychrel is function Reverse_Num return Long_Long_Integer is part : Long_Long_Integer := num; reversed : Long_Long_Integer := 0; begin while part > 0 loop reversed := reversed * 10 + (part mod 10); part := part / 10; end loop; return reversed; end; function Insert_Cache(result : Lychrel) return Lychrel is begin if num <= Is_Lychrel_Cache'Last then Is_Lychrel_Cache(num) := result; end if; return result; end Insert_Cache; begin if num <= Is_Lychrel_Cache'Last and then Is_Lychrel_Cache(num) /= Unknown then return Is_Lychrel_Cache(num); elsif count = 50 then return Insert_Cache(False); else declare reversed : constant Long_Long_Integer := Reverse_Num; begin if count > 1 and reversed = num then return True; elsif Long_Long_Integer'Last - num > reversed then return Insert_Cache(Check_Lychrel(num + reversed, count + 1)); else return Check_Lychrel(BigInteger.Create(num) + BigInteger.Create(reversed), count + 1); end if; end; end if; end Check_Lychrel; begin case(Check_Lychrel(Long_Long_Integer(num), 0)) is when True => return True; when False => return False; when Others => raise Constraint_Error; end case; end Is_Lychrel; procedure Solve is count : Natural := 0; begin for num in 1 .. 10_000 loop if Is_Lychrel(num) then count := count + 1; else null; end if; end loop; IO.Put(Natural'Image(count)); end Solve; end Problem_55;
with openGL.Tasks, GL.Binding, interfaces.C.Strings, ada.unchecked_Conversion; package body openGL.Server is function Version return String is use GL, GL.Binding, Interfaces; check_is_OK : constant Boolean := openGL.Tasks.Check with Unreferenced; type GLubyte_Pointer is access all GLubyte; function to_Chars_ptr is new ada.unchecked_Conversion (GLubyte_Pointer, c.Strings.Chars_ptr); Result : constant String := c.Strings.Value (to_Chars_ptr (glGetString (GL_VERSION))); begin return Result; end Version; function Version return a_Version is use GL, GL.Binding; Major : aliased glInt; Minor : aliased glInt; begin glGetIntegerv (GL_MAJOR_VERSION, Major'Access); glGetIntegerv (GL_MINOR_VERSION, Minor'Access); return (Major => Integer (Major), Minor => Integer (Minor)); end Version; end openGL.Server;
--****p* Data_Streams/Files -- DESCRIPTION -- The user can use as data stream for sample I/O files with different -- format. Every implemented format corresponds to a different implementation -- of the Data_Source or Data_Destination interface defined in the package -- Data_Streams. -- -- In order to make it easier to manage different format at runtime, -- this package acts as a kind of "broker" that recognizes the format -- and create the correct object to handle it. -- -- The interface of this package is really simple: it provides two -- Open functions (Open.source and Open.destination) that look -- at the filename to guess the format if this is not explicitely -- specified by the user. If given the special filename the opening -- functions use the standard input/output. -- -- |html <h2>Options in filename</h2> -- -- Sometimes it is necessary to give to the procedure opening the -- source/destination some information that cannot be found in the -- file itself. For example, if the file is just a raw sequence -- of samples, it is not possible to read from it the sampling -- frequency. As another example, when we open a data destination -- that can accept both Sample_Type and Float formats, we cannot know -- which format the user desires. -- -- In order to solve this kind of problems we allow to append to the -- filename an option string. The option string is separated from -- the filename by "::" and it is a sequence of assignaments -- key=value separated by commas. For example, -- -- |html <center><code>/tmp/impulse.txt::fmt=float,foo,bar=0</code></center> -- -- is a filename that identifies the file -- |html <code>/tmp/impulse.txt</code> and associates with it three options -- |html <code>fmt, foo</code> and -- |html <code>bar</code> with values, respectively, -- |html <code>float</code>, the empty string and 0. -- -- Note that the option section is defined as the part of the filename -- that goes -- |html <b>from the last "::" to the end</b>. Therefore, the following -- filename -- -- |html <center><code>/tmp/pippo::jimmy=9,::bar=0</code></center> -- -- is a filename that identifies the file -- |html <code>/tmp/pippo::jimmy=9,</code> (yes, with a comma at the end... -- pretty silly filename, I agree...) with option -- |html <code>bar=0</code> and -- |html <b>not</b> a file -- |html <code>/tmp/pippo</code> with options -- |html <code>jimmy=9</code> and -- |html <code>::bar=0</code>. -- -- Note that this structure does not allow to have neither "::" nor "," in an option -- value. Currently no escape mechanism is used, maybe later. -- -- Finally, notes that the option mechanism applies -- |html <b>also to the special name "-"</b>. -- For example, if we open a data detination with name -- -- |html <center><code>-::fmt=float</code></center> -- -- the output samples will be written to the standard output -- in floating point format. --*** package Fakedsp.Data_Streams.Files is --****t* Files/File_Type -- SOURCE type File_Type is (Wav_File, Text_File, Unknown); -- DESCRIPTION -- Enumeration type representing the currently recognized format. -- This type is here since we want to allow the user to specify -- the format when the source/destination is open, without -- any guessing on the library side. -- -- It is a good idea to extend this type when a new format is added. --*** --****f* Files/Open.Source -- SOURCE function Open (Filename : String; Format : File_Type := Unknown) return Data_Source_Access; -- DESCRIPTION -- Open a Data_Source based on the file with the specified filename and -- format (WAV, text-based, ...). If the special -- filename "-" is used, the standard input is used. -- -- If Format = Unknown, then: -- * if Filename = "-", format Text_File is used by default, otherwise -- * the format is guessed on the basis of the extension (maybe -- in the future we will check the content too). -- -- Sampling frequency and number of channels are read from the -- specified file or from the options read from the filename --*** --****f* Files/Open.Destination -- SOURCE function Open (Filename : String; Sampling : Frequency_Hz; Format : File_Type := Unknown; Last_Channel : Channel_Index := 1) return Data_Destination_Access with Pre => Sampling /= Unspecified_Frequency; -- DESCRIPTION -- Open a Data_Destination based on the file with the specified filename and -- format (WAV, text-based, ...). If the special -- filename "-" is used, the standard output is used. -- -- If Format = Unknown, then -- -- * if Filename = "-", format Text_File is used by default, otherwise -- * the format is guessed on the basis of the extension. --*** end Fakedsp.Data_Streams.Files;
with HAL_Interface; use HAL_Interface; package I2C_Interface with SPARK_Mode --,Abstract_State => State is type I2C_Type is new Port_Type with record pin : Integer := 0; end record; overriding procedure configure(Port : I2C_Type; Config : Configuration_Type); overriding procedure write (Port : I2C_Type; Address : Address_Type; Data : Data_Type) ; --with Global => (In_Out => State); overriding function read (Port : I2C_Type; Address : Address_Type) return Data_Type; end I2C_Interface;
-- -- 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 ewok.sched; with ewok.tasks; with m4.scb; package body ewok.tasks.debug with spark_mode => off is package DBG renames ewok.debug; procedure crashdump (frame_a : in ewok.t_stack_frame_access) is cfsr : constant m4.scb.t_SCB_CFSR := m4.scb.SCB.CFSR; begin if cfsr.MMFSR.IACCVIOL then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.MMFSR.IACCVIOL")); end if; if cfsr.MMFSR.DACCVIOL then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.MMFSR.DACCVIOL")); end if; if cfsr.MMFSR.MUNSTKERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.MMFSR.MUNSTKERR")); end if; if cfsr.MMFSR.MSTKERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.MMFSR.MSTKERR")); end if; if cfsr.MMFSR.MLSPERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.MMFSR.MLSPERR")); end if; if cfsr.MMFSR.MMARVALID then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.MMFSR.MMARVALID")); end if; if cfsr.MMFSR.MMARVALID then pragma DEBUG (DBG.log (DBG.ERROR, "MMFAR.ADDRESS = " & system_address'image (m4.scb.SCB.MMFAR.ADDRESS))); end if; if cfsr.BFSR.IBUSERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.IBUSERR")); end if; if cfsr.BFSR.PRECISERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.PRECISERR")); end if; if cfsr.BFSR.IMPRECISERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.IMPRECISERR")); end if; if cfsr.BFSR.UNSTKERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.UNSTKERR")); end if; if cfsr.BFSR.STKERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.STKERR")); end if; if cfsr.BFSR.LSPERR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.LSPERR")); end if; if cfsr.BFSR.BFARVALID then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.BFSR.BFARVALID")); end if; if cfsr.BFSR.BFARVALID then pragma DEBUG (DBG.log (DBG.ERROR, "BFAR.ADDRESS = " & system_address'image (m4.scb.SCB.BFAR.ADDRESS))); end if; if cfsr.UFSR.UNDEFINSTR then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.UFSR.UNDEFINSTR")); end if; if cfsr.UFSR.INVSTATE then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.UFSR.INVSTATE")); end if; if cfsr.UFSR.INVPC then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.UFSR.INVPC")); end if; if cfsr.UFSR.NOCP then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.UFSR.NOCP")); end if; if cfsr.UFSR.UNALIGNED then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.UFSR.UNALIGNED")); end if; if cfsr.UFSR.DIVBYZERO then pragma DEBUG (DBG.log (DBG.ERROR, "+cfsr.UFSR.DIVBYZERO")); end if; DBG.log (DBG.ERROR, ewok.tasks.tasks_list(ewok.sched.current_task_id).name); DBG.alert ("Frame "); DBG.alert (system_address'image (to_system_address (frame_a))); DBG.newline; DBG.alert ("EXC_RETURN "); DBG.alert (unsigned_32'image (frame_a.all.exc_return)); DBG.newline; DBG.alert ("R0 "); DBG.alert (unsigned_32'image (frame_a.all.R0)); DBG.newline; DBG.alert ("R1 "); DBG.alert (unsigned_32'image (frame_a.all.R1)); DBG.newline; DBG.alert ("R2 "); DBG.alert (unsigned_32'image (frame_a.all.R2)); DBG.newline; DBG.alert ("R3 "); DBG.alert (unsigned_32'image (frame_a.all.R3)); DBG.newline; DBG.alert ("R4 "); DBG.alert (unsigned_32'image (frame_a.all.R4)); DBG.newline; DBG.alert ("R5 "); DBG.alert (unsigned_32'image (frame_a.all.R5)); DBG.newline; DBG.alert ("R6 "); DBG.alert (unsigned_32'image (frame_a.all.R6)); DBG.newline; DBG.alert ("R7 "); DBG.alert (unsigned_32'image (frame_a.all.R7)); DBG.newline; DBG.alert ("R8 "); DBG.alert (unsigned_32'image (frame_a.all.R8)); DBG.newline; DBG.alert ("R9 "); DBG.alert (unsigned_32'image (frame_a.all.R9)); DBG.newline; DBG.alert ("R10 "); DBG.alert (unsigned_32'image (frame_a.all.R10)); DBG.newline; DBG.alert ("R11 "); DBG.alert (unsigned_32'image (frame_a.all.R11)); DBG.newline; DBG.alert ("R12 "); DBG.alert (unsigned_32'image (frame_a.all.R12)); DBG.newline; DBG.alert ("PC "); DBG.alert (unsigned_32'image (frame_a.all.PC)); DBG.newline; DBG.alert ("LR "); DBG.alert (unsigned_32'image (frame_a.all.LR)); DBG.newline; DBG.alert ("PSR "); DBG.alert (unsigned_32'image (m4.cpu.to_unsigned_32 (frame_a.all.PSR))); DBG.newline; end crashdump; end ewok.tasks.debug;
function Es_Divisor(N, M: Integer) return Boolean is begin if (M mod N) = 0 then return True; end if; return False; end Es_Divisor;
-- openapi_ipify -- OpenAPI client for ipify, a simple public IP address API -- -- OpenAPI spec version: 0.9.0 -- Contact: blah@cliffano.com -- -- NOTE: This package is auto generated by the swagger code generator 3.2.1-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Servers; with .Models; with Security.Permissions; package .Skeletons is use .Models; type Server_Type is limited interface; -- Get your public IP address procedure Get_Ip (Server : in out Server_Type; Format : in Swagger.Nullable_UString; Callback : in Swagger.Nullable_UString; Result : out Swagger.Object; Context : in out Swagger.Servers.Context_Type) is abstract; generic type Implementation_Type is limited new Server_Type with private; package Skeleton is procedure Register (Server : in out Swagger.Servers.Application_Type'Class); -- Get your public IP address procedure Get_Ip (Req : in out Swagger.Servers.Request'Class; Reply : in out Swagger.Servers.Response'Class; Stream : in out Swagger.Servers.Output_Stream'Class; Context : in out Swagger.Servers.Context_Type); end Skeleton; generic type Implementation_Type is limited new Server_Type with private; package Shared_Instance is procedure Register (Server : in out Swagger.Servers.Application_Type'Class); -- Get your public IP address procedure Get_Ip (Req : in out Swagger.Servers.Request'Class; Reply : in out Swagger.Servers.Response'Class; Stream : in out Swagger.Servers.Output_Stream'Class; Context : in out Swagger.Servers.Context_Type); private protected Server is -- Get your public IP address procedure Get_Ip (Format : in Swagger.Nullable_UString; Callback : in Swagger.Nullable_UString; Result : out Swagger.Object; Context : in out Swagger.Servers.Context_Type); private Impl : Implementation_Type; end Server; end Shared_Instance; end .Skeletons;
-- -- Jan & Uwe R. Zimmer, Australia, July 2011 -- package Callback_Procedures is pragma Elaborate_Body; procedure Main_Operations; end Callback_Procedures;
-- Score PIXAL le 07/10/2020 à 17:04 : 100% with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Characters.Handling; use Ada.Characters.Handling; procedure Robot_Type_1 is --| Le type T_Direction |--------------------------------------------------- type T_Direction is (NORD, EST, SUD, OUEST); procedure Get_Direction (Direction: out T_Direction ; Consigne: String) is Taille_Max: constant Integer := 10; -- suffisant pour une direction Direction_Texte: String (1..Taille_Max); -- une direction lue au clavier Taille: Integer; -- la taille effective de Direction_Texte begin -- Demander la direction (String) Put (Consigne); Get_Line (Direction_Texte, Taille); --! Lire une chaîne de caractère --! Réalise un Skip_Line -- Convertir la direction en texte en T_Direction Direction := T_Direction'Value (To_Upper (Direction_Texte (1..Taille))); end Get_Direction; --| Le type T_Robot |------------------------------------------------------- type T_Robot is -- ^ Y -- | -- | Robot de coordonnées (4, 2) direction OUEST -- 2 | <o -- 1 | -- -+--------------------------------> -- | 1 2 3 4 Y record Abscisse, Ordonnee: Integer; -- les coordonnées Direction: T_Direction; -- direction du robot end record; -- Initialiser un robot à partir se son abscisse, sont ordonnée et sa direction. procedure Initialiser ( Robot : out T_Robot; Abscisse, Ordonnee: in Integer; Direction: T_Direction ) with Post => Robot.Abscisse = Abscisse and Robot.Ordonnee = Ordonnee and Robot.Direction = Direction is begin Robot := T_Robot'(Abscisse, Ordonnee, Direction); end Initialiser; -- Afficher un robot sous la forme "(X, Y)>Direction>". procedure Put (Robot: in T_Robot) is begin Put ("("); Put (Robot.Abscisse, 1); Put (", "); Put (Robot.Ordonnee, 1); Put (")>"); Put (To_Lower (T_Direction'Image(Robot.Direction))); Put (">"); end Put; -- Afficher un robot en ajout un retour à la ligne. procedure Put_Line (Robot: in T_Robot) is begin Put (Robot); New_Line; end Put_Line; -- Faire avancer le robot d'une case suivant sa direction courante. procedure Avancer (Robot : in out T_Robot) is begin case Robot.Direction is when NORD => Robot.Ordonnee := Robot.Ordonnee + 1; when SUD => Robot.Ordonnee := Robot.Ordonnee - 1; when EST => Robot.Abscisse := Robot.Abscisse + 1; when OUEST => Robot.Abscisse := Robot.Abscisse - 1; end case; end Avancer; -- Faire pivoter le robot dans le sens NORD, EST, SUD, OUEST procedure Pivoter (Robot : in out T_Robot) is begin Robot.Direction := T_Direction'Val((T_Direction'Pos(Robot.Direction) + 1) mod 4); end Pivoter; --| Le type T_Environnement |----------------------------------------------- MAX_X: constant Integer := 100; MAX_Y: constant Integer := 50; type T_Case is (LIBRE, OBSTACLE); type T_Environnement is array (-MAX_x..MAX_X, -MAX_Y..MAX_Y) of T_Case; -- Faire avancer le robot d'une case suivant sa direction courante dans une -- environnement. On considère qu'il peut y avoir plusieurs robots dans la -- même case de l'environnement. Le robot n'avance pas s'il y a un obstrable. -- Il ne peut pas sortir de l'environnement. procedure Avancer (Robot : in out T_Robot ; Environnement : T_Environnement) with Pre => -MAX_X <= Robot.Abscisse and Robot.Abscisse <= Max_X and -MAX_Y <= Robot.Ordonnee and Robot.Ordonnee <= Max_Y is type T_VecteurDeplacement is array (T_Direction) of Integer; -- Invariant : les valeurs sont 0, 1 ou -1 DX: constant T_VecteurDeplacement := (0, 1, 0, -1); -- déplacmeent suivant l'axe des X DY: constant T_VecteurDeplacement := (1, 0, -1, 0); -- déplacmeent suivant l'axe des Y Nouveau_X, Nouveau_Y: Integer; -- nouvelles coordonnées du robot si pas d'obstacle begin -- Calculer les nouvelles coordonnées théoriques du robot Nouveau_X := Robot.Abscisse + DX (Robot.direction); Nouveau_Y := Robot.Ordonnee + DY (Robot.direction); if (-MAX_X <= Nouveau_X and Nouveau_X <= Max_X and -MAX_Y <= Nouveau_Y and Nouveau_Y <= Max_Y) and then Environnement (Nouveau_X, Nouveau_Y) = LIBRE then Robot.Abscisse := Nouveau_X; Robot.Ordonnee := Nouveau_Y; else null; -- le robot ne bouge pas end if; end Avancer; -- Faire pivoter le robot dans le sens NORD, EST, SUD, OUEST dans -- l'environnement considéré. -- Remarque : l'environnement n'a pas d'impact sur cette opération. procedure Pivoter (Robot : in out T_Robot; Environnement : in T_Environnement) is begin Pivoter (Robot); end Pivoter; -- Faire avancer le robot jusqu'à un obstacle ou aux limites de -- l'environnement. procedure Foncer(Robot : in out T_Robot; Environnement : in T_Environnement) is Ancien_X, Ancien_Y: Integer; begin loop Ancien_X := Robot.Abscisse; Ancien_Y := Robot.Ordonnee; Avancer(Robot, Environnement); exit when Ancien_X = Robot.Abscisse and Ancien_Y = Robot.Ordonnee; end loop; end Foncer; --| Sous-programmes qui manipulent les sous-programmes précédents |--------- -- Lire les informations d'un robot. procedure Lire_Robot (Robot : out T_Robot) is Abscisse, Ordonnee: Integer; -- les coordonnées initiales du robot Direction: T_Direction; -- la direction initiale du robot begin -- Demander l'abscisse Put ("Abscisse : "); Get (Abscisse); Skip_Line; -- Demander l'ordonnée Put ("Ordonnée : "); Get (Ordonnee); Skip_Line; -- Demander la direction Get_Direction (direction, "Direction : "); Initialiser (Robot, Abscisse, Ordonnee, Direction); end Lire_Robot; -- programme de test PIXAL pour le robot et ses sous-programmes procedure Exemple_Robot is Robot1 : T_Robot; begin Lire_Robot (Robot1); Put ("Robot lu : "); Put_Line (Robot1); for i in 1..4 loop Put ("Avancer : "); Avancer (Robot1); Put_Line (Robot1); Put ("Pivoter : "); Pivoter (Robot1); Put_Line (Robot1); end loop; end Exemple_Robot; procedure Exemple_Robot_Dans_Environnment is Robot1 : T_Robot; Environnement : T_Environnement; -- un exemple d'environnement begin -- Saisir le robot Lire_Robot (Robot1); Put ("Robot lu : "); Put_Line (Robot1); -- Initialiser l'environnement Environnement := (others => (others => LIBRE)); -- environnement vide Environnement ((Robot1.Abscisse + 20) mod MAX_X, Robot1.Ordonnee) := OBSTACLE; -- Faire foncer le robot Put_Line ("Le robot fonce..."); Foncer (Robot1, environnement); -- Afficher le robot Put ("Le robot s'arrête en : "); Put_Line (Robot1); end Exemple_Robot_Dans_Environnment; --| Le programme principal |------------------------------------------------ Type_Test: Character; begin -- Choisir le type de test Put ("Type de test : "); Get (Type_Test); Skip_Line; -- Lancer le test choisi case To_Lower (Type_Test) is when 'r' => Exemple_Robot; when 'e' => Exemple_Robot_Dans_Environnment; when others => Put ("Test inconnu"); end case; -- QUESTIONS -- 1: a: Elles ont été déclarés dans cet ordre pour simplifier l'affectation -- ex: NORD+1 = EST qui est bien un pivotage de 90deg. -- 1: b: L'utilisateur saisie une direction en ecrivant son nom -- 1: c: La procédure Get_Direction n'est pas robuste car si l'utilisateur entre une direction -- inconnue, la fonction jete un erreur. -- 1: d: Oui, car Get n'a pas de signature identique à Get_Direction -- (vu que T_Direction est definie par l'utilisateur). -- -- 3: a: T_Case admet deux valeurs (LIBRE, OCCUPE), Boolean admet aussi deux valeurs (True, False) -- donc on peux prendre le type Boolean au lieu de T_Case. (mais si Case = True, on veut dire quoi?) -- 3: b: DX et DY correspondent aux changements de position en relation avec la Direction -- ex: DX(NORD) = 0 car en direction nord on ne fait pas de déplacements sur l'axe X end Robot_Type_1;
with Ada.Text_IO; use Ada.Text_IO; procedure Szummazas_Rek is type Index is new Integer; type Elem is new Integer; type Tomb is array (Index range <>) of Elem; function Szumma ( T: Tomb; S: Elem ) return Elem is begin if T'Length > 1 then return Szumma(T(T'First..Index'Pred(T'Last)), S + T(T'Last)); else return S + T(T'Last); end if; end Szumma; function Szumma2 ( T: Tomb ) return Elem is begin if T'Length > 1 then return T(T'Last) + Szumma2(T(T'First..Index'Pred(T'Last))); else return T(T'Last); end if; end Szumma2; begin Put_Line( Elem'Image( Szumma((3,2,5,7,1), 0) ) ); Put_Line( Elem'Image( Szumma2((3,2,5,7,1)) ) ); end Szummazas_Rek;
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.RESTRICTED_DOUBLY_LINKED_LISTS -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2021, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ -- The doubly-linked list container provides constant-time insertion and -- deletion at all positions, and allows iteration in both the forward and -- reverse directions. This list form allocates storage for all nodes -- statically (there is no dynamic allocation), and a discriminant is used to -- specify the capacity. This container is also "restricted", meaning that -- even though it does raise exceptions (as described below), it does not use -- internal exception handlers. No state changes are made that would need to -- be reverted (in the event of an exception), and so as a consequence, this -- container cannot detect tampering (of cursors or elements). generic type Element_Type is private; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Restricted_Doubly_Linked_Lists is pragma Pure; type List (Capacity : Count_Type) is tagged limited private; pragma Preelaborable_Initialization (List); type Cursor is private; pragma Preelaborable_Initialization (Cursor); Empty_List : constant List; -- The default value for list objects declared without an explicit -- initialization expression. No_Element : constant Cursor; -- The default value for cursor objects declared without an explicit -- initialization expression. function "=" (Left, Right : List) return Boolean; -- If Left denotes the same list object as Right, then equality returns -- True. If the length of Left is different from the length of Right, then -- it returns False. Otherwise, list equality iterates over Left and Right, -- comparing the element of Left to the corresponding element of Right -- using the generic actual equality operator for elements. If the elements -- compare False, then the iteration terminates and list equality returns -- False. Otherwise, if all elements return True, then list equality -- returns True. procedure Assign (Target : in out List; Source : List); -- If Target denotes the same list object as Source, the operation does -- nothing. If Target.Capacity is less than Source.Length, then it raises -- Constraint_Error. Otherwise, it clears Target, and then inserts each -- element of Source into Target. function Length (Container : List) return Count_Type; -- Returns the total number of (active) elements in Container function Is_Empty (Container : List) return Boolean; -- Returns True if Container.Length is 0 procedure Clear (Container : in out List); -- Deletes all elements from Container. Note that this is a bounded -- container and so the element is not "deallocated" in the same sense that -- an unbounded form would deallocate the element. Rather, the node is -- relinked off of the active part of the list and onto the inactive part -- of the list (the storage from which new elements are "allocated"). function Element (Position : Cursor) return Element_Type; -- If Position equals No_Element, then Constraint_Error is raised. -- Otherwise, function Element returns the element designed by Position. procedure Replace_Element (Container : in out List; Position : Cursor; New_Item : Element_Type); -- If Position equals No_Element, then Constraint_Error is raised. If -- Position is associated with a list object different from Container, -- Program_Error is raised. Otherwise, the element designated by Position -- is assigned the value New_Item. procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)); -- If Position equals No_Element, then Constraint_Error is raised. -- Otherwise, it calls Process with (a constant view of) the element -- designated by Position as the parameter. procedure Update_Element (Container : in out List; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); -- If Position equals No_Element, then Constraint_Error is raised. -- Otherwise, it calls Process with (a variable view of) the element -- designated by Position as the parameter. procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1); -- Inserts Count new elements, all with the value New_Item, into Container, -- immediately prior to the position specified by Before. If Before has the -- value No_Element, this is interpreted to mean that the elements are -- appended to the list. If Before is associated with a list object -- different from Container, then Program_Error is raised. If there are -- fewer than Count nodes available, then Constraint_Error is raised. procedure Insert (Container : in out List; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1); -- Inserts elements into Container as described above, but with the -- difference that cursor Position is returned, which designates the first -- of the new elements inserted. If Count is 0, Position returns the value -- Before. procedure Insert (Container : in out List; Before : Cursor; Position : out Cursor; Count : Count_Type := 1); -- Inserts elements in Container as described above, but with the -- difference that the new elements are initialized to the default value -- for objects of type Element_Type. procedure Prepend (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1); -- Inserts Count elements, all having the value New_Item, prior to the -- first element of Container. procedure Append (Container : in out List; New_Item : Element_Type; Count : Count_Type := 1); -- Inserts Count elements, all having the value New_Item, following the -- last element of Container. procedure Delete (Container : in out List; Position : in out Cursor; Count : Count_Type := 1); -- If Position equals No_Element, Constraint_Error is raised. If Position -- is associated with a list object different from Container, then -- Program_Error is raised. Otherwise, the Count nodes starting from -- Position are removed from Container ("removed" meaning that the nodes -- are unlinked from the active nodes of the list and relinked to inactive -- storage). On return, Position is set to No_Element. procedure Delete_First (Container : in out List; Count : Count_Type := 1); -- Removes the first Count nodes from Container procedure Delete_Last (Container : in out List; Count : Count_Type := 1); -- Removes the last Count nodes from Container procedure Reverse_Elements (Container : in out List); -- Relinks the nodes in reverse order procedure Swap (Container : in out List; I, J : Cursor); -- If I or J equals No_Element, then Constraint_Error is raised. If I or J -- is associated with a list object different from Container, then -- Program_Error is raised. Otherwise, Swap exchanges (copies) the values -- of the elements (on the nodes) designated by I and J. procedure Swap_Links (Container : in out List; I, J : Cursor); -- If I or J equals No_Element, then Constraint_Error is raised. If I or J -- is associated with a list object different from Container, then -- Program_Error is raised. Otherwise, Swap exchanges (relinks) the nodes -- designated by I and J. procedure Splice (Container : in out List; Before : Cursor; Position : in out Cursor); -- If Before is associated with a list object different from Container, -- then Program_Error is raised. If Position equals No_Element, then -- Constraint_Error is raised; if it associated with a list object -- different from Container, then Program_Error is raised. Otherwise, the -- node designated by Position is relinked immediately prior to Before. If -- Before equals No_Element, this is interpreted to mean to move the node -- designed by Position to the last end of the list. function First (Container : List) return Cursor; -- If Container is empty, the function returns No_Element. Otherwise, it -- returns a cursor designating the first element. function First_Element (Container : List) return Element_Type; -- Equivalent to Element (First (Container)) function Last (Container : List) return Cursor; -- If Container is empty, the function returns No_Element. Otherwise, it -- returns a cursor designating the last element. function Last_Element (Container : List) return Element_Type; -- Equivalent to Element (Last (Container)) function Next (Position : Cursor) return Cursor; -- If Position equals No_Element or Last (Container), the function returns -- No_Element. Otherwise, it returns a cursor designating the node that -- immediately follows the node designated by Position. procedure Next (Position : in out Cursor); -- Equivalent to Position := Next (Position) function Previous (Position : Cursor) return Cursor; -- If Position equals No_Element or First (Container), the function returns -- No_Element. Otherwise, it returns a cursor designating the node that -- immediately precedes the node designated by Position. procedure Previous (Position : in out Cursor); -- Equivalent to Position := Previous (Position) function Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor; -- Searches for the node whose element is equal to Item, starting from -- Position and continuing to the last end of the list. If Position equals -- No_Element, the search starts from the first node. If Position is -- associated with a list object different from Container, then -- Program_Error is raised. If no node is found having an element equal to -- Item, then Find returns No_Element. function Reverse_Find (Container : List; Item : Element_Type; Position : Cursor := No_Element) return Cursor; -- Searches in reverse for the node whose element is equal to Item, -- starting from Position and continuing to the first end of the list. If -- Position equals No_Element, the search starts from the last node. If -- Position is associated with a list object different from Container, then -- Program_Error is raised. If no node is found having an element equal to -- Item, then Reverse_Find returns No_Element. function Contains (Container : List; Item : Element_Type) return Boolean; -- Equivalent to Container.Find (Item) /= No_Element function Has_Element (Position : Cursor) return Boolean; -- Equivalent to Position /= No_Element procedure Iterate (Container : List; Process : not null access procedure (Position : Cursor)); -- Calls Process with a cursor designating each element of Container, in -- order from Container.First to Container.Last. procedure Reverse_Iterate (Container : List; Process : not null access procedure (Position : Cursor)); -- Calls Process with a cursor designating each element of Container, in -- order from Container.Last to Container.First. generic with function "<" (Left, Right : Element_Type) return Boolean is <>; package Generic_Sorting is function Is_Sorted (Container : List) return Boolean; -- Returns False if there exists an element which is less than its -- predecessor. procedure Sort (Container : in out List); -- Sorts the elements of Container (by relinking nodes), according to -- the order specified by the generic formal less-than operator, such -- that smaller elements are first in the list. The sort is stable, -- meaning that the relative order of elements is preserved. end Generic_Sorting; private type Node_Type is limited record Prev : Count_Type'Base; Next : Count_Type; Element : Element_Type; end record; type Node_Array is array (Count_Type range <>) of Node_Type; type List (Capacity : Count_Type) is tagged limited record Nodes : Node_Array (1 .. Capacity); Free : Count_Type'Base := -1; First : Count_Type := 0; Last : Count_Type := 0; Length : Count_Type := 0; end record; type List_Access is access all List; for List_Access'Storage_Size use 0; type Cursor is record Container : List_Access; Node : Count_Type := 0; end record; Empty_List : constant List := (0, others => <>); No_Element : constant Cursor := (null, 0); end Ada.Containers.Restricted_Doubly_Linked_Lists;
with GNAT.Dynamic_Tables; package Pack18_Pkg is type String_Access is access String; type Rec is record S : String_Access; B : Boolean; N : Natural; end record; pragma Pack (Rec); package Attributes_Tables is new GNAT.Dynamic_Tables (Table_Component_Type => Rec, Table_Index_Type => Natural, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 200); end Pack18_Pkg;
private package GID.Decoding_PNG is type PNG_Chunk_tag is ( -- -- Critical chunks -- IHDR, -- must be the first chunk; it contains the header. PLTE, -- contains the palette; list of colors. IDAT, -- contains the image, which may be split among multiple IDAT chunks. IEND, -- marks the image end. -- -- Ancillary chunks -- bKGD, -- gives the default background color. cHRM, -- gives the chromaticity coordinates of the display primaries and white point. gAMA, -- specifies gamma. hIST, -- can store the histogram, or total amount of each color in the image. iCCP, -- is an ICC color profile. iTXt, -- contains UTF-8 text, compressed or not, with an optional language tag. pHYs, -- holds the intended pixel size and/or aspect ratio of the image. sBIT, -- (significant bits) indicates the color-accuracy of the source data. sPLT, -- suggests a palette to use if the full range of colors is unavailable. sRGB, -- indicates that the standard sRGB color space is used. tEXt, -- can store text that can be represented in ISO/IEC 8859-1. tIME, -- stores the time that the image was last changed. tRNS, -- contains transparency information. zTXt, -- contains compressed text with the same limits as tEXt. -- -- Public extentions -- PNG Extensions and Register of Public Chunks and Keywords -- oFFs, -- image offset from frame or page origin pCAL, -- physical calibration of pixel values sCAL, -- physical scale of image subject sTER, -- stereographic subimage layout gIFg, -- GIF Graphic Control Extension gIFx, -- GIF Application Extension fRAc, -- fractal image parameters -- -- Private chunks (not defined in the ISO standard) -- vpAg, -- used in ImageMagick to store "virtual page" size spAL, prVW, cmOD, cmPP, cpIp, mkBF, mkBS, mkBT, mkTS, pcLb ); type Chunk_head is record length: U32; kind : PNG_Chunk_tag; end record; procedure Read( image: in out Image_descriptor; ch: out Chunk_head); -------------------- -- Image decoding -- -------------------- generic type Primary_color_range is mod <>; with procedure Set_X_Y (x, y: Natural); with procedure Put_Pixel ( red, green, blue : Primary_color_range; alpha : Primary_color_range ); with procedure Feedback (percents: Natural); -- procedure Load (image: in out Image_descriptor); end GID.Decoding_PNG;
package Loop_Optimization4_Pkg is Max_Debug_Buffer_Len : Natural := 8 * 1024; Debug_Buffer : String (1 .. Max_Debug_Buffer_Len); Debug_Buffer_Len : Natural range 0 .. Max_Debug_Buffer_Len; procedure Add (Phrase : String); end Loop_Optimization4_Pkg;
pragma Style_Checks (Off); -- This spec has been automatically generated from ATSAMD51G19A.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package SAM_SVD.RAMECC is pragma Preelaborate; --------------- -- Registers -- --------------- -- Interrupt Enable Clear type RAMECC_INTENCLR_Register is record -- Single Bit ECC Error Interrupt Enable Clear SINGLEE : Boolean := False; -- Dual Bit ECC Error Interrupt Enable Clear DUALE : Boolean := False; -- unspecified Reserved_2_7 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for RAMECC_INTENCLR_Register use record SINGLEE at 0 range 0 .. 0; DUALE at 0 range 1 .. 1; Reserved_2_7 at 0 range 2 .. 7; end record; -- Interrupt Enable Set type RAMECC_INTENSET_Register is record -- Single Bit ECC Error Interrupt Enable Set SINGLEE : Boolean := False; -- Dual Bit ECC Error Interrupt Enable Set DUALE : Boolean := False; -- unspecified Reserved_2_7 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for RAMECC_INTENSET_Register use record SINGLEE at 0 range 0 .. 0; DUALE at 0 range 1 .. 1; Reserved_2_7 at 0 range 2 .. 7; end record; -- Interrupt Flag type RAMECC_INTFLAG_Register is record -- Single Bit ECC Error Interrupt SINGLEE : Boolean := False; -- Dual Bit ECC Error Interrupt DUALE : Boolean := False; -- unspecified Reserved_2_7 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for RAMECC_INTFLAG_Register use record SINGLEE at 0 range 0 .. 0; DUALE at 0 range 1 .. 1; Reserved_2_7 at 0 range 2 .. 7; end record; -- Status type RAMECC_STATUS_Register is record -- Read-only. ECC Disable ECCDIS : Boolean; -- unspecified Reserved_1_7 : HAL.UInt7; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for RAMECC_STATUS_Register use record ECCDIS at 0 range 0 .. 0; Reserved_1_7 at 0 range 1 .. 7; end record; subtype RAMECC_ERRADDR_ERRADDR_Field is HAL.UInt17; -- Error Address type RAMECC_ERRADDR_Register is record -- Read-only. Error Address ERRADDR : RAMECC_ERRADDR_ERRADDR_Field; -- unspecified Reserved_17_31 : HAL.UInt15; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for RAMECC_ERRADDR_Register use record ERRADDR at 0 range 0 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- Debug Control type RAMECC_DBGCTRL_Register is record -- ECC Disable ECCDIS : Boolean := False; -- ECC Error Log ECCELOG : Boolean := False; -- unspecified Reserved_2_7 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for RAMECC_DBGCTRL_Register use record ECCDIS at 0 range 0 .. 0; ECCELOG at 0 range 1 .. 1; Reserved_2_7 at 0 range 2 .. 7; end record; ----------------- -- Peripherals -- ----------------- -- RAM ECC type RAMECC_Peripheral is record -- Interrupt Enable Clear INTENCLR : aliased RAMECC_INTENCLR_Register; -- Interrupt Enable Set INTENSET : aliased RAMECC_INTENSET_Register; -- Interrupt Flag INTFLAG : aliased RAMECC_INTFLAG_Register; -- Status STATUS : aliased RAMECC_STATUS_Register; -- Error Address ERRADDR : aliased RAMECC_ERRADDR_Register; -- Debug Control DBGCTRL : aliased RAMECC_DBGCTRL_Register; end record with Volatile; for RAMECC_Peripheral use record INTENCLR at 16#0# range 0 .. 7; INTENSET at 16#1# range 0 .. 7; INTFLAG at 16#2# range 0 .. 7; STATUS at 16#3# range 0 .. 7; ERRADDR at 16#4# range 0 .. 31; DBGCTRL at 16#F# range 0 .. 7; end record; -- RAM ECC RAMECC_Periph : aliased RAMECC_Peripheral with Import, Address => RAMECC_Base; end SAM_SVD.RAMECC;
-- { dg-do compile } -- { dg-options "-O2" } with Ada.Containers; use Ada.Containers; with Ada.Containers.Vectors; function Opt32 return Natural is package My_Vectors is new Vectors (Index_Type => Natural, Element_Type => Integer); use My_Vectors; V : Vector; function Sign_Changes return Natural is Cur : Cursor := To_Cursor (V, 0); R : Natural := 0; Negative : Boolean; begin Negative := Element (Cur) < 0; loop Cur := Next (Cur); exit when R > 100; if (Element (Cur) < 0) /= Negative then Negative := not Negative; R := R + 1; end if; end loop; return R; end; begin return Sign_Changes; end;
with Ada.Text_Io; procedure Hello_World is begin Ada.Text_Io.Put_Line("Hello World!"); end;
-- Copyright 2012-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/>. package body Pck is function New_Small_Table (Low: Color; High: Color) return Small_Table is Result : Small_Table (Low .. High); begin for J in Low .. High loop Result (J) := (J = Black or J = Green or J = White); end loop; return Result; end New_Small_Table; function New_Multi_Table (Low, High: Color; LS, HS: Strength) return Multi_Table is Result : Multi_Table (Low .. High, LS .. HS); Next : Boolean := True; begin for J in Low .. High loop for K in LS .. HS loop Result (J, K) := Next; Next := not Next; end loop; end loop; return Result; end New_Multi_Table; function New_Multi_Multi_Table (L1, H1, L2, H2, L3, H3: Positive) return Multi_Multi_Table is Result : Multi_Multi_Table (L1 .. H1, L2 .. H2, L3 .. H3); Next : Boolean := True; begin for J in L1 .. H1 loop for K in L2 .. H2 loop for L in L3 .. H3 loop Result (J, K, L) := Next; Next := not Next; end loop; end loop; end loop; return Result; end New_Multi_Multi_Table; procedure Do_Nothing (A : System.Address) is begin null; end Do_Nothing; end Pck;
-- { dg-do run } with GNAT.Time_Stamp; use GNAT.Time_Stamp; procedure test_time_stamp is S : constant String := Current_Time; function NN (S : String) return Boolean is begin for J in S'Range loop if S (J) not in '0' .. '9' then return True; end if; end loop; return False; end NN; begin if S'Length /= 22 or else S (5) /= '-' or else S (8) /= '-' or else S (11) /= ' ' or else S (14) /= ':' or else S (17) /= ':' or else S (20) /= '.' or else NN (S (1 .. 4)) or else NN (S (6 .. 7)) or else NN (S (9 .. 10)) or else NN (S (12 .. 13)) or else NN (S (15 .. 16)) or else NN (S (18 .. 19)) or else NN (S (21 .. 22)) then raise Program_Error; end if; end;
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT INTERFACE COMPONENTS -- -- -- -- A S I S . C L A U S E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2006-2012, Free Software Foundation, Inc. -- -- -- -- This specification is adapted from the Ada Semantic Interface -- -- Specification Standard (ISO/IEC 15291) 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. -- -- -- -- This specification also contains suggestions and discussion items -- -- related to revising the ASIS Standard according to the changes proposed -- -- for the new revision of the Ada standard. The copyright notice above, -- -- and the license provisions that follow apply solely to these suggestions -- -- and discussion items that are separated by the corresponding comment -- -- sentinels -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore -- -- (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 19 package Asis.Clauses -- Suggestions related to changing this specification to accept new Ada -- features as defined in incoming revision of the Ada Standard (ISO 8652) -- are marked by following comment sentinels: -- -- --|A2005 start -- ... the suggestion goes here ... -- --|A2005 end -- -- and the discussion items are marked by the comment sentinels of teh form: -- -- --|D2005 start -- ... the discussion item goes here ... -- --|D2005 end ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ package Asis.Clauses is ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Asis.Clauses -- -- This package encapsulates a set of queries that operate on A_Clause -- elements. -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Use_Package_Clause - 8.4 -- --|ER A_Use_Type_Clause - 8.4 -- --|ER A_Use_All_Type_Clause - 8.4 -- Ada 2012 -- --|ER A_With_Clause - 10.1.2 -- --|CR -- --|CR Child elements returned by: -- --|CR function Clause_Names -- --|CR ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 19.1 function Clause_Names ------------------------------------------------------------------------------ function Clause_Names (Clause : Asis.Element) return Asis.Name_List; ------------------------------------------------------------------------------ -- Clause - Specifies the with_clause or use_clause to query -- -- Returns a list of the names that appear in the given clause. -- The names in the list should be in their order of appearance in the -- original clauses from the compilation text. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all clauses containing multiple names -- into an equivalent sequence of corresponding single clauses. -- Similarly, an implementation may keep a name only once even though that -- name can appear more than once in a clause. -- -- Appropriate Element_Kinds: -- A_Use_Package_Clause -- A_Use_Type_Clause -- A_Use_All_Type_Clause -- Ada 2012 -- A_With_Clause -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Representation_Clause - 13.1 -- --|ER--------------------------------------------------------------------- -- --|ER An_Attribute_Definition_Clause - 13.3 -- --|ER An_Enumeration_Representation_Clause - 13.4 -- --|ER An_At_Clause - J.7 -- --|CR -- --|CR Child elements returned by: -- --|CR function Representation_Clause_Name -- --|CR function Representation_Clause_Expression -- ------------------------------------------------------------------------------ -- 19.2 function Representation_Clause_Name ------------------------------------------------------------------------------ function Representation_Clause_Name (Clause : Asis.Clause) return Asis.Name; ------------------------------------------------------------------------------ -- Clause - Specifies the representation_clause to query -- -- Returns the direct_name expression following the reserved word "for". -- -- |D2005 start -- But A_Component_Clause does not have the reserved word "for"! The wording -- needs revising! -- |D2005 end -- -- Appropriate Clause_Kinds: -- A_Representation_Clause -- A_Component_Clause -- -- Returns Expression_Kinds: -- An_Identifier -- An_Attribute_Reference -- ------------------------------------------------------------------------------ -- 19.3 function Representation_Clause_Expression ------------------------------------------------------------------------------ function Representation_Clause_Expression (Clause : Asis.Representation_Clause) return Asis.Expression; ------------------------------------------------------------------------------ -- Clause - Specifies the representation_clause to query -- -- Returns the expression following the reserved word "use" or the reserved -- words "use at". -- -- Appropriate Representation_Clause_Kinds: -- An_Attribute_Definition_Clause -- An_Enumeration_Representation_Clause -- An_At_Clause -- -- Returns Element_Kinds: -- An_Expression -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Record_Representation_Clause - 13.5.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Representation_Clause_Name -- --|CR function Mod_Clause_Expression -- --|CR function Component_Clauses -- ------------------------------------------------------------------------------ -- 19.4 function Mod_Clause_Expression ------------------------------------------------------------------------------ function Mod_Clause_Expression (Clause : Asis.Representation_Clause) return Asis.Expression; ------------------------------------------------------------------------------ -- Clause - Specifies the record representation clause to query -- -- Returns the static_expression appearing after the reserved words "at mod". -- -- Returns a Nil_Element if a mod_clause is not present. -- -- Appropriate Representation_Clause_Kinds: -- A_Record_Representation_Clause -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression -- ------------------------------------------------------------------------------ -- 19.5 function Component_Clauses ------------------------------------------------------------------------------ function Component_Clauses (Clause : Asis.Representation_Clause; Include_Pragmas : Boolean := False) return Asis.Component_Clause_List; ------------------------------------------------------------------------------ -- Clause - Specifies the record representation clause to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns the component_clause and pragma elements from the -- record_representation_clause, in their order of appearance. -- -- Returns a Nil_Element_List if the record_representation_clause has no -- component_clause or pragma elements. -- -- Appropriate Representation_Clause_Kinds: -- A_Record_Representation_Clause -- -- Returns Element_Kinds: -- A_Clause -- A_Pragma -- -- Returns Clause_Kinds: -- A_Component_Clause -- -- --|ER--------------------------------------------------------------------- -- --|ER A_Component_Clause - 13.5.1 -- --|CR -- --|CR Child elements returned by: -- --|CR function Representation_Clause_Name -- --|CR function Component_Clause_Position -- --|CR function Component_Clause_Range -- ------------------------------------------------------------------------------ -- 19.6 function Component_Clause_Position ------------------------------------------------------------------------------ function Component_Clause_Position (Clause : Asis.Component_Clause) return Asis.Expression; ------------------------------------------------------------------------------ -- Clause - Specifies the component_clause to query -- -- Returns the position expression for the component_clause. -- -- Appropriate Clause_Kinds: -- A_Component_Clause -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ -- 19.7 function Component_Clause_Range ------------------------------------------------------------------------------ function Component_Clause_Range (Clause : Asis.Component_Clause) return Asis.Discrete_Range; ------------------------------------------------------------------------------ -- Clause - Specifies the component_clause to query -- -- Returns the first_bit .. last_bit range for the component_clause. -- -- Appropriate Clause_Kinds: -- A_Component_Clause -- -- Returns Discrete_Range_Kinds: -- A_Discrete_Simple_Expression_Range -- ------------------------------------------------------------------------------ end Asis.Clauses;
with Interfaces; use Interfaces; with System; package ATmega2560 is -- ADC Control and Status Register B ADCSRB : Unsigned_8; for ADCSRB'Address use System'To_Address (16#7B#); ADCSRB_ACME: constant := 64; -- Analog Comparator Multiplexer Enable -- Analog Comparator Control And Status Register ACSR : Unsigned_8; for ACSR'Address use System'To_Address (16#50#); ACSR_ACIS0: constant := 1; -- Analog Comparator Interrupt Mode Select bit 0 ACSR_ACIS1: constant := 2; -- Analog Comparator Interrupt Mode Select bit 1 ACSR_ACIC: constant := 4; -- Analog Comparator Input Capture Enable ACSR_ACIE: constant := 8; -- Analog Comparator Interrupt Enable ACSR_ACI: constant := 16; -- Analog Comparator Interrupt Flag ACSR_ACO: constant := 32; -- Analog Compare Output ACSR_ACBG: constant := 64; -- Analog Comparator Bandgap Select ACSR_ACD: constant := 128; -- Analog Comparator Disable -- Digital Input Disable Register 1 DIDR1 : Unsigned_8; for DIDR1'Address use System'To_Address (16#7F#); DIDR1_AIN0D: constant := 1; -- AIN0 Digital Input Disable DIDR1_AIN1D: constant := 2; -- AIN1 Digital Input Disable -- USART I/O Data Register UDR0 : Unsigned_8; for UDR0'Address use System'To_Address (16#C6#); -- USART Control and Status Register A UCSR0A : Unsigned_8; for UCSR0A'Address use System'To_Address (16#C0#); UCSR0A_MPCM0: constant := 1; -- Multi-processor Communication Mode UCSR0A_U2X0: constant := 2; -- Double the USART transmission speed UCSR0A_UPE0: constant := 4; -- Parity Error UCSR0A_DOR0: constant := 8; -- Data overRun UCSR0A_FE0: constant := 16; -- Framing Error UCSR0A_UDRE0: constant := 32; -- USART Data Register Empty UCSR0A_TXC0: constant := 64; -- USART Transmitt Complete UCSR0A_RXC0: constant := 128; -- USART Receive Complete -- USART Control and Status Register B UCSR0B : Unsigned_8; for UCSR0B'Address use System'To_Address (16#C1#); UCSR0B_TXB80: constant := 1; -- Transmit Data Bit 8 UCSR0B_RXB80: constant := 2; -- Receive Data Bit 8 UCSR0B_UCSZ02: constant := 4; -- Character Size UCSR0B_TXEN0: constant := 8; -- Transmitter Enable UCSR0B_RXEN0: constant := 16; -- Receiver Enable UCSR0B_UDRIE0: constant := 32; -- USART Data register Empty Interrupt Enable UCSR0B_TXCIE0: constant := 64; -- TX Complete Interrupt Enable UCSR0B_RXCIE0: constant := 128; -- RX Complete Interrupt Enable -- USART Control and Status Register C UCSR0C : Unsigned_8; for UCSR0C'Address use System'To_Address (16#C2#); UCSR0C_UCPOL0: constant := 1; -- Clock Polarity UCSR0C_UCSZ00: constant := 2; -- Character Size UCSR0C_UCSZ01: constant := 4; -- Character Size UCSR0C_USBS0: constant := 8; -- Stop Bit Select UCSR0C_UPM00: constant := 16; -- Parity Mode Bit 0 UCSR0C_UPM01: constant := 32; -- Parity Mode Bit 1 UCSR0C_UMSEL00: constant := 64; -- USART Mode Select UCSR0C_UMSEL01: constant := 128; -- USART Mode Select -- USART Baud Rate Register High Byte UBRR0H : Unsigned_8; for UBRR0H'Address use System'To_Address (16#C5#); UBRR0H_UBRR8: constant := 1; -- USART Baud Rate Register bit 8 UBRR0H_UBRR9: constant := 2; -- USART Baud Rate Register bit 9 UBRR0H_UBRR10: constant := 4; -- USART Baud Rate Register bit 10 UBRR0H_UBRR11: constant := 8; -- USART Baud Rate Register bit 11 -- USART Baud Rate Register Low Byte UBRR0L : Unsigned_8; for UBRR0L'Address use System'To_Address (16#C4#); UBRR0L_UBRR0: constant := 1; -- USART Baud Rate Register bit 0 UBRR0L_UBRR1: constant := 2; -- USART Baud Rate Register bit 1 UBRR0L_UBRR2: constant := 4; -- USART Baud Rate Register bit 2 UBRR0L_UBRR3: constant := 8; -- USART Baud Rate Register bit 3 UBRR0L_UBRR4: constant := 16; -- USART Baud Rate Register bit 4 UBRR0L_UBRR5: constant := 32; -- USART Baud Rate Register bit 5 UBRR0L_UBRR6: constant := 64; -- USART Baud Rate Register bit 6 UBRR0L_UBRR7: constant := 128; -- USART Baud Rate Register bit 7 -- TWI (Slave) Address Mask Register TWAMR : Unsigned_8; for TWAMR'Address use System'To_Address (16#BD#); TWAMR_TWAM0: constant := 2; TWAMR_TWAM1: constant := 4; TWAMR_TWAM2: constant := 8; TWAMR_TWAM3: constant := 16; TWAMR_TWAM4: constant := 32; TWAMR_TWAM5: constant := 64; TWAMR_TWAM6: constant := 128; -- TWI Bit Rate register TWBR : Unsigned_8; for TWBR'Address use System'To_Address (16#B8#); TWBR_TWBR0: constant := 1; TWBR_TWBR1: constant := 2; TWBR_TWBR2: constant := 4; TWBR_TWBR3: constant := 8; TWBR_TWBR4: constant := 16; TWBR_TWBR5: constant := 32; TWBR_TWBR6: constant := 64; TWBR_TWBR7: constant := 128; -- TWI Control Register TWCR : Unsigned_8; for TWCR'Address use System'To_Address (16#BC#); TWCR_TWIE: constant := 1; -- TWI Interrupt Enable TWCR_TWEN: constant := 4; -- TWI Enable Bit TWCR_TWWC: constant := 8; -- TWI Write Collition Flag TWCR_TWSTO: constant := 16; -- TWI Stop Condition Bit TWCR_TWSTA: constant := 32; -- TWI Start Condition Bit TWCR_TWEA: constant := 64; -- TWI Enable Acknowledge Bit TWCR_TWINT: constant := 128; -- TWI Interrupt Flag -- TWI Status Register TWSR : Unsigned_8; for TWSR'Address use System'To_Address (16#B9#); TWSR_TWPS0: constant := 1; -- TWI Prescaler TWSR_TWPS1: constant := 2; -- TWI Prescaler TWSR_TWS3: constant := 8; -- TWI Status TWSR_TWS4: constant := 16; -- TWI Status TWSR_TWS5: constant := 32; -- TWI Status TWSR_TWS6: constant := 64; -- TWI Status TWSR_TWS7: constant := 128; -- TWI Status -- TWI Data register TWDR : Unsigned_8; for TWDR'Address use System'To_Address (16#BB#); TWDR_TWD0: constant := 1; -- TWI Data Register Bit 0 TWDR_TWD1: constant := 2; -- TWI Data Register Bit 1 TWDR_TWD2: constant := 4; -- TWI Data Register Bit 2 TWDR_TWD3: constant := 8; -- TWI Data Register Bit 3 TWDR_TWD4: constant := 16; -- TWI Data Register Bit 4 TWDR_TWD5: constant := 32; -- TWI Data Register Bit 5 TWDR_TWD6: constant := 64; -- TWI Data Register Bit 6 TWDR_TWD7: constant := 128; -- TWI Data Register Bit 7 -- TWI (Slave) Address register TWAR : Unsigned_8; for TWAR'Address use System'To_Address (16#BA#); TWAR_TWGCE: constant := 1; -- TWI General Call Recognition Enable Bit TWAR_TWA0: constant := 2; -- TWI (Slave) Address register Bit 0 TWAR_TWA1: constant := 4; -- TWI (Slave) Address register Bit 1 TWAR_TWA2: constant := 8; -- TWI (Slave) Address register Bit 2 TWAR_TWA3: constant := 16; -- TWI (Slave) Address register Bit 3 TWAR_TWA4: constant := 32; -- TWI (Slave) Address register Bit 4 TWAR_TWA5: constant := 64; -- TWI (Slave) Address register Bit 5 TWAR_TWA6: constant := 128; -- TWI (Slave) Address register Bit 6 -- SPI Control Register SPCR : Unsigned_8; for SPCR'Address use System'To_Address (16#4C#); SPCR_SPR0: constant := 1; -- SPI Clock Rate Select 0 SPCR_SPR1: constant := 2; -- SPI Clock Rate Select 1 SPCR_CPHA: constant := 4; -- Clock Phase SPCR_CPOL: constant := 8; -- Clock polarity SPCR_MSTR: constant := 16; -- Master/Slave Select SPCR_DORD: constant := 32; -- Data Order SPCR_SPE: constant := 64; -- SPI Enable SPCR_SPIE: constant := 128; -- SPI Interrupt Enable -- SPI Status Register SPSR : Unsigned_8; for SPSR'Address use System'To_Address (16#4D#); SPSR_SPI2X: constant := 1; -- Double SPI Speed Bit SPSR_WCOL: constant := 64; -- Write Collision Flag SPSR_SPIF: constant := 128; -- SPI Interrupt Flag -- SPI Data Register SPDR : Unsigned_8; for SPDR'Address use System'To_Address (16#4E#); SPDR_SPDR0: constant := 1; -- SPI Data Register bit 0 SPDR_SPDR1: constant := 2; -- SPI Data Register bit 1 SPDR_SPDR2: constant := 4; -- SPI Data Register bit 2 SPDR_SPDR3: constant := 8; -- SPI Data Register bit 3 SPDR_SPDR4: constant := 16; -- SPI Data Register bit 4 SPDR_SPDR5: constant := 32; -- SPI Data Register bit 5 SPDR_SPDR6: constant := 64; -- SPI Data Register bit 6 SPDR_SPDR7: constant := 128; -- SPI Data Register bit 7 -- Port A Data Register PORTA : Unsigned_8; for PORTA'Address use System'To_Address (16#22#); PORTA_PORTA0: constant := 1; -- Port A Data Register bit 0 PORTA_PORTA1: constant := 2; -- Port A Data Register bit 1 PORTA_PORTA2: constant := 4; -- Port A Data Register bit 2 PORTA_PORTA3: constant := 8; -- Port A Data Register bit 3 PORTA_PORTA4: constant := 16; -- Port A Data Register bit 4 PORTA_PORTA5: constant := 32; -- Port A Data Register bit 5 PORTA_PORTA6: constant := 64; -- Port A Data Register bit 6 PORTA_PORTA7: constant := 128; -- Port A Data Register bit 7 -- Port A Data Direction Register DDRA : Unsigned_8; for DDRA'Address use System'To_Address (16#21#); DDRA_DDA0: constant := 1; -- Data Direction Register, Port A, bit 0 DDRA_DDA1: constant := 2; -- Data Direction Register, Port A, bit 1 DDRA_DDA2: constant := 4; -- Data Direction Register, Port A, bit 2 DDRA_DDA3: constant := 8; -- Data Direction Register, Port A, bit 3 DDRA_DDA4: constant := 16; -- Data Direction Register, Port A, bit 4 DDRA_DDA5: constant := 32; -- Data Direction Register, Port A, bit 5 DDRA_DDA6: constant := 64; -- Data Direction Register, Port A, bit 6 DDRA_DDA7: constant := 128; -- Data Direction Register, Port A, bit 7 -- Port A Input Pins PINA : Unsigned_8; for PINA'Address use System'To_Address (16#20#); PINA_PINA0: constant := 1; -- Input Pins, Port A bit 0 PINA_PINA1: constant := 2; -- Input Pins, Port A bit 1 PINA_PINA2: constant := 4; -- Input Pins, Port A bit 2 PINA_PINA3: constant := 8; -- Input Pins, Port A bit 3 PINA_PINA4: constant := 16; -- Input Pins, Port A bit 4 PINA_PINA5: constant := 32; -- Input Pins, Port A bit 5 PINA_PINA6: constant := 64; -- Input Pins, Port A bit 6 PINA_PINA7: constant := 128; -- Input Pins, Port A bit 7 -- Port B Data Register PORTB : Unsigned_8; for PORTB'Address use System'To_Address (16#25#); PORTB_PORTB0: constant := 1; -- Port B Data Register bit 0 PORTB_PORTB1: constant := 2; -- Port B Data Register bit 1 PORTB_PORTB2: constant := 4; -- Port B Data Register bit 2 PORTB_PORTB3: constant := 8; -- Port B Data Register bit 3 PORTB_PORTB4: constant := 16; -- Port B Data Register bit 4 PORTB_PORTB5: constant := 32; -- Port B Data Register bit 5 PORTB_PORTB6: constant := 64; -- Port B Data Register bit 6 PORTB_PORTB7: constant := 128; -- Port B Data Register bit 7 -- Port B Data Direction Register DDRB : Unsigned_8; for DDRB'Address use System'To_Address (16#24#); DDRB_DDB0: constant := 1; -- Port B Data Direction Register bit 0 DDRB_DDB1: constant := 2; -- Port B Data Direction Register bit 1 DDRB_DDB2: constant := 4; -- Port B Data Direction Register bit 2 DDRB_DDB3: constant := 8; -- Port B Data Direction Register bit 3 DDRB_DDB4: constant := 16; -- Port B Data Direction Register bit 4 DDRB_DDB5: constant := 32; -- Port B Data Direction Register bit 5 DDRB_DDB6: constant := 64; -- Port B Data Direction Register bit 6 DDRB_DDB7: constant := 128; -- Port B Data Direction Register bit 7 -- Port B Input Pins PINB : Unsigned_8; for PINB'Address use System'To_Address (16#23#); PINB_PINB0: constant := 1; -- Port B Input Pins bit 0 PINB_PINB1: constant := 2; -- Port B Input Pins bit 1 PINB_PINB2: constant := 4; -- Port B Input Pins bit 2 PINB_PINB3: constant := 8; -- Port B Input Pins bit 3 PINB_PINB4: constant := 16; -- Port B Input Pins bit 4 PINB_PINB5: constant := 32; -- Port B Input Pins bit 5 PINB_PINB6: constant := 64; -- Port B Input Pins bit 6 PINB_PINB7: constant := 128; -- Port B Input Pins bit 7 -- Port C Data Register PORTC : Unsigned_8; for PORTC'Address use System'To_Address (16#28#); PORTC_PORTC0: constant := 1; -- Port C Data Register bit 0 PORTC_PORTC1: constant := 2; -- Port C Data Register bit 1 PORTC_PORTC2: constant := 4; -- Port C Data Register bit 2 PORTC_PORTC3: constant := 8; -- Port C Data Register bit 3 PORTC_PORTC4: constant := 16; -- Port C Data Register bit 4 PORTC_PORTC5: constant := 32; -- Port C Data Register bit 5 PORTC_PORTC6: constant := 64; -- Port C Data Register bit 6 PORTC_PORTC7: constant := 128; -- Port C Data Register bit 7 -- Port C Data Direction Register DDRC : Unsigned_8; for DDRC'Address use System'To_Address (16#27#); DDRC_DDC0: constant := 1; -- Port C Data Direction Register bit 0 DDRC_DDC1: constant := 2; -- Port C Data Direction Register bit 1 DDRC_DDC2: constant := 4; -- Port C Data Direction Register bit 2 DDRC_DDC3: constant := 8; -- Port C Data Direction Register bit 3 DDRC_DDC4: constant := 16; -- Port C Data Direction Register bit 4 DDRC_DDC5: constant := 32; -- Port C Data Direction Register bit 5 DDRC_DDC6: constant := 64; -- Port C Data Direction Register bit 6 DDRC_DDC7: constant := 128; -- Port C Data Direction Register bit 7 -- Port C Input Pins PINC : Unsigned_8; for PINC'Address use System'To_Address (16#26#); PINC_PINC0: constant := 1; -- Port C Input Pins bit 0 PINC_PINC1: constant := 2; -- Port C Input Pins bit 1 PINC_PINC2: constant := 4; -- Port C Input Pins bit 2 PINC_PINC3: constant := 8; -- Port C Input Pins bit 3 PINC_PINC4: constant := 16; -- Port C Input Pins bit 4 PINC_PINC5: constant := 32; -- Port C Input Pins bit 5 PINC_PINC6: constant := 64; -- Port C Input Pins bit 6 PINC_PINC7: constant := 128; -- Port C Input Pins bit 7 -- Port D Data Register PORTD : Unsigned_8; for PORTD'Address use System'To_Address (16#2B#); PORTD_PORTD0: constant := 1; -- Port D Data Register bit 0 PORTD_PORTD1: constant := 2; -- Port D Data Register bit 1 PORTD_PORTD2: constant := 4; -- Port D Data Register bit 2 PORTD_PORTD3: constant := 8; -- Port D Data Register bit 3 PORTD_PORTD4: constant := 16; -- Port D Data Register bit 4 PORTD_PORTD5: constant := 32; -- Port D Data Register bit 5 PORTD_PORTD6: constant := 64; -- Port D Data Register bit 6 PORTD_PORTD7: constant := 128; -- Port D Data Register bit 7 -- Port D Data Direction Register DDRD : Unsigned_8; for DDRD'Address use System'To_Address (16#2A#); DDRD_DDD0: constant := 1; -- Port D Data Direction Register bit 0 DDRD_DDD1: constant := 2; -- Port D Data Direction Register bit 1 DDRD_DDD2: constant := 4; -- Port D Data Direction Register bit 2 DDRD_DDD3: constant := 8; -- Port D Data Direction Register bit 3 DDRD_DDD4: constant := 16; -- Port D Data Direction Register bit 4 DDRD_DDD5: constant := 32; -- Port D Data Direction Register bit 5 DDRD_DDD6: constant := 64; -- Port D Data Direction Register bit 6 DDRD_DDD7: constant := 128; -- Port D Data Direction Register bit 7 -- Port D Input Pins PIND : Unsigned_8; for PIND'Address use System'To_Address (16#29#); PIND_PIND0: constant := 1; -- Port D Input Pins bit 0 PIND_PIND1: constant := 2; -- Port D Input Pins bit 1 PIND_PIND2: constant := 4; -- Port D Input Pins bit 2 PIND_PIND3: constant := 8; -- Port D Input Pins bit 3 PIND_PIND4: constant := 16; -- Port D Input Pins bit 4 PIND_PIND5: constant := 32; -- Port D Input Pins bit 5 PIND_PIND6: constant := 64; -- Port D Input Pins bit 6 PIND_PIND7: constant := 128; -- Port D Input Pins bit 7 -- Data Register, Port E PORTE : Unsigned_8; for PORTE'Address use System'To_Address (16#2E#); PORTE_PORTE0: constant := 1; PORTE_PORTE1: constant := 2; PORTE_PORTE2: constant := 4; PORTE_PORTE3: constant := 8; PORTE_PORTE4: constant := 16; PORTE_PORTE5: constant := 32; PORTE_PORTE6: constant := 64; PORTE_PORTE7: constant := 128; -- Data Direction Register, Port E DDRE : Unsigned_8; for DDRE'Address use System'To_Address (16#2D#); DDRE_DDE0: constant := 1; DDRE_DDE1: constant := 2; DDRE_DDE2: constant := 4; DDRE_DDE3: constant := 8; DDRE_DDE4: constant := 16; DDRE_DDE5: constant := 32; DDRE_DDE6: constant := 64; DDRE_DDE7: constant := 128; -- Input Pins, Port E PINE : Unsigned_8; for PINE'Address use System'To_Address (16#2C#); PINE_PINE0: constant := 1; PINE_PINE1: constant := 2; PINE_PINE2: constant := 4; PINE_PINE3: constant := 8; PINE_PINE4: constant := 16; PINE_PINE5: constant := 32; PINE_PINE6: constant := 64; PINE_PINE7: constant := 128; -- Data Register, Port F PORTF : Unsigned_8; for PORTF'Address use System'To_Address (16#31#); PORTF_PORTF0: constant := 1; PORTF_PORTF1: constant := 2; PORTF_PORTF2: constant := 4; PORTF_PORTF3: constant := 8; PORTF_PORTF4: constant := 16; PORTF_PORTF5: constant := 32; PORTF_PORTF6: constant := 64; PORTF_PORTF7: constant := 128; -- Data Direction Register, Port F DDRF : Unsigned_8; for DDRF'Address use System'To_Address (16#30#); DDRF_DDF0: constant := 1; DDRF_DDF1: constant := 2; DDRF_DDF2: constant := 4; DDRF_DDF3: constant := 8; DDRF_DDF4: constant := 16; DDRF_DDF5: constant := 32; DDRF_DDF6: constant := 64; DDRF_DDF7: constant := 128; -- Input Pins, Port F PINF : Unsigned_8; for PINF'Address use System'To_Address (16#2F#); PINF_PINF0: constant := 1; PINF_PINF1: constant := 2; PINF_PINF2: constant := 4; PINF_PINF3: constant := 8; PINF_PINF4: constant := 16; PINF_PINF5: constant := 32; PINF_PINF6: constant := 64; PINF_PINF7: constant := 128; -- Data Register, Port G PORTG : Unsigned_8; for PORTG'Address use System'To_Address (16#34#); PORTG_PORTG0: constant := 1; PORTG_PORTG1: constant := 2; PORTG_PORTG2: constant := 4; PORTG_PORTG3: constant := 8; PORTG_PORTG4: constant := 16; PORTG_PORTG5: constant := 32; -- Data Direction Register, Port G DDRG : Unsigned_8; for DDRG'Address use System'To_Address (16#33#); DDRG_DDG0: constant := 1; DDRG_DDG1: constant := 2; DDRG_DDG2: constant := 4; DDRG_DDG3: constant := 8; DDRG_DDG4: constant := 16; DDRG_DDG5: constant := 32; -- Input Pins, Port G PING : Unsigned_8; for PING'Address use System'To_Address (16#32#); PING_PING0: constant := 1; PING_PING1: constant := 2; PING_PING2: constant := 4; PING_PING3: constant := 8; PING_PING4: constant := 16; PING_PING5: constant := 32; -- PORT H Data Register PORTH : Unsigned_8; for PORTH'Address use System'To_Address (16#102#); PORTH_PORTH0: constant := 1; -- PORT H Data Register bit 0 PORTH_PORTH1: constant := 2; -- PORT H Data Register bit 1 PORTH_PORTH2: constant := 4; -- PORT H Data Register bit 2 PORTH_PORTH3: constant := 8; -- PORT H Data Register bit 3 PORTH_PORTH4: constant := 16; -- PORT H Data Register bit 4 PORTH_PORTH5: constant := 32; -- PORT H Data Register bit 5 PORTH_PORTH6: constant := 64; -- PORT H Data Register bit 6 PORTH_PORTH7: constant := 128; -- PORT H Data Register bit 7 -- PORT H Data Direction Register DDRH : Unsigned_8; for DDRH'Address use System'To_Address (16#101#); DDRH_DDH0: constant := 1; -- PORT H Data Direction Register bit 0 DDRH_DDH1: constant := 2; -- PORT H Data Direction Register bit 1 DDRH_DDH2: constant := 4; -- PORT H Data Direction Register bit 2 DDRH_DDH3: constant := 8; -- PORT H Data Direction Register bit 3 DDRH_DDH4: constant := 16; -- PORT H Data Direction Register bit 4 DDRH_DDH5: constant := 32; -- PORT H Data Direction Register bit 5 DDRH_DDH6: constant := 64; -- PORT H Data Direction Register bit 6 DDRH_DDH7: constant := 128; -- PORT H Data Direction Register bit 7 -- PORT H Input Pins PINH : Unsigned_8; for PINH'Address use System'To_Address (16#100#); PINH_PINH0: constant := 1; -- PORT H Input Pins bit 0 PINH_PINH1: constant := 2; -- PORT H Input Pins bit 1 PINH_PINH2: constant := 4; -- PORT H Input Pins bit 2 PINH_PINH3: constant := 8; -- PORT H Input Pins bit 3 PINH_PINH4: constant := 16; -- PORT H Input Pins bit 4 PINH_PINH5: constant := 32; -- PORT H Input Pins bit 5 PINH_PINH6: constant := 64; -- PORT H Input Pins bit 6 PINH_PINH7: constant := 128; -- PORT H Input Pins bit 7 -- PORT J Data Register PORTJ : Unsigned_8; for PORTJ'Address use System'To_Address (16#105#); PORTJ_PORTJ0: constant := 1; -- PORT J Data Register bit 0 PORTJ_PORTJ1: constant := 2; -- PORT J Data Register bit 1 PORTJ_PORTJ2: constant := 4; -- PORT J Data Register bit 2 PORTJ_PORTJ3: constant := 8; -- PORT J Data Register bit 3 PORTJ_PORTJ4: constant := 16; -- PORT J Data Register bit 4 PORTJ_PORTJ5: constant := 32; -- PORT J Data Register bit 5 PORTJ_PORTJ6: constant := 64; -- PORT J Data Register bit 6 PORTJ_PORTJ7: constant := 128; -- PORT J Data Register bit 7 -- PORT J Data Direction Register DDRJ : Unsigned_8; for DDRJ'Address use System'To_Address (16#104#); DDRJ_DDJ0: constant := 1; -- PORT J Data Direction Register bit 0 DDRJ_DDJ1: constant := 2; -- PORT J Data Direction Register bit 1 DDRJ_DDJ2: constant := 4; -- PORT J Data Direction Register bit 2 DDRJ_DDJ3: constant := 8; -- PORT J Data Direction Register bit 3 DDRJ_DDJ4: constant := 16; -- PORT J Data Direction Register bit 4 DDRJ_DDJ5: constant := 32; -- PORT J Data Direction Register bit 5 DDRJ_DDJ6: constant := 64; -- PORT J Data Direction Register bit 6 DDRJ_DDJ7: constant := 128; -- PORT J Data Direction Register bit 7 -- PORT J Input Pins PINJ : Unsigned_8; for PINJ'Address use System'To_Address (16#103#); PINJ_PINJ0: constant := 1; -- PORT J Input Pins bit 0 PINJ_PINJ1: constant := 2; -- PORT J Input Pins bit 1 PINJ_PINJ2: constant := 4; -- PORT J Input Pins bit 2 PINJ_PINJ3: constant := 8; -- PORT J Input Pins bit 3 PINJ_PINJ4: constant := 16; -- PORT J Input Pins bit 4 PINJ_PINJ5: constant := 32; -- PORT J Input Pins bit 5 PINJ_PINJ6: constant := 64; -- PORT J Input Pins bit 6 PINJ_PINJ7: constant := 128; -- PORT J Input Pins bit 7 -- PORT K Data Register PORTK : Unsigned_8; for PORTK'Address use System'To_Address (16#108#); PORTK_PORTK0: constant := 1; -- PORT K Data Register bit 0 PORTK_PORTK1: constant := 2; -- PORT K Data Register bit 1 PORTK_PORTK2: constant := 4; -- PORT K Data Register bit 2 PORTK_PORTK3: constant := 8; -- PORT K Data Register bit 3 PORTK_PORTK4: constant := 16; -- PORT K Data Register bit 4 PORTK_PORTK5: constant := 32; -- PORT K Data Register bit 5 PORTK_PORTK6: constant := 64; -- PORT K Data Register bit 6 PORTK_PORTK7: constant := 128; -- PORT K Data Register bit 7 -- PORT K Data Direction Register DDRK : Unsigned_8; for DDRK'Address use System'To_Address (16#107#); DDRK_DDK0: constant := 1; -- PORT K Data Direction Register bit 0 DDRK_DDK1: constant := 2; -- PORT K Data Direction Register bit 1 DDRK_DDK2: constant := 4; -- PORT K Data Direction Register bit 2 DDRK_DDK3: constant := 8; -- PORT K Data Direction Register bit 3 DDRK_DDK4: constant := 16; -- PORT K Data Direction Register bit 4 DDRK_DDK5: constant := 32; -- PORT K Data Direction Register bit 5 DDRK_DDK6: constant := 64; -- PORT K Data Direction Register bit 6 DDRK_DDK7: constant := 128; -- PORT K Data Direction Register bit 7 -- PORT K Input Pins PINK : Unsigned_8; for PINK'Address use System'To_Address (16#106#); PINK_PINK0: constant := 1; -- PORT K Input Pins bit 0 PINK_PINK1: constant := 2; -- PORT K Input Pins bit 1 PINK_PINK2: constant := 4; -- PORT K Input Pins bit 2 PINK_PINK3: constant := 8; -- PORT K Input Pins bit 3 PINK_PINK4: constant := 16; -- PORT K Input Pins bit 4 PINK_PINK5: constant := 32; -- PORT K Input Pins bit 5 PINK_PINK6: constant := 64; -- PORT K Input Pins bit 6 PINK_PINK7: constant := 128; -- PORT K Input Pins bit 7 -- PORT L Data Register PORTL : Unsigned_8; for PORTL'Address use System'To_Address (16#10B#); PORTL_PORTL0: constant := 1; -- PORT L Data Register bit 0 PORTL_PORTL1: constant := 2; -- PORT L Data Register bit 1 PORTL_PORTL2: constant := 4; -- PORT L Data Register bit 2 PORTL_PORTL3: constant := 8; -- PORT L Data Register bit 3 PORTL_PORTL4: constant := 16; -- PORT L Data Register bit 4 PORTL_PORTL5: constant := 32; -- PORT L Data Register bit 5 PORTL_PORTL6: constant := 64; -- PORT L Data Register bit 6 PORTL_PORTL7: constant := 128; -- PORT L Data Register bit 7 -- PORT L Data Direction Register DDRL : Unsigned_8; for DDRL'Address use System'To_Address (16#10A#); DDRL_DDL0: constant := 1; -- PORT L Data Direction Register bit 0 DDRL_DDL1: constant := 2; -- PORT L Data Direction Register bit 1 DDRL_DDL2: constant := 4; -- PORT L Data Direction Register bit 2 DDRL_DDL3: constant := 8; -- PORT L Data Direction Register bit 3 DDRL_DDL4: constant := 16; -- PORT L Data Direction Register bit 4 DDRL_DDL5: constant := 32; -- PORT L Data Direction Register bit 5 DDRL_DDL6: constant := 64; -- PORT L Data Direction Register bit 6 DDRL_DDL7: constant := 128; -- PORT L Data Direction Register bit 7 -- PORT L Input Pins PINL : Unsigned_8; for PINL'Address use System'To_Address (16#109#); PINL_PINL0: constant := 1; -- PORT L Input Pins bit 0 PINL_PINL1: constant := 2; -- PORT L Input Pins bit 1 PINL_PINL2: constant := 4; -- PORT L Input Pins bit 2 PINL_PINL3: constant := 8; -- PORT L Input Pins bit 3 PINL_PINL4: constant := 16; -- PORT L Input Pins bit 4 PINL_PINL5: constant := 32; -- PORT L Input Pins bit 5 PINL_PINL6: constant := 64; -- PORT L Input Pins bit 6 PINL_PINL7: constant := 128; -- PORT L Input Pins bit 7 -- Timer/Counter0 Output Compare Register OCR0B : Unsigned_8; for OCR0B'Address use System'To_Address (16#48#); OCR0B_OCR0B_0: constant := 1; OCR0B_OCR0B_1: constant := 2; OCR0B_OCR0B_2: constant := 4; OCR0B_OCR0B_3: constant := 8; OCR0B_OCR0B_4: constant := 16; OCR0B_OCR0B_5: constant := 32; OCR0B_OCR0B_6: constant := 64; OCR0B_OCR0B_7: constant := 128; -- Timer/Counter0 Output Compare Register OCR0A : Unsigned_8; for OCR0A'Address use System'To_Address (16#47#); OCR0A_OCROA_0: constant := 1; OCR0A_OCROA_1: constant := 2; OCR0A_OCROA_2: constant := 4; OCR0A_OCROA_3: constant := 8; OCR0A_OCROA_4: constant := 16; OCR0A_OCROA_5: constant := 32; OCR0A_OCROA_6: constant := 64; OCR0A_OCROA_7: constant := 128; -- Timer/Counter0 TCNT0 : Unsigned_8; for TCNT0'Address use System'To_Address (16#46#); TCNT0_TCNT0_0: constant := 1; TCNT0_TCNT0_1: constant := 2; TCNT0_TCNT0_2: constant := 4; TCNT0_TCNT0_3: constant := 8; TCNT0_TCNT0_4: constant := 16; TCNT0_TCNT0_5: constant := 32; TCNT0_TCNT0_6: constant := 64; TCNT0_TCNT0_7: constant := 128; -- Timer/Counter Control Register B TCCR0B : Unsigned_8; for TCCR0B'Address use System'To_Address (16#45#); TCCR0B_CS00: constant := 1; -- Clock Select TCCR0B_CS01: constant := 2; -- Clock Select TCCR0B_CS02: constant := 4; -- Clock Select TCCR0B_WGM02: constant := 8; TCCR0B_FOC0B: constant := 64; -- Force Output Compare B TCCR0B_FOC0A: constant := 128; -- Force Output Compare A -- Timer/Counter Control Register A TCCR0A : Unsigned_8; for TCCR0A'Address use System'To_Address (16#44#); TCCR0A_WGM00: constant := 1; -- Waveform Generation Mode TCCR0A_WGM01: constant := 2; -- Waveform Generation Mode TCCR0A_COM0B0: constant := 16; -- Compare Output Mode, Fast PWm TCCR0A_COM0B1: constant := 32; -- Compare Output Mode, Fast PWm TCCR0A_COM0A0: constant := 64; -- Compare Output Mode, Phase Correct PWM Mode TCCR0A_COM0A1: constant := 128; -- Compare Output Mode, Phase Correct PWM Mode -- Timer/Counter0 Interrupt Mask Register TIMSK0 : Unsigned_8; for TIMSK0'Address use System'To_Address (16#6E#); TIMSK0_TOIE0: constant := 1; -- Timer/Counter0 Overflow Interrupt Enable TIMSK0_OCIE0A: constant := 2; -- Timer/Counter0 Output Compare Match A Interrupt Enable TIMSK0_OCIE0B: constant := 4; -- Timer/Counter0 Output Compare Match B Interrupt Enable -- Timer/Counter0 Interrupt Flag register TIFR0 : Unsigned_8; for TIFR0'Address use System'To_Address (16#35#); TIFR0_TOV0: constant := 1; -- Timer/Counter0 Overflow Flag TIFR0_OCF0A: constant := 2; -- Timer/Counter0 Output Compare Flag 0A TIFR0_OCF0B: constant := 4; -- Timer/Counter0 Output Compare Flag 0B -- General Timer/Counter Control Register GTCCR : Unsigned_8; for GTCCR'Address use System'To_Address (16#43#); GTCCR_PSRSYNC: constant := 1; -- Prescaler Reset Timer/Counter1 and Timer/Counter0 GTCCR_TSM: constant := 128; -- Timer/Counter Synchronization Mode -- Timer/Counter Interrupt Mask register TIMSK2 : Unsigned_8; for TIMSK2'Address use System'To_Address (16#70#); TIMSK2_TOIE2: constant := 1; -- Timer/Counter2 Overflow Interrupt Enable TIMSK2_OCIE2A: constant := 2; -- Timer/Counter2 Output Compare Match A Interrupt Enable TIMSK2_OCIE2B: constant := 4; -- Timer/Counter2 Output Compare Match B Interrupt Enable -- Timer/Counter Interrupt Flag Register TIFR2 : Unsigned_8; for TIFR2'Address use System'To_Address (16#37#); TIFR2_TOV2: constant := 1; -- Timer/Counter2 Overflow Flag TIFR2_OCF2A: constant := 2; -- Output Compare Flag 2A TIFR2_OCF2B: constant := 4; -- Output Compare Flag 2B -- Timer/Counter2 Control Register A TCCR2A : Unsigned_8; for TCCR2A'Address use System'To_Address (16#B0#); TCCR2A_WGM20: constant := 1; -- Waveform Genration Mode TCCR2A_WGM21: constant := 2; -- Waveform Genration Mode TCCR2A_COM2B0: constant := 16; -- Compare Output Mode bit 0 TCCR2A_COM2B1: constant := 32; -- Compare Output Mode bit 1 TCCR2A_COM2A0: constant := 64; -- Compare Output Mode bit 1 TCCR2A_COM2A1: constant := 128; -- Compare Output Mode bit 1 -- Timer/Counter2 Control Register B TCCR2B : Unsigned_8; for TCCR2B'Address use System'To_Address (16#B1#); TCCR2B_CS20: constant := 1; -- Clock Select bit 0 TCCR2B_CS21: constant := 2; -- Clock Select bit 1 TCCR2B_CS22: constant := 4; -- Clock Select bit 2 TCCR2B_WGM22: constant := 8; -- Waveform Generation Mode TCCR2B_FOC2B: constant := 64; -- Force Output Compare B TCCR2B_FOC2A: constant := 128; -- Force Output Compare A -- Timer/Counter2 TCNT2 : Unsigned_8; for TCNT2'Address use System'To_Address (16#B2#); -- Timer/Counter2 Output Compare Register B OCR2B : Unsigned_8; for OCR2B'Address use System'To_Address (16#B4#); -- Timer/Counter2 Output Compare Register A OCR2A : Unsigned_8; for OCR2A'Address use System'To_Address (16#B3#); -- Asynchronous Status Register ASSR : Unsigned_8; for ASSR'Address use System'To_Address (16#B6#); ASSR_TCR2BUB: constant := 1; -- Timer/Counter Control Register2 Update Busy ASSR_TCR2AUB: constant := 2; -- Timer/Counter Control Register2 Update Busy ASSR_OCR2BUB: constant := 4; -- Output Compare Register 2 Update Busy ASSR_OCR2AUB: constant := 8; -- Output Compare Register2 Update Busy ASSR_TCN2UB: constant := 16; -- Timer/Counter2 Update Busy ASSR_AS2: constant := 32; -- Asynchronous Timer/Counter2 ASSR_EXCLK: constant := 64; -- Enable External Clock Input -- General Timer Counter Control register -- Watchdog Timer Control Register WDTCSR : Unsigned_8; for WDTCSR'Address use System'To_Address (16#60#); WDTCSR_WDP0: constant := 1; -- Watch Dog Timer Prescaler bit 0 WDTCSR_WDP1: constant := 2; -- Watch Dog Timer Prescaler bit 1 WDTCSR_WDP2: constant := 4; -- Watch Dog Timer Prescaler bit 2 WDTCSR_WDE: constant := 8; -- Watch Dog Enable WDTCSR_WDCE: constant := 16; -- Watchdog Change Enable WDTCSR_WDP3: constant := 32; -- Watchdog Timer Prescaler Bit 3 WDTCSR_WDIE: constant := 64; -- Watchdog Timeout Interrupt Enable WDTCSR_WDIF: constant := 128; -- Watchdog Timeout Interrupt Flag -- USART I/O Data Register UDR1 : Unsigned_8; for UDR1'Address use System'To_Address (16#CE#); -- USART Control and Status Register A UCSR1A : Unsigned_8; for UCSR1A'Address use System'To_Address (16#C8#); UCSR1A_MPCM1: constant := 1; -- Multi-processor Communication Mode UCSR1A_U2X1: constant := 2; -- Double the USART transmission speed UCSR1A_UPE1: constant := 4; -- Parity Error UCSR1A_DOR1: constant := 8; -- Data overRun UCSR1A_FE1: constant := 16; -- Framing Error UCSR1A_UDRE1: constant := 32; -- USART Data Register Empty UCSR1A_TXC1: constant := 64; -- USART Transmitt Complete UCSR1A_RXC1: constant := 128; -- USART Receive Complete -- USART Control and Status Register B UCSR1B : Unsigned_8; for UCSR1B'Address use System'To_Address (16#C9#); UCSR1B_TXB81: constant := 1; -- Transmit Data Bit 8 UCSR1B_RXB81: constant := 2; -- Receive Data Bit 8 UCSR1B_UCSZ12: constant := 4; -- Character Size UCSR1B_TXEN1: constant := 8; -- Transmitter Enable UCSR1B_RXEN1: constant := 16; -- Receiver Enable UCSR1B_UDRIE1: constant := 32; -- USART Data register Empty Interrupt Enable UCSR1B_TXCIE1: constant := 64; -- TX Complete Interrupt Enable UCSR1B_RXCIE1: constant := 128; -- RX Complete Interrupt Enable -- USART Control and Status Register C UCSR1C : Unsigned_8; for UCSR1C'Address use System'To_Address (16#CA#); UCSR1C_UCPOL1: constant := 1; -- Clock Polarity UCSR1C_UCSZ10: constant := 2; -- Character Size UCSR1C_UCSZ11: constant := 4; -- Character Size UCSR1C_USBS1: constant := 8; -- Stop Bit Select UCSR1C_UPM10: constant := 16; -- Parity Mode Bit 0 UCSR1C_UPM11: constant := 32; -- Parity Mode Bit 1 UCSR1C_UMSEL10: constant := 64; -- USART Mode Select UCSR1C_UMSEL11: constant := 128; -- USART Mode Select -- USART Baud Rate Register High Byte UBRR1H : Unsigned_8; for UBRR1H'Address use System'To_Address (16#CD#); UBRR1H_UBRR8: constant := 1; -- USART Baud Rate Register bit 8 UBRR1H_UBRR9: constant := 2; -- USART Baud Rate Register bit 9 UBRR1H_UBRR10: constant := 4; -- USART Baud Rate Register bit 10 UBRR1H_UBRR11: constant := 8; -- USART Baud Rate Register bit 11 -- USART Baud Rate Register Low Byte UBRR1L : Unsigned_8; for UBRR1L'Address use System'To_Address (16#CC#); UBRR1L_UBRR0: constant := 1; -- USART Baud Rate Register bit 0 UBRR1L_UBRR1: constant := 2; -- USART Baud Rate Register bit 1 UBRR1L_UBRR2: constant := 4; -- USART Baud Rate Register bit 2 UBRR1L_UBRR3: constant := 8; -- USART Baud Rate Register bit 3 UBRR1L_UBRR4: constant := 16; -- USART Baud Rate Register bit 4 UBRR1L_UBRR5: constant := 32; -- USART Baud Rate Register bit 5 UBRR1L_UBRR6: constant := 64; -- USART Baud Rate Register bit 6 UBRR1L_UBRR7: constant := 128; -- USART Baud Rate Register bit 7 -- EEPROM Address Register Low Byte EEARH : Unsigned_8; for EEARH'Address use System'To_Address (16#42#); EEARH_EEAR8: constant := 1; -- EEPROM Read/Write Access Bit 8 EEARH_EEAR9: constant := 2; -- EEPROM Read/Write Access Bit 9 EEARH_EEAR10: constant := 4; -- EEPROM Read/Write Access Bit 10 EEARH_EEAR11: constant := 8; -- EEPROM Read/Write Access Bit 11 -- EEPROM Address Register Low Byte EEARL : Unsigned_8; for EEARL'Address use System'To_Address (16#41#); EEARL_EEAR0: constant := 1; -- EEPROM Read/Write Access Bit 0 EEARL_EEAR1: constant := 2; -- EEPROM Read/Write Access Bit 1 EEARL_EEAR2: constant := 4; -- EEPROM Read/Write Access Bit 2 EEARL_EEAR3: constant := 8; -- EEPROM Read/Write Access Bit 3 EEARL_EEAR4: constant := 16; -- EEPROM Read/Write Access Bit 4 EEARL_EEAR5: constant := 32; -- EEPROM Read/Write Access Bit 5 EEARL_EEAR6: constant := 64; -- EEPROM Read/Write Access Bit 6 EEARL_EEAR7: constant := 128; -- EEPROM Read/Write Access Bit 7 -- EEPROM Data Register EEDR : Unsigned_8; for EEDR'Address use System'To_Address (16#40#); EEDR_EEDR0: constant := 1; -- EEPROM Data Register bit 0 EEDR_EEDR1: constant := 2; -- EEPROM Data Register bit 1 EEDR_EEDR2: constant := 4; -- EEPROM Data Register bit 2 EEDR_EEDR3: constant := 8; -- EEPROM Data Register bit 3 EEDR_EEDR4: constant := 16; -- EEPROM Data Register bit 4 EEDR_EEDR5: constant := 32; -- EEPROM Data Register bit 5 EEDR_EEDR6: constant := 64; -- EEPROM Data Register bit 6 EEDR_EEDR7: constant := 128; -- EEPROM Data Register bit 7 -- EEPROM Control Register EECR : Unsigned_8; for EECR'Address use System'To_Address (16#3F#); EECR_EERE: constant := 1; -- EEPROM Read Enable EECR_EEPE: constant := 2; -- EEPROM Write Enable EECR_EEMPE: constant := 4; -- EEPROM Master Write Enable EECR_EERIE: constant := 8; -- EEPROM Ready Interrupt Enable EECR_EEPM0: constant := 16; -- EEPROM Programming Mode Bit 0 EECR_EEPM1: constant := 32; -- EEPROM Programming Mode Bit 1 -- Timer/Counter5 Control Register A TCCR5A : Unsigned_8; for TCCR5A'Address use System'To_Address (16#120#); TCCR5A_WGM50: constant := 1; -- Waveform Generation Mode TCCR5A_WGM51: constant := 2; -- Waveform Generation Mode TCCR5A_COM5C0: constant := 4; -- Compare Output Mode 5C, bit 0 TCCR5A_COM5C1: constant := 8; -- Compare Output Mode 5C, bit 1 TCCR5A_COM5B0: constant := 16; -- Compare Output Mode 5B, bit 0 TCCR5A_COM5B1: constant := 32; -- Compare Output Mode 5B, bit 1 TCCR5A_COM5A0: constant := 64; -- Compare Output Mode 5A, bit 0 TCCR5A_COM5A1: constant := 128; -- Compare Output Mode 1A, bit 1 -- Timer/Counter5 Control Register B TCCR5B : Unsigned_8; for TCCR5B'Address use System'To_Address (16#121#); TCCR5B_CS50: constant := 1; -- Prescaler source of Timer/Counter 5 TCCR5B_CS51: constant := 2; -- Prescaler source of Timer/Counter 5 TCCR5B_CS52: constant := 4; -- Prescaler source of Timer/Counter 5 TCCR5B_WGM52: constant := 8; -- Waveform Generation Mode TCCR5B_WGM53: constant := 16; -- Waveform Generation Mode TCCR5B_ICES5: constant := 64; -- Input Capture 5 Edge Select TCCR5B_ICNC5: constant := 128; -- Input Capture 5 Noise Canceler -- Timer/Counter 5 Control Register C TCCR5C : Unsigned_8; for TCCR5C'Address use System'To_Address (16#122#); TCCR5C_FOC5C: constant := 32; -- Force Output Compare 5C TCCR5C_FOC5B: constant := 64; -- Force Output Compare 5B TCCR5C_FOC5A: constant := 128; -- Force Output Compare 5A -- Timer/Counter5 High Byte TCNT5H : Unsigned_8; for TCNT5H'Address use System'To_Address (16#125#); TCNT5H_TCNT5H0: constant := 1; -- Timer/Counter5 High Byte bit 0 TCNT5H_TCNT5H1: constant := 2; -- Timer/Counter5 High Byte bit 1 TCNT5H_TCNT5H2: constant := 4; -- Timer/Counter5 High Byte bit 2 TCNT5H_TCNT5H3: constant := 8; -- Timer/Counter5 High Byte bit 3 TCNT5H_TCNT5H4: constant := 16; -- Timer/Counter5 High Byte bit 4 TCNT5H_TCNT5H5: constant := 32; -- Timer/Counter5 High Byte bit 5 TCNT5H_TCNT5H6: constant := 64; -- Timer/Counter5 High Byte bit 6 TCNT5H_TCNT5H7: constant := 128; -- Timer/Counter5 High Byte bit 7 -- Timer/Counter5 Low Byte TCNT5L : Unsigned_8; for TCNT5L'Address use System'To_Address (16#124#); TCNT5L_TCNT5L0: constant := 1; -- Timer/Counter5 Low Byte bit 0 TCNT5L_TCNT5L1: constant := 2; -- Timer/Counter5 Low Byte bit 1 TCNT5L_TCNT5L2: constant := 4; -- Timer/Counter5 Low Byte bit 2 TCNT5L_TCNT5L3: constant := 8; -- Timer/Counter5 Low Byte bit 3 TCNT5L_TCNT5L4: constant := 16; -- Timer/Counter5 Low Byte bit 4 TCNT5L_TCNT5L5: constant := 32; -- Timer/Counter5 Low Byte bit 5 TCNT5L_TCNT5L6: constant := 64; -- Timer/Counter5 Low Byte bit 6 TCNT5L_TCNT5L7: constant := 128; -- Timer/Counter5 Low Byte bit 7 -- Timer/Counter5 Outbut Compare Register A High Byte OCR5AH : Unsigned_8; for OCR5AH'Address use System'To_Address (16#129#); OCR5AH_OCR5AH0: constant := 1; -- Timer/Counter5 Outbut Compare Register High Byte bit 0 OCR5AH_OCR5AH1: constant := 2; -- Timer/Counter5 Outbut Compare Register High Byte bit 1 OCR5AH_OCR5AH2: constant := 4; -- Timer/Counter5 Outbut Compare Register High Byte bit 2 OCR5AH_OCR5AH3: constant := 8; -- Timer/Counter5 Outbut Compare Register High Byte bit 3 OCR5AH_OCR5AH4: constant := 16; -- Timer/Counter5 Outbut Compare Register High Byte bit 4 OCR5AH_OCR5AH5: constant := 32; -- Timer/Counter5 Outbut Compare Register High Byte bit 5 OCR5AH_OCR5AH6: constant := 64; -- Timer/Counter5 Outbut Compare Register High Byte bit 6 OCR5AH_OCR5AH7: constant := 128; -- Timer/Counter5 Outbut Compare Register High Byte bit 7 -- Timer/Counter5 Outbut Compare Register A Low Byte OCR5AL : Unsigned_8; for OCR5AL'Address use System'To_Address (16#128#); OCR5AL_OCR5AL0: constant := 1; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 0 OCR5AL_OCR5AL1: constant := 2; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 1 OCR5AL_OCR5AL2: constant := 4; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 2 OCR5AL_OCR5AL3: constant := 8; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 3 OCR5AL_OCR5AL4: constant := 16; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 4 OCR5AL_OCR5AL5: constant := 32; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 5 OCR5AL_OCR5AL6: constant := 64; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 6 OCR5AL_OCR5AL7: constant := 128; -- Timer/Counter5 Outbut Compare Register Low Byte Bit 7 -- Timer/Counter5 Output Compare Register B High Byte OCR5BH : Unsigned_8; for OCR5BH'Address use System'To_Address (16#12B#); OCR5BH_OCR5BH0: constant := 1; -- Timer/Counter5 Output Compare Register High Byte bit 0 OCR5BH_OCR5BH1: constant := 2; -- Timer/Counter5 Output Compare Register High Byte bit 1 OCR5BH_OCR5BH2: constant := 4; -- Timer/Counter5 Output Compare Register High Byte bit 2 OCR5BH_OCR5BH3: constant := 8; -- Timer/Counter5 Output Compare Register High Byte bit 3 OCR5BH_OCR5BH4: constant := 16; -- Timer/Counter5 Output Compare Register High Byte bit 4 OCR5BH_OCR5BH5: constant := 32; -- Timer/Counter5 Output Compare Register High Byte bit 5 OCR5BH_OCR5BH6: constant := 64; -- Timer/Counter5 Output Compare Register High Byte bit 6 OCR5BH_OCR5BH7: constant := 128; -- Timer/Counter5 Output Compare Register High Byte bit 7 -- Timer/Counter5 Output Compare Register B Low Byte OCR5BL : Unsigned_8; for OCR5BL'Address use System'To_Address (16#12A#); OCR5BL_OCR5BL0: constant := 1; -- Timer/Counter5 Output Compare Register Low Byte bit 0 OCR5BL_OCR5BL1: constant := 2; -- Timer/Counter5 Output Compare Register Low Byte bit 1 OCR5BL_OCR5BL2: constant := 4; -- Timer/Counter5 Output Compare Register Low Byte bit 2 OCR5BL_OCR5BL3: constant := 8; -- Timer/Counter5 Output Compare Register Low Byte bit 3 OCR5BL_OCR5BL4: constant := 16; -- Timer/Counter5 Output Compare Register Low Byte bit 4 OCR5BL_OCR5BL5: constant := 32; -- Timer/Counter5 Output Compare Register Low Byte bit 5 OCR5BL_OCR5BL6: constant := 64; -- Timer/Counter5 Output Compare Register Low Byte bit 6 OCR5BL_OCR5BL7: constant := 128; -- Timer/Counter5 Output Compare Register Low Byte bit 7 -- Timer/Counter5 Output Compare Register B High Byte OCR5CH : Unsigned_8; for OCR5CH'Address use System'To_Address (16#12D#); OCR5CH_OCR5CH0: constant := 1; -- Timer/Counter5 Output Compare Register High Byte bit 0 OCR5CH_OCR5CH1: constant := 2; -- Timer/Counter5 Output Compare Register High Byte bit 1 OCR5CH_OCR5CH2: constant := 4; -- Timer/Counter5 Output Compare Register High Byte bit 2 OCR5CH_OCR5CH3: constant := 8; -- Timer/Counter5 Output Compare Register High Byte bit 3 OCR5CH_OCR5CH4: constant := 16; -- Timer/Counter5 Output Compare Register High Byte bit 4 OCR5CH_OCR5CH5: constant := 32; -- Timer/Counter5 Output Compare Register High Byte bit 5 OCR5CH_OCR5CH6: constant := 64; -- Timer/Counter5 Output Compare Register High Byte bit 6 OCR5CH_OCR5CH7: constant := 128; -- Timer/Counter5 Output Compare Register High Byte bit 7 -- Timer/Counter5 Output Compare Register B Low Byte OCR5CL : Unsigned_8; for OCR5CL'Address use System'To_Address (16#12C#); OCR5CL_OCR5CL0: constant := 1; -- Timer/Counter5 Output Compare Register Low Byte bit 0 OCR5CL_OCR5CL1: constant := 2; -- Timer/Counter5 Output Compare Register Low Byte bit 1 OCR5CL_OCR5CL2: constant := 4; -- Timer/Counter5 Output Compare Register Low Byte bit 2 OCR5CL_OCR5CL3: constant := 8; -- Timer/Counter5 Output Compare Register Low Byte bit 3 OCR5CL_OCR5CL4: constant := 16; -- Timer/Counter5 Output Compare Register Low Byte bit 4 OCR5CL_OCR5CL5: constant := 32; -- Timer/Counter5 Output Compare Register Low Byte bit 5 OCR5CL_OCR5CL6: constant := 64; -- Timer/Counter5 Output Compare Register Low Byte bit 6 OCR5CL_OCR5CL7: constant := 128; -- Timer/Counter5 Output Compare Register Low Byte bit 7 -- Timer/Counter5 Input Capture Register High Byte ICR5H : Unsigned_8; for ICR5H'Address use System'To_Address (16#127#); ICR5H_ICR5H0: constant := 1; -- Timer/Counter5 Input Capture Register High Byte bit 0 ICR5H_ICR5H1: constant := 2; -- Timer/Counter5 Input Capture Register High Byte bit 1 ICR5H_ICR5H2: constant := 4; -- Timer/Counter5 Input Capture Register High Byte bit 2 ICR5H_ICR5H3: constant := 8; -- Timer/Counter5 Input Capture Register High Byte bit 3 ICR5H_ICR5H4: constant := 16; -- Timer/Counter5 Input Capture Register High Byte bit 4 ICR5H_ICR5H5: constant := 32; -- Timer/Counter5 Input Capture Register High Byte bit 5 ICR5H_ICR5H6: constant := 64; -- Timer/Counter5 Input Capture Register High Byte bit 6 ICR5H_ICR5H7: constant := 128; -- Timer/Counter5 Input Capture Register High Byte bit 7 -- Timer/Counter5 Input Capture Register Low Byte ICR5L : Unsigned_8; for ICR5L'Address use System'To_Address (16#126#); ICR5L_ICR5L0: constant := 1; -- Timer/Counter5 Input Capture Register Low Byte bit 0 ICR5L_ICR5L1: constant := 2; -- Timer/Counter5 Input Capture Register Low Byte bit 1 ICR5L_ICR5L2: constant := 4; -- Timer/Counter5 Input Capture Register Low Byte bit 2 ICR5L_ICR5L3: constant := 8; -- Timer/Counter5 Input Capture Register Low Byte bit 3 ICR5L_ICR5L4: constant := 16; -- Timer/Counter5 Input Capture Register Low Byte bit 4 ICR5L_ICR5L5: constant := 32; -- Timer/Counter5 Input Capture Register Low Byte bit 5 ICR5L_ICR5L6: constant := 64; -- Timer/Counter5 Input Capture Register Low Byte bit 6 ICR5L_ICR5L7: constant := 128; -- Timer/Counter5 Input Capture Register Low Byte bit 7 -- Timer/Counter5 Interrupt Mask Register TIMSK5 : Unsigned_8; for TIMSK5'Address use System'To_Address (16#73#); TIMSK5_TOIE5: constant := 1; -- Timer/Counter5 Overflow Interrupt Enable TIMSK5_OCIE5A: constant := 2; -- Timer/Counter5 Output Compare A Match Interrupt Enable TIMSK5_OCIE5B: constant := 4; -- Timer/Counter5 Output Compare B Match Interrupt Enable TIMSK5_OCIE5C: constant := 8; -- Timer/Counter5 Output Compare C Match Interrupt Enable TIMSK5_ICIE5: constant := 32; -- Timer/Counter5 Input Capture Interrupt Enable -- Timer/Counter5 Interrupt Flag register TIFR5 : Unsigned_8; for TIFR5'Address use System'To_Address (16#3A#); TIFR5_TOV5: constant := 1; -- Timer/Counter5 Overflow Flag TIFR5_OCF5A: constant := 2; -- Output Compare Flag 5A TIFR5_OCF5B: constant := 4; -- Output Compare Flag 5B TIFR5_OCF5C: constant := 8; -- Output Compare Flag 5C TIFR5_ICF5: constant := 32; -- Input Capture Flag 5 -- Timer/Counter4 Control Register A TCCR4A : Unsigned_8; for TCCR4A'Address use System'To_Address (16#A0#); TCCR4A_WGM40: constant := 1; -- Waveform Generation Mode TCCR4A_WGM41: constant := 2; -- Waveform Generation Mode TCCR4A_COM4C0: constant := 4; -- Compare Output Mode 4C, bit 0 TCCR4A_COM4C1: constant := 8; -- Compare Output Mode 4C, bit 1 TCCR4A_COM4B0: constant := 16; -- Compare Output Mode 4B, bit 0 TCCR4A_COM4B1: constant := 32; -- Compare Output Mode 4B, bit 1 TCCR4A_COM4A0: constant := 64; -- Compare Output Mode 4A, bit 0 TCCR4A_COM4A1: constant := 128; -- Compare Output Mode 1A, bit 1 -- Timer/Counter4 Control Register B TCCR4B : Unsigned_8; for TCCR4B'Address use System'To_Address (16#A1#); TCCR4B_CS40: constant := 1; -- Prescaler source of Timer/Counter 4 TCCR4B_CS41: constant := 2; -- Prescaler source of Timer/Counter 4 TCCR4B_CS42: constant := 4; -- Prescaler source of Timer/Counter 4 TCCR4B_WGM42: constant := 8; -- Waveform Generation Mode TCCR4B_WGM43: constant := 16; -- Waveform Generation Mode TCCR4B_ICES4: constant := 64; -- Input Capture 4 Edge Select TCCR4B_ICNC4: constant := 128; -- Input Capture 4 Noise Canceler -- Timer/Counter 4 Control Register C TCCR4C : Unsigned_8; for TCCR4C'Address use System'To_Address (16#A2#); TCCR4C_FOC4C: constant := 32; -- Force Output Compare 4C TCCR4C_FOC4B: constant := 64; -- Force Output Compare 4B TCCR4C_FOC4A: constant := 128; -- Force Output Compare 4A -- Timer/Counter4 High Byte TCNT4H : Unsigned_8; for TCNT4H'Address use System'To_Address (16#A5#); TCNT4H_TCNT4H0: constant := 1; -- Timer/Counter4 High Byte bit 0 TCNT4H_TCNT4H1: constant := 2; -- Timer/Counter4 High Byte bit 1 TCNT4H_TCNT4H2: constant := 4; -- Timer/Counter4 High Byte bit 2 TCNT4H_TCNT4H3: constant := 8; -- Timer/Counter4 High Byte bit 3 TCNT4H_TCNT4H4: constant := 16; -- Timer/Counter4 High Byte bit 4 TCNT4H_TCNT4H5: constant := 32; -- Timer/Counter4 High Byte bit 5 TCNT4H_TCNT4H6: constant := 64; -- Timer/Counter4 High Byte bit 6 TCNT4H_TCNT4H7: constant := 128; -- Timer/Counter4 High Byte bit 7 -- Timer/Counter4 Low Byte TCNT4L : Unsigned_8; for TCNT4L'Address use System'To_Address (16#A4#); TCNT4L_TCNT4L0: constant := 1; -- Timer/Counter4 Low Byte bit 0 TCNT4L_TCNT4L1: constant := 2; -- Timer/Counter4 Low Byte bit 1 TCNT4L_TCNT4L2: constant := 4; -- Timer/Counter4 Low Byte bit 2 TCNT4L_TCNT4L3: constant := 8; -- Timer/Counter4 Low Byte bit 3 TCNT4L_TCNT4L4: constant := 16; -- Timer/Counter4 Low Byte bit 4 TCNT4L_TCNT4L5: constant := 32; -- Timer/Counter4 Low Byte bit 5 TCNT4L_TCNT4L6: constant := 64; -- Timer/Counter4 Low Byte bit 6 TCNT4L_TCNT4L7: constant := 128; -- Timer/Counter4 Low Byte bit 7 -- Timer/Counter4 Outbut Compare Register A High Byte OCR4AH : Unsigned_8; for OCR4AH'Address use System'To_Address (16#A9#); OCR4AH_OCR4AH0: constant := 1; -- Timer/Counter4 Outbut Compare Register High Byte bit 0 OCR4AH_OCR4AH1: constant := 2; -- Timer/Counter4 Outbut Compare Register High Byte bit 1 OCR4AH_OCR4AH2: constant := 4; -- Timer/Counter4 Outbut Compare Register High Byte bit 2 OCR4AH_OCR4AH3: constant := 8; -- Timer/Counter4 Outbut Compare Register High Byte bit 3 OCR4AH_OCR4AH4: constant := 16; -- Timer/Counter4 Outbut Compare Register High Byte bit 4 OCR4AH_OCR4AH5: constant := 32; -- Timer/Counter4 Outbut Compare Register High Byte bit 5 OCR4AH_OCR4AH6: constant := 64; -- Timer/Counter4 Outbut Compare Register High Byte bit 6 OCR4AH_OCR4AH7: constant := 128; -- Timer/Counter4 Outbut Compare Register High Byte bit 7 -- Timer/Counter4 Outbut Compare Register A Low Byte OCR4AL : Unsigned_8; for OCR4AL'Address use System'To_Address (16#A8#); OCR4AL_OCR4AL0: constant := 1; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 0 OCR4AL_OCR4AL1: constant := 2; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 1 OCR4AL_OCR4AL2: constant := 4; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 2 OCR4AL_OCR4AL3: constant := 8; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 3 OCR4AL_OCR4AL4: constant := 16; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 4 OCR4AL_OCR4AL5: constant := 32; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 5 OCR4AL_OCR4AL6: constant := 64; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 6 OCR4AL_OCR4AL7: constant := 128; -- Timer/Counter4 Outbut Compare Register Low Byte Bit 7 -- Timer/Counter4 Output Compare Register B High Byte OCR4BH : Unsigned_8; for OCR4BH'Address use System'To_Address (16#AB#); OCR4BH_OCR4BH0: constant := 1; -- Timer/Counter4 Output Compare Register High Byte bit 0 OCR4BH_OCR4BH1: constant := 2; -- Timer/Counter4 Output Compare Register High Byte bit 1 OCR4BH_OCR4BH2: constant := 4; -- Timer/Counter4 Output Compare Register High Byte bit 2 OCR4BH_OCR4BH3: constant := 8; -- Timer/Counter4 Output Compare Register High Byte bit 3 OCR4BH_OCR4BH4: constant := 16; -- Timer/Counter4 Output Compare Register High Byte bit 4 OCR4BH_OCR4BH5: constant := 32; -- Timer/Counter4 Output Compare Register High Byte bit 5 OCR4BH_OCR4BH6: constant := 64; -- Timer/Counter4 Output Compare Register High Byte bit 6 OCR4BH_OCR4BH7: constant := 128; -- Timer/Counter4 Output Compare Register High Byte bit 7 -- Timer/Counter4 Output Compare Register B Low Byte OCR4BL : Unsigned_8; for OCR4BL'Address use System'To_Address (16#AA#); OCR4BL_OCR4BL0: constant := 1; -- Timer/Counter4 Output Compare Register Low Byte bit 0 OCR4BL_OCR4BL1: constant := 2; -- Timer/Counter4 Output Compare Register Low Byte bit 1 OCR4BL_OCR4BL2: constant := 4; -- Timer/Counter4 Output Compare Register Low Byte bit 2 OCR4BL_OCR4BL3: constant := 8; -- Timer/Counter4 Output Compare Register Low Byte bit 3 OCR4BL_OCR4BL4: constant := 16; -- Timer/Counter4 Output Compare Register Low Byte bit 4 OCR4BL_OCR4BL5: constant := 32; -- Timer/Counter4 Output Compare Register Low Byte bit 5 OCR4BL_OCR4BL6: constant := 64; -- Timer/Counter4 Output Compare Register Low Byte bit 6 OCR4BL_OCR4BL7: constant := 128; -- Timer/Counter4 Output Compare Register Low Byte bit 7 -- Timer/Counter4 Output Compare Register B High Byte OCR4CH : Unsigned_8; for OCR4CH'Address use System'To_Address (16#AD#); OCR4CH_OCR4CH0: constant := 1; -- Timer/Counter4 Output Compare Register High Byte bit 0 OCR4CH_OCR4CH1: constant := 2; -- Timer/Counter4 Output Compare Register High Byte bit 1 OCR4CH_OCR4CH2: constant := 4; -- Timer/Counter4 Output Compare Register High Byte bit 2 OCR4CH_OCR4CH3: constant := 8; -- Timer/Counter4 Output Compare Register High Byte bit 3 OCR4CH_OCR4CH4: constant := 16; -- Timer/Counter4 Output Compare Register High Byte bit 4 OCR4CH_OCR4CH5: constant := 32; -- Timer/Counter4 Output Compare Register High Byte bit 5 OCR4CH_OCR4CH6: constant := 64; -- Timer/Counter4 Output Compare Register High Byte bit 6 OCR4CH_OCR4CH7: constant := 128; -- Timer/Counter4 Output Compare Register High Byte bit 7 -- Timer/Counter4 Output Compare Register B Low Byte OCR4CL : Unsigned_8; for OCR4CL'Address use System'To_Address (16#AC#); OCR4CL_OCR4CL0: constant := 1; -- Timer/Counter4 Output Compare Register Low Byte bit 0 OCR4CL_OCR4CL1: constant := 2; -- Timer/Counter4 Output Compare Register Low Byte bit 1 OCR4CL_OCR4CL2: constant := 4; -- Timer/Counter4 Output Compare Register Low Byte bit 2 OCR4CL_OCR4CL3: constant := 8; -- Timer/Counter4 Output Compare Register Low Byte bit 3 OCR4CL_OCR4CL4: constant := 16; -- Timer/Counter4 Output Compare Register Low Byte bit 4 OCR4CL_OCR4CL5: constant := 32; -- Timer/Counter4 Output Compare Register Low Byte bit 5 OCR4CL_OCR4CL6: constant := 64; -- Timer/Counter4 Output Compare Register Low Byte bit 6 OCR4CL_OCR4CL7: constant := 128; -- Timer/Counter4 Output Compare Register Low Byte bit 7 -- Timer/Counter4 Input Capture Register High Byte ICR4H : Unsigned_8; for ICR4H'Address use System'To_Address (16#A7#); ICR4H_ICR4H0: constant := 1; -- Timer/Counter4 Input Capture Register High Byte bit 0 ICR4H_ICR4H1: constant := 2; -- Timer/Counter4 Input Capture Register High Byte bit 1 ICR4H_ICR4H2: constant := 4; -- Timer/Counter4 Input Capture Register High Byte bit 2 ICR4H_ICR4H3: constant := 8; -- Timer/Counter4 Input Capture Register High Byte bit 3 ICR4H_ICR4H4: constant := 16; -- Timer/Counter4 Input Capture Register High Byte bit 4 ICR4H_ICR4H5: constant := 32; -- Timer/Counter4 Input Capture Register High Byte bit 5 ICR4H_ICR4H6: constant := 64; -- Timer/Counter4 Input Capture Register High Byte bit 6 ICR4H_ICR4H7: constant := 128; -- Timer/Counter4 Input Capture Register High Byte bit 7 -- Timer/Counter4 Input Capture Register Low Byte ICR4L : Unsigned_8; for ICR4L'Address use System'To_Address (16#A6#); ICR4L_ICR4L0: constant := 1; -- Timer/Counter4 Input Capture Register Low Byte bit 0 ICR4L_ICR4L1: constant := 2; -- Timer/Counter4 Input Capture Register Low Byte bit 1 ICR4L_ICR4L2: constant := 4; -- Timer/Counter4 Input Capture Register Low Byte bit 2 ICR4L_ICR4L3: constant := 8; -- Timer/Counter4 Input Capture Register Low Byte bit 3 ICR4L_ICR4L4: constant := 16; -- Timer/Counter4 Input Capture Register Low Byte bit 4 ICR4L_ICR4L5: constant := 32; -- Timer/Counter4 Input Capture Register Low Byte bit 5 ICR4L_ICR4L6: constant := 64; -- Timer/Counter4 Input Capture Register Low Byte bit 6 ICR4L_ICR4L7: constant := 128; -- Timer/Counter4 Input Capture Register Low Byte bit 7 -- Timer/Counter4 Interrupt Mask Register TIMSK4 : Unsigned_8; for TIMSK4'Address use System'To_Address (16#72#); TIMSK4_TOIE4: constant := 1; -- Timer/Counter4 Overflow Interrupt Enable TIMSK4_OCIE4A: constant := 2; -- Timer/Counter4 Output Compare A Match Interrupt Enable TIMSK4_OCIE4B: constant := 4; -- Timer/Counter4 Output Compare B Match Interrupt Enable TIMSK4_OCIE4C: constant := 8; -- Timer/Counter4 Output Compare C Match Interrupt Enable TIMSK4_ICIE4: constant := 32; -- Timer/Counter4 Input Capture Interrupt Enable -- Timer/Counter4 Interrupt Flag register TIFR4 : Unsigned_8; for TIFR4'Address use System'To_Address (16#39#); TIFR4_TOV4: constant := 1; -- Timer/Counter4 Overflow Flag TIFR4_OCF4A: constant := 2; -- Output Compare Flag 4A TIFR4_OCF4B: constant := 4; -- Output Compare Flag 4B TIFR4_OCF4C: constant := 8; -- Output Compare Flag 4C TIFR4_ICF4: constant := 32; -- Input Capture Flag 4 -- Timer/Counter3 Control Register A TCCR3A : Unsigned_8; for TCCR3A'Address use System'To_Address (16#90#); TCCR3A_WGM30: constant := 1; -- Waveform Generation Mode TCCR3A_WGM31: constant := 2; -- Waveform Generation Mode TCCR3A_COM3C0: constant := 4; -- Compare Output Mode 3C, bit 0 TCCR3A_COM3C1: constant := 8; -- Compare Output Mode 3C, bit 1 TCCR3A_COM3B0: constant := 16; -- Compare Output Mode 3B, bit 0 TCCR3A_COM3B1: constant := 32; -- Compare Output Mode 3B, bit 1 TCCR3A_COM3A0: constant := 64; -- Compare Output Mode 3A, bit 0 TCCR3A_COM3A1: constant := 128; -- Compare Output Mode 1A, bit 1 -- Timer/Counter3 Control Register B TCCR3B : Unsigned_8; for TCCR3B'Address use System'To_Address (16#91#); TCCR3B_CS30: constant := 1; -- Prescaler source of Timer/Counter 3 TCCR3B_CS31: constant := 2; -- Prescaler source of Timer/Counter 3 TCCR3B_CS32: constant := 4; -- Prescaler source of Timer/Counter 3 TCCR3B_WGM32: constant := 8; -- Waveform Generation Mode TCCR3B_WGM33: constant := 16; -- Waveform Generation Mode TCCR3B_ICES3: constant := 64; -- Input Capture 3 Edge Select TCCR3B_ICNC3: constant := 128; -- Input Capture 3 Noise Canceler -- Timer/Counter 3 Control Register C TCCR3C : Unsigned_8; for TCCR3C'Address use System'To_Address (16#92#); TCCR3C_FOC3C: constant := 32; -- Force Output Compare 3C TCCR3C_FOC3B: constant := 64; -- Force Output Compare 3B TCCR3C_FOC3A: constant := 128; -- Force Output Compare 3A -- Timer/Counter3 High Byte TCNT3H : Unsigned_8; for TCNT3H'Address use System'To_Address (16#95#); TCNT3H_TCNT3H0: constant := 1; -- Timer/Counter3 High Byte bit 0 TCNT3H_TCNT3H1: constant := 2; -- Timer/Counter3 High Byte bit 1 TCNT3H_TCNT3H2: constant := 4; -- Timer/Counter3 High Byte bit 2 TCNT3H_TCNT3H3: constant := 8; -- Timer/Counter3 High Byte bit 3 TCNT3H_TCNT3H4: constant := 16; -- Timer/Counter3 High Byte bit 4 TCNT3H_TCNT3H5: constant := 32; -- Timer/Counter3 High Byte bit 5 TCNT3H_TCNT3H6: constant := 64; -- Timer/Counter3 High Byte bit 6 TCNT3H_TCNT3H7: constant := 128; -- Timer/Counter3 High Byte bit 7 -- Timer/Counter3 Low Byte TCNT3L : Unsigned_8; for TCNT3L'Address use System'To_Address (16#94#); TCNT3L_TCNT3L0: constant := 1; -- Timer/Counter3 Low Byte bit 0 TCNT3L_TCNT3L1: constant := 2; -- Timer/Counter3 Low Byte bit 1 TCNT3L_TCNT3L2: constant := 4; -- Timer/Counter3 Low Byte bit 2 TCNT3L_TCNT3L3: constant := 8; -- Timer/Counter3 Low Byte bit 3 TCNT3L_TCNT3L4: constant := 16; -- Timer/Counter3 Low Byte bit 4 TCNT3L_TCNT3L5: constant := 32; -- Timer/Counter3 Low Byte bit 5 TCNT3L_TCNT3L6: constant := 64; -- Timer/Counter3 Low Byte bit 6 TCNT3L_TCNT3L7: constant := 128; -- Timer/Counter3 Low Byte bit 7 -- Timer/Counter3 Outbut Compare Register A High Byte OCR3AH : Unsigned_8; for OCR3AH'Address use System'To_Address (16#99#); OCR3AH_OCR3AH0: constant := 1; -- Timer/Counter3 Outbut Compare Register High Byte bit 0 OCR3AH_OCR3AH1: constant := 2; -- Timer/Counter3 Outbut Compare Register High Byte bit 1 OCR3AH_OCR3AH2: constant := 4; -- Timer/Counter3 Outbut Compare Register High Byte bit 2 OCR3AH_OCR3AH3: constant := 8; -- Timer/Counter3 Outbut Compare Register High Byte bit 3 OCR3AH_OCR3AH4: constant := 16; -- Timer/Counter3 Outbut Compare Register High Byte bit 4 OCR3AH_OCR3AH5: constant := 32; -- Timer/Counter3 Outbut Compare Register High Byte bit 5 OCR3AH_OCR3AH6: constant := 64; -- Timer/Counter3 Outbut Compare Register High Byte bit 6 OCR3AH_OCR3AH7: constant := 128; -- Timer/Counter3 Outbut Compare Register High Byte bit 7 -- Timer/Counter3 Outbut Compare Register A Low Byte OCR3AL : Unsigned_8; for OCR3AL'Address use System'To_Address (16#98#); OCR3AL_OCR3AL0: constant := 1; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 0 OCR3AL_OCR3AL1: constant := 2; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 1 OCR3AL_OCR3AL2: constant := 4; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 2 OCR3AL_OCR3AL3: constant := 8; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 3 OCR3AL_OCR3AL4: constant := 16; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 4 OCR3AL_OCR3AL5: constant := 32; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 5 OCR3AL_OCR3AL6: constant := 64; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 6 OCR3AL_OCR3AL7: constant := 128; -- Timer/Counter3 Outbut Compare Register Low Byte Bit 7 -- Timer/Counter3 Output Compare Register B High Byte OCR3BH : Unsigned_8; for OCR3BH'Address use System'To_Address (16#9B#); OCR3BH_OCR3BH0: constant := 1; -- Timer/Counter3 Output Compare Register High Byte bit 0 OCR3BH_OCR3BH1: constant := 2; -- Timer/Counter3 Output Compare Register High Byte bit 1 OCR3BH_OCR3BH2: constant := 4; -- Timer/Counter3 Output Compare Register High Byte bit 2 OCR3BH_OCR3BH3: constant := 8; -- Timer/Counter3 Output Compare Register High Byte bit 3 OCR3BH_OCR3BH4: constant := 16; -- Timer/Counter3 Output Compare Register High Byte bit 4 OCR3BH_OCR3BH5: constant := 32; -- Timer/Counter3 Output Compare Register High Byte bit 5 OCR3BH_OCR3BH6: constant := 64; -- Timer/Counter3 Output Compare Register High Byte bit 6 OCR3BH_OCR3BH7: constant := 128; -- Timer/Counter3 Output Compare Register High Byte bit 7 -- Timer/Counter3 Output Compare Register B Low Byte OCR3BL : Unsigned_8; for OCR3BL'Address use System'To_Address (16#9A#); OCR3BL_OCR3BL0: constant := 1; -- Timer/Counter3 Output Compare Register Low Byte bit 0 OCR3BL_OCR3BL1: constant := 2; -- Timer/Counter3 Output Compare Register Low Byte bit 1 OCR3BL_OCR3BL2: constant := 4; -- Timer/Counter3 Output Compare Register Low Byte bit 2 OCR3BL_OCR3BL3: constant := 8; -- Timer/Counter3 Output Compare Register Low Byte bit 3 OCR3BL_OCR3BL4: constant := 16; -- Timer/Counter3 Output Compare Register Low Byte bit 4 OCR3BL_OCR3BL5: constant := 32; -- Timer/Counter3 Output Compare Register Low Byte bit 5 OCR3BL_OCR3BL6: constant := 64; -- Timer/Counter3 Output Compare Register Low Byte bit 6 OCR3BL_OCR3BL7: constant := 128; -- Timer/Counter3 Output Compare Register Low Byte bit 7 -- Timer/Counter3 Output Compare Register B High Byte OCR3CH : Unsigned_8; for OCR3CH'Address use System'To_Address (16#9D#); OCR3CH_OCR3CH0: constant := 1; -- Timer/Counter3 Output Compare Register High Byte bit 0 OCR3CH_OCR3CH1: constant := 2; -- Timer/Counter3 Output Compare Register High Byte bit 1 OCR3CH_OCR3CH2: constant := 4; -- Timer/Counter3 Output Compare Register High Byte bit 2 OCR3CH_OCR3CH3: constant := 8; -- Timer/Counter3 Output Compare Register High Byte bit 3 OCR3CH_OCR3CH4: constant := 16; -- Timer/Counter3 Output Compare Register High Byte bit 4 OCR3CH_OCR3CH5: constant := 32; -- Timer/Counter3 Output Compare Register High Byte bit 5 OCR3CH_OCR3CH6: constant := 64; -- Timer/Counter3 Output Compare Register High Byte bit 6 OCR3CH_OCR3CH7: constant := 128; -- Timer/Counter3 Output Compare Register High Byte bit 7 -- Timer/Counter3 Output Compare Register B Low Byte OCR3CL : Unsigned_8; for OCR3CL'Address use System'To_Address (16#9C#); OCR3CL_OCR3CL0: constant := 1; -- Timer/Counter3 Output Compare Register Low Byte bit 0 OCR3CL_OCR3CL1: constant := 2; -- Timer/Counter3 Output Compare Register Low Byte bit 1 OCR3CL_OCR3CL2: constant := 4; -- Timer/Counter3 Output Compare Register Low Byte bit 2 OCR3CL_OCR3CL3: constant := 8; -- Timer/Counter3 Output Compare Register Low Byte bit 3 OCR3CL_OCR3CL4: constant := 16; -- Timer/Counter3 Output Compare Register Low Byte bit 4 OCR3CL_OCR3CL5: constant := 32; -- Timer/Counter3 Output Compare Register Low Byte bit 5 OCR3CL_OCR3CL6: constant := 64; -- Timer/Counter3 Output Compare Register Low Byte bit 6 OCR3CL_OCR3CL7: constant := 128; -- Timer/Counter3 Output Compare Register Low Byte bit 7 -- Timer/Counter3 Input Capture Register High Byte ICR3H : Unsigned_8; for ICR3H'Address use System'To_Address (16#97#); ICR3H_ICR3H0: constant := 1; -- Timer/Counter3 Input Capture Register High Byte bit 0 ICR3H_ICR3H1: constant := 2; -- Timer/Counter3 Input Capture Register High Byte bit 1 ICR3H_ICR3H2: constant := 4; -- Timer/Counter3 Input Capture Register High Byte bit 2 ICR3H_ICR3H3: constant := 8; -- Timer/Counter3 Input Capture Register High Byte bit 3 ICR3H_ICR3H4: constant := 16; -- Timer/Counter3 Input Capture Register High Byte bit 4 ICR3H_ICR3H5: constant := 32; -- Timer/Counter3 Input Capture Register High Byte bit 5 ICR3H_ICR3H6: constant := 64; -- Timer/Counter3 Input Capture Register High Byte bit 6 ICR3H_ICR3H7: constant := 128; -- Timer/Counter3 Input Capture Register High Byte bit 7 -- Timer/Counter3 Input Capture Register Low Byte ICR3L : Unsigned_8; for ICR3L'Address use System'To_Address (16#96#); ICR3L_ICR3L0: constant := 1; -- Timer/Counter3 Input Capture Register Low Byte bit 0 ICR3L_ICR3L1: constant := 2; -- Timer/Counter3 Input Capture Register Low Byte bit 1 ICR3L_ICR3L2: constant := 4; -- Timer/Counter3 Input Capture Register Low Byte bit 2 ICR3L_ICR3L3: constant := 8; -- Timer/Counter3 Input Capture Register Low Byte bit 3 ICR3L_ICR3L4: constant := 16; -- Timer/Counter3 Input Capture Register Low Byte bit 4 ICR3L_ICR3L5: constant := 32; -- Timer/Counter3 Input Capture Register Low Byte bit 5 ICR3L_ICR3L6: constant := 64; -- Timer/Counter3 Input Capture Register Low Byte bit 6 ICR3L_ICR3L7: constant := 128; -- Timer/Counter3 Input Capture Register Low Byte bit 7 -- Timer/Counter3 Interrupt Mask Register TIMSK3 : Unsigned_8; for TIMSK3'Address use System'To_Address (16#71#); TIMSK3_TOIE3: constant := 1; -- Timer/Counter3 Overflow Interrupt Enable TIMSK3_OCIE3A: constant := 2; -- Timer/Counter3 Output Compare A Match Interrupt Enable TIMSK3_OCIE3B: constant := 4; -- Timer/Counter3 Output Compare B Match Interrupt Enable TIMSK3_OCIE3C: constant := 8; -- Timer/Counter3 Output Compare C Match Interrupt Enable TIMSK3_ICIE3: constant := 32; -- Timer/Counter3 Input Capture Interrupt Enable -- Timer/Counter3 Interrupt Flag register TIFR3 : Unsigned_8; for TIFR3'Address use System'To_Address (16#38#); TIFR3_TOV3: constant := 1; -- Timer/Counter3 Overflow Flag TIFR3_OCF3A: constant := 2; -- Output Compare Flag 3A TIFR3_OCF3B: constant := 4; -- Output Compare Flag 3B TIFR3_OCF3C: constant := 8; -- Output Compare Flag 3C TIFR3_ICF3: constant := 32; -- Input Capture Flag 3 -- Timer/Counter1 Control Register A TCCR1A : Unsigned_8; for TCCR1A'Address use System'To_Address (16#80#); TCCR1A_WGM10: constant := 1; -- Waveform Generation Mode TCCR1A_WGM11: constant := 2; -- Waveform Generation Mode TCCR1A_COM1C0: constant := 4; -- Compare Output Mode 1C, bit 0 TCCR1A_COM1C1: constant := 8; -- Compare Output Mode 1C, bit 1 TCCR1A_COM1B0: constant := 16; -- Compare Output Mode 1B, bit 0 TCCR1A_COM1B1: constant := 32; -- Compare Output Mode 1B, bit 1 TCCR1A_COM1A0: constant := 64; -- Compare Output Mode 1A, bit 0 TCCR1A_COM1A1: constant := 128; -- Compare Output Mode 1A, bit 1 -- Timer/Counter1 Control Register B TCCR1B : Unsigned_8; for TCCR1B'Address use System'To_Address (16#81#); TCCR1B_CS10: constant := 1; -- Prescaler source of Timer/Counter 1 TCCR1B_CS11: constant := 2; -- Prescaler source of Timer/Counter 1 TCCR1B_CS12: constant := 4; -- Prescaler source of Timer/Counter 1 TCCR1B_WGM12: constant := 8; -- Waveform Generation Mode TCCR1B_WGM13: constant := 16; -- Waveform Generation Mode TCCR1B_ICES1: constant := 64; -- Input Capture 1 Edge Select TCCR1B_ICNC1: constant := 128; -- Input Capture 1 Noise Canceler -- Timer/Counter 1 Control Register C TCCR1C : Unsigned_8; for TCCR1C'Address use System'To_Address (16#82#); TCCR1C_FOC1C: constant := 32; -- Force Output Compare 1C TCCR1C_FOC1B: constant := 64; -- Force Output Compare 1B TCCR1C_FOC1A: constant := 128; -- Force Output Compare 1A -- Timer/Counter1 High Byte TCNT1H : Unsigned_8; for TCNT1H'Address use System'To_Address (16#85#); TCNT1H_TCNT1H0: constant := 1; -- Timer/Counter1 High Byte bit 0 TCNT1H_TCNT1H1: constant := 2; -- Timer/Counter1 High Byte bit 1 TCNT1H_TCNT1H2: constant := 4; -- Timer/Counter1 High Byte bit 2 TCNT1H_TCNT1H3: constant := 8; -- Timer/Counter1 High Byte bit 3 TCNT1H_TCNT1H4: constant := 16; -- Timer/Counter1 High Byte bit 4 TCNT1H_TCNT1H5: constant := 32; -- Timer/Counter1 High Byte bit 5 TCNT1H_TCNT1H6: constant := 64; -- Timer/Counter1 High Byte bit 6 TCNT1H_TCNT1H7: constant := 128; -- Timer/Counter1 High Byte bit 7 -- Timer/Counter1 Low Byte TCNT1L : Unsigned_8; for TCNT1L'Address use System'To_Address (16#84#); TCNT1L_TCNT1L0: constant := 1; -- Timer/Counter1 Low Byte bit 0 TCNT1L_TCNT1L1: constant := 2; -- Timer/Counter1 Low Byte bit 1 TCNT1L_TCNT1L2: constant := 4; -- Timer/Counter1 Low Byte bit 2 TCNT1L_TCNT1L3: constant := 8; -- Timer/Counter1 Low Byte bit 3 TCNT1L_TCNT1L4: constant := 16; -- Timer/Counter1 Low Byte bit 4 TCNT1L_TCNT1L5: constant := 32; -- Timer/Counter1 Low Byte bit 5 TCNT1L_TCNT1L6: constant := 64; -- Timer/Counter1 Low Byte bit 6 TCNT1L_TCNT1L7: constant := 128; -- Timer/Counter1 Low Byte bit 7 -- Timer/Counter1 Outbut Compare Register A High Byte OCR1AH : Unsigned_8; for OCR1AH'Address use System'To_Address (16#89#); OCR1AH_OCR1AH0: constant := 1; -- Timer/Counter1 Outbut Compare Register High Byte bit 0 OCR1AH_OCR1AH1: constant := 2; -- Timer/Counter1 Outbut Compare Register High Byte bit 1 OCR1AH_OCR1AH2: constant := 4; -- Timer/Counter1 Outbut Compare Register High Byte bit 2 OCR1AH_OCR1AH3: constant := 8; -- Timer/Counter1 Outbut Compare Register High Byte bit 3 OCR1AH_OCR1AH4: constant := 16; -- Timer/Counter1 Outbut Compare Register High Byte bit 4 OCR1AH_OCR1AH5: constant := 32; -- Timer/Counter1 Outbut Compare Register High Byte bit 5 OCR1AH_OCR1AH6: constant := 64; -- Timer/Counter1 Outbut Compare Register High Byte bit 6 OCR1AH_OCR1AH7: constant := 128; -- Timer/Counter1 Outbut Compare Register High Byte bit 7 -- Timer/Counter1 Outbut Compare Register A Low Byte OCR1AL : Unsigned_8; for OCR1AL'Address use System'To_Address (16#88#); OCR1AL_OCR1AL0: constant := 1; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 0 OCR1AL_OCR1AL1: constant := 2; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 1 OCR1AL_OCR1AL2: constant := 4; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 2 OCR1AL_OCR1AL3: constant := 8; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 3 OCR1AL_OCR1AL4: constant := 16; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 4 OCR1AL_OCR1AL5: constant := 32; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 5 OCR1AL_OCR1AL6: constant := 64; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 6 OCR1AL_OCR1AL7: constant := 128; -- Timer/Counter1 Outbut Compare Register Low Byte Bit 7 -- Timer/Counter1 Output Compare Register B High Byte OCR1BH : Unsigned_8; for OCR1BH'Address use System'To_Address (16#8B#); OCR1BH_OCR1BH0: constant := 1; -- Timer/Counter1 Output Compare Register High Byte bit 0 OCR1BH_OCR1BH1: constant := 2; -- Timer/Counter1 Output Compare Register High Byte bit 1 OCR1BH_OCR1BH2: constant := 4; -- Timer/Counter1 Output Compare Register High Byte bit 2 OCR1BH_OCR1BH3: constant := 8; -- Timer/Counter1 Output Compare Register High Byte bit 3 OCR1BH_OCR1BH4: constant := 16; -- Timer/Counter1 Output Compare Register High Byte bit 4 OCR1BH_OCR1BH5: constant := 32; -- Timer/Counter1 Output Compare Register High Byte bit 5 OCR1BH_OCR1BH6: constant := 64; -- Timer/Counter1 Output Compare Register High Byte bit 6 OCR1BH_OCR1BH7: constant := 128; -- Timer/Counter1 Output Compare Register High Byte bit 7 -- Timer/Counter1 Output Compare Register B Low Byte OCR1BL : Unsigned_8; for OCR1BL'Address use System'To_Address (16#8A#); OCR1BL_OCR1BL0: constant := 1; -- Timer/Counter1 Output Compare Register Low Byte bit 0 OCR1BL_OCR1BL1: constant := 2; -- Timer/Counter1 Output Compare Register Low Byte bit 1 OCR1BL_OCR1BL2: constant := 4; -- Timer/Counter1 Output Compare Register Low Byte bit 2 OCR1BL_OCR1BL3: constant := 8; -- Timer/Counter1 Output Compare Register Low Byte bit 3 OCR1BL_OCR1BL4: constant := 16; -- Timer/Counter1 Output Compare Register Low Byte bit 4 OCR1BL_OCR1BL5: constant := 32; -- Timer/Counter1 Output Compare Register Low Byte bit 5 OCR1BL_OCR1BL6: constant := 64; -- Timer/Counter1 Output Compare Register Low Byte bit 6 OCR1BL_OCR1BL7: constant := 128; -- Timer/Counter1 Output Compare Register Low Byte bit 7 -- Timer/Counter1 Output Compare Register C High Byte OCR1CH : Unsigned_8; for OCR1CH'Address use System'To_Address (16#8D#); OCR1CH_OCR1CH0: constant := 1; -- Timer/Counter1 Output Compare Register High Byte bit 0 OCR1CH_OCR1CH1: constant := 2; -- Timer/Counter1 Output Compare Register High Byte bit 1 OCR1CH_OCR1CH2: constant := 4; -- Timer/Counter1 Output Compare Register High Byte bit 2 OCR1CH_OCR1CH3: constant := 8; -- Timer/Counter1 Output Compare Register High Byte bit 3 OCR1CH_OCR1CH4: constant := 16; -- Timer/Counter1 Output Compare Register High Byte bit 4 OCR1CH_OCR1CH5: constant := 32; -- Timer/Counter1 Output Compare Register High Byte bit 5 OCR1CH_OCR1CH6: constant := 64; -- Timer/Counter1 Output Compare Register High Byte bit 6 OCR1CH_OCR1CH7: constant := 128; -- Timer/Counter1 Output Compare Register High Byte bit 7 -- Timer/Counter1 Output Compare Register C Low Byte OCR1CL : Unsigned_8; for OCR1CL'Address use System'To_Address (16#8C#); OCR1CL_OCR1CL0: constant := 1; -- Timer/Counter1 Output Compare Register Low Byte bit 0 OCR1CL_OCR1CL1: constant := 2; -- Timer/Counter1 Output Compare Register Low Byte bit 1 OCR1CL_OCR1CL2: constant := 4; -- Timer/Counter1 Output Compare Register Low Byte bit 2 OCR1CL_OCR1CL3: constant := 8; -- Timer/Counter1 Output Compare Register Low Byte bit 3 OCR1CL_OCR1CL4: constant := 16; -- Timer/Counter1 Output Compare Register Low Byte bit 4 OCR1CL_OCR1CL5: constant := 32; -- Timer/Counter1 Output Compare Register Low Byte bit 5 OCR1CL_OCR1CL6: constant := 64; -- Timer/Counter1 Output Compare Register Low Byte bit 6 OCR1CL_OCR1CL7: constant := 128; -- Timer/Counter1 Output Compare Register Low Byte bit 7 -- Timer/Counter1 Input Capture Register High Byte ICR1H : Unsigned_8; for ICR1H'Address use System'To_Address (16#87#); ICR1H_ICR1H0: constant := 1; -- Timer/Counter1 Input Capture Register High Byte bit 0 ICR1H_ICR1H1: constant := 2; -- Timer/Counter1 Input Capture Register High Byte bit 1 ICR1H_ICR1H2: constant := 4; -- Timer/Counter1 Input Capture Register High Byte bit 2 ICR1H_ICR1H3: constant := 8; -- Timer/Counter1 Input Capture Register High Byte bit 3 ICR1H_ICR1H4: constant := 16; -- Timer/Counter1 Input Capture Register High Byte bit 4 ICR1H_ICR1H5: constant := 32; -- Timer/Counter1 Input Capture Register High Byte bit 5 ICR1H_ICR1H6: constant := 64; -- Timer/Counter1 Input Capture Register High Byte bit 6 ICR1H_ICR1H7: constant := 128; -- Timer/Counter1 Input Capture Register High Byte bit 7 -- Timer/Counter1 Input Capture Register Low Byte ICR1L : Unsigned_8; for ICR1L'Address use System'To_Address (16#86#); ICR1L_ICR1L0: constant := 1; -- Timer/Counter1 Input Capture Register Low Byte bit 0 ICR1L_ICR1L1: constant := 2; -- Timer/Counter1 Input Capture Register Low Byte bit 1 ICR1L_ICR1L2: constant := 4; -- Timer/Counter1 Input Capture Register Low Byte bit 2 ICR1L_ICR1L3: constant := 8; -- Timer/Counter1 Input Capture Register Low Byte bit 3 ICR1L_ICR1L4: constant := 16; -- Timer/Counter1 Input Capture Register Low Byte bit 4 ICR1L_ICR1L5: constant := 32; -- Timer/Counter1 Input Capture Register Low Byte bit 5 ICR1L_ICR1L6: constant := 64; -- Timer/Counter1 Input Capture Register Low Byte bit 6 ICR1L_ICR1L7: constant := 128; -- Timer/Counter1 Input Capture Register Low Byte bit 7 -- Timer/Counter1 Interrupt Mask Register TIMSK1 : Unsigned_8; for TIMSK1'Address use System'To_Address (16#6F#); TIMSK1_TOIE1: constant := 1; -- Timer/Counter1 Overflow Interrupt Enable TIMSK1_OCIE1A: constant := 2; -- Timer/Counter1 Output Compare A Match Interrupt Enable TIMSK1_OCIE1B: constant := 4; -- Timer/Counter1 Output Compare B Match Interrupt Enable TIMSK1_OCIE1C: constant := 8; -- Timer/Counter1 Output Compare C Match Interrupt Enable TIMSK1_ICIE1: constant := 32; -- Timer/Counter1 Input Capture Interrupt Enable -- Timer/Counter1 Interrupt Flag register TIFR1 : Unsigned_8; for TIFR1'Address use System'To_Address (16#36#); TIFR1_TOV1: constant := 1; -- Timer/Counter1 Overflow Flag TIFR1_OCF1A: constant := 2; -- Output Compare Flag 1A TIFR1_OCF1B: constant := 4; -- Output Compare Flag 1B TIFR1_OCF1C: constant := 8; -- Output Compare Flag 1C TIFR1_ICF1: constant := 32; -- Input Capture Flag 1 -- On-Chip Debug Related Register in I/O Memory OCDR : Unsigned_8; for OCDR'Address use System'To_Address (16#51#); OCDR_OCDR0: constant := 1; -- On-Chip Debug Register Bit 0 OCDR_OCDR1: constant := 2; -- On-Chip Debug Register Bit 1 OCDR_OCDR2: constant := 4; -- On-Chip Debug Register Bit 2 OCDR_OCDR3: constant := 8; -- On-Chip Debug Register Bit 3 OCDR_OCDR4: constant := 16; -- On-Chip Debug Register Bit 4 OCDR_OCDR5: constant := 32; -- On-Chip Debug Register Bit 5 OCDR_OCDR6: constant := 64; -- On-Chip Debug Register Bit 6 OCDR_OCDR7: constant := 128; -- On-Chip Debug Register Bit 7 -- MCU Control Register MCUCR : Unsigned_8; for MCUCR'Address use System'To_Address (16#55#); MCUCR_JTD: constant := 128; -- JTAG Interface Disable -- MCU Status Register MCUSR : Unsigned_8; for MCUSR'Address use System'To_Address (16#54#); MCUSR_JTRF: constant := 16; -- JTAG Reset Flag -- External Interrupt Control Register A EICRA : Unsigned_8; for EICRA'Address use System'To_Address (16#69#); EICRA_ISC00: constant := 1; -- External Interrupt Sense Control Bit EICRA_ISC01: constant := 2; -- External Interrupt Sense Control Bit EICRA_ISC10: constant := 4; -- External Interrupt Sense Control Bit EICRA_ISC11: constant := 8; -- External Interrupt Sense Control Bit EICRA_ISC20: constant := 16; -- External Interrupt Sense Control Bit EICRA_ISC21: constant := 32; -- External Interrupt Sense Control Bit EICRA_ISC30: constant := 64; -- External Interrupt Sense Control Bit EICRA_ISC31: constant := 128; -- External Interrupt Sense Control Bit -- External Interrupt Control Register B EICRB : Unsigned_8; for EICRB'Address use System'To_Address (16#6A#); EICRB_ISC40: constant := 1; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC41: constant := 2; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC50: constant := 4; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC51: constant := 8; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC60: constant := 16; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC61: constant := 32; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC70: constant := 64; -- External Interrupt 7-4 Sense Control Bit EICRB_ISC71: constant := 128; -- External Interrupt 7-4 Sense Control Bit -- External Interrupt Mask Register EIMSK : Unsigned_8; for EIMSK'Address use System'To_Address (16#3D#); EIMSK_INT0: constant := 1; -- External Interrupt Request 0 Enable EIMSK_INT1: constant := 2; -- External Interrupt Request 1 Enable EIMSK_INT2: constant := 4; -- External Interrupt Request 2 Enable EIMSK_INT3: constant := 8; -- External Interrupt Request 3 Enable EIMSK_INT4: constant := 16; -- External Interrupt Request 4 Enable EIMSK_INT5: constant := 32; -- External Interrupt Request 5 Enable EIMSK_INT6: constant := 64; -- External Interrupt Request 6 Enable EIMSK_INT7: constant := 128; -- External Interrupt Request 7 Enable -- External Interrupt Flag Register EIFR : Unsigned_8; for EIFR'Address use System'To_Address (16#3C#); EIFR_INTF0: constant := 1; -- External Interrupt Flag 0 EIFR_INTF1: constant := 2; -- External Interrupt Flag 1 EIFR_INTF2: constant := 4; -- External Interrupt Flag 2 EIFR_INTF3: constant := 8; -- External Interrupt Flag 3 EIFR_INTF4: constant := 16; -- External Interrupt Flag 4 EIFR_INTF5: constant := 32; -- External Interrupt Flag 5 EIFR_INTF6: constant := 64; -- External Interrupt Flag 6 EIFR_INTF7: constant := 128; -- External Interrupt Flag 7 -- Pin Change Mask Register 2 PCMSK2 : Unsigned_8; for PCMSK2'Address use System'To_Address (16#6D#); PCMSK2_PCINT16: constant := 1; -- Pin Change Enable Mask 16 PCMSK2_PCINT17: constant := 2; -- Pin Change Enable Mask 17 PCMSK2_PCINT18: constant := 4; -- Pin Change Enable Mask 18 PCMSK2_PCINT19: constant := 8; -- Pin Change Enable Mask 19 PCMSK2_PCINT20: constant := 16; -- Pin Change Enable Mask 20 PCMSK2_PCINT21: constant := 32; -- Pin Change Enable Mask 21 PCMSK2_PCINT22: constant := 64; -- Pin Change Enable Mask 22 PCMSK2_PCINT23: constant := 128; -- Pin Change Enable Mask 23 -- Pin Change Mask Register 1 PCMSK1 : Unsigned_8; for PCMSK1'Address use System'To_Address (16#6C#); PCMSK1_PCINT8: constant := 1; -- Pin Change Enable Mask 8 PCMSK1_PCINT9: constant := 2; -- Pin Change Enable Mask 9 PCMSK1_PCINT10: constant := 4; -- Pin Change Enable Mask 10 PCMSK1_PCINT11: constant := 8; -- Pin Change Enable Mask 11 PCMSK1_PCINT12: constant := 16; -- Pin Change Enable Mask 12 PCMSK1_PCINT13: constant := 32; -- Pin Change Enable Mask 13 PCMSK1_PCINT14: constant := 64; -- Pin Change Enable Mask 14 PCMSK1_PCINT15: constant := 128; -- Pin Change Enable Mask 15 -- Pin Change Mask Register 0 PCMSK0 : Unsigned_8; for PCMSK0'Address use System'To_Address (16#6B#); PCMSK0_PCINT0: constant := 1; -- Pin Change Enable Mask 0 PCMSK0_PCINT1: constant := 2; -- Pin Change Enable Mask 1 PCMSK0_PCINT2: constant := 4; -- Pin Change Enable Mask 2 PCMSK0_PCINT3: constant := 8; -- Pin Change Enable Mask 3 PCMSK0_PCINT4: constant := 16; -- Pin Change Enable Mask 4 PCMSK0_PCINT5: constant := 32; -- Pin Change Enable Mask 5 PCMSK0_PCINT6: constant := 64; -- Pin Change Enable Mask 6 PCMSK0_PCINT7: constant := 128; -- Pin Change Enable Mask 7 -- Pin Change Interrupt Flag Register PCIFR : Unsigned_8; for PCIFR'Address use System'To_Address (16#3B#); PCIFR_PCIF0: constant := 1; -- Pin Change Interrupt Flag 0 PCIFR_PCIF1: constant := 2; -- Pin Change Interrupt Flag 1 PCIFR_PCIF2: constant := 4; -- Pin Change Interrupt Flag 2 -- Pin Change Interrupt Control Register PCICR : Unsigned_8; for PCICR'Address use System'To_Address (16#68#); PCICR_PCIE0: constant := 1; -- Pin Change Interrupt Enable 0 PCICR_PCIE1: constant := 2; -- Pin Change Interrupt Enable 1 PCICR_PCIE2: constant := 4; -- Pin Change Interrupt Enable 2 -- Status Register SREG : Unsigned_8; for SREG'Address use System'To_Address (16#5F#); SREG_C: constant := 1; -- Carry Flag SREG_Z: constant := 2; -- Zero Flag SREG_N: constant := 4; -- Negative Flag SREG_V: constant := 8; -- Two's Complement Overflow Flag SREG_S: constant := 16; -- Sign Bit SREG_H: constant := 32; -- Half Carry Flag SREG_T: constant := 64; -- Bit Copy Storage SREG_I: constant := 128; -- Global Interrupt Enable -- Stack Pointer High SPH : Unsigned_8; for SPH'Address use System'To_Address (16#5E#); SPH_SP8: constant := 1; -- Stack pointer bit 8 SPH_SP9: constant := 2; -- Stack pointer bit 9 SPH_SP10: constant := 4; -- Stack pointer bit 10 SPH_SP11: constant := 8; -- Stack pointer bit 11 SPH_SP12: constant := 16; -- Stack pointer bit 12 SPH_SP13: constant := 32; -- Stack pointer bit 13 SPH_SP14: constant := 64; -- Stack pointer bit 14 SPH_SP15: constant := 128; -- Stack pointer bit 15 -- Stack Pointer Low SPL : Unsigned_8; for SPL'Address use System'To_Address (16#5D#); SPL_SP0: constant := 1; -- Stack pointer bit 0 SPL_SP1: constant := 2; -- Stack pointer bit 1 SPL_SP2: constant := 4; -- Stack pointer bit 2 SPL_SP3: constant := 8; -- Stack pointer bit 3 SPL_SP4: constant := 16; -- Stack pointer bit 4 SPL_SP5: constant := 32; -- Stack pointer bit 5 SPL_SP6: constant := 64; -- Stack pointer bit 6 SPL_SP7: constant := 128; -- Stack pointer bit 7 -- MCU Control Register -- MCU Status Register -- External Memory Control Register A XMCRA : Unsigned_8; for XMCRA'Address use System'To_Address (16#74#); XMCRA_SRW00: constant := 1; -- Wait state select bit lower page XMCRA_SRW01: constant := 2; -- Wait state select bit lower page XMCRA_SRW10: constant := 4; -- Wait state select bit upper page XMCRA_SRW11: constant := 8; -- Wait state select bit upper page XMCRA_SRL0: constant := 16; -- Wait state page limit XMCRA_SRL1: constant := 32; -- Wait state page limit XMCRA_SRL2: constant := 64; -- Wait state page limit XMCRA_SRE: constant := 128; -- External SRAM Enable -- External Memory Control Register B XMCRB : Unsigned_8; for XMCRB'Address use System'To_Address (16#75#); XMCRB_XMM0: constant := 1; -- External Memory High Mask XMCRB_XMM1: constant := 2; -- External Memory High Mask XMCRB_XMM2: constant := 4; -- External Memory High Mask XMCRB_XMBK: constant := 128; -- External Memory Bus Keeper Enable -- Oscillator Calibration Value OSCCAL : Unsigned_8; for OSCCAL'Address use System'To_Address (16#66#); OSCCAL_CAL0: constant := 1; -- Oscillator Calibration Value Bit0 OSCCAL_CAL1: constant := 2; -- Oscillator Calibration Value Bit1 OSCCAL_CAL2: constant := 4; -- Oscillator Calibration Value Bit2 OSCCAL_CAL3: constant := 8; -- Oscillator Calibration Value Bit3 OSCCAL_CAL4: constant := 16; -- Oscillator Calibration Value Bit4 OSCCAL_CAL5: constant := 32; -- Oscillator Calibration Value Bit5 OSCCAL_CAL6: constant := 64; -- Oscillator Calibration Value Bit6 OSCCAL_CAL7: constant := 128; -- Oscillator Calibration Value Bit7 CLKPR : Unsigned_8; for CLKPR'Address use System'To_Address (16#61#); CLKPR_CLKPS0: constant := 1; CLKPR_CLKPS1: constant := 2; CLKPR_CLKPS2: constant := 4; CLKPR_CLKPS3: constant := 8; CLKPR_CLKPCE: constant := 128; -- Sleep Mode Control Register SMCR : Unsigned_8; for SMCR'Address use System'To_Address (16#53#); SMCR_SE: constant := 1; -- Sleep Enable SMCR_SM0: constant := 2; -- Sleep Mode Select bit 0 SMCR_SM1: constant := 4; -- Sleep Mode Select bit 1 SMCR_SM2: constant := 8; -- Sleep Mode Select bit 2 -- Extended Indirect Register EIND : Unsigned_8; for EIND'Address use System'To_Address (16#5C#); EIND_EIND0: constant := 1; -- Bit 0 -- RAM Page Z Select Register RAMPZ : Unsigned_8; for RAMPZ'Address use System'To_Address (16#5B#); RAMPZ_RAMPZ0: constant := 1; -- RAM Page Z Select Register Bit 0 RAMPZ_RAMPZ1: constant := 2; -- RAM Page Z Select Register Bit 1 -- General Purpose IO Register 2 GPIOR2 : Unsigned_8; for GPIOR2'Address use System'To_Address (16#4B#); GPIOR2_GPIOR20: constant := 1; -- General Purpose IO Register 2 bit 0 GPIOR2_GPIOR21: constant := 2; -- General Purpose IO Register 2 bit 1 GPIOR2_GPIOR22: constant := 4; -- General Purpose IO Register 2 bit 2 GPIOR2_GPIOR23: constant := 8; -- General Purpose IO Register 2 bit 3 GPIOR2_GPIOR24: constant := 16; -- General Purpose IO Register 2 bit 4 GPIOR2_GPIOR25: constant := 32; -- General Purpose IO Register 2 bit 5 GPIOR2_GPIOR26: constant := 64; -- General Purpose IO Register 2 bit 6 GPIOR2_GPIOR27: constant := 128; -- General Purpose IO Register 2 bit 7 -- General Purpose IO Register 1 GPIOR1 : Unsigned_8; for GPIOR1'Address use System'To_Address (16#4A#); GPIOR1_GPIOR10: constant := 1; -- General Purpose IO Register 1 bit 0 GPIOR1_GPIOR11: constant := 2; -- General Purpose IO Register 1 bit 1 GPIOR1_GPIOR12: constant := 4; -- General Purpose IO Register 1 bit 2 GPIOR1_GPIOR13: constant := 8; -- General Purpose IO Register 1 bit 3 GPIOR1_GPIOR14: constant := 16; -- General Purpose IO Register 1 bit 4 GPIOR1_GPIOR15: constant := 32; -- General Purpose IO Register 1 bit 5 GPIOR1_GPIOR16: constant := 64; -- General Purpose IO Register 1 bit 6 GPIOR1_GPIOR17: constant := 128; -- General Purpose IO Register 1 bit 7 -- General Purpose IO Register 0 GPIOR0 : Unsigned_8; for GPIOR0'Address use System'To_Address (16#3E#); GPIOR0_GPIOR00: constant := 1; -- General Purpose IO Register 0 bit 0 GPIOR0_GPIOR01: constant := 2; -- General Purpose IO Register 0 bit 1 GPIOR0_GPIOR02: constant := 4; -- General Purpose IO Register 0 bit 2 GPIOR0_GPIOR03: constant := 8; -- General Purpose IO Register 0 bit 3 GPIOR0_GPIOR04: constant := 16; -- General Purpose IO Register 0 bit 4 GPIOR0_GPIOR05: constant := 32; -- General Purpose IO Register 0 bit 5 GPIOR0_GPIOR06: constant := 64; -- General Purpose IO Register 0 bit 6 GPIOR0_GPIOR07: constant := 128; -- General Purpose IO Register 0 bit 7 -- Power Reduction Register1 PRR1 : Unsigned_8; for PRR1'Address use System'To_Address (16#65#); PRR1_PRUSART1: constant := 1; -- Power Reduction USART1 PRR1_PRUSART2: constant := 2; -- Power Reduction USART2 PRR1_PRUSART3: constant := 4; -- Power Reduction USART3 PRR1_PRTIM3: constant := 8; -- Power Reduction Timer/Counter3 PRR1_PRTIM4: constant := 16; -- Power Reduction Timer/Counter4 PRR1_PRTIM5: constant := 32; -- Power Reduction Timer/Counter5 -- Power Reduction Register0 PRR0 : Unsigned_8; for PRR0'Address use System'To_Address (16#64#); PRR0_PRADC: constant := 1; -- Power Reduction ADC PRR0_PRUSART0: constant := 2; -- Power Reduction USART PRR0_PRSPI: constant := 4; -- Power Reduction Serial Peripheral Interface PRR0_PRTIM1: constant := 8; -- Power Reduction Timer/Counter1 PRR0_PRTIM0: constant := 32; -- Power Reduction Timer/Counter0 PRR0_PRTIM2: constant := 64; -- Power Reduction Timer/Counter2 PRR0_PRTWI: constant := 128; -- Power Reduction TWI -- The ADC multiplexer Selection Register ADMUX : Unsigned_8; for ADMUX'Address use System'To_Address (16#7C#); ADMUX_MUX0: constant := 1; -- Analog Channel and Gain Selection Bits ADMUX_MUX1: constant := 2; -- Analog Channel and Gain Selection Bits ADMUX_MUX2: constant := 4; -- Analog Channel and Gain Selection Bits ADMUX_MUX3: constant := 8; -- Analog Channel and Gain Selection Bits ADMUX_MUX4: constant := 16; -- Analog Channel and Gain Selection Bits ADMUX_ADLAR: constant := 32; -- Left Adjust Result ADMUX_REFS0: constant := 64; -- Reference Selection Bit 0 ADMUX_REFS1: constant := 128; -- Reference Selection Bit 1 -- ADC Data Register High Byte ADCH : Unsigned_8; for ADCH'Address use System'To_Address (16#79#); ADCH_ADCH0: constant := 1; -- ADC Data Register High Byte Bit 0 ADCH_ADCH1: constant := 2; -- ADC Data Register High Byte Bit 1 ADCH_ADCH2: constant := 4; -- ADC Data Register High Byte Bit 2 ADCH_ADCH3: constant := 8; -- ADC Data Register High Byte Bit 3 ADCH_ADCH4: constant := 16; -- ADC Data Register High Byte Bit 4 ADCH_ADCH5: constant := 32; -- ADC Data Register High Byte Bit 5 ADCH_ADCH6: constant := 64; -- ADC Data Register High Byte Bit 6 ADCH_ADCH7: constant := 128; -- ADC Data Register High Byte Bit 7 -- ADC Data Register Low Byte ADCL : Unsigned_8; for ADCL'Address use System'To_Address (16#78#); ADCL_ADCL0: constant := 1; -- ADC Data Register Low Byte Bit 0 ADCL_ADCL1: constant := 2; -- ADC Data Register Low Byte Bit 1 ADCL_ADCL2: constant := 4; -- ADC Data Register Low Byte Bit 2 ADCL_ADCL3: constant := 8; -- ADC Data Register Low Byte Bit 3 ADCL_ADCL4: constant := 16; -- ADC Data Register Low Byte Bit 4 ADCL_ADCL5: constant := 32; -- ADC Data Register Low Byte Bit 5 ADCL_ADCL6: constant := 64; -- ADC Data Register Low Byte Bit 6 ADCL_ADCL7: constant := 128; -- ADC Data Register Low Byte Bit 7 -- The ADC Control and Status register A ADCSRA : Unsigned_8; for ADCSRA'Address use System'To_Address (16#7A#); ADCSRA_ADPS0: constant := 1; -- ADC Prescaler Select Bits ADCSRA_ADPS1: constant := 2; -- ADC Prescaler Select Bits ADCSRA_ADPS2: constant := 4; -- ADC Prescaler Select Bits ADCSRA_ADIE: constant := 8; -- ADC Interrupt Enable ADCSRA_ADIF: constant := 16; -- ADC Interrupt Flag ADCSRA_ADATE: constant := 32; -- ADC Auto Trigger Enable ADCSRA_ADSC: constant := 64; -- ADC Start Conversion ADCSRA_ADEN: constant := 128; -- ADC Enable -- The ADC Control and Status register B -- Digital Input Disable Register DIDR2 : Unsigned_8; for DIDR2'Address use System'To_Address (16#7D#); DIDR2_ADC8D: constant := 1; DIDR2_ADC9D: constant := 2; DIDR2_ADC10D: constant := 4; DIDR2_ADC11D: constant := 8; DIDR2_ADC12D: constant := 16; DIDR2_ADC13D: constant := 32; DIDR2_ADC14D: constant := 64; DIDR2_ADC15D: constant := 128; -- Digital Input Disable Register DIDR0 : Unsigned_8; for DIDR0'Address use System'To_Address (16#7E#); DIDR0_ADC0D: constant := 1; DIDR0_ADC1D: constant := 2; DIDR0_ADC2D: constant := 4; DIDR0_ADC3D: constant := 8; DIDR0_ADC4D: constant := 16; DIDR0_ADC5D: constant := 32; DIDR0_ADC6D: constant := 64; DIDR0_ADC7D: constant := 128; -- Store Program Memory Control Register SPMCSR : Unsigned_8; for SPMCSR'Address use System'To_Address (16#57#); SPMCSR_SPMEN: constant := 1; -- Store Program Memory Enable SPMCSR_PGERS: constant := 2; -- Page Erase SPMCSR_PGWRT: constant := 4; -- Page Write SPMCSR_BLBSET: constant := 8; -- Boot Lock Bit Set SPMCSR_RWWSRE: constant := 16; -- Read While Write section read enable SPMCSR_SIGRD: constant := 32; -- Signature Row Read SPMCSR_RWWSB: constant := 64; -- Read While Write Section Busy SPMCSR_SPMIE: constant := 128; -- SPM Interrupt Enable -- USART I/O Data Register UDR2 : Unsigned_8; for UDR2'Address use System'To_Address (16#D6#); -- USART Control and Status Register A UCSR2A : Unsigned_8; for UCSR2A'Address use System'To_Address (16#D0#); UCSR2A_MPCM2: constant := 1; -- Multi-processor Communication Mode UCSR2A_U2X2: constant := 2; -- Double the USART transmission speed UCSR2A_UPE2: constant := 4; -- Parity Error UCSR2A_DOR2: constant := 8; -- Data overRun UCSR2A_FE2: constant := 16; -- Framing Error UCSR2A_UDRE2: constant := 32; -- USART Data Register Empty UCSR2A_TXC2: constant := 64; -- USART Transmitt Complete UCSR2A_RXC2: constant := 128; -- USART Receive Complete -- USART Control and Status Register B UCSR2B : Unsigned_8; for UCSR2B'Address use System'To_Address (16#D1#); UCSR2B_TXB82: constant := 1; -- Transmit Data Bit 8 UCSR2B_RXB82: constant := 2; -- Receive Data Bit 8 UCSR2B_UCSZ22: constant := 4; -- Character Size UCSR2B_TXEN2: constant := 8; -- Transmitter Enable UCSR2B_RXEN2: constant := 16; -- Receiver Enable UCSR2B_UDRIE2: constant := 32; -- USART Data register Empty Interrupt Enable UCSR2B_TXCIE2: constant := 64; -- TX Complete Interrupt Enable UCSR2B_RXCIE2: constant := 128; -- RX Complete Interrupt Enable -- USART Control and Status Register C UCSR2C : Unsigned_8; for UCSR2C'Address use System'To_Address (16#D2#); UCSR2C_UCPOL2: constant := 1; -- Clock Polarity UCSR2C_UCSZ20: constant := 2; -- Character Size UCSR2C_UCSZ21: constant := 4; -- Character Size UCSR2C_USBS2: constant := 8; -- Stop Bit Select UCSR2C_UPM20: constant := 16; -- Parity Mode Bit 0 UCSR2C_UPM21: constant := 32; -- Parity Mode Bit 1 UCSR2C_UMSEL20: constant := 64; -- USART Mode Select UCSR2C_UMSEL21: constant := 128; -- USART Mode Select -- USART Baud Rate Register High Byte UBRR2H : Unsigned_8; for UBRR2H'Address use System'To_Address (16#D5#); UBRR2H_UBRR8: constant := 1; -- USART Baud Rate Register bit 8 UBRR2H_UBRR9: constant := 2; -- USART Baud Rate Register bit 9 UBRR2H_UBRR10: constant := 4; -- USART Baud Rate Register bit 10 UBRR2H_UBRR11: constant := 8; -- USART Baud Rate Register bit 11 -- USART Baud Rate Register Low Byte UBRR2L : Unsigned_8; for UBRR2L'Address use System'To_Address (16#D4#); UBRR2L_UBRR0: constant := 1; -- USART Baud Rate Register bit 0 UBRR2L_UBRR1: constant := 2; -- USART Baud Rate Register bit 1 UBRR2L_UBRR2: constant := 4; -- USART Baud Rate Register bit 2 UBRR2L_UBRR3: constant := 8; -- USART Baud Rate Register bit 3 UBRR2L_UBRR4: constant := 16; -- USART Baud Rate Register bit 4 UBRR2L_UBRR5: constant := 32; -- USART Baud Rate Register bit 5 UBRR2L_UBRR6: constant := 64; -- USART Baud Rate Register bit 6 UBRR2L_UBRR7: constant := 128; -- USART Baud Rate Register bit 7 -- USART I/O Data Register UDR3 : Unsigned_8; for UDR3'Address use System'To_Address (16#136#); -- USART Control and Status Register A UCSR3A : Unsigned_8; for UCSR3A'Address use System'To_Address (16#130#); UCSR3A_MPCM3: constant := 1; -- Multi-processor Communication Mode UCSR3A_U2X3: constant := 2; -- Double the USART transmission speed UCSR3A_UPE3: constant := 4; -- Parity Error UCSR3A_DOR3: constant := 8; -- Data overRun UCSR3A_FE3: constant := 16; -- Framing Error UCSR3A_UDRE3: constant := 32; -- USART Data Register Empty UCSR3A_TXC3: constant := 64; -- USART Transmitt Complete UCSR3A_RXC3: constant := 128; -- USART Receive Complete -- USART Control and Status Register B UCSR3B : Unsigned_8; for UCSR3B'Address use System'To_Address (16#131#); UCSR3B_TXB83: constant := 1; -- Transmit Data Bit 8 UCSR3B_RXB83: constant := 2; -- Receive Data Bit 8 UCSR3B_UCSZ32: constant := 4; -- Character Size UCSR3B_TXEN3: constant := 8; -- Transmitter Enable UCSR3B_RXEN3: constant := 16; -- Receiver Enable UCSR3B_UDRIE3: constant := 32; -- USART Data register Empty Interrupt Enable UCSR3B_TXCIE3: constant := 64; -- TX Complete Interrupt Enable UCSR3B_RXCIE3: constant := 128; -- RX Complete Interrupt Enable -- USART Control and Status Register C UCSR3C : Unsigned_8; for UCSR3C'Address use System'To_Address (16#132#); UCSR3C_UCPOL3: constant := 1; -- Clock Polarity UCSR3C_UCSZ30: constant := 2; -- Character Size UCSR3C_UCSZ31: constant := 4; -- Character Size UCSR3C_USBS3: constant := 8; -- Stop Bit Select UCSR3C_UPM30: constant := 16; -- Parity Mode Bit 0 UCSR3C_UPM31: constant := 32; -- Parity Mode Bit 1 UCSR3C_UMSEL30: constant := 64; -- USART Mode Select UCSR3C_UMSEL31: constant := 128; -- USART Mode Select -- USART Baud Rate Register High Byte UBRR3H : Unsigned_8; for UBRR3H'Address use System'To_Address (16#135#); UBRR3H_UBRR8: constant := 1; -- USART Baud Rate Register bit 8 UBRR3H_UBRR9: constant := 2; -- USART Baud Rate Register bit 9 UBRR3H_UBRR10: constant := 4; -- USART Baud Rate Register bit 10 UBRR3H_UBRR11: constant := 8; -- USART Baud Rate Register bit 11 -- USART Baud Rate Register Low Byte UBRR3L : Unsigned_8; for UBRR3L'Address use System'To_Address (16#134#); UBRR3L_UBRR0: constant := 1; -- USART Baud Rate Register bit 0 UBRR3L_UBRR1: constant := 2; -- USART Baud Rate Register bit 1 UBRR3L_UBRR2: constant := 4; -- USART Baud Rate Register bit 2 UBRR3L_UBRR3: constant := 8; -- USART Baud Rate Register bit 3 UBRR3L_UBRR4: constant := 16; -- USART Baud Rate Register bit 4 UBRR3L_UBRR5: constant := 32; -- USART Baud Rate Register bit 5 UBRR3L_UBRR6: constant := 64; -- USART Baud Rate Register bit 6 UBRR3L_UBRR7: constant := 128; -- USART Baud Rate Register bit 7 end ATmega2560;
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; with SDL_stdinc_h; package SDL_clipboard_h is -- Simple DirectMedia Layer -- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. -- --* -- * \file SDL_clipboard.h -- * -- * Include file for SDL clipboard handling -- -- Set up for C function definitions, even when using C++ -- Function prototypes --* -- * \brief Put UTF-8 text into the clipboard -- * -- * \sa SDL_GetClipboardText() -- function SDL_SetClipboardText (text : Interfaces.C.Strings.chars_ptr) return int; -- ..\SDL2_tmp\SDL_clipboard.h:46 pragma Import (C, SDL_SetClipboardText, "SDL_SetClipboardText"); --* -- * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() -- * -- * \sa SDL_SetClipboardText() -- function SDL_GetClipboardText return Interfaces.C.Strings.chars_ptr; -- ..\SDL2_tmp\SDL_clipboard.h:53 pragma Import (C, SDL_GetClipboardText, "SDL_GetClipboardText"); --* -- * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty -- * -- * \sa SDL_GetClipboardText() -- function SDL_HasClipboardText return SDL_stdinc_h.SDL_bool; -- ..\SDL2_tmp\SDL_clipboard.h:60 pragma Import (C, SDL_HasClipboardText, "SDL_HasClipboardText"); -- Ends C function definitions when using C++ -- vi: set ts=4 sw=4 expandtab: end SDL_clipboard_h;
-- AoC 2020, Day 17 with Ada.Text_IO; package body Day is package TIO renames Ada.Text_IO; function location_hash(key : in Location) return Hash_Type is begin return Hash_Type(abs((key.x * 137) + (key.y * 149) + (key.z * 163) + (key.w * 13))); end location_hash; procedure parse_line(line : in String; y : in Natural; g : in out Grid_Set.Set) is x : Natural := 0; begin for c of line loop if c = '#' then g.insert(Location'(X => x, Y => y, Z=> 0, W => 0)); end if; x := x + 1; end loop; end parse_line; function load_file(filename : in String) return Grid_Set.Set is file : TIO.File_Type; g : Grid_Set.Set := Empty_Set; y : Natural := 0; begin TIO.open(File => file, Mode => TIO.In_File, Name => filename); while not TIO.end_of_file(file) loop parse_line(TIO.get_line(file), y, g); y := y + 1; end loop; TIO.close(file); return g; end load_file; pragma Warnings (Off); procedure put_line(l : in Location) is pragma Warnings (On); begin TIO.put_line(l.x'IMAGE & "," & l.y'IMAGE & "," & l.z'IMAGE & "," & l.w'IMAGE); end put_line; function neighbors(l : in Location) return Grid_Set.Set is g : Grid_Set.Set := Empty_Set; begin for x in l.x-1 .. l.x+1 loop for y in l.y-1 .. l.y+1 loop for z in l.z-1 .. l.z+1 loop g.include(Location'(X=>x, Y=>y, Z=>z, W=>0)); end loop; end loop; end loop; g.exclude(l); return g; end neighbors; function neighbors_4d(l : in Location) return Grid_Set.Set is g : Grid_Set.Set := Empty_Set; begin for x in l.x-1 .. l.x+1 loop for y in l.y-1 .. l.y+1 loop for z in l.z-1 .. l.z+1 loop for w in l.w-1 .. l.w+1 loop g.include(Location'(X=>x, Y=>y, Z=>z, W=>w)); end loop; end loop; end loop; end loop; g.exclude(l); return g; end neighbors_4d; function active(to_check : in Grid_Set.Set; active : in Grid_Set.Set) return Natural is cnt : Natural := 0; begin for l of to_check loop if active.contains(l) then cnt := cnt + 1; end if; end loop; return cnt; end active; procedure step(g : in out Grid_Set.Set; fourd : in Boolean) is old_grid : constant Grid_Set.Set := g; new_grid : Grid_Set.Set := Empty_Set; all_possible : Grid_Set.Set := Empty_Set; begin for p of old_grid loop all_possible.include(p); if fourd then all_possible := all_possible or neighbors_4d(p); else all_possible := all_possible or neighbors(p); end if; end loop; for p of all_possible loop declare neighs : Grid_Set.Set := Empty_Set; active_neigh : Natural := 0; was_active : constant Boolean := old_grid.contains(p); begin if fourd then neighs := neighbors_4d(p); else neighs := neighbors(p); end if; active_neigh := active(neighs, old_grid); if was_active then if active_neigh = 2 or active_neigh = 3 then new_grid.include(p); end if; else if active_neigh = 3 then new_grid.include(p); end if; end if; end; end loop; g := new_grid; end step; function active_count(g : in Grid_Set.Set; cycles : in Natural) return Natural is grid : Grid_Set.Set := g; begin for i in 1..cycles loop step(grid, false); end loop; return Natural(grid.length); end active_count; function active_count_4d(g : in Grid_Set.Set; cycles : in Natural) return Natural is grid : Grid_Set.Set := g; begin for i in 1..cycles loop step(grid, true); end loop; return Natural(grid.length); end active_count_4d; end Day;
with Extraction.Utilities; private package Extraction.Graph_Operations is type Graph_Context is tagged private; function Create_Graph_Context (Graph_File : access GW.GraphML_File; Directory_Prefix : VFS.Virtual_File; Project_Context : Utilities.Project_Context) return Graph_Context; procedure Write_Node (Graph : Graph_Context; File : VFS.Virtual_File); procedure Write_Node (Graph : Graph_Context; Project : GPR.Project_Type); procedure Write_Node (Graph : Graph_Context; Basic_Decl : LAL.Basic_Decl); procedure Write_Node (Graph : Graph_Context; Defining_Name : LAL.Defining_Name; Basic_Decl : LAL.Basic_Decl); procedure Write_Edge (Graph : Graph_Context; Source_Project : GPR.Project_Type; Target_Project : GPR.Project_Type; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Project : GPR.Project_Type; Target_File : VFS.Virtual_File; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_File : VFS.Virtual_File; Target_Project : GPR.Project_Type; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_File : VFS.Virtual_File; Target_File : VFS.Virtual_File; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Unit : LAL.Analysis_Unit; Target_Name : LAL.Defining_Name; Target_Decl : LAL.Basic_Decl'Class; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Name : LAL.Defining_Name; Source_Decl : LAL.Basic_Decl'Class; Target_Unit : LAL.Analysis_Unit; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Decl : LAL.Basic_Decl'Class; Target_Decl : LAL.Basic_Decl'Class; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Name : LAL.Defining_Name; Source_Decl : LAL.Basic_Decl'Class; Target_Decl : LAL.Basic_Decl'Class; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Decl : LAL.Basic_Decl'Class; Target_Name : LAL.Defining_Name; Target_Decl : LAL.Basic_Decl'Class; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); procedure Write_Edge (Graph : Graph_Context; Source_Name : LAL.Defining_Name; Source_Decl : LAL.Basic_Decl'Class; Target_Name : LAL.Defining_Name; Target_Decl : LAL.Basic_Decl'Class; Edge_Ty : GraphML_Writers.Edge_Type; Edge_Attrs : GW.Attribute_Value_Sets.Map := GW.Attribute_Value_Sets.Empty); private type Graph_Context is tagged record Graph_File : access GW.GraphML_File; Directory_Prefix : VFS.Virtual_File; Project_Context : Utilities.Project_Context; end record; end Extraction.Graph_Operations;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package body Items is function Integer_Image(Self : in Integer) return String is Img : constant String := Integer'Image(Self); begin if Self < 0 then return Img; else return Img(2 .. Img'Length); end if; end; function To_String(Self : in Item) return String is Name : constant Unbounded_String := Self.Name; Sell_In : constant Unbounded_String := To_Unbounded_String(Integer_Image(Self.Sell_In)); Quality : constant Unbounded_String := To_Unbounded_String(Integer_Image(Self.Quality)); Ret : Unbounded_String; begin Append(Ret, Name); Append(Ret, ", "); Append(Ret, Sell_In); Append(Ret, ", "); Append(Ret, Quality); return To_String(Ret); end; end Items;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 6 -- -- -- -- 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 Atree; use Atree; with Checks; use Checks; with Contracts; use Contracts; with Debug; use Debug; with Einfo; use Einfo; with Errout; use Errout; with Elists; use Elists; with Exp_Aggr; use Exp_Aggr; with Exp_Atag; use Exp_Atag; with Exp_Ch2; use Exp_Ch2; with Exp_Ch3; use Exp_Ch3; with Exp_Ch7; use Exp_Ch7; with Exp_Ch9; use Exp_Ch9; with Exp_Dbug; use Exp_Dbug; with Exp_Disp; use Exp_Disp; with Exp_Dist; use Exp_Dist; with Exp_Intr; use Exp_Intr; with Exp_Pakd; use Exp_Pakd; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Inline; use Inline; with Lib; use Lib; with Namet; use Namet; 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 Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch6; use Sem_Ch6; with Sem_Ch8; use Sem_Ch8; with Sem_Ch12; use Sem_Ch12; with Sem_Ch13; use Sem_Ch13; with Sem_Dim; use Sem_Dim; with Sem_Disp; use Sem_Disp; with Sem_Dist; use Sem_Dist; with Sem_Eval; use Sem_Eval; with Sem_Mech; use Sem_Mech; with Sem_Res; use Sem_Res; with Sem_SCIL; use Sem_SCIL; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; with Validsw; use Validsw; package body Exp_Ch6 is ----------------------- -- Local Subprograms -- ----------------------- procedure Add_Access_Actual_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; Return_Object : Node_Id; Is_Access : Boolean := False); -- Ada 2005 (AI-318-02): Apply the Unrestricted_Access attribute to the -- object name given by Return_Object and add the attribute to the end of -- the actual parameter list associated with the build-in-place function -- call denoted by Function_Call. However, if Is_Access is True, then -- Return_Object is already an access expression, in which case it's passed -- along directly to the build-in-place function. Finally, if Return_Object -- is empty, then pass a null literal as the actual. procedure Add_Unconstrained_Actuals_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; Alloc_Form : BIP_Allocation_Form := Unspecified; Alloc_Form_Exp : Node_Id := Empty; Pool_Actual : Node_Id := Make_Null (No_Location)); -- Ada 2005 (AI-318-02): Add the actuals needed for a build-in-place -- function call that returns a caller-unknown-size result (BIP_Alloc_Form -- and BIP_Storage_Pool). If Alloc_Form_Exp is present, then use it, -- otherwise pass a literal corresponding to the Alloc_Form parameter -- (which must not be Unspecified in that case). Pool_Actual is the -- parameter to pass to BIP_Storage_Pool. procedure Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call : Node_Id; Func_Id : Entity_Id; Ptr_Typ : Entity_Id := Empty; Master_Exp : Node_Id := Empty); -- Ada 2005 (AI-318-02): If the result type of a build-in-place call needs -- finalization actions, add an actual parameter which is a pointer to the -- finalization master of the caller. If Master_Exp is not Empty, then that -- will be passed as the actual. Otherwise, if Ptr_Typ is left Empty, this -- will result in an automatic "null" value for the actual. procedure Add_Task_Actuals_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; Master_Actual : Node_Id; Chain : Node_Id := Empty); -- Ada 2005 (AI-318-02): For a build-in-place call, if the result type -- contains tasks, add two actual parameters: the master, and a pointer to -- the caller's activation chain. Master_Actual is the actual parameter -- expression to pass for the master. In most cases, this is the current -- master (_master). The two exceptions are: If the function call is the -- initialization expression for an allocator, we pass the master of the -- access type. If the function call is the initialization expression for a -- return object, we pass along the master passed in by the caller. In most -- contexts, the activation chain to pass is the local one, which is -- indicated by No (Chain). However, in an allocator, the caller passes in -- the activation Chain. Note: Master_Actual can be Empty, but only if -- there are no tasks. procedure Check_Overriding_Operation (Subp : Entity_Id); -- Subp is a dispatching operation. Check whether it may override an -- inherited private operation, in which case its DT entry is that of -- the hidden operation, not the one it may have received earlier. -- This must be done before emitting the code to set the corresponding -- DT to the address of the subprogram. The actual placement of Subp in -- the proper place in the list of primitive operations is done in -- Declare_Inherited_Private_Subprograms, which also has to deal with -- implicit operations. This duplication is unavoidable for now??? procedure Detect_Infinite_Recursion (N : Node_Id; Spec : Entity_Id); -- This procedure is called only if the subprogram body N, whose spec -- has the given entity Spec, contains a parameterless recursive call. -- It attempts to generate runtime code to detect if this a case of -- infinite recursion. -- -- The body is scanned to determine dependencies. If the only external -- dependencies are on a small set of scalar variables, then the values -- of these variables are captured on entry to the subprogram, and if -- the values are not changed for the call, we know immediately that -- we have an infinite recursion. procedure Expand_Actuals (N : in out Node_Id; Subp : Entity_Id); -- For each actual of an in-out or out parameter which is a numeric -- (view) conversion of the form T (A), where A denotes a variable, -- we insert the declaration: -- -- Temp : T[ := T (A)]; -- -- prior to the call. Then we replace the actual with a reference to Temp, -- and append the assignment: -- -- A := TypeA (Temp); -- -- after the call. Here TypeA is the actual type of variable A. For out -- parameters, the initial declaration has no expression. If A is not an -- entity name, we generate instead: -- -- Var : TypeA renames A; -- Temp : T := Var; -- omitting expression for out parameter. -- ... -- Var := TypeA (Temp); -- -- For other in-out parameters, we emit the required constraint checks -- before and/or after the call. -- -- For all parameter modes, actuals that denote components and slices of -- packed arrays are expanded into suitable temporaries. -- -- For non-scalar objects that are possibly unaligned, add call by copy -- code (copy in for IN and IN OUT, copy out for OUT and IN OUT). -- -- For OUT and IN OUT parameters, add predicate checks after the call -- based on the predicates of the actual type. -- -- The parameter N is IN OUT because in some cases, the expansion code -- rewrites the call as an expression actions with the call inside. In -- this case N is reset to point to the inside call so that the caller -- can continue processing of this call. procedure Expand_Ctrl_Function_Call (N : Node_Id); -- N is a function call which returns a controlled object. Transform the -- call into a temporary which retrieves the returned object from the -- secondary stack using 'reference. procedure Expand_Non_Function_Return (N : Node_Id); -- Expand a simple return statement found in a procedure body, entry body, -- accept statement, or an extended return statement. Note that all non- -- function returns are simple return statements. function Expand_Protected_Object_Reference (N : Node_Id; Scop : Entity_Id) return Node_Id; procedure Expand_Protected_Subprogram_Call (N : Node_Id; Subp : Entity_Id; Scop : Entity_Id); -- A call to a protected subprogram within the protected object may appear -- as a regular call. The list of actuals must be expanded to contain a -- reference to the object itself, and the call becomes a call to the -- corresponding protected subprogram. procedure Expand_Simple_Function_Return (N : Node_Id); -- Expand simple return from function. In the case where we are returning -- from a function body this is called by Expand_N_Simple_Return_Statement. function Has_Unconstrained_Access_Discriminants (Subtyp : Entity_Id) return Boolean; -- Returns True if the given subtype is unconstrained and has one or more -- access discriminants. procedure Rewrite_Function_Call_For_C (N : Node_Id); -- When generating C code, replace a call to a function that returns an -- array into the generated procedure with an additional out parameter. procedure Set_Enclosing_Sec_Stack_Return (N : Node_Id); -- N is a return statement for a function that returns its result on the -- secondary stack. This sets the Sec_Stack_Needed_For_Return flag on the -- function and all blocks and loops that the return statement is jumping -- out of. This ensures that the secondary stack is not released; otherwise -- the function result would be reclaimed before returning to the caller. ---------------------------------------------- -- Add_Access_Actual_To_Build_In_Place_Call -- ---------------------------------------------- procedure Add_Access_Actual_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; Return_Object : Node_Id; Is_Access : Boolean := False) is Loc : constant Source_Ptr := Sloc (Function_Call); Obj_Address : Node_Id; Obj_Acc_Formal : Entity_Id; begin -- Locate the implicit access parameter in the called function Obj_Acc_Formal := Build_In_Place_Formal (Function_Id, BIP_Object_Access); -- If no return object is provided, then pass null if not Present (Return_Object) then Obj_Address := Make_Null (Loc); Set_Parent (Obj_Address, Function_Call); -- If Return_Object is already an expression of an access type, then use -- it directly, since it must be an access value denoting the return -- object, and couldn't possibly be the return object itself. elsif Is_Access then Obj_Address := Return_Object; Set_Parent (Obj_Address, Function_Call); -- Apply Unrestricted_Access to caller's return object else Obj_Address := Make_Attribute_Reference (Loc, Prefix => Return_Object, Attribute_Name => Name_Unrestricted_Access); Set_Parent (Return_Object, Obj_Address); Set_Parent (Obj_Address, Function_Call); end if; Analyze_And_Resolve (Obj_Address, Etype (Obj_Acc_Formal)); -- Build the parameter association for the new actual and add it to the -- end of the function's actuals. Add_Extra_Actual_To_Call (Function_Call, Obj_Acc_Formal, Obj_Address); end Add_Access_Actual_To_Build_In_Place_Call; ------------------------------------------------------ -- Add_Unconstrained_Actuals_To_Build_In_Place_Call -- ------------------------------------------------------ procedure Add_Unconstrained_Actuals_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; Alloc_Form : BIP_Allocation_Form := Unspecified; Alloc_Form_Exp : Node_Id := Empty; Pool_Actual : Node_Id := Make_Null (No_Location)) is Loc : constant Source_Ptr := Sloc (Function_Call); Alloc_Form_Actual : Node_Id; Alloc_Form_Formal : Node_Id; Pool_Formal : Node_Id; begin -- The allocation form generally doesn't need to be passed in the case -- of a constrained result subtype, since normally the caller performs -- the allocation in that case. However this formal is still needed in -- the case where the function has a tagged result, because generally -- such functions can be called in a dispatching context and such calls -- must be handled like calls to class-wide functions. if Is_Constrained (Underlying_Type (Etype (Function_Id))) and then not Is_Tagged_Type (Underlying_Type (Etype (Function_Id))) then return; end if; -- Locate the implicit allocation form parameter in the called function. -- Maybe it would be better for each implicit formal of a build-in-place -- function to have a flag or a Uint attribute to identify it. ??? Alloc_Form_Formal := Build_In_Place_Formal (Function_Id, BIP_Alloc_Form); if Present (Alloc_Form_Exp) then pragma Assert (Alloc_Form = Unspecified); Alloc_Form_Actual := Alloc_Form_Exp; else pragma Assert (Alloc_Form /= Unspecified); Alloc_Form_Actual := Make_Integer_Literal (Loc, Intval => UI_From_Int (BIP_Allocation_Form'Pos (Alloc_Form))); end if; Analyze_And_Resolve (Alloc_Form_Actual, Etype (Alloc_Form_Formal)); -- Build the parameter association for the new actual and add it to the -- end of the function's actuals. Add_Extra_Actual_To_Call (Function_Call, Alloc_Form_Formal, Alloc_Form_Actual); -- Pass the Storage_Pool parameter. This parameter is omitted on -- ZFP as those targets do not support pools. if RTE_Available (RE_Root_Storage_Pool_Ptr) then Pool_Formal := Build_In_Place_Formal (Function_Id, BIP_Storage_Pool); Analyze_And_Resolve (Pool_Actual, Etype (Pool_Formal)); Add_Extra_Actual_To_Call (Function_Call, Pool_Formal, Pool_Actual); end if; end Add_Unconstrained_Actuals_To_Build_In_Place_Call; ----------------------------------------------------------- -- Add_Finalization_Master_Actual_To_Build_In_Place_Call -- ----------------------------------------------------------- procedure Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call : Node_Id; Func_Id : Entity_Id; Ptr_Typ : Entity_Id := Empty; Master_Exp : Node_Id := Empty) is begin if not Needs_BIP_Finalization_Master (Func_Id) then return; end if; declare Formal : constant Entity_Id := Build_In_Place_Formal (Func_Id, BIP_Finalization_Master); Loc : constant Source_Ptr := Sloc (Func_Call); Actual : Node_Id; Desig_Typ : Entity_Id; begin -- If there is a finalization master actual, such as the implicit -- finalization master of an enclosing build-in-place function, -- then this must be added as an extra actual of the call. if Present (Master_Exp) then Actual := Master_Exp; -- Case where the context does not require an actual master elsif No (Ptr_Typ) then Actual := Make_Null (Loc); else Desig_Typ := Directly_Designated_Type (Ptr_Typ); -- Check for a library-level access type whose designated type has -- supressed finalization. Such an access types lack a master. -- Pass a null actual to the callee in order to signal a missing -- master. if Is_Library_Level_Entity (Ptr_Typ) and then Finalize_Storage_Only (Desig_Typ) then Actual := Make_Null (Loc); -- Types in need of finalization actions elsif Needs_Finalization (Desig_Typ) then -- The general mechanism of creating finalization masters for -- anonymous access types is disabled by default, otherwise -- finalization masters will pop all over the place. Such types -- use context-specific masters. if Ekind (Ptr_Typ) = E_Anonymous_Access_Type and then No (Finalization_Master (Ptr_Typ)) then Build_Anonymous_Master (Ptr_Typ); end if; -- Access-to-controlled types should always have a master pragma Assert (Present (Finalization_Master (Ptr_Typ))); Actual := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Finalization_Master (Ptr_Typ), Loc), Attribute_Name => Name_Unrestricted_Access); -- Tagged types else Actual := Make_Null (Loc); end if; end if; Analyze_And_Resolve (Actual, Etype (Formal)); -- Build the parameter association for the new actual and add it to -- the end of the function's actuals. Add_Extra_Actual_To_Call (Func_Call, Formal, Actual); end; end Add_Finalization_Master_Actual_To_Build_In_Place_Call; ------------------------------ -- Add_Extra_Actual_To_Call -- ------------------------------ procedure Add_Extra_Actual_To_Call (Subprogram_Call : Node_Id; Extra_Formal : Entity_Id; Extra_Actual : Node_Id) is Loc : constant Source_Ptr := Sloc (Subprogram_Call); Param_Assoc : Node_Id; begin Param_Assoc := Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of (Extra_Formal, Loc), Explicit_Actual_Parameter => Extra_Actual); Set_Parent (Param_Assoc, Subprogram_Call); Set_Parent (Extra_Actual, Param_Assoc); if Present (Parameter_Associations (Subprogram_Call)) then if Nkind (Last (Parameter_Associations (Subprogram_Call))) = N_Parameter_Association then -- Find last named actual, and append declare L : Node_Id; begin L := First_Actual (Subprogram_Call); while Present (L) loop if No (Next_Actual (L)) then Set_Next_Named_Actual (Parent (L), Extra_Actual); exit; end if; Next_Actual (L); end loop; end; else Set_First_Named_Actual (Subprogram_Call, Extra_Actual); end if; Append (Param_Assoc, To => Parameter_Associations (Subprogram_Call)); else Set_Parameter_Associations (Subprogram_Call, New_List (Param_Assoc)); Set_First_Named_Actual (Subprogram_Call, Extra_Actual); end if; end Add_Extra_Actual_To_Call; --------------------------------------------- -- Add_Task_Actuals_To_Build_In_Place_Call -- --------------------------------------------- procedure Add_Task_Actuals_To_Build_In_Place_Call (Function_Call : Node_Id; Function_Id : Entity_Id; Master_Actual : Node_Id; Chain : Node_Id := Empty) is Loc : constant Source_Ptr := Sloc (Function_Call); Result_Subt : constant Entity_Id := Available_View (Etype (Function_Id)); Actual : Node_Id; Chain_Actual : Node_Id; Chain_Formal : Node_Id; Master_Formal : Node_Id; begin -- No such extra parameters are needed if there are no tasks if not Has_Task (Result_Subt) then return; end if; Actual := Master_Actual; -- Use a dummy _master actual in case of No_Task_Hierarchy if Restriction_Active (No_Task_Hierarchy) then Actual := New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc); -- In the case where we use the master associated with an access type, -- the actual is an entity and requires an explicit reference. elsif Nkind (Actual) = N_Defining_Identifier then Actual := New_Occurrence_Of (Actual, Loc); end if; -- Locate the implicit master parameter in the called function Master_Formal := Build_In_Place_Formal (Function_Id, BIP_Task_Master); Analyze_And_Resolve (Actual, Etype (Master_Formal)); -- Build the parameter association for the new actual and add it to the -- end of the function's actuals. Add_Extra_Actual_To_Call (Function_Call, Master_Formal, Actual); -- Locate the implicit activation chain parameter in the called function Chain_Formal := Build_In_Place_Formal (Function_Id, BIP_Activation_Chain); -- Create the actual which is a pointer to the current activation chain if No (Chain) then Chain_Actual := Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uChain), Attribute_Name => Name_Unrestricted_Access); -- Allocator case; make a reference to the Chain passed in by the caller else Chain_Actual := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Chain, Loc), Attribute_Name => Name_Unrestricted_Access); end if; Analyze_And_Resolve (Chain_Actual, Etype (Chain_Formal)); -- Build the parameter association for the new actual and add it to the -- end of the function's actuals. Add_Extra_Actual_To_Call (Function_Call, Chain_Formal, Chain_Actual); end Add_Task_Actuals_To_Build_In_Place_Call; ----------------------- -- BIP_Formal_Suffix -- ----------------------- function BIP_Formal_Suffix (Kind : BIP_Formal_Kind) return String is begin case Kind is when BIP_Alloc_Form => return "BIPalloc"; when BIP_Storage_Pool => return "BIPstoragepool"; when BIP_Finalization_Master => return "BIPfinalizationmaster"; when BIP_Task_Master => return "BIPtaskmaster"; when BIP_Activation_Chain => return "BIPactivationchain"; when BIP_Object_Access => return "BIPaccess"; end case; end BIP_Formal_Suffix; --------------------------- -- Build_In_Place_Formal -- --------------------------- function Build_In_Place_Formal (Func : Entity_Id; Kind : BIP_Formal_Kind) return Entity_Id is Formal_Name : constant Name_Id := New_External_Name (Chars (Func), BIP_Formal_Suffix (Kind)); Extra_Formal : Entity_Id := Extra_Formals (Func); begin -- Maybe it would be better for each implicit formal of a build-in-place -- function to have a flag or a Uint attribute to identify it. ??? -- The return type in the function declaration may have been a limited -- view, and the extra formals for the function were not generated at -- that point. At the point of call the full view must be available and -- the extra formals can be created. if No (Extra_Formal) then Create_Extra_Formals (Func); Extra_Formal := Extra_Formals (Func); end if; loop pragma Assert (Present (Extra_Formal)); exit when Chars (Extra_Formal) = Formal_Name; Next_Formal_With_Extras (Extra_Formal); end loop; return Extra_Formal; end Build_In_Place_Formal; ------------------------------- -- Build_Procedure_Body_Form -- ------------------------------- function Build_Procedure_Body_Form (Func_Id : Entity_Id; Func_Body : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (Func_Body); Proc_Decl : constant Node_Id := Next (Unit_Declaration_Node (Func_Id)); -- It is assumed that the next node following the declaration of the -- corresponding subprogram spec is the declaration of the procedure -- form. Proc_Id : constant Entity_Id := Defining_Entity (Proc_Decl); procedure Replace_Returns (Param_Id : Entity_Id; Stmts : List_Id); -- Replace each return statement found in the list Stmts with an -- assignment of the return expression to parameter Param_Id. --------------------- -- Replace_Returns -- --------------------- procedure Replace_Returns (Param_Id : Entity_Id; Stmts : List_Id) is Stmt : Node_Id; begin Stmt := First (Stmts); while Present (Stmt) loop if Nkind (Stmt) = N_Block_Statement then Replace_Returns (Param_Id, Statements (Stmt)); elsif Nkind (Stmt) = N_Case_Statement then declare Alt : Node_Id; begin Alt := First (Alternatives (Stmt)); while Present (Alt) loop Replace_Returns (Param_Id, Statements (Alt)); Next (Alt); end loop; end; elsif Nkind (Stmt) = N_Extended_Return_Statement then declare Ret_Obj : constant Entity_Id := Defining_Entity (First (Return_Object_Declarations (Stmt))); Assign : constant Node_Id := Make_Assignment_Statement (Sloc (Stmt), Name => New_Occurrence_Of (Param_Id, Loc), Expression => New_Occurrence_Of (Ret_Obj, Sloc (Stmt))); Stmts : List_Id; begin -- The extended return may just contain the declaration if Present (Handled_Statement_Sequence (Stmt)) then Stmts := Statements (Handled_Statement_Sequence (Stmt)); else Stmts := New_List; end if; Set_Assignment_OK (Name (Assign)); Rewrite (Stmt, Make_Block_Statement (Sloc (Stmt), Declarations => Return_Object_Declarations (Stmt), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts))); Replace_Returns (Param_Id, Stmts); Append_To (Stmts, Assign); Append_To (Stmts, Make_Simple_Return_Statement (Loc)); end; elsif Nkind (Stmt) = N_If_Statement then Replace_Returns (Param_Id, Then_Statements (Stmt)); Replace_Returns (Param_Id, Else_Statements (Stmt)); declare Part : Node_Id; begin Part := First (Elsif_Parts (Stmt)); while Present (Part) loop Replace_Returns (Param_Id, Then_Statements (Part)); Next (Part); end loop; end; elsif Nkind (Stmt) = N_Loop_Statement then Replace_Returns (Param_Id, Statements (Stmt)); elsif Nkind (Stmt) = N_Simple_Return_Statement then -- Generate: -- Param := Expr; -- return; Rewrite (Stmt, Make_Assignment_Statement (Sloc (Stmt), Name => New_Occurrence_Of (Param_Id, Loc), Expression => Relocate_Node (Expression (Stmt)))); Insert_After (Stmt, Make_Simple_Return_Statement (Loc)); -- Skip the added return Next (Stmt); end if; Next (Stmt); end loop; end Replace_Returns; -- Local variables Stmts : List_Id; New_Body : Node_Id; -- Start of processing for Build_Procedure_Body_Form begin -- This routine replaces the original function body: -- function F (...) return Array_Typ is -- begin -- ... -- return Something; -- end F; -- with the following: -- procedure P (..., Result : out Array_Typ) is -- begin -- ... -- Result := Something; -- end P; Stmts := Statements (Handled_Statement_Sequence (Func_Body)); Replace_Returns (Last_Entity (Proc_Id), Stmts); New_Body := Make_Subprogram_Body (Loc, Specification => Copy_Subprogram_Spec (Specification (Proc_Decl)), Declarations => Declarations (Func_Body), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts)); -- If the function is a generic instance, so is the new procedure. -- Set flag accordingly so that the proper renaming declarations are -- generated. Set_Is_Generic_Instance (Proc_Id, Is_Generic_Instance (Func_Id)); return New_Body; end Build_Procedure_Body_Form; -------------------------------- -- Check_Overriding_Operation -- -------------------------------- procedure Check_Overriding_Operation (Subp : Entity_Id) is Typ : constant Entity_Id := Find_Dispatching_Type (Subp); Op_List : constant Elist_Id := Primitive_Operations (Typ); Op_Elmt : Elmt_Id; Prim_Op : Entity_Id; Par_Op : Entity_Id; begin if Is_Derived_Type (Typ) and then not Is_Private_Type (Typ) and then In_Open_Scopes (Scope (Etype (Typ))) and then Is_Base_Type (Typ) then -- Subp overrides an inherited private operation if there is an -- inherited operation with a different name than Subp (see -- Derive_Subprogram) whose Alias is a hidden subprogram with the -- same name as Subp. Op_Elmt := First_Elmt (Op_List); while Present (Op_Elmt) loop Prim_Op := Node (Op_Elmt); Par_Op := Alias (Prim_Op); if Present (Par_Op) and then not Comes_From_Source (Prim_Op) and then Chars (Prim_Op) /= Chars (Par_Op) and then Chars (Par_Op) = Chars (Subp) and then Is_Hidden (Par_Op) and then Type_Conformant (Prim_Op, Subp) then Set_DT_Position_Value (Subp, DT_Position (Prim_Op)); end if; Next_Elmt (Op_Elmt); end loop; end if; end Check_Overriding_Operation; ------------------------------- -- Detect_Infinite_Recursion -- ------------------------------- procedure Detect_Infinite_Recursion (N : Node_Id; Spec : Entity_Id) is Loc : constant Source_Ptr := Sloc (N); Var_List : constant Elist_Id := New_Elmt_List; -- List of globals referenced by body of procedure Call_List : constant Elist_Id := New_Elmt_List; -- List of recursive calls in body of procedure Shad_List : constant Elist_Id := New_Elmt_List; -- List of entity id's for entities created to capture the value of -- referenced globals on entry to the procedure. Scop : constant Uint := Scope_Depth (Spec); -- This is used to record the scope depth of the current procedure, so -- that we can identify global references. Max_Vars : constant := 4; -- Do not test more than four global variables Count_Vars : Natural := 0; -- Count variables found so far Var : Entity_Id; Elm : Elmt_Id; Ent : Entity_Id; Call : Elmt_Id; Decl : Node_Id; Test : Node_Id; Elm1 : Elmt_Id; Elm2 : Elmt_Id; Last : Node_Id; function Process (Nod : Node_Id) return Traverse_Result; -- Function to traverse the subprogram body (using Traverse_Func) ------------- -- Process -- ------------- function Process (Nod : Node_Id) return Traverse_Result is begin -- Procedure call if Nkind (Nod) = N_Procedure_Call_Statement then -- Case of one of the detected recursive calls if Is_Entity_Name (Name (Nod)) and then Has_Recursive_Call (Entity (Name (Nod))) and then Entity (Name (Nod)) = Spec then Append_Elmt (Nod, Call_List); return Skip; -- Any other procedure call may have side effects else return Abandon; end if; -- A call to a pure function can always be ignored elsif Nkind (Nod) = N_Function_Call and then Is_Entity_Name (Name (Nod)) and then Is_Pure (Entity (Name (Nod))) then return Skip; -- Case of an identifier reference elsif Nkind (Nod) = N_Identifier then Ent := Entity (Nod); -- If no entity, then ignore the reference -- Not clear why this can happen. To investigate, remove this -- test and look at the crash that occurs here in 3401-004 ??? if No (Ent) then return Skip; -- Ignore entities with no Scope, again not clear how this -- can happen, to investigate, look at 4108-008 ??? elsif No (Scope (Ent)) then return Skip; -- Ignore the reference if not to a more global object elsif Scope_Depth (Scope (Ent)) >= Scop then return Skip; -- References to types, exceptions and constants are always OK elsif Is_Type (Ent) or else Ekind (Ent) = E_Exception or else Ekind (Ent) = E_Constant then return Skip; -- If other than a non-volatile scalar variable, we have some -- kind of global reference (e.g. to a function) that we cannot -- deal with so we forget the attempt. elsif Ekind (Ent) /= E_Variable or else not Is_Scalar_Type (Etype (Ent)) or else Treat_As_Volatile (Ent) then return Abandon; -- Otherwise we have a reference to a global scalar else -- Loop through global entities already detected Elm := First_Elmt (Var_List); loop -- If not detected before, record this new global reference if No (Elm) then Count_Vars := Count_Vars + 1; if Count_Vars <= Max_Vars then Append_Elmt (Entity (Nod), Var_List); else return Abandon; end if; exit; -- If recorded before, ignore elsif Node (Elm) = Entity (Nod) then return Skip; -- Otherwise keep looking else Next_Elmt (Elm); end if; end loop; return Skip; end if; -- For all other node kinds, recursively visit syntactic children else return OK; end if; end Process; function Traverse_Body is new Traverse_Func (Process); -- Start of processing for Detect_Infinite_Recursion begin -- Do not attempt detection in No_Implicit_Conditional mode, since we -- won't be able to generate the code to handle the recursion in any -- case. if Restriction_Active (No_Implicit_Conditionals) then return; end if; -- Otherwise do traversal and quit if we get abandon signal if Traverse_Body (N) = Abandon then return; -- We must have a call, since Has_Recursive_Call was set. If not just -- ignore (this is only an error check, so if we have a funny situation, -- due to bugs or errors, we do not want to bomb). elsif Is_Empty_Elmt_List (Call_List) then return; end if; -- Here is the case where we detect recursion at compile time -- Push our current scope for analyzing the declarations and code that -- we will insert for the checking. Push_Scope (Spec); -- This loop builds temporary variables for each of the referenced -- globals, so that at the end of the loop the list Shad_List contains -- these temporaries in one-to-one correspondence with the elements in -- Var_List. Last := Empty; Elm := First_Elmt (Var_List); while Present (Elm) loop Var := Node (Elm); Ent := Make_Temporary (Loc, 'S'); Append_Elmt (Ent, Shad_List); -- Insert a declaration for this temporary at the start of the -- declarations for the procedure. The temporaries are declared as -- constant objects initialized to the current values of the -- corresponding temporaries. Decl := Make_Object_Declaration (Loc, Defining_Identifier => Ent, Object_Definition => New_Occurrence_Of (Etype (Var), Loc), Constant_Present => True, Expression => New_Occurrence_Of (Var, Loc)); if No (Last) then Prepend (Decl, Declarations (N)); else Insert_After (Last, Decl); end if; Last := Decl; Analyze (Decl); Next_Elmt (Elm); end loop; -- Loop through calls Call := First_Elmt (Call_List); while Present (Call) loop -- Build a predicate expression of the form -- True -- and then global1 = temp1 -- and then global2 = temp2 -- ... -- This predicate determines if any of the global values -- referenced by the procedure have changed since the -- current call, if not an infinite recursion is assured. Test := New_Occurrence_Of (Standard_True, Loc); Elm1 := First_Elmt (Var_List); Elm2 := First_Elmt (Shad_List); while Present (Elm1) loop Test := Make_And_Then (Loc, Left_Opnd => Test, Right_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Node (Elm1), Loc), Right_Opnd => New_Occurrence_Of (Node (Elm2), Loc))); Next_Elmt (Elm1); Next_Elmt (Elm2); end loop; -- Now we replace the call with the sequence -- if no-changes (see above) then -- raise Storage_Error; -- else -- original-call -- end if; Rewrite (Node (Call), Make_If_Statement (Loc, Condition => Test, Then_Statements => New_List ( Make_Raise_Storage_Error (Loc, Reason => SE_Infinite_Recursion)), Else_Statements => New_List ( Relocate_Node (Node (Call))))); Analyze (Node (Call)); Next_Elmt (Call); end loop; -- Remove temporary scope stack entry used for analysis Pop_Scope; end Detect_Infinite_Recursion; -------------------- -- Expand_Actuals -- -------------------- procedure Expand_Actuals (N : in out Node_Id; Subp : Entity_Id) is Loc : constant Source_Ptr := Sloc (N); Actual : Node_Id; Formal : Entity_Id; N_Node : Node_Id; Post_Call : List_Id; E_Actual : Entity_Id; E_Formal : Entity_Id; procedure Add_Call_By_Copy_Code; -- For cases where the parameter must be passed by copy, this routine -- generates a temporary variable into which the actual is copied and -- then passes this as the parameter. For an OUT or IN OUT parameter, -- an assignment is also generated to copy the result back. The call -- also takes care of any constraint checks required for the type -- conversion case (on both the way in and the way out). procedure Add_Simple_Call_By_Copy_Code; -- This is similar to the above, but is used in cases where we know -- that all that is needed is to simply create a temporary and copy -- the value in and out of the temporary. procedure Check_Fortran_Logical; -- A value of type Logical that is passed through a formal parameter -- must be normalized because .TRUE. usually does not have the same -- representation as True. We assume that .FALSE. = False = 0. -- What about functions that return a logical type ??? function Is_Legal_Copy return Boolean; -- Check that an actual can be copied before generating the temporary -- to be used in the call. If the actual is of a by_reference type then -- the program is illegal (this can only happen in the presence of -- rep. clauses that force an incorrect alignment). If the formal is -- a by_reference parameter imposed by a DEC pragma, emit a warning to -- the effect that this might lead to unaligned arguments. function Make_Var (Actual : Node_Id) return Entity_Id; -- Returns an entity that refers to the given actual parameter, Actual -- (not including any type conversion). If Actual is an entity name, -- then this entity is returned unchanged, otherwise a renaming is -- created to provide an entity for the actual. procedure Reset_Packed_Prefix; -- The expansion of a packed array component reference is delayed in -- the context of a call. Now we need to complete the expansion, so we -- unmark the analyzed bits in all prefixes. --------------------------- -- Add_Call_By_Copy_Code -- --------------------------- procedure Add_Call_By_Copy_Code is Crep : Boolean; Expr : Node_Id; F_Typ : Entity_Id := Etype (Formal); Indic : Node_Id; Init : Node_Id; Temp : Entity_Id; V_Typ : Entity_Id; Var : Entity_Id; begin if not Is_Legal_Copy then return; end if; Temp := Make_Temporary (Loc, 'T', Actual); -- Handle formals whose type comes from the limited view if From_Limited_With (F_Typ) and then Has_Non_Limited_View (F_Typ) then F_Typ := Non_Limited_View (F_Typ); end if; -- Use formal type for temp, unless formal type is an unconstrained -- array, in which case we don't have to worry about bounds checks, -- and we use the actual type, since that has appropriate bounds. if Is_Array_Type (F_Typ) and then not Is_Constrained (F_Typ) then Indic := New_Occurrence_Of (Etype (Actual), Loc); else Indic := New_Occurrence_Of (F_Typ, Loc); end if; if Nkind (Actual) = N_Type_Conversion then V_Typ := Etype (Expression (Actual)); -- If the formal is an (in-)out parameter, capture the name -- of the variable in order to build the post-call assignment. Var := Make_Var (Expression (Actual)); Crep := not Same_Representation (F_Typ, Etype (Expression (Actual))); else V_Typ := Etype (Actual); Var := Make_Var (Actual); Crep := False; end if; -- Setup initialization for case of in out parameter, or an out -- parameter where the formal is an unconstrained array (in the -- latter case, we have to pass in an object with bounds). -- If this is an out parameter, the initial copy is wasteful, so as -- an optimization for the one-dimensional case we extract the -- bounds of the actual and build an uninitialized temporary of the -- right size. if Ekind (Formal) = E_In_Out_Parameter or else (Is_Array_Type (F_Typ) and then not Is_Constrained (F_Typ)) then if Nkind (Actual) = N_Type_Conversion then if Conversion_OK (Actual) then Init := OK_Convert_To (F_Typ, New_Occurrence_Of (Var, Loc)); else Init := Convert_To (F_Typ, New_Occurrence_Of (Var, Loc)); end if; elsif Ekind (Formal) = E_Out_Parameter and then Is_Array_Type (F_Typ) and then Number_Dimensions (F_Typ) = 1 and then not Has_Non_Null_Base_Init_Proc (F_Typ) then -- Actual is a one-dimensional array or slice, and the type -- requires no initialization. Create a temporary of the -- right size, but do not copy actual into it (optimization). Init := Empty; Indic := Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (F_Typ, Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List ( Make_Range (Loc, Low_Bound => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Var, Loc), Attribute_Name => Name_First), High_Bound => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Var, Loc), Attribute_Name => Name_Last))))); else Init := New_Occurrence_Of (Var, Loc); end if; -- An initialization is created for packed conversions as -- actuals for out parameters to enable Make_Object_Declaration -- to determine the proper subtype for N_Node. Note that this -- is wasteful because the extra copying on the call side is -- not required for such out parameters. ??? elsif Ekind (Formal) = E_Out_Parameter and then Nkind (Actual) = N_Type_Conversion and then (Is_Bit_Packed_Array (F_Typ) or else Is_Bit_Packed_Array (Etype (Expression (Actual)))) then if Conversion_OK (Actual) then Init := OK_Convert_To (F_Typ, New_Occurrence_Of (Var, Loc)); else Init := Convert_To (F_Typ, New_Occurrence_Of (Var, Loc)); end if; elsif Ekind (Formal) = E_In_Parameter then -- Handle the case in which the actual is a type conversion if Nkind (Actual) = N_Type_Conversion then if Conversion_OK (Actual) then Init := OK_Convert_To (F_Typ, New_Occurrence_Of (Var, Loc)); else Init := Convert_To (F_Typ, New_Occurrence_Of (Var, Loc)); end if; else Init := New_Occurrence_Of (Var, Loc); end if; else Init := Empty; end if; N_Node := Make_Object_Declaration (Loc, Defining_Identifier => Temp, Object_Definition => Indic, Expression => Init); Set_Assignment_OK (N_Node); Insert_Action (N, N_Node); -- Now, normally the deal here is that we use the defining -- identifier created by that object declaration. There is -- one exception to this. In the change of representation case -- the above declaration will end up looking like: -- temp : type := identifier; -- And in this case we might as well use the identifier directly -- and eliminate the temporary. Note that the analysis of the -- declaration was not a waste of time in that case, since it is -- what generated the necessary change of representation code. If -- the change of representation introduced additional code, as in -- a fixed-integer conversion, the expression is not an identifier -- and must be kept. if Crep and then Present (Expression (N_Node)) and then Is_Entity_Name (Expression (N_Node)) then Temp := Entity (Expression (N_Node)); Rewrite (N_Node, Make_Null_Statement (Loc)); end if; -- For IN parameter, all we do is to replace the actual if Ekind (Formal) = E_In_Parameter then Rewrite (Actual, New_Occurrence_Of (Temp, Loc)); Analyze (Actual); -- Processing for OUT or IN OUT parameter else -- Kill current value indications for the temporary variable we -- created, since we just passed it as an OUT parameter. Kill_Current_Values (Temp); Set_Is_Known_Valid (Temp, False); -- If type conversion, use reverse conversion on exit if Nkind (Actual) = N_Type_Conversion then if Conversion_OK (Actual) then Expr := OK_Convert_To (V_Typ, New_Occurrence_Of (Temp, Loc)); else Expr := Convert_To (V_Typ, New_Occurrence_Of (Temp, Loc)); end if; else Expr := New_Occurrence_Of (Temp, Loc); end if; Rewrite (Actual, New_Occurrence_Of (Temp, Loc)); Analyze (Actual); -- If the actual is a conversion of a packed reference, it may -- already have been expanded by Remove_Side_Effects, and the -- resulting variable is a temporary which does not designate -- the proper out-parameter, which may not be addressable. In -- that case, generate an assignment to the original expression -- (before expansion of the packed reference) so that the proper -- expansion of assignment to a packed component can take place. declare Obj : Node_Id; Lhs : Node_Id; begin if Is_Renaming_Of_Object (Var) and then Nkind (Renamed_Object (Var)) = N_Selected_Component and then Nkind (Original_Node (Prefix (Renamed_Object (Var)))) = N_Indexed_Component and then Has_Non_Standard_Rep (Etype (Prefix (Renamed_Object (Var)))) then Obj := Renamed_Object (Var); Lhs := Make_Selected_Component (Loc, Prefix => New_Copy_Tree (Original_Node (Prefix (Obj))), Selector_Name => New_Copy (Selector_Name (Obj))); Reset_Analyzed_Flags (Lhs); else Lhs := New_Occurrence_Of (Var, Loc); end if; Set_Assignment_OK (Lhs); if Is_Access_Type (E_Formal) and then Is_Entity_Name (Lhs) and then Present (Effective_Extra_Accessibility (Entity (Lhs))) then -- Copyback target is an Ada 2012 stand-alone object of an -- anonymous access type. pragma Assert (Ada_Version >= Ada_2012); if Type_Access_Level (E_Formal) > Object_Access_Level (Lhs) then Append_To (Post_Call, Make_Raise_Program_Error (Loc, Reason => PE_Accessibility_Check_Failed)); end if; Append_To (Post_Call, Make_Assignment_Statement (Loc, Name => Lhs, Expression => Expr)); -- We would like to somehow suppress generation of the -- extra_accessibility assignment generated by the expansion -- of the above assignment statement. It's not a correctness -- issue because the following assignment renders it dead, -- but generating back-to-back assignments to the same -- target is undesirable. ??? Append_To (Post_Call, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of ( Effective_Extra_Accessibility (Entity (Lhs)), Loc), Expression => Make_Integer_Literal (Loc, Type_Access_Level (E_Formal)))); else Append_To (Post_Call, Make_Assignment_Statement (Loc, Name => Lhs, Expression => Expr)); end if; end; end if; end Add_Call_By_Copy_Code; ---------------------------------- -- Add_Simple_Call_By_Copy_Code -- ---------------------------------- procedure Add_Simple_Call_By_Copy_Code is Decl : Node_Id; F_Typ : Entity_Id := Etype (Formal); Incod : Node_Id; Indic : Node_Id; Lhs : Node_Id; Outcod : Node_Id; Rhs : Node_Id; Temp : Entity_Id; begin if not Is_Legal_Copy then return; end if; -- Handle formals whose type comes from the limited view if From_Limited_With (F_Typ) and then Has_Non_Limited_View (F_Typ) then F_Typ := Non_Limited_View (F_Typ); end if; -- Use formal type for temp, unless formal type is an unconstrained -- array, in which case we don't have to worry about bounds checks, -- and we use the actual type, since that has appropriate bounds. if Is_Array_Type (F_Typ) and then not Is_Constrained (F_Typ) then Indic := New_Occurrence_Of (Etype (Actual), Loc); else Indic := New_Occurrence_Of (F_Typ, Loc); end if; -- Prepare to generate code Reset_Packed_Prefix; Temp := Make_Temporary (Loc, 'T', Actual); Incod := Relocate_Node (Actual); Outcod := New_Copy_Tree (Incod); -- Generate declaration of temporary variable, initializing it -- with the input parameter unless we have an OUT formal or -- this is an initialization call. -- If the formal is an out parameter with discriminants, the -- discriminants must be captured even if the rest of the object -- is in principle uninitialized, because the discriminants may -- be read by the called subprogram. if Ekind (Formal) = E_Out_Parameter then Incod := Empty; if Has_Discriminants (F_Typ) then Indic := New_Occurrence_Of (Etype (Actual), Loc); end if; elsif Inside_Init_Proc then -- Could use a comment here to match comment below ??? if Nkind (Actual) /= N_Selected_Component or else not Has_Discriminant_Dependent_Constraint (Entity (Selector_Name (Actual))) then Incod := Empty; -- Otherwise, keep the component in order to generate the proper -- actual subtype, that depends on enclosing discriminants. else null; end if; end if; Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp, Object_Definition => Indic, Expression => Incod); if Inside_Init_Proc and then No (Incod) then -- If the call is to initialize a component of a composite type, -- and the component does not depend on discriminants, use the -- actual type of the component. This is required in case the -- component is constrained, because in general the formal of the -- initialization procedure will be unconstrained. Note that if -- the component being initialized is constrained by an enclosing -- discriminant, the presence of the initialization in the -- declaration will generate an expression for the actual subtype. Set_No_Initialization (Decl); Set_Object_Definition (Decl, New_Occurrence_Of (Etype (Actual), Loc)); end if; Insert_Action (N, Decl); -- The actual is simply a reference to the temporary Rewrite (Actual, New_Occurrence_Of (Temp, Loc)); -- Generate copy out if OUT or IN OUT parameter if Ekind (Formal) /= E_In_Parameter then Lhs := Outcod; Rhs := New_Occurrence_Of (Temp, Loc); -- Deal with conversion if Nkind (Lhs) = N_Type_Conversion then Lhs := Expression (Lhs); Rhs := Convert_To (Etype (Actual), Rhs); end if; Append_To (Post_Call, Make_Assignment_Statement (Loc, Name => Lhs, Expression => Rhs)); Set_Assignment_OK (Name (Last (Post_Call))); end if; end Add_Simple_Call_By_Copy_Code; --------------------------- -- Check_Fortran_Logical -- --------------------------- procedure Check_Fortran_Logical is Logical : constant Entity_Id := Etype (Formal); Var : Entity_Id; -- Note: this is very incomplete, e.g. it does not handle arrays -- of logical values. This is really not the right approach at all???) begin if Convention (Subp) = Convention_Fortran and then Root_Type (Etype (Formal)) = Standard_Boolean and then Ekind (Formal) /= E_In_Parameter then Var := Make_Var (Actual); Append_To (Post_Call, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Var, Loc), Expression => Unchecked_Convert_To ( Logical, Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Var, Loc), Right_Opnd => Unchecked_Convert_To ( Logical, New_Occurrence_Of (Standard_False, Loc)))))); end if; end Check_Fortran_Logical; ------------------- -- Is_Legal_Copy -- ------------------- function Is_Legal_Copy return Boolean is begin -- An attempt to copy a value of such a type can only occur if -- representation clauses give the actual a misaligned address. if Is_By_Reference_Type (Etype (Formal)) then -- If the front-end does not perform full type layout, the actual -- may in fact be properly aligned but there is not enough front- -- end information to determine this. In that case gigi will emit -- an error if a copy is not legal, or generate the proper code. -- For other backends we report the error now. -- Seems wrong to be issuing an error in the expander, since it -- will be missed in -gnatc mode ??? if Frontend_Layout_On_Target then Error_Msg_N ("misaligned actual cannot be passed by reference", Actual); end if; return False; -- For users of Starlet, we assume that the specification of by- -- reference mechanism is mandatory. This may lead to unaligned -- objects but at least for DEC legacy code it is known to work. -- The warning will alert users of this code that a problem may -- be lurking. elsif Mechanism (Formal) = By_Reference and then Is_Valued_Procedure (Scope (Formal)) then Error_Msg_N ("by_reference actual may be misaligned??", Actual); return False; else return True; end if; end Is_Legal_Copy; -------------- -- Make_Var -- -------------- function Make_Var (Actual : Node_Id) return Entity_Id is Var : Entity_Id; begin if Is_Entity_Name (Actual) then return Entity (Actual); else Var := Make_Temporary (Loc, 'T', Actual); N_Node := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Var, Subtype_Mark => New_Occurrence_Of (Etype (Actual), Loc), Name => Relocate_Node (Actual)); Insert_Action (N, N_Node); return Var; end if; end Make_Var; ------------------------- -- Reset_Packed_Prefix -- ------------------------- procedure Reset_Packed_Prefix is Pfx : Node_Id := Actual; begin loop Set_Analyzed (Pfx, False); exit when not Nkind_In (Pfx, N_Selected_Component, N_Indexed_Component); Pfx := Prefix (Pfx); end loop; end Reset_Packed_Prefix; -- Start of processing for Expand_Actuals begin Post_Call := New_List; Formal := First_Formal (Subp); Actual := First_Actual (N); while Present (Formal) loop E_Formal := Etype (Formal); E_Actual := Etype (Actual); -- Handle formals whose type comes from the limited view if From_Limited_With (E_Formal) and then Has_Non_Limited_View (E_Formal) then E_Formal := Non_Limited_View (E_Formal); end if; if Is_Scalar_Type (E_Formal) or else Nkind (Actual) = N_Slice then Check_Fortran_Logical; -- RM 6.4.1 (11) elsif Ekind (Formal) /= E_Out_Parameter then -- The unusual case of the current instance of a protected type -- requires special handling. This can only occur in the context -- of a call within the body of a protected operation. if Is_Entity_Name (Actual) and then Ekind (Entity (Actual)) = E_Protected_Type and then In_Open_Scopes (Entity (Actual)) then if Scope (Subp) /= Entity (Actual) then Error_Msg_N ("operation outside protected type may not " & "call back its protected operations??", Actual); end if; Rewrite (Actual, Expand_Protected_Object_Reference (N, Entity (Actual))); end if; -- Ada 2005 (AI-318-02): If the actual parameter is a call to a -- build-in-place function, then a temporary return object needs -- to be created and access to it must be passed to the function. -- Currently we limit such functions to those with inherently -- limited result subtypes, but eventually we plan to expand the -- functions that are treated as build-in-place to include other -- composite result types. if Is_Build_In_Place_Function_Call (Actual) then Make_Build_In_Place_Call_In_Anonymous_Context (Actual); end if; Apply_Constraint_Check (Actual, E_Formal); -- Out parameter case. No constraint checks on access type -- RM 6.4.1 (13) elsif Is_Access_Type (E_Formal) then null; -- RM 6.4.1 (14) elsif Has_Discriminants (Base_Type (E_Formal)) or else Has_Non_Null_Base_Init_Proc (E_Formal) then Apply_Constraint_Check (Actual, E_Formal); -- RM 6.4.1 (15) else Apply_Constraint_Check (Actual, Base_Type (E_Formal)); end if; -- Processing for IN-OUT and OUT parameters if Ekind (Formal) /= E_In_Parameter then -- For type conversions of arrays, apply length/range checks if Is_Array_Type (E_Formal) and then Nkind (Actual) = N_Type_Conversion then if Is_Constrained (E_Formal) then Apply_Length_Check (Expression (Actual), E_Formal); else Apply_Range_Check (Expression (Actual), E_Formal); end if; end if; -- If argument is a type conversion for a type that is passed -- by copy, then we must pass the parameter by copy. if Nkind (Actual) = N_Type_Conversion and then (Is_Numeric_Type (E_Formal) or else Is_Access_Type (E_Formal) or else Is_Enumeration_Type (E_Formal) or else Is_Bit_Packed_Array (Etype (Formal)) or else Is_Bit_Packed_Array (Etype (Expression (Actual))) -- Also pass by copy if change of representation or else not Same_Representation (Etype (Formal), Etype (Expression (Actual)))) then Add_Call_By_Copy_Code; -- References to components of bit-packed arrays are expanded -- at this point, rather than at the point of analysis of the -- actuals, to handle the expansion of the assignment to -- [in] out parameters. elsif Is_Ref_To_Bit_Packed_Array (Actual) then Add_Simple_Call_By_Copy_Code; -- If a non-scalar actual is possibly bit-aligned, we need a copy -- because the back-end cannot cope with such objects. In other -- cases where alignment forces a copy, the back-end generates -- it properly. It should not be generated unconditionally in the -- front-end because it does not know precisely the alignment -- requirements of the target, and makes too conservative an -- estimate, leading to superfluous copies or spurious errors -- on by-reference parameters. elsif Nkind (Actual) = N_Selected_Component and then Component_May_Be_Bit_Aligned (Entity (Selector_Name (Actual))) and then not Represented_As_Scalar (Etype (Formal)) then Add_Simple_Call_By_Copy_Code; -- References to slices of bit-packed arrays are expanded elsif Is_Ref_To_Bit_Packed_Slice (Actual) then Add_Call_By_Copy_Code; -- References to possibly unaligned slices of arrays are expanded elsif Is_Possibly_Unaligned_Slice (Actual) then Add_Call_By_Copy_Code; -- Deal with access types where the actual subtype and the -- formal subtype are not the same, requiring a check. -- It is necessary to exclude tagged types because of "downward -- conversion" errors. elsif Is_Access_Type (E_Formal) and then not Same_Type (E_Formal, E_Actual) and then not Is_Tagged_Type (Designated_Type (E_Formal)) then Add_Call_By_Copy_Code; -- If the actual is not a scalar and is marked for volatile -- treatment, whereas the formal is not volatile, then pass -- by copy unless it is a by-reference type. -- Note: we use Is_Volatile here rather than Treat_As_Volatile, -- because this is the enforcement of a language rule that applies -- only to "real" volatile variables, not e.g. to the address -- clause overlay case. elsif Is_Entity_Name (Actual) and then Is_Volatile (Entity (Actual)) and then not Is_By_Reference_Type (E_Actual) and then not Is_Scalar_Type (Etype (Entity (Actual))) and then not Is_Volatile (E_Formal) then Add_Call_By_Copy_Code; elsif Nkind (Actual) = N_Indexed_Component and then Is_Entity_Name (Prefix (Actual)) and then Has_Volatile_Components (Entity (Prefix (Actual))) then Add_Call_By_Copy_Code; -- Add call-by-copy code for the case of scalar out parameters -- when it is not known at compile time that the subtype of the -- formal is a subrange of the subtype of the actual (or vice -- versa for in out parameters), in order to get range checks -- on such actuals. (Maybe this case should be handled earlier -- in the if statement???) elsif Is_Scalar_Type (E_Formal) and then (not In_Subrange_Of (E_Formal, E_Actual) or else (Ekind (Formal) = E_In_Out_Parameter and then not In_Subrange_Of (E_Actual, E_Formal))) then -- Perhaps the setting back to False should be done within -- Add_Call_By_Copy_Code, since it could get set on other -- cases occurring above??? if Do_Range_Check (Actual) then Set_Do_Range_Check (Actual, False); end if; Add_Call_By_Copy_Code; end if; -- RM 3.2.4 (23/3): A predicate is checked on in-out and out -- by-reference parameters on exit from the call. If the actual -- is a derived type and the operation is inherited, the body -- of the operation will not contain a call to the predicate -- function, so it must be done explicitly after the call. Ditto -- if the actual is an entity of a predicated subtype. -- The rule refers to by-reference types, but a check is needed -- for by-copy types as well. That check is subsumed by the rule -- for subtype conversion on assignment, but we can generate the -- required check now. -- Note also that Subp may be either a subprogram entity for -- direct calls, or a type entity for indirect calls, which must -- be handled separately because the name does not denote an -- overloadable entity. By_Ref_Predicate_Check : declare Aund : constant Entity_Id := Underlying_Type (E_Actual); Atyp : Entity_Id; function Is_Public_Subp return Boolean; -- Check whether the subprogram being called is a visible -- operation of the type of the actual. Used to determine -- whether an invariant check must be generated on the -- caller side. --------------------- -- Is_Public_Subp -- --------------------- function Is_Public_Subp return Boolean is Pack : constant Entity_Id := Scope (Subp); Subp_Decl : Node_Id; begin if not Is_Subprogram (Subp) then return False; -- The operation may be inherited, or a primitive of the -- root type. elsif Nkind_In (Parent (Subp), N_Private_Extension_Declaration, N_Full_Type_Declaration) then Subp_Decl := Parent (Subp); else Subp_Decl := Unit_Declaration_Node (Subp); end if; return Ekind (Pack) = E_Package and then List_Containing (Subp_Decl) = Visible_Declarations (Specification (Unit_Declaration_Node (Pack))); end Is_Public_Subp; -- Start of processing for By_Ref_Predicate_Check begin if No (Aund) then Atyp := E_Actual; else Atyp := Aund; end if; if Has_Predicates (Atyp) and then Present (Predicate_Function (Atyp)) -- Skip predicate checks for special cases and then Predicate_Tests_On_Arguments (Subp) then Append_To (Post_Call, Make_Predicate_Check (Atyp, Actual)); end if; -- We generated caller-side invariant checks in two cases: -- a) when calling an inherited operation, where there is an -- implicit view conversion of the actual to the parent type. -- b) When the conversion is explicit -- We treat these cases separately because the required -- conversion for a) is added later when expanding the call. if Has_Invariants (Etype (Actual)) and then Nkind (Parent (Subp)) = N_Private_Extension_Declaration then if Comes_From_Source (N) and then Is_Public_Subp then Append_To (Post_Call, Make_Invariant_Call (Actual)); end if; elsif Nkind (Actual) = N_Type_Conversion and then Has_Invariants (Etype (Expression (Actual))) then if Comes_From_Source (N) and then Is_Public_Subp then Append_To (Post_Call, Make_Invariant_Call (Expression (Actual))); end if; end if; end By_Ref_Predicate_Check; -- Processing for IN parameters else -- For IN parameters in the bit-packed array case, we expand an -- indexed component (the circuit in Exp_Ch4 deliberately left -- indexed components appearing as actuals untouched, so that -- the special processing above for the OUT and IN OUT cases -- could be performed. We could make the test in Exp_Ch4 more -- complex and have it detect the parameter mode, but it is -- easier simply to handle all cases here.) if Nkind (Actual) = N_Indexed_Component and then Is_Bit_Packed_Array (Etype (Prefix (Actual))) then Reset_Packed_Prefix; Expand_Packed_Element_Reference (Actual); -- If we have a reference to a bit-packed array, we copy it, since -- the actual must be byte aligned. -- Is this really necessary in all cases??? elsif Is_Ref_To_Bit_Packed_Array (Actual) then Add_Simple_Call_By_Copy_Code; -- If a non-scalar actual is possibly unaligned, we need a copy elsif Is_Possibly_Unaligned_Object (Actual) and then not Represented_As_Scalar (Etype (Formal)) then Add_Simple_Call_By_Copy_Code; -- Similarly, we have to expand slices of packed arrays here -- because the result must be byte aligned. elsif Is_Ref_To_Bit_Packed_Slice (Actual) then Add_Call_By_Copy_Code; -- Only processing remaining is to pass by copy if this is a -- reference to a possibly unaligned slice, since the caller -- expects an appropriately aligned argument. elsif Is_Possibly_Unaligned_Slice (Actual) then Add_Call_By_Copy_Code; -- An unusual case: a current instance of an enclosing task can be -- an actual, and must be replaced by a reference to self. elsif Is_Entity_Name (Actual) and then Is_Task_Type (Entity (Actual)) then if In_Open_Scopes (Entity (Actual)) then Rewrite (Actual, (Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Self), Loc)))); Analyze (Actual); -- A task type cannot otherwise appear as an actual else raise Program_Error; end if; end if; end if; Next_Formal (Formal); Next_Actual (Actual); end loop; -- Find right place to put post call stuff if it is present if not Is_Empty_List (Post_Call) then -- Cases where the call is not a member of a statement list. -- This includes the case where the call is an actual in another -- function call or indexing, i.e. an expression context as well. if not Is_List_Member (N) or else Nkind_In (Parent (N), N_Function_Call, N_Indexed_Component) then -- In Ada 2012 the call may be a function call in an expression -- (since OUT and IN OUT parameters are now allowed for such -- calls). The write-back of (in)-out parameters is handled -- by the back-end, but the constraint checks generated when -- subtypes of formal and actual don't match must be inserted -- in the form of assignments. if Ada_Version >= Ada_2012 and then Nkind (N) = N_Function_Call then -- We used to just do handle this by climbing up parents to -- a non-statement/declaration and then simply making a call -- to Insert_Actions_After (P, Post_Call), but that doesn't -- work. If we are in the middle of an expression, e.g. the -- condition of an IF, this call would insert after the IF -- statement, which is much too late to be doing the write -- back. For example: -- if Clobber (X) then -- Put_Line (X'Img); -- else -- goto Junk -- end if; -- Now assume Clobber changes X, if we put the write back -- after the IF, the Put_Line gets the wrong value and the -- goto causes the write back to be skipped completely. -- To deal with this, we replace the call by -- do -- Tnnn : constant function-result-type := function-call; -- Post_Call actions -- in -- Tnnn; -- end; declare Tnnn : constant Entity_Id := Make_Temporary (Loc, 'T'); FRTyp : constant Entity_Id := Etype (N); Name : constant Node_Id := Relocate_Node (N); begin Prepend_To (Post_Call, Make_Object_Declaration (Loc, Defining_Identifier => Tnnn, Object_Definition => New_Occurrence_Of (FRTyp, Loc), Constant_Present => True, Expression => Name)); Rewrite (N, Make_Expression_With_Actions (Loc, Actions => Post_Call, Expression => New_Occurrence_Of (Tnnn, Loc))); -- We don't want to just blindly call Analyze_And_Resolve -- because that would cause unwanted recursion on the call. -- So for a moment set the call as analyzed to prevent that -- recursion, and get the rest analyzed properly, then reset -- the analyzed flag, so our caller can continue. Set_Analyzed (Name, True); Analyze_And_Resolve (N, FRTyp); Set_Analyzed (Name, False); -- Reset calling argument to point to function call inside -- the expression with actions so the caller can continue -- to process the call. In spite of the fact that it is -- marked Analyzed above, it may be rewritten by Remove_ -- Side_Effects if validity checks are present, so go back -- to original call. N := Original_Node (Name); end; -- If not the special Ada 2012 case of a function call, then -- we must have the triggering statement of a triggering -- alternative or an entry call alternative, and we can add -- the post call stuff to the corresponding statement list. else declare P : Node_Id; begin P := Parent (N); pragma Assert (Nkind_In (P, N_Triggering_Alternative, N_Entry_Call_Alternative)); if Is_Non_Empty_List (Statements (P)) then Insert_List_Before_And_Analyze (First (Statements (P)), Post_Call); else Set_Statements (P, Post_Call); end if; return; end; end if; -- Otherwise, normal case where N is in a statement sequence, -- just put the post-call stuff after the call statement. else Insert_Actions_After (N, Post_Call); return; end if; end if; -- The call node itself is re-analyzed in Expand_Call end Expand_Actuals; ----------------- -- Expand_Call -- ----------------- -- This procedure handles expansion of function calls and procedure call -- statements (i.e. it serves as the body for Expand_N_Function_Call and -- Expand_N_Procedure_Call_Statement). Processing for calls includes: -- Replace call to Raise_Exception by Raise_Exception_Always if possible -- Provide values of actuals for all formals in Extra_Formals list -- Replace "call" to enumeration literal function by literal itself -- Rewrite call to predefined operator as operator -- Replace actuals to in-out parameters that are numeric conversions, -- with explicit assignment to temporaries before and after the call. -- Note that the list of actuals has been filled with default expressions -- during semantic analysis of the call. Only the extra actuals required -- for the 'Constrained attribute and for accessibility checks are added -- at this point. procedure Expand_Call (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Call_Node : Node_Id := N; Extra_Actuals : List_Id := No_List; Prev : Node_Id := Empty; procedure Add_Actual_Parameter (Insert_Param : Node_Id); -- Adds one entry to the end of the actual parameter list. Used for -- default parameters and for extra actuals (for Extra_Formals). The -- argument is an N_Parameter_Association node. procedure Add_Extra_Actual (Expr : Node_Id; EF : Entity_Id); -- Adds an extra actual to the list of extra actuals. Expr is the -- expression for the value of the actual, EF is the entity for the -- extra formal. procedure Add_View_Conversion_Invariants (Formal : Entity_Id; Actual : Node_Id); -- Adds invariant checks for every intermediate type between the range -- of a view converted argument to its ancestor (from parent to child). function Inherited_From_Formal (S : Entity_Id) return Entity_Id; -- Within an instance, a type derived from an untagged formal derived -- type inherits from the original parent, not from the actual. The -- current derivation mechanism has the derived type inherit from the -- actual, which is only correct outside of the instance. If the -- subprogram is inherited, we test for this particular case through a -- convoluted tree traversal before setting the proper subprogram to be -- called. function In_Unfrozen_Instance (E : Entity_Id) return Boolean; -- Return true if E comes from an instance that is not yet frozen function Is_Direct_Deep_Call (Subp : Entity_Id) return Boolean; -- Determine if Subp denotes a non-dispatching call to a Deep routine function New_Value (From : Node_Id) return Node_Id; -- From is the original Expression. New_Value is equivalent to a call -- to Duplicate_Subexpr with an explicit dereference when From is an -- access parameter. -------------------------- -- Add_Actual_Parameter -- -------------------------- procedure Add_Actual_Parameter (Insert_Param : Node_Id) is Actual_Expr : constant Node_Id := Explicit_Actual_Parameter (Insert_Param); begin -- Case of insertion is first named actual if No (Prev) or else Nkind (Parent (Prev)) /= N_Parameter_Association then Set_Next_Named_Actual (Insert_Param, First_Named_Actual (Call_Node)); Set_First_Named_Actual (Call_Node, Actual_Expr); if No (Prev) then if No (Parameter_Associations (Call_Node)) then Set_Parameter_Associations (Call_Node, New_List); end if; Append (Insert_Param, Parameter_Associations (Call_Node)); else Insert_After (Prev, Insert_Param); end if; -- Case of insertion is not first named actual else Set_Next_Named_Actual (Insert_Param, Next_Named_Actual (Parent (Prev))); Set_Next_Named_Actual (Parent (Prev), Actual_Expr); Append (Insert_Param, Parameter_Associations (Call_Node)); end if; Prev := Actual_Expr; end Add_Actual_Parameter; ---------------------- -- Add_Extra_Actual -- ---------------------- procedure Add_Extra_Actual (Expr : Node_Id; EF : Entity_Id) is Loc : constant Source_Ptr := Sloc (Expr); begin if Extra_Actuals = No_List then Extra_Actuals := New_List; Set_Parent (Extra_Actuals, Call_Node); end if; Append_To (Extra_Actuals, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of (EF, Loc), Explicit_Actual_Parameter => Expr)); Analyze_And_Resolve (Expr, Etype (EF)); if Nkind (Call_Node) = N_Function_Call then Set_Is_Accessibility_Actual (Parent (Expr)); end if; end Add_Extra_Actual; ------------------------------------ -- Add_View_Conversion_Invariants -- ------------------------------------ procedure Add_View_Conversion_Invariants (Formal : Entity_Id; Actual : Node_Id) is Arg : Entity_Id; Curr_Typ : Entity_Id; Inv_Checks : List_Id; Par_Typ : Entity_Id; begin Inv_Checks := No_List; -- Extract the argument from a potentially nested set of view -- conversions. Arg := Actual; while Nkind (Arg) = N_Type_Conversion loop Arg := Expression (Arg); end loop; -- Move up the derivation chain starting with the type of the formal -- parameter down to the type of the actual object. Curr_Typ := Empty; Par_Typ := Etype (Arg); while Par_Typ /= Etype (Formal) and Par_Typ /= Curr_Typ loop Curr_Typ := Par_Typ; if Has_Invariants (Curr_Typ) and then Present (Invariant_Procedure (Curr_Typ)) then -- Verify the invariate of the current type. Generate: -- <Curr_Typ>Invariant (Curr_Typ (Arg)); Prepend_New_To (Inv_Checks, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Invariant_Procedure (Curr_Typ), Loc), Parameter_Associations => New_List ( Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Curr_Typ, Loc), Expression => New_Copy_Tree (Arg))))); end if; Par_Typ := Base_Type (Etype (Curr_Typ)); end loop; if not Is_Empty_List (Inv_Checks) then Insert_Actions_After (N, Inv_Checks); end if; end Add_View_Conversion_Invariants; --------------------------- -- Inherited_From_Formal -- --------------------------- function Inherited_From_Formal (S : Entity_Id) return Entity_Id is Par : Entity_Id; Gen_Par : Entity_Id; Gen_Prim : Elist_Id; Elmt : Elmt_Id; Indic : Node_Id; begin -- If the operation is inherited, it is attached to the corresponding -- type derivation. If the parent in the derivation is a generic -- actual, it is a subtype of the actual, and we have to recover the -- original derived type declaration to find the proper parent. if Nkind (Parent (S)) /= N_Full_Type_Declaration or else not Is_Derived_Type (Defining_Identifier (Parent (S))) or else Nkind (Type_Definition (Original_Node (Parent (S)))) /= N_Derived_Type_Definition or else not In_Instance then return Empty; else Indic := Subtype_Indication (Type_Definition (Original_Node (Parent (S)))); if Nkind (Indic) = N_Subtype_Indication then Par := Entity (Subtype_Mark (Indic)); else Par := Entity (Indic); end if; end if; if not Is_Generic_Actual_Type (Par) or else Is_Tagged_Type (Par) or else Nkind (Parent (Par)) /= N_Subtype_Declaration or else not In_Open_Scopes (Scope (Par)) then return Empty; else Gen_Par := Generic_Parent_Type (Parent (Par)); end if; -- If the actual has no generic parent type, the formal is not -- a formal derived type, so nothing to inherit. if No (Gen_Par) then return Empty; end if; -- If the generic parent type is still the generic type, this is a -- private formal, not a derived formal, and there are no operations -- inherited from the formal. if Nkind (Parent (Gen_Par)) = N_Formal_Type_Declaration then return Empty; end if; Gen_Prim := Collect_Primitive_Operations (Gen_Par); Elmt := First_Elmt (Gen_Prim); while Present (Elmt) loop if Chars (Node (Elmt)) = Chars (S) then declare F1 : Entity_Id; F2 : Entity_Id; begin F1 := First_Formal (S); F2 := First_Formal (Node (Elmt)); while Present (F1) and then Present (F2) loop if Etype (F1) = Etype (F2) or else Etype (F2) = Gen_Par then Next_Formal (F1); Next_Formal (F2); else Next_Elmt (Elmt); exit; -- not the right subprogram end if; return Node (Elmt); end loop; end; else Next_Elmt (Elmt); end if; end loop; raise Program_Error; end Inherited_From_Formal; -------------------------- -- In_Unfrozen_Instance -- -------------------------- function In_Unfrozen_Instance (E : Entity_Id) return Boolean is S : Entity_Id; begin S := E; while Present (S) and then S /= Standard_Standard loop if Is_Generic_Instance (S) and then Present (Freeze_Node (S)) and then not Analyzed (Freeze_Node (S)) then return True; end if; S := Scope (S); end loop; return False; end In_Unfrozen_Instance; ------------------------- -- Is_Direct_Deep_Call -- ------------------------- function Is_Direct_Deep_Call (Subp : Entity_Id) return Boolean is begin if Is_TSS (Subp, TSS_Deep_Adjust) or else Is_TSS (Subp, TSS_Deep_Finalize) or else Is_TSS (Subp, TSS_Deep_Initialize) then declare Actual : Node_Id; Formal : Node_Id; begin Actual := First (Parameter_Associations (N)); Formal := First_Formal (Subp); while Present (Actual) and then Present (Formal) loop if Nkind (Actual) = N_Identifier and then Is_Controlling_Actual (Actual) and then Etype (Actual) = Etype (Formal) then return True; end if; Next (Actual); Next_Formal (Formal); end loop; end; end if; return False; end Is_Direct_Deep_Call; --------------- -- New_Value -- --------------- function New_Value (From : Node_Id) return Node_Id is Res : constant Node_Id := Duplicate_Subexpr (From); begin if Is_Access_Type (Etype (From)) then return Make_Explicit_Dereference (Sloc (From), Prefix => Res); else return Res; end if; end New_Value; -- Local variables Remote : constant Boolean := Is_Remote_Call (Call_Node); Actual : Node_Id; Formal : Entity_Id; Orig_Subp : Entity_Id := Empty; Param_Count : Natural := 0; Parent_Formal : Entity_Id; Parent_Subp : Entity_Id; Scop : Entity_Id; Subp : Entity_Id; Prev_Orig : Node_Id; -- Original node for an actual, which may have been rewritten. If the -- actual is a function call that has been transformed from a selected -- component, the original node is unanalyzed. Otherwise, it carries -- semantic information used to generate additional actuals. CW_Interface_Formals_Present : Boolean := False; -- Start of processing for Expand_Call begin -- Expand the function or procedure call if the first actual has a -- declared dimension aspect, and the subprogram is declared in one -- of the dimension I/O packages. if Ada_Version >= Ada_2012 and then Nkind_In (Call_Node, N_Procedure_Call_Statement, N_Function_Call) and then Present (Parameter_Associations (Call_Node)) then Expand_Put_Call_With_Symbol (Call_Node); end if; -- Ignore if previous error if Nkind (Call_Node) in N_Has_Etype and then Etype (Call_Node) = Any_Type then return; end if; -- Call using access to subprogram with explicit dereference if Nkind (Name (Call_Node)) = N_Explicit_Dereference then Subp := Etype (Name (Call_Node)); Parent_Subp := Empty; -- Case of call to simple entry, where the Name is a selected component -- whose prefix is the task, and whose selector name is the entry name elsif Nkind (Name (Call_Node)) = N_Selected_Component then Subp := Entity (Selector_Name (Name (Call_Node))); Parent_Subp := Empty; -- Case of call to member of entry family, where Name is an indexed -- component, with the prefix being a selected component giving the -- task and entry family name, and the index being the entry index. elsif Nkind (Name (Call_Node)) = N_Indexed_Component then Subp := Entity (Selector_Name (Prefix (Name (Call_Node)))); Parent_Subp := Empty; -- Normal case else Subp := Entity (Name (Call_Node)); Parent_Subp := Alias (Subp); -- Replace call to Raise_Exception by call to Raise_Exception_Always -- if we can tell that the first parameter cannot possibly be null. -- This improves efficiency by avoiding a run-time test. -- We do not do this if Raise_Exception_Always does not exist, which -- can happen in configurable run time profiles which provide only a -- Raise_Exception. if Is_RTE (Subp, RE_Raise_Exception) and then RTE_Available (RE_Raise_Exception_Always) then declare FA : constant Node_Id := Original_Node (First_Actual (Call_Node)); begin -- The case we catch is where the first argument is obtained -- using the Identity attribute (which must always be -- non-null). if Nkind (FA) = N_Attribute_Reference and then Attribute_Name (FA) = Name_Identity then Subp := RTE (RE_Raise_Exception_Always); Set_Name (Call_Node, New_Occurrence_Of (Subp, Loc)); end if; end; end if; if Ekind (Subp) = E_Entry then Parent_Subp := Empty; end if; end if; -- Ada 2005 (AI-345): We have a procedure call as a triggering -- alternative in an asynchronous select or as an entry call in -- a conditional or timed select. Check whether the procedure call -- is a renaming of an entry and rewrite it as an entry call. if Ada_Version >= Ada_2005 and then Nkind (Call_Node) = N_Procedure_Call_Statement and then ((Nkind (Parent (Call_Node)) = N_Triggering_Alternative and then Triggering_Statement (Parent (Call_Node)) = Call_Node) or else (Nkind (Parent (Call_Node)) = N_Entry_Call_Alternative and then Entry_Call_Statement (Parent (Call_Node)) = Call_Node)) then declare Ren_Decl : Node_Id; Ren_Root : Entity_Id := Subp; begin -- This may be a chain of renamings, find the root if Present (Alias (Ren_Root)) then Ren_Root := Alias (Ren_Root); end if; if Present (Original_Node (Parent (Parent (Ren_Root)))) then Ren_Decl := Original_Node (Parent (Parent (Ren_Root))); if Nkind (Ren_Decl) = N_Subprogram_Renaming_Declaration then Rewrite (Call_Node, Make_Entry_Call_Statement (Loc, Name => New_Copy_Tree (Name (Ren_Decl)), Parameter_Associations => New_Copy_List_Tree (Parameter_Associations (Call_Node)))); return; end if; end if; end; end if; -- When generating C code, transform a function call that returns a -- constrained array type into procedure form. if Modify_Tree_For_C and then Nkind (Call_Node) = N_Function_Call and then Is_Entity_Name (Name (Call_Node)) and then Rewritten_For_C (Ultimate_Alias (Entity (Name (Call_Node)))) then -- For internally generated calls ensure that they reference the -- entity of the spec of the called function (needed since the -- expander may generate calls using the entity of their body). -- See for example Expand_Boolean_Operator(). if not (Comes_From_Source (Call_Node)) and then Nkind (Unit_Declaration_Node (Ultimate_Alias (Entity (Name (Call_Node))))) = N_Subprogram_Body then Set_Entity (Name (Call_Node), Corresponding_Function (Corresponding_Procedure (Ultimate_Alias (Entity (Name (Call_Node)))))); end if; Rewrite_Function_Call_For_C (Call_Node); return; end if; -- First step, compute extra actuals, corresponding to any Extra_Formals -- present. Note that we do not access Extra_Formals directly, instead -- we simply note the presence of the extra formals as we process the -- regular formals collecting corresponding actuals in Extra_Actuals. -- We also generate any required range checks for actuals for in formals -- as we go through the loop, since this is a convenient place to do it. -- (Though it seems that this would be better done in Expand_Actuals???) -- Special case: Thunks must not compute the extra actuals; they must -- just propagate to the target primitive their extra actuals. if Is_Thunk (Current_Scope) and then Thunk_Entity (Current_Scope) = Subp and then Present (Extra_Formals (Subp)) then pragma Assert (Present (Extra_Formals (Current_Scope))); declare Target_Formal : Entity_Id; Thunk_Formal : Entity_Id; begin Target_Formal := Extra_Formals (Subp); Thunk_Formal := Extra_Formals (Current_Scope); while Present (Target_Formal) loop Add_Extra_Actual (New_Occurrence_Of (Thunk_Formal, Loc), Thunk_Formal); Target_Formal := Extra_Formal (Target_Formal); Thunk_Formal := Extra_Formal (Thunk_Formal); end loop; while Is_Non_Empty_List (Extra_Actuals) loop Add_Actual_Parameter (Remove_Head (Extra_Actuals)); end loop; Expand_Actuals (Call_Node, Subp); return; end; end if; Formal := First_Formal (Subp); Actual := First_Actual (Call_Node); Param_Count := 1; while Present (Formal) loop -- Generate range check if required if Do_Range_Check (Actual) and then Ekind (Formal) = E_In_Parameter then Generate_Range_Check (Actual, Etype (Formal), CE_Range_Check_Failed); end if; -- Prepare to examine current entry Prev := Actual; Prev_Orig := Original_Node (Prev); -- Ada 2005 (AI-251): Check if any formal is a class-wide interface -- to expand it in a further round. CW_Interface_Formals_Present := CW_Interface_Formals_Present or else (Is_Class_Wide_Type (Etype (Formal)) and then Is_Interface (Etype (Etype (Formal)))) or else (Ekind (Etype (Formal)) = E_Anonymous_Access_Type and then Is_Class_Wide_Type (Directly_Designated_Type (Etype (Etype (Formal)))) and then Is_Interface (Directly_Designated_Type (Etype (Etype (Formal))))); -- Create possible extra actual for constrained case. Usually, the -- extra actual is of the form actual'constrained, but since this -- attribute is only available for unconstrained records, TRUE is -- expanded if the type of the formal happens to be constrained (for -- instance when this procedure is inherited from an unconstrained -- record to a constrained one) or if the actual has no discriminant -- (its type is constrained). An exception to this is the case of a -- private type without discriminants. In this case we pass FALSE -- because the object has underlying discriminants with defaults. if Present (Extra_Constrained (Formal)) then if Ekind (Etype (Prev)) in Private_Kind and then not Has_Discriminants (Base_Type (Etype (Prev))) then Add_Extra_Actual (New_Occurrence_Of (Standard_False, Loc), Extra_Constrained (Formal)); elsif Is_Constrained (Etype (Formal)) or else not Has_Discriminants (Etype (Prev)) then Add_Extra_Actual (New_Occurrence_Of (Standard_True, Loc), Extra_Constrained (Formal)); -- Do not produce extra actuals for Unchecked_Union parameters. -- Jump directly to the end of the loop. elsif Is_Unchecked_Union (Base_Type (Etype (Actual))) then goto Skip_Extra_Actual_Generation; else -- If the actual is a type conversion, then the constrained -- test applies to the actual, not the target type. declare Act_Prev : Node_Id; begin -- Test for unchecked conversions as well, which can occur -- as out parameter actuals on calls to stream procedures. Act_Prev := Prev; while Nkind_In (Act_Prev, N_Type_Conversion, N_Unchecked_Type_Conversion) loop Act_Prev := Expression (Act_Prev); end loop; -- If the expression is a conversion of a dereference, this -- is internally generated code that manipulates addresses, -- e.g. when building interface tables. No check should -- occur in this case, and the discriminated object is not -- directly a hand. if not Comes_From_Source (Actual) and then Nkind (Actual) = N_Unchecked_Type_Conversion and then Nkind (Act_Prev) = N_Explicit_Dereference then Add_Extra_Actual (New_Occurrence_Of (Standard_False, Loc), Extra_Constrained (Formal)); else Add_Extra_Actual (Make_Attribute_Reference (Sloc (Prev), Prefix => Duplicate_Subexpr_No_Checks (Act_Prev, Name_Req => True), Attribute_Name => Name_Constrained), Extra_Constrained (Formal)); end if; end; end if; end if; -- Create possible extra actual for accessibility level if Present (Extra_Accessibility (Formal)) then -- Ada 2005 (AI-252): If the actual was rewritten as an Access -- attribute, then the original actual may be an aliased object -- occurring as the prefix in a call using "Object.Operation" -- notation. In that case we must pass the level of the object, -- so Prev_Orig is reset to Prev and the attribute will be -- processed by the code for Access attributes further below. if Prev_Orig /= Prev and then Nkind (Prev) = N_Attribute_Reference and then Get_Attribute_Id (Attribute_Name (Prev)) = Attribute_Access and then Is_Aliased_View (Prev_Orig) then Prev_Orig := Prev; end if; -- Ada 2005 (AI-251): Thunks must propagate the extra actuals of -- accessibility levels. if Is_Thunk (Current_Scope) then declare Parm_Ent : Entity_Id; begin if Is_Controlling_Actual (Actual) then -- Find the corresponding actual of the thunk Parm_Ent := First_Entity (Current_Scope); for J in 2 .. Param_Count loop Next_Entity (Parm_Ent); end loop; -- Handle unchecked conversion of access types generated -- in thunks (cf. Expand_Interface_Thunk). elsif Is_Access_Type (Etype (Actual)) and then Nkind (Actual) = N_Unchecked_Type_Conversion then Parm_Ent := Entity (Expression (Actual)); else pragma Assert (Is_Entity_Name (Actual)); Parm_Ent := Entity (Actual); end if; Add_Extra_Actual (New_Occurrence_Of (Extra_Accessibility (Parm_Ent), Loc), Extra_Accessibility (Formal)); end; elsif Is_Entity_Name (Prev_Orig) then -- When passing an access parameter, or a renaming of an access -- parameter, as the actual to another access parameter we need -- to pass along the actual's own access level parameter. This -- is done if we are within the scope of the formal access -- parameter (if this is an inlined body the extra formal is -- irrelevant). if (Is_Formal (Entity (Prev_Orig)) or else (Present (Renamed_Object (Entity (Prev_Orig))) and then Is_Entity_Name (Renamed_Object (Entity (Prev_Orig))) and then Is_Formal (Entity (Renamed_Object (Entity (Prev_Orig)))))) and then Ekind (Etype (Prev_Orig)) = E_Anonymous_Access_Type and then In_Open_Scopes (Scope (Entity (Prev_Orig))) then declare Parm_Ent : constant Entity_Id := Param_Entity (Prev_Orig); begin pragma Assert (Present (Parm_Ent)); if Present (Extra_Accessibility (Parm_Ent)) then Add_Extra_Actual (New_Occurrence_Of (Extra_Accessibility (Parm_Ent), Loc), Extra_Accessibility (Formal)); -- If the actual access parameter does not have an -- associated extra formal providing its scope level, -- then treat the actual as having library-level -- accessibility. else Add_Extra_Actual (Make_Integer_Literal (Loc, Intval => Scope_Depth (Standard_Standard)), Extra_Accessibility (Formal)); end if; end; -- The actual is a normal access value, so just pass the level -- of the actual's access type. else Add_Extra_Actual (Dynamic_Accessibility_Level (Prev_Orig), Extra_Accessibility (Formal)); end if; -- If the actual is an access discriminant, then pass the level -- of the enclosing object (RM05-3.10.2(12.4/2)). elsif Nkind (Prev_Orig) = N_Selected_Component and then Ekind (Entity (Selector_Name (Prev_Orig))) = E_Discriminant and then Ekind (Etype (Entity (Selector_Name (Prev_Orig)))) = E_Anonymous_Access_Type then Add_Extra_Actual (Make_Integer_Literal (Loc, Intval => Object_Access_Level (Prefix (Prev_Orig))), Extra_Accessibility (Formal)); -- All other cases else case Nkind (Prev_Orig) is when N_Attribute_Reference => case Get_Attribute_Id (Attribute_Name (Prev_Orig)) is -- For X'Access, pass on the level of the prefix X when Attribute_Access => -- If this is an Access attribute applied to the -- the current instance object passed to a type -- initialization procedure, then use the level -- of the type itself. This is not really correct, -- as there should be an extra level parameter -- passed in with _init formals (only in the case -- where the type is immutably limited), but we -- don't have an easy way currently to create such -- an extra formal (init procs aren't ever frozen). -- For now we just use the level of the type, -- which may be too shallow, but that works better -- than passing Object_Access_Level of the type, -- which can be one level too deep in some cases. -- ??? if Is_Entity_Name (Prefix (Prev_Orig)) and then Is_Type (Entity (Prefix (Prev_Orig))) then Add_Extra_Actual (Make_Integer_Literal (Loc, Intval => Type_Access_Level (Entity (Prefix (Prev_Orig)))), Extra_Accessibility (Formal)); else Add_Extra_Actual (Make_Integer_Literal (Loc, Intval => Object_Access_Level (Prefix (Prev_Orig))), Extra_Accessibility (Formal)); end if; -- Treat the unchecked attributes as library-level when Attribute_Unchecked_Access | Attribute_Unrestricted_Access => Add_Extra_Actual (Make_Integer_Literal (Loc, Intval => Scope_Depth (Standard_Standard)), Extra_Accessibility (Formal)); -- No other cases of attributes returning access -- values that can be passed to access parameters. when others => raise Program_Error; end case; -- For allocators we pass the level of the execution of the -- called subprogram, which is one greater than the current -- scope level. when N_Allocator => Add_Extra_Actual (Make_Integer_Literal (Loc, Intval => Scope_Depth (Current_Scope) + 1), Extra_Accessibility (Formal)); -- For most other cases we simply pass the level of the -- actual's access type. The type is retrieved from -- Prev rather than Prev_Orig, because in some cases -- Prev_Orig denotes an original expression that has -- not been analyzed. when others => Add_Extra_Actual (Dynamic_Accessibility_Level (Prev), Extra_Accessibility (Formal)); end case; end if; end if; -- Perform the check of 4.6(49) that prevents a null value from being -- passed as an actual to an access parameter. Note that the check -- is elided in the common cases of passing an access attribute or -- access parameter as an actual. Also, we currently don't enforce -- this check for expander-generated actuals and when -gnatdj is set. if Ada_Version >= Ada_2005 then -- Ada 2005 (AI-231): Check null-excluding access types. Note that -- the intent of 6.4.1(13) is that null-exclusion checks should -- not be done for 'out' parameters, even though it refers only -- to constraint checks, and a null_exclusion is not a constraint. -- Note that AI05-0196-1 corrects this mistake in the RM. if Is_Access_Type (Etype (Formal)) and then Can_Never_Be_Null (Etype (Formal)) and then Ekind (Formal) /= E_Out_Parameter and then Nkind (Prev) /= N_Raise_Constraint_Error and then (Known_Null (Prev) or else not Can_Never_Be_Null (Etype (Prev))) then Install_Null_Excluding_Check (Prev); end if; -- Ada_Version < Ada_2005 else if Ekind (Etype (Formal)) /= E_Anonymous_Access_Type or else Access_Checks_Suppressed (Subp) then null; elsif Debug_Flag_J then null; elsif not Comes_From_Source (Prev) then null; elsif Is_Entity_Name (Prev) and then Ekind (Etype (Prev)) = E_Anonymous_Access_Type then null; elsif Nkind_In (Prev, N_Allocator, N_Attribute_Reference) then null; else Install_Null_Excluding_Check (Prev); end if; end if; -- Perform appropriate validity checks on parameters that -- are entities. if Validity_Checks_On then if (Ekind (Formal) = E_In_Parameter and then Validity_Check_In_Params) or else (Ekind (Formal) = E_In_Out_Parameter and then Validity_Check_In_Out_Params) then -- If the actual is an indexed component of a packed type (or -- is an indexed or selected component whose prefix recursively -- meets this condition), it has not been expanded yet. It will -- be copied in the validity code that follows, and has to be -- expanded appropriately, so reanalyze it. -- What we do is just to unset analyzed bits on prefixes till -- we reach something that does not have a prefix. declare Nod : Node_Id; begin Nod := Actual; while Nkind_In (Nod, N_Indexed_Component, N_Selected_Component) loop Set_Analyzed (Nod, False); Nod := Prefix (Nod); end loop; end; Ensure_Valid (Actual); end if; end if; -- For IN OUT and OUT parameters, ensure that subscripts are valid -- since this is a left side reference. We only do this for calls -- from the source program since we assume that compiler generated -- calls explicitly generate any required checks. We also need it -- only if we are doing standard validity checks, since clearly it is -- not needed if validity checks are off, and in subscript validity -- checking mode, all indexed components are checked with a call -- directly from Expand_N_Indexed_Component. if Comes_From_Source (Call_Node) and then Ekind (Formal) /= E_In_Parameter and then Validity_Checks_On and then Validity_Check_Default and then not Validity_Check_Subscripts then Check_Valid_Lvalue_Subscripts (Actual); end if; -- Mark any scalar OUT parameter that is a simple variable as no -- longer known to be valid (unless the type is always valid). This -- reflects the fact that if an OUT parameter is never set in a -- procedure, then it can become invalid on the procedure return. if Ekind (Formal) = E_Out_Parameter and then Is_Entity_Name (Actual) and then Ekind (Entity (Actual)) = E_Variable and then not Is_Known_Valid (Etype (Actual)) then Set_Is_Known_Valid (Entity (Actual), False); end if; -- For an OUT or IN OUT parameter, if the actual is an entity, then -- clear current values, since they can be clobbered. We are probably -- doing this in more places than we need to, but better safe than -- sorry when it comes to retaining bad current values. if Ekind (Formal) /= E_In_Parameter and then Is_Entity_Name (Actual) and then Present (Entity (Actual)) then declare Ent : constant Entity_Id := Entity (Actual); Sav : Node_Id; begin -- For an OUT or IN OUT parameter that is an assignable entity, -- we do not want to clobber the Last_Assignment field, since -- if it is set, it was precisely because it is indeed an OUT -- or IN OUT parameter. We do reset the Is_Known_Valid flag -- since the subprogram could have returned in invalid value. if Ekind_In (Formal, E_Out_Parameter, E_In_Out_Parameter) and then Is_Assignable (Ent) then Sav := Last_Assignment (Ent); Kill_Current_Values (Ent); Set_Last_Assignment (Ent, Sav); Set_Is_Known_Valid (Ent, False); -- For all other cases, just kill the current values else Kill_Current_Values (Ent); end if; end; end if; -- If the formal is class wide and the actual is an aggregate, force -- evaluation so that the back end who does not know about class-wide -- type, does not generate a temporary of the wrong size. if not Is_Class_Wide_Type (Etype (Formal)) then null; elsif Nkind (Actual) = N_Aggregate or else (Nkind (Actual) = N_Qualified_Expression and then Nkind (Expression (Actual)) = N_Aggregate) then Force_Evaluation (Actual); end if; -- In a remote call, if the formal is of a class-wide type, check -- that the actual meets the requirements described in E.4(18). if Remote and then Is_Class_Wide_Type (Etype (Formal)) then Insert_Action (Actual, Make_Transportable_Check (Loc, Duplicate_Subexpr_Move_Checks (Actual))); end if; -- Perform invariant checks for all intermediate types in a view -- conversion after successful return from a call that passes the -- view conversion as an IN OUT or OUT parameter (RM 7.3.2 (12/3, -- 13/3, 14/3)). Consider only source conversion in order to avoid -- generating spurious checks on complex expansion such as object -- initialization through an extension aggregate. if Comes_From_Source (N) and then Ekind (Formal) /= E_In_Parameter and then Nkind (Actual) = N_Type_Conversion then Add_View_Conversion_Invariants (Formal, Actual); end if; -- Generating C the initialization of an allocator is performed by -- means of individual statements, and hence it must be done before -- the call. if Modify_Tree_For_C and then Nkind (Actual) = N_Allocator and then Nkind (Expression (Actual)) = N_Qualified_Expression then Remove_Side_Effects (Actual); end if; -- This label is required when skipping extra actual generation for -- Unchecked_Union parameters. <<Skip_Extra_Actual_Generation>> Param_Count := Param_Count + 1; Next_Actual (Actual); Next_Formal (Formal); end loop; -- If we are calling an Ada 2012 function which needs to have the -- "accessibility level determined by the point of call" (AI05-0234) -- passed in to it, then pass it in. if Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type) and then Present (Extra_Accessibility_Of_Result (Ultimate_Alias (Subp))) then declare Ancestor : Node_Id := Parent (Call_Node); Level : Node_Id := Empty; Defer : Boolean := False; begin -- Unimplemented: if Subp returns an anonymous access type, then -- a) if the call is the operand of an explict conversion, then -- the target type of the conversion (a named access type) -- determines the accessibility level pass in; -- b) if the call defines an access discriminant of an object -- (e.g., the discriminant of an object being created by an -- allocator, or the discriminant of a function result), -- then the accessibility level to pass in is that of the -- discriminated object being initialized). -- ??? while Nkind (Ancestor) = N_Qualified_Expression loop Ancestor := Parent (Ancestor); end loop; case Nkind (Ancestor) is when N_Allocator => -- At this point, we'd like to assign -- Level := Dynamic_Accessibility_Level (Ancestor); -- but Etype of Ancestor may not have been set yet, -- so that doesn't work. -- Handle this later in Expand_Allocator_Expression. Defer := True; when N_Object_Declaration | N_Object_Renaming_Declaration => declare Def_Id : constant Entity_Id := Defining_Identifier (Ancestor); begin if Is_Return_Object (Def_Id) then if Present (Extra_Accessibility_Of_Result (Return_Applies_To (Scope (Def_Id)))) then -- Pass along value that was passed in if the -- routine we are returning from also has an -- Accessibility_Of_Result formal. Level := New_Occurrence_Of (Extra_Accessibility_Of_Result (Return_Applies_To (Scope (Def_Id))), Loc); end if; else Level := Make_Integer_Literal (Loc, Intval => Object_Access_Level (Def_Id)); end if; end; when N_Simple_Return_Statement => if Present (Extra_Accessibility_Of_Result (Return_Applies_To (Return_Statement_Entity (Ancestor)))) then -- Pass along value that was passed in if the returned -- routine also has an Accessibility_Of_Result formal. Level := New_Occurrence_Of (Extra_Accessibility_Of_Result (Return_Applies_To (Return_Statement_Entity (Ancestor))), Loc); end if; when others => null; end case; if not Defer then if not Present (Level) then -- The "innermost master that evaluates the function call". -- ??? - Should we use Integer'Last here instead in order -- to deal with (some of) the problems associated with -- calls to subps whose enclosing scope is unknown (e.g., -- Anon_Access_To_Subp_Param.all)? Level := Make_Integer_Literal (Loc, Intval => Scope_Depth (Current_Scope) + 1); end if; Add_Extra_Actual (Level, Extra_Accessibility_Of_Result (Ultimate_Alias (Subp))); end if; end; end if; -- If we are expanding the RHS of an assignment we need to check if tag -- propagation is needed. You might expect this processing to be in -- Analyze_Assignment but has to be done earlier (bottom-up) because the -- assignment might be transformed to a declaration for an unconstrained -- value if the expression is classwide. if Nkind (Call_Node) = N_Function_Call and then Is_Tag_Indeterminate (Call_Node) and then Is_Entity_Name (Name (Call_Node)) then declare Ass : Node_Id := Empty; begin if Nkind (Parent (Call_Node)) = N_Assignment_Statement then Ass := Parent (Call_Node); elsif Nkind (Parent (Call_Node)) = N_Qualified_Expression and then Nkind (Parent (Parent (Call_Node))) = N_Assignment_Statement then Ass := Parent (Parent (Call_Node)); elsif Nkind (Parent (Call_Node)) = N_Explicit_Dereference and then Nkind (Parent (Parent (Call_Node))) = N_Assignment_Statement then Ass := Parent (Parent (Call_Node)); end if; if Present (Ass) and then Is_Class_Wide_Type (Etype (Name (Ass))) then if Is_Access_Type (Etype (Call_Node)) then if Designated_Type (Etype (Call_Node)) /= Root_Type (Etype (Name (Ass))) then Error_Msg_NE ("tag-indeterminate expression " & " must have designated type& (RM 5.2 (6))", Call_Node, Root_Type (Etype (Name (Ass)))); else Propagate_Tag (Name (Ass), Call_Node); end if; elsif Etype (Call_Node) /= Root_Type (Etype (Name (Ass))) then Error_Msg_NE ("tag-indeterminate expression must have type&" & "(RM 5.2 (6))", Call_Node, Root_Type (Etype (Name (Ass)))); else Propagate_Tag (Name (Ass), Call_Node); end if; -- The call will be rewritten as a dispatching call, and -- expanded as such. return; end if; end; end if; -- Ada 2005 (AI-251): If some formal is a class-wide interface, expand -- it to point to the correct secondary virtual table if Nkind (Call_Node) in N_Subprogram_Call and then CW_Interface_Formals_Present then Expand_Interface_Actuals (Call_Node); end if; -- Deals with Dispatch_Call if we still have a call, before expanding -- extra actuals since this will be done on the re-analysis of the -- dispatching call. Note that we do not try to shorten the actual list -- for a dispatching call, it would not make sense to do so. Expansion -- of dispatching calls is suppressed for VM targets, because the VM -- back-ends directly handle the generation of dispatching calls and -- would have to undo any expansion to an indirect call. if Nkind (Call_Node) in N_Subprogram_Call and then Present (Controlling_Argument (Call_Node)) then declare Call_Typ : constant Entity_Id := Etype (Call_Node); Typ : constant Entity_Id := Find_Dispatching_Type (Subp); Eq_Prim_Op : Entity_Id := Empty; New_Call : Node_Id; Param : Node_Id; Prev_Call : Node_Id; begin if not Is_Limited_Type (Typ) then Eq_Prim_Op := Find_Prim_Op (Typ, Name_Op_Eq); end if; if Tagged_Type_Expansion then Expand_Dispatching_Call (Call_Node); -- The following return is worrisome. Is it really OK to skip -- all remaining processing in this procedure ??? return; -- VM targets else Apply_Tag_Checks (Call_Node); -- If this is a dispatching "=", we must first compare the -- tags so we generate: x.tag = y.tag and then x = y if Subp = Eq_Prim_Op then -- Mark the node as analyzed to avoid reanalyzing this -- dispatching call (which would cause a never-ending loop) Prev_Call := Relocate_Node (Call_Node); Set_Analyzed (Prev_Call); Param := First_Actual (Call_Node); New_Call := Make_And_Then (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => Make_Selected_Component (Loc, Prefix => New_Value (Param), Selector_Name => New_Occurrence_Of (First_Tag_Component (Typ), Loc)), Right_Opnd => Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Typ, New_Value (Next_Actual (Param))), Selector_Name => New_Occurrence_Of (First_Tag_Component (Typ), Loc))), Right_Opnd => Prev_Call); Rewrite (Call_Node, New_Call); Analyze_And_Resolve (Call_Node, Call_Typ, Suppress => All_Checks); end if; -- Expansion of a dispatching call results in an indirect call, -- which in turn causes current values to be killed (see -- Resolve_Call), so on VM targets we do the call here to -- ensure consistent warnings between VM and non-VM targets. Kill_Current_Values; end if; -- If this is a dispatching "=" then we must update the reference -- to the call node because we generated: -- x.tag = y.tag and then x = y if Subp = Eq_Prim_Op then Call_Node := Right_Opnd (Call_Node); end if; end; end if; -- Similarly, expand calls to RCI subprograms on which pragma -- All_Calls_Remote applies. The rewriting will be reanalyzed -- later. Do this only when the call comes from source since we -- do not want such a rewriting to occur in expanded code. if Is_All_Remote_Call (Call_Node) then Expand_All_Calls_Remote_Subprogram_Call (Call_Node); -- Similarly, do not add extra actuals for an entry call whose entity -- is a protected procedure, or for an internal protected subprogram -- call, because it will be rewritten as a protected subprogram call -- and reanalyzed (see Expand_Protected_Subprogram_Call). elsif Is_Protected_Type (Scope (Subp)) and then (Ekind (Subp) = E_Procedure or else Ekind (Subp) = E_Function) then null; -- During that loop we gathered the extra actuals (the ones that -- correspond to Extra_Formals), so now they can be appended. else while Is_Non_Empty_List (Extra_Actuals) loop Add_Actual_Parameter (Remove_Head (Extra_Actuals)); end loop; end if; -- At this point we have all the actuals, so this is the point at which -- the various expansion activities for actuals is carried out. Expand_Actuals (Call_Node, Subp); -- Verify that the actuals do not share storage. This check must be done -- on the caller side rather that inside the subprogram to avoid issues -- of parameter passing. if Check_Aliasing_Of_Parameters then Apply_Parameter_Aliasing_Checks (Call_Node, Subp); end if; -- If the subprogram is a renaming, or if it is inherited, replace it in -- the call with the name of the actual subprogram being called. If this -- is a dispatching call, the run-time decides what to call. The Alias -- attribute does not apply to entries. if Nkind (Call_Node) /= N_Entry_Call_Statement and then No (Controlling_Argument (Call_Node)) and then Present (Parent_Subp) and then not Is_Direct_Deep_Call (Subp) then if Present (Inherited_From_Formal (Subp)) then Parent_Subp := Inherited_From_Formal (Subp); else Parent_Subp := Ultimate_Alias (Parent_Subp); end if; -- The below setting of Entity is suspect, see F109-018 discussion??? Set_Entity (Name (Call_Node), Parent_Subp); if Is_Abstract_Subprogram (Parent_Subp) and then not In_Instance then Error_Msg_NE ("cannot call abstract subprogram &!", Name (Call_Node), Parent_Subp); end if; -- Inspect all formals of derived subprogram Subp. Compare parameter -- types with the parent subprogram and check whether an actual may -- need a type conversion to the corresponding formal of the parent -- subprogram. -- Not clear whether intrinsic subprograms need such conversions. ??? if not Is_Intrinsic_Subprogram (Parent_Subp) or else Is_Generic_Instance (Parent_Subp) then declare procedure Convert (Act : Node_Id; Typ : Entity_Id); -- Rewrite node Act as a type conversion of Act to Typ. Analyze -- and resolve the newly generated construct. ------------- -- Convert -- ------------- procedure Convert (Act : Node_Id; Typ : Entity_Id) is begin Rewrite (Act, OK_Convert_To (Typ, Relocate_Node (Act))); Analyze (Act); Resolve (Act, Typ); end Convert; -- Local variables Actual_Typ : Entity_Id; Formal_Typ : Entity_Id; Parent_Typ : Entity_Id; begin Actual := First_Actual (Call_Node); Formal := First_Formal (Subp); Parent_Formal := First_Formal (Parent_Subp); while Present (Formal) loop Actual_Typ := Etype (Actual); Formal_Typ := Etype (Formal); Parent_Typ := Etype (Parent_Formal); -- For an IN parameter of a scalar type, the parent formal -- type and derived formal type differ or the parent formal -- type and actual type do not match statically. if Is_Scalar_Type (Formal_Typ) and then Ekind (Formal) = E_In_Parameter and then Formal_Typ /= Parent_Typ and then not Subtypes_Statically_Match (Parent_Typ, Actual_Typ) and then not Raises_Constraint_Error (Actual) then Convert (Actual, Parent_Typ); Enable_Range_Check (Actual); -- If the actual has been marked as requiring a range -- check, then generate it here. if Do_Range_Check (Actual) then Generate_Range_Check (Actual, Etype (Formal), CE_Range_Check_Failed); end if; -- For access types, the parent formal type and actual type -- differ. elsif Is_Access_Type (Formal_Typ) and then Base_Type (Parent_Typ) /= Base_Type (Actual_Typ) then if Ekind (Formal) /= E_In_Parameter then Convert (Actual, Parent_Typ); elsif Ekind (Parent_Typ) = E_Anonymous_Access_Type and then Designated_Type (Parent_Typ) /= Designated_Type (Actual_Typ) and then not Is_Controlling_Formal (Formal) then -- This unchecked conversion is not necessary unless -- inlining is enabled, because in that case the type -- mismatch may become visible in the body about to be -- inlined. Rewrite (Actual, Unchecked_Convert_To (Parent_Typ, Relocate_Node (Actual))); Analyze (Actual); Resolve (Actual, Parent_Typ); end if; -- If there is a change of representation, then generate a -- warning, and do the change of representation. elsif not Same_Representation (Formal_Typ, Parent_Typ) then Error_Msg_N ("??change of representation required", Actual); Convert (Actual, Parent_Typ); -- For array and record types, the parent formal type and -- derived formal type have different sizes or pragma Pack -- status. elsif ((Is_Array_Type (Formal_Typ) and then Is_Array_Type (Parent_Typ)) or else (Is_Record_Type (Formal_Typ) and then Is_Record_Type (Parent_Typ))) and then (Esize (Formal_Typ) /= Esize (Parent_Typ) or else Has_Pragma_Pack (Formal_Typ) /= Has_Pragma_Pack (Parent_Typ)) then Convert (Actual, Parent_Typ); end if; Next_Actual (Actual); Next_Formal (Formal); Next_Formal (Parent_Formal); end loop; end; end if; Orig_Subp := Subp; Subp := Parent_Subp; end if; -- Deal with case where call is an explicit dereference if Nkind (Name (Call_Node)) = N_Explicit_Dereference then -- Handle case of access to protected subprogram type if Is_Access_Protected_Subprogram_Type (Base_Type (Etype (Prefix (Name (Call_Node))))) then -- If this is a call through an access to protected operation, the -- prefix has the form (object'address, operation'access). Rewrite -- as a for other protected calls: the object is the 1st parameter -- of the list of actuals. declare Call : Node_Id; Parm : List_Id; Nam : Node_Id; Obj : Node_Id; Ptr : constant Node_Id := Prefix (Name (Call_Node)); T : constant Entity_Id := Equivalent_Type (Base_Type (Etype (Ptr))); D_T : constant Entity_Id := Designated_Type (Base_Type (Etype (Ptr))); begin Obj := Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (T, Ptr), Selector_Name => New_Occurrence_Of (First_Entity (T), Loc)); Nam := Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (T, Ptr), Selector_Name => New_Occurrence_Of (Next_Entity (First_Entity (T)), Loc)); Nam := Make_Explicit_Dereference (Loc, Prefix => Nam); if Present (Parameter_Associations (Call_Node)) then Parm := Parameter_Associations (Call_Node); else Parm := New_List; end if; Prepend (Obj, Parm); if Etype (D_T) = Standard_Void_Type then Call := Make_Procedure_Call_Statement (Loc, Name => Nam, Parameter_Associations => Parm); else Call := Make_Function_Call (Loc, Name => Nam, Parameter_Associations => Parm); end if; Set_First_Named_Actual (Call, First_Named_Actual (Call_Node)); Set_Etype (Call, Etype (D_T)); -- We do not re-analyze the call to avoid infinite recursion. -- We analyze separately the prefix and the object, and set -- the checks on the prefix that would otherwise be emitted -- when resolving a call. Rewrite (Call_Node, Call); Analyze (Nam); Apply_Access_Check (Nam); Analyze (Obj); return; end; end if; end if; -- If this is a call to an intrinsic subprogram, then perform the -- appropriate expansion to the corresponding tree node and we -- are all done (since after that the call is gone). -- In the case where the intrinsic is to be processed by the back end, -- the call to Expand_Intrinsic_Call will do nothing, which is fine, -- since the idea in this case is to pass the call unchanged. If the -- intrinsic is an inherited unchecked conversion, and the derived type -- is the target type of the conversion, we must retain it as the return -- type of the expression. Otherwise the expansion below, which uses the -- parent operation, will yield the wrong type. if Is_Intrinsic_Subprogram (Subp) then Expand_Intrinsic_Call (Call_Node, Subp); if Nkind (Call_Node) = N_Unchecked_Type_Conversion and then Parent_Subp /= Orig_Subp and then Etype (Parent_Subp) /= Etype (Orig_Subp) then Set_Etype (Call_Node, Etype (Orig_Subp)); end if; return; end if; if Ekind_In (Subp, E_Function, E_Procedure) then -- We perform a simple optimization on calls for To_Address by -- replacing them with an unchecked conversion. Not only is this -- efficient, but it also avoids order of elaboration problems when -- address clauses are inlined (address expression elaborated at the -- at the wrong point). -- We perform this optimization regardless of whether we are in the -- main unit or in a unit in the context of the main unit, to ensure -- that tree generated is the same in both cases, for CodePeer use. if Is_RTE (Subp, RE_To_Address) then Rewrite (Call_Node, Unchecked_Convert_To (RTE (RE_Address), Relocate_Node (First_Actual (Call_Node)))); return; end if; -- Handle inlining. No action needed if the subprogram is not inlined if not Is_Inlined (Subp) then null; -- Frontend inlining of expression functions (performed also when -- backend inlining is enabled). elsif Is_Inlinable_Expression_Function (Subp) then Rewrite (N, New_Copy (Expression_Of_Expression_Function (Subp))); Analyze (N); return; -- Handle frontend inlining elsif not Back_End_Inlining then Inlined_Subprogram : declare Bod : Node_Id; Must_Inline : Boolean := False; Spec : constant Node_Id := Unit_Declaration_Node (Subp); begin -- Verify that the body to inline has already been seen, and -- that if the body is in the current unit the inlining does -- not occur earlier. This avoids order-of-elaboration problems -- in the back end. -- This should be documented in sinfo/einfo ??? if No (Spec) or else Nkind (Spec) /= N_Subprogram_Declaration or else No (Body_To_Inline (Spec)) then Must_Inline := False; -- If this an inherited function that returns a private type, -- do not inline if the full view is an unconstrained array, -- because such calls cannot be inlined. elsif Present (Orig_Subp) and then Is_Array_Type (Etype (Orig_Subp)) and then not Is_Constrained (Etype (Orig_Subp)) then Must_Inline := False; elsif In_Unfrozen_Instance (Scope (Subp)) then Must_Inline := False; else Bod := Body_To_Inline (Spec); if (In_Extended_Main_Code_Unit (Call_Node) or else In_Extended_Main_Code_Unit (Parent (Call_Node)) or else Has_Pragma_Inline_Always (Subp)) and then (not In_Same_Extended_Unit (Sloc (Bod), Loc) or else Earlier_In_Extended_Unit (Sloc (Bod), Loc)) then Must_Inline := True; -- If we are compiling a package body that is not the main -- unit, it must be for inlining/instantiation purposes, -- in which case we inline the call to insure that the same -- temporaries are generated when compiling the body by -- itself. Otherwise link errors can occur. -- If the function being called is itself in the main unit, -- we cannot inline, because there is a risk of double -- elaboration and/or circularity: the inlining can make -- visible a private entity in the body of the main unit, -- that gigi will see before its sees its proper definition. elsif not (In_Extended_Main_Code_Unit (Call_Node)) and then In_Package_Body then Must_Inline := not In_Extended_Main_Source_Unit (Subp); -- Inline calls to _postconditions when generating C code elsif Modify_Tree_For_C and then In_Same_Extended_Unit (Sloc (Bod), Loc) and then Chars (Name (N)) = Name_uPostconditions then Must_Inline := True; end if; end if; if Must_Inline then Expand_Inlined_Call (Call_Node, Subp, Orig_Subp); else -- Let the back end handle it Add_Inlined_Body (Subp, Call_Node); if Front_End_Inlining and then Nkind (Spec) = N_Subprogram_Declaration and then (In_Extended_Main_Code_Unit (Call_Node)) and then No (Body_To_Inline (Spec)) and then not Has_Completion (Subp) and then In_Same_Extended_Unit (Sloc (Spec), Loc) then Cannot_Inline ("cannot inline& (body not seen yet)?", Call_Node, Subp); end if; end if; end Inlined_Subprogram; -- Back end inlining: let the back end handle it elsif No (Unit_Declaration_Node (Subp)) or else Nkind (Unit_Declaration_Node (Subp)) /= N_Subprogram_Declaration or else No (Body_To_Inline (Unit_Declaration_Node (Subp))) or else Nkind (Body_To_Inline (Unit_Declaration_Node (Subp))) in N_Entity then Add_Inlined_Body (Subp, Call_Node); -- If the inlined call appears within an instantiation and some -- level of optimization is required, ensure that the enclosing -- instance body is available so that the back-end can actually -- perform the inlining. if In_Instance and then Comes_From_Source (Subp) and then Optimization_Level > 0 then declare Decl : Node_Id; Inst : Entity_Id; Inst_Node : Node_Id; begin Inst := Scope (Subp); -- Find enclosing instance while Present (Inst) and then Inst /= Standard_Standard loop exit when Is_Generic_Instance (Inst); Inst := Scope (Inst); end loop; if Present (Inst) and then Is_Generic_Instance (Inst) and then not Is_Inlined (Inst) then Set_Is_Inlined (Inst); Decl := Unit_Declaration_Node (Inst); -- Do not add a pending instantiation if the body exits -- already, or if the instance is a compilation unit, or -- the instance node is missing. if Present (Corresponding_Body (Decl)) or else Nkind (Parent (Decl)) = N_Compilation_Unit or else No (Next (Decl)) then null; else -- The instantiation node usually follows the package -- declaration for the instance. If the generic unit -- has aspect specifications, they are transformed -- into pragmas in the instance, and the instance node -- appears after them. Inst_Node := Next (Decl); while Nkind (Inst_Node) /= N_Package_Instantiation loop Inst_Node := Next (Inst_Node); end loop; Add_Pending_Instantiation (Inst_Node, Decl); end if; end if; end; end if; -- Front end expansion of simple functions returning unconstrained -- types (see Check_And_Split_Unconstrained_Function). Note that the -- case of a simple renaming (Body_To_Inline in N_Entity above, see -- also Build_Renamed_Body) cannot be expanded here because this may -- give rise to order-of-elaboration issues for the types of the -- parameters of the subprogram, if any. else Expand_Inlined_Call (Call_Node, Subp, Orig_Subp); end if; end if; -- Check for protected subprogram. This is either an intra-object call, -- or a protected function call. Protected procedure calls are rewritten -- as entry calls and handled accordingly. -- In Ada 2005, this may be an indirect call to an access parameter that -- is an access_to_subprogram. In that case the anonymous type has a -- scope that is a protected operation, but the call is a regular one. -- In either case do not expand call if subprogram is eliminated. Scop := Scope (Subp); if Nkind (Call_Node) /= N_Entry_Call_Statement and then Is_Protected_Type (Scop) and then Ekind (Subp) /= E_Subprogram_Type and then not Is_Eliminated (Subp) then -- If the call is an internal one, it is rewritten as a call to the -- corresponding unprotected subprogram. Expand_Protected_Subprogram_Call (Call_Node, Subp, Scop); end if; -- Functions returning controlled objects need special attention. If -- the return type is limited, then the context is initialization and -- different processing applies. If the call is to a protected function, -- the expansion above will call Expand_Call recursively. Otherwise the -- function call is transformed into a temporary which obtains the -- result from the secondary stack. if Needs_Finalization (Etype (Subp)) then if not Is_Limited_View (Etype (Subp)) and then (No (First_Formal (Subp)) or else not Is_Concurrent_Record_Type (Etype (First_Formal (Subp)))) then Expand_Ctrl_Function_Call (Call_Node); -- Build-in-place function calls which appear in anonymous contexts -- need a transient scope to ensure the proper finalization of the -- intermediate result after its use. elsif Is_Build_In_Place_Function_Call (Call_Node) and then Nkind_In (Parent (Call_Node), N_Attribute_Reference, N_Function_Call, N_Indexed_Component, N_Object_Renaming_Declaration, N_Procedure_Call_Statement, N_Selected_Component, N_Slice) then Establish_Transient_Scope (Call_Node, Sec_Stack => True); end if; end if; end Expand_Call; ------------------------------- -- Expand_Ctrl_Function_Call -- ------------------------------- procedure Expand_Ctrl_Function_Call (N : Node_Id) is function Is_Element_Reference (N : Node_Id) return Boolean; -- Determine whether node N denotes a reference to an Ada 2012 container -- element. -------------------------- -- Is_Element_Reference -- -------------------------- function Is_Element_Reference (N : Node_Id) return Boolean is Ref : constant Node_Id := Original_Node (N); begin -- Analysis marks an element reference by setting the generalized -- indexing attribute of an indexed component before the component -- is rewritten into a function call. return Nkind (Ref) = N_Indexed_Component and then Present (Generalized_Indexing (Ref)); end Is_Element_Reference; -- Start of processing for Expand_Ctrl_Function_Call begin -- Optimization, if the returned value (which is on the sec-stack) is -- returned again, no need to copy/readjust/finalize, we can just pass -- the value thru (see Expand_N_Simple_Return_Statement), and thus no -- attachment is needed if Nkind (Parent (N)) = N_Simple_Return_Statement then return; end if; -- Resolution is now finished, make sure we don't start analysis again -- because of the duplication. Set_Analyzed (N); -- A function which returns a controlled object uses the secondary -- stack. Rewrite the call into a temporary which obtains the result of -- the function using 'reference. Remove_Side_Effects (N); -- The side effect removal of the function call produced a temporary. -- When the context is a case expression, if expression, or expression -- with actions, the lifetime of the temporary must be extended to match -- that of the context. Otherwise the function result will be finalized -- too early and affect the result of the expression. To prevent this -- unwanted effect, the temporary should not be considered for clean up -- actions by the general finalization machinery. -- Exception to this rule are references to Ada 2012 container elements. -- Such references must be finalized at the end of each iteration of the -- related quantified expression, otherwise the container will remain -- busy. if Nkind (N) = N_Explicit_Dereference and then Within_Case_Or_If_Expression (N) and then not Is_Element_Reference (N) then Set_Is_Ignored_Transient (Entity (Prefix (N))); end if; end Expand_Ctrl_Function_Call; ---------------------------------------- -- Expand_N_Extended_Return_Statement -- ---------------------------------------- -- If there is a Handled_Statement_Sequence, we rewrite this: -- return Result : T := <expression> do -- <handled_seq_of_stms> -- end return; -- to be: -- declare -- Result : T := <expression>; -- begin -- <handled_seq_of_stms> -- return Result; -- end; -- Otherwise (no Handled_Statement_Sequence), we rewrite this: -- return Result : T := <expression>; -- to be: -- return <expression>; -- unless it's build-in-place or there's no <expression>, in which case -- we generate: -- declare -- Result : T := <expression>; -- begin -- return Result; -- end; -- Note that this case could have been written by the user as an extended -- return statement, or could have been transformed to this from a simple -- return statement. -- That is, we need to have a reified return object if there are statements -- (which might refer to it) or if we're doing build-in-place (so we can -- set its address to the final resting place or if there is no expression -- (in which case default initial values might need to be set). procedure Expand_N_Extended_Return_Statement (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); function Build_Heap_Allocator (Temp_Id : Entity_Id; Temp_Typ : Entity_Id; Func_Id : Entity_Id; Ret_Typ : Entity_Id; Alloc_Expr : Node_Id) return Node_Id; -- Create the statements necessary to allocate a return object on the -- caller's master. The master is available through implicit parameter -- BIPfinalizationmaster. -- -- if BIPfinalizationmaster /= null then -- declare -- type Ptr_Typ is access Ret_Typ; -- for Ptr_Typ'Storage_Pool use -- Base_Pool (BIPfinalizationmaster.all).all; -- Local : Ptr_Typ; -- -- begin -- procedure Allocate (...) is -- begin -- System.Storage_Pools.Subpools.Allocate_Any (...); -- end Allocate; -- -- Local := <Alloc_Expr>; -- Temp_Id := Temp_Typ (Local); -- end; -- end if; -- -- Temp_Id is the temporary which is used to reference the internally -- created object in all allocation forms. Temp_Typ is the type of the -- temporary. Func_Id is the enclosing function. Ret_Typ is the return -- type of Func_Id. Alloc_Expr is the actual allocator. function Move_Activation_Chain (Func_Id : Entity_Id) return Node_Id; -- Construct a call to System.Tasking.Stages.Move_Activation_Chain -- with parameters: -- From current activation chain -- To activation chain passed in by the caller -- New_Master master passed in by the caller -- -- Func_Id is the entity of the function where the extended return -- statement appears. -------------------------- -- Build_Heap_Allocator -- -------------------------- function Build_Heap_Allocator (Temp_Id : Entity_Id; Temp_Typ : Entity_Id; Func_Id : Entity_Id; Ret_Typ : Entity_Id; Alloc_Expr : Node_Id) return Node_Id is begin pragma Assert (Is_Build_In_Place_Function (Func_Id)); -- Processing for build-in-place object allocation. if Needs_Finalization (Ret_Typ) then declare Decls : constant List_Id := New_List; Fin_Mas_Id : constant Entity_Id := Build_In_Place_Formal (Func_Id, BIP_Finalization_Master); Stmts : constant List_Id := New_List; Desig_Typ : Entity_Id; Local_Id : Entity_Id; Pool_Id : Entity_Id; Ptr_Typ : Entity_Id; begin -- Generate: -- Pool_Id renames Base_Pool (BIPfinalizationmaster.all).all; Pool_Id := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Pool_Id, Subtype_Mark => New_Occurrence_Of (RTE (RE_Root_Storage_Pool), Loc), Name => Make_Explicit_Dereference (Loc, Prefix => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Base_Pool), Loc), Parameter_Associations => New_List ( Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Fin_Mas_Id, Loc))))))); -- Create an access type which uses the storage pool of the -- caller's master. This additional type is necessary because -- the finalization master cannot be associated with the type -- of the temporary. Otherwise the secondary stack allocation -- will fail. Desig_Typ := Ret_Typ; -- Ensure that the build-in-place machinery uses a fat pointer -- when allocating an unconstrained array on the heap. In this -- case the result object type is a constrained array type even -- though the function type is unconstrained. if Ekind (Desig_Typ) = E_Array_Subtype then Desig_Typ := Base_Type (Desig_Typ); end if; -- Generate: -- type Ptr_Typ is access Desig_Typ; Ptr_Typ := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Full_Type_Declaration (Loc, Defining_Identifier => Ptr_Typ, Type_Definition => Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Desig_Typ, Loc)))); -- Perform minor decoration in order to set the master and the -- storage pool attributes. Set_Ekind (Ptr_Typ, E_Access_Type); Set_Finalization_Master (Ptr_Typ, Fin_Mas_Id); Set_Associated_Storage_Pool (Ptr_Typ, Pool_Id); -- Create the temporary, generate: -- Local_Id : Ptr_Typ; Local_Id := Make_Temporary (Loc, 'T'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Local_Id, Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc))); -- Allocate the object, generate: -- Local_Id := <Alloc_Expr>; Append_To (Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Local_Id, Loc), Expression => Alloc_Expr)); -- Generate: -- Temp_Id := Temp_Typ (Local_Id); Append_To (Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Temp_Id, Loc), Expression => Unchecked_Convert_To (Temp_Typ, New_Occurrence_Of (Local_Id, Loc)))); -- Wrap the allocation in a block. This is further conditioned -- by checking the caller finalization master at runtime. A -- null value indicates a non-existent master, most likely due -- to a Finalize_Storage_Only allocation. -- Generate: -- if BIPfinalizationmaster /= null then -- declare -- <Decls> -- begin -- <Stmts> -- end; -- end if; return Make_If_Statement (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Fin_Mas_Id, Loc), Right_Opnd => Make_Null (Loc)), Then_Statements => New_List ( Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts)))); end; -- For all other cases, generate: -- Temp_Id := <Alloc_Expr>; else return Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Temp_Id, Loc), Expression => Alloc_Expr); end if; end Build_Heap_Allocator; --------------------------- -- Move_Activation_Chain -- --------------------------- function Move_Activation_Chain (Func_Id : Entity_Id) return Node_Id is begin return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Move_Activation_Chain), Loc), Parameter_Associations => New_List ( -- Source chain Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Name_uChain), Attribute_Name => Name_Unrestricted_Access), -- Destination chain New_Occurrence_Of (Build_In_Place_Formal (Func_Id, BIP_Activation_Chain), Loc), -- New master New_Occurrence_Of (Build_In_Place_Formal (Func_Id, BIP_Task_Master), Loc))); end Move_Activation_Chain; -- Local variables Func_Id : constant Entity_Id := Return_Applies_To (Return_Statement_Entity (N)); Is_BIP_Func : constant Boolean := Is_Build_In_Place_Function (Func_Id); Ret_Obj_Id : constant Entity_Id := First_Entity (Return_Statement_Entity (N)); Ret_Obj_Decl : constant Node_Id := Parent (Ret_Obj_Id); Ret_Typ : constant Entity_Id := Etype (Func_Id); Exp : Node_Id; HSS : Node_Id; Result : Node_Id; Return_Stmt : Node_Id; Stmts : List_Id; -- Start of processing for Expand_N_Extended_Return_Statement begin -- Given that functionality of interface thunks is simple (just displace -- the pointer to the object) they are always handled by means of -- simple return statements. pragma Assert (not Is_Thunk (Current_Scope)); if Nkind (Ret_Obj_Decl) = N_Object_Declaration then Exp := Expression (Ret_Obj_Decl); else Exp := Empty; end if; HSS := Handled_Statement_Sequence (N); -- If the returned object needs finalization actions, the function must -- perform the appropriate cleanup should it fail to return. The state -- of the function itself is tracked through a flag which is coupled -- with the scope finalizer. There is one flag per each return object -- in case of multiple returns. if Is_BIP_Func and then Needs_Finalization (Etype (Ret_Obj_Id)) then declare Flag_Decl : Node_Id; Flag_Id : Entity_Id; Func_Bod : Node_Id; begin -- Recover the function body Func_Bod := Unit_Declaration_Node (Func_Id); if Nkind (Func_Bod) = N_Subprogram_Declaration then Func_Bod := Parent (Parent (Corresponding_Body (Func_Bod))); end if; -- Create a flag to track the function state Flag_Id := Make_Temporary (Loc, 'F'); Set_Status_Flag_Or_Transient_Decl (Ret_Obj_Id, Flag_Id); -- Insert the flag at the beginning of the function declarations, -- generate: -- Fnn : Boolean := False; Flag_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Flag_Id, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc)); Prepend_To (Declarations (Func_Bod), Flag_Decl); Analyze (Flag_Decl); end; end if; -- Build a simple_return_statement that returns the return object when -- there is a statement sequence, or no expression, or the result will -- be built in place. Note however that we currently do this for all -- composite cases, even though nonlimited composite results are not yet -- built in place (though we plan to do so eventually). if Present (HSS) or else Is_Composite_Type (Ret_Typ) or else No (Exp) then if No (HSS) then Stmts := New_List; -- If the extended return has a handled statement sequence, then wrap -- it in a block and use the block as the first statement. else Stmts := New_List ( Make_Block_Statement (Loc, Declarations => New_List, Handled_Statement_Sequence => HSS)); end if; -- If the result type contains tasks, we call Move_Activation_Chain. -- Later, the cleanup code will call Complete_Master, which will -- terminate any unactivated tasks belonging to the return statement -- master. But Move_Activation_Chain updates their master to be that -- of the caller, so they will not be terminated unless the return -- statement completes unsuccessfully due to exception, abort, goto, -- or exit. As a formality, we test whether the function requires the -- result to be built in place, though that's necessarily true for -- the case of result types with task parts. if Is_BIP_Func and then Has_Task (Ret_Typ) then -- The return expression is an aggregate for a complex type which -- contains tasks. This particular case is left unexpanded since -- the regular expansion would insert all temporaries and -- initialization code in the wrong block. if Nkind (Exp) = N_Aggregate then Expand_N_Aggregate (Exp); end if; -- Do not move the activation chain if the return object does not -- contain tasks. if Has_Task (Etype (Ret_Obj_Id)) then Append_To (Stmts, Move_Activation_Chain (Func_Id)); end if; end if; -- Update the state of the function right before the object is -- returned. if Is_BIP_Func and then Needs_Finalization (Etype (Ret_Obj_Id)) then declare Flag_Id : constant Entity_Id := Status_Flag_Or_Transient_Decl (Ret_Obj_Id); begin -- Generate: -- Fnn := True; Append_To (Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Flag_Id, Loc), Expression => New_Occurrence_Of (Standard_True, Loc))); end; end if; -- Build a simple_return_statement that returns the return object Return_Stmt := Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (Ret_Obj_Id, Loc)); Append_To (Stmts, Return_Stmt); HSS := Make_Handled_Sequence_Of_Statements (Loc, Stmts); end if; -- Case where we build a return statement block if Present (HSS) then Result := Make_Block_Statement (Loc, Declarations => Return_Object_Declarations (N), Handled_Statement_Sequence => HSS); -- We set the entity of the new block statement to be that of the -- return statement. This is necessary so that various fields, such -- as Finalization_Chain_Entity carry over from the return statement -- to the block. Note that this block is unusual, in that its entity -- is an E_Return_Statement rather than an E_Block. Set_Identifier (Result, New_Occurrence_Of (Return_Statement_Entity (N), Loc)); -- If the object decl was already rewritten as a renaming, then we -- don't want to do the object allocation and transformation of -- the return object declaration to a renaming. This case occurs -- when the return object is initialized by a call to another -- build-in-place function, and that function is responsible for -- the allocation of the return object. if Is_BIP_Func and then Nkind (Ret_Obj_Decl) = N_Object_Renaming_Declaration then pragma Assert (Nkind (Original_Node (Ret_Obj_Decl)) = N_Object_Declaration and then Is_Build_In_Place_Function_Call (Expression (Original_Node (Ret_Obj_Decl)))); -- Return the build-in-place result by reference Set_By_Ref (Return_Stmt); elsif Is_BIP_Func then -- Locate the implicit access parameter associated with the -- caller-supplied return object and convert the return -- statement's return object declaration to a renaming of a -- dereference of the access parameter. If the return object's -- declaration includes an expression that has not already been -- expanded as separate assignments, then add an assignment -- statement to ensure the return object gets initialized. -- declare -- Result : T [:= <expression>]; -- begin -- ... -- is converted to -- declare -- Result : T renames FuncRA.all; -- [Result := <expression;] -- begin -- ... declare Ret_Obj_Expr : constant Node_Id := Expression (Ret_Obj_Decl); Ret_Obj_Typ : constant Entity_Id := Etype (Ret_Obj_Id); Init_Assignment : Node_Id := Empty; Obj_Acc_Formal : Entity_Id; Obj_Acc_Deref : Node_Id; Obj_Alloc_Formal : Entity_Id; begin -- Build-in-place results must be returned by reference Set_By_Ref (Return_Stmt); -- Retrieve the implicit access parameter passed by the caller Obj_Acc_Formal := Build_In_Place_Formal (Func_Id, BIP_Object_Access); -- If the return object's declaration includes an expression -- and the declaration isn't marked as No_Initialization, then -- we need to generate an assignment to the object and insert -- it after the declaration before rewriting it as a renaming -- (otherwise we'll lose the initialization). The case where -- the result type is an interface (or class-wide interface) -- is also excluded because the context of the function call -- must be unconstrained, so the initialization will always -- be done as part of an allocator evaluation (storage pool -- or secondary stack), never to a constrained target object -- passed in by the caller. Besides the assignment being -- unneeded in this case, it avoids problems with trying to -- generate a dispatching assignment when the return expression -- is a nonlimited descendant of a limited interface (the -- interface has no assignment operation). if Present (Ret_Obj_Expr) and then not No_Initialization (Ret_Obj_Decl) and then not Is_Interface (Ret_Obj_Typ) then Init_Assignment := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Ret_Obj_Id, Loc), Expression => Relocate_Node (Ret_Obj_Expr)); Set_Etype (Name (Init_Assignment), Etype (Ret_Obj_Id)); Set_Assignment_OK (Name (Init_Assignment)); Set_No_Ctrl_Actions (Init_Assignment); Set_Parent (Name (Init_Assignment), Init_Assignment); Set_Parent (Expression (Init_Assignment), Init_Assignment); Set_Expression (Ret_Obj_Decl, Empty); if Is_Class_Wide_Type (Etype (Ret_Obj_Id)) and then not Is_Class_Wide_Type (Etype (Expression (Init_Assignment))) then Rewrite (Expression (Init_Assignment), Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Etype (Ret_Obj_Id), Loc), Expression => Relocate_Node (Expression (Init_Assignment)))); end if; -- In the case of functions where the calling context can -- determine the form of allocation needed, initialization -- is done with each part of the if statement that handles -- the different forms of allocation (this is true for -- unconstrained and tagged result subtypes). if Is_Constrained (Ret_Typ) and then not Is_Tagged_Type (Underlying_Type (Ret_Typ)) then Insert_After (Ret_Obj_Decl, Init_Assignment); end if; end if; -- When the function's subtype is unconstrained, a run-time -- test is needed to determine the form of allocation to use -- for the return object. The function has an implicit formal -- parameter indicating this. If the BIP_Alloc_Form formal has -- the value one, then the caller has passed access to an -- existing object for use as the return object. If the value -- is two, then the return object must be allocated on the -- secondary stack. Otherwise, the object must be allocated in -- a storage pool (currently only supported for the global -- heap, user-defined storage pools TBD ???). We generate an -- if statement to test the implicit allocation formal and -- initialize a local access value appropriately, creating -- allocators in the secondary stack and global heap cases. -- The special formal also exists and must be tested when the -- function has a tagged result, even when the result subtype -- is constrained, because in general such functions can be -- called in dispatching contexts and must be handled similarly -- to functions with a class-wide result. if not Is_Constrained (Ret_Typ) or else Is_Tagged_Type (Underlying_Type (Ret_Typ)) then Obj_Alloc_Formal := Build_In_Place_Formal (Func_Id, BIP_Alloc_Form); declare Pool_Id : constant Entity_Id := Make_Temporary (Loc, 'P'); Alloc_Obj_Id : Entity_Id; Alloc_Obj_Decl : Node_Id; Alloc_If_Stmt : Node_Id; Heap_Allocator : Node_Id; Pool_Decl : Node_Id; Pool_Allocator : Node_Id; Ptr_Type_Decl : Node_Id; Ref_Type : Entity_Id; SS_Allocator : Node_Id; begin -- Reuse the itype created for the function's implicit -- access formal. This avoids the need to create a new -- access type here, plus it allows assigning the access -- formal directly without applying a conversion. -- Ref_Type := Etype (Object_Access); -- Create an access type designating the function's -- result subtype. Ref_Type := Make_Temporary (Loc, 'A'); Ptr_Type_Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Ref_Type, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => New_Occurrence_Of (Ret_Obj_Typ, Loc))); Insert_Before (Ret_Obj_Decl, Ptr_Type_Decl); -- Create an access object that will be initialized to an -- access value denoting the return object, either coming -- from an implicit access value passed in by the caller -- or from the result of an allocator. Alloc_Obj_Id := Make_Temporary (Loc, 'R'); Set_Etype (Alloc_Obj_Id, Ref_Type); Alloc_Obj_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Alloc_Obj_Id, Object_Definition => New_Occurrence_Of (Ref_Type, Loc)); Insert_Before (Ret_Obj_Decl, Alloc_Obj_Decl); -- Create allocators for both the secondary stack and -- global heap. If there's an initialization expression, -- then create these as initialized allocators. if Present (Ret_Obj_Expr) and then not No_Initialization (Ret_Obj_Decl) then -- Always use the type of the expression for the -- qualified expression, rather than the result type. -- In general we cannot always use the result type -- for the allocator, because the expression might be -- of a specific type, such as in the case of an -- aggregate or even a nonlimited object when the -- result type is a limited class-wide interface type. Heap_Allocator := Make_Allocator (Loc, Expression => Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (Etype (Ret_Obj_Expr), Loc), Expression => New_Copy_Tree (Ret_Obj_Expr))); else -- If the function returns a class-wide type we cannot -- use the return type for the allocator. Instead we -- use the type of the expression, which must be an -- aggregate of a definite type. if Is_Class_Wide_Type (Ret_Obj_Typ) then Heap_Allocator := Make_Allocator (Loc, Expression => New_Occurrence_Of (Etype (Ret_Obj_Expr), Loc)); else Heap_Allocator := Make_Allocator (Loc, Expression => New_Occurrence_Of (Ret_Obj_Typ, Loc)); end if; -- If the object requires default initialization then -- that will happen later following the elaboration of -- the object renaming. If we don't turn it off here -- then the object will be default initialized twice. Set_No_Initialization (Heap_Allocator); end if; -- The Pool_Allocator is just like the Heap_Allocator, -- except we set Storage_Pool and Procedure_To_Call so -- it will use the user-defined storage pool. Pool_Allocator := New_Copy_Tree (Heap_Allocator); -- Do not generate the renaming of the build-in-place -- pool parameter on ZFP because the parameter is not -- created in the first place. if RTE_Available (RE_Root_Storage_Pool_Ptr) then Pool_Decl := Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Pool_Id, Subtype_Mark => New_Occurrence_Of (RTE (RE_Root_Storage_Pool), Loc), Name => Make_Explicit_Dereference (Loc, New_Occurrence_Of (Build_In_Place_Formal (Func_Id, BIP_Storage_Pool), Loc))); Set_Storage_Pool (Pool_Allocator, Pool_Id); Set_Procedure_To_Call (Pool_Allocator, RTE (RE_Allocate_Any)); else Pool_Decl := Make_Null_Statement (Loc); end if; -- If the No_Allocators restriction is active, then only -- an allocator for secondary stack allocation is needed. -- It's OK for such allocators to have Comes_From_Source -- set to False, because gigi knows not to flag them as -- being a violation of No_Implicit_Heap_Allocations. if Restriction_Active (No_Allocators) then SS_Allocator := Heap_Allocator; Heap_Allocator := Make_Null (Loc); Pool_Allocator := Make_Null (Loc); -- Otherwise the heap and pool allocators may be needed, -- so we make another allocator for secondary stack -- allocation. else SS_Allocator := New_Copy_Tree (Heap_Allocator); -- The heap and pool allocators are marked as -- Comes_From_Source since they correspond to an -- explicit user-written allocator (that is, it will -- only be executed on behalf of callers that call the -- function as initialization for such an allocator). -- Prevents errors when No_Implicit_Heap_Allocations -- is in force. Set_Comes_From_Source (Heap_Allocator, True); Set_Comes_From_Source (Pool_Allocator, True); end if; -- The allocator is returned on the secondary stack. Set_Storage_Pool (SS_Allocator, RTE (RE_SS_Pool)); Set_Procedure_To_Call (SS_Allocator, RTE (RE_SS_Allocate)); -- The allocator is returned on the secondary stack, -- so indicate that the function return, as well as -- all blocks that encloses the allocator, must not -- release it. The flags must be set now because -- the decision to use the secondary stack is done -- very late in the course of expanding the return -- statement, past the point where these flags are -- normally set. Set_Uses_Sec_Stack (Func_Id); Set_Uses_Sec_Stack (Return_Statement_Entity (N)); Set_Sec_Stack_Needed_For_Return (Return_Statement_Entity (N)); Set_Enclosing_Sec_Stack_Return (N); -- Create an if statement to test the BIP_Alloc_Form -- formal and initialize the access object to either the -- BIP_Object_Access formal (BIP_Alloc_Form = -- Caller_Allocation), the result of allocating the -- object in the secondary stack (BIP_Alloc_Form = -- Secondary_Stack), or else an allocator to create the -- return object in the heap or user-defined pool -- (BIP_Alloc_Form = Global_Heap or User_Storage_Pool). -- ??? An unchecked type conversion must be made in the -- case of assigning the access object formal to the -- local access object, because a normal conversion would -- be illegal in some cases (such as converting access- -- to-unconstrained to access-to-constrained), but the -- the unchecked conversion will presumably fail to work -- right in just such cases. It's not clear at all how to -- handle this. ??? Alloc_If_Stmt := Make_If_Statement (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Obj_Alloc_Formal, Loc), Right_Opnd => Make_Integer_Literal (Loc, UI_From_Int (BIP_Allocation_Form'Pos (Caller_Allocation)))), Then_Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Alloc_Obj_Id, Loc), Expression => Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Ref_Type, Loc), Expression => New_Occurrence_Of (Obj_Acc_Formal, Loc)))), Elsif_Parts => New_List ( Make_Elsif_Part (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Obj_Alloc_Formal, Loc), Right_Opnd => Make_Integer_Literal (Loc, UI_From_Int (BIP_Allocation_Form'Pos (Secondary_Stack)))), Then_Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Alloc_Obj_Id, Loc), Expression => SS_Allocator))), Make_Elsif_Part (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Obj_Alloc_Formal, Loc), Right_Opnd => Make_Integer_Literal (Loc, UI_From_Int (BIP_Allocation_Form'Pos (Global_Heap)))), Then_Statements => New_List ( Build_Heap_Allocator (Temp_Id => Alloc_Obj_Id, Temp_Typ => Ref_Type, Func_Id => Func_Id, Ret_Typ => Ret_Obj_Typ, Alloc_Expr => Heap_Allocator)))), Else_Statements => New_List ( Pool_Decl, Build_Heap_Allocator (Temp_Id => Alloc_Obj_Id, Temp_Typ => Ref_Type, Func_Id => Func_Id, Ret_Typ => Ret_Obj_Typ, Alloc_Expr => Pool_Allocator))); -- If a separate initialization assignment was created -- earlier, append that following the assignment of the -- implicit access formal to the access object, to ensure -- that the return object is initialized in that case. In -- this situation, the target of the assignment must be -- rewritten to denote a dereference of the access to the -- return object passed in by the caller. if Present (Init_Assignment) then Rewrite (Name (Init_Assignment), Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Alloc_Obj_Id, Loc))); Set_Etype (Name (Init_Assignment), Etype (Ret_Obj_Id)); Append_To (Then_Statements (Alloc_If_Stmt), Init_Assignment); end if; Insert_Before (Ret_Obj_Decl, Alloc_If_Stmt); -- Remember the local access object for use in the -- dereference of the renaming created below. Obj_Acc_Formal := Alloc_Obj_Id; end; end if; -- Replace the return object declaration with a renaming of a -- dereference of the access value designating the return -- object. Obj_Acc_Deref := Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Obj_Acc_Formal, Loc)); Rewrite (Ret_Obj_Decl, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Ret_Obj_Id, Access_Definition => Empty, Subtype_Mark => New_Occurrence_Of (Ret_Obj_Typ, Loc), Name => Obj_Acc_Deref)); Set_Renamed_Object (Ret_Obj_Id, Obj_Acc_Deref); end; end if; -- Case where we do not build a block else -- We're about to drop Return_Object_Declarations on the floor, so -- we need to insert it, in case it got expanded into useful code. -- Remove side effects from expression, which may be duplicated in -- subsequent checks (see Expand_Simple_Function_Return). Insert_List_Before (N, Return_Object_Declarations (N)); Remove_Side_Effects (Exp); -- Build simple_return_statement that returns the expression directly Return_Stmt := Make_Simple_Return_Statement (Loc, Expression => Exp); Result := Return_Stmt; end if; -- Set the flag to prevent infinite recursion Set_Comes_From_Extended_Return_Statement (Return_Stmt); Rewrite (N, Result); Analyze (N); end Expand_N_Extended_Return_Statement; ---------------------------- -- Expand_N_Function_Call -- ---------------------------- procedure Expand_N_Function_Call (N : Node_Id) is begin Expand_Call (N); end Expand_N_Function_Call; --------------------------------------- -- Expand_N_Procedure_Call_Statement -- --------------------------------------- procedure Expand_N_Procedure_Call_Statement (N : Node_Id) is begin Expand_Call (N); end Expand_N_Procedure_Call_Statement; -------------------------------------- -- Expand_N_Simple_Return_Statement -- -------------------------------------- procedure Expand_N_Simple_Return_Statement (N : Node_Id) is begin -- Defend against previous errors (i.e. the return statement calls a -- function that is not available in configurable runtime). if Present (Expression (N)) and then Nkind (Expression (N)) = N_Empty then Check_Error_Detected; return; end if; -- Distinguish the function and non-function cases: case Ekind (Return_Applies_To (Return_Statement_Entity (N))) is when E_Function | E_Generic_Function => Expand_Simple_Function_Return (N); when E_Entry | E_Entry_Family | E_Generic_Procedure | E_Procedure | E_Return_Statement => Expand_Non_Function_Return (N); when others => raise Program_Error; end case; exception when RE_Not_Available => return; end Expand_N_Simple_Return_Statement; ------------------------------ -- Expand_N_Subprogram_Body -- ------------------------------ -- Add poll call if ATC polling is enabled, unless the body will be inlined -- by the back-end. -- Add dummy push/pop label nodes at start and end to clear any local -- exception indications if local-exception-to-goto optimization is active. -- Add return statement if last statement in body is not a return statement -- (this makes things easier on Gigi which does not want to have to handle -- a missing return). -- Add call to Activate_Tasks if body is a task activator -- Deal with possible detection of infinite recursion -- Eliminate body completely if convention stubbed -- Encode entity names within body, since we will not need to reference -- these entities any longer in the front end. -- Initialize scalar out parameters if Initialize/Normalize_Scalars -- Reset Pure indication if any parameter has root type System.Address -- or has any parameters of limited types, where limited means that the -- run-time view is limited (i.e. the full type is limited). -- Wrap thread body procedure Expand_N_Subprogram_Body (N : Node_Id) is Body_Id : constant Entity_Id := Defining_Entity (N); HSS : constant Node_Id := Handled_Statement_Sequence (N); Loc : constant Source_Ptr := Sloc (N); procedure Add_Return (Spec_Id : Entity_Id; Stmts : List_Id); -- Append a return statement to the statement sequence Stmts if the last -- statement is not already a return or a goto statement. Note that the -- latter test is not critical, it does not matter if we add a few extra -- returns, since they get eliminated anyway later on. Spec_Id denotes -- the corresponding spec of the subprogram body. ---------------- -- Add_Return -- ---------------- procedure Add_Return (Spec_Id : Entity_Id; Stmts : List_Id) is Last_Stmt : Node_Id; Loc : Source_Ptr; Stmt : Node_Id; begin -- Get last statement, ignoring any Pop_xxx_Label nodes, which are -- not relevant in this context since they are not executable. Last_Stmt := Last (Stmts); while Nkind (Last_Stmt) in N_Pop_xxx_Label loop Prev (Last_Stmt); end loop; -- Now insert return unless last statement is a transfer if not Is_Transfer (Last_Stmt) then -- The source location for the return is the end label of the -- procedure if present. Otherwise use the sloc of the last -- statement in the list. If the list comes from a generated -- exception handler and we are not debugging generated code, -- all the statements within the handler are made invisible -- to the debugger. if Nkind (Parent (Stmts)) = N_Exception_Handler and then not Comes_From_Source (Parent (Stmts)) then Loc := Sloc (Last_Stmt); elsif Present (End_Label (HSS)) then Loc := Sloc (End_Label (HSS)); else Loc := Sloc (Last_Stmt); end if; -- Append return statement, and set analyzed manually. We can't -- call Analyze on this return since the scope is wrong. -- Note: it almost works to push the scope and then do the Analyze -- call, but something goes wrong in some weird cases and it is -- not worth worrying about ??? Stmt := Make_Simple_Return_Statement (Loc); -- The return statement is handled properly, and the call to the -- postcondition, inserted below, does not require information -- from the body either. However, that call is analyzed in the -- enclosing scope, and an elaboration check might improperly be -- added to it. A guard in Sem_Elab is needed to prevent that -- spurious check, see Check_Elab_Call. Append_To (Stmts, Stmt); Set_Analyzed (Stmt); -- Call the _Postconditions procedure if the related subprogram -- has contract assertions that need to be verified on exit. if Ekind (Spec_Id) = E_Procedure and then Present (Postconditions_Proc (Spec_Id)) then Insert_Action (Stmt, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Postconditions_Proc (Spec_Id), Loc))); end if; end if; end Add_Return; -- Local variables Except_H : Node_Id; L : List_Id; Spec_Id : Entity_Id; -- Start of processing for Expand_N_Subprogram_Body begin if Present (Corresponding_Spec (N)) then Spec_Id := Corresponding_Spec (N); else Spec_Id := Body_Id; end if; -- If this is a Pure function which has any parameters whose root type -- is System.Address, reset the Pure indication. -- This check is also performed when the subprogram is frozen, but we -- repeat it on the body so that the indication is consistent, and so -- it applies as well to bodies without separate specifications. if Is_Pure (Spec_Id) and then Is_Subprogram (Spec_Id) and then not Has_Pragma_Pure_Function (Spec_Id) then Check_Function_With_Address_Parameter (Spec_Id); if Spec_Id /= Body_Id then Set_Is_Pure (Body_Id, Is_Pure (Spec_Id)); end if; end if; -- Set L to either the list of declarations if present, or to the list -- of statements if no declarations are present. This is used to insert -- new stuff at the start. if Is_Non_Empty_List (Declarations (N)) then L := Declarations (N); else L := Statements (HSS); end if; -- If local-exception-to-goto optimization active, insert dummy push -- statements at start, and dummy pop statements at end, but inhibit -- this if we have No_Exception_Handlers, since they are useless and -- intefere with analysis, e.g. by codepeer. if (Debug_Flag_Dot_G or else Restriction_Active (No_Exception_Propagation)) and then not Restriction_Active (No_Exception_Handlers) and then not CodePeer_Mode and then Is_Non_Empty_List (L) then declare FS : constant Node_Id := First (L); FL : constant Source_Ptr := Sloc (FS); LS : Node_Id; LL : Source_Ptr; begin -- LS points to either last statement, if statements are present -- or to the last declaration if there are no statements present. -- It is the node after which the pop's are generated. if Is_Non_Empty_List (Statements (HSS)) then LS := Last (Statements (HSS)); else LS := Last (L); end if; LL := Sloc (LS); Insert_List_Before_And_Analyze (FS, New_List ( Make_Push_Constraint_Error_Label (FL), Make_Push_Program_Error_Label (FL), Make_Push_Storage_Error_Label (FL))); Insert_List_After_And_Analyze (LS, New_List ( Make_Pop_Constraint_Error_Label (LL), Make_Pop_Program_Error_Label (LL), Make_Pop_Storage_Error_Label (LL))); end; end if; -- Need poll on entry to subprogram if polling enabled. We only do this -- for non-empty subprograms, since it does not seem necessary to poll -- for a dummy null subprogram. if Is_Non_Empty_List (L) then -- Do not add a polling call if the subprogram is to be inlined by -- the back-end, to avoid repeated calls with multiple inlinings. if Is_Inlined (Spec_Id) and then Front_End_Inlining and then Optimization_Level > 1 then null; else Generate_Poll_Call (First (L)); end if; end if; -- Initialize any scalar OUT args if Initialize/Normalize_Scalars if Init_Or_Norm_Scalars and then Is_Subprogram (Spec_Id) then declare F : Entity_Id; A : Node_Id; begin -- Loop through formals F := First_Formal (Spec_Id); while Present (F) loop if Is_Scalar_Type (Etype (F)) and then Ekind (F) = E_Out_Parameter then Check_Restriction (No_Default_Initialization, F); -- Insert the initialization. We turn off validity checks -- for this assignment, since we do not want any check on -- the initial value itself (which may well be invalid). -- Predicate checks are disabled as well (RM 6.4.1 (13/3)) A := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (F, Loc), Expression => Get_Simple_Init_Val (Etype (F), N)); Set_Suppress_Assignment_Checks (A); Insert_Before_And_Analyze (First (L), A, Suppress => Validity_Check); end if; Next_Formal (F); end loop; end; end if; -- Clear out statement list for stubbed procedure if Present (Corresponding_Spec (N)) then Set_Elaboration_Flag (N, Spec_Id); if Convention (Spec_Id) = Convention_Stubbed or else Is_Eliminated (Spec_Id) then Set_Declarations (N, Empty_List); Set_Handled_Statement_Sequence (N, Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Make_Null_Statement (Loc)))); return; end if; end if; -- Create a set of discriminals for the next protected subprogram body if Is_List_Member (N) and then Present (Parent (List_Containing (N))) and then Nkind (Parent (List_Containing (N))) = N_Protected_Body and then Present (Next_Protected_Operation (N)) then Set_Discriminals (Parent (Base_Type (Scope (Spec_Id)))); end if; -- Returns_By_Ref flag is normally set when the subprogram is frozen but -- subprograms with no specs are not frozen. declare Typ : constant Entity_Id := Etype (Spec_Id); Utyp : constant Entity_Id := Underlying_Type (Typ); begin if Is_Limited_View (Typ) then Set_Returns_By_Ref (Spec_Id); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then Set_Returns_By_Ref (Spec_Id); end if; end; -- For a procedure, we add a return for all possible syntactic ends of -- the subprogram. if Ekind_In (Spec_Id, E_Procedure, E_Generic_Procedure) then Add_Return (Spec_Id, Statements (HSS)); if Present (Exception_Handlers (HSS)) then Except_H := First_Non_Pragma (Exception_Handlers (HSS)); while Present (Except_H) loop Add_Return (Spec_Id, Statements (Except_H)); Next_Non_Pragma (Except_H); end loop; end if; -- For a function, we must deal with the case where there is at least -- one missing return. What we do is to wrap the entire body of the -- function in a block: -- begin -- ... -- end; -- becomes -- begin -- begin -- ... -- end; -- raise Program_Error; -- end; -- This approach is necessary because the raise must be signalled to the -- caller, not handled by any local handler (RM 6.4(11)). -- Note: we do not need to analyze the constructed sequence here, since -- it has no handler, and an attempt to analyze the handled statement -- sequence twice is risky in various ways (e.g. the issue of expanding -- cleanup actions twice). elsif Has_Missing_Return (Spec_Id) then declare Hloc : constant Source_Ptr := Sloc (HSS); Blok : constant Node_Id := Make_Block_Statement (Hloc, Handled_Statement_Sequence => HSS); Rais : constant Node_Id := Make_Raise_Program_Error (Hloc, Reason => PE_Missing_Return); begin Set_Handled_Statement_Sequence (N, Make_Handled_Sequence_Of_Statements (Hloc, Statements => New_List (Blok, Rais))); Push_Scope (Spec_Id); Analyze (Blok); Analyze (Rais); Pop_Scope; end; end if; -- If subprogram contains a parameterless recursive call, then we may -- have an infinite recursion, so see if we can generate code to check -- for this possibility if storage checks are not suppressed. if Ekind (Spec_Id) = E_Procedure and then Has_Recursive_Call (Spec_Id) and then not Storage_Checks_Suppressed (Spec_Id) then Detect_Infinite_Recursion (N, Spec_Id); end if; -- Set to encode entity names in package body before gigi is called Qualify_Entity_Names (N); end Expand_N_Subprogram_Body; ----------------------------------- -- Expand_N_Subprogram_Body_Stub -- ----------------------------------- procedure Expand_N_Subprogram_Body_Stub (N : Node_Id) is Bod : Node_Id; begin if Present (Corresponding_Body (N)) then Bod := Unit_Declaration_Node (Corresponding_Body (N)); -- The body may have been expanded already when it is analyzed -- through the subunit node. Do no expand again: it interferes -- with the construction of unnesting tables when generating C. if not Analyzed (Bod) then Expand_N_Subprogram_Body (Bod); end if; -- Add full qualification to entities that may be created late -- during unnesting. Qualify_Entity_Names (N); end if; end Expand_N_Subprogram_Body_Stub; ------------------------------------- -- Expand_N_Subprogram_Declaration -- ------------------------------------- -- If the declaration appears within a protected body, it is a private -- operation of the protected type. We must create the corresponding -- protected subprogram an associated formals. For a normal protected -- operation, this is done when expanding the protected type declaration. -- If the declaration is for a null procedure, emit null body procedure Expand_N_Subprogram_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Subp : constant Entity_Id := Defining_Entity (N); -- Local variables Scop : constant Entity_Id := Scope (Subp); Prot_Bod : Node_Id; Prot_Decl : Node_Id; Prot_Id : Entity_Id; -- Start of processing for Expand_N_Subprogram_Declaration begin -- In SPARK, subprogram declarations are only allowed in package -- specifications. if Nkind (Parent (N)) /= N_Package_Specification then if Nkind (Parent (N)) = N_Compilation_Unit then Check_SPARK_05_Restriction ("subprogram declaration is not a library item", N); elsif Present (Next (N)) and then Nkind (Next (N)) = N_Pragma and then Get_Pragma_Id (Next (N)) = Pragma_Import then -- In SPARK, subprogram declarations are also permitted in -- declarative parts when immediately followed by a corresponding -- pragma Import. We only check here that there is some pragma -- Import. null; else Check_SPARK_05_Restriction ("subprogram declaration is not allowed here", N); end if; end if; -- Deal with case of protected subprogram. Do not generate protected -- operation if operation is flagged as eliminated. if Is_List_Member (N) and then Present (Parent (List_Containing (N))) and then Nkind (Parent (List_Containing (N))) = N_Protected_Body and then Is_Protected_Type (Scop) then if No (Protected_Body_Subprogram (Subp)) and then not Is_Eliminated (Subp) then Prot_Decl := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (N, Scop, Unprotected_Mode)); -- The protected subprogram is declared outside of the protected -- body. Given that the body has frozen all entities so far, we -- analyze the subprogram and perform freezing actions explicitly. -- including the generation of an explicit freeze node, to ensure -- that gigi has the proper order of elaboration. -- If the body is a subunit, the insertion point is before the -- stub in the parent. Prot_Bod := Parent (List_Containing (N)); if Nkind (Parent (Prot_Bod)) = N_Subunit then Prot_Bod := Corresponding_Stub (Parent (Prot_Bod)); end if; Insert_Before (Prot_Bod, Prot_Decl); Prot_Id := Defining_Unit_Name (Specification (Prot_Decl)); Set_Has_Delayed_Freeze (Prot_Id); Push_Scope (Scope (Scop)); Analyze (Prot_Decl); Freeze_Before (N, Prot_Id); Set_Protected_Body_Subprogram (Subp, Prot_Id); -- Create protected operation as well. Even though the operation -- is only accessible within the body, it is possible to make it -- available outside of the protected object by using 'Access to -- provide a callback, so build protected version in all cases. Prot_Decl := Make_Subprogram_Declaration (Loc, Specification => Build_Protected_Sub_Specification (N, Scop, Protected_Mode)); Insert_Before (Prot_Bod, Prot_Decl); Analyze (Prot_Decl); Pop_Scope; end if; -- Ada 2005 (AI-348): Generate body for a null procedure. In most -- cases this is superfluous because calls to it will be automatically -- inlined, but we definitely need the body if preconditions for the -- procedure are present. elsif Nkind (Specification (N)) = N_Procedure_Specification and then Null_Present (Specification (N)) then declare Bod : constant Node_Id := Body_To_Inline (N); begin Set_Has_Completion (Subp, False); Append_Freeze_Action (Subp, Bod); -- The body now contains raise statements, so calls to it will -- not be inlined. Set_Is_Inlined (Subp, False); end; end if; -- When generating C code, transform a function that returns a -- constrained array type into a procedure with an out parameter -- that carries the return value. -- We skip this transformation for unchecked conversions, since they -- are not needed by the C generator (and this also produces cleaner -- output). if Modify_Tree_For_C and then Nkind (Specification (N)) = N_Function_Specification and then Is_Array_Type (Etype (Subp)) and then Is_Constrained (Etype (Subp)) and then not Is_Unchecked_Conversion_Instance (Subp) then Build_Procedure_Form (N); end if; end Expand_N_Subprogram_Declaration; -------------------------------- -- Expand_Non_Function_Return -- -------------------------------- procedure Expand_Non_Function_Return (N : Node_Id) is pragma Assert (No (Expression (N))); Loc : constant Source_Ptr := Sloc (N); Scope_Id : Entity_Id := Return_Applies_To (Return_Statement_Entity (N)); Kind : constant Entity_Kind := Ekind (Scope_Id); Call : Node_Id; Acc_Stat : Node_Id; Goto_Stat : Node_Id; Lab_Node : Node_Id; begin -- Call the _Postconditions procedure if the related subprogram has -- contract assertions that need to be verified on exit. if Ekind_In (Scope_Id, E_Entry, E_Entry_Family, E_Procedure) and then Present (Postconditions_Proc (Scope_Id)) then Insert_Action (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Postconditions_Proc (Scope_Id), Loc))); end if; -- If it is a return from a procedure do no extra steps if Kind = E_Procedure or else Kind = E_Generic_Procedure then return; -- If it is a nested return within an extended one, replace it with a -- return of the previously declared return object. elsif Kind = E_Return_Statement then Rewrite (N, Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (First_Entity (Scope_Id), Loc))); Set_Comes_From_Extended_Return_Statement (N); Set_Return_Statement_Entity (N, Scope_Id); Expand_Simple_Function_Return (N); return; end if; pragma Assert (Is_Entry (Scope_Id)); -- Look at the enclosing block to see whether the return is from an -- accept statement or an entry body. for J in reverse 0 .. Scope_Stack.Last loop Scope_Id := Scope_Stack.Table (J).Entity; exit when Is_Concurrent_Type (Scope_Id); end loop; -- If it is a return from accept statement it is expanded as call to -- RTS Complete_Rendezvous and a goto to the end of the accept body. -- (cf : Expand_N_Accept_Statement, Expand_N_Selective_Accept, -- Expand_N_Accept_Alternative in exp_ch9.adb) if Is_Task_Type (Scope_Id) then Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Complete_Rendezvous), Loc)); Insert_Before (N, Call); -- why not insert actions here??? Analyze (Call); Acc_Stat := Parent (N); while Nkind (Acc_Stat) /= N_Accept_Statement loop Acc_Stat := Parent (Acc_Stat); end loop; Lab_Node := Last (Statements (Handled_Statement_Sequence (Acc_Stat))); Goto_Stat := Make_Goto_Statement (Loc, Name => New_Occurrence_Of (Entity (Identifier (Lab_Node)), Loc)); Set_Analyzed (Goto_Stat); Rewrite (N, Goto_Stat); Analyze (N); -- If it is a return from an entry body, put a Complete_Entry_Body call -- in front of the return. elsif Is_Protected_Type (Scope_Id) then Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Complete_Entry_Body), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Find_Protection_Object (Current_Scope), Loc), Attribute_Name => Name_Unchecked_Access))); Insert_Before (N, Call); Analyze (Call); end if; end Expand_Non_Function_Return; --------------------------------------- -- Expand_Protected_Object_Reference -- --------------------------------------- function Expand_Protected_Object_Reference (N : Node_Id; Scop : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); Corr : Entity_Id; Rec : Node_Id; Param : Entity_Id; Proc : Entity_Id; begin Rec := Make_Identifier (Loc, Name_uObject); Set_Etype (Rec, Corresponding_Record_Type (Scop)); -- Find enclosing protected operation, and retrieve its first parameter, -- which denotes the enclosing protected object. If the enclosing -- operation is an entry, we are immediately within the protected body, -- and we can retrieve the object from the service entries procedure. A -- barrier function has the same signature as an entry. A barrier -- function is compiled within the protected object, but unlike -- protected operations its never needs locks, so that its protected -- body subprogram points to itself. Proc := Current_Scope; while Present (Proc) and then Scope (Proc) /= Scop loop Proc := Scope (Proc); end loop; Corr := Protected_Body_Subprogram (Proc); if No (Corr) then -- Previous error left expansion incomplete. -- Nothing to do on this call. return Empty; end if; Param := Defining_Identifier (First (Parameter_Specifications (Parent (Corr)))); if Is_Subprogram (Proc) and then Proc /= Corr then -- Protected function or procedure Set_Entity (Rec, Param); -- Rec is a reference to an entity which will not be in scope when -- the call is reanalyzed, and needs no further analysis. Set_Analyzed (Rec); else -- Entry or barrier function for entry body. The first parameter of -- the entry body procedure is pointer to the object. We create a -- local variable of the proper type, duplicating what is done to -- define _object later on. declare Decls : List_Id; Obj_Ptr : constant Entity_Id := Make_Temporary (Loc, 'T'); begin Decls := New_List ( Make_Full_Type_Declaration (Loc, Defining_Identifier => Obj_Ptr, Type_Definition => Make_Access_To_Object_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Corresponding_Record_Type (Scop), Loc)))); Insert_Actions (N, Decls); Freeze_Before (N, Obj_Ptr); Rec := Make_Explicit_Dereference (Loc, Prefix => Unchecked_Convert_To (Obj_Ptr, New_Occurrence_Of (Param, Loc))); -- Analyze new actual. Other actuals in calls are already analyzed -- and the list of actuals is not reanalyzed after rewriting. Set_Parent (Rec, N); Analyze (Rec); end; end if; return Rec; end Expand_Protected_Object_Reference; -------------------------------------- -- Expand_Protected_Subprogram_Call -- -------------------------------------- procedure Expand_Protected_Subprogram_Call (N : Node_Id; Subp : Entity_Id; Scop : Entity_Id) is Rec : Node_Id; procedure Expand_Internal_Init_Call; -- A call to an operation of the type may occur in the initialization -- of a private component. In that case the prefix of the call is an -- entity name and the call is treated as internal even though it -- appears in code outside of the protected type. procedure Freeze_Called_Function; -- If it is a function call it can appear in elaboration code and -- the called entity must be frozen before the call. This must be -- done before the call is expanded, as the expansion may rewrite it -- to something other than a call (e.g. a temporary initialized in a -- transient block). ------------------------------- -- Expand_Internal_Init_Call -- ------------------------------- procedure Expand_Internal_Init_Call is begin -- If the context is a protected object (rather than a protected -- type) the call itself is bound to raise program_error because -- the protected body will not have been elaborated yet. This is -- diagnosed subsequently in Sem_Elab. Freeze_Called_Function; -- The target of the internal call is the first formal of the -- enclosing initialization procedure. Rec := New_Occurrence_Of (First_Formal (Current_Scope), Sloc (N)); Build_Protected_Subprogram_Call (N, Name => Name (N), Rec => Rec, External => False); Analyze (N); Resolve (N, Etype (Subp)); end Expand_Internal_Init_Call; ---------------------------- -- Freeze_Called_Function -- ---------------------------- procedure Freeze_Called_Function is begin if Ekind (Subp) = E_Function then Freeze_Expression (Name (N)); end if; end Freeze_Called_Function; -- Start of processing for Expand_Protected_Subprogram_Call begin -- If the protected object is not an enclosing scope, this is an inter- -- object function call. Inter-object procedure calls are expanded by -- Exp_Ch9.Build_Simple_Entry_Call. The call is intra-object only if the -- subprogram being called is in the protected body being compiled, and -- if the protected object in the call is statically the enclosing type. -- The object may be a component of some other data structure, in which -- case this must be handled as an inter-object call. if not In_Open_Scopes (Scop) or else Is_Entry_Wrapper (Current_Scope) or else not Is_Entity_Name (Name (N)) then if Nkind (Name (N)) = N_Selected_Component then Rec := Prefix (Name (N)); elsif Nkind (Name (N)) = N_Indexed_Component then Rec := Prefix (Prefix (Name (N))); -- If this is a call within an entry wrapper, it appears within a -- precondition that calls another primitive of the synchronized -- type. The target object of the call is the first actual on the -- wrapper. Note that this is an external call, because the wrapper -- is called outside of the synchronized object. This means that -- an entry call to an entry with preconditions involves two -- synchronized operations. elsif Ekind (Current_Scope) = E_Procedure and then Is_Entry_Wrapper (Current_Scope) then Rec := New_Occurrence_Of (First_Entity (Current_Scope), Sloc (N)); else -- If the context is the initialization procedure for a protected -- type, the call is legal because the called entity must be a -- function of that enclosing type, and this is treated as an -- internal call. pragma Assert (Is_Entity_Name (Name (N)) and then Inside_Init_Proc); Expand_Internal_Init_Call; return; end if; Freeze_Called_Function; Build_Protected_Subprogram_Call (N, Name => New_Occurrence_Of (Subp, Sloc (N)), Rec => Convert_Concurrent (Rec, Etype (Rec)), External => True); else Rec := Expand_Protected_Object_Reference (N, Scop); if No (Rec) then return; end if; Freeze_Called_Function; Build_Protected_Subprogram_Call (N, Name => Name (N), Rec => Rec, External => False); end if; -- Analyze and resolve the new call. The actuals have already been -- resolved, but expansion of a function call will add extra actuals -- if needed. Analysis of a procedure call already includes resolution. Analyze (N); if Ekind (Subp) = E_Function then Resolve (N, Etype (Subp)); end if; end Expand_Protected_Subprogram_Call; ----------------------------------- -- Expand_Simple_Function_Return -- ----------------------------------- -- The "simple" comes from the syntax rule simple_return_statement. The -- semantics are not at all simple. procedure Expand_Simple_Function_Return (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Scope_Id : constant Entity_Id := Return_Applies_To (Return_Statement_Entity (N)); -- The function we are returning from R_Type : constant Entity_Id := Etype (Scope_Id); -- The result type of the function Utyp : constant Entity_Id := Underlying_Type (R_Type); Exp : Node_Id := Expression (N); pragma Assert (Present (Exp)); Exptyp : constant Entity_Id := Etype (Exp); -- The type of the expression (not necessarily the same as R_Type) Subtype_Ind : Node_Id; -- If the result type of the function is class-wide and the expression -- has a specific type, then we use the expression's type as the type of -- the return object. In cases where the expression is an aggregate that -- is built in place, this avoids the need for an expensive conversion -- of the return object to the specific type on assignments to the -- individual components. begin if Is_Class_Wide_Type (R_Type) and then not Is_Class_Wide_Type (Exptyp) and then Nkind (Exp) /= N_Type_Conversion then Subtype_Ind := New_Occurrence_Of (Exptyp, Loc); else Subtype_Ind := New_Occurrence_Of (R_Type, Loc); -- If the result type is class-wide and the expression is a view -- conversion, the conversion plays no role in the expansion because -- it does not modify the tag of the object. Remove the conversion -- altogether to prevent tag overwriting. if Is_Class_Wide_Type (R_Type) and then not Is_Class_Wide_Type (Exptyp) and then Nkind (Exp) = N_Type_Conversion then Exp := Expression (Exp); end if; end if; -- For the case of a simple return that does not come from an extended -- return, in the case of Ada 2005 where we are returning a limited -- type, we rewrite "return <expression>;" to be: -- return _anon_ : <return_subtype> := <expression> -- The expansion produced by Expand_N_Extended_Return_Statement will -- contain simple return statements (for example, a block containing -- simple return of the return object), which brings us back here with -- Comes_From_Extended_Return_Statement set. The reason for the barrier -- checking for a simple return that does not come from an extended -- return is to avoid this infinite recursion. -- The reason for this design is that for Ada 2005 limited returns, we -- need to reify the return object, so we can build it "in place", and -- we need a block statement to hang finalization and tasking stuff. -- ??? In order to avoid disruption, we avoid translating to extended -- return except in the cases where we really need to (Ada 2005 for -- inherently limited). We might prefer to do this translation in all -- cases (except perhaps for the case of Ada 95 inherently limited), -- in order to fully exercise the Expand_N_Extended_Return_Statement -- code. This would also allow us to do the build-in-place optimization -- for efficiency even in cases where it is semantically not required. -- As before, we check the type of the return expression rather than the -- return type of the function, because the latter may be a limited -- class-wide interface type, which is not a limited type, even though -- the type of the expression may be. if not Comes_From_Extended_Return_Statement (N) and then Is_Limited_View (Etype (Expression (N))) and then Ada_Version >= Ada_2005 and then not Debug_Flag_Dot_L -- The functionality of interface thunks is simple and it is always -- handled by means of simple return statements. This leaves their -- expansion simple and clean. and then not Is_Thunk (Current_Scope) then declare Return_Object_Entity : constant Entity_Id := Make_Temporary (Loc, 'R', Exp); Obj_Decl : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Return_Object_Entity, Object_Definition => Subtype_Ind, Expression => Exp); Ext : constant Node_Id := Make_Extended_Return_Statement (Loc, Return_Object_Declarations => New_List (Obj_Decl)); -- Do not perform this high-level optimization if the result type -- is an interface because the "this" pointer must be displaced. begin Rewrite (N, Ext); Analyze (N); return; end; end if; -- Here we have a simple return statement that is part of the expansion -- of an extended return statement (either written by the user, or -- generated by the above code). -- Always normalize C/Fortran boolean result. This is not always needed, -- but it seems a good idea to minimize the passing around of non- -- normalized values, and in any case this handles the processing of -- barrier functions for protected types, which turn the condition into -- a return statement. if Is_Boolean_Type (Exptyp) and then Nonzero_Is_True (Exptyp) then Adjust_Condition (Exp); Adjust_Result_Type (Exp, Exptyp); end if; -- Do validity check if enabled for returns if Validity_Checks_On and then Validity_Check_Returns then Ensure_Valid (Exp); end if; -- Check the result expression of a scalar function against the subtype -- of the function by inserting a conversion. This conversion must -- eventually be performed for other classes of types, but for now it's -- only done for scalars. -- ??? if Is_Scalar_Type (Exptyp) then Rewrite (Exp, Convert_To (R_Type, Exp)); -- The expression is resolved to ensure that the conversion gets -- expanded to generate a possible constraint check. Analyze_And_Resolve (Exp, R_Type); end if; -- Deal with returning variable length objects and controlled types -- Nothing to do if we are returning by reference, or this is not a -- type that requires special processing (indicated by the fact that -- it requires a cleanup scope for the secondary stack case). if Is_Limited_View (Exptyp) or else Is_Limited_Interface (Exptyp) then null; -- No copy needed for thunks returning interface type objects since -- the object is returned by reference and the maximum functionality -- required is just to displace the pointer. elsif Is_Thunk (Current_Scope) and then Is_Interface (Exptyp) then null; -- If the call is within a thunk and the type is a limited view, the -- backend will eventually see the non-limited view of the type. elsif Is_Thunk (Current_Scope) and then Is_Incomplete_Type (Exptyp) then return; elsif not Requires_Transient_Scope (R_Type) then -- Mutable records with variable-length components are not returned -- on the sec-stack, so we need to make sure that the back end will -- only copy back the size of the actual value, and not the maximum -- size. We create an actual subtype for this purpose. However we -- need not do it if the expression is a function call since this -- will be done in the called function and doing it here too would -- cause a temporary with maximum size to be created. declare Ubt : constant Entity_Id := Underlying_Type (Base_Type (Exptyp)); Decl : Node_Id; Ent : Entity_Id; begin if Nkind (Exp) /= N_Function_Call and then Has_Discriminants (Ubt) and then not Is_Constrained (Ubt) and then not Has_Unchecked_Union (Ubt) then Decl := Build_Actual_Subtype (Ubt, Exp); Ent := Defining_Identifier (Decl); Insert_Action (Exp, Decl); Rewrite (Exp, Unchecked_Convert_To (Ent, Exp)); Analyze_And_Resolve (Exp); end if; end; -- Here if secondary stack is used else -- Prevent the reclamation of the secondary stack by all enclosing -- blocks and loops as well as the related function; otherwise the -- result would be reclaimed too early. Set_Enclosing_Sec_Stack_Return (N); -- Optimize the case where the result is a function call. In this -- case either the result is already on the secondary stack, or is -- already being returned with the stack pointer depressed and no -- further processing is required except to set the By_Ref flag -- to ensure that gigi does not attempt an extra unnecessary copy. -- (actually not just unnecessary but harmfully wrong in the case -- of a controlled type, where gigi does not know how to do a copy). -- To make up for a gcc 2.8.1 deficiency (???), we perform the copy -- for array types if the constrained status of the target type is -- different from that of the expression. if Requires_Transient_Scope (Exptyp) and then (not Is_Array_Type (Exptyp) or else Is_Constrained (Exptyp) = Is_Constrained (R_Type) or else CW_Or_Has_Controlled_Part (Utyp)) and then Nkind (Exp) = N_Function_Call then Set_By_Ref (N); -- Remove side effects from the expression now so that other parts -- of the expander do not have to reanalyze this node without this -- optimization Rewrite (Exp, Duplicate_Subexpr_No_Checks (Exp)); -- For controlled types, do the allocation on the secondary stack -- manually in order to call adjust at the right time: -- type Anon1 is access R_Type; -- for Anon1'Storage_pool use ss_pool; -- Anon2 : anon1 := new R_Type'(expr); -- return Anon2.all; -- We do the same for classwide types that are not potentially -- controlled (by the virtue of restriction No_Finalization) because -- gigi is not able to properly allocate class-wide types. elsif CW_Or_Has_Controlled_Part (Utyp) then declare Loc : constant Source_Ptr := Sloc (N); Acc_Typ : constant Entity_Id := Make_Temporary (Loc, 'A'); Alloc_Node : Node_Id; Temp : Entity_Id; begin Set_Ekind (Acc_Typ, E_Access_Type); Set_Associated_Storage_Pool (Acc_Typ, RTE (RE_SS_Pool)); -- This is an allocator for the secondary stack, and it's fine -- to have Comes_From_Source set False on it, as gigi knows not -- to flag it as a violation of No_Implicit_Heap_Allocations. Alloc_Node := Make_Allocator (Loc, Expression => Make_Qualified_Expression (Loc, Subtype_Mark => New_Occurrence_Of (Etype (Exp), Loc), Expression => Relocate_Node (Exp))); -- We do not want discriminant checks on the declaration, -- given that it gets its value from the allocator. Set_No_Initialization (Alloc_Node); Temp := Make_Temporary (Loc, 'R', Alloc_Node); Insert_List_Before_And_Analyze (N, New_List ( Make_Full_Type_Declaration (Loc, Defining_Identifier => Acc_Typ, Type_Definition => Make_Access_To_Object_Definition (Loc, Subtype_Indication => Subtype_Ind)), Make_Object_Declaration (Loc, Defining_Identifier => Temp, Object_Definition => New_Occurrence_Of (Acc_Typ, Loc), Expression => Alloc_Node))); Rewrite (Exp, Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Temp, Loc))); -- Ada 2005 (AI-251): If the type of the returned object is -- an interface then add an implicit type conversion to force -- displacement of the "this" pointer. if Is_Interface (R_Type) then Rewrite (Exp, Convert_To (R_Type, Relocate_Node (Exp))); end if; Analyze_And_Resolve (Exp, R_Type); end; -- Otherwise use the gigi mechanism to allocate result on the -- secondary stack. else Check_Restriction (No_Secondary_Stack, N); Set_Storage_Pool (N, RTE (RE_SS_Pool)); Set_Procedure_To_Call (N, RTE (RE_SS_Allocate)); end if; end if; -- Implement the rules of 6.5(8-10), which require a tag check in -- the case of a limited tagged return type, and tag reassignment for -- nonlimited tagged results. These actions are needed when the return -- type is a specific tagged type and the result expression is a -- conversion or a formal parameter, because in that case the tag of -- the expression might differ from the tag of the specific result type. if Is_Tagged_Type (Utyp) and then not Is_Class_Wide_Type (Utyp) and then (Nkind_In (Exp, N_Type_Conversion, N_Unchecked_Type_Conversion) or else (Is_Entity_Name (Exp) and then Ekind (Entity (Exp)) in Formal_Kind)) then -- When the return type is limited, perform a check that the tag of -- the result is the same as the tag of the return type. if Is_Limited_Type (R_Type) then Insert_Action (Exp, Make_Raise_Constraint_Error (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Exp), Selector_Name => Make_Identifier (Loc, Name_uTag)), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Base_Type (Utyp), Loc), Attribute_Name => Name_Tag)), Reason => CE_Tag_Check_Failed)); -- If the result type is a specific nonlimited tagged type, then we -- have to ensure that the tag of the result is that of the result -- type. This is handled by making a copy of the expression in -- the case where it might have a different tag, namely when the -- expression is a conversion or a formal parameter. We create a new -- object of the result type and initialize it from the expression, -- which will implicitly force the tag to be set appropriately. else declare ExpR : constant Node_Id := Relocate_Node (Exp); Result_Id : constant Entity_Id := Make_Temporary (Loc, 'R', ExpR); Result_Exp : constant Node_Id := New_Occurrence_Of (Result_Id, Loc); Result_Obj : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Result_Id, Object_Definition => New_Occurrence_Of (R_Type, Loc), Constant_Present => True, Expression => ExpR); begin Set_Assignment_OK (Result_Obj); Insert_Action (Exp, Result_Obj); Rewrite (Exp, Result_Exp); Analyze_And_Resolve (Exp, R_Type); end; end if; -- Ada 2005 (AI-344): If the result type is class-wide, then insert -- a check that the level of the return expression's underlying type -- is not deeper than the level of the master enclosing the function. -- Always generate the check when the type of the return expression -- is class-wide, when it's a type conversion, or when it's a formal -- parameter. Otherwise, suppress the check in the case where the -- return expression has a specific type whose level is known not to -- be statically deeper than the function's result type. -- No runtime check needed in interface thunks since it is performed -- by the target primitive associated with the thunk. -- Note: accessibility check is skipped in the VM case, since there -- does not seem to be any practical way to implement this check. elsif Ada_Version >= Ada_2005 and then Tagged_Type_Expansion and then Is_Class_Wide_Type (R_Type) and then not Is_Thunk (Current_Scope) and then not Scope_Suppress.Suppress (Accessibility_Check) and then (Is_Class_Wide_Type (Etype (Exp)) or else Nkind_In (Exp, N_Type_Conversion, N_Unchecked_Type_Conversion) or else (Is_Entity_Name (Exp) and then Ekind (Entity (Exp)) in Formal_Kind) or else Scope_Depth (Enclosing_Dynamic_Scope (Etype (Exp))) > Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id))) then declare Tag_Node : Node_Id; begin -- Ada 2005 (AI-251): In class-wide interface objects we displace -- "this" to reference the base of the object. This is required to -- get access to the TSD of the object. if Is_Class_Wide_Type (Etype (Exp)) and then Is_Interface (Etype (Exp)) then -- If the expression is an explicit dereference then we can -- directly displace the pointer to reference the base of -- the object. if Nkind (Exp) = N_Explicit_Dereference then Tag_Node := Make_Explicit_Dereference (Loc, Prefix => Unchecked_Convert_To (RTE (RE_Tag_Ptr), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Base_Address), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Address), Duplicate_Subexpr (Prefix (Exp))))))); -- Similar case to the previous one but the expression is a -- renaming of an explicit dereference. elsif Nkind (Exp) = N_Identifier and then Present (Renamed_Object (Entity (Exp))) and then Nkind (Renamed_Object (Entity (Exp))) = N_Explicit_Dereference then Tag_Node := Make_Explicit_Dereference (Loc, Prefix => Unchecked_Convert_To (RTE (RE_Tag_Ptr), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Base_Address), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Address), Duplicate_Subexpr (Prefix (Renamed_Object (Entity (Exp))))))))); -- Common case: obtain the address of the actual object and -- displace the pointer to reference the base of the object. else Tag_Node := Make_Explicit_Dereference (Loc, Prefix => Unchecked_Convert_To (RTE (RE_Tag_Ptr), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Base_Address), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (Exp), Attribute_Name => Name_Address))))); end if; else Tag_Node := Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr (Exp), Attribute_Name => Name_Tag); end if; Insert_Action (Exp, Make_Raise_Program_Error (Loc, Condition => Make_Op_Gt (Loc, Left_Opnd => Build_Get_Access_Level (Loc, Tag_Node), Right_Opnd => Make_Integer_Literal (Loc, Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))), Reason => PE_Accessibility_Check_Failed)); end; -- AI05-0073: If function has a controlling access result, check that -- the tag of the return value, if it is not null, matches designated -- type of return type. -- The return expression is referenced twice in the code below, so it -- must be made free of side effects. Given that different compilers -- may evaluate these parameters in different order, both occurrences -- perform a copy. elsif Ekind (R_Type) = E_Anonymous_Access_Type and then Has_Controlling_Result (Scope_Id) then Insert_Action (N, Make_Raise_Constraint_Error (Loc, Condition => Make_And_Then (Loc, Left_Opnd => Make_Op_Ne (Loc, Left_Opnd => Duplicate_Subexpr (Exp), Right_Opnd => Make_Null (Loc)), Right_Opnd => Make_Op_Ne (Loc, Left_Opnd => Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr (Exp), Selector_Name => Make_Identifier (Loc, Name_uTag)), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Designated_Type (R_Type), Loc), Attribute_Name => Name_Tag))), Reason => CE_Tag_Check_Failed), Suppress => All_Checks); end if; -- AI05-0234: RM 6.5(21/3). Check access discriminants to -- ensure that the function result does not outlive an -- object designated by one of it discriminants. if Present (Extra_Accessibility_Of_Result (Scope_Id)) and then Has_Unconstrained_Access_Discriminants (R_Type) then declare Discrim_Source : Node_Id; procedure Check_Against_Result_Level (Level : Node_Id); -- Check the given accessibility level against the level -- determined by the point of call. (AI05-0234). -------------------------------- -- Check_Against_Result_Level -- -------------------------------- procedure Check_Against_Result_Level (Level : Node_Id) is begin Insert_Action (N, Make_Raise_Program_Error (Loc, Condition => Make_Op_Gt (Loc, Left_Opnd => Level, Right_Opnd => New_Occurrence_Of (Extra_Accessibility_Of_Result (Scope_Id), Loc)), Reason => PE_Accessibility_Check_Failed)); end Check_Against_Result_Level; begin Discrim_Source := Exp; while Nkind (Discrim_Source) = N_Qualified_Expression loop Discrim_Source := Expression (Discrim_Source); end loop; if Nkind (Discrim_Source) = N_Identifier and then Is_Return_Object (Entity (Discrim_Source)) then Discrim_Source := Entity (Discrim_Source); if Is_Constrained (Etype (Discrim_Source)) then Discrim_Source := Etype (Discrim_Source); else Discrim_Source := Expression (Parent (Discrim_Source)); end if; elsif Nkind (Discrim_Source) = N_Identifier and then Nkind_In (Original_Node (Discrim_Source), N_Aggregate, N_Extension_Aggregate) then Discrim_Source := Original_Node (Discrim_Source); elsif Nkind (Discrim_Source) = N_Explicit_Dereference and then Nkind (Original_Node (Discrim_Source)) = N_Function_Call then Discrim_Source := Original_Node (Discrim_Source); end if; while Nkind_In (Discrim_Source, N_Qualified_Expression, N_Type_Conversion, N_Unchecked_Type_Conversion) loop Discrim_Source := Expression (Discrim_Source); end loop; case Nkind (Discrim_Source) is when N_Defining_Identifier => pragma Assert (Is_Composite_Type (Discrim_Source) and then Has_Discriminants (Discrim_Source) and then Is_Constrained (Discrim_Source)); declare Discrim : Entity_Id := First_Discriminant (Base_Type (R_Type)); Disc_Elmt : Elmt_Id := First_Elmt (Discriminant_Constraint (Discrim_Source)); begin loop if Ekind (Etype (Discrim)) = E_Anonymous_Access_Type then Check_Against_Result_Level (Dynamic_Accessibility_Level (Node (Disc_Elmt))); end if; Next_Elmt (Disc_Elmt); Next_Discriminant (Discrim); exit when not Present (Discrim); end loop; end; when N_Aggregate | N_Extension_Aggregate => -- Unimplemented: extension aggregate case where discrims -- come from ancestor part, not extension part. declare Discrim : Entity_Id := First_Discriminant (Base_Type (R_Type)); Disc_Exp : Node_Id := Empty; Positionals_Exhausted : Boolean := not Present (Expressions (Discrim_Source)); function Associated_Expr (Comp_Id : Entity_Id; Associations : List_Id) return Node_Id; -- Given a component and a component associations list, -- locate the expression for that component; returns -- Empty if no such expression is found. --------------------- -- Associated_Expr -- --------------------- function Associated_Expr (Comp_Id : Entity_Id; Associations : List_Id) return Node_Id is Assoc : Node_Id; Choice : Node_Id; begin -- Simple linear search seems ok here Assoc := First (Associations); while Present (Assoc) loop Choice := First (Choices (Assoc)); while Present (Choice) loop if (Nkind (Choice) = N_Identifier and then Chars (Choice) = Chars (Comp_Id)) or else (Nkind (Choice) = N_Others_Choice) then return Expression (Assoc); end if; Next (Choice); end loop; Next (Assoc); end loop; return Empty; end Associated_Expr; -- Start of processing for Expand_Simple_Function_Return begin if not Positionals_Exhausted then Disc_Exp := First (Expressions (Discrim_Source)); end if; loop if Positionals_Exhausted then Disc_Exp := Associated_Expr (Discrim, Component_Associations (Discrim_Source)); end if; if Ekind (Etype (Discrim)) = E_Anonymous_Access_Type then Check_Against_Result_Level (Dynamic_Accessibility_Level (Disc_Exp)); end if; Next_Discriminant (Discrim); exit when not Present (Discrim); if not Positionals_Exhausted then Next (Disc_Exp); Positionals_Exhausted := not Present (Disc_Exp); end if; end loop; end; when N_Function_Call => -- No check needed (check performed by callee) null; when others => declare Level : constant Node_Id := Make_Integer_Literal (Loc, Object_Access_Level (Discrim_Source)); begin -- Unimplemented: check for name prefix that includes -- a dereference of an access value with a dynamic -- accessibility level (e.g., an access param or a -- saooaaat) and use dynamic level in that case. For -- example: -- return Access_Param.all(Some_Index).Some_Component; -- ??? Set_Etype (Level, Standard_Natural); Check_Against_Result_Level (Level); end; end case; end; end if; -- If we are returning an object that may not be bit-aligned, then copy -- the value into a temporary first. This copy may need to expand to a -- loop of component operations. if Is_Possibly_Unaligned_Slice (Exp) or else Is_Possibly_Unaligned_Object (Exp) then declare ExpR : constant Node_Id := Relocate_Node (Exp); Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR); begin Insert_Action (Exp, Make_Object_Declaration (Loc, Defining_Identifier => Tnn, Constant_Present => True, Object_Definition => New_Occurrence_Of (R_Type, Loc), Expression => ExpR), Suppress => All_Checks); Rewrite (Exp, New_Occurrence_Of (Tnn, Loc)); end; end if; -- Call the _Postconditions procedure if the related function has -- contract assertions that need to be verified on exit. if Ekind (Scope_Id) = E_Function and then Present (Postconditions_Proc (Scope_Id)) then -- In the case of discriminated objects, we have created a -- constrained subtype above, and used the underlying type. This -- transformation is post-analysis and harmless, except that now the -- call to the post-condition will be analyzed and the type kinds -- have to match. if Nkind (Exp) = N_Unchecked_Type_Conversion and then Is_Private_Type (R_Type) /= Is_Private_Type (Etype (Exp)) then Rewrite (Exp, Expression (Relocate_Node (Exp))); end if; -- We are going to reference the returned value twice in this case, -- once in the call to _Postconditions, and once in the actual return -- statement, but we can't have side effects happening twice. Force_Evaluation (Exp, Mode => Strict); -- Generate call to _Postconditions Insert_Action (Exp, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Postconditions_Proc (Scope_Id), Loc), Parameter_Associations => New_List (New_Copy_Tree (Exp)))); end if; -- Ada 2005 (AI-251): If this return statement corresponds with an -- simple return statement associated with an extended return statement -- and the type of the returned object is an interface then generate an -- implicit conversion to force displacement of the "this" pointer. if Ada_Version >= Ada_2005 and then Comes_From_Extended_Return_Statement (N) and then Nkind (Expression (N)) = N_Identifier and then Is_Interface (Utyp) and then Utyp /= Underlying_Type (Exptyp) then Rewrite (Exp, Convert_To (Utyp, Relocate_Node (Exp))); Analyze_And_Resolve (Exp); end if; end Expand_Simple_Function_Return; -------------------------------------------- -- Has_Unconstrained_Access_Discriminants -- -------------------------------------------- function Has_Unconstrained_Access_Discriminants (Subtyp : Entity_Id) return Boolean is Discr : Entity_Id; begin if Has_Discriminants (Subtyp) and then not Is_Constrained (Subtyp) then Discr := First_Discriminant (Subtyp); while Present (Discr) loop if Ekind (Etype (Discr)) = E_Anonymous_Access_Type then return True; end if; Next_Discriminant (Discr); end loop; end if; return False; end Has_Unconstrained_Access_Discriminants; -------------------------------- -- Is_Build_In_Place_Function -- -------------------------------- function Is_Build_In_Place_Function (E : Entity_Id) return Boolean is begin -- This function is called from Expand_Subtype_From_Expr during -- semantic analysis, even when expansion is off. In those cases -- the build_in_place expansion will not take place. if not Expander_Active then return False; end if; -- For now we test whether E denotes a function or access-to-function -- type whose result subtype is inherently limited. Later this test -- may be revised to allow composite nonlimited types. Functions with -- a foreign convention or whose result type has a foreign convention -- never qualify. if Ekind_In (E, E_Function, E_Generic_Function) or else (Ekind (E) = E_Subprogram_Type and then Etype (E) /= Standard_Void_Type) then -- Note: If the function has a foreign convention, it cannot build -- its result in place, so you're on your own. On the other hand, -- if only the return type has a foreign convention, its layout is -- intended to be compatible with the other language, but the build- -- in place machinery can ensure that the object is not copied. if Has_Foreign_Convention (E) then return False; -- In Ada 2005 all functions with an inherently limited return type -- must be handled using a build-in-place profile, including the case -- of a function with a limited interface result, where the function -- may return objects of nonlimited descendants. else return Is_Limited_View (Etype (E)) and then Ada_Version >= Ada_2005 and then not Debug_Flag_Dot_L; end if; else return False; end if; end Is_Build_In_Place_Function; ------------------------------------- -- Is_Build_In_Place_Function_Call -- ------------------------------------- function Is_Build_In_Place_Function_Call (N : Node_Id) return Boolean is Exp_Node : Node_Id := N; Function_Id : Entity_Id; begin -- Return False if the expander is currently inactive, since awareness -- of build-in-place treatment is only relevant during expansion. Note -- that Is_Build_In_Place_Function, which is called as part of this -- function, is also conditioned this way, but we need to check here as -- well to avoid blowing up on processing protected calls when expansion -- is disabled (such as with -gnatc) since those would trip over the -- raise of Program_Error below. -- In SPARK mode, build-in-place calls are not expanded, so that we -- may end up with a call that is neither resolved to an entity, nor -- an indirect call. if not Expander_Active then return False; end if; -- Step past qualification, type conversion (which can occur in actual -- parameter contexts), and unchecked conversion (which can occur in -- cases of calls to 'Input). if Nkind_In (Exp_Node, N_Qualified_Expression, N_Type_Conversion, N_Unchecked_Type_Conversion) then Exp_Node := Expression (N); end if; if Nkind (Exp_Node) /= N_Function_Call then return False; else if Is_Entity_Name (Name (Exp_Node)) then Function_Id := Entity (Name (Exp_Node)); -- In the case of an explicitly dereferenced call, use the subprogram -- type generated for the dereference. elsif Nkind (Name (Exp_Node)) = N_Explicit_Dereference then Function_Id := Etype (Name (Exp_Node)); -- This may be a call to a protected function. elsif Nkind (Name (Exp_Node)) = N_Selected_Component then Function_Id := Etype (Entity (Selector_Name (Name (Exp_Node)))); else raise Program_Error; end if; return Is_Build_In_Place_Function (Function_Id); end if; end Is_Build_In_Place_Function_Call; ----------------------- -- Freeze_Subprogram -- ----------------------- procedure Freeze_Subprogram (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); procedure Register_Predefined_DT_Entry (Prim : Entity_Id); -- (Ada 2005): Register a predefined primitive in all the secondary -- dispatch tables of its primitive type. ---------------------------------- -- Register_Predefined_DT_Entry -- ---------------------------------- procedure Register_Predefined_DT_Entry (Prim : Entity_Id) is Iface_DT_Ptr : Elmt_Id; Tagged_Typ : Entity_Id; Thunk_Id : Entity_Id; Thunk_Code : Node_Id; begin Tagged_Typ := Find_Dispatching_Type (Prim); if No (Access_Disp_Table (Tagged_Typ)) or else not Has_Interfaces (Tagged_Typ) or else not RTE_Available (RE_Interface_Tag) or else Restriction_Active (No_Dispatching_Calls) then return; end if; -- Skip the first two access-to-dispatch-table pointers since they -- leads to the primary dispatch table (predefined DT and user -- defined DT). We are only concerned with the secondary dispatch -- table pointers. Note that the access-to- dispatch-table pointer -- corresponds to the first implemented interface retrieved below. Iface_DT_Ptr := Next_Elmt (Next_Elmt (First_Elmt (Access_Disp_Table (Tagged_Typ)))); while Present (Iface_DT_Ptr) and then Ekind (Node (Iface_DT_Ptr)) = E_Constant loop pragma Assert (Has_Thunks (Node (Iface_DT_Ptr))); Expand_Interface_Thunk (Prim, Thunk_Id, Thunk_Code); if Present (Thunk_Code) then Insert_Actions_After (N, New_List ( Thunk_Code, Build_Set_Predefined_Prim_Op_Address (Loc, Tag_Node => New_Occurrence_Of (Node (Next_Elmt (Iface_DT_Ptr)), Loc), Position => DT_Position (Prim), Address_Node => Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Thunk_Id, Loc), Attribute_Name => Name_Unrestricted_Access))), Build_Set_Predefined_Prim_Op_Address (Loc, Tag_Node => New_Occurrence_Of (Node (Next_Elmt (Next_Elmt (Next_Elmt (Iface_DT_Ptr)))), Loc), Position => DT_Position (Prim), Address_Node => Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Prim, Loc), Attribute_Name => Name_Unrestricted_Access))))); end if; -- Skip the tag of the predefined primitives dispatch table Next_Elmt (Iface_DT_Ptr); pragma Assert (Has_Thunks (Node (Iface_DT_Ptr))); -- Skip tag of the no-thunks dispatch table Next_Elmt (Iface_DT_Ptr); pragma Assert (not Has_Thunks (Node (Iface_DT_Ptr))); -- Skip tag of predefined primitives no-thunks dispatch table Next_Elmt (Iface_DT_Ptr); pragma Assert (not Has_Thunks (Node (Iface_DT_Ptr))); Next_Elmt (Iface_DT_Ptr); end loop; end Register_Predefined_DT_Entry; -- Local variables Subp : constant Entity_Id := Entity (N); -- Start of processing for Freeze_Subprogram begin -- We suppress the initialization of the dispatch table entry when -- not Tagged_Type_Expansion because the dispatching mechanism is -- handled internally by the target. if Is_Dispatching_Operation (Subp) and then not Is_Abstract_Subprogram (Subp) and then Present (DTC_Entity (Subp)) and then Present (Scope (DTC_Entity (Subp))) and then Tagged_Type_Expansion and then not Restriction_Active (No_Dispatching_Calls) and then RTE_Available (RE_Tag) then declare Typ : constant Entity_Id := Scope (DTC_Entity (Subp)); begin -- Handle private overridden primitives if not Is_CPP_Class (Typ) then Check_Overriding_Operation (Subp); end if; -- We assume that imported CPP primitives correspond with objects -- whose constructor is in the CPP side; therefore we don't need -- to generate code to register them in the dispatch table. if Is_CPP_Class (Typ) then null; -- Handle CPP primitives found in derivations of CPP_Class types. -- These primitives must have been inherited from some parent, and -- there is no need to register them in the dispatch table because -- Build_Inherit_Prims takes care of initializing these slots. elsif Is_Imported (Subp) and then (Convention (Subp) = Convention_CPP or else Convention (Subp) = Convention_C) then null; -- Generate code to register the primitive in non statically -- allocated dispatch tables elsif not Building_Static_DT (Scope (DTC_Entity (Subp))) then -- When a primitive is frozen, enter its name in its dispatch -- table slot. if not Is_Interface (Typ) or else Present (Interface_Alias (Subp)) then if Is_Predefined_Dispatching_Operation (Subp) then Register_Predefined_DT_Entry (Subp); end if; Insert_Actions_After (N, Register_Primitive (Loc, Prim => Subp)); end if; end if; end; end if; -- Mark functions that return by reference. Note that it cannot be part -- of the normal semantic analysis of the spec since the underlying -- returned type may not be known yet (for private types). declare Typ : constant Entity_Id := Etype (Subp); Utyp : constant Entity_Id := Underlying_Type (Typ); begin if Is_Limited_View (Typ) then Set_Returns_By_Ref (Subp); elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then Set_Returns_By_Ref (Subp); end if; end; -- Wnen freezing a null procedure, analyze its delayed aspects now -- because we may not have reached the end of the declarative list when -- delayed aspects are normally analyzed. This ensures that dispatching -- calls are properly rewritten when the generated _Postcondition -- procedure is analyzed in the null procedure body. if Nkind (Parent (Subp)) = N_Procedure_Specification and then Null_Present (Parent (Subp)) then Analyze_Entry_Or_Subprogram_Contract (Subp); end if; end Freeze_Subprogram; ----------------------- -- Is_Null_Procedure -- ----------------------- function Is_Null_Procedure (Subp : Entity_Id) return Boolean is Decl : constant Node_Id := Unit_Declaration_Node (Subp); begin if Ekind (Subp) /= E_Procedure then return False; -- Check if this is a declared null procedure elsif Nkind (Decl) = N_Subprogram_Declaration then if not Null_Present (Specification (Decl)) then return False; elsif No (Body_To_Inline (Decl)) then return False; -- Check if the body contains only a null statement, followed by -- the return statement added during expansion. else declare Orig_Bod : constant Node_Id := Body_To_Inline (Decl); Stat : Node_Id; Stat2 : Node_Id; begin if Nkind (Orig_Bod) /= N_Subprogram_Body then return False; else -- We must skip SCIL nodes because they are currently -- implemented as special N_Null_Statement nodes. Stat := First_Non_SCIL_Node (Statements (Handled_Statement_Sequence (Orig_Bod))); Stat2 := Next_Non_SCIL_Node (Stat); return Is_Empty_List (Declarations (Orig_Bod)) and then Nkind (Stat) = N_Null_Statement and then (No (Stat2) or else (Nkind (Stat2) = N_Simple_Return_Statement and then No (Next (Stat2)))); end if; end; end if; else return False; end if; end Is_Null_Procedure; ------------------------------------------- -- Make_Build_In_Place_Call_In_Allocator -- ------------------------------------------- procedure Make_Build_In_Place_Call_In_Allocator (Allocator : Node_Id; Function_Call : Node_Id) is Acc_Type : constant Entity_Id := Etype (Allocator); Loc : Source_Ptr; Func_Call : Node_Id := Function_Call; Ref_Func_Call : Node_Id; Function_Id : Entity_Id; Result_Subt : Entity_Id; New_Allocator : Node_Id; Return_Obj_Access : Entity_Id; -- temp for function result Temp_Init : Node_Id; -- initial value of Return_Obj_Access Alloc_Form : BIP_Allocation_Form; Pool : Node_Id; -- nonnull if Alloc_Form = User_Storage_Pool Return_Obj_Actual : Node_Id; -- the temp.all, in caller-allocates case Chain : Entity_Id; -- activation chain, in case of tasks begin -- Step past qualification or unchecked conversion (the latter can occur -- in cases of calls to 'Input). if Nkind_In (Func_Call, N_Qualified_Expression, N_Type_Conversion, N_Unchecked_Type_Conversion) then Func_Call := Expression (Func_Call); end if; -- If the call has already been processed to add build-in-place actuals -- then return. This should not normally occur in an allocator context, -- but we add the protection as a defensive measure. if Is_Expanded_Build_In_Place_Call (Func_Call) then return; end if; -- Mark the call as processed as a build-in-place call Set_Is_Expanded_Build_In_Place_Call (Func_Call); Loc := Sloc (Function_Call); if Is_Entity_Name (Name (Func_Call)) then Function_Id := Entity (Name (Func_Call)); elsif Nkind (Name (Func_Call)) = N_Explicit_Dereference then Function_Id := Etype (Name (Func_Call)); else raise Program_Error; end if; Result_Subt := Available_View (Etype (Function_Id)); -- Create a temp for the function result. In the caller-allocates case, -- this will be initialized to the result of a new uninitialized -- allocator. Note: we do not use Allocator as the Related_Node of -- Return_Obj_Access in call to Make_Temporary below as this would -- create a sort of infinite "recursion". Return_Obj_Access := Make_Temporary (Loc, 'R'); Set_Etype (Return_Obj_Access, Acc_Type); -- When the result subtype is constrained, the return object is -- allocated on the caller side, and access to it is passed to the -- function. -- Here and in related routines, we must examine the full view of the -- type, because the view at the point of call may differ from that -- that in the function body, and the expansion mechanism depends on -- the characteristics of the full view. if Is_Constrained (Underlying_Type (Result_Subt)) then -- Replace the initialized allocator of form "new T'(Func (...))" -- with an uninitialized allocator of form "new T", where T is the -- result subtype of the called function. The call to the function -- is handled separately further below. New_Allocator := Make_Allocator (Loc, Expression => New_Occurrence_Of (Result_Subt, Loc)); Set_No_Initialization (New_Allocator); -- Copy attributes to new allocator. Note that the new allocator -- logically comes from source if the original one did, so copy the -- relevant flag. This ensures proper treatment of the restriction -- No_Implicit_Heap_Allocations in this case. Set_Storage_Pool (New_Allocator, Storage_Pool (Allocator)); Set_Procedure_To_Call (New_Allocator, Procedure_To_Call (Allocator)); Set_Comes_From_Source (New_Allocator, Comes_From_Source (Allocator)); Rewrite (Allocator, New_Allocator); -- Initial value of the temp is the result of the uninitialized -- allocator Temp_Init := Relocate_Node (Allocator); -- Indicate that caller allocates, and pass in the return object Alloc_Form := Caller_Allocation; Pool := Make_Null (No_Location); Return_Obj_Actual := Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc), Expression => Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Return_Obj_Access, Loc))); -- When the result subtype is unconstrained, the function itself must -- perform the allocation of the return object, so we pass parameters -- indicating that. else Temp_Init := Empty; -- Case of a user-defined storage pool. Pass an allocation parameter -- indicating that the function should allocate its result in the -- pool, and pass the pool. Use 'Unrestricted_Access because the -- pool may not be aliased. if Present (Associated_Storage_Pool (Acc_Type)) then Alloc_Form := User_Storage_Pool; Pool := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Associated_Storage_Pool (Acc_Type), Loc), Attribute_Name => Name_Unrestricted_Access); -- No user-defined pool; pass an allocation parameter indicating that -- the function should allocate its result on the heap. else Alloc_Form := Global_Heap; Pool := Make_Null (No_Location); end if; -- The caller does not provide the return object in this case, so we -- have to pass null for the object access actual. Return_Obj_Actual := Empty; end if; -- Declare the temp object Insert_Action (Allocator, Make_Object_Declaration (Loc, Defining_Identifier => Return_Obj_Access, Object_Definition => New_Occurrence_Of (Acc_Type, Loc), Expression => Temp_Init)); Ref_Func_Call := Make_Reference (Loc, Func_Call); -- Ada 2005 (AI-251): If the type of the allocator is an interface -- then generate an implicit conversion to force displacement of the -- "this" pointer. if Is_Interface (Designated_Type (Acc_Type)) then Rewrite (Ref_Func_Call, OK_Convert_To (Acc_Type, Ref_Func_Call)); end if; declare Assign : constant Node_Id := Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Return_Obj_Access, Loc), Expression => Ref_Func_Call); -- Assign the result of the function call into the temp. In the -- caller-allocates case, this is overwriting the temp with its -- initial value, which has no effect. In the callee-allocates case, -- this is setting the temp to point to the object allocated by the -- callee. Actions : List_Id; -- Actions to be inserted. If there are no tasks, this is just the -- assignment statement. If the allocated object has tasks, we need -- to wrap the assignment in a block that activates them. The -- activation chain of that block must be passed to the function, -- rather than some outer chain. begin if Has_Task (Result_Subt) then Actions := New_List; Build_Task_Allocate_Block_With_Init_Stmts (Actions, Allocator, Init_Stmts => New_List (Assign)); Chain := Activation_Chain_Entity (Last (Actions)); else Actions := New_List (Assign); Chain := Empty; end if; Insert_Actions (Allocator, Actions); end; -- When the function has a controlling result, an allocation-form -- parameter must be passed indicating that the caller is allocating -- the result object. This is needed because such a function can be -- called as a dispatching operation and must be treated similarly -- to functions with unconstrained result subtypes. Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form, Pool_Actual => Pool); Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Acc_Type); Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Master_Actual => Master_Id (Acc_Type), Chain => Chain); -- Add an implicit actual to the function call that provides access -- to the allocated object. An unchecked conversion to the (specific) -- result subtype of the function is inserted to handle cases where -- the access type of the allocator has a class-wide designated type. Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Return_Obj_Actual); -- Finally, replace the allocator node with a reference to the temp Rewrite (Allocator, New_Occurrence_Of (Return_Obj_Access, Loc)); Analyze_And_Resolve (Allocator, Acc_Type); end Make_Build_In_Place_Call_In_Allocator; --------------------------------------------------- -- Make_Build_In_Place_Call_In_Anonymous_Context -- --------------------------------------------------- procedure Make_Build_In_Place_Call_In_Anonymous_Context (Function_Call : Node_Id) is Loc : Source_Ptr; Func_Call : Node_Id := Function_Call; Function_Id : Entity_Id; Result_Subt : Entity_Id; Return_Obj_Id : Entity_Id; Return_Obj_Decl : Entity_Id; Definite : Boolean; -- True if result subtype is definite, or has a size that does not -- require secondary stack usage (i.e. no variant part or components -- whose type depends on discriminants). In particular, untagged types -- with only access discriminants do not require secondary stack use. -- Note that if the return type is tagged we must always use the sec. -- stack because the call may dispatch on result. begin -- Step past qualification, type conversion (which can occur in actual -- parameter contexts), and unchecked conversion (which can occur in -- cases of calls to 'Input). if Nkind_In (Func_Call, N_Qualified_Expression, N_Type_Conversion, N_Unchecked_Type_Conversion) then Func_Call := Expression (Func_Call); end if; -- If the call has already been processed to add build-in-place actuals -- then return. One place this can occur is for calls to build-in-place -- functions that occur within a call to a protected operation, where -- due to rewriting and expansion of the protected call there can be -- more than one call to Expand_Actuals for the same set of actuals. if Is_Expanded_Build_In_Place_Call (Func_Call) then return; end if; -- Mark the call as processed as a build-in-place call Set_Is_Expanded_Build_In_Place_Call (Func_Call); Loc := Sloc (Function_Call); if Is_Entity_Name (Name (Func_Call)) then Function_Id := Entity (Name (Func_Call)); elsif Nkind (Name (Func_Call)) = N_Explicit_Dereference then Function_Id := Etype (Name (Func_Call)); else raise Program_Error; end if; Result_Subt := Etype (Function_Id); Definite := (Is_Definite_Subtype (Underlying_Type (Result_Subt)) and then not Is_Tagged_Type (Result_Subt)) or else not Requires_Transient_Scope (Underlying_Type (Result_Subt)); -- If the build-in-place function returns a controlled object, then the -- object needs to be finalized immediately after the context. Since -- this case produces a transient scope, the servicing finalizer needs -- to name the returned object. Create a temporary which is initialized -- with the function call: -- -- Temp_Id : Func_Type := BIP_Func_Call; -- -- The initialization expression of the temporary will be rewritten by -- the expander using the appropriate mechanism in Make_Build_In_Place_ -- Call_In_Object_Declaration. if Needs_Finalization (Result_Subt) then declare Temp_Id : constant Entity_Id := Make_Temporary (Loc, 'R'); Temp_Decl : Node_Id; begin -- Reset the guard on the function call since the following does -- not perform actual call expansion. Set_Is_Expanded_Build_In_Place_Call (Func_Call, False); Temp_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp_Id, Object_Definition => New_Occurrence_Of (Result_Subt, Loc), Expression => New_Copy_Tree (Function_Call)); Insert_Action (Function_Call, Temp_Decl); Rewrite (Function_Call, New_Occurrence_Of (Temp_Id, Loc)); Analyze (Function_Call); end; -- When the result subtype is definite, an object of the subtype is -- declared and an access value designating it is passed as an actual. elsif Definite then -- Create a temporary object to hold the function result Return_Obj_Id := Make_Temporary (Loc, 'R'); Set_Etype (Return_Obj_Id, Result_Subt); Return_Obj_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Return_Obj_Id, Aliased_Present => True, Object_Definition => New_Occurrence_Of (Result_Subt, Loc)); Set_No_Initialization (Return_Obj_Decl); Insert_Action (Func_Call, Return_Obj_Decl); -- When the function has a controlling result, an allocation-form -- parameter must be passed indicating that the caller is allocating -- the result object. This is needed because such a function can be -- called as a dispatching operation and must be treated similarly -- to functions with unconstrained result subtypes. Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Caller_Allocation); Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call, Function_Id); Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Make_Identifier (Loc, Name_uMaster)); -- Add an implicit actual to the function call that provides access -- to the caller's return object. Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, New_Occurrence_Of (Return_Obj_Id, Loc)); -- When the result subtype is unconstrained, the function must allocate -- the return object in the secondary stack, so appropriate implicit -- parameters are added to the call to indicate that. A transient -- scope is established to ensure eventual cleanup of the result. else -- Pass an allocation parameter indicating that the function should -- allocate its result on the secondary stack. Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Secondary_Stack); Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call, Function_Id); Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Make_Identifier (Loc, Name_uMaster)); -- Pass a null value to the function since no return object is -- available on the caller side. Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Empty); end if; end Make_Build_In_Place_Call_In_Anonymous_Context; -------------------------------------------- -- Make_Build_In_Place_Call_In_Assignment -- -------------------------------------------- procedure Make_Build_In_Place_Call_In_Assignment (Assign : Node_Id; Function_Call : Node_Id) is Lhs : constant Node_Id := Name (Assign); Func_Call : Node_Id := Function_Call; Func_Id : Entity_Id; Loc : Source_Ptr; Obj_Decl : Node_Id; Obj_Id : Entity_Id; Ptr_Typ : Entity_Id; Ptr_Typ_Decl : Node_Id; New_Expr : Node_Id; Result_Subt : Entity_Id; Target : Node_Id; begin -- Step past qualification or unchecked conversion (the latter can occur -- in cases of calls to 'Input). if Nkind_In (Func_Call, N_Qualified_Expression, N_Unchecked_Type_Conversion) then Func_Call := Expression (Func_Call); end if; -- If the call has already been processed to add build-in-place actuals -- then return. This should not normally occur in an assignment context, -- but we add the protection as a defensive measure. if Is_Expanded_Build_In_Place_Call (Func_Call) then return; end if; -- Mark the call as processed as a build-in-place call Set_Is_Expanded_Build_In_Place_Call (Func_Call); Loc := Sloc (Function_Call); if Is_Entity_Name (Name (Func_Call)) then Func_Id := Entity (Name (Func_Call)); elsif Nkind (Name (Func_Call)) = N_Explicit_Dereference then Func_Id := Etype (Name (Func_Call)); else raise Program_Error; end if; Result_Subt := Etype (Func_Id); -- When the result subtype is unconstrained, an additional actual must -- be passed to indicate that the caller is providing the return object. -- This parameter must also be passed when the called function has a -- controlling result, because dispatching calls to the function needs -- to be treated effectively the same as calls to class-wide functions. Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Func_Id, Alloc_Form => Caller_Allocation); Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call, Func_Id); Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Func_Id, Make_Identifier (Loc, Name_uMaster)); -- Add an implicit actual to the function call that provides access to -- the caller's return object. Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Func_Id, Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc), Expression => Relocate_Node (Lhs))); -- Create an access type designating the function's result subtype Ptr_Typ := Make_Temporary (Loc, 'A'); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Ptr_Typ, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => New_Occurrence_Of (Result_Subt, Loc))); Insert_After_And_Analyze (Assign, Ptr_Typ_Decl); -- Finally, create an access object initialized to a reference to the -- function call. We know this access value is non-null, so mark the -- entity accordingly to suppress junk access checks. New_Expr := Make_Reference (Loc, Relocate_Node (Func_Call)); Obj_Id := Make_Temporary (Loc, 'R', New_Expr); Set_Etype (Obj_Id, Ptr_Typ); Set_Is_Known_Non_Null (Obj_Id); Obj_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Obj_Id, Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc), Expression => New_Expr); Insert_After_And_Analyze (Ptr_Typ_Decl, Obj_Decl); Rewrite (Assign, Make_Null_Statement (Loc)); -- Retrieve the target of the assignment if Nkind (Lhs) = N_Selected_Component then Target := Selector_Name (Lhs); elsif Nkind (Lhs) = N_Type_Conversion then Target := Expression (Lhs); else Target := Lhs; end if; -- If we are assigning to a return object or this is an expression of -- an extension aggregate, the target should either be an identifier -- or a simple expression. All other cases imply a different scenario. if Nkind (Target) in N_Has_Entity then Target := Entity (Target); else return; end if; end Make_Build_In_Place_Call_In_Assignment; ---------------------------------------------------- -- Make_Build_In_Place_Call_In_Object_Declaration -- ---------------------------------------------------- procedure Make_Build_In_Place_Call_In_Object_Declaration (Obj_Decl : Node_Id; Function_Call : Node_Id) is Obj_Def_Id : constant Entity_Id := Defining_Identifier (Obj_Decl); Encl_Func : constant Entity_Id := Enclosing_Subprogram (Obj_Def_Id); Loc : constant Source_Ptr := Sloc (Function_Call); Obj_Loc : constant Source_Ptr := Sloc (Obj_Decl); Call_Deref : Node_Id; Caller_Object : Node_Id; Def_Id : Entity_Id; Fmaster_Actual : Node_Id := Empty; Func_Call : Node_Id := Function_Call; Function_Id : Entity_Id; Pool_Actual : Node_Id; Ptr_Typ : Entity_Id; Ptr_Typ_Decl : Node_Id; Pass_Caller_Acc : Boolean := False; Res_Decl : Node_Id; Result_Subt : Entity_Id; Definite : Boolean; -- True if result subtype is definite, or has a size that does not -- require secondary stack usage (i.e. no variant part or components -- whose type depends on discriminants). In particular, untagged types -- with only access discriminants do not require secondary stack use. -- Note that if the return type is tagged we must always use the sec. -- stack because the call may dispatch on result. begin -- Step past qualification or unchecked conversion (the latter can occur -- in cases of calls to 'Input). if Nkind_In (Func_Call, N_Qualified_Expression, N_Unchecked_Type_Conversion) then Func_Call := Expression (Func_Call); end if; -- If the call has already been processed to add build-in-place actuals -- then return. This should not normally occur in an object declaration, -- but we add the protection as a defensive measure. if Is_Expanded_Build_In_Place_Call (Func_Call) then return; end if; -- Mark the call as processed as a build-in-place call Set_Is_Expanded_Build_In_Place_Call (Func_Call); if Is_Entity_Name (Name (Func_Call)) then Function_Id := Entity (Name (Func_Call)); elsif Nkind (Name (Func_Call)) = N_Explicit_Dereference then Function_Id := Etype (Name (Func_Call)); else raise Program_Error; end if; Result_Subt := Etype (Function_Id); Definite := (Is_Definite_Subtype (Underlying_Type (Result_Subt)) and then not Is_Tagged_Type (Result_Subt)) or else not Requires_Transient_Scope (Underlying_Type (Result_Subt)); -- Create an access type designating the function's result subtype. We -- use the type of the original call because it may be a call to an -- inherited operation, which the expansion has replaced with the parent -- operation that yields the parent type. Note that this access type -- must be declared before we establish a transient scope, so that it -- receives the proper accessibility level. Ptr_Typ := Make_Temporary (Loc, 'A'); Ptr_Typ_Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Ptr_Typ, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => New_Occurrence_Of (Etype (Function_Call), Loc))); -- The access type and its accompanying object must be inserted after -- the object declaration in the constrained case, so that the function -- call can be passed access to the object. In the indefinite case, -- or if the object declaration is for a return object, the access type -- and object must be inserted before the object, since the object -- declaration is rewritten to be a renaming of a dereference of the -- access object. Note: we need to freeze Ptr_Typ explicitly, because -- the result object is in a different (transient) scope, so won't -- cause freezing. if Definite and then not Is_Return_Object (Defining_Identifier (Obj_Decl)) then Insert_After_And_Analyze (Obj_Decl, Ptr_Typ_Decl); else Insert_Action (Obj_Decl, Ptr_Typ_Decl); end if; -- Force immediate freezing of Ptr_Typ because Res_Decl will be -- elaborated in an inner (transient) scope and thus won't cause -- freezing by itself. declare Ptr_Typ_Freeze_Ref : constant Node_Id := New_Occurrence_Of (Ptr_Typ, Loc); begin Set_Parent (Ptr_Typ_Freeze_Ref, Ptr_Typ_Decl); Freeze_Expression (Ptr_Typ_Freeze_Ref); end; -- If the object is a return object of an enclosing build-in-place -- function, then the implicit build-in-place parameters of the -- enclosing function are simply passed along to the called function. -- (Unfortunately, this won't cover the case of extension aggregates -- where the ancestor part is a build-in-place indefinite function -- call that should be passed along the caller's parameters. Currently -- those get mishandled by reassigning the result of the call to the -- aggregate return object, when the call result should really be -- directly built in place in the aggregate and not in a temporary. ???) if Is_Return_Object (Defining_Identifier (Obj_Decl)) then Pass_Caller_Acc := True; -- When the enclosing function has a BIP_Alloc_Form formal then we -- pass it along to the callee (such as when the enclosing function -- has an unconstrained or tagged result type). if Needs_BIP_Alloc_Form (Encl_Func) then if RTE_Available (RE_Root_Storage_Pool_Ptr) then Pool_Actual := New_Occurrence_Of (Build_In_Place_Formal (Encl_Func, BIP_Storage_Pool), Loc); -- The build-in-place pool formal is not built on e.g. ZFP else Pool_Actual := Empty; end if; Add_Unconstrained_Actuals_To_Build_In_Place_Call (Function_Call => Func_Call, Function_Id => Function_Id, Alloc_Form_Exp => New_Occurrence_Of (Build_In_Place_Formal (Encl_Func, BIP_Alloc_Form), Loc), Pool_Actual => Pool_Actual); -- Otherwise, if enclosing function has a definite result subtype, -- then caller allocation will be used. else Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Caller_Allocation); end if; if Needs_BIP_Finalization_Master (Encl_Func) then Fmaster_Actual := New_Occurrence_Of (Build_In_Place_Formal (Encl_Func, BIP_Finalization_Master), Loc); end if; -- Retrieve the BIPacc formal from the enclosing function and convert -- it to the access type of the callee's BIP_Object_Access formal. Caller_Object := Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Etype (Build_In_Place_Formal (Function_Id, BIP_Object_Access)), Loc), Expression => New_Occurrence_Of (Build_In_Place_Formal (Encl_Func, BIP_Object_Access), Loc)); -- In the definite case, add an implicit actual to the function call -- that provides access to the declared object. An unchecked conversion -- to the (specific) result type of the function is inserted to handle -- the case where the object is declared with a class-wide type. elsif Definite then Caller_Object := Make_Unchecked_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (Result_Subt, Loc), Expression => New_Occurrence_Of (Obj_Def_Id, Loc)); -- When the function has a controlling result, an allocation-form -- parameter must be passed indicating that the caller is allocating -- the result object. This is needed because such a function can be -- called as a dispatching operation and must be treated similarly -- to functions with indefinite result subtypes. Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Caller_Allocation); -- The allocation for indefinite library-level objects occurs on the -- heap as opposed to the secondary stack. This accommodates DLLs where -- the secondary stack is destroyed after each library unload. This is -- a hybrid mechanism where a stack-allocated object lives on the heap. elsif Is_Library_Level_Entity (Defining_Identifier (Obj_Decl)) and then not Restriction_Active (No_Implicit_Heap_Allocations) then Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Global_Heap); Caller_Object := Empty; -- Create a finalization master for the access result type to ensure -- that the heap allocation can properly chain the object and later -- finalize it when the library unit goes out of scope. if Needs_Finalization (Etype (Func_Call)) then Build_Finalization_Master (Typ => Ptr_Typ, For_Lib_Level => True, Insertion_Node => Ptr_Typ_Decl); Fmaster_Actual := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Finalization_Master (Ptr_Typ), Loc), Attribute_Name => Name_Unrestricted_Access); end if; -- In other indefinite cases, pass an indication to do the allocation -- on the secondary stack and set Caller_Object to Empty so that a null -- value will be passed for the caller's object address. A transient -- scope is established to ensure eventual cleanup of the result. else Add_Unconstrained_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Alloc_Form => Secondary_Stack); Caller_Object := Empty; Establish_Transient_Scope (Obj_Decl, Sec_Stack => True); end if; -- Pass along any finalization master actual, which is needed in the -- case where the called function initializes a return object of an -- enclosing build-in-place function. Add_Finalization_Master_Actual_To_Build_In_Place_Call (Func_Call => Func_Call, Func_Id => Function_Id, Master_Exp => Fmaster_Actual); if Nkind (Parent (Obj_Decl)) = N_Extended_Return_Statement and then Has_Task (Result_Subt) then -- Here we're passing along the master that was passed in to this -- function. Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Master_Actual => New_Occurrence_Of (Build_In_Place_Formal (Encl_Func, BIP_Task_Master), Loc)); else Add_Task_Actuals_To_Build_In_Place_Call (Func_Call, Function_Id, Make_Identifier (Loc, Name_uMaster)); end if; Add_Access_Actual_To_Build_In_Place_Call (Func_Call, Function_Id, Caller_Object, Is_Access => Pass_Caller_Acc); -- Finally, create an access object initialized to a reference to the -- function call. We know this access value cannot be null, so mark the -- entity accordingly to suppress the access check. Def_Id := Make_Temporary (Loc, 'R', Func_Call); Set_Etype (Def_Id, Ptr_Typ); Set_Is_Known_Non_Null (Def_Id); Res_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Def_Id, Constant_Present => True, Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc), Expression => Make_Reference (Loc, Relocate_Node (Func_Call))); Insert_After_And_Analyze (Ptr_Typ_Decl, Res_Decl); -- If the result subtype of the called function is definite and is not -- itself the return expression of an enclosing BIP function, then mark -- the object as having no initialization. if Definite and then not Is_Return_Object (Defining_Identifier (Obj_Decl)) then -- The related object declaration is encased in a transient block -- because the build-in-place function call contains at least one -- nested function call that produces a controlled transient -- temporary: -- Obj : ... := BIP_Func_Call (Ctrl_Func_Call); -- Since the build-in-place expansion decouples the call from the -- object declaration, the finalization machinery lacks the context -- which prompted the generation of the transient block. To resolve -- this scenario, store the build-in-place call. if Scope_Is_Transient and then Node_To_Be_Wrapped = Obj_Decl then Set_BIP_Initialization_Call (Obj_Def_Id, Res_Decl); end if; Set_Expression (Obj_Decl, Empty); Set_No_Initialization (Obj_Decl); -- In case of an indefinite result subtype, or if the call is the -- return expression of an enclosing BIP function, rewrite the object -- declaration as an object renaming where the renamed object is a -- dereference of <function_Call>'reference: -- -- Obj : Subt renames <function_call>'Ref.all; else Call_Deref := Make_Explicit_Dereference (Obj_Loc, Prefix => New_Occurrence_Of (Def_Id, Obj_Loc)); Rewrite (Obj_Decl, Make_Object_Renaming_Declaration (Obj_Loc, Defining_Identifier => Make_Temporary (Obj_Loc, 'D'), Subtype_Mark => New_Occurrence_Of (Result_Subt, Obj_Loc), Name => Call_Deref)); Set_Renamed_Object (Defining_Identifier (Obj_Decl), Call_Deref); -- If the original entity comes from source, then mark the new -- entity as needing debug information, even though it's defined -- by a generated renaming that does not come from source, so that -- the Materialize_Entity flag will be set on the entity when -- Debug_Renaming_Declaration is called during analysis. if Comes_From_Source (Obj_Def_Id) then Set_Debug_Info_Needed (Defining_Identifier (Obj_Decl)); end if; Analyze (Obj_Decl); -- Replace the internal identifier of the renaming declaration's -- entity with identifier of the original object entity. We also have -- to exchange the entities containing their defining identifiers to -- ensure the correct replacement of the object declaration by the -- object renaming declaration to avoid homograph conflicts (since -- the object declaration's defining identifier was already entered -- in current scope). The Next_Entity links of the two entities also -- have to be swapped since the entities are part of the return -- scope's entity list and the list structure would otherwise be -- corrupted. Finally, the homonym chain must be preserved as well. declare Ren_Id : constant Entity_Id := Defining_Entity (Obj_Decl); Next_Id : constant Entity_Id := Next_Entity (Ren_Id); begin Set_Chars (Ren_Id, Chars (Obj_Def_Id)); -- Swap next entity links in preparation for exchanging entities Set_Next_Entity (Ren_Id, Next_Entity (Obj_Def_Id)); Set_Next_Entity (Obj_Def_Id, Next_Id); Set_Homonym (Ren_Id, Homonym (Obj_Def_Id)); Exchange_Entities (Ren_Id, Obj_Def_Id); -- Preserve source indication of original declaration, so that -- xref information is properly generated for the right entity. Preserve_Comes_From_Source (Obj_Decl, Original_Node (Obj_Decl)); Preserve_Comes_From_Source (Obj_Def_Id, Original_Node (Obj_Decl)); Set_Comes_From_Source (Ren_Id, False); end; end if; -- If the object entity has a class-wide Etype, then we need to change -- it to the result subtype of the function call, because otherwise the -- object will be class-wide without an explicit initialization and -- won't be allocated properly by the back end. It seems unclean to make -- such a revision to the type at this point, and we should try to -- improve this treatment when build-in-place functions with class-wide -- results are implemented. ??? if Is_Class_Wide_Type (Etype (Defining_Identifier (Obj_Decl))) then Set_Etype (Defining_Identifier (Obj_Decl), Result_Subt); end if; end Make_Build_In_Place_Call_In_Object_Declaration; -------------------------------------------- -- Make_CPP_Constructor_Call_In_Allocator -- -------------------------------------------- procedure Make_CPP_Constructor_Call_In_Allocator (Allocator : Node_Id; Function_Call : Node_Id) is Loc : constant Source_Ptr := Sloc (Function_Call); Acc_Type : constant Entity_Id := Etype (Allocator); Function_Id : constant Entity_Id := Entity (Name (Function_Call)); Result_Subt : constant Entity_Id := Available_View (Etype (Function_Id)); New_Allocator : Node_Id; Return_Obj_Access : Entity_Id; Tmp_Obj : Node_Id; begin pragma Assert (Nkind (Allocator) = N_Allocator and then Nkind (Function_Call) = N_Function_Call); pragma Assert (Convention (Function_Id) = Convention_CPP and then Is_Constructor (Function_Id)); pragma Assert (Is_Constrained (Underlying_Type (Result_Subt))); -- Replace the initialized allocator of form "new T'(Func (...))" with -- an uninitialized allocator of form "new T", where T is the result -- subtype of the called function. The call to the function is handled -- separately further below. New_Allocator := Make_Allocator (Loc, Expression => New_Occurrence_Of (Result_Subt, Loc)); Set_No_Initialization (New_Allocator); -- Copy attributes to new allocator. Note that the new allocator -- logically comes from source if the original one did, so copy the -- relevant flag. This ensures proper treatment of the restriction -- No_Implicit_Heap_Allocations in this case. Set_Storage_Pool (New_Allocator, Storage_Pool (Allocator)); Set_Procedure_To_Call (New_Allocator, Procedure_To_Call (Allocator)); Set_Comes_From_Source (New_Allocator, Comes_From_Source (Allocator)); Rewrite (Allocator, New_Allocator); -- Create a new access object and initialize it to the result of the -- new uninitialized allocator. Note: we do not use Allocator as the -- Related_Node of Return_Obj_Access in call to Make_Temporary below -- as this would create a sort of infinite "recursion". Return_Obj_Access := Make_Temporary (Loc, 'R'); Set_Etype (Return_Obj_Access, Acc_Type); -- Generate: -- Rnnn : constant ptr_T := new (T); -- Init (Rnn.all,...); Tmp_Obj := Make_Object_Declaration (Loc, Defining_Identifier => Return_Obj_Access, Constant_Present => True, Object_Definition => New_Occurrence_Of (Acc_Type, Loc), Expression => Relocate_Node (Allocator)); Insert_Action (Allocator, Tmp_Obj); Insert_List_After_And_Analyze (Tmp_Obj, Build_Initialization_Call (Loc, Id_Ref => Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Return_Obj_Access, Loc)), Typ => Etype (Function_Id), Constructor_Ref => Function_Call)); -- Finally, replace the allocator node with a reference to the result of -- the function call itself (which will effectively be an access to the -- object created by the allocator). Rewrite (Allocator, New_Occurrence_Of (Return_Obj_Access, Loc)); -- Ada 2005 (AI-251): If the type of the allocator is an interface then -- generate an implicit conversion to force displacement of the "this" -- pointer. if Is_Interface (Designated_Type (Acc_Type)) then Rewrite (Allocator, Convert_To (Acc_Type, Relocate_Node (Allocator))); end if; Analyze_And_Resolve (Allocator, Acc_Type); end Make_CPP_Constructor_Call_In_Allocator; ----------------------------------- -- Needs_BIP_Finalization_Master -- ----------------------------------- function Needs_BIP_Finalization_Master (Func_Id : Entity_Id) return Boolean is pragma Assert (Is_Build_In_Place_Function (Func_Id)); Func_Typ : constant Entity_Id := Underlying_Type (Etype (Func_Id)); begin -- A formal giving the finalization master is needed for build-in-place -- functions whose result type needs finalization or is a tagged type. -- Tagged primitive build-in-place functions need such a formal because -- they can be called by a dispatching call, and extensions may require -- finalization even if the root type doesn't. This means they're also -- needed for tagged nonprimitive build-in-place functions with tagged -- results, since such functions can be called via access-to-function -- types, and those can be used to call primitives, so masters have to -- be passed to all such build-in-place functions, primitive or not. return not Restriction_Active (No_Finalization) and then (Needs_Finalization (Func_Typ) or else Is_Tagged_Type (Func_Typ)); end Needs_BIP_Finalization_Master; -------------------------- -- Needs_BIP_Alloc_Form -- -------------------------- function Needs_BIP_Alloc_Form (Func_Id : Entity_Id) return Boolean is pragma Assert (Is_Build_In_Place_Function (Func_Id)); Func_Typ : constant Entity_Id := Underlying_Type (Etype (Func_Id)); begin return not Is_Constrained (Func_Typ) or else Is_Tagged_Type (Func_Typ); end Needs_BIP_Alloc_Form; -------------------------------------- -- Needs_Result_Accessibility_Level -- -------------------------------------- function Needs_Result_Accessibility_Level (Func_Id : Entity_Id) return Boolean is Func_Typ : constant Entity_Id := Underlying_Type (Etype (Func_Id)); function Has_Unconstrained_Access_Discriminant_Component (Comp_Typ : Entity_Id) return Boolean; -- Returns True if any component of the type has an unconstrained access -- discriminant. ----------------------------------------------------- -- Has_Unconstrained_Access_Discriminant_Component -- ----------------------------------------------------- function Has_Unconstrained_Access_Discriminant_Component (Comp_Typ : Entity_Id) return Boolean is begin if not Is_Limited_Type (Comp_Typ) then return False; -- Only limited types can have access discriminants with -- defaults. elsif Has_Unconstrained_Access_Discriminants (Comp_Typ) then return True; elsif Is_Array_Type (Comp_Typ) then return Has_Unconstrained_Access_Discriminant_Component (Underlying_Type (Component_Type (Comp_Typ))); elsif Is_Record_Type (Comp_Typ) then declare Comp : Entity_Id; begin Comp := First_Component (Comp_Typ); while Present (Comp) loop if Has_Unconstrained_Access_Discriminant_Component (Underlying_Type (Etype (Comp))) then return True; end if; Next_Component (Comp); end loop; end; end if; return False; end Has_Unconstrained_Access_Discriminant_Component; Feature_Disabled : constant Boolean := True; -- Temporary -- Start of processing for Needs_Result_Accessibility_Level begin -- False if completion unavailable (how does this happen???) if not Present (Func_Typ) then return False; elsif Feature_Disabled then return False; -- False if not a function, also handle enum-lit renames case elsif Func_Typ = Standard_Void_Type or else Is_Scalar_Type (Func_Typ) then return False; -- Handle a corner case, a cross-dialect subp renaming. For example, -- an Ada 2012 renaming of an Ada 2005 subprogram. This can occur when -- an Ada 2005 (or earlier) unit references predefined run-time units. elsif Present (Alias (Func_Id)) then -- Unimplemented: a cross-dialect subp renaming which does not set -- the Alias attribute (e.g., a rename of a dereference of an access -- to subprogram value). ??? return Present (Extra_Accessibility_Of_Result (Alias (Func_Id))); -- Remaining cases require Ada 2012 mode elsif Ada_Version < Ada_2012 then return False; elsif Ekind (Func_Typ) = E_Anonymous_Access_Type or else Is_Tagged_Type (Func_Typ) then -- In the case of, say, a null tagged record result type, the need -- for this extra parameter might not be obvious. This function -- returns True for all tagged types for compatibility reasons. -- A function with, say, a tagged null controlling result type might -- be overridden by a primitive of an extension having an access -- discriminant and the overrider and overridden must have compatible -- calling conventions (including implicitly declared parameters). -- Similarly, values of one access-to-subprogram type might designate -- both a primitive subprogram of a given type and a function -- which is, for example, not a primitive subprogram of any type. -- Again, this requires calling convention compatibility. -- It might be possible to solve these issues by introducing -- wrappers, but that is not the approach that was chosen. return True; elsif Has_Unconstrained_Access_Discriminants (Func_Typ) then return True; elsif Has_Unconstrained_Access_Discriminant_Component (Func_Typ) then return True; -- False for all other cases else return False; end if; end Needs_Result_Accessibility_Level; --------------------------------- -- Rewrite_Function_Call_For_C -- --------------------------------- procedure Rewrite_Function_Call_For_C (N : Node_Id) is Orig_Func : constant Entity_Id := Entity (Name (N)); Func_Id : constant Entity_Id := Ultimate_Alias (Orig_Func); Par : constant Node_Id := Parent (N); Proc_Id : constant Entity_Id := Corresponding_Procedure (Func_Id); Loc : constant Source_Ptr := Sloc (Par); Actuals : List_Id; Last_Actual : Node_Id; Last_Formal : Entity_Id; -- Start of processing for Rewrite_Function_Call_For_C begin -- The actuals may be given by named associations, so the added actual -- that is the target of the return value of the call must be a named -- association as well, so we retrieve the name of the generated -- out_formal. Last_Formal := First_Formal (Proc_Id); while Present (Next_Formal (Last_Formal)) loop Last_Formal := Next_Formal (Last_Formal); end loop; Actuals := Parameter_Associations (N); -- The original function may lack parameters if No (Actuals) then Actuals := New_List; end if; -- If the function call is the expression of an assignment statement, -- transform the assignment into a procedure call. Generate: -- LHS := Func_Call (...); -- Proc_Call (..., LHS); -- If function is inherited, a conversion may be necessary. if Nkind (Par) = N_Assignment_Statement then Last_Actual := Name (Par); if not Comes_From_Source (Orig_Func) and then Etype (Orig_Func) /= Etype (Func_Id) then Last_Actual := Make_Type_Conversion (Loc, New_Occurrence_Of (Etype (Func_Id), Loc), Last_Actual); end if; Append_To (Actuals, Make_Parameter_Association (Loc, Selector_Name => Make_Identifier (Loc, Chars (Last_Formal)), Explicit_Actual_Parameter => Last_Actual)); Rewrite (Par, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc_Id, Loc), Parameter_Associations => Actuals)); Analyze (Par); -- Otherwise the context is an expression. Generate a temporary and a -- procedure call to obtain the function result. Generate: -- ... Func_Call (...) ... -- Temp : ...; -- Proc_Call (..., Temp); -- ... Temp ... else declare Temp_Id : constant Entity_Id := Make_Temporary (Loc, 'T'); Call : Node_Id; Decl : Node_Id; begin -- Generate: -- Temp : ...; Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp_Id, Object_Definition => New_Occurrence_Of (Etype (Func_Id), Loc)); -- Generate: -- Proc_Call (..., Temp); Append_To (Actuals, Make_Parameter_Association (Loc, Selector_Name => Make_Identifier (Loc, Chars (Last_Formal)), Explicit_Actual_Parameter => New_Occurrence_Of (Temp_Id, Loc))); Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Proc_Id, Loc), Parameter_Associations => Actuals); Insert_Actions (Par, New_List (Decl, Call)); Rewrite (N, New_Occurrence_Of (Temp_Id, Loc)); end; end if; end Rewrite_Function_Call_For_C; ------------------------------------ -- Set_Enclosing_Sec_Stack_Return -- ------------------------------------ procedure Set_Enclosing_Sec_Stack_Return (N : Node_Id) is P : Node_Id := N; begin -- Due to a possible mix of internally generated blocks, source blocks -- and loops, the scope stack may not be contiguous as all labels are -- inserted at the top level within the related function. Instead, -- perform a parent-based traversal and mark all appropriate constructs. while Present (P) loop -- Mark the label of a source or internally generated block or -- loop. if Nkind_In (P, N_Block_Statement, N_Loop_Statement) then Set_Sec_Stack_Needed_For_Return (Entity (Identifier (P))); -- Mark the enclosing function elsif Nkind (P) = N_Subprogram_Body then if Present (Corresponding_Spec (P)) then Set_Sec_Stack_Needed_For_Return (Corresponding_Spec (P)); else Set_Sec_Stack_Needed_For_Return (Defining_Entity (P)); end if; -- Do not go beyond the enclosing function exit; end if; P := Parent (P); end loop; end Set_Enclosing_Sec_Stack_Return; end Exp_Ch6;
package Sizetype3_Pkg is type List is array (Integer range <>) of Integer; function F return List; end Sizetype3_Pkg;
-- { dg-do compile } -- { dg-options "-O3" } with Ada.Finalization; use Ada.Finalization; with Opt57_Pkg; use Opt57_Pkg; package Opt57 is procedure Update; procedure Init; type Module_Factory is abstract new Limited_Controlled with private; type Root_Module_Rec (Language : access Module_Factory'Class) is abstract new GC_Pool with null record; type List is tagged limited private; type Linkable is abstract new Root_Module_Rec with private; type Linkable_Ptr is access all Linkable'Class; private type Link is access all List'Class; type Link_Constant is access constant List'Class; type List is tagged limited record Next : Link; end record; type Links_Type (Container : access Linkable) is new List with null record; type Linkable is abstract new Root_Module_Rec with record On_List : Link_Constant; Links : aliased Links_Type (Linkable'Access); end record; type Module_Rec (Language : access Module_Factory'Class) is abstract new Linkable (Language) with null record; type Module_Ptr is access all Module_Rec'Class; type Private_Module_Factory; type Private_Module_Factory_Ptr is access Private_Module_Factory; type Module_Factory is abstract new Limited_Controlled with record Priv : Private_Module_Factory_Ptr; end record; type Module_Factory_Ptr is access all Module_Factory'Class; end Opt57;
-- -- 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 ewok.exported.gpios; use ewok.exported.gpios; with soc.gpio; use type soc.gpio.t_gpio_pin_index; use type soc.gpio.t_gpio_port_index; package body ewok.gpio with spark_mode => off is function to_pin_alt_func (u : unsigned_32) return soc.gpio.t_pin_alt_func is pragma warnings (off); function conv is new ada.unchecked_conversion (unsigned_32, soc.gpio.t_pin_alt_func); pragma warnings (on); begin if u > 15 then raise program_error; end if; return conv (u); end to_pin_alt_func; function is_used (ref : ewok.exported.gpios.t_gpio_ref) return boolean is begin return gpio_points(ref.port, ref.pin).used; end is_used; procedure register (task_id : in ewok.tasks_shared.t_task_id; device_id : in ewok.devices_shared.t_device_id; conf_a : in ewok.exported.gpios.t_gpio_config_access; success : out boolean) is ref : constant ewok.exported.gpios.t_gpio_ref := conf_a.all.kref; begin if gpio_points(ref.port, ref.pin).used then pragma DEBUG (debug.log (debug.ERROR, "Registering GPIO: port" & soc.gpio.t_gpio_port_index'image (ref.port) & ", pin" & soc.gpio.t_gpio_pin_index'image (ref.pin) & " is already used.")); success := false; else gpio_points(ref.port, ref.pin).used := true; gpio_points(ref.port, ref.pin).task_id := task_id; gpio_points(ref.port, ref.pin).device_id := device_id; gpio_points(ref.port, ref.pin).config := conf_a; success := true; end if; end register; procedure release (task_id : in ewok.tasks_shared.t_task_id; device_id : in ewok.devices_shared.t_device_id; conf_a : in ewok.exported.gpios.t_gpio_config_access) is ref : constant ewok.exported.gpios.t_gpio_ref := conf_a.all.kref; begin if gpio_points(ref.port, ref.pin).task_id /= task_id or gpio_points(ref.port, ref.pin).device_id /= device_id then raise program_error; -- Should never happen else gpio_points(ref.port, ref.pin).used := false; gpio_points(ref.port, ref.pin).task_id := ID_UNUSED; gpio_points(ref.port, ref.pin).device_id := ID_DEV_UNUSED; gpio_points(ref.port, ref.pin).config := NULL; end if; end release; procedure config (conf : in ewok.exported.gpios.t_gpio_config_access) is begin -- Enable RCC soc.gpio.enable_clock (conf.all.kref.port); if conf.all.settings.set_mode then soc.gpio.set_mode (conf.all.kref.port, conf.all.kref.pin, soc.gpio.t_pin_mode'val (t_interface_gpio_mode'pos (conf.all.mode))); end if; if conf.all.settings.set_type then soc.gpio.set_type (conf.all.kref.port, conf.all.kref.pin, soc.gpio.t_pin_output_type'val (t_interface_gpio_type'pos (conf.all.otype))); end if; if conf.all.settings.set_speed then soc.gpio.set_speed (conf.all.kref.port, conf.all.kref.pin, soc.gpio.t_pin_output_speed'val (t_interface_gpio_speed'pos (conf.all.ospeed))); end if; if conf.all.settings.set_pupd then soc.gpio.set_pupd (conf.all.kref.port, conf.all.kref.pin, soc.gpio.t_pin_pupd'val (t_interface_gpio_pupd'pos (conf.all.pupd))); end if; if conf.all.settings.set_bsr_r then soc.gpio.set_bsr_r (conf.all.kref.port, conf.all.kref.pin, types.to_bit (conf.all.bsr_r)); end if; if conf.all.settings.set_bsr_s then soc.gpio.set_bsr_s (conf.all.kref.port, conf.all.kref.pin, types.to_bit (conf.all.bsr_s)); end if; -- FIXME - Writing to LCKR register requires a specific sequence -- describe in section 8.4.8 (RM 00090) if conf.all.settings.set_lck then soc.gpio.set_lck (conf.all.kref.port, conf.all.kref.pin, soc.gpio.t_pin_lock'val (conf.all.lck)); end if; if conf.all.settings.set_af then soc.gpio.set_af (conf.all.kref.port, conf.all.kref.pin, to_pin_alt_func (conf.all.af)); end if; end config; procedure write_pin (ref : in ewok.exported.gpios.t_gpio_ref; value : in bit) is begin soc.gpio.write_pin (ref.port, ref.pin, value); end write_pin; function read_pin (ref : ewok.exported.gpios.t_gpio_ref) return bit is value : bit; begin soc.gpio.read_pin (ref.port, ref.pin, value); return value; end read_pin; function belong_to (task_id : ewok.tasks_shared.t_task_id; ref : ewok.exported.gpios.t_gpio_ref) return boolean is begin if gpio_points(ref.port, ref.pin).used and gpio_points(ref.port, ref.pin).task_id = task_id then return true; else return false; end if; end belong_to; function get_task_id (ref : in ewok.exported.gpios.t_gpio_ref) return ewok.tasks_shared.t_task_id is begin return gpio_points(ref.port, ref.pin).task_id; end get_task_id; function get_device_id (ref : in ewok.exported.gpios.t_gpio_ref) return ewok.devices_shared.t_device_id is begin return gpio_points(ref.port, ref.pin).device_id; end get_device_id; function get_config (ref : in ewok.exported.gpios.t_gpio_ref) return ewok.exported.gpios.t_gpio_config_access is begin return gpio_points(ref.port, ref.pin).config; end get_config; end ewok.gpio;
with Ada.Text_Io, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Maps; use Ada.Text_Io, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Maps; package Semantica.Assemblador is Error_Assemblador : exception; procedure Genera_Assemblador (Nom_Fitxer : in String); private Nproc : Num_Proc := 0; Fitxer_Asmbl : File_Type; end Semantica.Assemblador;
----------------------------------------------------------------------- -- wiki-helpers-parser -- Generic procedure for the wiki parser -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Strings; with Wiki.Documents; with Wiki.Streams; generic type Engine_Type is limited private; type Element_Type (<>) is limited private; with procedure Element (Item : in Element_Type; Pos : in out Natural; Char : out Wiki.Strings.WChar) is <>; with function Length (Item : in Element_Type) return Natural is <>; with procedure Parse (Engine : in out Engine_Type; Stream : in Wiki.Streams.Input_Stream_Access; Doc : in out Wiki.Documents.Document) is <>; procedure Wiki.Helpers.Parser (Engine : in out Engine_Type; Content : in Element_Type; Doc : in out Wiki.Documents.Document); pragma Preelaborate (Wiki.Helpers.Parser);
pragma License (Unrestricted); -- generalized unit of Ada.Strings.Fixed generic type Character_Type is (<>); type String_Type is array (Positive range <>) of Character_Type; Space : Character_Type; package Ada.Strings.Generic_Functions is pragma Preelaborate; -- "Copy" procedure for strings of possibly different lengths procedure Move ( Source : String_Type; Target : out String_Type; Drop : Truncation := Error; Justify : Alignment := Left; Pad : Character_Type := Space); -- Search subprograms -- extended -- Character searching. function Index_Element ( Source : String_Type; Pattern : Character_Type; From : Positive; Going : Direction := Forward) return Natural; function Index_Element ( Source : String_Type; Pattern : Character_Type; Going : Direction := Forward) return Natural; pragma Inline (Index_Element); -- extended -- Forward or backward only version. function Index_Element_Forward ( Source : String_Type; Pattern : Character_Type) return Natural; function Index_Element_Backward ( Source : String_Type; Pattern : Character_Type) return Natural; function Index ( Source : String_Type; Pattern : String_Type; From : Positive; Going : Direction := Forward) return Natural; pragma Inline (Index); function Index ( Source : String_Type; Pattern : String_Type; Going : Direction := Forward) return Natural; pragma Inline (Index); -- extended -- Forward or backward only version. function Index_Forward (Source : String_Type; Pattern : String_Type) return Natural; function Index_Backward (Source : String_Type; Pattern : String_Type) return Natural; function Index_Non_Blank ( Source : String_Type; From : Positive; Going : Direction := Forward) return Natural; pragma Inline (Index_Non_Blank); function Index_Non_Blank ( Source : String_Type; Going : Direction := Forward) return Natural; pragma Inline (Index_Non_Blank); -- extended -- Forward or backward only version. function Index_Non_Blank_Forward ( Source : String_Type; Blank : Character_Type := Space) return Natural; function Index_Non_Blank_Backward ( Source : String_Type; Blank : Character_Type := Space) return Natural; function Count ( Source : String_Type; Pattern : String_Type) return Natural; -- String transformation subprograms function Replace_Slice ( Source : String_Type; Low : Positive; High : Natural; By : String_Type) return String_Type; procedure Replace_Slice ( Source : in out String_Type; Low : Positive; High : Natural; By : String_Type; Drop : Truncation := Error; Justify : Alignment := Left; Pad : Character_Type := Space); -- extended -- Copying, for Bounded_String and Unbounded_String. procedure Replace_Slice ( Source : String_Type; Low : Positive; High : Natural; By : String_Type; Target : out String_Type; Target_Last : out Natural); -- extended -- Destructive, for Bounded_String and Unbounded_String. procedure Replace_Slice ( Source : in out String_Type; Last : in out Natural; Low : Positive; High : Natural; By : String_Type); function Insert ( Source : String_Type; Before : Positive; New_Item : String_Type) return String_Type; procedure Insert ( Source : in out String_Type; Before : Positive; New_Item : String_Type; Drop : Truncation := Error); -- extended -- Copying, for Bounded_String and Unbounded_String. procedure Insert ( Source : String_Type; Before : Positive; New_Item : String_Type; Target : out String_Type; Target_Last : out Natural); -- extended -- Destructive, for Bounded_String and Unbounded_String. procedure Insert ( Source : in out String_Type; Last : in out Natural; Before : Positive; New_Item : String_Type); function Overwrite ( Source : String_Type; Position : Positive; New_Item : String_Type) return String_Type; procedure Overwrite ( Source : in out String_Type; Position : Positive; New_Item : String_Type; Drop : Truncation := Right); -- Note: Overwrite is danger in drake, -- because the trailing element of any multi-byte character is possible -- to be left at Source (Position + New_Item'Length). function Delete ( Source : String_Type; From : Positive; Through : Natural) return String_Type; procedure Delete ( Source : in out String_Type; From : Positive; Through : Natural; Justify : Alignment := Left; Pad : Character_Type := Space); -- extended -- Copying, for Bounded_String and Unbounded_String. procedure Delete ( Source : String_Type; From : Positive; Through : Natural; Target : out String_Type; Target_Last : out Natural); -- extended -- Destructive, for Bounded_String and Unbounded_String. procedure Delete ( Source : in out String_Type; Last : in out Natural; From : Positive; Through : Natural); -- String selector subprograms function Trim ( Source : String_Type; Side : Trim_End; Blank : Character_Type := Space) -- additional return String_Type; procedure Trim ( Source : in out String_Type; Side : Trim_End; Justify : Alignment := Left; Pad : Character_Type := Space); -- extended -- Explicit blank. (default parameter is wrong for CXA4025) procedure Trim ( Source : in out String_Type; Side : Trim_End; Blank : Character_Type; Justify : Alignment := Left; Pad : Character_Type := Space); -- extended -- No copying. procedure Trim ( Source : String_Type; Side : Trim_End; Blank : Character_Type := Space; First : out Positive; Last : out Natural); function Head ( Source : String_Type; Count : Natural; Pad : Character_Type := Space) return String_Type; procedure Head ( Source : in out String_Type; Count : Natural; Justify : Alignment := Left; Pad : Character_Type := Space); -- extended -- Copying, for Bounded_String and Unbounded_String. procedure Head ( Source : String_Type; Count : Natural; Pad : Character_Type := Space; Target : out String_Type; Target_Last : out Natural); -- extended -- Destructive, for Bounded_String and Unbounded_String. procedure Head ( Source : in out String_Type; Last : in out Natural; Count : Natural; Pad : Character_Type := Space); function Tail ( Source : String_Type; Count : Natural; Pad : Character_Type := Space) return String_Type; procedure Tail ( Source : in out String_Type; Count : Natural; Justify : Alignment := Left; Pad : Character_Type := Space); -- extended -- Copying, for Bounded_String and Unbounded_String. procedure Tail ( Source : String_Type; Count : Natural; Pad : Character_Type := Space; Target : out String_Type; Target_Last : out Natural); -- String constructor functions function "*" (Left : Natural; Right : Character_Type) return String_Type; function "*" (Left : Natural; Right : String_Type) return String_Type; generic Expanding : Natural; with procedure Put ( Value : Wide_Wide_Character; Item : out String_Type; Last : out Natural); with procedure Get ( Item : String_Type; Last : out Natural; Value : out Wide_Wide_Character; Is_Illegal_Sequence : out Boolean); with procedure Get_Reverse ( Item : String_Type; First : out Positive; Value : out Wide_Wide_Character; Is_Illegal_Sequence : out Boolean); type Character_Set is private; with function Is_In ( Element : Wide_Wide_Character; Set : Character_Set) return Boolean; type Character_Mapping is private; with function Value ( Map : Character_Mapping; Element : Wide_Wide_Character) return Wide_Wide_Character; package Generic_Maps is -- Search subprograms function Index ( Source : String_Type; Pattern : String_Type; From : Positive; Going : Direction := Forward; Mapping : Character_Mapping) return Natural; pragma Inline (Index); function Index ( Source : String_Type; Pattern : String_Type; Going : Direction := Forward; Mapping : Character_Mapping) return Natural; pragma Inline (Index); -- extended -- Forward or backward only version. function Index_Forward ( Source : String_Type; Pattern : String_Type; Mapping : Character_Mapping) return Natural; function Index_Backward ( Source : String_Type; Pattern : String_Type; Mapping : Character_Mapping) return Natural; function Index ( Source : String_Type; Pattern : String_Type; From : Positive; Going : Direction := Forward; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural; pragma Inline (Index); function Index ( Source : String_Type; Pattern : String_Type; Going : Direction := Forward; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural; pragma Inline (Index); -- extended -- Forward or backward only version. function Index_Forward ( Source : String_Type; Pattern : String_Type; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural; function Index_Backward ( Source : String_Type; Pattern : String_Type; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural; function Index_Element ( Source : String_Type; Pattern : String_Type; From : Positive; Going : Direction := Forward; Mapping : not null access function (From : Character_Type) return Character_Type) return Natural; pragma Inline (Index_Element); function Index_Element ( Source : String_Type; Pattern : String_Type; Going : Direction := Forward; Mapping : not null access function (From : Character_Type) return Character_Type) return Natural; pragma Inline (Index_Element); -- extended -- Forward or backward only version. function Index_Element_Forward ( Source : String_Type; Pattern : String_Type; Mapping : not null access function (From : Character_Type) return Character_Type) return Natural; function Index_Element_Backward ( Source : String_Type; Pattern : String_Type; Mapping : not null access function (From : Character_Type) return Character_Type) return Natural; function Index ( Source : String_Type; Set : Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural; pragma Inline (Index); function Index ( Source : String_Type; Set : Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural; pragma Inline (Index); -- extended -- Forward or backward only version. function Index_Forward ( Source : String_Type; Set : Character_Set; Test : Membership := Inside) return Natural; function Index_Backward ( Source : String_Type; Set : Character_Set; Test : Membership := Inside) return Natural; function Count ( Source : String_Type; Pattern : String_Type; Mapping : Character_Mapping) return Natural; function Count ( Source : String_Type; Pattern : String_Type; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return Natural; function Count_Element ( Source : String_Type; Pattern : String_Type; Mapping : not null access function (From : Character_Type) return Character_Type) return Natural; function Count ( Source : String_Type; Set : Character_Set) return Natural; procedure Find_Token ( Source : String_Type; Set : Character_Set; From : Positive; Test : Membership; First : out Positive; Last : out Natural); procedure Find_Token ( Source : String_Type; Set : Character_Set; Test : Membership; First : out Positive; Last : out Natural); -- extended -- Only First or only Last. function Find_Token_Last ( Source : String_Type; Set : Character_Set; Test : Membership) return Natural; function Find_Token_First ( Source : String_Type; Set : Character_Set; Test : Membership) return Positive; -- String translation subprograms function Translate ( Source : String_Type; Mapping : Character_Mapping) return String_Type; procedure Translate ( Source : in out String_Type; Mapping : Character_Mapping; Drop : Truncation := Error; -- additional Justify : Alignment := Left; -- additional Pad : Character_Type := Space); -- additional -- extended -- For Bounded_String and Unbounded_String. procedure Translate ( Source : String_Type; Mapping : Character_Mapping; Target : out String_Type; Target_Last : out Natural); function Translate ( Source : String_Type; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character) return String_Type; procedure Translate ( Source : in out String_Type; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character; Drop : Truncation := Error; -- additional Justify : Alignment := Left; -- additional Pad : Character_Type := Space); -- additional -- extended -- For Bounded_String and Unbounded_String. procedure Translate ( Source : String_Type; Mapping : not null access function (From : Wide_Wide_Character) return Wide_Wide_Character; Target : out String_Type; Target_Last : out Natural); function Translate_Element ( Source : String_Type; Mapping : not null access function (From : Character_Type) return Character_Type) return String_Type; procedure Translate_Element ( Source : in out String_Type; Mapping : not null access function (From : Character_Type) return Character_Type); -- extended -- For Bounded_String and Unbounded_String. procedure Translate_Element ( Source : String_Type; Mapping : not null access function (From : Character_Type) return Character_Type; Target : out String_Type); -- String selector subprograms function Trim ( Source : String_Type; Left : Character_Set; Right : Character_Set) return String_Type; procedure Trim ( Source : in out String_Type; Left : Character_Set; Right : Character_Set; Justify : Alignment := Strings.Left; Pad : Character_Type := Space); -- extended -- No copying. procedure Trim ( Source : String_Type; Left : Character_Set; Right : Character_Set; First : out Positive; Last : out Natural); end Generic_Maps; end Ada.Strings.Generic_Functions;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with Glfw.API; with Interfaces.C.Strings; package body Glfw is use type Interfaces.C.int; procedure Init is begin if API.Init = 0 then raise Initialization_Exception; end if; end Init; procedure Shutdown is begin API.Glfw_Terminate; end Shutdown; procedure Version (Major, Minor, Rev : out Natural) is Raw_Major, Raw_Minor, Raw_Rev : C.int; begin API.Get_Version (Raw_Major, Raw_Minor, Raw_Rev); Major := Natural (Raw_Major); Minor := Natural (Raw_Minor); Rev := Natural (Raw_Rev); end Version; function Version_String return String is begin return Interfaces.C.Strings.Value (API.Get_Version_String); end Version_String; function Time return Seconds is begin return API.Get_Time; end Time; procedure Set_Time (Value : Seconds) is begin API.Set_Time (Value); end Set_Time; function Extension_Supported (Name : String) return Boolean is begin return Boolean (API.Extension_Supported (Interfaces.C.To_C (Name))); end Extension_Supported; end Glfw;
package Array23_Pkg3 is C0 : Natural := 2; end Array23_Pkg3;
-- -- Copyright (C) 2015-2017 secunet Security Networks AG -- -- 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 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with System; with HW.GFX.GMA; private package HW.GFX.GMA.Registers with Abstract_State => ((Address_State with Part_Of => GMA.State), (Register_State with External, Part_Of => GMA.Device_State), (GTT_State with External, Part_Of => GMA.Device_State)), Initializes => Address_State is type Registers_Invalid_Index is (Invalid_Register, -- Allow a placeholder when access is not acceptable RCS_RING_BUFFER_TAIL, RCS_RING_BUFFER_HEAD, RCS_RING_BUFFER_STRT, RCS_RING_BUFFER_CTL, QUIRK_02084, QUIRK_02090, HWSTAM, MI_MODE, INSTPM, GT_MODE, CACHE_MODE_0, CTX_SIZE, PP_DCLV_HIGH, PP_DCLV_LOW, GFX_MODE, ARB_MODE, HWS_PGA, GAM_ECOCHK, GMCH_GMBUS0, GMCH_GMBUS1, GMCH_GMBUS2, GMCH_GMBUS3, GMCH_GMBUS4, GMCH_GMBUS5, GMCH_DPLL_A, GMCH_DPLL_B, GMCH_FPA0, GMCH_FPA1, GMCH_FPB0, GMCH_FPB1, MBCTL, UCGCTL1, UCGCTL2, GMCH_CLKCFG, VCS_RING_BUFFER_TAIL, VCS_RING_BUFFER_HEAD, VCS_RING_BUFFER_STRT, VCS_RING_BUFFER_CTL, SLEEP_PSMI_CONTROL, VCS_HWSTAM, VCS_PP_DCLV_HIGH, VCS_PP_DCLV_LOW, GAC_ECO_BITS, BCS_RING_BUFFER_TAIL, BCS_RING_BUFFER_HEAD, BCS_RING_BUFFER_STRT, BCS_RING_BUFFER_CTL, BCS_HWSTAM, BCS_PP_DCLV_HIGH, BCS_PP_DCLV_LOW, GAB_CTL_REG, CPU_VGACNTRL, FUSE_STATUS, ILK_DISPLAY_CHICKEN2, DSPCLK_GATE_D, FBA_CFB_BASE, FBC_CTL, IPS_CTL, DEISR, DEIMR, DEIIR, DEIER, GTISR, GTIMR, GTIIR, GTIER, IIR, HOTPLUG_CTL, ARB_CTL, DBUF_CTL, WM_PIPE_A, WM_PIPE_B, WM1_LP_ILK, WM2_LP_ILK, WM3_LP_ILK, WM_PIPE_C, WM_LINETIME_A, WM_LINETIME_B, WM_LINETIME_C, PWR_WELL_CTL_BIOS, PWR_WELL_CTL_DRIVER, PWR_WELL_CTL_KVMR, PWR_WELL_CTL_DEBUG, PWR_WELL_CTL5, PWR_WELL_CTL6, CDCLK_CTL, LCPLL1_CTL, LCPLL2_CTL, SPLL_CTL, WRPLL_CTL_1, WRPLL_CTL_2, BXT_DE_PLL_ENABLE, BXT_PORT_PLL_ENABLE_A, BXT_PORT_PLL_ENABLE_B, BXT_PORT_PLL_ENABLE_C, PORT_CLK_SEL_DDIA, PORT_CLK_SEL_DDIB, PORT_CLK_SEL_DDIC, PORT_CLK_SEL_DDID, PORT_CLK_SEL_DDIE, TRANSA_CLK_SEL, TRANSB_CLK_SEL, TRANSC_CLK_SEL, NDE_RSTWRN_OPT, BLC_PWM_CPU_CTL2, BLC_PWM_CPU_CTL, HTOTAL_A, HBLANK_A, HSYNC_A, VTOTAL_A, VBLANK_A, VSYNC_A, PIPEASRC, PIPE_VSYNCSHIFT_A, PIPEA_DATA_M1, PIPEA_DATA_N1, PIPEA_LINK_M1, PIPEA_LINK_N1, FDI_TX_CTL_A, PIPEA_DDI_FUNC_CTL, PIPEA_MSA_MISC, SRD_CTL_A, SRD_STATUS_A, HTOTAL_B, HBLANK_B, HSYNC_B, VTOTAL_B, VBLANK_B, VSYNC_B, PIPEBSRC, PIPE_VSYNCSHIFT_B, PIPEB_DATA_M1, PIPEB_DATA_N1, PIPEB_LINK_M1, PIPEB_LINK_N1, FDI_TX_CTL_B, PORT_HOTPLUG_EN, PORT_HOTPLUG_STAT, GMCH_SDVOB, GMCH_SDVOC, GMCH_LVDS, GMCH_PP_STATUS, GMCH_PP_CONTROL, GMCH_PP_ON_DELAYS, GMCH_PP_OFF_DELAYS, GMCH_PP_DIVISOR, GMCH_PFIT_CONTROL, PIPEB_DDI_FUNC_CTL, PIPEB_MSA_MISC, SRD_CTL_B, SRD_STATUS_B, HTOTAL_C, HBLANK_C, HSYNC_C, VTOTAL_C, VBLANK_C, VSYNC_C, PIPECSRC, G4X_AUD_VID_DID, PIPE_VSYNCSHIFT_C, PIPEC_DATA_M1, PIPEC_DATA_N1, PIPEC_LINK_M1, PIPEC_LINK_N1, FDI_TX_CTL_C, PIPEC_DDI_FUNC_CTL, PIPEC_MSA_MISC, SRD_CTL_C, SRD_STATUS_C, DDI_BUF_CTL_A, DDI_AUX_CTL_A, DDI_AUX_DATA_A_1, DDI_AUX_DATA_A_2, DDI_AUX_DATA_A_3, DDI_AUX_DATA_A_4, DDI_AUX_DATA_A_5, DDI_AUX_MUTEX_A, DP_TP_CTL_A, DDI_BUF_CTL_B, DDI_AUX_CTL_B, DDI_AUX_DATA_B_1, DDI_AUX_DATA_B_2, DDI_AUX_DATA_B_3, DDI_AUX_DATA_B_4, DDI_AUX_DATA_B_5, DDI_AUX_MUTEX_B, DP_TP_CTL_B, DP_TP_STATUS_B, DDI_BUF_CTL_C, DDI_AUX_CTL_C, DDI_AUX_DATA_C_1, DDI_AUX_DATA_C_2, DDI_AUX_DATA_C_3, DDI_AUX_DATA_C_4, DDI_AUX_DATA_C_5, DDI_AUX_MUTEX_C, DP_TP_CTL_C, DP_TP_STATUS_C, DDI_BUF_CTL_D, DDI_AUX_CTL_D, DDI_AUX_DATA_D_1, DDI_AUX_DATA_D_2, DDI_AUX_DATA_D_3, DDI_AUX_DATA_D_4, DDI_AUX_DATA_D_5, DDI_AUX_MUTEX_D, DP_TP_CTL_D, DP_TP_STATUS_D, DDI_BUF_CTL_E, DP_TP_CTL_E, DP_TP_STATUS_E, SRD_CTL, SRD_STATUS, BXT_PHY_CTL_A, BXT_PHY_CTL_B, BXT_PHY_CTL_C, BXT_PHY_CTL_FAM_EDP, BXT_PHY_CTL_FAM_DDI, DDI_BUF_TRANS_A_S0T1, DDI_BUF_TRANS_A_S0T2, DDI_BUF_TRANS_A_S1T1, DDI_BUF_TRANS_A_S1T2, DDI_BUF_TRANS_A_S2T1, DDI_BUF_TRANS_A_S2T2, DDI_BUF_TRANS_A_S3T1, DDI_BUF_TRANS_A_S3T2, DDI_BUF_TRANS_A_S4T1, DDI_BUF_TRANS_A_S4T2, DDI_BUF_TRANS_A_S5T1, DDI_BUF_TRANS_A_S5T2, DDI_BUF_TRANS_A_S6T1, DDI_BUF_TRANS_A_S6T2, DDI_BUF_TRANS_A_S7T1, DDI_BUF_TRANS_A_S7T2, DDI_BUF_TRANS_A_S8T1, DDI_BUF_TRANS_A_S8T2, DDI_BUF_TRANS_A_S9T1, DDI_BUF_TRANS_A_S9T2, DDI_BUF_TRANS_B_S0T1, DDI_BUF_TRANS_B_S0T2, DDI_BUF_TRANS_B_S1T1, DDI_BUF_TRANS_B_S1T2, DDI_BUF_TRANS_B_S2T1, DDI_BUF_TRANS_B_S2T2, DDI_BUF_TRANS_B_S3T1, DDI_BUF_TRANS_B_S3T2, DDI_BUF_TRANS_B_S4T1, DDI_BUF_TRANS_B_S4T2, DDI_BUF_TRANS_B_S5T1, DDI_BUF_TRANS_B_S5T2, DDI_BUF_TRANS_B_S6T1, DDI_BUF_TRANS_B_S6T2, DDI_BUF_TRANS_B_S7T1, DDI_BUF_TRANS_B_S7T2, DDI_BUF_TRANS_B_S8T1, DDI_BUF_TRANS_B_S8T2, DDI_BUF_TRANS_B_S9T1, DDI_BUF_TRANS_B_S9T2, DDI_BUF_TRANS_C_S0T1, DDI_BUF_TRANS_C_S0T2, DDI_BUF_TRANS_C_S1T1, DDI_BUF_TRANS_C_S1T2, DDI_BUF_TRANS_C_S2T1, DDI_BUF_TRANS_C_S2T2, DDI_BUF_TRANS_C_S3T1, DDI_BUF_TRANS_C_S3T2, DDI_BUF_TRANS_C_S4T1, DDI_BUF_TRANS_C_S4T2, DDI_BUF_TRANS_C_S5T1, DDI_BUF_TRANS_C_S5T2, DDI_BUF_TRANS_C_S6T1, DDI_BUF_TRANS_C_S6T2, DDI_BUF_TRANS_C_S7T1, DDI_BUF_TRANS_C_S7T2, DDI_BUF_TRANS_C_S8T1, DDI_BUF_TRANS_C_S8T2, DDI_BUF_TRANS_C_S9T1, DDI_BUF_TRANS_C_S9T2, DDI_BUF_TRANS_D_S0T1, DDI_BUF_TRANS_D_S0T2, DDI_BUF_TRANS_D_S1T1, DDI_BUF_TRANS_D_S1T2, DDI_BUF_TRANS_D_S2T1, DDI_BUF_TRANS_D_S2T2, DDI_BUF_TRANS_D_S3T1, DDI_BUF_TRANS_D_S3T2, DDI_BUF_TRANS_D_S4T1, DDI_BUF_TRANS_D_S4T2, DDI_BUF_TRANS_D_S5T1, DDI_BUF_TRANS_D_S5T2, DDI_BUF_TRANS_D_S6T1, DDI_BUF_TRANS_D_S6T2, DDI_BUF_TRANS_D_S7T1, DDI_BUF_TRANS_D_S7T2, DDI_BUF_TRANS_D_S8T1, DDI_BUF_TRANS_D_S8T2, DDI_BUF_TRANS_D_S9T1, DDI_BUF_TRANS_D_S9T2, DDI_BUF_TRANS_E_S0T1, DDI_BUF_TRANS_E_S0T2, DDI_BUF_TRANS_E_S1T1, DDI_BUF_TRANS_E_S1T2, DDI_BUF_TRANS_E_S2T1, DDI_BUF_TRANS_E_S2T2, DDI_BUF_TRANS_E_S3T1, DDI_BUF_TRANS_E_S3T2, DDI_BUF_TRANS_E_S4T1, DDI_BUF_TRANS_E_S4T2, DDI_BUF_TRANS_E_S5T1, DDI_BUF_TRANS_E_S5T2, DDI_BUF_TRANS_E_S6T1, DDI_BUF_TRANS_E_S6T2, DDI_BUF_TRANS_E_S7T1, DDI_BUF_TRANS_E_S7T2, DDI_BUF_TRANS_E_S8T1, DDI_BUF_TRANS_E_S8T2, DDI_BUF_TRANS_E_S9T1, DDI_BUF_TRANS_E_S9T2, AUD_VID_DID, PFA_WIN_POS, PFA_WIN_SZ, PFA_CTL_1, PS_WIN_POS_1_A, PS_WIN_SZ_1_A, PS_CTRL_1_A, PS_WIN_POS_2_A, PS_WIN_SZ_2_A, PS_CTRL_2_A, PFB_WIN_POS, PFB_WIN_SZ, PFB_CTL_1, PS_WIN_POS_1_B, PS_WIN_SZ_1_B, PS_CTRL_1_B, PS_WIN_POS_2_B, PS_WIN_SZ_2_B, PS_CTRL_2_B, PFC_WIN_POS, PFC_WIN_SZ, PFC_CTL_1, PS_WIN_POS_1_C, PS_WIN_SZ_1_C, PS_CTRL_1_C, BXT_PORT_CL1CM_DW0_BC, DISPIO_CR_TX_BMU_CR0, BXT_PORT_CL1CM_DW9_BC, BXT_PORT_CL1CM_DW10_BC, BXT_PORT_PLL_EBB_0_B, BXT_PORT_PLL_EBB_4_B, DPLL1_CFGR1, DPLL1_CFGR2, DPLL2_CFGR1, DPLL2_CFGR2, DPLL3_CFGR1, DPLL3_CFGR2, DPLL_CTRL1, DPLL_CTRL2, DPLL_STATUS, BXT_PORT_CL1CM_DW28_BC, BXT_PORT_CL1CM_DW30_BC, BXT_PORT_PLL_0_B, BXT_PORT_PLL_1_B, BXT_PORT_PLL_2_B, BXT_PORT_PLL_3_B, BXT_PORT_PLL_6_B, BXT_PORT_PLL_8_B, BXT_PORT_PLL_9_B, BXT_PORT_PLL_10_B, BXT_PORT_REF_DW3_BC, BXT_PORT_REF_DW6_BC, BXT_PORT_REF_DW8_BC, BXT_PORT_PLL_EBB_0_C, BXT_PORT_PLL_EBB_4_C, BXT_PORT_CL2CM_DW6_BC, BXT_PORT_PLL_0_C, BXT_PORT_PLL_1_C, BXT_PORT_PLL_2_C, BXT_PORT_PLL_3_C, BXT_PORT_PLL_6_C, BXT_PORT_PLL_8_C, BXT_PORT_PLL_9_C, BXT_PORT_PLL_10_C, BXT_PORT_PCS_DW10_01_B, BXT_PORT_PCS_DW12_01_B, BXT_PORT_TX_DW2_LN0_B, BXT_PORT_TX_DW3_LN0_B, BXT_PORT_TX_DW4_LN0_B, BXT_PORT_TX_DW14_LN0_B, BXT_PORT_TX_DW14_LN1_B, BXT_PORT_TX_DW14_LN2_B, BXT_PORT_TX_DW14_LN3_B, BXT_PORT_PCS_DW10_01_C, BXT_PORT_PCS_DW12_01_C, BXT_PORT_TX_DW2_LN0_C, BXT_PORT_TX_DW3_LN0_C, BXT_PORT_TX_DW4_LN0_C, BXT_PORT_TX_DW14_LN0_C, BXT_PORT_TX_DW14_LN1_C, BXT_PORT_TX_DW14_LN2_C, BXT_PORT_TX_DW14_LN3_C, BXT_PORT_PCS_DW10_GRP_B, BXT_PORT_PCS_DW12_GRP_B, BXT_PORT_TX_DW2_GRP_B, BXT_PORT_TX_DW3_GRP_B, BXT_PORT_TX_DW4_GRP_B, BXT_PORT_PCS_DW10_GRP_C, BXT_PORT_PCS_DW12_GRP_C, BXT_PORT_TX_DW2_GRP_C, BXT_PORT_TX_DW3_GRP_C, BXT_PORT_TX_DW4_GRP_C, BXT_DE_PLL_CTL, HTOTAL_EDP, HBLANK_EDP, HSYNC_EDP, VTOTAL_EDP, VBLANK_EDP, VSYNC_EDP, PIPE_EDP_DATA_M1, PIPE_EDP_DATA_N1, PIPE_EDP_LINK_M1, PIPE_EDP_LINK_N1, PIPE_EDP_DDI_FUNC_CTL, PIPE_EDP_MSA_MISC, SRD_CTL_EDP, SRD_STATUS_EDP, PIPE_SCANLINE_A, PIPEACONF, PIPEAMISC, PIPE_FRMCNT_A, PIPEA_GMCH_DATA_M, PIPEA_GMCH_DATA_N, PIPEA_GMCH_LINK_M, PIPEA_GMCH_LINK_N, CUR_CTL_A, CUR_BASE_A, CUR_POS_A, CUR_FBC_CTL_A, CUR_WM_A_0, CUR_WM_A_1, CUR_WM_A_2, CUR_WM_A_3, CUR_WM_A_4, CUR_WM_A_5, CUR_WM_A_6, CUR_WM_A_7, CUR_BUF_CFG_A, DSPACNTR, DSPALINOFF, DSPASTRIDE, PLANE_POS_1_A, PLANE_SIZE_1_A, DSPASURF, DSPATILEOFF, PLANE_WM_1_A_0, PLANE_WM_1_A_1, PLANE_WM_1_A_2, PLANE_WM_1_A_3, PLANE_WM_1_A_4, PLANE_WM_1_A_5, PLANE_WM_1_A_6, PLANE_WM_1_A_7, PLANE_BUF_CFG_1_A, SPACNTR, PIPE_SCANLINE_B, PIPEBCONF, PIPEBMISC, PIPE_FRMCNT_B, PIPEB_GMCH_DATA_M, PIPEB_GMCH_DATA_N, PIPEB_GMCH_LINK_M, PIPEB_GMCH_LINK_N, CUR_CTL_B, CUR_BASE_B, CUR_POS_B, CUR_FBC_CTL_B, CUR_WM_B_0, CUR_WM_B_1, CUR_WM_B_2, CUR_WM_B_3, CUR_WM_B_4, CUR_WM_B_5, CUR_WM_B_6, CUR_WM_B_7, CUR_BUF_CFG_B, DSPBCNTR, DSPBLINOFF, DSPBSTRIDE, PLANE_POS_1_B, PLANE_SIZE_1_B, DSPBSURF, DSPBTILEOFF, PLANE_WM_1_B_0, PLANE_WM_1_B_1, PLANE_WM_1_B_2, PLANE_WM_1_B_3, PLANE_WM_1_B_4, PLANE_WM_1_B_5, PLANE_WM_1_B_6, PLANE_WM_1_B_7, PLANE_BUF_CFG_1_B, SPBCNTR, GMCH_VGACNTRL, PIPE_SCANLINE_C, PIPECCONF, PIPECMISC, PIPE_FRMCNT_C, CUR_CTL_C, CUR_BASE_C, CUR_POS_C, CUR_FBC_CTL_C, CUR_WM_C_0, CUR_WM_C_1, CUR_WM_C_2, CUR_WM_C_3, CUR_WM_C_4, CUR_WM_C_5, CUR_WM_C_6, CUR_WM_C_7, CUR_BUF_CFG_C, DSPCCNTR, DSPCLINOFF, DSPCSTRIDE, PLANE_POS_1_C, PLANE_SIZE_1_C, DSPCSURF, DSPCTILEOFF, PLANE_WM_1_C_0, PLANE_WM_1_C_1, PLANE_WM_1_C_2, PLANE_WM_1_C_3, PLANE_WM_1_C_4, PLANE_WM_1_C_5, PLANE_WM_1_C_6, PLANE_WM_1_C_7, PLANE_BUF_CFG_1_C, SPCCNTR, PIPE_EDP_CONF, PCH_FDI_CHICKEN_B_C, QUIRK_C2004, SFUSE_STRAP, PCH_DSPCLK_GATE_D, SDEISR, SDEIMR, SDEIIR, SDEIER, SHOTPLUG_CTL, PCH_GMBUS0, PCH_GMBUS1, PCH_GMBUS2, PCH_GMBUS3, PCH_GMBUS4, PCH_GMBUS5, SBI_ADDR, SBI_DATA, SBI_CTL_STAT, PCH_DPLL_A, PCH_DPLL_B, PCH_PIXCLK_GATE, PCH_FPA0, PCH_FPA1, PCH_FPB0, PCH_FPB1, PCH_DREF_CONTROL, PCH_RAWCLK_FREQ, PCH_DPLL_SEL, PCH_PP_STATUS, PCH_PP_CONTROL, PCH_PP_ON_DELAYS, PCH_PP_OFF_DELAYS, PCH_PP_DIVISOR, BLC_PWM_PCH_CTL1, BLC_PWM_PCH_CTL2, TRANS_HTOTAL_A, TRANS_HBLANK_A, TRANS_HSYNC_A, TRANS_VTOTAL_A, TRANS_VBLANK_A, TRANS_VSYNC_A, TRANS_VSYNCSHIFT_A, TRANSA_DATA_M1, TRANSA_DATA_N1, TRANSA_DP_LINK_M1, TRANSA_DP_LINK_N1, TRANS_DP_CTL_A, TRANS_HTOTAL_B, TRANS_HBLANK_B, TRANS_HSYNC_B, TRANS_VTOTAL_B, TRANS_VBLANK_B, TRANS_VSYNC_B, TRANS_VSYNCSHIFT_B, TRANSB_DATA_M1, TRANSB_DATA_N1, TRANSB_DP_LINK_M1, TRANSB_DP_LINK_N1, PCH_ADPA, PCH_HDMIB, PCH_HDMIC, PCH_HDMID, PCH_LVDS, TRANS_DP_CTL_B, TRANS_HTOTAL_C, TRANS_HBLANK_C, TRANS_HSYNC_C, TRANS_VTOTAL_C, TRANS_VBLANK_C, TRANS_VSYNC_C, TRANS_VSYNCSHIFT_C, TRANSC_DATA_M1, TRANSC_DATA_N1, TRANSC_DP_LINK_M1, TRANSC_DP_LINK_N1, TRANS_DP_CTL_C, PCH_DP_B, PCH_DP_AUX_CTL_B, PCH_DP_AUX_DATA_B_1, PCH_DP_AUX_DATA_B_2, PCH_DP_AUX_DATA_B_3, PCH_DP_AUX_DATA_B_4, PCH_DP_AUX_DATA_B_5, PCH_DP_C, PCH_DP_AUX_CTL_C, PCH_DP_AUX_DATA_C_1, PCH_DP_AUX_DATA_C_2, PCH_DP_AUX_DATA_C_3, PCH_DP_AUX_DATA_C_4, PCH_DP_AUX_DATA_C_5, PCH_DP_D, PCH_DP_AUX_CTL_D, PCH_DP_AUX_DATA_D_1, PCH_DP_AUX_DATA_D_2, PCH_DP_AUX_DATA_D_3, PCH_DP_AUX_DATA_D_4, PCH_DP_AUX_DATA_D_5, AUD_CONFIG_A, PCH_AUD_VID_DID, AUD_HDMIW_HDMIEDID_A, AUD_CNTL_ST_A, AUD_CNTRL_ST2, AUD_CONFIG_B, AUD_HDMIW_HDMIEDID_B, AUD_CNTL_ST_B, AUD_CONFIG_C, AUD_HDMIW_HDMIEDID_C, AUD_CNTL_ST_C, TRANSACONF, FDI_RXA_CTL, FDI_RX_MISC_A, FDI_RXA_IIR, FDI_RXA_IMR, FDI_RXA_TUSIZE1, QUIRK_F0060, TRANSA_CHICKEN2, TRANSBCONF, FDI_RXB_CTL, FDI_RX_MISC_B, FDI_RXB_IIR, FDI_RXB_IMR, FDI_RXB_TUSIZE1, QUIRK_F1060, TRANSB_CHICKEN2, TRANSCCONF, FDI_RXC_CTL, FDI_RX_MISC_C, FDI_RXC_IIR, FDI_RXC_IMR, FDI_RXC_TUSIZE1, QUIRK_F2060, TRANSC_CHICKEN2, BXT_P_CR_GT_DISP_PWRON, GT_MAILBOX, GT_MAILBOX_DATA, GT_MAILBOX_DATA_1, BXT_PORT_CL1CM_DW0_A, BXT_PORT_CL1CM_DW9_A, BXT_PORT_CL1CM_DW10_A, BXT_PORT_PLL_EBB_0_A, BXT_PORT_PLL_EBB_4_A, BXT_PORT_CL1CM_DW28_A, BXT_PORT_CL1CM_DW30_A, BXT_PORT_PLL_0_A, BXT_PORT_PLL_1_A, BXT_PORT_PLL_2_A, BXT_PORT_PLL_3_A, BXT_PORT_PLL_6_A, BXT_PORT_PLL_8_A, BXT_PORT_PLL_9_A, BXT_PORT_PLL_10_A, BXT_PORT_REF_DW3_A, BXT_PORT_REF_DW6_A, BXT_PORT_REF_DW8_A, BXT_PORT_PCS_DW10_01_A, BXT_PORT_PCS_DW12_01_A, BXT_PORT_TX_DW2_LN0_A, BXT_PORT_TX_DW3_LN0_A, BXT_PORT_TX_DW4_LN0_A, BXT_PORT_TX_DW14_LN0_A, BXT_PORT_TX_DW14_LN1_A, BXT_PORT_TX_DW14_LN2_A, BXT_PORT_TX_DW14_LN3_A, BXT_PORT_PCS_DW10_GRP_A, BXT_PORT_PCS_DW12_GRP_A, BXT_PORT_TX_DW2_GRP_A, BXT_PORT_TX_DW3_GRP_A, BXT_PORT_TX_DW4_GRP_A); pragma Warnings (GNATprove, Off, "pragma ""KEEP_NAMES"" ignored *(not yet supported)", Reason => "TODO: Should it matter?"); pragma Keep_Names (Registers_Invalid_Index); pragma Warnings (GNATprove, On, "pragma ""KEEP_NAMES"" ignored *(not yet supported)"); Register_Width : constant := 4; for Registers_Invalid_Index use (Invalid_Register => 0, --------------------------------------------------------------------------- -- Pipe A registers --------------------------------------------------------------------------- -- pipe timing registers HTOTAL_A => 16#06_0000# / Register_Width, HBLANK_A => 16#06_0004# / Register_Width, HSYNC_A => 16#06_0008# / Register_Width, VTOTAL_A => 16#06_000c# / Register_Width, VBLANK_A => 16#06_0010# / Register_Width, VSYNC_A => 16#06_0014# / Register_Width, PIPEASRC => 16#06_001c# / Register_Width, PIPEACONF => 16#07_0008# / Register_Width, PIPEAMISC => 16#07_0030# / Register_Width, TRANS_HTOTAL_A => 16#0e_0000# / Register_Width, TRANS_HBLANK_A => 16#0e_0004# / Register_Width, TRANS_HSYNC_A => 16#0e_0008# / Register_Width, TRANS_VTOTAL_A => 16#0e_000c# / Register_Width, TRANS_VBLANK_A => 16#0e_0010# / Register_Width, TRANS_VSYNC_A => 16#0e_0014# / Register_Width, TRANSA_DATA_M1 => 16#0e_0030# / Register_Width, TRANSA_DATA_N1 => 16#0e_0034# / Register_Width, TRANSA_DP_LINK_M1 => 16#0e_0040# / Register_Width, TRANSA_DP_LINK_N1 => 16#0e_0044# / Register_Width, PIPEA_DATA_M1 => 16#06_0030# / Register_Width, PIPEA_DATA_N1 => 16#06_0034# / Register_Width, PIPEA_LINK_M1 => 16#06_0040# / Register_Width, PIPEA_LINK_N1 => 16#06_0044# / Register_Width, PIPEA_GMCH_DATA_M => 16#07_0050# / Register_Width, PIPEA_GMCH_DATA_N => 16#07_0054# / Register_Width, PIPEA_GMCH_LINK_M => 16#07_0060# / Register_Width, PIPEA_GMCH_LINK_N => 16#07_0064# / Register_Width, PIPEA_DDI_FUNC_CTL => 16#06_0400# / Register_Width, PIPEA_MSA_MISC => 16#06_0410# / Register_Width, -- PCH sideband interface registers SBI_ADDR => 16#0c_6000# / Register_Width, SBI_DATA => 16#0c_6004# / Register_Width, SBI_CTL_STAT => 16#0c_6008# / Register_Width, -- GMCH clock registers GMCH_DPLL_A => 16#00_6014# / Register_Width, GMCH_FPA0 => 16#00_6040# / Register_Width, GMCH_FPA1 => 16#00_6044# / Register_Width, -- PCH clock registers PCH_DPLL_A => 16#0c_6014# / Register_Width, PCH_PIXCLK_GATE => 16#0c_6020# / Register_Width, PCH_FPA0 => 16#0c_6040# / Register_Width, PCH_FPA1 => 16#0c_6044# / Register_Width, -- panel fitter PFA_CTL_1 => 16#06_8080# / Register_Width, PFA_WIN_POS => 16#06_8070# / Register_Width, PFA_WIN_SZ => 16#06_8074# / Register_Width, PS_WIN_POS_1_A => 16#06_8170# / Register_Width, PS_WIN_SZ_1_A => 16#06_8174# / Register_Width, PS_CTRL_1_A => 16#06_8180# / Register_Width, PS_WIN_POS_2_A => 16#06_8270# / Register_Width, PS_WIN_SZ_2_A => 16#06_8274# / Register_Width, PS_CTRL_2_A => 16#06_8280# / Register_Width, -- cursor control CUR_CTL_A => 16#07_0080# / Register_Width, CUR_BASE_A => 16#07_0084# / Register_Width, CUR_POS_A => 16#07_0088# / Register_Width, CUR_FBC_CTL_A => 16#07_00a0# / Register_Width, -- display control DSPACNTR => 16#07_0180# / Register_Width, DSPALINOFF => 16#07_0184# / Register_Width, DSPASTRIDE => 16#07_0188# / Register_Width, PLANE_POS_1_A => 16#07_018c# / Register_Width, PLANE_SIZE_1_A => 16#07_0190# / Register_Width, DSPASURF => 16#07_019c# / Register_Width, DSPATILEOFF => 16#07_01a4# / Register_Width, -- sprite control SPACNTR => 16#07_0280# / Register_Width, -- FDI and PCH transcoder control FDI_TX_CTL_A => 16#06_0100# / Register_Width, FDI_RXA_CTL => 16#0f_000c# / Register_Width, FDI_RX_MISC_A => 16#0f_0010# / Register_Width, FDI_RXA_IIR => 16#0f_0014# / Register_Width, FDI_RXA_IMR => 16#0f_0018# / Register_Width, FDI_RXA_TUSIZE1 => 16#0f_0030# / Register_Width, TRANSACONF => 16#0f_0008# / Register_Width, TRANSA_CHICKEN2 => 16#0f_0064# / Register_Width, -- watermark registers WM_LINETIME_A => 16#04_5270# / Register_Width, PLANE_WM_1_A_0 => 16#07_0240# / Register_Width, PLANE_WM_1_A_1 => 16#07_0244# / Register_Width, PLANE_WM_1_A_2 => 16#07_0248# / Register_Width, PLANE_WM_1_A_3 => 16#07_024c# / Register_Width, PLANE_WM_1_A_4 => 16#07_0250# / Register_Width, PLANE_WM_1_A_5 => 16#07_0254# / Register_Width, PLANE_WM_1_A_6 => 16#07_0258# / Register_Width, PLANE_WM_1_A_7 => 16#07_025c# / Register_Width, PLANE_BUF_CFG_1_A => 16#07_027c# / Register_Width, CUR_WM_A_0 => 16#07_0140# / Register_Width, CUR_WM_A_1 => 16#07_0144# / Register_Width, CUR_WM_A_2 => 16#07_0148# / Register_Width, CUR_WM_A_3 => 16#07_014c# / Register_Width, CUR_WM_A_4 => 16#07_0150# / Register_Width, CUR_WM_A_5 => 16#07_0154# / Register_Width, CUR_WM_A_6 => 16#07_0158# / Register_Width, CUR_WM_A_7 => 16#07_015c# / Register_Width, CUR_BUF_CFG_A => 16#07_017c# / Register_Width, -- CPU transcoder clock select TRANSA_CLK_SEL => 16#04_6140# / Register_Width, --------------------------------------------------------------------------- -- Pipe B registers --------------------------------------------------------------------------- -- pipe timing registers HTOTAL_B => 16#06_1000# / Register_Width, HBLANK_B => 16#06_1004# / Register_Width, HSYNC_B => 16#06_1008# / Register_Width, VTOTAL_B => 16#06_100c# / Register_Width, VBLANK_B => 16#06_1010# / Register_Width, VSYNC_B => 16#06_1014# / Register_Width, PIPEBSRC => 16#06_101c# / Register_Width, PIPEBCONF => 16#07_1008# / Register_Width, PIPEBMISC => 16#07_1030# / Register_Width, TRANS_HTOTAL_B => 16#0e_1000# / Register_Width, TRANS_HBLANK_B => 16#0e_1004# / Register_Width, TRANS_HSYNC_B => 16#0e_1008# / Register_Width, TRANS_VTOTAL_B => 16#0e_100c# / Register_Width, TRANS_VBLANK_B => 16#0e_1010# / Register_Width, TRANS_VSYNC_B => 16#0e_1014# / Register_Width, TRANSB_DATA_M1 => 16#0e_1030# / Register_Width, TRANSB_DATA_N1 => 16#0e_1034# / Register_Width, TRANSB_DP_LINK_M1 => 16#0e_1040# / Register_Width, TRANSB_DP_LINK_N1 => 16#0e_1044# / Register_Width, PIPEB_DATA_M1 => 16#06_1030# / Register_Width, PIPEB_DATA_N1 => 16#06_1034# / Register_Width, PIPEB_LINK_M1 => 16#06_1040# / Register_Width, PIPEB_LINK_N1 => 16#06_1044# / Register_Width, PIPEB_GMCH_DATA_M => 16#07_1050# / Register_Width, PIPEB_GMCH_DATA_N => 16#07_1054# / Register_Width, PIPEB_GMCH_LINK_M => 16#07_1060# / Register_Width, PIPEB_GMCH_LINK_N => 16#07_1064# / Register_Width, PIPEB_DDI_FUNC_CTL => 16#06_1400# / Register_Width, PIPEB_MSA_MISC => 16#06_1410# / Register_Width, -- GMCH clock registers GMCH_DPLL_B => 16#00_6018# / Register_Width, GMCH_FPB0 => 16#00_6048# / Register_Width, GMCH_FPB1 => 16#00_604c# / Register_Width, -- PCH clock registers PCH_DPLL_B => 16#0c_6018# / Register_Width, PCH_FPB0 => 16#0c_6048# / Register_Width, PCH_FPB1 => 16#0c_604c# / Register_Width, -- panel fitter PFB_CTL_1 => 16#06_8880# / Register_Width, PFB_WIN_POS => 16#06_8870# / Register_Width, PFB_WIN_SZ => 16#06_8874# / Register_Width, PS_WIN_POS_1_B => 16#06_8970# / Register_Width, PS_WIN_SZ_1_B => 16#06_8974# / Register_Width, PS_CTRL_1_B => 16#06_8980# / Register_Width, PS_WIN_POS_2_B => 16#06_8a70# / Register_Width, PS_WIN_SZ_2_B => 16#06_8a74# / Register_Width, PS_CTRL_2_B => 16#06_8a80# / Register_Width, -- cursor control CUR_CTL_B => 16#07_1080# / Register_Width, CUR_BASE_B => 16#07_1084# / Register_Width, CUR_POS_B => 16#07_1088# / Register_Width, CUR_FBC_CTL_B => 16#07_10a0# / Register_Width, -- display control DSPBCNTR => 16#07_1180# / Register_Width, DSPBLINOFF => 16#07_1184# / Register_Width, DSPBSTRIDE => 16#07_1188# / Register_Width, PLANE_POS_1_B => 16#07_118c# / Register_Width, PLANE_SIZE_1_B => 16#07_1190# / Register_Width, DSPBSURF => 16#07_119c# / Register_Width, DSPBTILEOFF => 16#07_11a4# / Register_Width, -- sprite control SPBCNTR => 16#07_1280# / Register_Width, -- FDI and PCH transcoder control FDI_TX_CTL_B => 16#06_1100# / Register_Width, -- aliased by GMCH_ADPA FDI_RXB_CTL => 16#0f_100c# / Register_Width, FDI_RX_MISC_B => 16#0f_1010# / Register_Width, FDI_RXB_IIR => 16#0f_1014# / Register_Width, FDI_RXB_IMR => 16#0f_1018# / Register_Width, FDI_RXB_TUSIZE1 => 16#0f_1030# / Register_Width, TRANSBCONF => 16#0f_1008# / Register_Width, TRANSB_CHICKEN2 => 16#0f_1064# / Register_Width, -- watermark registers WM_LINETIME_B => 16#04_5274# / Register_Width, PLANE_WM_1_B_0 => 16#07_1240# / Register_Width, PLANE_WM_1_B_1 => 16#07_1244# / Register_Width, PLANE_WM_1_B_2 => 16#07_1248# / Register_Width, PLANE_WM_1_B_3 => 16#07_124c# / Register_Width, PLANE_WM_1_B_4 => 16#07_1250# / Register_Width, PLANE_WM_1_B_5 => 16#07_1254# / Register_Width, PLANE_WM_1_B_6 => 16#07_1258# / Register_Width, PLANE_WM_1_B_7 => 16#07_125c# / Register_Width, PLANE_BUF_CFG_1_B => 16#07_127c# / Register_Width, CUR_WM_B_0 => 16#07_1140# / Register_Width, CUR_WM_B_1 => 16#07_1144# / Register_Width, CUR_WM_B_2 => 16#07_1148# / Register_Width, CUR_WM_B_3 => 16#07_114c# / Register_Width, CUR_WM_B_4 => 16#07_1150# / Register_Width, CUR_WM_B_5 => 16#07_1154# / Register_Width, CUR_WM_B_6 => 16#07_1158# / Register_Width, CUR_WM_B_7 => 16#07_115c# / Register_Width, CUR_BUF_CFG_B => 16#07_117c# / Register_Width, -- CPU transcoder clock select TRANSB_CLK_SEL => 16#04_6144# / Register_Width, --------------------------------------------------------------------------- -- Pipe C registers --------------------------------------------------------------------------- -- pipe timing registers HTOTAL_C => 16#06_2000# / Register_Width, HBLANK_C => 16#06_2004# / Register_Width, HSYNC_C => 16#06_2008# / Register_Width, VTOTAL_C => 16#06_200c# / Register_Width, VBLANK_C => 16#06_2010# / Register_Width, VSYNC_C => 16#06_2014# / Register_Width, PIPECSRC => 16#06_201c# / Register_Width, PIPECCONF => 16#07_2008# / Register_Width, PIPECMISC => 16#07_2030# / Register_Width, TRANS_HTOTAL_C => 16#0e_2000# / Register_Width, TRANS_HBLANK_C => 16#0e_2004# / Register_Width, TRANS_HSYNC_C => 16#0e_2008# / Register_Width, TRANS_VTOTAL_C => 16#0e_200c# / Register_Width, TRANS_VBLANK_C => 16#0e_2010# / Register_Width, TRANS_VSYNC_C => 16#0e_2014# / Register_Width, TRANSC_DATA_M1 => 16#0e_2030# / Register_Width, TRANSC_DATA_N1 => 16#0e_2034# / Register_Width, TRANSC_DP_LINK_M1 => 16#0e_2040# / Register_Width, TRANSC_DP_LINK_N1 => 16#0e_2044# / Register_Width, PIPEC_DATA_M1 => 16#06_2030# / Register_Width, PIPEC_DATA_N1 => 16#06_2034# / Register_Width, PIPEC_LINK_M1 => 16#06_2040# / Register_Width, PIPEC_LINK_N1 => 16#06_2044# / Register_Width, PIPEC_DDI_FUNC_CTL => 16#06_2400# / Register_Width, PIPEC_MSA_MISC => 16#06_2410# / Register_Width, -- panel fitter PFC_CTL_1 => 16#06_9080# / Register_Width, PFC_WIN_POS => 16#06_9070# / Register_Width, PFC_WIN_SZ => 16#06_9074# / Register_Width, PS_WIN_POS_1_C => 16#06_9170# / Register_Width, PS_WIN_SZ_1_C => 16#06_9174# / Register_Width, PS_CTRL_1_C => 16#06_9180# / Register_Width, -- cursor control CUR_CTL_C => 16#07_2080# / Register_Width, CUR_BASE_C => 16#07_2084# / Register_Width, CUR_POS_C => 16#07_2088# / Register_Width, CUR_FBC_CTL_C => 16#07_20a0# / Register_Width, -- display control DSPCCNTR => 16#07_2180# / Register_Width, DSPCLINOFF => 16#07_2184# / Register_Width, DSPCSTRIDE => 16#07_2188# / Register_Width, PLANE_POS_1_C => 16#07_218c# / Register_Width, PLANE_SIZE_1_C => 16#07_2190# / Register_Width, DSPCSURF => 16#07_219c# / Register_Width, DSPCTILEOFF => 16#07_21a4# / Register_Width, -- sprite control SPCCNTR => 16#07_2280# / Register_Width, -- PCH transcoder control FDI_TX_CTL_C => 16#06_2100# / Register_Width, FDI_RXC_CTL => 16#0f_200c# / Register_Width, FDI_RX_MISC_C => 16#0f_2010# / Register_Width, FDI_RXC_IIR => 16#0f_2014# / Register_Width, FDI_RXC_IMR => 16#0f_2018# / Register_Width, FDI_RXC_TUSIZE1 => 16#0f_2030# / Register_Width, TRANSCCONF => 16#0f_2008# / Register_Width, TRANSC_CHICKEN2 => 16#0f_2064# / Register_Width, -- watermark registers WM_LINETIME_C => 16#04_5278# / Register_Width, PLANE_WM_1_C_0 => 16#07_2240# / Register_Width, PLANE_WM_1_C_1 => 16#07_2244# / Register_Width, PLANE_WM_1_C_2 => 16#07_2248# / Register_Width, PLANE_WM_1_C_3 => 16#07_224c# / Register_Width, PLANE_WM_1_C_4 => 16#07_2250# / Register_Width, PLANE_WM_1_C_5 => 16#07_2254# / Register_Width, PLANE_WM_1_C_6 => 16#07_2258# / Register_Width, PLANE_WM_1_C_7 => 16#07_225c# / Register_Width, PLANE_BUF_CFG_1_C => 16#07_227c# / Register_Width, CUR_WM_C_0 => 16#07_2140# / Register_Width, CUR_WM_C_1 => 16#07_2144# / Register_Width, CUR_WM_C_2 => 16#07_2148# / Register_Width, CUR_WM_C_3 => 16#07_214c# / Register_Width, CUR_WM_C_4 => 16#07_2150# / Register_Width, CUR_WM_C_5 => 16#07_2154# / Register_Width, CUR_WM_C_6 => 16#07_2158# / Register_Width, CUR_WM_C_7 => 16#07_215c# / Register_Width, CUR_BUF_CFG_C => 16#07_217c# / Register_Width, -- CPU transcoder clock select TRANSC_CLK_SEL => 16#04_6148# / Register_Width, --------------------------------------------------------------------------- -- Pipe EDP registers --------------------------------------------------------------------------- -- pipe timing registers HTOTAL_EDP => 16#06_f000# / Register_Width, HBLANK_EDP => 16#06_f004# / Register_Width, HSYNC_EDP => 16#06_f008# / Register_Width, VTOTAL_EDP => 16#06_f00c# / Register_Width, VBLANK_EDP => 16#06_f010# / Register_Width, VSYNC_EDP => 16#06_f014# / Register_Width, PIPE_EDP_CONF => 16#07_f008# / Register_Width, PIPE_EDP_DATA_M1 => 16#06_f030# / Register_Width, PIPE_EDP_DATA_N1 => 16#06_f034# / Register_Width, PIPE_EDP_LINK_M1 => 16#06_f040# / Register_Width, PIPE_EDP_LINK_N1 => 16#06_f044# / Register_Width, PIPE_EDP_DDI_FUNC_CTL => 16#06_f400# / Register_Width, PIPE_EDP_MSA_MISC => 16#06_f410# / Register_Width, -- PSR registers SRD_CTL => 16#06_4800# / Register_Width, SRD_CTL_A => 16#06_0800# / Register_Width, SRD_CTL_B => 16#06_1800# / Register_Width, SRD_CTL_C => 16#06_2800# / Register_Width, SRD_CTL_EDP => 16#06_f800# / Register_Width, SRD_STATUS => 16#06_4840# / Register_Width, SRD_STATUS_A => 16#06_0840# / Register_Width, SRD_STATUS_B => 16#06_1840# / Register_Width, SRD_STATUS_C => 16#06_2840# / Register_Width, SRD_STATUS_EDP => 16#06_f840# / Register_Width, -- DDI registers DDI_BUF_CTL_A => 16#06_4000# / Register_Width, -- aliased by DP_CTL_A DDI_BUF_TRANS_A_S0T1 => 16#06_4e00# / Register_Width, DDI_BUF_TRANS_A_S0T2 => 16#06_4e04# / Register_Width, DDI_BUF_TRANS_A_S1T1 => 16#06_4e08# / Register_Width, DDI_BUF_TRANS_A_S1T2 => 16#06_4e0c# / Register_Width, DDI_BUF_TRANS_A_S2T1 => 16#06_4e10# / Register_Width, DDI_BUF_TRANS_A_S2T2 => 16#06_4e14# / Register_Width, DDI_BUF_TRANS_A_S3T1 => 16#06_4e18# / Register_Width, DDI_BUF_TRANS_A_S3T2 => 16#06_4e1c# / Register_Width, DDI_BUF_TRANS_A_S4T1 => 16#06_4e20# / Register_Width, DDI_BUF_TRANS_A_S4T2 => 16#06_4e24# / Register_Width, DDI_BUF_TRANS_A_S5T1 => 16#06_4e28# / Register_Width, DDI_BUF_TRANS_A_S5T2 => 16#06_4e2c# / Register_Width, DDI_BUF_TRANS_A_S6T1 => 16#06_4e30# / Register_Width, DDI_BUF_TRANS_A_S6T2 => 16#06_4e34# / Register_Width, DDI_BUF_TRANS_A_S7T1 => 16#06_4e38# / Register_Width, DDI_BUF_TRANS_A_S7T2 => 16#06_4e3c# / Register_Width, DDI_BUF_TRANS_A_S8T1 => 16#06_4e40# / Register_Width, DDI_BUF_TRANS_A_S8T2 => 16#06_4e44# / Register_Width, DDI_BUF_TRANS_A_S9T1 => 16#06_4e48# / Register_Width, DDI_BUF_TRANS_A_S9T2 => 16#06_4e4c# / Register_Width, DDI_AUX_CTL_A => 16#06_4010# / Register_Width, -- aliased by DP_AUX_CTL_A DDI_AUX_DATA_A_1 => 16#06_4014# / Register_Width, -- aliased by DP_AUX_DATA_A_1 DDI_AUX_DATA_A_2 => 16#06_4018# / Register_Width, -- aliased by DP_AUX_DATA_A_2 DDI_AUX_DATA_A_3 => 16#06_401c# / Register_Width, -- aliased by DP_AUX_DATA_A_3 DDI_AUX_DATA_A_4 => 16#06_4020# / Register_Width, -- aliased by DP_AUX_DATA_A_4 DDI_AUX_DATA_A_5 => 16#06_4024# / Register_Width, -- aliased by DP_AUX_DATA_A_5 DDI_AUX_MUTEX_A => 16#06_402c# / Register_Width, DDI_BUF_CTL_B => 16#06_4100# / Register_Width, -- aliased by GMCH_DP_B DDI_BUF_TRANS_B_S0T1 => 16#06_4e60# / Register_Width, DDI_BUF_TRANS_B_S0T2 => 16#06_4e64# / Register_Width, DDI_BUF_TRANS_B_S1T1 => 16#06_4e68# / Register_Width, DDI_BUF_TRANS_B_S1T2 => 16#06_4e6c# / Register_Width, DDI_BUF_TRANS_B_S2T1 => 16#06_4e70# / Register_Width, DDI_BUF_TRANS_B_S2T2 => 16#06_4e74# / Register_Width, DDI_BUF_TRANS_B_S3T1 => 16#06_4e78# / Register_Width, DDI_BUF_TRANS_B_S3T2 => 16#06_4e7c# / Register_Width, DDI_BUF_TRANS_B_S4T1 => 16#06_4e80# / Register_Width, DDI_BUF_TRANS_B_S4T2 => 16#06_4e84# / Register_Width, DDI_BUF_TRANS_B_S5T1 => 16#06_4e88# / Register_Width, DDI_BUF_TRANS_B_S5T2 => 16#06_4e8c# / Register_Width, DDI_BUF_TRANS_B_S6T1 => 16#06_4e90# / Register_Width, DDI_BUF_TRANS_B_S6T2 => 16#06_4e94# / Register_Width, DDI_BUF_TRANS_B_S7T1 => 16#06_4e98# / Register_Width, DDI_BUF_TRANS_B_S7T2 => 16#06_4e9c# / Register_Width, DDI_BUF_TRANS_B_S8T1 => 16#06_4ea0# / Register_Width, DDI_BUF_TRANS_B_S8T2 => 16#06_4ea4# / Register_Width, DDI_BUF_TRANS_B_S9T1 => 16#06_4ea8# / Register_Width, DDI_BUF_TRANS_B_S9T2 => 16#06_4eac# / Register_Width, DDI_AUX_CTL_B => 16#06_4110# / Register_Width, DDI_AUX_DATA_B_1 => 16#06_4114# / Register_Width, DDI_AUX_DATA_B_2 => 16#06_4118# / Register_Width, DDI_AUX_DATA_B_3 => 16#06_411c# / Register_Width, DDI_AUX_DATA_B_4 => 16#06_4120# / Register_Width, DDI_AUX_DATA_B_5 => 16#06_4124# / Register_Width, DDI_AUX_MUTEX_B => 16#06_412c# / Register_Width, DDI_BUF_CTL_C => 16#06_4200# / Register_Width, -- aliased by GMCH_DP_C DDI_BUF_TRANS_C_S0T1 => 16#06_4ec0# / Register_Width, DDI_BUF_TRANS_C_S0T2 => 16#06_4ec4# / Register_Width, DDI_BUF_TRANS_C_S1T1 => 16#06_4ec8# / Register_Width, DDI_BUF_TRANS_C_S1T2 => 16#06_4ecc# / Register_Width, DDI_BUF_TRANS_C_S2T1 => 16#06_4ed0# / Register_Width, DDI_BUF_TRANS_C_S2T2 => 16#06_4ed4# / Register_Width, DDI_BUF_TRANS_C_S3T1 => 16#06_4ed8# / Register_Width, DDI_BUF_TRANS_C_S3T2 => 16#06_4edc# / Register_Width, DDI_BUF_TRANS_C_S4T1 => 16#06_4ee0# / Register_Width, DDI_BUF_TRANS_C_S4T2 => 16#06_4ee4# / Register_Width, DDI_BUF_TRANS_C_S5T1 => 16#06_4ee8# / Register_Width, DDI_BUF_TRANS_C_S5T2 => 16#06_4eec# / Register_Width, DDI_BUF_TRANS_C_S6T1 => 16#06_4ef0# / Register_Width, DDI_BUF_TRANS_C_S6T2 => 16#06_4ef4# / Register_Width, DDI_BUF_TRANS_C_S7T1 => 16#06_4ef8# / Register_Width, DDI_BUF_TRANS_C_S7T2 => 16#06_4efc# / Register_Width, DDI_BUF_TRANS_C_S8T1 => 16#06_4f00# / Register_Width, DDI_BUF_TRANS_C_S8T2 => 16#06_4f04# / Register_Width, DDI_BUF_TRANS_C_S9T1 => 16#06_4f08# / Register_Width, DDI_BUF_TRANS_C_S9T2 => 16#06_4f0c# / Register_Width, DDI_AUX_CTL_C => 16#06_4210# / Register_Width, DDI_AUX_DATA_C_1 => 16#06_4214# / Register_Width, DDI_AUX_DATA_C_2 => 16#06_4218# / Register_Width, DDI_AUX_DATA_C_3 => 16#06_421c# / Register_Width, DDI_AUX_DATA_C_4 => 16#06_4220# / Register_Width, DDI_AUX_DATA_C_5 => 16#06_4224# / Register_Width, DDI_AUX_MUTEX_C => 16#06_422c# / Register_Width, DDI_BUF_CTL_D => 16#06_4300# / Register_Width, -- aliased by GMCH_DP_D DDI_BUF_TRANS_D_S0T1 => 16#06_4f20# / Register_Width, DDI_BUF_TRANS_D_S0T2 => 16#06_4f24# / Register_Width, DDI_BUF_TRANS_D_S1T1 => 16#06_4f28# / Register_Width, DDI_BUF_TRANS_D_S1T2 => 16#06_4f2c# / Register_Width, DDI_BUF_TRANS_D_S2T1 => 16#06_4f30# / Register_Width, DDI_BUF_TRANS_D_S2T2 => 16#06_4f34# / Register_Width, DDI_BUF_TRANS_D_S3T1 => 16#06_4f38# / Register_Width, DDI_BUF_TRANS_D_S3T2 => 16#06_4f3c# / Register_Width, DDI_BUF_TRANS_D_S4T1 => 16#06_4f40# / Register_Width, DDI_BUF_TRANS_D_S4T2 => 16#06_4f44# / Register_Width, DDI_BUF_TRANS_D_S5T1 => 16#06_4f48# / Register_Width, DDI_BUF_TRANS_D_S5T2 => 16#06_4f4c# / Register_Width, DDI_BUF_TRANS_D_S6T1 => 16#06_4f50# / Register_Width, DDI_BUF_TRANS_D_S6T2 => 16#06_4f54# / Register_Width, DDI_BUF_TRANS_D_S7T1 => 16#06_4f58# / Register_Width, DDI_BUF_TRANS_D_S7T2 => 16#06_4f5c# / Register_Width, DDI_BUF_TRANS_D_S8T1 => 16#06_4f60# / Register_Width, DDI_BUF_TRANS_D_S8T2 => 16#06_4f64# / Register_Width, DDI_BUF_TRANS_D_S9T1 => 16#06_4f68# / Register_Width, DDI_BUF_TRANS_D_S9T2 => 16#06_4f6c# / Register_Width, DDI_AUX_CTL_D => 16#06_4310# / Register_Width, DDI_AUX_DATA_D_1 => 16#06_4314# / Register_Width, DDI_AUX_DATA_D_2 => 16#06_4318# / Register_Width, DDI_AUX_DATA_D_3 => 16#06_431c# / Register_Width, DDI_AUX_DATA_D_4 => 16#06_4320# / Register_Width, DDI_AUX_DATA_D_5 => 16#06_4324# / Register_Width, DDI_AUX_MUTEX_D => 16#06_432c# / Register_Width, DDI_BUF_CTL_E => 16#06_4400# / Register_Width, DDI_BUF_TRANS_E_S0T1 => 16#06_4f80# / Register_Width, DDI_BUF_TRANS_E_S0T2 => 16#06_4f84# / Register_Width, DDI_BUF_TRANS_E_S1T1 => 16#06_4f88# / Register_Width, DDI_BUF_TRANS_E_S1T2 => 16#06_4f8c# / Register_Width, DDI_BUF_TRANS_E_S2T1 => 16#06_4f90# / Register_Width, DDI_BUF_TRANS_E_S2T2 => 16#06_4f94# / Register_Width, DDI_BUF_TRANS_E_S3T1 => 16#06_4f98# / Register_Width, DDI_BUF_TRANS_E_S3T2 => 16#06_4f9c# / Register_Width, DDI_BUF_TRANS_E_S4T1 => 16#06_4fa0# / Register_Width, DDI_BUF_TRANS_E_S4T2 => 16#06_4fa4# / Register_Width, DDI_BUF_TRANS_E_S5T1 => 16#06_4fa8# / Register_Width, DDI_BUF_TRANS_E_S5T2 => 16#06_4fac# / Register_Width, DDI_BUF_TRANS_E_S6T1 => 16#06_4fb0# / Register_Width, DDI_BUF_TRANS_E_S6T2 => 16#06_4fb4# / Register_Width, DDI_BUF_TRANS_E_S7T1 => 16#06_4fb8# / Register_Width, DDI_BUF_TRANS_E_S7T2 => 16#06_4fbc# / Register_Width, DDI_BUF_TRANS_E_S8T1 => 16#06_4fc0# / Register_Width, DDI_BUF_TRANS_E_S8T2 => 16#06_4fc4# / Register_Width, DDI_BUF_TRANS_E_S9T1 => 16#06_4fc8# / Register_Width, DDI_BUF_TRANS_E_S9T2 => 16#06_4fcc# / Register_Width, DP_TP_CTL_A => 16#06_4040# / Register_Width, DP_TP_CTL_B => 16#06_4140# / Register_Width, DP_TP_CTL_C => 16#06_4240# / Register_Width, DP_TP_CTL_D => 16#06_4340# / Register_Width, DP_TP_CTL_E => 16#06_4440# / Register_Width, DP_TP_STATUS_B => 16#06_4144# / Register_Width, DP_TP_STATUS_C => 16#06_4244# / Register_Width, DP_TP_STATUS_D => 16#06_4344# / Register_Width, DP_TP_STATUS_E => 16#06_4444# / Register_Width, PORT_CLK_SEL_DDIA => 16#04_6100# / Register_Width, PORT_CLK_SEL_DDIB => 16#04_6104# / Register_Width, PORT_CLK_SEL_DDIC => 16#04_6108# / Register_Width, PORT_CLK_SEL_DDID => 16#04_610c# / Register_Width, PORT_CLK_SEL_DDIE => 16#04_6110# / Register_Width, -- Skylake I_boost configuration DISPIO_CR_TX_BMU_CR0 => 16#06_c00c# / Register_Width, -- Skylake DPLL registers DPLL1_CFGR1 => 16#06_c040# / Register_Width, DPLL1_CFGR2 => 16#06_c044# / Register_Width, DPLL2_CFGR1 => 16#06_c048# / Register_Width, DPLL2_CFGR2 => 16#06_c04c# / Register_Width, DPLL3_CFGR1 => 16#06_c050# / Register_Width, DPLL3_CFGR2 => 16#06_c054# / Register_Width, DPLL_CTRL1 => 16#06_c058# / Register_Width, DPLL_CTRL2 => 16#06_c05c# / Register_Width, DPLL_STATUS => 16#06_c060# / Register_Width, -- CD CLK register CDCLK_CTL => 16#04_6000# / Register_Width, -- Skylake LCPLL registers LCPLL1_CTL => 16#04_6010# / Register_Width, LCPLL2_CTL => 16#04_6014# / Register_Width, -- SPLL register SPLL_CTL => 16#04_6020# / Register_Width, -- WRPLL registers WRPLL_CTL_1 => 16#04_6040# / Register_Width, WRPLL_CTL_2 => 16#04_6060# / Register_Width, -- Broxton Display Engine PLL registers BXT_DE_PLL_CTL => 16#06_d000# / Register_Width, BXT_DE_PLL_ENABLE => 16#04_6070# / Register_Width, -- Broxton DDI PHY PLL registers BXT_PORT_PLL_ENABLE_A => 16#04_6074# / Register_Width, BXT_PORT_PLL_ENABLE_B => 16#04_6078# / Register_Width, BXT_PORT_PLL_ENABLE_C => 16#04_607c# / Register_Width, BXT_PORT_PLL_EBB_0_A => 16#16_2034# / Register_Width, BXT_PORT_PLL_EBB_4_A => 16#16_2038# / Register_Width, BXT_PORT_PLL_0_A => 16#16_2100# / Register_Width, BXT_PORT_PLL_1_A => 16#16_2104# / Register_Width, BXT_PORT_PLL_2_A => 16#16_2108# / Register_Width, BXT_PORT_PLL_3_A => 16#16_210c# / Register_Width, BXT_PORT_PLL_6_A => 16#16_2118# / Register_Width, BXT_PORT_PLL_8_A => 16#16_2120# / Register_Width, BXT_PORT_PLL_9_A => 16#16_2124# / Register_Width, BXT_PORT_PLL_10_A => 16#16_2128# / Register_Width, BXT_PORT_PLL_EBB_0_B => 16#06_c034# / Register_Width, BXT_PORT_PLL_EBB_4_B => 16#06_c038# / Register_Width, BXT_PORT_PLL_0_B => 16#06_c100# / Register_Width, BXT_PORT_PLL_1_B => 16#06_c104# / Register_Width, BXT_PORT_PLL_2_B => 16#06_c108# / Register_Width, BXT_PORT_PLL_3_B => 16#06_c10c# / Register_Width, BXT_PORT_PLL_6_B => 16#06_c118# / Register_Width, BXT_PORT_PLL_8_B => 16#06_c120# / Register_Width, BXT_PORT_PLL_9_B => 16#06_c124# / Register_Width, BXT_PORT_PLL_10_B => 16#06_c128# / Register_Width, BXT_PORT_PLL_EBB_0_C => 16#06_c340# / Register_Width, BXT_PORT_PLL_EBB_4_C => 16#06_c344# / Register_Width, BXT_PORT_PLL_0_C => 16#06_c380# / Register_Width, BXT_PORT_PLL_1_C => 16#06_c384# / Register_Width, BXT_PORT_PLL_2_C => 16#06_c388# / Register_Width, BXT_PORT_PLL_3_C => 16#06_c38c# / Register_Width, BXT_PORT_PLL_6_C => 16#06_c398# / Register_Width, BXT_PORT_PLL_8_C => 16#06_c3a0# / Register_Width, BXT_PORT_PLL_9_C => 16#06_c3a4# / Register_Width, BXT_PORT_PLL_10_C => 16#06_c3a8# / Register_Width, -- Broxton DDI PHY PCS? registers BXT_PORT_PCS_DW10_01_A => 16#16_2428# / Register_Width, BXT_PORT_PCS_DW12_01_A => 16#16_2430# / Register_Width, BXT_PORT_PCS_DW10_GRP_A => 16#16_2c28# / Register_Width, BXT_PORT_PCS_DW12_GRP_A => 16#16_2c30# / Register_Width, BXT_PORT_PCS_DW10_01_B => 16#06_c428# / Register_Width, BXT_PORT_PCS_DW12_01_B => 16#06_c430# / Register_Width, BXT_PORT_PCS_DW10_01_C => 16#06_c828# / Register_Width, BXT_PORT_PCS_DW12_01_C => 16#06_c830# / Register_Width, BXT_PORT_PCS_DW10_GRP_B => 16#06_cc28# / Register_Width, BXT_PORT_PCS_DW12_GRP_B => 16#06_cc30# / Register_Width, BXT_PORT_PCS_DW10_GRP_C => 16#06_ce28# / Register_Width, BXT_PORT_PCS_DW12_GRP_C => 16#06_ce30# / Register_Width, -- Broxton DDI PHY registers BXT_P_CR_GT_DISP_PWRON => 16#13_8090# / Register_Width, BXT_PHY_CTL_A => 16#06_4c00# / Register_Width, BXT_PHY_CTL_B => 16#06_4c10# / Register_Width, BXT_PHY_CTL_C => 16#06_4c20# / Register_Width, BXT_PHY_CTL_FAM_EDP => 16#06_4c80# / Register_Width, BXT_PHY_CTL_FAM_DDI => 16#06_4c90# / Register_Width, -- Broxton DDI PHY common lane registers BXT_PORT_CL1CM_DW0_A => 16#16_2000# / Register_Width, BXT_PORT_CL1CM_DW0_BC => 16#06_c000# / Register_Width, BXT_PORT_CL1CM_DW9_A => 16#16_2024# / Register_Width, BXT_PORT_CL1CM_DW9_BC => 16#06_c024# / Register_Width, BXT_PORT_CL1CM_DW10_A => 16#16_2028# / Register_Width, BXT_PORT_CL1CM_DW10_BC => 16#06_c028# / Register_Width, BXT_PORT_CL1CM_DW28_A => 16#16_2070# / Register_Width, BXT_PORT_CL1CM_DW28_BC => 16#06_c070# / Register_Width, BXT_PORT_CL1CM_DW30_A => 16#16_2078# / Register_Width, BXT_PORT_CL1CM_DW30_BC => 16#06_c078# / Register_Width, BXT_PORT_CL2CM_DW6_BC => 16#06_c358# / Register_Width, -- Broxton DDI PHY TX lane registers BXT_PORT_TX_DW2_LN0_A => 16#16_2508# / Register_Width, BXT_PORT_TX_DW3_LN0_A => 16#16_250c# / Register_Width, BXT_PORT_TX_DW4_LN0_A => 16#16_2510# / Register_Width, BXT_PORT_TX_DW14_LN0_A => 16#16_2538# / Register_Width, BXT_PORT_TX_DW14_LN1_A => 16#16_25b8# / Register_Width, BXT_PORT_TX_DW14_LN2_A => 16#16_2738# / Register_Width, BXT_PORT_TX_DW14_LN3_A => 16#16_27b8# / Register_Width, BXT_PORT_TX_DW2_GRP_A => 16#16_2d08# / Register_Width, BXT_PORT_TX_DW3_GRP_A => 16#16_2d0c# / Register_Width, BXT_PORT_TX_DW4_GRP_A => 16#16_2d10# / Register_Width, BXT_PORT_TX_DW2_LN0_B => 16#06_c508# / Register_Width, BXT_PORT_TX_DW3_LN0_B => 16#06_c50c# / Register_Width, BXT_PORT_TX_DW4_LN0_B => 16#06_c510# / Register_Width, BXT_PORT_TX_DW14_LN0_B => 16#06_c538# / Register_Width, BXT_PORT_TX_DW14_LN1_B => 16#06_c5b8# / Register_Width, BXT_PORT_TX_DW14_LN2_B => 16#06_c738# / Register_Width, BXT_PORT_TX_DW14_LN3_B => 16#06_c7b8# / Register_Width, BXT_PORT_TX_DW2_GRP_B => 16#06_cd08# / Register_Width, BXT_PORT_TX_DW3_GRP_B => 16#06_cd0c# / Register_Width, BXT_PORT_TX_DW4_GRP_B => 16#06_cd10# / Register_Width, BXT_PORT_TX_DW2_LN0_C => 16#06_c908# / Register_Width, BXT_PORT_TX_DW3_LN0_C => 16#06_c90c# / Register_Width, BXT_PORT_TX_DW4_LN0_C => 16#06_c910# / Register_Width, BXT_PORT_TX_DW14_LN0_C => 16#06_c938# / Register_Width, BXT_PORT_TX_DW14_LN1_C => 16#06_c9b8# / Register_Width, BXT_PORT_TX_DW14_LN2_C => 16#06_cb38# / Register_Width, BXT_PORT_TX_DW14_LN3_C => 16#06_cbb8# / Register_Width, BXT_PORT_TX_DW2_GRP_C => 16#06_cf08# / Register_Width, BXT_PORT_TX_DW3_GRP_C => 16#06_cf0c# / Register_Width, BXT_PORT_TX_DW4_GRP_C => 16#06_cf10# / Register_Width, -- Broxton DDI PHY ref registers BXT_PORT_REF_DW3_A => 16#16_218c# / Register_Width, BXT_PORT_REF_DW3_BC => 16#06_c18c# / Register_Width, BXT_PORT_REF_DW6_A => 16#16_2198# / Register_Width, BXT_PORT_REF_DW6_BC => 16#06_c198# / Register_Width, BXT_PORT_REF_DW8_A => 16#16_21a0# / Register_Width, BXT_PORT_REF_DW8_BC => 16#06_c1a0# / Register_Width, -- Power Down Well registers PWR_WELL_CTL_BIOS => 16#04_5400# / Register_Width, PWR_WELL_CTL_DRIVER => 16#04_5404# / Register_Width, PWR_WELL_CTL_KVMR => 16#04_5408# / Register_Width, PWR_WELL_CTL_DEBUG => 16#04_540c# / Register_Width, PWR_WELL_CTL5 => 16#04_5410# / Register_Width, PWR_WELL_CTL6 => 16#04_5414# / Register_Width, -- class Panel registers GMCH_PP_STATUS => 16#06_1200# / Register_Width, GMCH_PP_CONTROL => 16#06_1204# / Register_Width, GMCH_PP_ON_DELAYS => 16#06_1208# / Register_Width, GMCH_PP_OFF_DELAYS => 16#06_120c# / Register_Width, GMCH_PP_DIVISOR => 16#06_1210# / Register_Width, GMCH_PFIT_CONTROL => 16#06_1230# / Register_Width, PCH_PP_STATUS => 16#0c_7200# / Register_Width, PCH_PP_CONTROL => 16#0c_7204# / Register_Width, PCH_PP_ON_DELAYS => 16#0c_7208# / Register_Width, PCH_PP_OFF_DELAYS => 16#0c_720c# / Register_Width, PCH_PP_DIVISOR => 16#0c_7210# / Register_Width, BLC_PWM_CPU_CTL => 16#04_8254# / Register_Width, BLC_PWM_PCH_CTL2 => 16#0c_8254# / Register_Width, -- GMCH LVDS Connector Registers GMCH_LVDS => 16#06_1180# / Register_Width, -- PCH LVDS Connector Registers PCH_LVDS => 16#0e_1180# / Register_Width, -- PCH ADPA Connector Registers PCH_ADPA => 16#0e_1100# / Register_Width, -- GMCH DVOB Connector Registers GMCH_SDVOB => 16#06_1140# / Register_Width, -- PCH HDMIB Connector Registers PCH_HDMIB => 16#0e_1140# / Register_Width, -- GMCH DVOC Connector Registers GMCH_SDVOC => 16#06_1160# / Register_Width, -- PCH HDMIC Connector Registers PCH_HDMIC => 16#0e_1150# / Register_Width, -- PCH HDMID Connector Registers PCH_HDMID => 16#0e_1160# / Register_Width, -- Intel Registers CPU_VGACNTRL => 16#04_1000# / Register_Width, GMCH_VGACNTRL => 16#07_1400# / Register_Width, FUSE_STATUS => 16#04_2000# / Register_Width, FBA_CFB_BASE => 16#04_3200# / Register_Width, IPS_CTL => 16#04_3408# / Register_Width, ARB_CTL => 16#04_5000# / Register_Width, DBUF_CTL => 16#04_5008# / Register_Width, NDE_RSTWRN_OPT => 16#04_6408# / Register_Width, PCH_DREF_CONTROL => 16#0c_6200# / Register_Width, BLC_PWM_PCH_CTL1 => 16#0c_8250# / Register_Width, BLC_PWM_CPU_CTL2 => 16#04_8250# / Register_Width, PCH_DPLL_SEL => 16#0c_7000# / Register_Width, GT_MAILBOX => 16#13_8124# / Register_Width, GT_MAILBOX_DATA => 16#13_8128# / Register_Width, GT_MAILBOX_DATA_1 => 16#13_812c# / Register_Width, PCH_DP_B => 16#0e_4100# / Register_Width, PCH_DP_AUX_CTL_B => 16#0e_4110# / Register_Width, PCH_DP_AUX_DATA_B_1 => 16#0e_4114# / Register_Width, PCH_DP_AUX_DATA_B_2 => 16#0e_4118# / Register_Width, PCH_DP_AUX_DATA_B_3 => 16#0e_411c# / Register_Width, PCH_DP_AUX_DATA_B_4 => 16#0e_4120# / Register_Width, PCH_DP_AUX_DATA_B_5 => 16#0e_4124# / Register_Width, PCH_DP_C => 16#0e_4200# / Register_Width, PCH_DP_AUX_CTL_C => 16#0e_4210# / Register_Width, PCH_DP_AUX_DATA_C_1 => 16#0e_4214# / Register_Width, PCH_DP_AUX_DATA_C_2 => 16#0e_4218# / Register_Width, PCH_DP_AUX_DATA_C_3 => 16#0e_421c# / Register_Width, PCH_DP_AUX_DATA_C_4 => 16#0e_4220# / Register_Width, PCH_DP_AUX_DATA_C_5 => 16#0e_4224# / Register_Width, PCH_DP_D => 16#0e_4300# / Register_Width, PCH_DP_AUX_CTL_D => 16#0e_4310# / Register_Width, PCH_DP_AUX_DATA_D_1 => 16#0e_4314# / Register_Width, PCH_DP_AUX_DATA_D_2 => 16#0e_4318# / Register_Width, PCH_DP_AUX_DATA_D_3 => 16#0e_431c# / Register_Width, PCH_DP_AUX_DATA_D_4 => 16#0e_4320# / Register_Width, PCH_DP_AUX_DATA_D_5 => 16#0e_4324# / Register_Width, -- watermark registers WM1_LP_ILK => 16#04_5108# / Register_Width, WM2_LP_ILK => 16#04_510c# / Register_Width, WM3_LP_ILK => 16#04_5110# / Register_Width, -- audio VID/DID AUD_VID_DID => 16#06_5020# / Register_Width, PCH_AUD_VID_DID => 16#0e_5020# / Register_Width, G4X_AUD_VID_DID => 16#06_2020# / Register_Width, -- interrupt registers DEISR => 16#04_4000# / Register_Width, DEIMR => 16#04_4004# / Register_Width, DEIIR => 16#04_4008# / Register_Width, DEIER => 16#04_400c# / Register_Width, GTISR => 16#04_4010# / Register_Width, GTIMR => 16#04_4014# / Register_Width, GTIIR => 16#04_4018# / Register_Width, GTIER => 16#04_401c# / Register_Width, SDEISR => 16#0c_4000# / Register_Width, SDEIMR => 16#0c_4004# / Register_Width, SDEIIR => 16#0c_4008# / Register_Width, SDEIER => 16#0c_400c# / Register_Width, -- I2C stuff GMCH_GMBUS0 => 16#00_5100# / Register_Width, GMCH_GMBUS1 => 16#00_5104# / Register_Width, GMCH_GMBUS2 => 16#00_5108# / Register_Width, GMCH_GMBUS3 => 16#00_510c# / Register_Width, GMCH_GMBUS4 => 16#00_5110# / Register_Width, GMCH_GMBUS5 => 16#00_5120# / Register_Width, PCH_GMBUS0 => 16#0c_5100# / Register_Width, PCH_GMBUS1 => 16#0c_5104# / Register_Width, PCH_GMBUS2 => 16#0c_5108# / Register_Width, PCH_GMBUS3 => 16#0c_510c# / Register_Width, PCH_GMBUS4 => 16#0c_5110# / Register_Width, PCH_GMBUS5 => 16#0c_5120# / Register_Width, -- clock gating -- maybe have to touch this DSPCLK_GATE_D => 16#04_2020# / Register_Width, PCH_FDI_CHICKEN_B_C => 16#0c_2000# / Register_Width, PCH_DSPCLK_GATE_D => 16#0c_2020# / Register_Width, -- hotplug and initial detection HOTPLUG_CTL => 16#04_4030# / Register_Width, PORT_HOTPLUG_EN => 16#06_1110# / Register_Width, PORT_HOTPLUG_STAT => 16#06_1114# / Register_Width, SHOTPLUG_CTL => 16#0c_4030# / Register_Width, SFUSE_STRAP => 16#0c_2014# / Register_Width, -- Render Engine Command Streamer ARB_MODE => 16#00_4030# / Register_Width, HWS_PGA => 16#00_4080# / Register_Width, RCS_RING_BUFFER_TAIL => 16#00_2030# / Register_Width, VCS_RING_BUFFER_TAIL => 16#01_2030# / Register_Width, BCS_RING_BUFFER_TAIL => 16#02_2030# / Register_Width, RCS_RING_BUFFER_HEAD => 16#00_2034# / Register_Width, VCS_RING_BUFFER_HEAD => 16#01_2034# / Register_Width, BCS_RING_BUFFER_HEAD => 16#02_2034# / Register_Width, RCS_RING_BUFFER_STRT => 16#00_2038# / Register_Width, VCS_RING_BUFFER_STRT => 16#01_2038# / Register_Width, BCS_RING_BUFFER_STRT => 16#02_2038# / Register_Width, RCS_RING_BUFFER_CTL => 16#00_203c# / Register_Width, VCS_RING_BUFFER_CTL => 16#01_203c# / Register_Width, BCS_RING_BUFFER_CTL => 16#02_203c# / Register_Width, MI_MODE => 16#00_209c# / Register_Width, INSTPM => 16#00_20c0# / Register_Width, GAB_CTL_REG => 16#02_4000# / Register_Width, PP_DCLV_HIGH => 16#00_2220# / Register_Width, PP_DCLV_LOW => 16#00_2228# / Register_Width, VCS_PP_DCLV_HIGH => 16#01_2220# / Register_Width, VCS_PP_DCLV_LOW => 16#01_2228# / Register_Width, BCS_PP_DCLV_HIGH => 16#02_2220# / Register_Width, BCS_PP_DCLV_LOW => 16#02_2228# / Register_Width, ILK_DISPLAY_CHICKEN2 => 16#04_2004# / Register_Width, UCGCTL1 => 16#00_9400# / Register_Width, UCGCTL2 => 16#00_9404# / Register_Width, MBCTL => 16#00_907c# / Register_Width, HWSTAM => 16#00_2098# / Register_Width, VCS_HWSTAM => 16#01_2098# / Register_Width, BCS_HWSTAM => 16#02_2098# / Register_Width, IIR => 16#04_4028# / Register_Width, PIPE_FRMCNT_A => 16#07_0040# / Register_Width, PIPE_FRMCNT_B => 16#07_1040# / Register_Width, PIPE_FRMCNT_C => 16#07_2040# / Register_Width, FBC_CTL => 16#04_3208# / Register_Width, PIPE_VSYNCSHIFT_A => 16#06_0028# / Register_Width, PIPE_VSYNCSHIFT_B => 16#06_1028# / Register_Width, PIPE_VSYNCSHIFT_C => 16#06_2028# / Register_Width, WM_PIPE_A => 16#04_5100# / Register_Width, WM_PIPE_B => 16#04_5104# / Register_Width, WM_PIPE_C => 16#04_5200# / Register_Width, PIPE_SCANLINE_A => 16#07_0000# / Register_Width, PIPE_SCANLINE_B => 16#07_1000# / Register_Width, PIPE_SCANLINE_C => 16#07_2000# / Register_Width, GFX_MODE => 16#00_2520# / Register_Width, CACHE_MODE_0 => 16#00_2120# / Register_Width, SLEEP_PSMI_CONTROL => 16#01_2050# / Register_Width, CTX_SIZE => 16#00_21a0# / Register_Width, GAC_ECO_BITS => 16#01_4090# / Register_Width, GAM_ECOCHK => 16#00_4090# / Register_Width, QUIRK_02084 => 16#00_2084# / Register_Width, QUIRK_02090 => 16#00_2090# / Register_Width, GT_MODE => 16#00_20d0# / Register_Width, QUIRK_F0060 => 16#0f_0060# / Register_Width, QUIRK_F1060 => 16#0f_1060# / Register_Width, QUIRK_F2060 => 16#0f_2060# / Register_Width, AUD_CNTRL_ST2 => 16#0e_50c0# / Register_Width, AUD_CNTL_ST_A => 16#0e_50b4# / Register_Width, AUD_CNTL_ST_B => 16#0e_51b4# / Register_Width, AUD_CNTL_ST_C => 16#0e_52b4# / Register_Width, AUD_HDMIW_HDMIEDID_A => 16#0e_5050# / Register_Width, AUD_HDMIW_HDMIEDID_B => 16#0e_5150# / Register_Width, AUD_HDMIW_HDMIEDID_C => 16#0e_5250# / Register_Width, AUD_CONFIG_A => 16#0e_5000# / Register_Width, AUD_CONFIG_B => 16#0e_5100# / Register_Width, AUD_CONFIG_C => 16#0e_5200# / Register_Width, TRANS_DP_CTL_A => 16#0e_0300# / Register_Width, TRANS_DP_CTL_B => 16#0e_1300# / Register_Width, TRANS_DP_CTL_C => 16#0e_2300# / Register_Width, TRANS_VSYNCSHIFT_A => 16#0e_0028# / Register_Width, TRANS_VSYNCSHIFT_B => 16#0e_1028# / Register_Width, TRANS_VSYNCSHIFT_C => 16#0e_2028# / Register_Width, PCH_RAWCLK_FREQ => 16#0c_6204# / Register_Width, QUIRK_C2004 => 16#0c_2004# / Register_Width, -- MCHBAR Mirror GMCH_CLKCFG => 16#01_0c00# / Register_Width); subtype Registers_Index is Registers_Invalid_Index range Registers_Invalid_Index'Succ (Invalid_Register) .. Registers_Invalid_Index'Last; -- aliased registers DP_CTL_A : constant Registers_Index := DDI_BUF_CTL_A; GMCH_DP_B : constant Registers_Index := DDI_BUF_CTL_B; GMCH_DP_C : constant Registers_Index := DDI_BUF_CTL_C; GMCH_DP_D : constant Registers_Index := DDI_BUF_CTL_D; DP_AUX_CTL_A : constant Registers_Index := DDI_AUX_CTL_A; DP_AUX_DATA_A_1 : constant Registers_Index := DDI_AUX_DATA_A_1; DP_AUX_DATA_A_2 : constant Registers_Index := DDI_AUX_DATA_A_2; DP_AUX_DATA_A_3 : constant Registers_Index := DDI_AUX_DATA_A_3; DP_AUX_DATA_A_4 : constant Registers_Index := DDI_AUX_DATA_A_4; DP_AUX_DATA_A_5 : constant Registers_Index := DDI_AUX_DATA_A_5; ILK_DISPLAY_CHICKEN1 : constant Registers_Index := FUSE_STATUS; GMCH_ADPA : constant Registers_Index := FDI_TX_CTL_B; GMCH_HDMIB : constant Registers_Index := GMCH_SDVOB; GMCH_HDMIC : constant Registers_Index := GMCH_SDVOC; --------------------------------------------------------------------------- Default_Timeout_MS : constant := 10; --------------------------------------------------------------------------- procedure Posting_Read (Register : in Registers_Index) with Global => (In_Out => Register_State), Depends => (Register_State =>+ (Register)), Pre => True, Post => True; pragma Warnings (GNATprove, Off, "unused variable ""Verbose""", Reason => "Only used on debugging path"); procedure Read (Register : in Registers_Index; Value : out Word32; Verbose : in Boolean := True) with Global => (In_Out => Register_State), Depends => ((Value, Register_State) => (Register, Register_State), null => Verbose), Pre => True, Post => True; pragma Warnings (GNATprove, On, "unused variable ""Verbose"""); procedure Write (Register : Registers_Index; Value : Word32) with Global => (In_Out => Register_State), Depends => (Register_State => (Register, Register_State, Value)), Pre => True, Post => True; procedure Is_Set_Mask (Register : in Registers_Index; Mask : in Word32; Result : out Boolean); pragma Warnings (GNATprove, Off, "unused initial value of ""Verbose""", Reason => "Only used on debugging path"); procedure Wait (Register : Registers_Index; Mask : Word32; Value : Word32; TOut_MS : Natural := Default_Timeout_MS; Verbose : Boolean := False); procedure Wait_Set_Mask (Register : Registers_Index; Mask : Word32; TOut_MS : Natural := Default_Timeout_MS; Verbose : Boolean := False); procedure Wait_Unset_Mask (Register : Registers_Index; Mask : Word32; TOut_MS : Natural := Default_Timeout_MS; Verbose : Boolean := False); pragma Warnings (GNATprove, On, "unused initial value of ""Verbose"""); procedure Set_Mask (Register : Registers_Index; Mask : Word32); procedure Unset_Mask (Register : Registers_Index; Mask : Word32); procedure Unset_And_Set_Mask (Register : Registers_Index; Mask_Unset : Word32; Mask_Set : Word32); procedure Clear_Fences; procedure Add_Fence (First_Page : in GTT_Range; Last_Page : in GTT_Range; Tiling : in XY_Tiling; Pitch : in Natural; Success : out Boolean); procedure Remove_Fence (First_Page, Last_Page : GTT_Range); pragma Warnings (Off, "declaration of ""Write_GTT"" hides one at *"); procedure Write_GTT (GTT_Page : GTT_Range; Device_Address : GTT_Address_Type; Valid : Boolean) with Global => (In_Out => GTT_State), Depends => (GTT_State =>+ (GTT_Page, Device_Address, Valid)), Pre => True, Post => True; pragma Warnings (On, "declaration of ""Write_GTT"" hides one at *"); procedure Set_Register_Base (Base : Word64; GTT_Base : Word64 := 0) with Global => (Output => Address_State), Depends => (Address_State => (Base, GTT_Base)), Pre => True, Post => True; end HW.GFX.GMA.Registers;
With INI.Read_INI; Package INI.Parameters is Parameters : INI.Instance renames Read_INI("Parameters.ini"); End INI.Parameters;
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Float_Random; procedure exercise8 is Count_Failed : exception; -- Exception to be raised when counting fails Gen : Generator; -- Random number generator protected type Transaction_Manager (N : Positive) is entry Finished; entry Wait_Until_Aborted; function Commit return Boolean; procedure Signal_Abort; private Finished_Gate_Open : Boolean := False; Aborted : Boolean := False; Should_Commit : Boolean := True; end Transaction_Manager; protected body Transaction_Manager is ------------------------------------------ -- PART 3: Modify the Finished entry entry Finished when Finished_Gate_Open or Finished'Count = N is begin Finished_Gate_Open := Finished'Count /=0; if not Finished_Gate_Open then Aborted := False; end if; end Finished; ------------------------------------------ procedure Signal_Abort is begin Aborted := True; end Signal_Abort; function Commit return Boolean is begin return Should_Commit; end Commit; ------------------------------------------ -- PART 2: Create the Wait_Until_Aborted entry entry Wait_Until_Aborted when Aborted is begin if Wait_Until_Aborted'Count = 0 then Aborted := False; end if; end Wait_Until_Aborted; ------------------------------------------ end Transaction_Manager; function Unreliable_Slow_Add (x : Integer) return Integer is Error_Rate : Constant := 0.15; -- (between 0 and 1) begin if Random(Gen) > Error_Rate then delay Duration(Random(Gen) * 5.0); return X + 10; else delay Duration(Random(Gen) * 1.0); raise Count_Failed; end if; end Unreliable_Slow_Add; task type Transaction_Worker (Initial : Integer; Manager : access Transaction_Manager); task body Transaction_Worker is Num : Integer := Initial; Prev : Integer := Num; Round_Num : Integer := 0; begin Put_Line ("Worker" & Integer'Image(Initial) & " started"); loop Put_Line ("Worker" & Integer'Image(Initial) & " started round" & Integer'Image(Round_Num)); Round_Num := Round_Num + 1; ------------------------------------------ -- PART 1: Select-Then-Abort statement select Manager.Wait_Until_Aborted; Num := Prev + 5; Put_Line (" Worker" & Integer'Image(Initial) & " comitting" & Integer'Image(Num)); then abort begin Num := Unreliable_Slow_Add(Num); Put_Line (" Worker" & Integer'Image(Initial) & " comitting" & Integer'Image(Num)); exception when Count_Failed => Put_Line ("Oh no! Worker" & Integer'Image(Initial) & " failed! Oh no! "); Manager.Signal_Abort; end; Manager.Finished; end select; ------------------------------------------ Prev := Num; delay 0.5; end loop; end Transaction_Worker; Manager : aliased Transaction_Manager (3); Worker_1 : Transaction_Worker (0, Manager'Access); Worker_2 : Transaction_Worker (1, Manager'Access); Worker_3 : Transaction_Worker (2, Manager'Access); begin Reset(Gen); -- Seed the random number generator end exercise8;
pragma License (Unrestricted); -- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux) package System.Synchronous_Objects.Abortable is pragma Preelaborate; -- queue procedure Take ( Object : in out Queue; Item : out Queue_Node_Access; Params : Address; Filter : Queue_Filter; Aborted : out Boolean); -- waiting -- event procedure Wait ( Object : in out Event; Aborted : out Boolean); procedure Wait ( Object : in out Event; Timeout : Duration; Value : out Boolean; Aborted : out Boolean); end System.Synchronous_Objects.Abortable;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. with Text_IO; with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package; -- with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names; with Latin_Utils.Inflections_Package; use Latin_Utils.Inflections_Package; with Latin_Utils.Dictionary_Package; use Latin_Utils.Dictionary_Package; -- with line_stuff; use line_stuff; -- with dictionary_form; procedure Uniqpage is -- package Integer_IO is new Text_IO.Integer_IO (Integer); use Text_IO; use Dictionary_Entry_IO; use Part_Entry_IO; use Kind_Entry_IO; use Translation_Record_IO; use Age_Type_IO; use Area_Type_IO; use Geo_Type_IO; use Frequency_Type_IO; use Source_Type_IO; Uniques_File, Uniqpage : Text_IO.File_Type; S : constant String (1 .. 400) := (others => ' '); Line : String (1 .. 400) := (others => ' '); Blanks : constant String (1 .. 400) := (others => ' '); L, Last : Integer := 0; Stem : Stem_Type := Null_Stem_Type; Qual : Quality_Record; Kind : Kind_Entry; Tran : Translation_Record; Mean : Meaning_Type; procedure Get_Line_Unique (Input : in Text_IO.File_Type; S : out String; Last : out Natural) is begin Last := 0; Text_IO.Get_Line (Input, S, Last); -- FIXME: this if statement was commented out, because it triggered -- warning "if statement has no effect". I didn't delete it because quite -- possibly author wanted it to do something. Question is what? --if Trim (s (s'First .. last)) /= "" then -- Rejecting blank lines -- null; --end if; end Get_Line_Unique; begin Put_Line ("UNIQUES.LAT -> UNIQPAGE.PG"); Put_Line ("Takes UNIQUES form, single lines it, puts # at beginning,"); Put_Line ("producing a .PG file for sorting to produce paper dictionary"); Create (Uniqpage, Out_File, "UNIQPAGE.PG"); Open (Uniques_File, In_File, "UNIQUES.LAT"); Over_Lines : while not End_Of_File (Uniques_File) loop Line := Blanks; Get_Line_Unique (Uniques_File, Line, Last); -- STEM Stem := Head (Trim (Line (1 .. Last)), Max_Stem_Size); Line := Blanks; Get_Line_Unique (Uniques_File, Line, Last); -- QUAL, KIND, TRAN Quality_Record_IO.Get (Line (1 .. Last), Qual, L); Get (Line (L + 1 .. Last), Qual.Pofs, Kind, L); Age_Type_IO.Get (Line (L + 1 .. Last), Tran.Age, L); Area_Type_IO.Get (Line (L + 1 .. Last), Tran.Area, L); Geo_Type_IO.Get (Line (L + 1 .. Last), Tran.Geo, L); Frequency_Type_IO.Get (Line (L + 1 .. Last), Tran.Freq, L); Source_Type_IO.Get (Line (L + 1 .. Last), Tran.Source, L); Line := Blanks; Get_Line_Unique (Uniques_File, Line, L); -- MEAN Mean := Head (Trim (Line (1 .. L)), Max_Meaning_Size); -- while not END_OF_FILE (UNIQUES_FILE) loop -- S := BLANK_LINE; -- GET_LINE (INPUT, S, LAST); -- if TRIM (S (1 .. LAST)) /= "" then -- Rejecting blank lines -- -- Text_IO.Put (Uniqpage, "#" & Stem); Quality_Record_IO.Put (Uniqpage, Qual); -- PART := (V, (QUAL.V.CON, KIND.V_KIND)); if (Qual.Pofs = V) and then (Kind.V_Kind in Gen .. Perfdef) then Text_IO.Put (Uniqpage, " " & Verb_Kind_Type'Image (Kind.V_Kind) & " "); end if; Text_IO.Put (Uniqpage, " ["); Age_Type_IO.Put (Uniqpage, Tran.Age); Area_Type_IO.Put (Uniqpage, Tran.Area); Geo_Type_IO.Put (Uniqpage, Tran.Geo); Frequency_Type_IO.Put (Uniqpage, Tran.Freq); Source_Type_IO.Put (Uniqpage, Tran.Source); Text_IO.Put (Uniqpage, "]"); Put (Uniqpage, " :: "); Put_Line (Uniqpage, Mean); --end if; -- Rejecting blank lines end loop Over_Lines; Close (Uniqpage); exception when Text_IO.Data_Error => null; when others => Put_Line (S (1 .. Last)); Close (Uniqpage); end Uniqpage;
package body BitOperations.Shift.Axiom.Logic_Left with SPARK_Mode => Off is ----------------------------------------------------- -- Axiom_Shift_Left_Is_Eq_Multiplying_By_Power_Of2 -- ----------------------------------------------------- procedure Equal_Mult_By_Power_2 (Value : Modular; Amount : Natural) is null; end BitOperations.Shift.Axiom.Logic_Left;
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C; use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C; procedure calc is type stringptr is access all char_array; procedure PInt(i : in Integer) is begin String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left)); end; -- --La suite de fibonaci -- function fibo(a : in Integer; b : in Integer; i : in Integer) return Integer is tmp : Integer; out_0 : Integer; b2 : Integer; a2 : Integer; begin out_0 := 0; a2 := a; b2 := b; for j in integer range 0..i + 1 loop PInt(j); out_0 := out_0 + a2; tmp := b2; b2 := b2 + a2; a2 := tmp; end loop; return out_0; end; begin PInt(fibo(1, 2, 4)); end;
with AUnit.Test_Suites; with AUnit.Test_Fixtures; package Test_Standard is function Suite return AUnit.Test_Suites.Access_Test_Suite; private type Test is new AUnit.Test_Fixtures.Test_Fixture with null record; procedure Test_Encoding_Empty (Object : in out Test); procedure Test_Encoding_Pad2 (Object : in out Test); procedure Test_Encoding_Pad1 (Object : in out Test); procedure Test_Encoding_Pad0 (Object : in out Test); procedure Test_Encoding_Big (Object : in out Test); procedure Test_Encoding_RFC4648 (Object : in out Test); procedure Test_Decoding_Empty (Object : in out Test); procedure Test_Decoding_Pad2 (Object : in out Test); procedure Test_Decoding_Pad1 (Object : in out Test); procedure Test_Decoding_Pad0 (Object : in out Test); procedure Test_Decoding_Big (Object : in out Test); procedure Test_Decoding_RFC4648 (Object : in out Test); end Test_Standard;
-- C52011B.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 DISCRIMINANT CONSTRAINTS FOR ASSIGNMENT OF ACCESS SUBTYPES. -- SPECIFICALLY, CHECK THAT: -- A) ANY ACCESS TYPE VARIABLE AND CONSTRAINED SUBTYPE VARIABLES OF THAT -- TYPE MAY BE ASSIGNED TO ONE ANOTHER IF THE VALUE BEING ASSIGNED -- IS NULL. -- B) VARIABLES OF THE SAME CONSTRAINED ACCESS SUBTYPE MAY BE ASSIGNED -- TO ONE ANOTHER OR TO VARIABLES OF THE BASE ACCESS TYPE. -- C) CONSTRAINT_ERROR IS RAISED UPON ASSIGNMENT OF NON-NULL OBJECTS -- BETWEEN DIFFERENTLY CONSTRAINED ACCESS SUBTYPES. -- D) CONSTRAINT_ERROR IS RAISED UPON ASSIGNMENT OF A NON-NULL OBJECT -- OF A BASE ACCESS TYPE VARIABLE TO A VARIABLE OF ONE OF ITS -- CONSTRAINED SUBTYPES IF THE CONSTRAINTS ON THE OBJECT DIFFER -- FROM THOSE ON THE SUBTYPE. -- E) NULL CAN BE ASSIGNED TO BASE ACCESS TYPES AND ANY CONSTRAINED -- SUBTYPES OF THIS TYPE. -- ASL 7/06/81 -- RM 6/17/82 -- RLB 6/29/01 - FIXED TO ALLOW AGGRESIVE OPTIMIZATION. WITH REPORT; PROCEDURE C52011B IS USE REPORT; TYPE REC(DISC : INTEGER := -1 ) IS RECORD NULL; END RECORD; TYPE REC_NAME IS ACCESS REC; SUBTYPE S1 IS REC_NAME(IDENT_INT(5)); SUBTYPE S2 IS REC_NAME(IDENT_INT(3)); W : REC_NAME := NULL; -- E. X1,X2 : S1 := NULL; -- E. Y1,Y2 : S2 := NULL; -- E. W_NONNULL : REC_NAME := NEW REC(7) ; X1_NONNULL : S1 := NEW REC(IDENT_INT(5)); Y1_NONNULL : S2 := NEW REC(IDENT_INT(3)); TOO_EARLY : BOOLEAN := TRUE; BEGIN TEST ("C52011B", "DISCRIMINANT CONSTRAINTS ON ACCESS SUBTYPE " & "OBJECTS MUST BE SATISFIED FOR ASSIGNMENT"); BEGIN IF EQUAL(3,3) THEN W_NONNULL := X1; -- A. END IF; IF W_NONNULL /= X1 THEN FAILED ("ASSIGNMENT FAILED - 1"); END IF; IF EQUAL(3,3) THEN W := Y1; -- A. END IF; IF W /= Y1 THEN FAILED ("ASSIGNMENT FAILED - 2"); END IF; IF EQUAL(3,3) THEN X1_NONNULL := Y1; -- A. END IF; IF X1_NONNULL /= Y1 THEN FAILED ("ASSIGNMENT FAILED - 3"); END IF; IF EQUAL(3,3) THEN Y1_NONNULL := Y2; -- A. END IF; IF Y1_NONNULL /= Y2 THEN FAILED ("ASSIGNMENT FAILED - 4"); END IF; X1 := NEW REC(IDENT_INT(5)); IF EQUAL(3,3) THEN X2 := X1; -- B. END IF; IF X1 /= X2 THEN FAILED ("ASSIGNMENT FAILED - 5"); END IF; IF EQUAL(3,3) THEN W := X1; -- B. END IF; IF W /= X1 THEN FAILED ("ASSIGNMENT FAILED - 6"); END IF; BEGIN Y1 := X1; -- C. IF Y1.DISC /= REPORT.IDENT_INT(3) THEN FAILED ("NON-NULL ASSIGNMENT MADE BETWEEN TWO " & "VARIABLES OF DIFFERENT CONSTRAINED ACCESS SUBTYPES " & "AND CONSTRAINT IS CHANGED"); ELSE FAILED ("NON-NULL ASSIGNMENT MADE BETWEEN TWO " & "VARIABLES OF DIFFERENT CONSTRAINED ACCESS SUBTYPES " & "AND CONSTRAINT IS NOT CHANGED"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION - 1"); END; W := NEW REC(IDENT_INT(3)); BEGIN X1 := W; -- D. IF X1.DISC /= REPORT.IDENT_INT(5) THEN FAILED ("NON-NULL ASSIGNMENT MADE FROM UNCONSTRAINED " & "ACCESS TYPE DESIGNATING CONSTRAINED OBJECT TO "& "ACCESS SUBTYPE WITH DIFFERENT CONSTRAINT " & "AND CONSTRAINT IS CHANGED"); ELSE FAILED ("NON-NULL ASSIGNMENT MADE FROM UNCONSTRAINED " & "ACCESS TYPE DESIGNATING CONSTRAINED OBJECT TO "& "ACCESS SUBTYPE WITH DIFFERENT CONSTRAINT " & "AND CONSTRAINT IS NOT CHANGED"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL ; WHEN OTHERS => FAILED ("WRONG EXCEPTION - 2"); END; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED"); END; RESULT; END C52011B;
----------------------------------------------------------------------- -- ADO Databases -- Database connections -- Copyright (C) 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- This file is part of ADO. -- -- 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 2, -- 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; see the file COPYING. If not, write to -- the Free Software Foundation, 59 Temple Place - Suite 330, -- Boston, MA 02111-1307, USA. ----------------------------------------------------------------------- with Sqlite3_H; with Sqlite3_H.Perfect_Hash; with Interfaces.C.Strings; with Util.Log; with Util.Log.Loggers; with ADO.Drivers.Dialects; package body ADO.Statements.Sqlite is use Util.Log; use Ada.Calendar; use type ADO.Schemas.Class_Mapping_Access; Log : constant Loggers.Logger := Loggers.Create ("ADO.Statements.Sqlite"); type Dialect is new ADO.Drivers.Dialects.Dialect with null record; -- Check if the string is a reserved keyword. overriding function Is_Reserved (D : in Dialect; Name : in String) return Boolean; -- Get the quote character to escape an identifier. overriding function Get_Identifier_Quote (D : in Dialect) return Character; -- Append the item in the buffer escaping some characters if necessary overriding procedure Escape_Sql (D : in Dialect; Buffer : in out Unbounded_String; Item : in ADO.Blob_Ref); Sqlite_Dialect : aliased Dialect; procedure Execute (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; SQL : in String; Result : out int; Stmt : out System.Address); -- Releases the sqlite statement procedure Release_Stmt (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Stmt : in out System.Address); procedure Prepare (Stmt : in out Sqlite_Query_Statement; Query : in String); -- ------------------------------ -- Check if the string is a reserved keyword. -- ------------------------------ overriding function Is_Reserved (D : in Dialect; Name : in String) return Boolean is pragma Unreferenced (D); begin return Sqlite3_H.Perfect_Hash.Is_Keyword (Name); end Is_Reserved; -- ------------------------------ -- Get the quote character to escape an identifier. -- ------------------------------ overriding function Get_Identifier_Quote (D : in Dialect) return Character is pragma Unreferenced (D); begin return '`'; end Get_Identifier_Quote; -- ------------------------------ -- Append the item in the buffer escaping some characters if necessary -- ------------------------------ overriding procedure Escape_Sql (D : in Dialect; Buffer : in out Unbounded_String; Item : in ADO.Blob_Ref) is pragma Unreferenced (D); use type Ada.Streams.Stream_Element; C : Ada.Streams.Stream_Element; Blob : constant ADO.Blob_Access := Item.Value; begin for I in Blob.Data'Range loop C := Blob.Data (I); case C is when Character'Pos (ASCII.NUL) => Append (Buffer, '\'); Append (Buffer, '0'); when Character'Pos (''') => Append (Buffer, '''); Append (Buffer, Character'Val (C)); when others => Append (Buffer, Character'Val (C)); end case; end loop; end Escape_Sql; -- ------------------------------ -- Releases the sqlite statement -- ------------------------------ procedure Release_Stmt (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Stmt : in out System.Address) is use System; Result : int; begin if Stmt /= System.Null_Address then Result := Sqlite3_H.sqlite3_reset (Stmt); ADO.Drivers.Connections.Sqlite.Check_Error (Connection, Result); Result := Sqlite3_H.sqlite3_finalize (Stmt); ADO.Drivers.Connections.Sqlite.Check_Error (Connection, Result); Stmt := System.Null_Address; end if; end Release_Stmt; -- ------------------------------ -- Delete statement -- ------------------------------ -- ------------------------------ -- Execute the query -- ------------------------------ overriding procedure Execute (Stmt : in out Sqlite_Delete_Statement; Result : out Natural) is begin ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => "DELETE FROM "); ADO.SQL.Append_Name (Target => Stmt.Query.SQL, Name => Stmt.Table.Table.all); if Stmt.Query.Has_Join then ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Join); end if; if Stmt.Query.Has_Filter then ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => " WHERE "); ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Filter); end if; declare Sql_Query : constant String := Stmt.Query.Expand; Handle : aliased System.Address; Res : int; begin Execute (Connection => Stmt.Connection, SQL => Sql_Query, Result => Res, Stmt => Handle); ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Res); Release_Stmt (Stmt.Connection, Handle); Result := Natural (Sqlite3_H.sqlite3_changes (Stmt.Connection)); end; end Execute; -- ------------------------------ -- Create the delete statement -- ------------------------------ function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement_Access is Result : constant Sqlite_Delete_Statement_Access := new Sqlite_Delete_Statement; begin Result.Connection := Database; Result.Table := Table; Result.Query := Result.Delete_Query'Access; Result.Delete_Query.Set_Dialect (Sqlite_Dialect'Access); return Result.all'Access; end Create_Statement; procedure Execute (Connection : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; SQL : in String; Result : out int; Stmt : out System.Address) is ZSql : Strings.chars_ptr := Strings.New_String (SQL); Handle : aliased System.Address; begin Log.Debug ("Execute: {0}", SQL); Result := Sqlite3_H.sqlite3_prepare_v2 (db => Connection, zSql => ZSql, nByte => int (SQL'Length + 1), ppStmt => Handle'Address, pzTail => System.Null_Address); Strings.Free (ZSql); Stmt := Handle; if Result /= Sqlite3_H.SQLITE_OK then ADO.Drivers.Connections.Sqlite.Check_Error (Connection, Result); return; end if; Result := Sqlite3_H.sqlite3_step (Handle); end Execute; -- ------------------------------ -- Update statement -- ------------------------------ -- ------------------------------ -- Execute the query -- ------------------------------ overriding procedure Execute (Stmt : in out Sqlite_Update_Statement) is Result : Integer; begin Sqlite_Update_Statement'Class (Stmt).Execute (Result); end Execute; -- ------------------------------ -- Execute the query -- ------------------------------ overriding procedure Execute (Stmt : in out Sqlite_Update_Statement; Result : out Integer) is begin ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "UPDATE "); ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all); ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " SET "); ADO.SQL.Append_Fields (Update => Stmt.This_Query); if Stmt.This_Query.Has_Join then ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Join); end if; if Stmt.This_Query.Has_Filter then ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " WHERE "); ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Filter); end if; declare Sql_Query : constant String := Stmt.This_Query.Expand; Handle : aliased System.Address; Res : int; begin Execute (Connection => Stmt.Connection, SQL => Sql_Query, Result => Res, Stmt => Handle); ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Res); Release_Stmt (Stmt.Connection, Handle); Result := Natural (Sqlite3_H.sqlite3_changes (Stmt.Connection)); end; end Execute; -- ------------------------------ -- Create an update statement -- ------------------------------ function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement_Access is Result : constant Sqlite_Update_Statement_Access := new Sqlite_Update_Statement; begin Result.Connection := Database; Result.Table := Table; Result.Update := Result.This_Query'Access; Result.Query := Result.This_Query'Access; Result.This_Query.Set_Dialect (Sqlite_Dialect'Access); return Result.all'Access; end Create_Statement; -- ------------------------------ -- Insert statement -- ------------------------------ -- ------------------------------ -- Execute the query -- ------------------------------ overriding procedure Execute (Stmt : in out Sqlite_Insert_Statement; Result : out Integer) is begin if Stmt.Table /= null then ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "INSERT INTO "); ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all); ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " ("); ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => False); ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ") VALUES("); ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => True); ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ")"); end if; declare Sql_Query : constant String := Stmt.This_Query.Expand; Handle : aliased System.Address; Res : int; begin Execute (Connection => Stmt.Connection, SQL => Sql_Query, Result => Res, Stmt => Handle); ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Res); Release_Stmt (Stmt.Connection, Handle); Result := Natural (Sqlite3_H.sqlite3_changes (Stmt.Connection)); end; end Execute; -- ------------------------------ -- Create an insert statement. -- ------------------------------ function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement_Access is Result : constant Sqlite_Insert_Statement_Access := new Sqlite_Insert_Statement; begin Result.Connection := Database; Result.Table := Table; Result.Update := Result.This_Query'Access; Result.This_Query.Set_Dialect (Sqlite_Dialect'Access); ADO.SQL.Set_Insert_Mode (Result.This_Query); return Result.all'Access; end Create_Statement; procedure Prepare (Stmt : in out Sqlite_Query_Statement; Query : in String) is Sql : Strings.chars_ptr := Strings.New_String (Query); Result : int; Handle : aliased System.Address; begin Result := Sqlite3_H.sqlite3_prepare_v2 (db => Stmt.Connection, zSql => Sql, nByte => int (Query'Length + 1), ppStmt => Handle'Address, pzTail => System.Null_Address); Strings.Free (Sql); if Result = Sqlite3_H.SQLITE_OK then Stmt.Stmt := Handle; else ADO.Drivers.Connections.Sqlite.Check_Error (Stmt.Connection, Result); end if; end Prepare; -- Execute the query procedure Execute (Query : in out Sqlite_Query_Statement) is use Sqlite3_H; use System; Result : int; begin if Query.This_Query.Has_Join then ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => " "); ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => Query.This_Query.Get_Join); end if; if Query.This_Query.Has_Filter then ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => " WHERE "); ADO.SQL.Append (Target => Query.This_Query.SQL, SQL => Query.This_Query.Get_Filter); end if; declare Expanded_Query : constant String := Query.Query.Expand; begin -- Execute the query Prepare (Query, Expanded_Query); Log.Debug ("Execute: {0}", Expanded_Query); Result := Sqlite3_H.sqlite3_step (Query.Stmt); if Result = Sqlite3_H.SQLITE_ROW then Query.Status := HAS_ROW; elsif Result = Sqlite3_H.SQLITE_DONE then Query.Status := DONE; else Query.Status := ERROR; declare Error : constant Strings.chars_ptr := Sqlite3_H.sqlite3_errmsg (Query.Connection); Message : constant String := Strings.Value (Error); begin Log.Error ("Query failed: '{0}'", Expanded_Query); Log.Error (" with error: '{0}'", Message); raise Invalid_Statement with "Query failed: " & Message; end; end if; end; end Execute; -- ------------------------------ -- Returns True if there is more data (row) to fetch -- ------------------------------ function Has_Elements (Query : in Sqlite_Query_Statement) return Boolean is use type System.Address; begin return Query.Stmt /= System.Null_Address and then Query.Status = HAS_ROW; end Has_Elements; -- ------------------------------ -- Fetch the next element -- ------------------------------ overriding procedure Next (Query : in out Sqlite_Query_Statement) is use type System.Address; Result : int; begin if Query.Stmt = System.Null_Address then Query.Status := ERROR; else Result := Sqlite3_H.sqlite3_step (Query.Stmt); if Result = Sqlite3_H.SQLITE_ROW then Query.Status := HAS_ROW; elsif Result = Sqlite3_H.SQLITE_DONE then Query.Status := DONE; else ADO.Drivers.Connections.Sqlite.Check_Error (Query.Connection, Result); Query.Status := ERROR; end if; end if; end Next; -- ------------------------------ -- Returns true if the column <b>Column</b> is null. -- ------------------------------ overriding function Is_Null (Query : in Sqlite_Query_Statement; Column : in Natural) return Boolean is Res : constant int := Sqlite3_H.sqlite3_column_type (Query.Stmt, int (Column)); begin return Res = Sqlite3_H.SQLITE_NULL; end Is_Null; -- Get the number of rows returned by the query function Get_Row_Count (Query : in Sqlite_Query_Statement) return Natural is pragma Unreferenced (Query); begin return 0; end Get_Row_Count; -- ------------------------------ -- Get the column value at position <b>Column</b> and -- return it as an <b>Int64</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. -- ------------------------------ overriding function Get_Int64 (Query : in Sqlite_Query_Statement; Column : in Natural) return Int64 is Result : constant Sqlite3_H.sqlite_int64 := Sqlite3_H.sqlite3_column_int64 (Query.Stmt, int (Column)); begin return Int64 (Result); end Get_Int64; -- ------------------------------ -- Get the column value at position <b>Column</b> and -- return it as an <b>Unbounded_String</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. -- ------------------------------ overriding function Get_Unbounded_String (Query : in Sqlite_Query_Statement; Column : in Natural) return Unbounded_String is use type Strings.chars_ptr; Text : constant Strings.chars_ptr := Sqlite3_H.sqlite3_column_text (Query.Stmt, int (Column)); begin if Text = Strings.Null_Ptr then return Null_Unbounded_String; else return To_Unbounded_String (Interfaces.C.Strings.Value (Text)); end if; end Get_Unbounded_String; -- ------------------------------ -- Get the column value at position <b>Column</b> and -- return it as an <b>Unbounded_String</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. -- ------------------------------ overriding function Get_String (Query : Sqlite_Query_Statement; Column : Natural) return String is use type Strings.chars_ptr; Text : constant Strings.chars_ptr := Sqlite3_H.sqlite3_column_text (Query.Stmt, int (Column)); begin if Text = Strings.Null_Ptr then return ""; else return Interfaces.C.Strings.Value (Text); end if; end Get_String; -- ------------------------------ -- Get the column value at position <b>Column</b> and -- return it as a <b>Blob</b> reference. -- ------------------------------ overriding function Get_Blob (Query : in Sqlite_Query_Statement; Column : in Natural) return ADO.Blob_Ref is use type System.Address; Text : constant System.Address := Sqlite3_H.sqlite3_column_blob (Query.Stmt, int (Column)); Len : constant int := Sqlite3_H.sqlite3_column_bytes (Query.Stmt, int (Column)); begin if Text = System.Null_Address or Len <= 0 then return Null_Blob; else return Get_Blob (Size => Natural (Len), Data => To_Chars_Ptr (Text)); end if; end Get_Blob; -- ------------------------------ -- Get the column value at position <b>Column</b> and -- return it as an <b>Time</b>. -- Raises <b>Invalid_Type</b> if the value cannot be converted. -- Raises <b>Invalid_Column</b> if the column does not exist. -- ------------------------------ function Get_Time (Query : in Sqlite_Query_Statement; Column : in Natural) return Ada.Calendar.Time is Text : constant Strings.chars_ptr := Sqlite3_H.sqlite3_column_text (Query.Stmt, int (Column)); begin return ADO.Statements.Get_Time (ADO.Statements.To_Chars_Ptr (Text)); end Get_Time; -- ------------------------------ -- Get the column type -- ------------------------------ overriding function Get_Column_Type (Query : in Sqlite_Query_Statement; Column : in Natural) return ADO.Schemas.Column_Type is Res : constant int := Sqlite3_H.sqlite3_column_type (Query.Stmt, int (Column)); begin case Res is when Sqlite3_H.SQLITE_NULL => return ADO.Schemas.T_NULL; when Sqlite3_H.SQLITE_INTEGER => return ADO.Schemas.T_INTEGER; when Sqlite3_H.SQLITE_FLOAT => return ADO.Schemas.T_FLOAT; when Sqlite3_H.SQLITE_TEXT => return ADO.Schemas.T_VARCHAR; when Sqlite3_H.SQLITE_BLOB => return ADO.Schemas.T_BLOB; when others => return ADO.Schemas.T_UNKNOWN; end case; end Get_Column_Type; -- ------------------------------ -- Get the column name. -- Raises <b>Invalid_Column</b> if the column does not exist. -- ------------------------------ overriding function Get_Column_Name (Query : in Sqlite_Query_Statement; Column : in Natural) return String is use type Interfaces.C.Strings.chars_ptr; Name : constant Interfaces.C.Strings.chars_ptr := Sqlite3_H.sqlite3_column_name (Query.Stmt, int (Column)); begin if Name = Interfaces.C.Strings.Null_Ptr then return ""; else return Interfaces.C.Strings.Value (Name); end if; end Get_Column_Name; -- ------------------------------ -- Get the number of columns in the result. -- ------------------------------ overriding function Get_Column_Count (Query : in Sqlite_Query_Statement) return Natural is begin return Natural (Sqlite3_H.sqlite3_column_count (Query.Stmt)); end Get_Column_Count; -- ------------------------------ -- Deletes the query statement. -- ------------------------------ overriding procedure Finalize (Query : in out Sqlite_Query_Statement) is begin Release_Stmt (Query.Connection, Query.Stmt); end Finalize; -- ------------------------------ -- Create the query statement. -- ------------------------------ function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement_Access is Result : constant Sqlite_Query_Statement_Access := new Sqlite_Query_Statement; begin Result.Connection := Database; Result.Query := Result.This_Query'Access; Result.This_Query.Set_Dialect (Sqlite_Dialect'Access); if Table /= null then ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "SELECT "); for I in Table.Members'Range loop if I > Table.Members'First then ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => ", "); end if; ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "o."); ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Members (I).all); end loop; ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " FROM "); ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Table.all); ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " AS o "); end if; return Result.all'Access; end Create_Statement; -- ------------------------------ -- Create the query statement. -- ------------------------------ function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access; Query : in String) return Query_Statement_Access is pragma Unreferenced (Query); Result : constant Sqlite_Query_Statement_Access := new Sqlite_Query_Statement; begin Result.Connection := Database; Result.Query := Result.This_Query'Access; return Result.all'Access; end Create_Statement; end ADO.Statements.Sqlite;
----------------------------------------------------------------------- -- mgrep-scanner -- Scan a directory and parse mail -- Copyright (C) 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Interfaces.C.Strings; with Ada.Directories; with Ada.IO_Exceptions; with Mail.Parsers; with Util.Systems.Types; with Util.Systems.Os; with Util.Streams.Raw; with Util.Log.Loggers; package body Mgrep.Scanner is use Ada.Strings.Unbounded; use Ada.Directories; use type Util.Systems.Types.File_Type; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Mgrep.Scanner"); procedure Add_Directory (Scanner : in out Scanner_Type; Path : in String) is begin Util.Concurrent.Counters.Increment (Scanner.Scan_Dir_Count); Scanner.Directories.Append (Path); end Add_Directory; procedure Add_File (Scanner : in out Scanner_Type; Path : in String) is Work : Work_Type; begin Util.Concurrent.Counters.Increment (Scanner.Job_Count); Util.Concurrent.Counters.Increment (Scanner.Scan_File_Count); Work.Path := To_Unbounded_String (Path); Work.Kind := SCAN_MAIL; Work.Scanner := Scanner.Self; Scanner.Manager.Execute (Work); end Add_File; procedure Scan_File (Scanner : in out Scanner_Type; Path : in String) is File : aliased Util.Streams.Raw.Raw_Stream; -- Text : aliased Util.Streams.Texts.Reader_Stream; Matcher : aliased Mgrep.Matcher.Mail_Processor (Scanner.Rule); Parser : Mail.Parsers.Parser_Type; Fd : Util.Systems.Os.File_Type; P : Interfaces.C.Strings.chars_ptr; begin Log.Info ("Scanning mail {0}", Path); Util.Concurrent.Counters.Increment (Scanner.File_Count); P := Interfaces.C.Strings.New_String (Path); Fd := Util.Systems.Os.Sys_Open (P, Util.Systems.Os.O_RDONLY, 8#600#); Interfaces.C.Strings.Free (P); if Fd = Util.Systems.Os.NO_FILE then raise Ada.IO_Exceptions.Name_Error with Path; end if; File.Initialize (Fd); -- Text.Initialize (File'Unchecked_Access); Parser.Parse (File'Unchecked_Access, Matcher'Access); exception when E : others => Log.Error ("Exception: " & Ada.Exceptions.Exception_Message (E)); end Scan_File; procedure Scan_Directory (Scanner : in out Scanner_Type; Path : in String) is Search_Filter : constant Ada.Directories.Filter_Type := (Ada.Directories.Ordinary_File => True, Ada.Directories.Directory => True, Ada.Directories.Special_File => False); Search : Ada.Directories.Search_Type; Ent : Ada.Directories.Directory_Entry_Type; Is_Zero : Boolean; begin Log.Info ("Scanning directory {0}", Path); Util.Concurrent.Counters.Increment (Scanner.Dir_Count); Ada.Directories.Start_Search (Search, Directory => Path, Pattern => "*", Filter => Search_Filter); while Ada.Directories.More_Entries (Search) loop Ada.Directories.Get_Next_Entry (Search, Ent); declare Name : constant String := Ada.Directories.Simple_Name (Ent); Kind : constant File_Kind := Ada.Directories.Kind (Ent); Fpath : constant String := Ada.Directories.Full_Name (Ent); begin if Kind /= Ada.Directories.Directory then Scanner.Add_File (Fpath); elsif Name /= "." and then Name /= ".." then Scanner.Add_Directory (Fpath); end if; end; end loop; Util.Concurrent.Counters.Decrement (Scanner.Scan_Dir_Count, Is_Zero); end Scan_Directory; procedure Start (Scanner : in out Scanner_Type) is begin Scanner.Manager.Start (Autostop => True); end Start; procedure Process (Scanner : in out Scanner_Type; Done : out Boolean) is begin while not Scanner.Directories.Is_Empty loop declare Path : constant String := Scanner.Directories.Last_Element; begin Scanner.Directories.Delete_Last; Scanner.Scan_Directory (Path); exit when Scanner.Directories.Is_Empty; exit when Scanner.Manager.Get_Count > QUEUE_SIZE * 3 / 4; end; end loop; Done := Scanner.Directories.Is_Empty and then Scanner.Manager.Get_Count = 0 and then Util.Concurrent.Counters.Value (Scanner.Job_Count) = 0; end Process; procedure Stop (Scanner : in out Scanner_Type) is begin Scanner.Manager.Wait; Scanner.Manager.Stop; end Stop; function Get_File_Count (Scanner : in Scanner_Type) return Natural is begin return Util.Concurrent.Counters.Value (Scanner.File_Count); end Get_File_Count; function Get_Directory_Count (Scanner : in Scanner_Type) return Natural is begin return Util.Concurrent.Counters.Value (Scanner.Dir_Count); end Get_Directory_Count; procedure Execute (Work : in out Work_Type) is begin case Work.Kind is when SCAN_DIRECTORY => Work.Scanner.Scan_Directory (To_String (Work.Path)); when SCAN_MAIL => Work.Scanner.Scan_File (To_String (Work.Path)); end case; Util.Concurrent.Counters.Decrement (Work.Scanner.Job_Count); end Execute; procedure Error (Work : in out Work_Type; Ex : in Ada.Exceptions.Exception_Occurrence) is begin Log.Error ("Error while executing work", Ex); Util.Concurrent.Counters.Decrement (Work.Scanner.Job_Count); end Error; overriding procedure Initialize (Scanner : in out Scanner_Type) is begin Scanner.Self := Scanner'Unrestricted_Access; end Initialize; end Mgrep.Scanner;
with System.Long_Long_Float_Types; with System.Long_Long_Integer_Types; package body Ada.Fixed is subtype Long_Long_Unsigned is System.Long_Long_Integer_Types.Long_Long_Unsigned; pragma Compile_Time_Error ( Long_Long_Float'Size < 96, "Long_Long_Float is too short for the intermediate format."); -- implementation procedure Divide ( Dividend : Dividend_Type; Divisor : Divisor_Type; Quotient : out Quotient_Type; Remainder : out Remainder_Type) is begin if Divisor = 0.0 and then Division_Check'Enabled then raise Constraint_Error; end if; if Dividend_Type'Small = Divisor_Type'Small then declare subtype LLU is Long_Long_Unsigned; N : constant LLU := LLU'Integer_Value (Dividend_Type'(abs Dividend)); D : constant LLU := LLU'Integer_Value (Divisor_Type'(abs Divisor)); Q : LLU; R : LLU; begin System.Long_Long_Integer_Types.Divide (N, D, Q, R); Quotient := Quotient_Type (Q); Remainder := Remainder_Type (Dividend_Type'Fixed_Value (R)); end; elsif Dividend_Type'Small >= 1.0 and then Divisor_Type'Small >= 1.0 then declare subtype LLF is Long_Long_Float; N : constant LLF := LLF (abs Dividend); D : constant LLF := LLF (abs Divisor); Q : LLF; R : LLF; begin System.Long_Long_Float_Types.Divide (N, D, Q, R); Quotient := Quotient_Type (Q); Remainder := Remainder_Type (R); end; else declare subtype LLF is Long_Long_Float; ND_Smallest : constant LLF := LLF'Min (Dividend_Type'Small, Divisor_Type'Small); N : constant LLF := (Dividend_Type'Small / ND_Smallest) * LLF ( Long_Long_Integer'Integer_Value ( Dividend_Type'(abs Dividend))); D : constant LLF := (Divisor_Type'Small / ND_Smallest) * LLF ( Long_Long_Integer'Integer_Value ( Divisor_Type'(abs Divisor))); Q : LLF; R : LLF; begin System.Long_Long_Float_Types.Divide (N, D, Q, R); Quotient := Quotient_Type (Q); Remainder := Remainder_Type (ND_Smallest * R); end; end if; if (Dividend < 0.0) /= (Divisor < 0.0) then Quotient := -Quotient; end if; if Dividend < 0.0 then Remainder := -Remainder; end if; end Divide; end Ada.Fixed;
-- The Beer-Ware License (revision 42) -- -- Jacob Sparre Andersen <jacob@jacob-sparre.dk> wrote this. As long as you -- retain this notice you can do whatever you want with this stuff. If we meet -- some day, and you think this stuff is worth it, you can buy me a beer in -- return. -- -- Jacob Sparre Andersen package Sound is type Sample_Frequency is range 4_000 .. 196_000; Default_Sample_Frequency : constant Sample_Frequency := 48_000; type Line_Mode is (Input, Output); end Sound;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Tools Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2015-2018, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Asis.Definitions; with Asis.Elements; with Asis.Expressions; with Properties.Tools; package body Properties.Expressions.Attribute_Reference is function Call_Convention (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Convention_Property) return Engines.Convention_Kind is pragma Unreferenced (Engine, Name); Kind : constant Asis.Attribute_Kinds := Asis.Elements.Attribute_Kind (Element); begin case Kind is when Asis.An_Image_Attribute | Asis.A_Ceiling_Attribute | Asis.A_Floor_Attribute | Asis.A_Max_Attribute | Asis.A_Min_Attribute | Asis.A_Pos_Attribute | Asis.A_Pred_Attribute | Asis.A_Succ_Attribute | Asis.A_Val_Attribute | Asis.A_Rounding_Attribute | Asis.A_Wide_Wide_Image_Attribute | Asis.A_Wide_Wide_Value_Attribute => return Engines.Intrinsic; when others => raise Program_Error with "Unimplemented Call_Convention attribute: " & Asis.Attribute_Kinds'Image (Kind); end case; end Call_Convention; ---------- -- Code -- ---------- function Code (Engine : access Engines.Contexts.Context; Element : Asis.Expression; Name : Engines.Text_Property) return League.Strings.Universal_String is function Array_Property (Kind : Asis.Attribute_Kinds) return League.Strings.Universal_String; -------------------- -- Array_Property -- -------------------- function Array_Property (Kind : Asis.Attribute_Kinds) return League.Strings.Universal_String is begin case Kind is when Asis.A_Length_Attribute => return League.Strings.To_Universal_String ("_length"); when Asis.A_First_Attribute => return League.Strings.To_Universal_String ("_first"); when Asis.A_Last_Attribute => return League.Strings.To_Universal_String ("_last"); when others => raise Program_Error; end case; end Array_Property; Prefix : constant Asis.Expression := Asis.Expressions.Prefix (Element); Text : League.Strings.Universal_String; Kind : constant Asis.Attribute_Kinds := Asis.Elements.Attribute_Kind (Element); begin case Kind is when Asis.An_Address_Attribute => Text := Engine.Text.Get_Property (Prefix, Engines.Address); if Tools.Is_Array (Prefix) then Text.Append (".A"); end if; return Text; when Asis.An_Access_Attribute | Asis.An_Unchecked_Access_Attribute => return Engine.Text.Get_Property (Prefix, Engines.Address); when Asis.A_Class_Attribute => -- FIX ME, but I have no idea how return Engine.Text.Get_Property (Prefix, Name); when Asis.A_Component_Size_Attribute => declare Decl : constant Asis.Declaration := Properties.Tools.Corresponding_Declaration (Prefix); View : constant Asis.Definition := Properties.Tools.Type_Declaration_View (Decl); Comp : constant Asis.Definition := Asis.Definitions.Array_Component_Definition (View); begin return Engine.Text.Get_Property (Comp, Engines.Size); end; when Asis.A_Length_Attribute | Asis.A_First_Attribute | Asis.A_Last_Attribute => declare Args : constant Asis.Expression_List := Asis.Expressions.Attribute_Designator_Expressions (Element); begin Text := Engine.Text.Get_Property (Prefix, Name); Text.Append ("."); Text.Append (Array_Property (Kind)); Text.Append ("["); if Args'Length = 0 then Text.Append ("0]"); else Text.Append (Engine.Text.Get_Property (Args (Args'First), Name)); Text.Append ("-1]"); end if; return Text; end; when Asis.A_Position_Attribute => declare Parent : constant Asis.Identifier := Asis.Expressions.Prefix (Prefix); Selector : constant Asis.Identifier := Asis.Expressions.Selector (Prefix); Down : League.Strings.Universal_String; begin Text := Engine.Text.Get_Property (Parent, Name); Text.Append ("._pos_"); Down := Engine.Text.Get_Property (Selector, Name); Text.Append (Down); return Text; end; when Asis.A_Model_Epsilon_Attribute => Text.Append ("Number.EPSILON"); return Text; when Asis.An_Implementation_Defined_Attribute => declare Id : constant Asis.Identifier := Asis.Expressions.Attribute_Designator_Identifier(Element); Attr : constant Asis.Program_Text := Asis.Expressions.Name_Image (Id); begin if Attr = "Unrestricted_Access" then return Engine.Text.Get_Property (Prefix, Engines.Address); else raise Program_Error with "Unimplemented implementation defined attribute"; end if; end; when others => raise Program_Error with "Unimplemented attribute: " & Asis.Attribute_Kinds'Image (Kind); end case; end Code; -------------------- -- Intrinsic_Name -- -------------------- function Intrinsic_Name (Engine : access Engines.Contexts.Context; Element : Asis.Declaration; Name : Engines.Text_Property) return League.Strings.Universal_String is pragma Unreferenced (Engine, Name); Kind : constant Asis.Attribute_Kinds := Asis.Elements.Attribute_Kind (Element); begin return League.Strings.To_Universal_String (Asis.Attribute_Kinds'Wide_Wide_Image (Kind)); end Intrinsic_Name; end Properties.Expressions.Attribute_Reference;
-- { dg-do run } -- { dg-options "-O2" } -- The issue which prompted the test is a compilation failure. Might -- as well verify that the generated code performs as expected. with opt64_pkg; use opt64_pkg; procedure opt64 is procedure assert (T : boolean) is begin if not T then raise program_error; end if; end; begin Encode (1); assert (last_hash = "1"); Encode (2); assert (last_hash = "2"); Encode (3); assert (last_hash = "3"); Encode (6); assert (last_hash = "?"); end;
-- -- -- package Copyright (c) Dmitry A. Kazakov -- -- GNAT.Sockets.Connection_State_Machine Luebeck -- -- Implementation Winter, 2012 -- -- -- -- Last revision : 13:13 14 Sep 2019 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This library -- -- is distributed in the hope that it will be useful, but WITHOUT -- -- ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from -- -- this unit, or you link this unit with other files to produce an -- -- executable, this unit does not by itself cause the resulting -- -- executable to be covered by the GNU General Public License. This -- -- exception does not however invalidate any other reasons why the -- -- executable file might be covered by the GNU Public License. -- --____________________________________________________________________-- with Ada.Exceptions; use Ada.Exceptions; with Ada.IO_Exceptions; use Ada.IO_Exceptions; with Ada.Tags; use Ada.Tags; with Strings_Edit.Integers; use Strings_Edit.Integers; with Ada.Unchecked_Deallocation; with Ada.Containers.Ordered_Maps; -- Changed to use standard library by J. Carter 2021 with System.Address_Image; with System.Address_To_Access_Conversions; package body GNAT.Sockets.Connection_State_Machine is procedure Check_Initialization_Stream ( Item : Data_Item'Class; Stream : Root_Stream_Type'Class ) is begin if Stream not in Initialization_Stream'Class then Raise_Exception ( Use_Error'Identity, ( "Stream attribute of " & Expanded_Name (Item'Tag) & " used with a non-initialization stream " & Expanded_Name (Stream'Tag) ) ); end if; end Check_Initialization_Stream; procedure Generic_Dump_Stream ( Stream : Initialization_Stream'Class; Prefix : String := "" ) is use Strings_Edit; Trailer : constant String (Prefix'Range) := (others => ' '); begin Put_Line ( Prefix & "stream at " & System.Address_Image (Stream'Address) & " items: " & Image (Integer (Stream.Count)) & ", to ignore next: " & Image (Integer (Stream.Ignore)) ); for Index in 1..Stream.Count loop Put_Line ( Trailer & Image (Integer (Index)) & " " & Ada.Tags.Expanded_Name (Get (Stream.Data, Index).all'Tag) & " at " & System.Address_Image (Get (Stream.Data, Index).all'Address) ); end loop; end Generic_Dump_Stream; package body Generic_Dump is procedure Put is new Generic_Dump_Stream; procedure Put ( Item : Data_Item'Class; Prefix : String := "" ) is begin Put_Line ( Prefix & Ada.Tags.Expanded_Name (Item'Tag) & " at " & System.Address_Image (Item'Address) ); declare Nested : constant Data_Item_Ptr_Array := Get_Children (Item); begin if Nested'Length > 0 then declare Trailer : constant String (Prefix'Range) := (others => ' '); begin for Index in Nested'Range loop Put ( Nested (Index).all, Trailer & " " & Image (Integer (Index)) & " " ); end loop; end; end if; end; end Put; procedure Put ( Buffer : in out External_String_Buffer; Prefix : String ) is Trailer : constant String (Prefix'Range) := (others => ' '); This : Allocator_Data_Ptr := Buffer.Allocators; begin Put_Line ( Prefix & "external buffer at " & System.Address_Image (Buffer'Address) & " allocators: " ); for Index in Positive'Range loop exit when This = null; Put ( Trailer & " " & Image (Index) & " at " & System.Address_Image (This.all'Address) ); Put_Line ( " -> " & Ada.Tags.Expanded_Name (This.Allocator.all'Tag) & " at " & System.Address_Image (This.Allocator.all'Address) ); This := This.Previous; end loop; end Put; procedure Put_Stream ( Item : Data_Item'Class; Prefix : String := "" ) is Buffer : aliased External_String_Buffer (64); Stream : aliased Initialization_Stream; begin Stream.Shared := Buffer'Unchecked_Access; Data_Item'Class'Write (Stream'Access, Item); Put (Stream, Prefix); end Put_Stream; procedure Put_Call_Stack ( Client : State_Machine'Class; Prefix : String := "" ) is Depth : Natural := 0; This : Sequence_Ptr := Client.Data; begin while This /= null loop Depth := Depth + 1; This := This.Caller; end loop; declare Stack : Sequence_Array (1..Depth); procedure Dump ( Start : Positive; Prefix : String ) is This : Sequence renames Stack (Start).all; List : Data_Item_Ptr_Array renames This.List; begin for Index in List'Range loop if Index = This.Current then Put_Line ( Prefix & "->" & Image (Integer (Index)) & " " & Ada.Tags.Expanded_Name (List (Index).all'Tag) ); if Start < Stack'Last then Dump (Start + 1, Prefix & " "); end if; else Put_Line ( Prefix & " " & Image (Integer (Index)) & " " & Ada.Tags.Expanded_Name (List (Index).all'Tag) ); end if; end loop; end Dump; begin This := Client.Data; for Index in reverse Stack'Range loop Stack (Index) := This; This := This.Caller; end loop; Put_Line (Prefix & Ada.Tags.Expanded_Name (Client'Tag)); Dump (1, Prefix & " "); end; end Put_Call_Stack; end Generic_Dump; package Address_Maps Is new Ada.Containers.Ordered_Maps (Key_Type => System.Address, Element_Type => Natural, "<" => System."<"); Prefixes : Address_Maps.Map; function Get_Prefix ( Stream : Root_Stream_Type'Class ) return String is begin if Prefixes.Contains (Stream'Address) then declare Result : constant String := (1 .. Prefixes.Element (Stream'Address) => ' '); begin return Result & System.Address_Image (Stream'Address) & ' '; end; else return ""; end if; end Get_Prefix; procedure Set_Prefix ( Stream : Root_Stream_Type'Class; Prefix : Natural ) is begin Prefixes.Include (Key => Stream'Address, New_Item => Prefix); end Set_Prefix; procedure Add ( Stream : in out Initialization_Stream; Item : Data_Item'Class; Nested : Data_Item_Offset := 0 ) is begin if Stream.Ignore > 0 then Stream.Ignore := Stream.Ignore - 1; else Stream.Count := Stream.Count + 1; Put (Stream.Data, Stream.Count, Self (Item)); end if; Stream.Ignore := Stream.Ignore + Nested; end Add; procedure Allocate ( Pool : in out Arena_Pool; Address : out System.Address; Size : Storage_Count; Alignment : Storage_Count ) is Size_In_Characters : constant Storage_Count := ( (Size * System.Storage_Unit + Character'Size - 1) / Character'Size ); Length : Natural renames Pool.Parent.Length; Buffer : String renames Pool.Parent.Buffer; Last : Integer; begin Align_To_The_Margin : for Index in 1..Alignment loop exit when Length >= Buffer'Last; if Buffer (Length + 1)'Address mod Alignment = 0 then Last := Length + Natural (Size_In_Characters); loop exit Align_To_The_Margin when Last >= Buffer'Last; exit when ( ( Buffer (Last + 1)'Address - Buffer (Length + 1)'Address ) <= Size ); Last := Last + 1; end loop; Address := Buffer (Length + 1)'Address; Length := Last + 1; Pool.Parent.Count := Pool.Parent.Count + 1; return; end if; Length := Length + 1; end loop Align_To_The_Margin; Raise_Exception ( Storage_Error'Identity, ( "Arena pool exhausted, " & Image (Length) & " used out of " & Image (Buffer'Last) & ", items allocated " & Image (Pool.Parent.Count) ) ); end Allocate; procedure Call ( Client : in out State_Machine; Pointer : Stream_Element_Offset; Data : Sequence_Ptr; State : Stream_Element_Offset := 0 ) is begin Client.Fed := Client.Fed + Unsigned_64 (Pointer - Client.Start); Client.Start := Pointer; Data.Caller := Client.Data; Client.Data := Data; Data.Current := 0; Data.State := State; end Call; procedure Connected (Client : in out State_Machine) is Stream : aliased Initialization_Stream; begin Initialize (Connection (Client)); State_Machine'Class'Write ( Stream'Access, State_Machine'Class (Client) ); Free (Client.Data); if Stream.Count > 0 then Client.Data := new Sequence' ( Length => Stream.Count, Caller => null, State => 0, Current => 1, List => Stream.Data.Vector (1..Stream.Count) ); end if; end Connected; procedure Deallocate ( Pool : in out Arena_Pool; Address : System.Address; Size : Storage_Count; Alignment : Storage_Count ) is begin null; end Deallocate; procedure End_Of_Subsequence ( Item : in out Data_Item; Data : Stream_Element_Array; Pointer : Stream_Element_Offset; Client : in out State_Machine'Class; State : in out Stream_Element_Offset ) is begin null; end End_Of_Subsequence; procedure Enumerate ( Stream : access Root_Stream_Type'Class; Pool : Arena_Pool ) is begin null; end Enumerate; procedure Enumerate ( Stream : access Root_Stream_Type'Class; Item : State_Machine ) is begin null; end Enumerate; procedure Enumerate ( Stream : access Root_Stream_Type'Class; Item : Data_Block ) is begin Check_Initialization_Stream (Item, Stream.all); declare Count : Data_Item_Offset := 0; Block : Data_Block'Class renames Self (Item).all; This : Initialization_Stream'Class renames Initialization_Stream'Class (Stream.all); begin if not Item.Initialized then declare Counter : aliased Initialization_Stream; begin if This.Parent = null then Counter.Parent := This.Shared'Access; else Counter.Parent := This.Parent; end if; Block.Initialized := True; Data_Block'Class'Write (Counter'Access, Block); if Counter.Count <= 1 then Raise_Exception ( Use_Error'Identity, ( "Block " & Expanded_Name (Block'Tag) & " is empty (contains no items)" ) ); end if; Self (Item).Data := new Sequence' ( Length => Counter.Count - 1, Caller => null, State => 0, Current => 1, List => Counter.Data.Vector ( 2 .. Counter.Count ) ); Count := Data_Item_Offset (Get_Size (Item)) - 1; end; end if; Add (This, Item, Count); end; end Enumerate; procedure Enumerate ( Stream : access Root_Stream_Type'Class; Item : Data_Item ) is begin Check_Initialization_Stream (Item, Stream.all); declare This : Initialization_Stream'Class renames Initialization_Stream'Class (Stream.all); begin Add (This, Item); end; end Enumerate; procedure Enumerate ( Stream : access Root_Stream_Type'Class; Item : Data_Selector ) is begin Check_Initialization_Stream (Item, Stream.all); declare Selector : Data_Selector'Class renames Self (Data_Selector'Class (Item)).all; Count : Data_Item_Offset := 0; This : Initialization_Stream'Class renames Initialization_Stream'Class (Stream.all); begin if not Selector.Initialized then Selector.Initialized := True; declare Counter : aliased Initialization_Stream; begin Selector.Initialized := True; Data_Selector'Class'Write (Counter'Access, Selector); if Counter.Count <= 1 then Raise_Exception ( Use_Error'Identity, ( "Selector " & Expanded_Name (Data_Item'Class (Item)'Tag) & " contains no alternatives" ) ); end if; Selector.Alternatives := new Alternatives_List ( Natural (Counter.Count) - 1 ); declare This : Data_Item_Ptr; List : Sequence_Array renames Item.Alternatives.List; begin for Index in List'Range loop This := Get ( Counter.Data, Data_Item_Offset (Index) + 1 ); List (Index) := new Sequence' ( Length => 1, Caller => null, State => 0, Current => 1, List => (1 => This) ); end loop; end; Count := Data_Item_Offset (Get_Size (Item)) - 1; end; end if; Add (This, Item, Count); end; end Enumerate; procedure Enumerate ( Stream : access Root_Stream_Type'Class; Item : Shared_Data_Item ) is begin Check_Initialization_Stream (Item, Stream.all); declare This : Initialization_Stream'Class renames Initialization_Stream'Class (Stream.all); begin if not Item.Initialized then declare Shared : Shared_Data_Item'Class renames Self (Item).all; begin Shared.Initialized := True; Shared.Previous := This.Shared; This.Shared := Shared'Unchecked_Access; end; end if; Add (This, Item); end; end Enumerate; procedure Erase (Buffer : in out External_String_Buffer) is This : Allocator_Data_Ptr := Buffer.Allocators; Next : Allocator_Data_Ptr; begin while This /= null loop Next := This.Previous; This.Previous := null; Freed (This.Allocator.all); This := Next; end loop; Buffer.Length := 0; Buffer.Count := 0; Buffer.Allocators := null; end Erase; procedure External_Initialize ( Item : Data_Item'Class; Shared : Shared_Data_Item_Ptr := null ) is Stream : aliased Initialization_Stream; begin Stream.Shared := Shared; Data_Item'Class'Write (Stream'Access, Item); end External_Initialize; procedure Feed ( Item : in out Shared_Data_Item; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Client : in out State_Machine'Class; State : in out Stream_Element_Offset ) is begin State := 0; end Feed; procedure Feed ( Item : in out External_String_Buffer; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Client : in out State_Machine'Class; State : in out Stream_Element_Offset ) is begin Erase (Item); -- Erase the buffer Feed (Shared_Data_Item (Item), Data, Pointer, Client, State); end Feed; procedure Feed ( Item : in out Data_Block; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Client : in out State_Machine'Class; State : in out Stream_Element_Offset ) is begin Call (Client, Pointer, Item.Data); State := 0; end Feed; procedure Feed ( Item : in out Data_Null; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Client : in out State_Machine'Class; State : in out Stream_Element_Offset ) is begin State := 0; end Feed; procedure Feed ( Item : in out Data_Selector; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset; Client : in out State_Machine'Class; State : in out Stream_Element_Offset ) is begin Call (Client, Pointer, Item.Alternatives.List (Item.Current)); State := 0; end Feed; procedure Finalize (Client : in out State_Machine) is begin if Client.Data /= null then while Client.Data.Caller /= null loop Client.Data := Client.Data.Caller; end loop; Free (Client.Data); end if; Finalize (Connection (Client)); end Finalize; procedure Finalize (Item : in out Data_Block) is begin Free (Item.Data); end Finalize; procedure Finalize (Item : in out Data_Selector) is procedure Free is new Ada.Unchecked_Deallocation ( Alternatives_List, Alternatives_List_Ptr ); begin if Item.Alternatives /= null then declare List : Sequence_Array renames Item.Alternatives.List; begin for Index in List'Range loop Free (List (Index)); end loop; end; Free (Item.Alternatives); end if; end Finalize; procedure Finalize (Buffer : in out External_String_Buffer) is begin Erase (Buffer); Buffer.Allocators := null; Finalize (Shared_Data_Item (Buffer)); end Finalize; procedure Freed (Item : in out Data_Item) is begin null; end Freed; package From_Block_Address is new System.Address_To_Access_Conversions (Data_Block'Class); package From_Item_Address is new System.Address_To_Access_Conversions (Data_Item'Class); package From_Selector_Address is new System.Address_To_Access_Conversions (Data_Selector'Class); package From_Shared_Item_Address is new System.Address_To_Access_Conversions (Shared_Data_Item'Class); function Get_Alternative (Item : Data_Selector) return Positive is begin return Item.Current; end Get_Alternative; function Get_Alternatives_Number (Item : Data_Selector) return Positive is begin if not Item.Initialized or else Item.Alternatives = null then Raise_Exception ( Use_Error'Identity, ( "Selector " & Expanded_Name (Data_Item'Class (Item)'Tag) & " was not properly initialized" ) ); end if; return Positive (Item.Alternatives.Size); end Get_Alternatives_Number; function Get_Children ( Item : Data_Item ) return Data_Item_Ptr_Array is begin return (1..0 => null); end Get_Children; function Get_Children ( Item : Data_Block ) return Data_Item_Ptr_Array is Length : Data_Item_Offset := 0; begin if not Item.Initialized or else Item.Data = null then Raise_Exception ( Use_Error'Identity, ( "Block " & Expanded_Name (Data_Item'Class (Item)'Tag) & " was not properly initialized" ) ); end if; return Item.Data.List; end Get_Children; function Get_Children ( Item : Data_Selector ) return Data_Item_Ptr_Array is Length : Data_Item_Offset := 0; begin if not Item.Initialized or else Item.Alternatives = null then Raise_Exception ( Use_Error'Identity, ( "Selector " & Expanded_Name (Data_Item'Class (Item)'Tag) & " was not properly initialized" ) ); end if; for Index in Item.Alternatives.List'Range loop Length := Length + Item.Alternatives.List (Index).List'Length; end loop; declare Result : Data_Item_Ptr_Array (1..Length); No : Data_Item_Address := 1; begin for Index in Item.Alternatives.List'Range loop declare Alternative : Data_Item_Ptr_Array renames Item.Alternatives.List (Index).List; begin Result (No..No + Alternative'Length - 1) := Alternative; No := No + Alternative'Length; end; end loop; return Result; end; end Get_Children; function Get_Length (Item : Data_Block) return Positive is begin if not Item.Initialized or else Item.Data = null then Raise_Exception ( Use_Error'Identity, ( "Block " & Expanded_Name (Data_Item'Class (Item)'Tag) & " was not properly initialized" ) ); end if; return Positive (Item.Data.Length); end Get_Length; function Get_Size (Item : Data_Block) return Natural is begin if not Item.Initialized or else Item.Data = null then Raise_Exception ( Use_Error'Identity, ( "Block " & Expanded_Name (Data_Item'Class (Item)'Tag) & " was not properly initialized" ) ); end if; declare Result : Natural := 1; List : Data_Item_Ptr_Array renames Item.Data.List; begin for Index in List'Range loop Result := Result + Get_Size (List (Index).all); end loop; return Result; end; end Get_Size; function Get_Size (Item : Data_Item) return Natural is begin return 1; end Get_Size; function Get_Size (Item : Data_Selector) return Natural is begin if not Item.Initialized or else Item.Alternatives = null then Raise_Exception ( Use_Error'Identity, ( "Selector " & Expanded_Name (Data_Item'Class (Item)'Tag) & " was not properly initialized" ) ); end if; declare Result : Natural := 1; Sequence : Sequence_Array renames Item.Alternatives.List; begin for Index in Sequence'Range loop declare List : Data_Item_Ptr_Array renames Sequence (Index).List; begin for Index in List'Range loop Result := Result + Get_Size (List (Index).all); end loop; end; end loop; return Result; end; end Get_Size; procedure Read ( Stream : in out Initialization_Stream; Item : out Stream_Element_Array; Last : out Stream_Element_Offset ) is begin Last := Item'Last; end Read; procedure Received ( Client : in out State_Machine; Data : Stream_Element_Array; Pointer : in out Stream_Element_Offset ) is begin Pointer := Data'First; while Pointer <= Data'Last loop Client.Start := Pointer; Feed ( Client.Data.List (Client.Data.Current).all, Data, Pointer, Client, Client.State ); Client.Fed := Client.Fed + Unsigned_64 (Pointer - Client.Start); if Client.State = 0 then -- Done with this item Client.Data.Current := Client.Data.Current + 1; while Client.Data.Current > Client.Data.Length loop if Client.Data.Caller = null then Client.Data.Current := 1; Process_Packet (State_Machine'Class (Client)); exit; end if; Client.State := Client.Data.State; -- Restore state Client.Data := Client.Data.Caller; if Client.State /= 0 then End_Of_Subsequence ( Client.Data.List (Client.Data.Current).all, Data, Pointer, Client, Client.State ); exit when Client.State /= 0; end if; Client.Data.Current := Client.Data.Current + 1; end loop; else exit when Pointer > Data'Last; -- All data consumed Raise_Exception ( Status_Error'Identity, ( "Unprocessed data left when after return from " & Expanded_Name ( Client.Data.List ( Client.Data.Current ) .all'Tag ) ) ); end if; end loop; end Received; function Self (Item : Data_Block'Class) return Data_Block_Ptr is use From_Block_Address; begin return To_Pointer (Item'Address).all'Unchecked_Access; end Self; function Self (Item : Data_Item'Class) return Data_Item_Ptr is use From_Item_Address; begin return To_Pointer (Item'Address).all'Unchecked_Access; end Self; function Self (Item : Data_Selector'Class) return Data_Selector_Ptr is use From_Selector_Address; begin return To_Pointer (Item'Address).all'Unchecked_Access; end Self; function Self (Item : Shared_Data_Item'Class) return Shared_Data_Item_Ptr is use From_Shared_Item_Address; begin return To_Pointer (Item'Address).all'Unchecked_Access; end Self; procedure Set_Alternative ( Item : in out Data_Selector; Alternative : Positive ) is begin if Alternative > Get_Alternatives_Number (Item) then Raise_Exception ( Constraint_Error'Identity, ( "Invalid alternative number of selector " & Expanded_Name (Data_Item'Class (Item)'Tag) ) ); end if; Item.Current := Alternative; end Set_Alternative; function Storage_Size ( Pool : Arena_Pool ) return Storage_Count is begin return Pool.Parent.Buffer'Size / System.Storage_Unit; end Storage_Size; function To_Integer (Value : Unsigned_8) return Integer_8 is begin if Value < 2**7 then return Integer_8 (Value); else return Integer_8 (not Value) - 1; end if; end To_Integer; function To_Integer (Value : Unsigned_16) return Integer_16 is begin if Value < 2**15 then return Integer_16 (Value); else return Integer_16 (not Value) - 1; end if; end To_Integer; function To_Integer (Value : Unsigned_32) return Integer_32 is begin if Value < 2**31 then return Integer_32 (Value); else return Integer_32 (not Value) - 1; end if; end To_Integer; function To_Integer (Value : Unsigned_64) return Integer_64 is begin if Value < 2**63 then return Integer_64 (Value); else return Integer_64 (not Value) - 1; end if; end To_Integer; function To_Unsigned (Value : Integer_8) return Unsigned_8 is begin if Value >= 0 then return Unsigned_8 (Value); else return not Unsigned_8 (-(Value + 1)); end if; end To_Unsigned; function To_Unsigned (Value : Integer_16) return Unsigned_16 is begin if Value >= 0 then return Unsigned_16 (Value); else return not Unsigned_16 (-(Value + 1)); end if; end To_Unsigned; function To_Unsigned (Value : Integer_32) return Unsigned_32 is begin if Value >= 0 then return Unsigned_32 (Value); else return not Unsigned_32 (-(Value + 1)); end if; end To_Unsigned; function To_Unsigned (Value : Integer_64) return Unsigned_64 is begin if Value >= 0 then return Unsigned_64 (Value); else return not Unsigned_64 (-(Value + 1)); end if; end To_Unsigned; procedure Write ( Stream : in out Initialization_Stream; Item : Stream_Element_Array ) is begin null; end Write; end GNAT.Sockets.Connection_State_Machine;
package Mat is function Lnko ( A, B : Positive ) return Positive; function Faktorialis( N: Natural ) return Positive; function Max2( A, B : Natural ) return Natural; function Max3( A, B, C : Natural ) return Natural; function isEven( N : Natural ) return Boolean; function signof( N : Integer ) return Integer; function powerof( X, N : Integer ) return Integer; function factorial( N : Natural ) return Natural; function digitSum( N : Natural ) return Natural; end Mat;
package body ACO.Protocols.Service_Data.Servers is overriding procedure Handle_Message (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; use type ACO.SDO_Sessions.Services; Service : constant ACO.SDO_Sessions.Services := This.Sessions.Service (Endpoint.Id); State_Error : Boolean := False; begin case Get_CS (Msg) is when Download_Initiate_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Download Initiate"); if Service = ACO.SDO_Sessions.None then This.Download_Init (Msg, Endpoint); else State_Error := True; end if; when Download_Segment_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Download Segment"); if Service = ACO.SDO_Sessions.Download then This.Download_Segment (Msg, Endpoint); else State_Error := True; end if; when Upload_Initiate_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Upload Initiate"); if Service = ACO.SDO_Sessions.None then This.Upload_Init (Msg, Endpoint); else State_Error := True; end if; when Upload_Segment_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Upload Segment"); if Service = ACO.SDO_Sessions.Upload then This.Upload_Segment (Msg, Endpoint); else State_Error := True; end if; when Abort_Req => This.SDO_Log (ACO.Log.Debug, "Server: Handling Abort"); This.Abort_All (Msg, Endpoint); when others => null; end case; if State_Error then This.Send_Abort (Endpoint => Endpoint, Error => Failed_To_Transfer_Or_Store_Data_Due_To_Local_Control); end if; end Handle_Message; procedure Upload_Init (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg); Error : Error_Type := Nothing; Session : ACO.SDO_Sessions.SDO_Session; begin if not This.Od.Entry_Exist (Index.Object, Index.Sub) then Error := Object_Does_Not_Exist_In_The_Object_Dictionary; elsif not This.Od.Is_Entry_Readable (Index) then Error := Attempt_To_Read_A_Write_Only_Object; end if; Session := ACO.SDO_Sessions.Create_Upload (Endpoint, Index); if Error /= Nothing then This.Send_Abort (Endpoint, Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; declare Ety : constant ACO.OD_Types.Entry_Base'Class := This.Od.Get_Entry (Index.Object, Index.Sub); Size : Natural; Resp : Upload_Initiate_Resp; begin Size := Ety.Data_Length; if Size > ACO.Configuration.Max_SDO_Transfer_Size then This.Send_Abort (Endpoint, General_Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; if Size <= Expedited_Data'Length then Resp := Create (Index, ACO.Messages.Data_Array (Ety.Read)); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else Resp := Create (Index, Size); This.Sessions.Clear_Buffer (Endpoint.Id); This.Sessions.Put_Buffer (Endpoint.Id, ACO.Messages.Data_Array (Ety.Read)); This.Start_Alarm (Endpoint.Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; This.Send_SDO (Endpoint, Resp.Raw); end; end Upload_Init; procedure Upload_Segment (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Cmd : constant Upload_Segment_Cmd := Convert (Msg); Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id; Bytes_Remain : constant Natural := This.Sessions.Length_Buffer (Id); Session : ACO.SDO_Sessions.SDO_Session; Error : Error_Type := Nothing; begin Session := This.Sessions.Get (Id); if Cmd.Toggle /= Session.Toggle then Error := Toggle_Bit_Not_Altered; elsif Bytes_Remain = 0 then Error := General_Error; end if; if Error /= Nothing then This.Send_Abort (Endpoint => Endpoint, Error => Error, Index => Session.Index); This.Stop_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; declare Bytes_To_Send : constant Positive := Natural'Min (Bytes_Remain, Segment_Data'Length); Data : ACO.Messages.Data_Array (0 .. Bytes_To_Send - 1); Resp : Upload_Segment_Resp; Is_Complete : constant Boolean := (Bytes_To_Send = Bytes_Remain); begin This.Sessions.Get_Buffer (Endpoint.Id, Data); Resp := Create (Toggle => Session.Toggle, Is_Complete => Is_Complete, Data => Data); This.Send_SDO (Endpoint => Endpoint, Raw_Data => Resp.Raw); This.SDO_Log (ACO.Log.Debug, "Server: Sent data of length" & Bytes_To_Send'Img); if Is_Complete then This.Stop_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else Session.Toggle := not Session.Toggle; This.Start_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; end; end Upload_Segment; procedure Download_Init (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Cmd : constant Download_Initiate_Cmd := Convert (Msg); Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg); Error : Error_Type := Nothing; Session : ACO.SDO_Sessions.SDO_Session; Resp : Download_Initiate_Resp; begin if not This.Od.Entry_Exist (Index.Object, Index.Sub) then Error := Object_Does_Not_Exist_In_The_Object_Dictionary; elsif not This.Od.Is_Entry_Writable (Index) then Error := Attempt_To_Write_A_Read_Only_Object; elsif not Cmd.Is_Size_Indicated then Error := Command_Specifier_Not_Valid_Or_Unknown; elsif Get_Data_Size (Cmd) > ACO.Configuration.Max_SDO_Transfer_Size then Error := General_Error; end if; Session := ACO.SDO_Sessions.Create_Download (Endpoint, Index); if Error /= Nothing then This.Send_Abort (Endpoint, Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; if Cmd.Is_Expedited then This.Write (Index => Index, Data => Cmd.Data (0 .. 3 - Natural (Cmd.Nof_No_Data)), Error => Error); if Error = Nothing then Resp := Create (Index); This.Send_SDO (Endpoint, Resp.Raw); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else This.Send_Abort (Endpoint, Error, Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); end if; else Resp := Create (Index); This.Send_SDO (Endpoint, Resp.Raw); This.Start_Alarm (Endpoint.Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; end Download_Init; procedure Download_Segment (This : in out Server; Msg : in ACO.Messages.Message; Endpoint : in ACO.SDO_Sessions.Endpoint_Type) is use ACO.SDO_Commands; Cmd : constant Download_Segment_Cmd := Convert (Msg); Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id; Session : ACO.SDO_Sessions. SDO_Session := This.Sessions.Get (Id); Error : Error_Type := Nothing; Resp : Download_Segment_Resp; begin if Cmd.Toggle /= Session.Toggle then This.Send_Abort (Endpoint => Endpoint, Error => Toggle_Bit_Not_Altered, Index => Session.Index); This.Stop_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); return; end if; This.Sessions.Put_Buffer (Id => Id, Data => Cmd.Data (0 .. 6 - Natural (Cmd.Nof_No_Data))); Session.Toggle := not Session.Toggle; if Cmd.Is_Complete then This.Write (Index => Session.Index, Data => This.Sessions.Peek_Buffer (Id), Error => Error); This.Stop_Alarm (Id); if Error = Nothing then Resp := Create (Cmd.Toggle); This.Send_SDO (Endpoint, Resp.Raw); This.Indicate_Status (Session, ACO.SDO_Sessions.Complete); else This.Send_Abort (Endpoint => Endpoint, Error => Failed_To_Transfer_Or_Store_Data, Index => Session.Index); This.Indicate_Status (Session, ACO.SDO_Sessions.Error); end if; else This.Start_Alarm (Id); This.Indicate_Status (Session, ACO.SDO_Sessions.Pending); end if; end Download_Segment; end ACO.Protocols.Service_Data.Servers;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- Driver package for the FT6x06 touch screen panel -- Based on the ft6x06 driver from MCD Application Team with Ada.Unchecked_Conversion; with HAL.Touch_Panel; use HAL.Touch_Panel; package body FT6x06 is -------------- -- Check_Id -- -------------- function Check_Id (This : in out FT6x06_Device) return Boolean is Id : UInt8; Status : Boolean; begin for J in 1 .. 3 loop Id := This.I2C_Read (FT6206_CHIP_ID_REG, Status); if Id = FT6206_ID_VALUE then return True; end if; if not Status then return False; end if; end loop; return False; end Check_Id; --------------------------- -- TP_Set_Use_Interrupts -- --------------------------- procedure TP_Set_Use_Interrupts (This : in out FT6x06_Device; Enabled : Boolean) is Reg_Value : UInt8 := 0; Status : Boolean with Unreferenced; begin if Enabled then Reg_Value := FT6206_G_MODE_INTERRUPT_TRIGGER; else Reg_Value := FT6206_G_MODE_INTERRUPT_POLLING; end if; This.I2C_Write (FT6206_GMODE_REG, Reg_Value, Status); end TP_Set_Use_Interrupts; ---------------- -- Set_Bounds -- ---------------- overriding procedure Set_Bounds (This : in out FT6x06_Device; Width : Natural; Height : Natural; Swap : HAL.Touch_Panel.Swap_State) is begin This.LCD_Natural_Width := Width; This.LCD_Natural_Height := Height; This.Swap := Swap; end Set_Bounds; ------------------------- -- Active_Touch_Points -- ------------------------- overriding function Active_Touch_Points (This : in out FT6x06_Device) return Touch_Identifier is Status : Boolean; Nb_Touch : UInt8 := 0; begin Nb_Touch := This.I2C_Read (FT6206_TD_STAT_REG, Status); if not Status then return 0; end if; Nb_Touch := Nb_Touch and FT6206_TD_STAT_MASK; if Natural (Nb_Touch) > FT6206_Px_Regs'Last or else Natural (Nb_Touch) not in Touch_Identifier then -- Overflow: set to 0 return 0; else return Touch_Identifier (Nb_Touch); end if; end Active_Touch_Points; --------------------- -- Get_Touch_State -- --------------------- overriding function Get_Touch_Point (This : in out FT6x06_Device; Touch_Id : Touch_Identifier) return HAL.Touch_Panel.TP_Touch_State is type UInt16_HL_Type is record High, Low : UInt8; end record with Size => 16; for UInt16_HL_Type use record High at 1 range 0 .. 7; Low at 0 range 0 .. 7; end record; function To_UInt16 is new Ada.Unchecked_Conversion (UInt16_HL_Type, UInt16); Ret : TP_Touch_State; Regs : FT6206_Pressure_Registers; Tmp : UInt16_HL_Type; Status : Boolean; begin if Touch_Id not in FT6206_Px_Regs'Range then return (0, 0, 0); end if; if Touch_Id > This.Active_Touch_Points then return (0, 0, 0); end if; -- X/Y are swaped from the screen coordinates Regs := FT6206_Px_Regs (Touch_Id); Tmp.Low := This.I2C_Read (Regs.XL_Reg, Status); if not Status then return (0, 0, 0); end if; Tmp.High := This.I2C_Read (Regs.XH_Reg, Status) and FT6206_TOUCH_POS_MSB_MASK; if not Status then return (0, 0, 0); end if; Ret.Y := Natural (To_UInt16 (Tmp)); Tmp.Low := This.I2C_Read (Regs.YL_Reg, Status); if not Status then return (0, 0, 0); end if; Tmp.High := This.I2C_Read (Regs.YH_Reg, Status) and FT6206_TOUCH_POS_MSB_MASK; if not Status then return (0, 0, 0); end if; Ret.X := Natural (To_UInt16 (Tmp)); Ret.Weight := Natural (This.I2C_Read (Regs.Weight_Reg, Status)); if not Status then Ret.Weight := 0; end if; if Ret.Weight = 0 then Ret.Weight := 50; end if; Ret.X := Natural'Max (0, Ret.X); Ret.Y := Natural'Max (0, Ret.Y); Ret.X := Natural'Min (This.LCD_Natural_Width - 1, Ret.X); Ret.Y := Natural'Min (This.LCD_Natural_Height - 1, Ret.Y); if (This.Swap and Invert_X) /= 0 then Ret.X := This.LCD_Natural_Width - Ret.X - 1; end if; if (This.Swap and Invert_Y) /= 0 then Ret.Y := This.LCD_Natural_Height - Ret.Y - 1; end if; if (This.Swap and Swap_XY) /= 0 then declare Tmp_X : constant Integer := Ret.X; begin Ret.X := Ret.Y; Ret.Y := Tmp_X; end; end if; return Ret; end Get_Touch_Point; -------------------------- -- Get_All_Touch_Points -- -------------------------- overriding function Get_All_Touch_Points (This : in out FT6x06_Device) return HAL.Touch_Panel.TP_State is N_Touch : constant Natural := This.Active_Touch_Points; State : TP_State (1 .. N_Touch); begin if N_Touch = 0 then return (1 .. 0 => <>); end if; for J in State'Range loop State (J) := This.Get_Touch_Point (J); end loop; return State; end Get_All_Touch_Points; -------------- -- I2C_Read -- -------------- function I2C_Read (This : in out FT6x06_Device; Reg : UInt8; Status : out Boolean) return UInt8 is Ret : I2C_Data (1 .. 1); Tmp_Status : I2C_Status; begin This.Port.Mem_Read (This.I2C_Addr, UInt16 (Reg), Memory_Size_8b, Ret, Tmp_Status, 1000); Status := Tmp_Status = Ok; return Ret (1); end I2C_Read; --------------- -- I2C_Write -- --------------- procedure I2C_Write (This : in out FT6x06_Device; Reg : UInt8; Data : UInt8; Status : out Boolean) is Tmp_Status : I2C_Status; begin This.Port.Mem_Write (This.I2C_Addr, UInt16 (Reg), Memory_Size_8b, (1 => Data), Tmp_Status, 1000); Status := Tmp_Status = Ok; end I2C_Write; end FT6x06;
----------------------------------------------------------------------- -- ado-queries-tests -- Test loading of database queries -- Copyright (C) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2019, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with ADO.Connections; with ADO.Queries.Loaders; package body ADO.Queries.Tests is use Util.Tests; package Caller is new Util.Test_Caller (Test, "ADO.Queries"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test ADO.Queries.Read_Query", Test_Load_Queries'Access); Caller.Add_Test (Suite, "Test ADO.Queries.Find_Query", Test_Find_Query'Access); Caller.Add_Test (Suite, "Test ADO.Queries.Initialize", Test_Initialize'Access); Caller.Add_Test (Suite, "Test ADO.Queries.Read_Query (reload)", Test_Reload_Queries'Access); Caller.Add_Test (Suite, "Test ADO.Queries.Set_Query", Test_Set_Query'Access); Caller.Add_Test (Suite, "Test ADO.Queries.Set_Limit", Test_Set_Limit'Access); Caller.Add_Test (Suite, "Test ADO.Queries.Get_SQL (raise Query_Error)", Test_Missing_Query'Access); end Add_Tests; package Simple_Query_File is new ADO.Queries.Loaders.File (Path => "regtests/files/simple-query.xml", Sha1 => ""); package Multi_Query_File is new ADO.Queries.Loaders.File (Path => "regtests/files/multi-query.xml", Sha1 => ""); package Missing_Query_File is new ADO.Queries.Loaders.File (Path => "regtests/files/missing-query.xml", Sha1 => ""); package Simple_Query is new ADO.Queries.Loaders.Query (Name => "simple-query", File => Simple_Query_File.File'Access); package Simple_Query_2 is new ADO.Queries.Loaders.Query (Name => "simple-query", File => Multi_Query_File.File'Access); package Index_Query is new ADO.Queries.Loaders.Query (Name => "index", File => Multi_Query_File.File'Access); package Value_Query is new ADO.Queries.Loaders.Query (Name => "value", File => Multi_Query_File.File'Access); package Missing_Query_SQLite is new ADO.Queries.Loaders.Query (Name => "missing-query-sqlite", File => Missing_Query_File.File'Access); package Missing_Query_MySQL is new ADO.Queries.Loaders.Query (Name => "missing-query-mysql", File => Missing_Query_File.File'Access); package Missing_Query_Postgresql is new ADO.Queries.Loaders.Query (Name => "missing-query-postgresql", File => Missing_Query_File.File'Access); package Missing_Query is new ADO.Queries.Loaders.Query (Name => "missing-query", File => Missing_Query_File.File'Access); pragma Warnings (Off, Simple_Query_2); pragma Warnings (Off, Value_Query); pragma Warnings (Off, Missing_Query); pragma Warnings (Off, Missing_Query_SQLite); pragma Warnings (Off, Missing_Query_MySQL); pragma Warnings (Off, Missing_Query_Postgresql); procedure Test_Load_Queries (T : in out Test) is use ADO.Connections; use type ADO.Configs.Driver_Index; Mysql_Driver : constant Driver_Access := ADO.Connections.Get_Driver ("mysql"); Sqlite_Driver : constant Driver_Access := ADO.Connections.Get_Driver ("sqlite"); Psql_Driver : constant Driver_Access := ADO.Connections.Get_Driver ("postgresql"); Config : ADO.Connections.Configuration; Manager : Query_Manager; Config_URL : constant String := Util.Tests.Get_Parameter ("test.database", "sqlite:///regtests.db"); begin -- Configure the XML query loader. Config.Set_Connection (Config_URL); ADO.Queries.Loaders.Initialize (Manager, Config); declare SQL : constant String := ADO.Queries.Get_SQL (Simple_Query.Query'Access, Manager, False); begin Assert_Equals (T, "select count(*) from user", SQL, "Invalid query for 'simple-query'"); end; declare SQL : constant String := ADO.Queries.Get_SQL (Index_Query.Query'Access, Manager, False); begin if Mysql_Driver /= null and then Manager.Driver = Mysql_Driver.Get_Driver_Index then Assert_Equals (T, "select 1", SQL, "Invalid query for 'index'"); elsif Psql_Driver /= null and then Manager.Driver = Psql_Driver.Get_Driver_Index then Assert_Equals (T, "select 3", SQL, "Invalid query for 'index'"); else Assert_Equals (T, "select 0", SQL, "Invalid query for 'index'"); end if; end; if Mysql_Driver /= null and then Manager.Driver = Mysql_Driver.Get_Driver_Index then declare SQL : constant String := ADO.Queries.Get_SQL (Index_Query.Query'Access, Manager, False); begin Assert_Equals (T, "select 1", SQL, "Invalid query for 'index' (MySQL driver)"); end; end if; if Sqlite_Driver /= null and then Manager.Driver = Sqlite_Driver.Get_Driver_Index then declare SQL : constant String := ADO.Queries.Get_SQL (Index_Query.Query'Access, Manager, False); begin Assert_Equals (T, "select 0", SQL, "Invalid query for 'index' (SQLite driver)"); end; end if; if Psql_Driver /= null and then Manager.Driver = Psql_Driver.Get_Driver_Index then declare SQL : constant String := ADO.Queries.Get_SQL (Index_Query.Query'Access, Manager, False); begin Assert_Equals (T, "select 3", SQL, "Invalid query for 'index' (PostgreSQL driver)"); end; end if; end Test_Load_Queries; -- ------------------------------ -- Test re-loading queries. -- ------------------------------ procedure Test_Reload_Queries (T : in out Test) is Config : ADO.Connections.Configuration; Manager : Query_Manager; Query : ADO.Queries.Context; Config_URL : constant String := Util.Tests.Get_Parameter ("test.database", "sqlite:///regtests.db"); begin -- Configure the XML query loader. Config.Set_Connection (Config_URL); ADO.Queries.Loaders.Initialize (Manager, Config); for I in 1 .. 10 loop Query.Set_Query ("simple-query"); declare SQL : constant String := Query.Get_SQL (Manager); begin Assert_Equals (T, "select count(*) from user", SQL, "Invalid query for 'simple-query'"); end; for J in Manager.Files'Range loop Manager.Files (J).Next_Check := 0; end loop; end loop; end Test_Reload_Queries; -- ------------------------------ -- Test the Initialize operation called several times -- ------------------------------ procedure Test_Initialize (T : in out Test) is Config : ADO.Connections.Configuration; Manager : Query_Manager; Pos : Query_Index; Config_URL : constant String := Util.Tests.Get_Parameter ("test.database", "sqlite:///regtests.db"); begin Config.Set_Connection (Config_URL); -- Configure and load the XML queries. for Pass in 1 .. 10 loop Config.Set_Property ("ado.queries.load", (if Pass = 1 then "false" else "true")); ADO.Queries.Loaders.Initialize (Manager, Config); T.Assert (Manager.Queries /= null, "The queries table is allocated"); T.Assert (Manager.Files /= null, "The files table is allocated"); Pos := 1; for Query of Manager.Queries.all loop if Pass = 1 then T.Assert (Query.Is_Null, "Query must not be loaded"); elsif Missing_Query.Query.Query /= Pos then T.Assert (not Query.Is_Null, "Query must have been loaded"); else T.Assert (Query.Is_Null, "Query must not be loaded (not found)"); end if; Pos := Pos + 1; end loop; end loop; end Test_Initialize; -- ------------------------------ -- Test the Set_Query operation. -- ------------------------------ procedure Test_Set_Query (T : in out Test) is Query : ADO.Queries.Context; Manager : Query_Manager; Config : ADO.Connections.Configuration; Config_URL : constant String := Util.Tests.Get_Parameter ("test.database", "sqlite:///regtests.db"); begin Config.Set_Connection (Config_URL); ADO.Queries.Loaders.Initialize (Manager, Config); Query.Set_Query ("simple-query"); declare SQL : constant String := Query.Get_SQL (Manager); begin Assert_Equals (T, "select count(*) from user", SQL, "Invalid query for 'simple-query'"); end; end Test_Set_Query; -- ------------------------------ -- Test the Set_Limit operation. -- ------------------------------ procedure Test_Set_Limit (T : in out Test) is Query : ADO.Queries.Context; begin Query.Set_Query ("index"); Query.Set_Limit (0, 10); Assert_Equals (T, 0, Query.Get_First_Row_Index, "Invalid first row index"); Assert_Equals (T, 10, Query.Get_Last_Row_Index, "Invalid last row index"); end Test_Set_Limit; -- ------------------------------ -- Test the Find_Query operation. -- ------------------------------ procedure Test_Find_Query (T : in out Test) is Q : Query_Definition_Access; begin Q := ADO.Queries.Loaders.Find_Query ("this query does not exist"); T.Assert (Q = null, "Find_Query should return null for unkown query"); end Test_Find_Query; -- ------------------------------ -- Test the missing query. -- ------------------------------ procedure Test_Missing_Query (T : in out Test) is Query : ADO.Queries.Context; Manager : Query_Manager; Config : ADO.Connections.Configuration; Count : Natural := 0; Config_URL : constant String := Util.Tests.Get_Parameter ("test.database", "sqlite:///regtests.db"); begin Config.Set_Connection (Config_URL); ADO.Queries.Loaders.Initialize (Manager, Config); Query.Set_Query ("missing-query"); begin Assert_Equals (T, "?", Query.Get_SQL (Manager)); T.Fail ("No ADO.Queries.Query_Error exception was raised"); exception when ADO.Queries.Query_Error => null; end; begin Query.Set_Query ("missing-query-sqlite"); Assert_Equals (T, "select count(*) from user", Query.Get_SQL (Manager)); exception when ADO.Queries.Query_Error => Count := Count + 1; end; begin Query.Set_Query ("missing-query-mysql"); Assert_Equals (T, "select count(*) from user", Query.Get_SQL (Manager)); exception when ADO.Queries.Query_Error => Count := Count + 1; end; begin Query.Set_Query ("missing-query-postgresql"); Assert_Equals (T, "select count(*) from user", Query.Get_SQL (Manager)); exception when ADO.Queries.Query_Error => Count := Count + 1; end; T.Assert (Count > 0, "No Query_Error exception was raised"); end Test_Missing_Query; end ADO.Queries.Tests;
with HAL; use HAL; with SPARKNaCl; use SPARKNaCl; with Interfaces; use Interfaces; package IO is procedure Put (X : Integer); -- Output integer to specified file, or to current output file, same -- output as if Ada.Text_IO.Integer_IO had been instantiated for Integer. procedure Put (X : UInt64); procedure Put (C : Character); -- Output character to specified file, or to current output file procedure Put (S : String); -- Output string to specified file, or to current output file procedure Put_Line (S : String); -- Output string followed by new line to stdout procedure Put_Line (S : String; X : Unsigned_64); -- Output string followed by X, then new line to stdout procedure New_Line (Spacing : Positive := 1); -- Output new line character to specified file, or to current output file procedure Put (B : in Byte); procedure Put (S : in String; D : in Byte_Seq); end IO;
function System.Tasking.Async_Delays.Enqueue_RT ( T : Ada.Real_Time.Time; D : not null access Delay_Block) return Boolean is begin raise Program_Error; -- unimplemented return Enqueue_RT (T, D); end System.Tasking.Async_Delays.Enqueue_RT;
procedure Foo (Arg_1 : Integer; Arg_2 : Float := 0.0);
package GESTE_Fonts.FreeMonoBoldOblique6pt7b is Font : constant Bitmap_Font_Ref; private FreeMonoBoldOblique6pt7bBitmaps : aliased constant Font_Bitmap := ( 16#00#, 16#00#, 16#00#, 16#00#, 16#80#, 16#C0#, 16#60#, 16#20#, 16#10#, 16#08#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#A0#, 16#B0#, 16#50#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#41#, 16#A1#, 16#F0#, 16#50#, 16#28#, 16#7E#, 16#14#, 16#0A#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#81#, 16#E1#, 16#90#, 16#E0#, 16#3C#, 16#66#, 16#3E#, 16#06#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#02#, 16#41#, 16#20#, 16#68#, 16#38#, 16#2C#, 16#0A#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#80#, 16#40#, 16#60#, 16#3E#, 16#26#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#40#, 16#20#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#20#, 16#20#, 16#30#, 16#10#, 16#08#, 16#04#, 16#02#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#01#, 16#00#, 16#C0#, 16#60#, 16#30#, 16#18#, 16#08#, 16#0C#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C1#, 16#F0#, 16#70#, 16#28#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#20#, 16#FC#, 16#08#, 16#0C#, 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#08#, 16#0C#, 16#04#, 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#00#, 16#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#00#, 16#00#, 16#00#, 16#60#, 16#20#, 16#20#, 16#30#, 16#10#, 16#10#, 16#18#, 16#08#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#90#, 16#88#, 16#44#, 16#26#, 16#12#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#81#, 16#C0#, 16#40#, 16#20#, 16#10#, 16#08#, 16#0C#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#90#, 16#88#, 16#0C#, 16#1C#, 16#18#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#10#, 16#08#, 16#18#, 16#02#, 16#03#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#70#, 16#50#, 16#48#, 16#7E#, 16#06#, 16#07#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E0#, 16#80#, 16#F0#, 16#44#, 16#02#, 16#02#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#70#, 16#C0#, 16#B0#, 16#64#, 16#22#, 16#12#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#10#, 16#18#, 16#08#, 16#08#, 16#04#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#90#, 16#88#, 16#38#, 16#26#, 16#32#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#90#, 16#C8#, 16#3C#, 16#06#, 16#06#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#40#, 16#00#, 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#C0#, 16#00#, 16#00#, 16#00#, 16#08#, 16#0C#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#18#, 16#30#, 16#60#, 16#18#, 16#03#, 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#7E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#00#, 16#60#, 16#0C#, 16#1C#, 16#30#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#90#, 16#08#, 16#0C#, 16#08#, 16#00#, 16#06#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E1#, 16#90#, 16#B8#, 16#64#, 16#54#, 16#26#, 16#10#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#E0#, 16#50#, 16#68#, 16#3E#, 16#23#, 16#3B#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#10#, 16#88#, 16#7C#, 16#22#, 16#31#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F1#, 16#19#, 16#80#, 16#80#, 16#40#, 16#31#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#10#, 16#88#, 16#44#, 16#62#, 16#22#, 16#3E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F1#, 16#10#, 16#A8#, 16#70#, 16#28#, 16#31#, 16#3F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F1#, 16#18#, 16#A8#, 16#70#, 16#68#, 16#20#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F1#, 16#11#, 16#00#, 16#80#, 16#4E#, 16#21#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#71#, 16#10#, 16#88#, 16#7C#, 16#64#, 16#22#, 16#3B#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E0#, 16#40#, 16#20#, 16#30#, 16#10#, 16#08#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#20#, 16#10#, 16#08#, 16#CC#, 16#44#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F1#, 16#20#, 16#A0#, 16#70#, 16#6C#, 16#22#, 16#39#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#C0#, 16#80#, 16#40#, 16#60#, 16#22#, 16#11#, 16#3F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#39#, 16#99#, 16#DC#, 16#BE#, 16#5A#, 16#2D#, 16#3B#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#71#, 16#90#, 16#E8#, 16#54#, 16#6E#, 16#23#, 16#39#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#11#, 16#0C#, 16#84#, 16#42#, 16#22#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#10#, 16#88#, 16#78#, 16#20#, 16#30#, 16#3C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#11#, 16#0C#, 16#84#, 16#42#, 16#22#, 16#0E#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#E1#, 16#10#, 16#98#, 16#78#, 16#6C#, 16#22#, 16#39#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#E1#, 16#10#, 16#80#, 16#78#, 16#06#, 16#23#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#F2#, 16#51#, 16#68#, 16#20#, 16#10#, 16#08#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#71#, 16#11#, 16#88#, 16#84#, 16#46#, 16#22#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#0F#, 16#73#, 16#11#, 16#90#, 16#58#, 16#28#, 16#18#, 16#0C#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#72#, 16#D1#, 16#68#, 16#BC#, 16#6C#, 16#36#, 16#13#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#71#, 16#B0#, 16#70#, 16#30#, 16#3C#, 16#32#, 16#3B#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#07#, 16#71#, 16#20#, 16#F0#, 16#30#, 16#10#, 16#08#, 16#1E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#E1#, 16#30#, 16#30#, 16#30#, 16#30#, 16#33#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#40#, 16#20#, 16#10#, 16#08#, 16#0C#, 16#04#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#01#, 16#00#, 16#80#, 16#60#, 16#10#, 16#08#, 16#06#, 16#03#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#40#, 16#20#, 16#10#, 16#08#, 16#0C#, 16#04#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#80#, 16#C0#, 16#B0#, 16#88#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#02#, 16#00#, 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#01#, 16#E0#, 16#18#, 16#7C#, 16#64#, 16#22#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#06#, 16#01#, 16#F0#, 16#88#, 16#44#, 16#62#, 16#33#, 16#3F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#88#, 16#80#, 16#40#, 16#20#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#30#, 16#F8#, 16#98#, 16#84#, 16#42#, 16#23#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E1#, 16#88#, 16#FC#, 16#40#, 16#30#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F1#, 16#F0#, 16#40#, 16#20#, 16#10#, 16#08#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F9#, 16#98#, 16#8C#, 16#44#, 16#22#, 16#0F#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#01#, 16#F0#, 16#C8#, 16#44#, 16#26#, 16#12#, 16#3B#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#81#, 16#C0#, 16#20#, 16#10#, 16#18#, 16#0C#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#41#, 16#F0#, 16#10#, 16#08#, 16#04#, 16#02#, 16#03#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#00#, 16#F0#, 16#F0#, 16#60#, 16#38#, 16#16#, 16#1B#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#C0#, 16#40#, 16#20#, 16#10#, 16#08#, 16#0C#, 16#1F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F1#, 16#AC#, 16#96#, 16#4A#, 16#2D#, 16#3E#, 16#C0#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F1#, 16#C8#, 16#44#, 16#26#, 16#12#, 16#3B#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#E0#, 16#88#, 16#84#, 16#42#, 16#32#, 16#0E#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#F0#, 16#88#, 16#C4#, 16#62#, 16#33#, 16#1F#, 16#08#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F9#, 16#98#, 16#8C#, 16#44#, 16#22#, 16#1F#, 16#00#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#B8#, 16#60#, 16#20#, 16#30#, 16#10#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#F0#, 16#88#, 16#78#, 16#1E#, 16#23#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#03#, 16#F0#, 16#80#, 16#40#, 16#20#, 16#10#, 16#0F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#30#, 16#88#, 16#44#, 16#26#, 16#32#, 16#0F#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#B8#, 16#98#, 16#48#, 16#28#, 16#1C#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#39#, 16#E8#, 16#FC#, 16#7C#, 16#36#, 16#1B#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#B8#, 16#D0#, 16#30#, 16#3C#, 16#33#, 16#3B#, 16#80#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#03#, 16#B8#, 16#98#, 16#48#, 16#38#, 16#1C#, 16#04#, 16#04#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#F0#, 16#90#, 16#10#, 16#18#, 16#18#, 16#1F#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#60#, 16#40#, 16#20#, 16#10#, 16#30#, 16#08#, 16#04#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#C0#, 16#40#, 16#20#, 16#10#, 16#08#, 16#0C#, 16#04#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#01#, 16#80#, 16#40#, 16#20#, 16#10#, 16#0C#, 16#0C#, 16#04#, 16#02#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#74#, 16#6C#, 16#00#, 16#00#, 16#00#, 16#00#); Font_D : aliased constant Bitmap_Font := ( Bytes_Per_Glyph => 14, Glyph_Width => 9, Glyph_Height => 12, Data => FreeMonoBoldOblique6pt7bBitmaps'Access); Font : constant Bitmap_Font_Ref := Font_D'Access; end GESTE_Fonts.FreeMonoBoldOblique6pt7b;
-- Generated at 2014-06-02 19:12:04 +0000 by Natools.Static_Hash_Maps -- from ../src/natools-s_expressions-printers-pretty-config-commands.sx function Natools.S_Expressions.Printers.Pretty.Config.Commands.T return Boolean; pragma Preelaborate (Natools.S_Expressions.Printers.Pretty.Config.Commands.T);
-- ----------------------------------------------------------------- -- -- -- -- This is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- ----------------------------------------------------------------- -- -- ----------------------------------------------------------------- -- -- This is a translation, to the Ada programming language, of the -- -- original C test files written by Sam Lantinga - www.libsdl.org -- -- translation made by Antonio F. Vargas - www.adapower.net/~avargas -- -- ----------------------------------------------------------------- -- with Ada.Unchecked_Conversion; with Ada.Text_IO; use Ada.Text_IO; with SDL.Error; with SDL.Thread; with SDL.Types; use SDL.Types; with SDL.Timer; package body TestError_TFunc is package Er renames SDL.Error; package T renames SDL.Thread; package Tm renames SDL.Timer; function To_chars_ptr is new Ada.Unchecked_Conversion (System.Address, CS.chars_ptr); -- ====================================== function ThreadFunc (data : System.Address) return Interfaces.C.int is begin Er.Set_Error ( "Thread " & CS.Value (To_chars_ptr (data)) & " (" & Uint32'Image (T.ThreadID) & ") " & "had a problem: nevermind"); while alive /= 0 loop Put_Line ("Thread '" & CS.Value (To_chars_ptr (data)) & "' is alive!"); Tm.SDL_Delay (1 * 1000); end loop; Put_Line ("Child thread error string: " & Er.Get_Error); return 0; end ThreadFunc; end TestError_TFunc;
-- reference: -- http://www.loc.gov/standards/iso639-2/php/code_list.php pragma Check_Policy (Validate => Ignore); with System.Native_Locales; with System.Once; package body Ada.Locales is type Long_Boolean is new Boolean; for Long_Boolean'Size use Long_Integer'Size; function expect (exp, c : Long_Boolean) return Long_Boolean with Import, Convention => Intrinsic, External_Name => "__builtin_expect"; type Alpha_2_NP is new String (1 .. 2); -- no predicate type Alpha_3_NP is new String (1 .. 3); function Compare (Left, Right : Alpha_2_NP) return Integer; function Compare (Left, Right : Alpha_2_NP) return Integer is type Compare_Integer is mod 16#10000#; Left_Value : constant Compare_Integer := Character'Pos (Left (1)) * 16#100# or Character'Pos (Left (2)); Right_Value : constant Compare_Integer := Character'Pos (Right (1)) * 16#100# or Character'Pos (Right (2)); begin return Integer (Left_Value) - Integer (Right_Value); end Compare; function Compare (Left, Right : Alpha_3_NP) return Integer; function Compare (Left, Right : Alpha_3_NP) return Integer is type Compare_Integer is mod 16#1000000#; Left_Value : constant Compare_Integer := Character'Pos (Left (1)) * 16#10000# or Character'Pos (Left (2)) * 16#100# or Character'Pos (Left (3)); Right_Value : constant Compare_Integer := Character'Pos (Right (1)) * 16#10000# or Character'Pos (Right (2)) * 16#100# or Character'Pos (Right (3)); begin return Integer (Left_Value) - Integer (Right_Value); end Compare; type Language_Table_Element is record Alpha_3 : Alpha_3_NP; Alpha_2 : Alpha_2_NP; end record; pragma Suppress_Initialization (Language_Table_Element); type Language_Table_Array is array (Positive range <>) of Language_Table_Element; pragma Suppress_Initialization (Language_Table_Array); type Language_Table_Array_Access is access Language_Table_Array; unde : constant Alpha_2_NP := (1 => ISO_639_Alpha_2_Unknown (1), 2 => ISO_639_Alpha_2_Unknown (2)); Language_Table : constant Language_Table_Array := ( ("aar", "aa"), -- "Afar", "afar" ("abk", "ab"), -- "Abkhazian", "abkhaze" ("ace", unde), -- "Achinese", "aceh" ("ach", unde), -- "Acoli", "acoli" ("ada", unde), -- "Adangme", "adangme" ("ady", unde), -- "Adyghe; Adygei", "adyghé" ("afa", unde), -- "Afro-Asiatic languages", "afro-asiatiques, langues" ("afh", unde), -- "Afrihili", "afrihili" ("afr", "af"), -- "Afrikaans", "afrikaans" ("ain", unde), -- "Ainu", "aïnou" ("aka", "ak"), -- "Akan", "akan" ("akk", unde), -- "Akkadian", "akkadien" ("alb", "sq"), -- (B) ("sqi", "sq"), -- (T) "Albanian", "albanais" ("ale", unde), -- "Aleut", "aléoute" ("alg", unde), -- "Algonquian languages", "algonquines, langues" ("alt", unde), -- "Southern Altai", "altai du Sud" ("amh", "am"), -- "Amharic", "amharique" ("ang", unde), -- "English, Old (ca.450-1100)", -- "anglo-saxon (ca.450-1100)" ("anp", unde), -- "Angika", "angika" ("apa", unde), -- "Apache languages", "apaches, langues" ("ara", "ar"), -- "Arabic", "arabe" ("arc", unde), -- "Official Aramaic (700-300 BCE); " -- & "Imperial Aramaic (700-300 BCE)", -- "araméen d'empire (700-300 BCE)" ("arg", "an"), -- "Aragonese", "aragonais" ("arm", "hy"), -- (B) ("hye", "hy"), -- (T) "Armenian", "arménien" ("arn", unde), -- "Mapudungun; Mapuche", "mapudungun; mapuche; mapuce" ("arp", unde), -- "Arapaho", "arapaho" ("art", unde), -- "Artificial languages", "artificielles, langues" ("arw", unde), -- "Arawak", "arawak" ("asm", "as"), -- "Assamese", "assamais" ("ast", unde), -- "Asturian; Bable; Leonese; Asturleonese", -- "asturien; bable; léonais; asturoléonais" ("ath", unde), -- "Athapascan languages", "athapascanes, langues" ("aus", unde), -- "Australian languages", "australiennes, langues" ("ava", "av"), -- "Avaric", "avar" ("ave", "ae"), -- "Avestan", "avestique" ("awa", unde), -- "Awadhi", "awadhi" ("aym", "ay"), -- "Aymara", "aymara" ("aze", "az"), -- "Azerbaijani", "azéri" ("bad", unde), -- "Banda languages", "banda, langues" ("bai", unde), -- "Bamileke languages", "bamiléké, langues" ("bak", "ba"), -- "Bashkir", "bachkir" ("bal", unde), -- "Baluchi", "baloutchi" ("bam", "bm"), -- "Bambara", "bambara" ("ban", unde), -- "Balinese", "balinais" ("baq", "eu"), -- (B) ("eus", "eu"), -- (T) "Basque", "basque" ("bas", unde), -- "Basa", "basa" ("bat", unde), -- "Baltic languages", "baltes, langues" ("bej", unde), -- "Beja; Bedawiyet", "bedja" ("bel", "be"), -- "Belarusian", "biélorusse" ("bem", unde), -- "Bemba", "bemba" ("ben", "bn"), -- "Bengali", "bengali" ("ber", unde), -- "Berber languages", "berbères, langues" ("bho", unde), -- "Bhojpuri", "bhojpuri" ("bih", "bh"), -- "Bihari languages", "langues biharis" ("bik", unde), -- "Bikol", "bikol" ("bin", unde), -- "Bini; Edo", "bini; edo" ("bis", "bi"), -- "Bislama", "bichlamar" ("bla", unde), -- "Siksika", "blackfoot" ("bnt", unde), -- "Bantu languages", "bantou, langues" ("tib", "bo"), -- (B) ("bod", "bo"), -- (T) "Tibetan", "tibétain" ("bos", "bs"), -- "Bosnian", "bosniaque" ("bra", unde), -- "Braj", "braj" ("bre", "br"), -- "Breton", "breton" ("btk", unde), -- "Batak languages", "batak, langues" ("bua", unde), -- "Buriat", "bouriate" ("bug", unde), -- "Buginese", "bugi" ("bul", "bg"), -- "Bulgarian", "bulgare" ("bur", "my"), -- (B) ("mya", "my"), -- (T) "Burmese", "birman" ("byn", unde), -- "Blin; Bilin", "blin; bilen" ("cad", unde), -- "Caddo", "caddo" ("cai", unde), -- "Central American Indian languages", -- "amérindiennes de l'Amérique centrale, langues" ("car", unde), -- "Galibi Carib", "karib; galibi; carib" ("cat", "ca"), -- "Catalan; Valencian", "catalan; valencien" ("cau", unde), -- "Caucasian languages", "caucasiennes, langues" ("ceb", unde), -- "Cebuano", "cebuano" ("cel", unde), -- "Celtic languages", -- "celtiques, langues; celtes, langues" ("cze", "cs"), -- (B) ("ces", "cs"), -- (T) "Czech", "tchèque" ("cha", "ch"), -- "Chamorro", "chamorro" ("chb", unde), -- "Chibcha", "chibcha" ("che", "ce"), -- "Chechen", "tchétchène" ("chg", unde), -- "Chagatai", "djaghataï" ("chi", "zh"), -- (B) ("zho", "zh"), -- (T) "Chinese", "chinois" ("chk", unde), -- "Chuukese", "chuuk" ("chm", unde), -- "Mari", "mari" ("chn", unde), -- "Chinook jargon", "chinook, jargon" ("cho", unde), -- "Choctaw", "choctaw" ("chp", unde), -- "Chipewyan; Dene Suline", "chipewyan" ("chr", unde), -- "Cherokee", "cherokee" ("chu", "cu"), -- "Church Slavic; Old Slavonic; Church Slavonic; " -- & "Old Bulgarian; Old Church Slavonic", -- "slavon d'église; vieux slave; slavon liturgique; " -- & "vieux bulgare" ("chv", "cv"), -- "Chuvash", "tchouvache" ("chy", unde), -- "Cheyenne", "cheyenne" ("cmc", unde), -- "Chamic languages", "chames, langues" ("cop", unde), -- "Coptic", "copte" ("cor", "kw"), -- "Cornish", "cornique" ("cos", "co"), -- "Corsican", "corse" ("cpe", unde), -- "Creoles and pidgins, English based", -- "créoles et pidgins basés sur l'anglais" ("cpf", unde), -- "Creoles and pidgins, French-based", -- "créoles et pidgins basés sur le français" ("cpp", unde), -- "Creoles and pidgins, Portuguese-based", -- "créoles et pidgins basés sur le portugais" ("cre", "cr"), -- "Cree", "cree" ("crh", unde), -- "Crimean Tatar; Crimean Turkish", "tatar de Crimé" ("crp", unde), -- "Creoles and pidgins", "créoles et pidgins" ("csb", unde), -- "Kashubian", "kachoube" ("cus", unde), -- "Cushitic languages", "couchitiques, langues" ("wel", "cy"), -- (B) ("cym", "cy"), -- (T) "Welsh", "gallois" ("dak", unde), -- "Dakota", "dakota" ("dan", "da"), -- "Danish", "danois" ("dar", unde), -- "Dargwa", "dargwa" ("day", unde), -- "Land Dayak languages", "dayak, langues" ("del", unde), -- "Delaware", "delaware" ("den", unde), -- "Slave (Athapascan)", "esclave (athapascan)" ("ger", "de"), -- (B) ("deu", "de"), -- (T) "German", "allemand" ("dgr", unde), -- "Dogrib", "dogrib" ("din", unde), -- "Dinka", "dinka" ("div", "dv"), -- "Divehi; Dhivehi; Maldivian", "maldivien" ("doi", unde), -- "Dogri", "dogri" ("dra", unde), -- "Dravidian languages", "dravidiennes, langues" ("dsb", unde), -- "Lower Sorbian", "bas-sorabe" ("dua", unde), -- "Duala", "douala" ("dum", unde), -- "Dutch, Middle (ca.1050-1350)", -- "néerlandais moyen (ca. 1050-1350)" ("dut", "nl"), -- (B) ("nld", "nl"), -- (T) "Dutch; Flemish", "néerlandais; flamand" ("dyu", unde), -- "Dyula", "dioula" ("dzo", "dz"), -- "Dzongkha", "dzongkha" ("efi", unde), -- "Efik", "efik" ("egy", unde), -- "Egyptian (Ancient)", "égyptien" ("eka", unde), -- "Ekajuk", "ekajuk" ("gre", "el"), -- (B) ("ell", "el"), -- (T) "Greek, Modern (1453-)", -- "grec moderne (après 1453)" ("elx", unde), -- "Elamite", "élamite" ("eng", "en"), -- "English", "anglais" ("enm", unde), -- "English, Middle (1100-1500)", -- "anglais moyen (1100-1500)" ("epo", "eo"), -- "Esperanto", "espéranto" ("est", "et"), -- "Estonian", "estonien" ("ewe", "ee"), -- "Ewe", "éwé" ("ewo", unde), -- "Ewondo", "éwondo" ("fan", unde), -- "Fang", "fang" ("fao", "fo"), -- "Faroese", "féroïen" ("per", "fa"), -- (B) ("fas", "fa"), -- (T) "Persian", "persan" ("fat", unde), -- "Fanti", "fanti" ("fij", "fj"), -- "Fijian", "fidjien" ("fil", unde), -- "Filipino; Pilipino", "filipino; pilipino" ("fin", "fi"), -- "Finnish", "finnois" ("fiu", unde), -- "Finno-Ugrian languages", "finno-ougriennes, langues" ("fon", unde), -- "Fon", "fon" ("fre", "fr"), -- (B) ("fra", "fr"), -- (T) "French", "français" ("frm", unde), -- "French, Middle (ca.1400-1600)", -- "français moyen (1400-1600)" ("fro", unde), -- "French, Old (842-ca.1400)", -- "français ancien (842-ca.1400)" ("frr", unde), -- "Northern Frisian", "frison septentrional" ("frs", unde), -- "Eastern Frisian", "frison oriental" ("fry", "fy"), -- "Western Frisian", "frison occidental" ("ful", "ff"), -- "Fulah", "peul" ("fur", unde), -- "Friulian", "frioulan" ("gaa", unde), -- "Ga", "ga" ("gay", unde), -- "Gayo", "gayo" ("gba", unde), -- "Gbaya", "gbaya" ("gem", unde), -- "Germanic languages", "germaniques, langues" ("geo", "ka"), -- (B) ("kat", "ka"), -- (T) "Georgian", "géorgien" ("gez", unde), -- "Geez", "guèze" ("gil", unde), -- "Gilbertese", "kiribati" ("gla", "gd"), -- "Gaelic; Scottish Gaelic", -- "gaélique; gaélique écossais" ("gle", "ga"), -- "Irish", "irlandais" ("glg", "gl"), -- "Galician", "galicien" ("glv", "gv"), -- "Manx", "manx; mannois" ("gmh", unde), -- "German, Middle High (ca.1050-1500)", -- "allemand, moyen haut (ca. 1050-1500)" ("goh", unde), -- "German, Old High (ca.750-1050)", -- "allemand, vieux haut (ca. 750-1050)" ("gon", unde), -- "Gondi", "gond" ("gor", unde), -- "Gorontalo", "gorontalo" ("got", unde), -- "Gothic", "gothique" ("grb", unde), -- "Grebo", "grebo" ("grc", unde), -- "Greek, Ancient (to 1453)", -- "grec ancien (jusqu'à 1453)" ("grn", "gn"), -- "Guarani", "guarani" ("gsw", unde), -- "Swiss German; Alemannic; Alsatian", -- "suisse alémanique; alémanique; alsacien" ("guj", "gu"), -- "Gujarati", "goudjrati" ("gwi", unde), -- "Gwich'in", "gwich'in" ("hai", unde), -- "Haida", "haida" ("hat", "ht"), -- "Haitian; Haitian Creole", -- "haïtien; créole haïtien" ("hau", "ha"), -- "Hausa", "haoussa" ("haw", unde), -- "Hawaiian", "hawaïen" ("heb", "he"), -- "Hebrew", "hébreu" ("her", "hz"), -- "Herero", "herero" ("hil", unde), -- "Hiligaynon", "hiligaynon" ("him", unde), -- "Himachali languages; Western Pahari languages", -- "langues himachalis; langues paharis occidentales" ("hin", "hi"), -- "Hindi", "hindi" ("hit", unde), -- "Hittite", "hittite" ("hmn", unde), -- "Hmong; Mong", "hmong" ("hmo", "ho"), -- "Hiri Motu", "hiri motu" ("hrv", "hr"), -- "Croatian", "croate" ("hsb", unde), -- "Upper Sorbian", "haut-sorabe" ("hun", "hu"), -- "Hungarian", "hongrois" ("hup", unde), -- "Hupa", "hupa" ("iba", unde), -- "Iban", "iban" ("ibo", "ig"), -- "Igbo", "igbo" ("ice", "is"), -- (B) ("isl", "is"), -- (T) "Icelandic", "islandais" ("ido", "io"), -- "Ido", "ido" ("iii", "ii"), -- "Sichuan Yi; Nuosu", "yi de Sichuan" ("ijo", unde), -- "Ijo languages", "ijo, langues" ("iku", "iu"), -- "Inuktitut", "inuktitut" ("ile", "ie"), -- "Interlingue; Occidental", "interlingue" ("ilo", unde), -- "Iloko", "ilocano" ("ina", "ia"), -- "Interlingua (International Auxiliary Language Association)", -- "interlingua (langue auxiliaire internationale)" ("inc", unde), -- "Indic languages", "indo-aryennes, langues" ("ind", "id"), -- "Indonesian", "indonésien" ("ine", unde), -- "Indo-European languages", -- "indo-européennes, langues" ("inh", unde), -- "Ingush", "ingouche" ("ipk", "ik"), -- "Inupiaq", "inupiaq" ("ira", unde), -- "Iranian languages", "iraniennes, langues" ("iro", unde), -- "Iroquoian languages", "iroquoises, langues" ("ita", "it"), -- "Italian", "italien" ("jav", "jv"), -- "Javanese", "javanais" ("jbo", unde), -- "Lojban", "lojban" ("jpn", "ja"), -- "Japanese", "japonais" ("jpr", unde), -- "Judeo-Persian", "judéo-persan" ("jrb", unde), -- "Judeo-Arabic", "judéo-arabe" ("kaa", unde), -- "Kara-Kalpak", "karakalpak" ("kab", unde), -- "Kabyle", "kabyle" ("kac", unde), -- "Kachin; Jingpho", "kachin; jingpho" ("kal", "kl"), -- "Kalaallisut; Greenlandic", "groenlandais" ("kam", unde), -- "Kamba", "kamba" ("kan", "kn"), -- "Kannada", "kannada" ("kar", unde), -- "Karen languages", "karen, langues" ("kas", "ks"), -- "Kashmiri", "kashmiri" ("kau", "kr"), -- "Kanuri", "kanouri" ("kaw", unde), -- "Kawi", "kawi" ("kaz", "kk"), -- "Kazakh", "kazakh" ("kbd", unde), -- "Kabardian", "kabardien" ("kha", unde), -- "Khasi", "khasi" ("khi", unde), -- "Khoisan languages", "khoïsan, langues" ("khm", "km"), -- "Central Khmer", "khmer central" ("kho", unde), -- "Khotanese; Sakan", "khotanais; sakan" ("kik", "ki"), -- "Kikuyu; Gikuyu", "kikuyu" ("kin", "rw"), -- "Kinyarwanda", "rwanda" ("kir", "ky"), -- "Kirghiz; Kyrgyz", "kirghiz" ("kmb", unde), -- "Kimbundu", "kimbundu" ("kok", unde), -- "Konkani", "konkani" ("kom", "kv"), -- "Komi", "kom" ("kon", "kg"), -- "Kongo", "kongo" ("kor", "ko"), -- "Korean", "coréen" ("kos", unde), -- "Kosraean", "kosrae" ("kpe", unde), -- "Kpelle", "kpellé" ("krc", unde), -- "Karachay-Balkar", "karatchai balkar" ("krl", unde), -- "Karelian", "carélien" ("kro", unde), -- "Kru languages", "krou, langues" ("kru", unde), -- "Kurukh", "kurukh" ("kua", "kj"), -- "Kuanyama; Kwanyama", "kuanyama; kwanyama" ("kum", unde), -- "Kumyk", "koumyk" ("kur", "ku"), -- "Kurdish", "kurde" ("kut", unde), -- "Kutenai", "kutenai" ("lad", unde), -- "Ladino", "judéo-espagnol" ("lah", unde), -- "Lahnda", "lahnda" ("lam", unde), -- "Lamba", "lamba" ("lao", "lo"), -- "Lao", "lao" ("lat", "la"), -- "Latin", "latin" ("lav", "lv"), -- "Latvian", "letton" ("lez", unde), -- "Lezghian", "lezghien" ("lim", "li"), -- "Limburgan; Limburger; Limburgish", "limbourgeois" ("lin", "ln"), -- "Lingala", "lingala" ("lit", "lt"), -- "Lithuanian", "lituanien" ("lol", unde), -- "Mongo", "mongo" ("loz", unde), -- "Lozi", "lozi" ("ltz", "lb"), -- "Luxembourgish; Letzeburgesch", "luxembourgeois" ("lua", unde), -- "Luba-Lulua", "luba-lulua" ("lub", "lu"), -- "Luba-Katanga", "luba-katanga" ("lug", "lg"), -- "Ganda", "ganda" ("lui", unde), -- "Luiseno", "luiseno" ("lun", unde), -- "Lunda", "lunda" ("luo", unde), -- "Luo (Kenya and Tanzania)", "luo (Kenya et Tanzanie)" ("lus", unde), -- "Lushai", "lushai" ("mac", "mk"), -- (B) ("mkd", "mk"), -- (T) "Macedonian", "macédonien" ("mad", unde), -- "Madurese", "madourais" ("mag", unde), -- "Magahi", "magahi" ("mah", "mh"), -- "Marshallese", "marshall" ("mai", unde), -- "Maithili", "maithili" ("mak", unde), -- "Makasar", "makassar" ("mal", "ml"), -- "Malayalam", "malayalam" ("man", unde), -- "Mandingo", "mandingue" ("mao", "mi"), -- (B) ("mri", "mi"), -- (T) "Maori", "maori" ("map", unde), -- "Austronesian languages", "austronésiennes, langues" ("mar", "mr"), -- "Marathi", "marathe" ("mas", unde), -- "Masai", "massaï" ("may", "ms"), -- (B) ("msa", "ms"), -- (T) "Malay", "malais" ("mdf", unde), -- "Moksha", "moksa" ("mdr", unde), -- "Mandar", "mandar" ("men", unde), -- "Mende", "mendé" ("mga", unde), -- "Irish, Middle (900-1200)", -- "irlandais moyen (900-1200)" ("mic", unde), -- "Mi'kmaq; Micmac", "mi'kmaq; micmac" ("min", unde), -- "Minangkabau", "minangkabau" ("mkh", unde), -- "Mon-Khmer languages", "môn-khmer, langues" ("mlg", "mg"), -- "Malagasy", "malgache" ("mlt", "mt"), -- "Maltese", "maltais" ("mnc", unde), -- "Manchu", "mandchou" ("mni", unde), -- "Manipuri", "manipuri" ("mno", unde), -- "Manobo languages", "manobo, langues" ("moh", unde), -- "Mohawk", "mohawk" ("mon", "mn"), -- "Mongolian", "mongol" ("mos", unde), -- "Mossi", "moré" ("mun", unde), -- "Munda languages", "mounda, langues" ("mus", unde), -- "Creek", "muskogee" ("mwl", unde), -- "Mirandese", "mirandais" ("mwr", unde), -- "Marwari", "marvari" ("myn", unde), -- "Mayan languages", "maya, langues" ("myv", unde), -- "Erzya", "erza" ("nah", unde), -- "Nahuatl languages", "nahuatl, langues" ("nai", unde), -- "North American Indian languages", -- "nord-amérindiennes, langues" ("nap", unde), -- "Neapolitan", "napolitain" ("nau", "na"), -- "Nauru", "nauruan" ("nav", "nv"), -- "Navajo; Navaho", "navaho" ("nbl", "nr"), -- "Ndebele, South; South Ndebele", "ndébélé du Sud" ("nde", "nd"), -- "Ndebele, North; North Ndebele", "ndébélé du Nord" ("ndo", "ng"), -- "Ndonga", "ndonga" ("nds", unde), -- "Low German; Low Saxon; German, Low; Saxon, Low", -- "bas allemand; bas saxon; allemand, bas; saxon, bas" ("nep", "ne"), -- "Nepali", "népalais" ("new", unde), -- "Nepal Bhasa; Newari", "nepal bhasa; newari" ("nia", unde), -- "Nias", "nias" ("nic", unde), -- "Niger-Kordofanian languages", -- "nigéro-kordofaniennes, langues" ("niu", unde), -- "Niuean", "niué" ("nno", "nn"), -- "Norwegian Nynorsk; Nynorsk, Norwegian", -- "norvégien nynorsk; nynorsk, norvégien" ("nob", "nb"), -- "Bokmål, Norwegian; Norwegian Bokmål", -- "norvégien bokmål" ("nog", unde), -- "Nogai", "nogaï; nogay" ("non", unde), -- "Norse, Old", "norrois, vieux" ("nor", "no"), -- "Norwegian", "norvégien" ("nqo", unde), -- "N'Ko", "n'ko" ("nso", unde), -- "Pedi; Sepedi; Northern Sotho", -- "pedi; sepedi; sotho du Nord" ("nub", unde), -- "Nubian languages", "nubiennes, langues" ("nwc", unde), -- "Classical Newari; Old Newari; Classical Nepal Bhasa", -- "newari classique" ("nya", "ny"), -- "Chichewa; Chewa; Nyanja", "chichewa; chewa; nyanja" ("nym", unde), -- "Nyamwezi", "nyamwezi" ("nyn", unde), -- "Nyankole", "nyankolé" ("nyo", unde), -- "Nyoro", "nyoro" ("nzi", unde), -- "Nzima", "nzema" ("oci", "oc"), -- "Occitan (post 1500)", "occitan (après 1500)" ("oji", "oj"), -- "Ojibwa", "ojibwa" ("ori", "or"), -- "Oriya", "oriya" ("orm", "om"), -- "Oromo", "galla" ("osa", unde), -- "Osage", "osage" ("oss", "os"), -- "Ossetian; Ossetic", "ossète" ("ota", unde), -- "Turkish, Ottoman (1500-1928)", -- "turc ottoman (1500-1928)" ("oto", unde), -- "Otomian languages", "otomi, langues" ("paa", unde), -- "Papuan languages", "papoues, langues" ("pag", unde), -- "Pangasinan", "pangasinan" ("pal", unde), -- "Pahlavi", "pahlavi" ("pam", unde), -- "Pampanga; Kapampangan", "pampangan" ("pan", "pa"), -- "Panjabi; Punjabi", "pendjabi" ("pap", unde), -- "Papiamento", "papiamento" ("pau", unde), -- "Palauan", "palau" ("peo", unde), -- "Persian, Old (ca.600-400 B.C.)", -- "perse, vieux (ca. 600-400 av. J.-C.)" ("phi", unde), -- "Philippine languages", "philippines, langues" ("phn", unde), -- "Phoenician", "phénicien" ("pli", "pi"), -- "Pali", "pali" ("pol", "pl"), -- "Polish", "polonais" ("pon", unde), -- "Pohnpeian", "pohnpei" ("por", "pt"), -- "Portuguese", "portugais" ("pra", unde), -- "Prakrit languages", "prâkrit, langues" ("pro", unde), -- "Provençal, Old (to 1500); Occitan, Old (to 1500)", -- "provençal ancien (jusqu'à 1500); " -- & "occitan ancien (jusqu'à 1500)" ("pus", "ps"), -- "Pushto; Pashto", "pachto" ("que", "qu"), -- "Quechua", "quechua" ("raj", unde), -- "Rajasthani", "rajasthani" ("rap", unde), -- "Rapanui", "rapanui" ("rar", unde), -- "Rarotongan; Cook Islands Maori", -- "rarotonga; maori des îles Cook" ("roa", unde), -- "Romance languages", "romanes, langues" ("roh", "rm"), -- "Romansh", "romanche" ("rom", unde), -- "Romany", "tsigane" ("rum", "ro"), -- (B) ("ron", "ro"), -- (T) "Romanian; Moldavian; Moldovan", "roumain; moldave" ("run", "rn"), -- "Rundi", "rundi" ("rup", unde), -- "Aromanian; Arumanian; Macedo-Romanian", -- "aroumain; macédo-roumain" ("rus", "ru"), -- "Russian", "russe" ("sad", unde), -- "Sandawe", "sandawe" ("sag", "sg"), -- "Sango", "sango" ("sah", unde), -- "Yakut", "iakoute" ("sai", unde), -- "South American Indian languages", -- "sud-amérindiennes, langues" ("sal", unde), -- "Salishan languages", "salishennes, langues" ("sam", unde), -- "Samaritan Aramaic", "samaritain" ("san", "sa"), -- "Sanskrit", "sanskrit" ("sas", unde), -- "Sasak", "sasak" ("sat", unde), -- "Santali", "santal" ("scn", unde), -- "Sicilian", "sicilien" ("sco", unde), -- "Scots", "écossais" ("sel", unde), -- "Selkup", "selkoupe" ("sem", unde), -- "Semitic languages", "sémitiques, langues" ("sga", unde), -- "Irish, Old (to 900)", -- "irlandais ancien (jusqu'à 900)" ("sgn", unde), -- "Sign Languages", "langues des signes" ("shn", unde), -- "Shan", "chan" ("sid", unde), -- "Sidamo", "sidamo" ("sin", "si"), -- "Sinhala; Sinhalese", "singhalais" ("sio", unde), -- "Siouan languages", "sioux, langues" ("sit", unde), -- "Sino-Tibetan languages", "sino-tibétaines, langues" ("sla", unde), -- "Slavic languages", "slaves, langues" ("slo", "sk"), -- (B) ("slk", "sk"), -- (T) "Slovak", "slovaque" ("slv", "sl"), -- "Slovenian", "slovène" ("sma", unde), -- "Southern Sami", "sami du Sud" ("sme", "se"), -- "Northern Sami", "sami du Nord" ("smi", unde), -- "Sami languages", "sames, langues" ("smj", unde), -- "Lule Sami", "sami de Lule" ("smn", unde), -- "Inari Sami", "sami d'Inari" ("smo", "sm"), -- "Samoan", "samoan" ("sms", unde), -- "Skolt Sami", "sami skolt" ("sna", "sn"), -- "Shona", "shona" ("snd", "sd"), -- "Sindhi", "sindhi" ("snk", unde), -- "Soninke", "soninké" ("sog", unde), -- "Sogdian", "sogdien" ("som", "so"), -- "Somali", "somali" ("son", unde), -- "Songhai languages", "songhai, langues" ("sot", "st"), -- "Sotho, Southern", "sotho du Sud" ("spa", "es"), -- "Spanish; Castilian", "espagnol; castillan" ("srd", "sc"), -- "Sardinian", "sarde" ("srn", unde), -- "Sranan Tongo", "sranan tongo" ("srp", "sr"), -- "Serbian", "serbe" ("srr", unde), -- "Serer", "sérère" ("ssa", unde), -- "Nilo-Saharan languages", "nilo-sahariennes, langues" ("ssw", "ss"), -- "Swati", "swati" ("suk", unde), -- "Sukuma", "sukuma" ("sun", "su"), -- "Sundanese", "soundanais" ("sus", unde), -- "Susu", "soussou" ("sux", unde), -- "Sumerian", "sumérien" ("swa", "sw"), -- "Swahili", "swahili" ("swe", "sv"), -- "Swedish", "suédois" ("syc", unde), -- "Classical Syriac", "syriaque classique" ("syr", unde), -- "Syriac", "syriaque" ("tah", "ty"), -- "Tahitian", "tahitien" ("tai", unde), -- "Tai languages", "tai, langues" ("tam", "ta"), -- "Tamil", "tamoul" ("tat", "tt"), -- "Tatar", "tatar" ("tel", "te"), -- "Telugu", "télougou" ("tem", unde), -- "Timne", "temne" ("ter", unde), -- "Tereno", "tereno" ("tet", unde), -- "Tetum", "tetum" ("tgk", "tg"), -- "Tajik", "tadjik" ("tgl", "tl"), -- "Tagalog", "tagalog" ("tha", "th"), -- "Thai", "thaï" ("tig", unde), -- "Tigre", "tigré" ("tir", "ti"), -- "Tigrinya", "tigrigna" ("tiv", unde), -- "Tiv", "tiv" ("tkl", unde), -- "Tokelau", "tokelau" ("tlh", unde), -- "Klingon; tlhIngan-Hol", "klingon" ("tli", unde), -- "Tlingit", "tlingit" ("tmh", unde), -- "Tamashek", "tamacheq" ("tog", unde), -- "Tonga (Nyasa)", "tonga (Nyasa)" ("ton", "to"), -- "Tonga (Tonga Islands)", "tongan (Îles Tonga)" ("tpi", unde), -- "Tok Pisin", "tok pisin" ("tsi", unde), -- "Tsimshian", "tsimshian" ("tsn", "tn"), -- "Tswana", "tswana" ("tso", "ts"), -- "Tsonga", "tsonga" ("tuk", "tk"), -- "Turkmen", "turkmène" ("tum", unde), -- "Tumbuka", "tumbuka" ("tup", unde), -- "Tupi languages", "tupi, langues" ("tur", "tr"), -- "Turkish", "turc" ("tut", unde), -- "Altaic languages", "altaïques, langues" ("tvl", unde), -- "Tuvalu", "tuvalu" ("twi", "tw"), -- "Twi", "twi" ("tyv", unde), -- "Tuvinian", "touva" ("udm", unde), -- "Udmurt", "oudmourte" ("uga", unde), -- "Ugaritic", "ougaritique" ("uig", "ug"), -- "Uighur; Uyghur", "ouïgour" ("ukr", "uk"), -- "Ukrainian", "ukrainien" ("umb", unde), -- "Umbundu", "umbundu" ("urd", "ur"), -- "Urdu", "ourdou" ("uzb", "uz"), -- "Uzbek", "ouszbek" ("vai", unde), -- "Vai", "vaï" ("ven", "ve"), -- "Venda", "venda" ("vie", "vi"), -- "Vietnamese", "vietnamien" ("vol", "vo"), -- "Volapük", "volapük" ("vot", unde), -- "Votic", "vote" ("wak", unde), -- "Wakashan languages", "wakashanes, langues" ("wal", unde), -- "Wolaitta; Wolaytta", "wolaitta; wolaytta" ("war", unde), -- "Waray", "waray" ("was", unde), -- "Washo", "washo" ("wen", unde), -- "Sorbian languages", "sorabes, langues" ("wln", "wa"), -- "Walloon", "wallon" ("wol", "wo"), -- "Wolof", "wolof" ("xal", unde), -- "Kalmyk; Oirat", "kalmouk; oïrat" ("xho", "xh"), -- "Xhosa", "xhosa" ("yao", unde), -- "Yao", "yao" ("yap", unde), -- "Yapese", "yapois" ("yid", "yi"), -- "Yiddish", "yiddish" ("yor", "yo"), -- "Yoruba", "yoruba" ("ypk", unde), -- "Yupik languages", "yupik, langues" ("zap", unde), -- "Zapotec", "zapotèque" ("zbl", unde), -- "Blissymbols; Blissymbolics; Bliss", -- "symboles Bliss; Bliss" ("zen", unde), -- "Zenaga", "zenaga" ("zha", "za"), -- "Zhuang; Chuang", "zhuang; chuang" ("znd", unde), -- "Zande languages", "zandé, langues" ("zul", "zu"), -- "Zulu", "zoulou" ("zun", unde), -- "Zuni", "zuni" ("zza", unde)); -- "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki", -- "zaza; dimili; dimli; kirdki; kirmanjki; zazaki" -- mis, mul, qaa-qtz, und, zxx are excluded Lang_Map_3 : Language_Table_Array_Access; Lang_Map_3_Flag : aliased System.Once.Flag := 0; procedure Lang_Map_3_Init; procedure Lang_Map_3_Init is begin -- copy table Lang_Map_3 := new Language_Table_Array'(Language_Table); -- check duplicated? pragma Check (Validate, Check => (for all I in Lang_Map_3'First .. Lang_Map_3'Last - 1 => (for all J in I + 1 .. Lang_Map_3'Last => Lang_Map_3 (I).Alpha_3 /= Lang_Map_3 (J).Alpha_3))); -- sort for I in Lang_Map_3'First + 1 .. Lang_Map_3'Last loop for J in reverse Lang_Map_3'First .. I - 1 loop exit when Compare ( Lang_Map_3 (J + 1).Alpha_3, Lang_Map_3 (J).Alpha_3) >= 0; declare Temp : constant Language_Table_Element := Lang_Map_3 (J); begin Lang_Map_3 (J) := Lang_Map_3 (J + 1); Lang_Map_3 (J + 1) := Temp; end; end loop; end loop; end Lang_Map_3_Init; function To_Alpha_2 (Item : ISO_639_Alpha_3) return ISO_639_Alpha_2 is pragma Check (Dynamic_Predicate, Check => (for all E of Item => E in 'a' .. 'z')); begin System.Once.Initialize (Lang_Map_3_Flag'Access, Lang_Map_3_Init'Access); declare First : Positive := Lang_Map_3'First; Last : Natural := Lang_Map_3'Last; begin while First <= Last loop declare Middle : constant Positive := (First + Last) / 2; Middle_Item : Language_Table_Element renames Lang_Map_3 (Middle); Compared : constant Integer := Compare (Middle_Item.Alpha_3, Alpha_3_NP (Item)); begin if Compared > 0 then Last := Middle - 1; elsif expect (Long_Boolean (Compared < 0), True) then First := Middle + 1; else return ( 1 => Middle_Item.Alpha_2 (1), 2 => Middle_Item.Alpha_2 (2)); end if; end; end loop; return ISO_639_Alpha_2_Unknown; end; end To_Alpha_2; Lang_Map_2 : Language_Table_Array_Access; Lang_Map_2_Flag : aliased System.Once.Flag := 0; procedure Lang_Map_2_Init; procedure Lang_Map_2_Init is begin -- copy table -- select terminology (second) declare Num : Natural := 0; J : Positive; begin for I in Language_Table'Range loop if Language_Table (I).Alpha_2 /= unde and then ( I = Language_Table'Last or else Language_Table (I).Alpha_2 /= Language_Table (I + 1).Alpha_2) then Num := Num + 1; end if; end loop; Lang_Map_2 := new Language_Table_Array (1 .. Num); J := Lang_Map_2'First; for I in Language_Table'Range loop if Language_Table (I).Alpha_2 /= unde and then ( I = Language_Table'Last or else Language_Table (I).Alpha_2 /= Language_Table (I + 1).Alpha_2) then Lang_Map_2 (J) := Language_Table (I); J := J + 1; end if; end loop; end; -- check duplicated? pragma Check (Validate, Check => (for all I in Lang_Map_2'First .. Lang_Map_2'Last - 1 => (for all J in I + 1 .. Lang_Map_2'Last => Lang_Map_2 (I).Alpha_2 /= Lang_Map_2 (J).Alpha_2))); -- sort for I in Lang_Map_2'First + 1 .. Lang_Map_2'Last loop for J in reverse Lang_Map_2'First .. I - 1 loop exit when Compare ( Lang_Map_2 (J + 1).Alpha_2, Lang_Map_2 (J).Alpha_2) >= 0; declare Temp : constant Language_Table_Element := Lang_Map_2 (J); begin Lang_Map_2 (J) := Lang_Map_2 (J + 1); Lang_Map_2 (J + 1) := Temp; end; end loop; end loop; end Lang_Map_2_Init; function To_Alpha_3 (Item : ISO_639_Alpha_2) return ISO_639_Alpha_3 is pragma Check (Dynamic_Predicate, Check => (for all E of Item => E in 'a' .. 'z')); begin System.Once.Initialize (Lang_Map_2_Flag'Access, Lang_Map_2_Init'Access); declare First : Positive := Lang_Map_2'First; Last : Natural := Lang_Map_2'Last; begin while First <= Last loop declare Middle : constant Positive := (First + Last) / 2; Middle_Item : Language_Table_Element renames Lang_Map_2 (Middle); Compared : constant Integer := Compare (Middle_Item.Alpha_2, Alpha_2_NP (Item)); begin if Compared > 0 then Last := Middle - 1; elsif expect (Long_Boolean (Compared < 0), True) then First := Middle + 1; else return ( 1 => Middle_Item.Alpha_3 (1), 2 => Middle_Item.Alpha_3 (2), 3 => Middle_Item.Alpha_3 (3)); end if; end; end loop; return ISO_639_Alpha_3_Unknown; end; end To_Alpha_3; function Language return ISO_639_Alpha_2 renames System.Native_Locales.Language; function Language return ISO_639_Alpha_3 renames System.Native_Locales.Language; function Country return ISO_3166_1_Alpha_2 renames System.Native_Locales.Country; end Ada.Locales;
with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Containers.Doubly_Linked_Lists; with Display_Warning; package Texaco is c :Key_Code; Ch : Character; Current_Char : Column_Position := 1; Save : Boolean; -- package DLL renames Ada.Containers.Doubly_Linked_Lists; package SU renames Ada.Strings.Unbounded; package String_List is new Ada.Containers.Doubly_Linked_Lists(Unbounded_String); use String_List; Text_Buffer : String_List.List; function GetKey (win1 : Window := Standard_Window) return Key_Code; -- procedure Line_Editor (Edline : in out Unbounded_String); procedure Line_Editor (win1 : Window; StartLine : Line_Position; StartColumn :Column_Position; EditLength : Column_Position; Edline : in out Unbounded_String; MaxLength : Integer; TextEditMode : Boolean := False; SuppressSpaces : Boolean := False; Number : Boolean := False ); procedure Text_Editor (win1 : Window; TopLine : Line_Position; BottomLine :Line_Position; MaxLines : Integer); procedure Dump_List; procedure Password_Editor (Win1 : Window; StartLine : Line_Position; StartColumn :Column_Position; Edline : in out Unbounded_String; MaxLength : Integer); end Texaco;
with System.Storage_Barriers; package body System.Reference_Counting is pragma Suppress (All_Checks); use type Storage_Elements.Storage_Offset; function atomic_load ( ptr : not null access constant Counter; memorder : Integer := Storage_Barriers.ATOMIC_ACQUIRE) return Counter with Import, Convention => Intrinsic, External_Name => "__atomic_load_4"; procedure atomic_add_fetch ( ptr : not null access Counter; val : Counter; memorder : Integer := Storage_Barriers.ATOMIC_ACQ_REL) with Import, Convention => Intrinsic, External_Name => "__atomic_add_fetch_4"; function atomic_sub_fetch ( ptr : not null access Counter; val : Counter; memorder : Integer := Storage_Barriers.ATOMIC_ACQ_REL) return Counter with Import, Convention => Intrinsic, External_Name => "__atomic_sub_fetch_4"; pragma Compile_Time_Error ( Storage_Elements.Storage_Offset'Size /= 32 and then Storage_Elements.Storage_Offset'Size /= 64, "Storage_Elements.Storage_Offset'Size is neither 32 nor 64"); -- Use sequentially consistent model because an object's length and -- contents should be synchronized. Order : constant := Storage_Barriers.ATOMIC_SEQ_CST; function atomic_compare_exchange ( ptr : not null access Length_Type; expected : not null access Length_Type; desired : Length_Type; weak : Boolean := False; success_memorder : Integer := Order; failure_memorder : Integer := Order) return Boolean with Import, Convention => Intrinsic, External_Name => (case Storage_Elements.Storage_Offset'Size is when 32 => "__atomic_compare_exchange_4", when others => "__atomic_compare_exchange_8"); -- implementation function Shared (Data : not null Data_Access) return Boolean is begin return atomic_load (Data) > 1; -- static is True end Shared; -- not null because using sentinel (that means empty data block) procedure Adjust ( Target : not null access Container) is Reference_Count : constant not null Data_Access := Target.all; begin if atomic_load (Reference_Count) /= Static then atomic_add_fetch (Reference_Count, 1); end if; end Adjust; procedure Assign ( Target : not null access Container; Source : not null access constant Container; Free : not null access procedure (Object : in out Data_Access)) is begin if Target.all /= Source.all then Clear (Target, Free); Target.all := Source.all; Adjust (Target); end if; end Assign; procedure Clear ( Target : not null access Container; Free : not null access procedure (Object : in out Data_Access)) is Reference_Count : constant not null Data_Access := Target.all; begin if atomic_load (Reference_Count) /= Static and then atomic_sub_fetch (Reference_Count, 1) = 0 then Free (Target.all); end if; end Clear; procedure Move ( Target : not null access Container; Source : not null access Container; Sentinel : not null Data_Access; Free : not null access procedure (Object : in out Data_Access)) is begin if Target.all /= Source.all then Clear (Target, Free); Target.all := Source.all; Source.all := Sentinel; end if; end Move; procedure Unique ( Target : not null access Container; Target_Length : Length_Type; Target_Capacity : Length_Type; New_Length : Length_Type; New_Capacity : Length_Type; Sentinel : not null Data_Access; Reallocate : not null access procedure ( Target : aliased in out not null Data_Access; Length : Length_Type; Max_Length : Length_Type; Capacity : Length_Type); Copy : not null access procedure ( Target : out not null Data_Access; Source : not null Data_Access; Length : Length_Type; Max_Length : Length_Type; Capacity : Length_Type); Free : not null access procedure (Object : in out Data_Access)) is begin if Shared (Target.all) then if New_Capacity /= Target_Capacity or else Target.all /= Sentinel then declare Old : aliased Container := Target.all; begin if New_Capacity = 0 then Target.all := Sentinel; else Copy ( Target.all, Old, Target_Length, New_Length, New_Capacity); end if; Clear (Old'Access, Free => Free); end; end if; else -- not shared if New_Capacity /= Target_Capacity then if New_Capacity = 0 then Free (Target.all); Target.all := Sentinel; else Reallocate ( Target.all, Target_Length, New_Length, New_Capacity); end if; end if; end if; end Unique; procedure In_Place_Set_Length ( Target_Data : not null Data_Access; Target_Length : Length_Type; Target_Max_Length : aliased in out Length_Type; Target_Capacity : Length_Type; New_Length : Length_Type; Failure : out Boolean) is begin if New_Length > Target_Length then -- inscreasing if New_Length > Target_Capacity then -- expanding Failure := True; -- should be reallocated else -- try to use reserved area declare Expected : aliased Length_Type := Target_Length; begin Failure := not atomic_compare_exchange ( Target_Max_Length'Access, Expected'Access, New_Length); end; if Failure and then not Shared (Target_Data) then -- reference count = 1 Target_Max_Length := New_Length; Failure := False; -- success end if; end if; else -- decreasing if not Shared (Target_Data) then Target_Max_Length := New_Length; end if; Failure := False; -- success end if; end In_Place_Set_Length; end System.Reference_Counting;
with Ada.Command_Line; with Ada.Text_IO; with CORBA.ORB; with CorbaCBSG.CBSG; with CorbaCBSG; use CorbaCBSG; with PolyORB.Setup.Client; pragma Warnings (Off, PolyORB.Setup.Client); procedure Client is use Ada.Command_Line; use Ada.Text_IO; use type CORBA.String; Rcvd_Bullshits : CORBA.String; Bullshit_Generator : CorbaCBSG.CBSG.Ref; Timestamped_Bullshit : timestamped_Sentence; begin CORBA.ORB.Initialize ("ORB"); if Argument_Count not in 1 .. 2 then Put_Line ("usage: client <IOR_string_from_server>"); return; end if; -- Get the distributed object reference through its IOR or corbaloc CORBA.ORB.String_To_Object (CORBA.To_CORBA_String (Ada.Command_Line.Argument (1)), Bullshit_Generator); -- Check that the reference is correct if CorbaCBSG.CBSG.Is_Nil(Bullshit_Generator) then Put_Line ("main : cannot invoke on a nil reference"); return; end if; -- Call a method Rcvd_Bullshits := CorbaCBSG.CBSG.createSentence(Bullshit_Generator); Put_Line ("The generator said : " & CORBA.To_Standard_String (Rcvd_Bullshits)); Timestamped_Bullshit := CorbaCBSG.CBSG.createTimestampedSentence(Bullshit_Generator); Put_Line ("At " & Timestamped_Bullshit.timestamp'Image & ", the generator said : " & CORBA.to_Standard_String (Timestamped_Bullshit.sentence)); exception when E : CORBA.Transient => declare Memb : CORBA.System_Exception_Members; begin CORBA.Get_Members (E, Memb); Put ("received exception transient, minor"); Put (CORBA.Unsigned_Long'Image (Memb.Minor)); Put (", completion status: "); Put_Line (CORBA.Completion_Status'Image (Memb.Completed)); end; end Client;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 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 Ada.Command_Line; with Ada.Containers.Indefinite_Holders; with Ada.Directories; with Ada.Exceptions; with Ada.Real_Time; with Ada.Strings.Unbounded; with Ada.Text_IO; with Ada.Containers.Vectors; with GL.Objects.Samplers; with GL.Objects.Textures; with GL.Toggles; with GL.Types; with GL.Viewports; with Orka.Behaviors; with Orka.Cameras.Rotate_Around_Cameras; with Orka.Contexts.AWT; with Orka.Debug; with Orka.Loggers.Terminal; with Orka.Logging; with Orka.Loops; with Orka.Rendering.Drawing; with Orka.Rendering.Framebuffers; with Orka.Rendering.Programs.Modules; with Orka.Rendering.Programs.Uniforms; with Orka.Rendering.Textures; with Orka.Resources.Locations.Directories; with Orka.Resources.Textures.KTX; with Orka.Types; with Orka.Windows; with AWT.Inputs; with Orka_Package_KTX; procedure Orka_KTX is Width : constant := 1280; Height : constant := 720; type Zoom_Mode is (Best_Fit, Actual_Size); type View_Mode is (External, Internal); package Job_System renames Orka_Package_KTX.Job_System; package Loader renames Orka_Package_KTX.Loader; use type Orka.Integer_32; use all type Orka.Logging.Source; use all type Orka.Logging.Severity; package Messages is new Orka.Logging.Messages (Application); package SU renames Ada.Strings.Unbounded; use type SU.Unbounded_String; begin if Ada.Command_Line.Argument_Count /= 1 then Ada.Text_IO.Put_Line ("Usage: <path to .ktx file>"); Job_System.Shutdown; Loader.Shutdown; return; end if; Orka.Logging.Set_Logger (Orka.Loggers.Terminal.Create_Logger (Level => Orka.Loggers.Info)); declare Context : constant Orka.Contexts.Context'Class := Orka.Contexts.AWT.Create_Context (Version => (4, 2), Flags => (Debug => True, others => False)); Window : constant Orka.Windows.Window'Class := Orka.Contexts.AWT.Create_Window (Context, Width, Height, Resizable => False); begin Orka.Debug.Set_Log_Messages (Enable => True); declare Full_Path : constant String := Ada.Command_Line.Argument (1); Location_Path : constant String := Ada.Directories.Containing_Directory (Full_Path); Texture_Path : SU.Unbounded_String := SU.To_Unbounded_String (Ada.Directories.Simple_Name (Full_Path)); Load_Texture_Path : SU.Unbounded_String := Texture_Path; type Load_Action_Kind is (Previous_File, Next_File); procedure Load_File (Action : Load_Action_Kind) is package String_Vectors is new Ada.Containers.Vectors (Positive, SU.Unbounded_String); Files : String_Vectors.Vector; procedure Process_File (File : Ada.Directories.Directory_Entry_Type) is Name : constant String := Ada.Directories.Simple_Name (File); begin Files.Append (SU.To_Unbounded_String (Name)); end Process_File; use all type Ada.Directories.File_Kind; begin Ada.Directories.Search (Directory => Location_Path, Pattern => "*.ktx", Filter => (Ordinary_File => True, others => False), Process => Process_File'Access); declare Cursor : String_Vectors.Cursor := Files.Find (Texture_Path); use type String_Vectors.Cursor; begin case Action is when Previous_File => Cursor := String_Vectors.Previous (Cursor); when Next_File => Cursor := String_Vectors.Next (Cursor); end case; if Cursor /= String_Vectors.No_Element then Load_Texture_Path := Files (Cursor); end if; end; end Load_File; use Orka.Rendering.Programs; use Orka.Rendering.Framebuffers; use Orka.Resources; use GL.Types; ---------------------------------------------------------------------- FB_D : Framebuffer := Create_Default_Framebuffer (Window.Width, Window.Height); use Orka.Cameras; Lens : constant Camera_Lens := Create_Lens (Width, Height, Transforms.FOV (36.0, 50.0), Context); Current_Camera : aliased Rotate_Around_Cameras.Rotate_Around_Camera := Rotate_Around_Cameras.Create_Camera (Lens); ---------------------------------------------------------------------- use GL.Objects.Textures; use GL.Objects.Samplers; Sampler_1 : Sampler; Location_Textures : constant Locations.Location_Ptr := Locations.Directories.Create_Location (Location_Path); package Texture_Holders is new Ada.Containers.Indefinite_Holders (Element_Type => GL.Objects.Textures.Texture); T_1 : Texture_Holders.Holder; Maximum_Level : Mipmap_Level; ---------------------------------------------------------------------- Location_Shaders : constant Locations.Location_Ptr := Locations.Directories.Create_Location ("data/shaders"); function Get_Module (Kind : LE.Texture_Kind) return Modules.Module is use all type LE.Texture_Kind; begin case Kind is when Texture_1D => return Modules.Create_Module (Location_Shaders, VS => "oversized-triangle.vert", FS => "tools/ktx-1D.frag"); when Texture_2D => return Modules.Create_Module (Location_Shaders, VS => "oversized-triangle.vert", FS => "tools/ktx-2D.frag"); when Texture_3D => return Modules.Create_Module (Location_Shaders, VS => "tools/volume.vert", FS => "tools/ktx-3D.frag"); when Texture_Cube_Map => return Modules.Create_Module (Location_Shaders, VS => "tools/cube.vert", FS => "tools/ktx-cube.frag"); when Texture_2D_Array => return Modules.Create_Module (Location_Shaders, VS => "oversized-triangle.vert", FS => "tools/ktx-2D-array.frag"); when others => raise Constraint_Error with "Unsupported texture kind"; end case; end Get_Module; procedure Draw (Kind : LE.Texture_Kind) is use all type LE.Texture_Kind; begin case Kind is when Texture_1D | Texture_2D | Texture_2D_Array => Orka.Rendering.Drawing.Draw (GL.Types.Triangles, 0, 3); when Texture_3D | Texture_Cube_Map => Orka.Rendering.Drawing.Draw (GL.Types.Triangles, 0, 6 * 6); when others => raise Constraint_Error; end case; end Draw; procedure Update_Title (Kind : LE.Texture_Kind; Mode : Zoom_Mode; View : View_Mode; Colors : Boolean; Level, Levels : Mipmap_Level) is use all type LE.Texture_Kind; use type Zoom_Mode; use type View_Mode; Text : SU.Unbounded_String := "KTX viewer - " & Texture_Path; begin if Levels > 1 then SU.Append (Text, " (level " & Orka.Logging.Trim (Mipmap_Level'Image (Level + 1)) & "/" & Orka.Logging.Trim (Levels'Image) & ")"); end if; case Kind is when Texture_1D | Texture_2D | Texture_2D_Array => SU.Append (Text, " (zoom: " & Mode'Image & ")"); when Texture_3D | Texture_Cube_Map => SU.Append (Text, " (view: " & View'Image & ")"); SU.Append (Text, " (colors: " & Colors'Image & ")"); when others => null; end case; Window.Set_Title (SU.To_String (Text)); end Update_Title; P_1 : Program; begin -- Clear color to black and depth to 0.0 (if using reversed Z) FB_D.Set_Default_Values ((Color => (0.0, 0.0, 0.0, 1.0), Depth => (if Context.Enabled (Orka.Contexts.Reversed_Z) then 0.0 else 1.0), others => <>)); FB_D.Use_Framebuffer; Sampler_1.Set_X_Wrapping (Clamp_To_Edge); Sampler_1.Set_Y_Wrapping (Clamp_To_Edge); Sampler_1.Set_Minifying_Filter (Linear); Sampler_1.Set_Magnifying_Filter (Linear); Sampler_1.Bind (0); GL.Toggles.Enable (GL.Toggles.Depth_Test); GL.Toggles.Enable (GL.Toggles.Texture_Cube_Map_Seamless); declare Level : Mipmap_Level := 0 with Atomic; Render_Zoom : Zoom_Mode := Best_Fit with Atomic; Render_View : View_Mode := External with Atomic; Render_Colors : Boolean := False with Atomic; package Loops is new Orka.Loops (Time_Step => Ada.Real_Time.Microseconds (2_083), Frame_Limit => Ada.Real_Time.Microseconds (16_667), Camera => Current_Camera'Unchecked_Access, Job_Manager => Job_System); procedure Render (Scene : not null Orka.Behaviors.Behavior_Array_Access; Camera : Orka.Cameras.Camera_Ptr) is use all type LE.Texture_Kind; begin FB_D.Clear; if Load_Texture_Path /= SU.Null_Unbounded_String then T_1 := Texture_Holders.To_Holder (Orka.Resources.Textures.KTX.Read_Texture (Location_Textures, SU.To_String (Load_Texture_Path))); P_1 := Create_Program (Get_Module (T_1.Constant_Reference.Kind)); P_1.Use_Program; declare Uni_Texture : constant Uniforms.Uniform_Sampler := P_1.Uniform_Sampler ("colorTexture"); begin Uni_Texture.Verify_Compatibility (T_1.Constant_Reference); Orka.Rendering.Textures.Bind (T_1.Constant_Reference, Orka.Rendering.Textures.Texture, 0); end; Maximum_Level := T_1.Constant_Reference.Mipmap_Levels - 1; Level := Mipmap_Level'Min (Level, Maximum_Level); Texture_Path := Load_Texture_Path; Load_Texture_Path := SU.Null_Unbounded_String; end if; T_1.Constant_Reference.Set_Lowest_Mipmap_Level (Level); Update_Title (T_1.Constant_Reference.Kind, Render_Zoom, Render_View, Render_Colors, Level, Maximum_Level + 1); case T_1.Constant_Reference.Kind is when Texture_1D | Texture_2D | Texture_2D_Array => declare Uni_Screen : constant Uniforms.Uniform := P_1.Uniform ("screenSize"); Uni_Best_Fit : constant Uniforms.Uniform := P_1.Uniform ("useBestFit"); begin Uni_Screen.Set_Vector (Orka.Types.Singles.Vector4' (Single (Window.Width), Single (Window.Height), 0.0, 0.0) ); Uni_Best_Fit.Set_Boolean (Render_Zoom = Best_Fit); end; when Texture_3D | Texture_Cube_Map => declare Uni_View : constant Uniforms.Uniform := P_1.Uniform ("view"); Uni_Proj : constant Uniforms.Uniform := P_1.Uniform ("proj"); Uni_External : constant Uniforms.Uniform := P_1.Uniform ("showExternal"); Uni_Colors : constant Uniforms.Uniform := P_1.Uniform ("showColors"); Uni_Invert : constant Uniforms.Uniform := P_1.Uniform ("invertView"); begin Uni_Invert.Set_Boolean (Render_View = Internal); Uni_View.Set_Matrix (Camera.View_Matrix); Uni_Proj.Set_Matrix (Camera.Projection_Matrix); Uni_External.Set_Boolean (Render_View = External); Uni_Colors.Set_Boolean (Render_Colors); end; when others => null; end case; -- The viewport of the default framebuffer could be adjusted -- automatically by implementing Window's procedure On_Configure GL.Viewports.Set_Viewports ((0 => (X => 0.0, Y => 0.0, Width => Single (Window.Width), Height => Single (Window.Height)) )); Draw (T_1.Constant_Reference.Kind); Window.Swap_Buffers; if Window.Should_Close then Loops.Stop_Loop; end if; end Render; begin Loops.Scene.Add (Orka.Behaviors.Null_Behavior); declare task Render_Task is entry Start_Rendering; end Render_Task; task body Render_Task is begin accept Start_Rendering; Context.Make_Current (Window); Loops.Run_Loop (Render'Access); Context.Make_Not_Current; exception when Error : others => Ada.Text_IO.Put_Line ("Error: " & Ada.Exceptions.Exception_Information (Error)); Context.Make_Not_Current; raise; end Render_Task; Did_Rotate_Camera : Boolean := False; begin Context.Make_Not_Current; Render_Task.Start_Rendering; while not Window.Should_Close loop AWT.Process_Events (0.016667); declare Pointer : constant AWT.Inputs.Pointer_State := Window.State; Keyboard : constant AWT.Inputs.Keyboard_State := Window.State; use all type AWT.Inputs.Button_State; use all type AWT.Inputs.Keyboard_Button; use all type AWT.Inputs.Pointer_Button; use all type AWT.Inputs.Pointer_Mode; use all type AWT.Inputs.Dimension; Rotate_Camera : constant Boolean := Pointer.Focused and Pointer.Buttons (Right) = Pressed; begin if Keyboard.Pressed (Key_Escape) then Window.Close; end if; if Keyboard.Pressed (Key_Arrow_Down) then Level := Mipmap_Level'Max (0, Level - 1); end if; if Keyboard.Pressed (Key_Arrow_Up) then Level := Mipmap_Level'Min (Maximum_Level, Level + 1); end if; if Keyboard.Pressed (Key_Arrow_Left) then Load_File (Previous_File); end if; if Keyboard.Pressed (Key_Arrow_Right) then Load_File (Next_File); end if; if Keyboard.Pressed (Key_Z) then if Render_Zoom = Zoom_Mode'Last then Render_Zoom := Zoom_Mode'First; else Render_Zoom := Zoom_Mode'Succ (Render_Zoom); end if; end if; if Keyboard.Pressed (Key_V) then if Render_View = View_Mode'Last then Render_View := View_Mode'First; else Render_View := View_Mode'Succ (Render_View); end if; end if; if Keyboard.Pressed (Key_C) then Render_Colors := not Render_Colors; end if; if Rotate_Camera /= Did_Rotate_Camera then Window.Set_Pointer_Mode (if Rotate_Camera then Locked else Visible); end if; Did_Rotate_Camera := Rotate_Camera; -- FIXME Update with PO? Rotate_Around_Cameras.Rotate_Around_Camera'Class (Current_Camera).Change_Orientation (((if Rotate_Camera then Orka.Float_64 (Pointer.Relative (X)) else 0.0), (if Rotate_Camera then Orka.Float_64 (Pointer.Relative (Y)) else 0.0), Orka.Float_64 (Pointer.Scroll (Y)), 0.0)); end; end loop; end; end; end; end; Job_System.Shutdown; Loader.Shutdown; exception when Error : others => Ada.Text_IO.Put_Line ("Error: " & Ada.Exceptions.Exception_Information (Error)); Job_System.Shutdown; Loader.Shutdown; end Orka_KTX;
------------------------------------------------------------------------------ -- -- -- 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.Internals.Extents; with AMF.Internals.Tables.CMOF_Constructors; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.DG_String_Data_00; package body AMF.Internals.Tables.DG_Metamodel.Objects is ---------------- -- Initialize -- ---------------- procedure Initialize is Extent : constant AMF.Internals.AMF_Extent := AMF.Internals.Extents.Allocate_Extent (AMF.Internals.Tables.DG_String_Data_00.MS_00F7'Access); begin Base := AMF.Internals.Tables.CMOF_Element_Table.Last; Initialize_1 (Extent); Initialize_2 (Extent); Initialize_3 (Extent); Initialize_4 (Extent); Initialize_5 (Extent); Initialize_6 (Extent); Initialize_7 (Extent); Initialize_8 (Extent); Initialize_9 (Extent); Initialize_10 (Extent); Initialize_11 (Extent); Initialize_12 (Extent); Initialize_13 (Extent); Initialize_14 (Extent); Initialize_15 (Extent); Initialize_16 (Extent); Initialize_17 (Extent); Initialize_18 (Extent); Initialize_19 (Extent); Initialize_20 (Extent); Initialize_21 (Extent); Initialize_22 (Extent); Initialize_23 (Extent); Initialize_24 (Extent); Initialize_25 (Extent); Initialize_26 (Extent); Initialize_27 (Extent); Initialize_28 (Extent); Initialize_29 (Extent); Initialize_30 (Extent); Initialize_31 (Extent); Initialize_32 (Extent); Initialize_33 (Extent); Initialize_34 (Extent); Initialize_35 (Extent); Initialize_36 (Extent); Initialize_37 (Extent); Initialize_38 (Extent); Initialize_39 (Extent); Initialize_40 (Extent); Initialize_41 (Extent); Initialize_42 (Extent); Initialize_43 (Extent); Initialize_44 (Extent); Initialize_45 (Extent); Initialize_46 (Extent); Initialize_47 (Extent); Initialize_48 (Extent); Initialize_49 (Extent); Initialize_50 (Extent); Initialize_51 (Extent); Initialize_52 (Extent); Initialize_53 (Extent); Initialize_54 (Extent); Initialize_55 (Extent); Initialize_56 (Extent); Initialize_57 (Extent); Initialize_58 (Extent); Initialize_59 (Extent); Initialize_60 (Extent); Initialize_61 (Extent); Initialize_62 (Extent); Initialize_63 (Extent); Initialize_64 (Extent); Initialize_65 (Extent); Initialize_66 (Extent); Initialize_67 (Extent); Initialize_68 (Extent); Initialize_69 (Extent); Initialize_70 (Extent); Initialize_71 (Extent); Initialize_72 (Extent); Initialize_73 (Extent); Initialize_74 (Extent); Initialize_75 (Extent); Initialize_76 (Extent); Initialize_77 (Extent); Initialize_78 (Extent); Initialize_79 (Extent); Initialize_80 (Extent); Initialize_81 (Extent); Initialize_82 (Extent); Initialize_83 (Extent); Initialize_84 (Extent); Initialize_85 (Extent); Initialize_86 (Extent); Initialize_87 (Extent); Initialize_88 (Extent); Initialize_89 (Extent); Initialize_90 (Extent); Initialize_91 (Extent); Initialize_92 (Extent); Initialize_93 (Extent); Initialize_94 (Extent); Initialize_95 (Extent); Initialize_96 (Extent); Initialize_97 (Extent); Initialize_98 (Extent); Initialize_99 (Extent); Initialize_100 (Extent); Initialize_101 (Extent); Initialize_102 (Extent); Initialize_103 (Extent); Initialize_104 (Extent); Initialize_105 (Extent); Initialize_106 (Extent); Initialize_107 (Extent); Initialize_108 (Extent); Initialize_109 (Extent); Initialize_110 (Extent); Initialize_111 (Extent); Initialize_112 (Extent); Initialize_113 (Extent); Initialize_114 (Extent); Initialize_115 (Extent); Initialize_116 (Extent); Initialize_117 (Extent); Initialize_118 (Extent); Initialize_119 (Extent); Initialize_120 (Extent); Initialize_121 (Extent); Initialize_122 (Extent); Initialize_123 (Extent); Initialize_124 (Extent); Initialize_125 (Extent); Initialize_126 (Extent); Initialize_127 (Extent); Initialize_128 (Extent); Initialize_129 (Extent); Initialize_130 (Extent); Initialize_131 (Extent); Initialize_132 (Extent); Initialize_133 (Extent); Initialize_134 (Extent); Initialize_135 (Extent); Initialize_136 (Extent); Initialize_137 (Extent); Initialize_138 (Extent); Initialize_139 (Extent); Initialize_140 (Extent); Initialize_141 (Extent); Initialize_142 (Extent); Initialize_143 (Extent); Initialize_144 (Extent); Initialize_145 (Extent); Initialize_146 (Extent); Initialize_147 (Extent); Initialize_148 (Extent); Initialize_149 (Extent); Initialize_150 (Extent); Initialize_151 (Extent); Initialize_152 (Extent); Initialize_153 (Extent); Initialize_154 (Extent); Initialize_155 (Extent); Initialize_156 (Extent); Initialize_157 (Extent); Initialize_158 (Extent); Initialize_159 (Extent); Initialize_160 (Extent); Initialize_161 (Extent); Initialize_162 (Extent); Initialize_163 (Extent); Initialize_164 (Extent); Initialize_165 (Extent); Initialize_166 (Extent); Initialize_167 (Extent); Initialize_168 (Extent); Initialize_169 (Extent); Initialize_170 (Extent); Initialize_171 (Extent); Initialize_172 (Extent); Initialize_173 (Extent); Initialize_174 (Extent); Initialize_175 (Extent); Initialize_176 (Extent); Initialize_177 (Extent); Initialize_178 (Extent); Initialize_179 (Extent); Initialize_180 (Extent); Initialize_181 (Extent); Initialize_182 (Extent); Initialize_183 (Extent); Initialize_184 (Extent); Initialize_185 (Extent); Initialize_186 (Extent); Initialize_187 (Extent); Initialize_188 (Extent); Initialize_189 (Extent); Initialize_190 (Extent); Initialize_191 (Extent); Initialize_192 (Extent); Initialize_193 (Extent); Initialize_194 (Extent); Initialize_195 (Extent); Initialize_196 (Extent); Initialize_197 (Extent); Initialize_198 (Extent); Initialize_199 (Extent); Initialize_200 (Extent); Initialize_201 (Extent); Initialize_202 (Extent); Initialize_203 (Extent); Initialize_204 (Extent); Initialize_205 (Extent); Initialize_206 (Extent); Initialize_207 (Extent); Initialize_208 (Extent); Initialize_209 (Extent); Initialize_210 (Extent); Initialize_211 (Extent); Initialize_212 (Extent); Initialize_213 (Extent); Initialize_214 (Extent); Initialize_215 (Extent); Initialize_216 (Extent); Initialize_217 (Extent); Initialize_218 (Extent); Initialize_219 (Extent); Initialize_220 (Extent); Initialize_221 (Extent); Initialize_222 (Extent); Initialize_223 (Extent); Initialize_224 (Extent); Initialize_225 (Extent); Initialize_226 (Extent); Initialize_227 (Extent); Initialize_228 (Extent); Initialize_229 (Extent); Initialize_230 (Extent); Initialize_231 (Extent); Initialize_232 (Extent); Initialize_233 (Extent); Initialize_234 (Extent); Initialize_235 (Extent); Initialize_236 (Extent); Initialize_237 (Extent); Initialize_238 (Extent); Initialize_239 (Extent); Initialize_240 (Extent); Initialize_241 (Extent); Initialize_242 (Extent); Initialize_243 (Extent); Initialize_244 (Extent); Initialize_245 (Extent); Initialize_246 (Extent); Initialize_247 (Extent); Initialize_248 (Extent); Initialize_249 (Extent); Initialize_250 (Extent); Initialize_251 (Extent); Initialize_252 (Extent); Initialize_253 (Extent); Initialize_254 (Extent); Initialize_255 (Extent); Initialize_256 (Extent); Initialize_257 (Extent); Initialize_258 (Extent); Initialize_259 (Extent); Initialize_260 (Extent); Initialize_261 (Extent); Initialize_262 (Extent); Initialize_263 (Extent); Initialize_264 (Extent); Initialize_265 (Extent); Initialize_266 (Extent); Initialize_267 (Extent); Initialize_268 (Extent); Initialize_269 (Extent); Initialize_270 (Extent); Initialize_271 (Extent); Initialize_272 (Extent); Initialize_273 (Extent); Initialize_274 (Extent); Initialize_275 (Extent); Initialize_276 (Extent); Initialize_277 (Extent); Initialize_278 (Extent); Initialize_279 (Extent); Initialize_280 (Extent); Initialize_281 (Extent); Initialize_282 (Extent); Initialize_283 (Extent); Initialize_284 (Extent); Initialize_285 (Extent); Initialize_286 (Extent); Initialize_287 (Extent); Initialize_288 (Extent); Initialize_289 (Extent); Initialize_290 (Extent); Initialize_291 (Extent); Initialize_292 (Extent); Initialize_293 (Extent); Initialize_294 (Extent); Initialize_295 (Extent); Initialize_296 (Extent); Initialize_297 (Extent); Initialize_298 (Extent); Initialize_299 (Extent); Initialize_300 (Extent); Initialize_301 (Extent); Initialize_302 (Extent); Initialize_303 (Extent); Initialize_304 (Extent); Initialize_305 (Extent); Initialize_306 (Extent); Initialize_307 (Extent); Initialize_308 (Extent); Initialize_309 (Extent); Initialize_310 (Extent); Initialize_311 (Extent); Initialize_312 (Extent); Initialize_313 (Extent); Initialize_314 (Extent); Initialize_315 (Extent); Initialize_316 (Extent); Initialize_317 (Extent); Initialize_318 (Extent); Initialize_319 (Extent); Initialize_320 (Extent); Initialize_321 (Extent); Initialize_322 (Extent); end Initialize; ------------------ -- Initialize_1 -- ------------------ procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_1; ------------------ -- Initialize_2 -- ------------------ procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_2; ------------------ -- Initialize_3 -- ------------------ procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_3; ------------------ -- Initialize_4 -- ------------------ procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_4; ------------------ -- Initialize_5 -- ------------------ procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_5; ------------------ -- Initialize_6 -- ------------------ procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_6; ------------------ -- Initialize_7 -- ------------------ procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_7; ------------------ -- Initialize_8 -- ------------------ procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_8; ------------------ -- Initialize_9 -- ------------------ procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_9; ------------------- -- Initialize_10 -- ------------------- procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_10; ------------------- -- Initialize_11 -- ------------------- procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_11; ------------------- -- Initialize_12 -- ------------------- procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_12; ------------------- -- Initialize_13 -- ------------------- procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_13; ------------------- -- Initialize_14 -- ------------------- procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_14; ------------------- -- Initialize_15 -- ------------------- procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_15; ------------------- -- Initialize_16 -- ------------------- procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_16; ------------------- -- Initialize_17 -- ------------------- procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_17; ------------------- -- Initialize_18 -- ------------------- procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_18; ------------------- -- Initialize_19 -- ------------------- procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_19; ------------------- -- Initialize_20 -- ------------------- procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_20; ------------------- -- Initialize_21 -- ------------------- procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_21; ------------------- -- Initialize_22 -- ------------------- procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_22; ------------------- -- Initialize_23 -- ------------------- procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_23; ------------------- -- Initialize_24 -- ------------------- procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_24; ------------------- -- Initialize_25 -- ------------------- procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_25; ------------------- -- Initialize_26 -- ------------------- procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_26; ------------------- -- Initialize_27 -- ------------------- procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_27; ------------------- -- Initialize_28 -- ------------------- procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_28; ------------------- -- Initialize_29 -- ------------------- procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_29; ------------------- -- Initialize_30 -- ------------------- procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_30; ------------------- -- Initialize_31 -- ------------------- procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_31; ------------------- -- Initialize_32 -- ------------------- procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_32; ------------------- -- Initialize_33 -- ------------------- procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_33; ------------------- -- Initialize_34 -- ------------------- procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_34; ------------------- -- Initialize_35 -- ------------------- procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_35; ------------------- -- Initialize_36 -- ------------------- procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_36; ------------------- -- Initialize_37 -- ------------------- procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_37; ------------------- -- Initialize_38 -- ------------------- procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_38; ------------------- -- Initialize_39 -- ------------------- procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_39; ------------------- -- Initialize_40 -- ------------------- procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_40; ------------------- -- Initialize_41 -- ------------------- procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_41; ------------------- -- Initialize_42 -- ------------------- procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_42; ------------------- -- Initialize_43 -- ------------------- procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_43; ------------------- -- Initialize_44 -- ------------------- procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_44; ------------------- -- Initialize_45 -- ------------------- procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_45; ------------------- -- Initialize_46 -- ------------------- procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_46; ------------------- -- Initialize_47 -- ------------------- procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_47; ------------------- -- Initialize_48 -- ------------------- procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_48; ------------------- -- Initialize_49 -- ------------------- procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_49; ------------------- -- Initialize_50 -- ------------------- procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_50; ------------------- -- Initialize_51 -- ------------------- procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_51; ------------------- -- Initialize_52 -- ------------------- procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_52; ------------------- -- Initialize_53 -- ------------------- procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_53; ------------------- -- Initialize_54 -- ------------------- procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_54; ------------------- -- Initialize_55 -- ------------------- procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_55; ------------------- -- Initialize_56 -- ------------------- procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_56; ------------------- -- Initialize_57 -- ------------------- procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_57; ------------------- -- Initialize_58 -- ------------------- procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_58; ------------------- -- Initialize_59 -- ------------------- procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_59; ------------------- -- Initialize_60 -- ------------------- procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_60; ------------------- -- Initialize_61 -- ------------------- procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_61; ------------------- -- Initialize_62 -- ------------------- procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_62; ------------------- -- Initialize_63 -- ------------------- procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_63; ------------------- -- Initialize_64 -- ------------------- procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_64; ------------------- -- Initialize_65 -- ------------------- procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_65; ------------------- -- Initialize_66 -- ------------------- procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_66; ------------------- -- Initialize_67 -- ------------------- procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_67; ------------------- -- Initialize_68 -- ------------------- procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_68; ------------------- -- Initialize_69 -- ------------------- procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_69; ------------------- -- Initialize_70 -- ------------------- procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_70; ------------------- -- Initialize_71 -- ------------------- procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_71; ------------------- -- Initialize_72 -- ------------------- procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_72; ------------------- -- Initialize_73 -- ------------------- procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_73; ------------------- -- Initialize_74 -- ------------------- procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_74; ------------------- -- Initialize_75 -- ------------------- procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_75; ------------------- -- Initialize_76 -- ------------------- procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_76; ------------------- -- Initialize_77 -- ------------------- procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_77; ------------------- -- Initialize_78 -- ------------------- procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_78; ------------------- -- Initialize_79 -- ------------------- procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_79; ------------------- -- Initialize_80 -- ------------------- procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_80; ------------------- -- Initialize_81 -- ------------------- procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_81; ------------------- -- Initialize_82 -- ------------------- procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_82; ------------------- -- Initialize_83 -- ------------------- procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_83; ------------------- -- Initialize_84 -- ------------------- procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_84; ------------------- -- Initialize_85 -- ------------------- procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_85; ------------------- -- Initialize_86 -- ------------------- procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_86; ------------------- -- Initialize_87 -- ------------------- procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_87; ------------------- -- Initialize_88 -- ------------------- procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_88; ------------------- -- Initialize_89 -- ------------------- procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_89; ------------------- -- Initialize_90 -- ------------------- procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_90; ------------------- -- Initialize_91 -- ------------------- procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_91; ------------------- -- Initialize_92 -- ------------------- procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_92; ------------------- -- Initialize_93 -- ------------------- procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_93; ------------------- -- Initialize_94 -- ------------------- procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_94; ------------------- -- Initialize_95 -- ------------------- procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_95; ------------------- -- Initialize_96 -- ------------------- procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_96; ------------------- -- Initialize_97 -- ------------------- procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_97; ------------------- -- Initialize_98 -- ------------------- procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_98; ------------------- -- Initialize_99 -- ------------------- procedure Initialize_99 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_99; -------------------- -- Initialize_100 -- -------------------- procedure Initialize_100 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package_Import; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_100; -------------------- -- Initialize_101 -- -------------------- procedure Initialize_101 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_101; -------------------- -- Initialize_102 -- -------------------- procedure Initialize_102 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_102; -------------------- -- Initialize_103 -- -------------------- procedure Initialize_103 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_103; -------------------- -- Initialize_104 -- -------------------- procedure Initialize_104 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_104; -------------------- -- Initialize_105 -- -------------------- procedure Initialize_105 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_105; -------------------- -- Initialize_106 -- -------------------- procedure Initialize_106 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_106; -------------------- -- Initialize_107 -- -------------------- procedure Initialize_107 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_107; -------------------- -- Initialize_108 -- -------------------- procedure Initialize_108 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_108; -------------------- -- Initialize_109 -- -------------------- procedure Initialize_109 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_109; -------------------- -- Initialize_110 -- -------------------- procedure Initialize_110 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_110; -------------------- -- Initialize_111 -- -------------------- procedure Initialize_111 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_111; -------------------- -- Initialize_112 -- -------------------- procedure Initialize_112 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_112; -------------------- -- Initialize_113 -- -------------------- procedure Initialize_113 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_113; -------------------- -- Initialize_114 -- -------------------- procedure Initialize_114 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_114; -------------------- -- Initialize_115 -- -------------------- procedure Initialize_115 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_115; -------------------- -- Initialize_116 -- -------------------- procedure Initialize_116 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_116; -------------------- -- Initialize_117 -- -------------------- procedure Initialize_117 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_117; -------------------- -- Initialize_118 -- -------------------- procedure Initialize_118 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_118; -------------------- -- Initialize_119 -- -------------------- procedure Initialize_119 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_119; -------------------- -- Initialize_120 -- -------------------- procedure Initialize_120 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_120; -------------------- -- Initialize_121 -- -------------------- procedure Initialize_121 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_121; -------------------- -- Initialize_122 -- -------------------- procedure Initialize_122 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_122; -------------------- -- Initialize_123 -- -------------------- procedure Initialize_123 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_123; -------------------- -- Initialize_124 -- -------------------- procedure Initialize_124 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_124; -------------------- -- Initialize_125 -- -------------------- procedure Initialize_125 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_125; -------------------- -- Initialize_126 -- -------------------- procedure Initialize_126 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_126; -------------------- -- Initialize_127 -- -------------------- procedure Initialize_127 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_127; -------------------- -- Initialize_128 -- -------------------- procedure Initialize_128 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_128; -------------------- -- Initialize_129 -- -------------------- procedure Initialize_129 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_129; -------------------- -- Initialize_130 -- -------------------- procedure Initialize_130 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_130; -------------------- -- Initialize_131 -- -------------------- procedure Initialize_131 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_131; -------------------- -- Initialize_132 -- -------------------- procedure Initialize_132 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_132; -------------------- -- Initialize_133 -- -------------------- procedure Initialize_133 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_133; -------------------- -- Initialize_134 -- -------------------- procedure Initialize_134 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_134; -------------------- -- Initialize_135 -- -------------------- procedure Initialize_135 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_135; -------------------- -- Initialize_136 -- -------------------- procedure Initialize_136 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_136; -------------------- -- Initialize_137 -- -------------------- procedure Initialize_137 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_137; -------------------- -- Initialize_138 -- -------------------- procedure Initialize_138 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_138; -------------------- -- Initialize_139 -- -------------------- procedure Initialize_139 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_139; -------------------- -- Initialize_140 -- -------------------- procedure Initialize_140 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_140; -------------------- -- Initialize_141 -- -------------------- procedure Initialize_141 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_141; -------------------- -- Initialize_142 -- -------------------- procedure Initialize_142 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_142; -------------------- -- Initialize_143 -- -------------------- procedure Initialize_143 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_143; -------------------- -- Initialize_144 -- -------------------- procedure Initialize_144 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_144; -------------------- -- Initialize_145 -- -------------------- procedure Initialize_145 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_145; -------------------- -- Initialize_146 -- -------------------- procedure Initialize_146 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_146; -------------------- -- Initialize_147 -- -------------------- procedure Initialize_147 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_147; -------------------- -- Initialize_148 -- -------------------- procedure Initialize_148 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_148; -------------------- -- Initialize_149 -- -------------------- procedure Initialize_149 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_149; -------------------- -- Initialize_150 -- -------------------- procedure Initialize_150 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_150; -------------------- -- Initialize_151 -- -------------------- procedure Initialize_151 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_151; -------------------- -- Initialize_152 -- -------------------- procedure Initialize_152 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_152; -------------------- -- Initialize_153 -- -------------------- procedure Initialize_153 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_153; -------------------- -- Initialize_154 -- -------------------- procedure Initialize_154 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_154; -------------------- -- Initialize_155 -- -------------------- procedure Initialize_155 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_155; -------------------- -- Initialize_156 -- -------------------- procedure Initialize_156 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_156; -------------------- -- Initialize_157 -- -------------------- procedure Initialize_157 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_157; -------------------- -- Initialize_158 -- -------------------- procedure Initialize_158 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_158; -------------------- -- Initialize_159 -- -------------------- procedure Initialize_159 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_159; -------------------- -- Initialize_160 -- -------------------- procedure Initialize_160 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_160; -------------------- -- Initialize_161 -- -------------------- procedure Initialize_161 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_161; -------------------- -- Initialize_162 -- -------------------- procedure Initialize_162 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_162; -------------------- -- Initialize_163 -- -------------------- procedure Initialize_163 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_163; -------------------- -- Initialize_164 -- -------------------- procedure Initialize_164 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_164; -------------------- -- Initialize_165 -- -------------------- procedure Initialize_165 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_165; -------------------- -- Initialize_166 -- -------------------- procedure Initialize_166 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_166; -------------------- -- Initialize_167 -- -------------------- procedure Initialize_167 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_167; -------------------- -- Initialize_168 -- -------------------- procedure Initialize_168 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_168; -------------------- -- Initialize_169 -- -------------------- procedure Initialize_169 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_169; -------------------- -- Initialize_170 -- -------------------- procedure Initialize_170 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_170; -------------------- -- Initialize_171 -- -------------------- procedure Initialize_171 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_171; -------------------- -- Initialize_172 -- -------------------- procedure Initialize_172 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_172; -------------------- -- Initialize_173 -- -------------------- procedure Initialize_173 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_173; -------------------- -- Initialize_174 -- -------------------- procedure Initialize_174 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_174; -------------------- -- Initialize_175 -- -------------------- procedure Initialize_175 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_175; -------------------- -- Initialize_176 -- -------------------- procedure Initialize_176 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_176; -------------------- -- Initialize_177 -- -------------------- procedure Initialize_177 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_177; -------------------- -- Initialize_178 -- -------------------- procedure Initialize_178 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_178; -------------------- -- Initialize_179 -- -------------------- procedure Initialize_179 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_179; -------------------- -- Initialize_180 -- -------------------- procedure Initialize_180 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_180; -------------------- -- Initialize_181 -- -------------------- procedure Initialize_181 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_181; -------------------- -- Initialize_182 -- -------------------- procedure Initialize_182 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_182; -------------------- -- Initialize_183 -- -------------------- procedure Initialize_183 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_183; -------------------- -- Initialize_184 -- -------------------- procedure Initialize_184 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_184; -------------------- -- Initialize_185 -- -------------------- procedure Initialize_185 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_185; -------------------- -- Initialize_186 -- -------------------- procedure Initialize_186 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_186; -------------------- -- Initialize_187 -- -------------------- procedure Initialize_187 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_187; -------------------- -- Initialize_188 -- -------------------- procedure Initialize_188 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_188; -------------------- -- Initialize_189 -- -------------------- procedure Initialize_189 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_189; -------------------- -- Initialize_190 -- -------------------- procedure Initialize_190 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_190; -------------------- -- Initialize_191 -- -------------------- procedure Initialize_191 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_191; -------------------- -- Initialize_192 -- -------------------- procedure Initialize_192 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_192; -------------------- -- Initialize_193 -- -------------------- procedure Initialize_193 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_193; -------------------- -- Initialize_194 -- -------------------- procedure Initialize_194 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_194; -------------------- -- Initialize_195 -- -------------------- procedure Initialize_195 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_195; -------------------- -- Initialize_196 -- -------------------- procedure Initialize_196 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_196; -------------------- -- Initialize_197 -- -------------------- procedure Initialize_197 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_197; -------------------- -- Initialize_198 -- -------------------- procedure Initialize_198 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_198; -------------------- -- Initialize_199 -- -------------------- procedure Initialize_199 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_199; -------------------- -- Initialize_200 -- -------------------- procedure Initialize_200 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_200; -------------------- -- Initialize_201 -- -------------------- procedure Initialize_201 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_201; -------------------- -- Initialize_202 -- -------------------- procedure Initialize_202 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_202; -------------------- -- Initialize_203 -- -------------------- procedure Initialize_203 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_203; -------------------- -- Initialize_204 -- -------------------- procedure Initialize_204 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_204; -------------------- -- Initialize_205 -- -------------------- procedure Initialize_205 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_205; -------------------- -- Initialize_206 -- -------------------- procedure Initialize_206 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_206; -------------------- -- Initialize_207 -- -------------------- procedure Initialize_207 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_207; -------------------- -- Initialize_208 -- -------------------- procedure Initialize_208 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_208; -------------------- -- Initialize_209 -- -------------------- procedure Initialize_209 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_209; -------------------- -- Initialize_210 -- -------------------- procedure Initialize_210 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_210; -------------------- -- Initialize_211 -- -------------------- procedure Initialize_211 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_211; -------------------- -- Initialize_212 -- -------------------- procedure Initialize_212 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_212; -------------------- -- Initialize_213 -- -------------------- procedure Initialize_213 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_213; -------------------- -- Initialize_214 -- -------------------- procedure Initialize_214 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_214; -------------------- -- Initialize_215 -- -------------------- procedure Initialize_215 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_215; -------------------- -- Initialize_216 -- -------------------- procedure Initialize_216 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_216; -------------------- -- Initialize_217 -- -------------------- procedure Initialize_217 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_217; -------------------- -- Initialize_218 -- -------------------- procedure Initialize_218 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_218; -------------------- -- Initialize_219 -- -------------------- procedure Initialize_219 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_219; -------------------- -- Initialize_220 -- -------------------- procedure Initialize_220 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_220; -------------------- -- Initialize_221 -- -------------------- procedure Initialize_221 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_221; -------------------- -- Initialize_222 -- -------------------- procedure Initialize_222 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_222; -------------------- -- Initialize_223 -- -------------------- procedure Initialize_223 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_223; -------------------- -- Initialize_224 -- -------------------- procedure Initialize_224 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_224; -------------------- -- Initialize_225 -- -------------------- procedure Initialize_225 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_225; -------------------- -- Initialize_226 -- -------------------- procedure Initialize_226 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_226; -------------------- -- Initialize_227 -- -------------------- procedure Initialize_227 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_227; -------------------- -- Initialize_228 -- -------------------- procedure Initialize_228 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_228; -------------------- -- Initialize_229 -- -------------------- procedure Initialize_229 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_229; -------------------- -- Initialize_230 -- -------------------- procedure Initialize_230 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_230; -------------------- -- Initialize_231 -- -------------------- procedure Initialize_231 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_231; -------------------- -- Initialize_232 -- -------------------- procedure Initialize_232 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_232; -------------------- -- Initialize_233 -- -------------------- procedure Initialize_233 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_233; -------------------- -- Initialize_234 -- -------------------- procedure Initialize_234 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_234; -------------------- -- Initialize_235 -- -------------------- procedure Initialize_235 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_235; -------------------- -- Initialize_236 -- -------------------- procedure Initialize_236 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_236; -------------------- -- Initialize_237 -- -------------------- procedure Initialize_237 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_237; -------------------- -- Initialize_238 -- -------------------- procedure Initialize_238 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_238; -------------------- -- Initialize_239 -- -------------------- procedure Initialize_239 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_239; -------------------- -- Initialize_240 -- -------------------- procedure Initialize_240 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_240; -------------------- -- Initialize_241 -- -------------------- procedure Initialize_241 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_241; -------------------- -- Initialize_242 -- -------------------- procedure Initialize_242 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_242; -------------------- -- Initialize_243 -- -------------------- procedure Initialize_243 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_243; -------------------- -- Initialize_244 -- -------------------- procedure Initialize_244 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_244; -------------------- -- Initialize_245 -- -------------------- procedure Initialize_245 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_245; -------------------- -- Initialize_246 -- -------------------- procedure Initialize_246 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_246; -------------------- -- Initialize_247 -- -------------------- procedure Initialize_247 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_247; -------------------- -- Initialize_248 -- -------------------- procedure Initialize_248 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_248; -------------------- -- Initialize_249 -- -------------------- procedure Initialize_249 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_249; -------------------- -- Initialize_250 -- -------------------- procedure Initialize_250 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_250; -------------------- -- Initialize_251 -- -------------------- procedure Initialize_251 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_251; -------------------- -- Initialize_252 -- -------------------- procedure Initialize_252 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_252; -------------------- -- Initialize_253 -- -------------------- procedure Initialize_253 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_253; -------------------- -- Initialize_254 -- -------------------- procedure Initialize_254 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_254; -------------------- -- Initialize_255 -- -------------------- procedure Initialize_255 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_255; -------------------- -- Initialize_256 -- -------------------- procedure Initialize_256 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_256; -------------------- -- Initialize_257 -- -------------------- procedure Initialize_257 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_257; -------------------- -- Initialize_258 -- -------------------- procedure Initialize_258 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_258; -------------------- -- Initialize_259 -- -------------------- procedure Initialize_259 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_259; -------------------- -- Initialize_260 -- -------------------- procedure Initialize_260 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_260; -------------------- -- Initialize_261 -- -------------------- procedure Initialize_261 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_261; -------------------- -- Initialize_262 -- -------------------- procedure Initialize_262 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_262; -------------------- -- Initialize_263 -- -------------------- procedure Initialize_263 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_263; -------------------- -- Initialize_264 -- -------------------- procedure Initialize_264 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_264; -------------------- -- Initialize_265 -- -------------------- procedure Initialize_265 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_265; -------------------- -- Initialize_266 -- -------------------- procedure Initialize_266 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_266; -------------------- -- Initialize_267 -- -------------------- procedure Initialize_267 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_267; -------------------- -- Initialize_268 -- -------------------- procedure Initialize_268 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_268; -------------------- -- Initialize_269 -- -------------------- procedure Initialize_269 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_269; -------------------- -- Initialize_270 -- -------------------- procedure Initialize_270 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_270; -------------------- -- Initialize_271 -- -------------------- procedure Initialize_271 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_271; -------------------- -- Initialize_272 -- -------------------- procedure Initialize_272 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_272; -------------------- -- Initialize_273 -- -------------------- procedure Initialize_273 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_273; -------------------- -- Initialize_274 -- -------------------- procedure Initialize_274 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_274; -------------------- -- Initialize_275 -- -------------------- procedure Initialize_275 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_275; -------------------- -- Initialize_276 -- -------------------- procedure Initialize_276 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_276; -------------------- -- Initialize_277 -- -------------------- procedure Initialize_277 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_277; -------------------- -- Initialize_278 -- -------------------- procedure Initialize_278 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_278; -------------------- -- Initialize_279 -- -------------------- procedure Initialize_279 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_279; -------------------- -- Initialize_280 -- -------------------- procedure Initialize_280 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_280; -------------------- -- Initialize_281 -- -------------------- procedure Initialize_281 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_281; -------------------- -- Initialize_282 -- -------------------- procedure Initialize_282 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_282; -------------------- -- Initialize_283 -- -------------------- procedure Initialize_283 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_283; -------------------- -- Initialize_284 -- -------------------- procedure Initialize_284 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_284; -------------------- -- Initialize_285 -- -------------------- procedure Initialize_285 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_285; -------------------- -- Initialize_286 -- -------------------- procedure Initialize_286 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_286; -------------------- -- Initialize_287 -- -------------------- procedure Initialize_287 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_287; -------------------- -- Initialize_288 -- -------------------- procedure Initialize_288 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_288; -------------------- -- Initialize_289 -- -------------------- procedure Initialize_289 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_289; -------------------- -- Initialize_290 -- -------------------- procedure Initialize_290 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_290; -------------------- -- Initialize_291 -- -------------------- procedure Initialize_291 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_291; -------------------- -- Initialize_292 -- -------------------- procedure Initialize_292 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_292; -------------------- -- Initialize_293 -- -------------------- procedure Initialize_293 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_293; -------------------- -- Initialize_294 -- -------------------- procedure Initialize_294 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_294; -------------------- -- Initialize_295 -- -------------------- procedure Initialize_295 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_295; -------------------- -- Initialize_296 -- -------------------- procedure Initialize_296 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_296; -------------------- -- Initialize_297 -- -------------------- procedure Initialize_297 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_297; -------------------- -- Initialize_298 -- -------------------- procedure Initialize_298 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_298; -------------------- -- Initialize_299 -- -------------------- procedure Initialize_299 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_299; -------------------- -- Initialize_300 -- -------------------- procedure Initialize_300 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_300; -------------------- -- Initialize_301 -- -------------------- procedure Initialize_301 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_301; -------------------- -- Initialize_302 -- -------------------- procedure Initialize_302 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_302; -------------------- -- Initialize_303 -- -------------------- procedure Initialize_303 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_303; -------------------- -- Initialize_304 -- -------------------- procedure Initialize_304 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_304; -------------------- -- Initialize_305 -- -------------------- procedure Initialize_305 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_305; -------------------- -- Initialize_306 -- -------------------- procedure Initialize_306 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_306; -------------------- -- Initialize_307 -- -------------------- procedure Initialize_307 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_307; -------------------- -- Initialize_308 -- -------------------- procedure Initialize_308 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_308; -------------------- -- Initialize_309 -- -------------------- procedure Initialize_309 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_309; -------------------- -- Initialize_310 -- -------------------- procedure Initialize_310 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_310; -------------------- -- Initialize_311 -- -------------------- procedure Initialize_311 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_311; -------------------- -- Initialize_312 -- -------------------- procedure Initialize_312 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_312; -------------------- -- Initialize_313 -- -------------------- procedure Initialize_313 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_313; -------------------- -- Initialize_314 -- -------------------- procedure Initialize_314 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_314; -------------------- -- Initialize_315 -- -------------------- procedure Initialize_315 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_315; -------------------- -- Initialize_316 -- -------------------- procedure Initialize_316 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_316; -------------------- -- Initialize_317 -- -------------------- procedure Initialize_317 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_317; -------------------- -- Initialize_318 -- -------------------- procedure Initialize_318 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_318; -------------------- -- Initialize_319 -- -------------------- procedure Initialize_319 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_319; -------------------- -- Initialize_320 -- -------------------- procedure Initialize_320 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_320; -------------------- -- Initialize_321 -- -------------------- procedure Initialize_321 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_321; -------------------- -- Initialize_322 -- -------------------- procedure Initialize_322 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_322; end AMF.Internals.Tables.DG_Metamodel.Objects;
-- with -- Ada.Assertions, -- -- Ada.Asynchronous_Task_Control, -- Ada.Calendar.Arithmetic, -- Ada.Calendar.Formatting, -- Ada.Calendar.Time_Zones, -- Ada.Characters.Conversions, -- Ada.Characters.Handling, -- Ada.Characters.Latin_1, -- Ada.Command_Line, -- Ada.Complex_Text_IO, -- Ada.Containers, -- Ada.Containers.Doubly_Linked_Lists, -- Ada.Containers.Generic_Array_Sort, -- Ada.Containers.Generic_Constrained_Array_Sort, -- Ada.Containers.Hashed_Maps, -- Ada.Containers.Hashed_Sets, -- Ada.Containers.Indefinite_Doubly_Linked_Lists, -- Ada.Containers.Indefinite_Hashed_Maps, -- Ada.Containers.Indefinite_Hashed_Sets, -- Ada.Containers.Indefinite_Ordered_Maps, -- Ada.Containers.Indefinite_Ordered_Sets, -- Ada.Containers.Indefinite_Vectors, -- Ada.Containers.Ordered_Maps, -- Ada.Containers.Ordered_Sets, -- Ada.Containers.Vectors, -- Ada.Decimal, -- Ada.Direct_IO, -- Ada.Directories, -- -- Ada.Directories.Information, -- Ada.Dispatching, -- -- Ada.Dispatching.EDF, -- -- Ada.Dispatching.Round_Robin, -- Ada.Dynamic_Priorities, -- Ada.Environment_Variables, -- Ada.Exceptions, -- Ada.Execution_Time, -- -- Ada.Execution_Time.Timers, -- -- Ada.Execution_Time.Group_Budgets, -- Ada.Finalization, -- Ada.Float_Text_IO, -- Ada.Float_Wide_Text_IO, -- -- Ada.Float_Wide_Wide_Text_IO, -- Ada.Integer_Text_IO, -- Ada.Integer_Wide_Text_IO, -- Ada.Integer_Wide_Wide_Text_IO, -- Ada.Interrupts, -- Ada.Interrupts.Names, -- Ada.IO_Exceptions, -- Ada.Numerics, -- Ada.Numerics.Complex_Arrays, -- Ada.Numerics.Complex_Elementary_Functions, -- Ada.Numerics.Complex_Types, -- Ada.Numerics.Discrete_Random, -- Ada.Numerics.Elementary_Functions, -- Ada.Numerics.Float_Random, -- Ada.Numerics.Generic_Complex_Arrays, -- Ada.Numerics.Generic_Complex_Elementary_Functions, -- Ada.Numerics.Generic_Complex_Types, -- Ada.Numerics.Generic_Elementary_Functions, -- Ada.Numerics.Generic_Real_Arrays, -- Ada.Numerics.Real_Arrays, -- Ada.Real_Time, -- Ada.Real_Time.Timing_Events, -- Ada.Sequential_IO, -- Ada.Storage_IO, -- Ada.Streams, -- Ada.Streams.Stream_IO, -- Ada.Strings, -- Ada.Strings.Bounded, -- Ada.Strings.Bounded.Hash, -- Ada.Strings.Fixed, -- Ada.Strings.Fixed.Hash, -- Ada.Strings.Hash, -- Ada.Strings.Maps, -- Ada.Strings.Maps.Constants, -- Ada.Strings.Unbounded, -- Ada.Strings.Unbounded.Hash, -- Ada.Strings.Wide_Bounded, -- Ada.Strings.Wide_Bounded.Wide_Hash, -- Ada.Strings.Wide_Fixed, -- Ada.Strings.Wide_Fixed.Wide_Hash, -- Ada.Strings.Wide_Hash, -- Ada.Strings.Wide_Maps, -- Ada.Strings.Wide_Maps.Wide_Constants, -- Ada.Strings.Wide_Unbounded, -- Ada.Strings.Wide_Unbounded.Wide_Hash, -- Ada.Strings.Wide_Wide_Bounded, -- Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash, -- Ada.Strings.Wide_Wide_Fixed, -- Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash, -- Ada.Strings.Wide_Wide_Hash, -- Ada.Strings.Wide_Wide_Maps, -- Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants, -- Ada.Strings.Wide_Wide_Unbounded, -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash, -- Ada.Synchronous_Task_Control, -- Ada.Tags, -- Ada.Tags.Generic_Dispatching_Constructor, -- Ada.Task_Attributes, -- Ada.Task_Identification, -- Ada.Task_Termination, -- Ada.Text_IO; -- Ada.Text_IO.Bounded_IO, -- Ada.Text_IO.Complex_IO, -- Ada.Text_IO.Editing, -- Ada.Text_IO.Text_Streams, -- Ada.Text_IO.Unbounded_IO, -- Ada.Unchecked_Conversion, -- Ada.Unchecked_Deallocation, -- Ada.Wide_Characters, -- Ada.Wide_Text_IO, -- -- Ada.Wide_Text_IO.Bounded_IO, -- Ada.Wide_Text_IO.Complex_IO, -- Ada.Wide_Text_IO.Editing, -- Ada.Wide_Text_IO.Text_Streams, -- -- Ada.Wide_Text_IO.Unbounded_IO, -- Ada.Wide_Wide_Characters, -- Ada.Wide_Wide_Text_IO, -- -- Ada.Wide_Wide_Text_IO.Bounded_IO, -- Ada.Wide_Wide_Text_IO.Complex_IO, -- Ada.Wide_Wide_Text_IO.Editing, -- Ada.Wide_Wide_Text_IO.Text_Streams; -- -- Ada.Wide_Wide_Text_IO.Unbounded_IO; procedure all_standard_Ada is begin null; end all_standard_Ada;
with openGL.Renderer.lean, mmi.World, mmi.Sprite, ada.Containers.Vectors, ada.Containers.Hashed_Sets, ada.Unchecked_Conversion; package gasp.World is type Item is limited new mmi.World.item with private; type View is access all item'Class; package Forge is function new_World (Name : in String; Renderer : in openGL.Renderer.lean.view) return View; end Forge; overriding procedure destroy (Self : in out Item); procedure free (Self : in out View); procedure store (Self : in out Item); procedure restore (Self : in out Item); overriding procedure evolve (Self : in out Item; By : in Duration); function Pod (Self : in Item) return mmi.Sprite.view; private use type mmi.sprite_Id; package sprite_id_Vectors is new ada.containers.Vectors (Positive, mmi.sprite_Id); function Hash is new ada.Unchecked_Conversion (mmi.sprite_Id, ada.Containers.Hash_Type); package organ_Sets is new ada.Containers.hashed_Sets (mmi.sprite_Id, Hash, "="); type Item is limited new mmi.World.item with record Counter : Natural := 0; pod_Sprite : mmi.Sprite.view; end record; end gasp.World;
pragma License (Unrestricted); package System.Storage_Elements is pragma Pure; type Storage_Offset is range -(2 ** (Standard'Address_Size - 1)) .. 2 ** (Standard'Address_Size - 1) - 1; -- implementation-defined subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last; type Storage_Element is mod 2 ** Storage_Unit; -- implementation-defined for Storage_Element'Size use Storage_Unit; type Storage_Array is array (Storage_Offset range <>) of aliased Storage_Element; for Storage_Array'Component_Size use Storage_Unit; -- Address Arithmetic: function "+" (Left : Address; Right : Storage_Offset) return Address with Convention => Intrinsic; function "+" (Left : Storage_Offset; Right : Address) return Address with Convention => Intrinsic; function "-" (Left : Address; Right : Storage_Offset) return Address with Convention => Intrinsic; function "-" (Left, Right : Address) return Storage_Offset with Convention => Intrinsic; pragma Pure_Function ("+"); pragma Pure_Function ("-"); pragma Inline_Always ("+"); pragma Inline_Always ("-"); function "mod" (Left : Address; Right : Storage_Offset) return Storage_Offset with Convention => Intrinsic; pragma Pure_Function ("mod"); pragma Inline_Always ("mod"); -- Conversion to/from integers: type Integer_Address is mod Memory_Size; -- implementation-defined function To_Address (Value : Integer_Address) return Address with Convention => Intrinsic; function To_Integer (Value : Address) return Integer_Address with Convention => Intrinsic; pragma Pure_Function (To_Address); pragma Pure_Function (To_Integer); pragma Inline_Always (To_Address); pragma Inline_Always (To_Integer); -- extended -- Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left, -- and Rotate_Right. pragma Provide_Shift_Operators (Storage_Element); pragma Provide_Shift_Operators (Integer_Address); end System.Storage_Elements;
with System, System.Storage_Elements; use System.Storage_Elements; package body Allocator_Maxalign2 is Max_Align : constant Storage_Offset := Standard'Maximum_Alignment; procedure Validate is use type System.Address; begin if Addr mod Max_Align /= 0 then raise Program_Error; end if; end; procedure Check is I : Integer; B : Block; type Block_Access is access all Block; A : Block_Access; begin Addr := I'Address; Addr := B'Address; Validate; for I in 1 .. 50 loop A := new Block; Addr := A.all'Address; Validate; end loop; end; end;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K I N G . R E N D E Z V O U S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- Note: the compiler generates direct calls to this interface, via Rtsfind. -- Any changes to this interface may require corresponding compiler changes. with Ada.Exceptions; with System.Tasking.Protected_Objects.Entries; package System.Tasking.Rendezvous is package STPE renames System.Tasking.Protected_Objects.Entries; procedure Task_Entry_Call (Acceptor : Task_Id; E : Task_Entry_Index; Uninterpreted_Data : System.Address; Mode : Call_Modes; Rendezvous_Successful : out Boolean); -- General entry call used to implement ATC or conditional entry calls. -- Compiler interface only. Do not call from within the RTS. -- Acceptor is the ID of the acceptor task. -- E is the entry index requested. -- Uninterpreted_Data represents the parameters of the entry. It is -- constructed by the compiler for the caller and the callee; therefore, -- the run time never needs to decode this data. -- Mode can be either Asynchronous_Call (ATC) or Conditional_Call. -- Rendezvous_Successful is set to True on return if the call was serviced. procedure Timed_Task_Entry_Call (Acceptor : Task_Id; E : Task_Entry_Index; Uninterpreted_Data : System.Address; Timeout : Duration; Mode : Delay_Modes; Rendezvous_Successful : out Boolean); -- Timed entry call without using ATC. -- Compiler interface only. Do not call from within the RTS. -- See Task_Entry_Call for details on Acceptor, E and Uninterpreted_Data. -- Timeout is the value of the time out. -- Mode determines whether the delay is relative or absolute. procedure Call_Simple (Acceptor : Task_Id; E : Task_Entry_Index; Uninterpreted_Data : System.Address); -- Simple entry call. -- Compiler interface only. Do not call from within the RTS. -- -- source: -- T.E1 (Params); -- -- expansion: -- declare -- P : parms := (parm1, parm2, parm3); -- X : Task_Entry_Index := 1; -- begin -- Call_Simple (t._task_id, X, P'Address); -- parm1 := P.param1; -- parm2 := P.param2; -- ... -- end; procedure Cancel_Task_Entry_Call (Cancelled : out Boolean); -- Cancel pending asynchronous task entry call. -- Compiler interface only. Do not call from within the RTS. -- See Exp_Ch9.Expand_N_Asynchronous_Select for code expansion. procedure Requeue_Task_Entry (Acceptor : Task_Id; E : Task_Entry_Index; With_Abort : Boolean); -- Requeue from a task entry to a task entry. -- Compiler interface only. Do not call from within the RTS. -- The code generation for task entry requeues is different from that for -- protected entry requeues. There is a "goto" that skips around the call -- to Complete_Rendezvous, so that Requeue_Task_Entry must also do the work -- of Complete_Rendezvous. The difference is that it does not report that -- the call's State = Done. -- -- source: -- accept e1 do -- ...A... -- requeue e2; -- ...B... -- end e1; -- -- expansion: -- A62b : address; -- L61b : label -- begin -- accept_call (1, A62b); -- ...A... -- requeue_task_entry (tTV!(t)._task_id, 2, false); -- goto L61b; -- ...B... -- complete_rendezvous; -- <<L61b>> -- exception -- when others => -- exceptional_complete_rendezvous (current_exception); -- end; procedure Requeue_Protected_To_Task_Entry (Object : STPE.Protection_Entries_Access; Acceptor : Task_Id; E : Task_Entry_Index; With_Abort : Boolean); -- Requeue from a protected entry to a task entry. -- Compiler interface only. Do not call from within the RTS. -- -- source: -- entry e2 when b is -- begin -- b := false; -- ...A... -- requeue t.e2; -- end e2; -- -- expansion: -- procedure rPT__E14b (O : address; P : address; E : -- protected_entry_index) is -- type rTVP is access rTV; -- freeze rTVP [] -- _object : rTVP := rTVP!(O); -- begin -- declare -- rR : protection renames _object._object; -- vP : integer renames _object.v; -- bP : boolean renames _object.b; -- begin -- b := false; -- ...A... -- requeue_protected_to_task_entry (rR'unchecked_access, tTV!(t). -- _task_id, 2, false); -- return; -- end; -- complete_entry_body (_object._object'unchecked_access, objectF => -- 0); -- return; -- exception -- when others => -- abort_undefer.all; -- exceptional_complete_entry_body (_object._object' -- unchecked_access, current_exception, objectF => 0); -- return; -- end rPT__E14b; procedure Selective_Wait (Open_Accepts : Accept_List_Access; Select_Mode : Select_Modes; Uninterpreted_Data : out System.Address; Index : out Select_Index); -- Implement select statement. -- Compiler interface only. Do not call from within the RTS. -- See comments on Accept_Call. -- -- source: -- select accept e1 do -- ...A... -- end e1; -- ...B... -- or accept e2; -- ...C... -- end select; -- -- expansion: -- A32b : address; -- declare -- A37b : T36b; -- A37b (1) := (null_body => false, s => 1); -- A37b (2) := (null_body => true, s => 2); -- S0 : aliased T36b := accept_list'A37b; -- J1 : select_index := 0; -- procedure e1A is -- begin -- abort_undefer.all; -- ...A... -- <<L31b>> -- complete_rendezvous; -- exception -- when all others => -- exceptional_complete_rendezvous (get_gnat_exception); -- end e1A; -- begin -- selective_wait (S0'unchecked_access, simple_mode, A32b, J1); -- case J1 is -- when 0 => -- goto L3; -- when 1 => -- e1A; -- goto L1; -- when 2 => -- goto L2; -- when others => -- goto L3; -- end case; -- <<L1>> -- ...B... -- goto L3; -- <<L2>> -- ...C... -- goto L3; -- <<L3>> -- end; procedure Timed_Selective_Wait (Open_Accepts : Accept_List_Access; Select_Mode : Select_Modes; Uninterpreted_Data : out System.Address; Timeout : Duration; Mode : Delay_Modes; Index : out Select_Index); -- Selective wait with timeout without using ATC. -- Compiler interface only. Do not call from within the RTS. procedure Accept_Call (E : Task_Entry_Index; Uninterpreted_Data : out System.Address); -- Accept an entry call. -- Compiler interface only. Do not call from within the RTS. -- -- source: -- accept E do ...A... end E; -- expansion: -- A27b : address; -- L26b : label -- begin -- accept_call (1, A27b); -- ...A... -- complete_rendezvous; -- <<L26b>> -- exception -- when all others => -- exceptional_complete_rendezvous (get_gnat_exception); -- end; -- -- The handler for Abort_Signal (*all* others) is to handle the case when -- the acceptor is aborted between Accept_Call and the corresponding -- Complete_Rendezvous call. We need to wake up the caller in this case. -- -- See also Selective_Wait procedure Accept_Trivial (E : Task_Entry_Index); -- Accept an entry call that has no parameters and no body. -- Compiler interface only. Do not call from within the RTS. -- This should only be called when there is no accept body, or the accept -- body is empty. -- -- source: -- accept E; -- expansion: -- accept_trivial (1); -- -- The compiler is also able to recognize the following and -- translate it the same way. -- -- accept E do null; end E; function Task_Count (E : Task_Entry_Index) return Natural; -- Return number of tasks waiting on the entry E (of current task) -- Compiler interface only. Do not call from within the RTS. function Callable (T : Task_Id) return Boolean; -- Return T'Callable -- Compiler interface. Do not call from within the RTS, except for body of -- Ada.Task_Identification. type Task_Entry_Nesting_Depth is new Task_Entry_Index range 0 .. Max_Task_Entry; function Task_Entry_Caller (D : Task_Entry_Nesting_Depth) return Task_Id; -- Return E'Caller. This will only work if called from within an -- accept statement that is handling E, as required by the LRM (C.7.1(14)). -- Compiler interface only. Do not call from within the RTS. procedure Complete_Rendezvous; -- Called by acceptor to wake up caller procedure Exceptional_Complete_Rendezvous (Ex : Ada.Exceptions.Exception_Id); pragma No_Return (Exceptional_Complete_Rendezvous); -- Called by acceptor to mark the end of the current rendezvous and -- propagate an exception to the caller. -- For internal use only: function Task_Do_Or_Queue (Self_ID : Task_Id; Entry_Call : Entry_Call_Link) return Boolean; -- Call this only with abort deferred and holding no locks, except -- the global RTS lock when Single_Lock is True which must be owned. -- Returns False iff the call cannot be served or queued, as is the -- case if the caller is not callable; i.e., a False return value -- indicates that Tasking_Error should be raised. -- Either initiate the entry call, such that the accepting task is -- free to execute the rendezvous, queue the call on the acceptor's -- queue, or cancel the call. Conditional calls that cannot be -- accepted immediately are cancelled. end System.Tasking.Rendezvous;
-- { dg-do run } -- { dg-options "-O" } with Interfaces; use Interfaces; with Unchecked_Conversion; procedure Opt31 is type Unsigned_24 is new Unsigned_32 range 0 .. 2**24 - 1; subtype Time_T is Unsigned_24 range 0 .. 24 * 60 * 60 * 128 - 1; type Messages_T is array (Positive range <>) of Unsigned_8; subtype T_3Bytes is Messages_T (1 .. 3); type Rec1 is record F : Time_T; end record; for Rec1 use record F at 0 range 0 .. 23; end record; for Rec1'Size use 24; type Rec2 is record I1,I2,I3,I4 : Integer; R1 : Rec1; end record; function Conv is new Unchecked_Conversion (T_3Bytes, Rec1); procedure Decode (M : Messages_T) is My_Rec2 : Rec2; begin My_Rec2.R1 := Conv (M (1 .. 3)); if not My_Rec2.R1.F'Valid then raise Program_Error; end if; end; Message : Messages_T (1 .. 4) := (16#18#, 16#0C#, 16#0C#, 16#18#); begin Decode (Message); end;
package Array7 is package Range_Subtype is type Arr is array (Positive range <>) of Integer; type Arr_Acc is access Arr; subtype My_Range is Integer range 1 .. 25; function Get_Arr (Nbr : My_Range) return Arr_Acc; end; package Range_Type is type My_Range is range 1 .. 25; type Arr is array (My_Range range <>) of Integer; type Arr_Acc is access Arr; function Get_Arr (Nbr : My_Range) return Arr_Acc; end; end Array7;
-- { dg-do compile } with Unchecked_Conversion; package Static_Initializer3 is type Byte is range 0 .. 16#FF#; for Byte'Size use 8; type Word is range 0 .. 16#FFFF# ; for Word'Size use 16; type R is record b1 : Boolean; b2 : Boolean; end record; for R use record b1 at 0 range 0..3; b2 at 0 range 4..7; end record; for R'Size use 8; function Conv is new Unchecked_Conversion (R, Byte); C1 : constant Byte := Conv ((true, false)); C2 : constant Word := Word(C1); end Static_Initializer3;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E L I S T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- WARNING: There is a C version of this package. Any changes to this -- source file must be properly reflected in the C header a-elists.h. with Alloc; with Debug; use Debug; with Output; use Output; with Table; package body Elists is ------------------------------------- -- Implementation of Element Lists -- ------------------------------------- -- Element lists are composed of three types of entities. The element -- list header, which references the first and last elements of the -- list, the elements themselves which are singly linked and also -- reference the nodes on the list, and finally the nodes themselves. -- The following diagram shows how an element list is represented: -- +----------------------------------------------------+ -- | +------------------------------------------+ | -- | | | | -- V | V | -- +-----|--+ +-------+ +-------+ +-------+ | -- | Elmt | | 1st | | 2nd | | Last | | -- | List |--->| Elmt |--->| Elmt ---...-->| Elmt ---+ -- | Header | | | | | | | | | | -- +--------+ +---|---+ +---|---+ +---|---+ -- | | | -- V V V -- +-------+ +-------+ +-------+ -- | | | | | | -- | Node1 | | Node2 | | Node3 | -- | | | | | | -- +-------+ +-------+ +-------+ -- The list header is an entry in the Elists table. The values used for -- the type Elist_Id are subscripts into this table. The First_Elmt field -- (Lfield1) points to the first element on the list, or to No_Elmt in the -- case of an empty list. Similarly the Last_Elmt field (Lfield2) points to -- the last element on the list or to No_Elmt in the case of an empty list. -- The elements themselves are entries in the Elmts table. The Next field -- of each entry points to the next element, or to the Elist header if this -- is the last item in the list. The Node field points to the node which -- is referenced by the corresponding list entry. ------------------------- -- Element List Tables -- ------------------------- type Elist_Header is record First : Elmt_Id; Last : Elmt_Id; end record; package Elists is new Table.Table ( Table_Component_Type => Elist_Header, Table_Index_Type => Elist_Id'Base, Table_Low_Bound => First_Elist_Id, Table_Initial => Alloc.Elists_Initial, Table_Increment => Alloc.Elists_Increment, Table_Name => "Elists"); type Elmt_Item is record Node : Node_Or_Entity_Id; Next : Union_Id; end record; package Elmts is new Table.Table ( Table_Component_Type => Elmt_Item, Table_Index_Type => Elmt_Id'Base, Table_Low_Bound => First_Elmt_Id, Table_Initial => Alloc.Elmts_Initial, Table_Increment => Alloc.Elmts_Increment, Table_Name => "Elmts"); ----------------- -- Append_Elmt -- ----------------- procedure Append_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is L : constant Elmt_Id := Elists.Table (To).Last; begin Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; Elmts.Table (Elmts.Last).Next := Union_Id (To); if L = No_Elmt then Elists.Table (To).First := Elmts.Last; else Elmts.Table (L).Next := Union_Id (Elmts.Last); end if; Elists.Table (To).Last := Elmts.Last; if Debug_Flag_N then Write_Str ("Append new element Elmt_Id = "); Write_Int (Int (Elmts.Last)); Write_Str (" to list Elist_Id = "); Write_Int (Int (To)); Write_Str (" referencing Node_Or_Entity_Id = "); Write_Int (Int (N)); Write_Eol; end if; end Append_Elmt; --------------------- -- Append_New_Elmt -- --------------------- procedure Append_New_Elmt (N : Node_Or_Entity_Id; To : in out Elist_Id) is begin if To = No_Elist then To := New_Elmt_List; end if; Append_Elmt (N, To); end Append_New_Elmt; ------------------------ -- Append_Unique_Elmt -- ------------------------ procedure Append_Unique_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is Elmt : Elmt_Id; begin Elmt := First_Elmt (To); loop if No (Elmt) then Append_Elmt (N, To); return; elsif Node (Elmt) = N then return; else Next_Elmt (Elmt); end if; end loop; end Append_Unique_Elmt; -------------- -- Contains -- -------------- function Contains (List : Elist_Id; N : Node_Or_Entity_Id) return Boolean is Elmt : Elmt_Id; begin if Present (List) then Elmt := First_Elmt (List); while Present (Elmt) loop if Node (Elmt) = N then return True; end if; Next_Elmt (Elmt); end loop; end if; return False; end Contains; -------------------- -- Elists_Address -- -------------------- function Elists_Address return System.Address is begin return Elists.Table (First_Elist_Id)'Address; end Elists_Address; ------------------- -- Elmts_Address -- ------------------- function Elmts_Address return System.Address is begin return Elmts.Table (First_Elmt_Id)'Address; end Elmts_Address; ---------------- -- First_Elmt -- ---------------- function First_Elmt (List : Elist_Id) return Elmt_Id is begin pragma Assert (List > Elist_Low_Bound); return Elists.Table (List).First; end First_Elmt; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Elists.Init; Elmts.Init; end Initialize; ----------------------- -- Insert_Elmt_After -- ----------------------- procedure Insert_Elmt_After (N : Node_Or_Entity_Id; Elmt : Elmt_Id) is Nxt : constant Union_Id := Elmts.Table (Elmt).Next; begin pragma Assert (Elmt /= No_Elmt); Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; Elmts.Table (Elmts.Last).Next := Nxt; Elmts.Table (Elmt).Next := Union_Id (Elmts.Last); if Nxt in Elist_Range then Elists.Table (Elist_Id (Nxt)).Last := Elmts.Last; end if; end Insert_Elmt_After; ------------------------ -- Is_Empty_Elmt_List -- ------------------------ function Is_Empty_Elmt_List (List : Elist_Id) return Boolean is begin return Elists.Table (List).First = No_Elmt; end Is_Empty_Elmt_List; ------------------- -- Last_Elist_Id -- ------------------- function Last_Elist_Id return Elist_Id is begin return Elists.Last; end Last_Elist_Id; --------------- -- Last_Elmt -- --------------- function Last_Elmt (List : Elist_Id) return Elmt_Id is begin return Elists.Table (List).Last; end Last_Elmt; ------------------ -- Last_Elmt_Id -- ------------------ function Last_Elmt_Id return Elmt_Id is begin return Elmts.Last; end Last_Elmt_Id; ----------------- -- List_Length -- ----------------- function List_Length (List : Elist_Id) return Nat is Elmt : Elmt_Id; N : Nat; begin if List = No_Elist then return 0; else N := 0; Elmt := First_Elmt (List); loop if No (Elmt) then return N; else N := N + 1; Next_Elmt (Elmt); end if; end loop; end if; end List_Length; ---------- -- Lock -- ---------- procedure Lock is begin Elists.Locked := True; Elmts.Locked := True; Elists.Release; Elmts.Release; end Lock; -------------------- -- New_Copy_Elist -- -------------------- function New_Copy_Elist (List : Elist_Id) return Elist_Id is Result : Elist_Id; Elmt : Elmt_Id; begin if List = No_Elist then return No_Elist; -- Replicate the contents of the input list while preserving the -- original order. else Result := New_Elmt_List; Elmt := First_Elmt (List); while Present (Elmt) loop Append_Elmt (Node (Elmt), Result); Next_Elmt (Elmt); end loop; return Result; end if; end New_Copy_Elist; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List return Elist_Id is begin Elists.Increment_Last; Elists.Table (Elists.Last).First := No_Elmt; Elists.Table (Elists.Last).Last := No_Elmt; if Debug_Flag_N then Write_Str ("Allocate new element list, returned ID = "); Write_Int (Int (Elists.Last)); Write_Eol; end if; return Elists.Last; end New_Elmt_List; --------------- -- Next_Elmt -- --------------- function Next_Elmt (Elmt : Elmt_Id) return Elmt_Id is N : constant Union_Id := Elmts.Table (Elmt).Next; begin if N in Elist_Range then return No_Elmt; else return Elmt_Id (N); end if; end Next_Elmt; procedure Next_Elmt (Elmt : in out Elmt_Id) is begin Elmt := Next_Elmt (Elmt); end Next_Elmt; -------- -- No -- -------- function No (List : Elist_Id) return Boolean is begin return List = No_Elist; end No; function No (Elmt : Elmt_Id) return Boolean is begin return Elmt = No_Elmt; end No; ---------- -- Node -- ---------- function Node (Elmt : Elmt_Id) return Node_Or_Entity_Id is begin if Elmt = No_Elmt then return Empty; else return Elmts.Table (Elmt).Node; end if; end Node; ---------------- -- Num_Elists -- ---------------- function Num_Elists return Nat is begin return Int (Elmts.Last) - Int (Elmts.First) + 1; end Num_Elists; ------------------ -- Prepend_Elmt -- ------------------ procedure Prepend_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is F : constant Elmt_Id := Elists.Table (To).First; begin Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; if F = No_Elmt then Elists.Table (To).Last := Elmts.Last; Elmts.Table (Elmts.Last).Next := Union_Id (To); else Elmts.Table (Elmts.Last).Next := Union_Id (F); end if; Elists.Table (To).First := Elmts.Last; end Prepend_Elmt; ------------- -- Present -- ------------- function Present (List : Elist_Id) return Boolean is begin return List /= No_Elist; end Present; function Present (Elmt : Elmt_Id) return Boolean is begin return Elmt /= No_Elmt; end Present; ------------ -- Remove -- ------------ procedure Remove (List : Elist_Id; N : Node_Or_Entity_Id) is Elmt : Elmt_Id; begin if Present (List) then Elmt := First_Elmt (List); while Present (Elmt) loop if Node (Elmt) = N then Remove_Elmt (List, Elmt); exit; end if; Next_Elmt (Elmt); end loop; end if; end Remove; ----------------- -- Remove_Elmt -- ----------------- procedure Remove_Elmt (List : Elist_Id; Elmt : Elmt_Id) is Nxt : Elmt_Id; Prv : Elmt_Id; begin Nxt := Elists.Table (List).First; -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then pragma Assert (Nxt = Elmt); Elists.Table (List).First := No_Elmt; Elists.Table (List).Last := No_Elmt; -- Case of removing the first element in the list elsif Nxt = Elmt then Elists.Table (List).First := Elmt_Id (Elmts.Table (Nxt).Next); -- Case of removing second or later element in the list else loop Prv := Nxt; Nxt := Elmt_Id (Elmts.Table (Prv).Next); exit when Nxt = Elmt or else Elmts.Table (Nxt).Next in Elist_Range; end loop; pragma Assert (Nxt = Elmt); Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next; if Elmts.Table (Prv).Next in Elist_Range then Elists.Table (List).Last := Prv; end if; end if; end Remove_Elmt; ---------------------- -- Remove_Last_Elmt -- ---------------------- procedure Remove_Last_Elmt (List : Elist_Id) is Nxt : Elmt_Id; Prv : Elmt_Id; begin Nxt := Elists.Table (List).First; -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then Elists.Table (List).First := No_Elmt; Elists.Table (List).Last := No_Elmt; -- Case of at least two elements in list else loop Prv := Nxt; Nxt := Elmt_Id (Elmts.Table (Prv).Next); exit when Elmts.Table (Nxt).Next in Elist_Range; end loop; Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next; Elists.Table (List).Last := Prv; end if; end Remove_Last_Elmt; ------------------ -- Replace_Elmt -- ------------------ procedure Replace_Elmt (Elmt : Elmt_Id; New_Node : Node_Or_Entity_Id) is begin Elmts.Table (Elmt).Node := New_Node; end Replace_Elmt; --------------- -- Tree_Read -- --------------- procedure Tree_Read is begin Elists.Tree_Read; Elmts.Tree_Read; end Tree_Read; ---------------- -- Tree_Write -- ---------------- procedure Tree_Write is begin Elists.Tree_Write; Elmts.Tree_Write; end Tree_Write; ------------ -- Unlock -- ------------ procedure Unlock is begin Elists.Locked := False; Elmts.Locked := False; end Unlock; end Elists;
package Week_String_Literal is Mon : constant String := "Monday"; end Week_String_Literal;
pragma License (Unrestricted); -- implementation unit package System.Formatting.Literals is pragma Pure; -- parsing Ada-form literals procedure Skip_Spaces (Item : String; Last : in out Natural); procedure Check_Last (Item : String; Last : Natural; Error : out Boolean); procedure Get_Exponent ( Item : String; Last : in out Natural; Result : out Integer; Positive_Only : Boolean; Error : out Boolean); -- for integer types procedure Get_Literal ( Item : String; Last : out Natural; Result : out Long_Long_Integer_Types.Word_Integer; Error : out Boolean); procedure Get_Literal ( Item : String; Last : out Natural; Result : out Long_Long_Integer; Error : out Boolean); -- for modular types procedure Get_Literal ( Item : String; Last : out Natural; Result : out Long_Long_Integer_Types.Word_Unsigned; Error : out Boolean); procedure Get_Literal ( Item : String; Last : out Natural; Result : out Long_Long_Integer_Types.Long_Long_Unsigned; Error : out Boolean); end System.Formatting.Literals;
function Continued_Fraction_Ada95 (Steps : in Natural) return Scalar is function A (N : in Natural) return Scalar is begin return Scalar (Natural'(A (N))); end A; function B (N : in Positive) return Scalar is begin return Scalar (Natural'(B (N))); end B; Fraction : Scalar := 0.0; begin for N in reverse Natural range 1 .. Steps loop Fraction := B (N) / (A (N) + Fraction); end loop; return A (0) + Fraction; end Continued_Fraction_Ada95;
with COBS; package body Test_Utils.Abstract_Decoder.COBS_Simple is ------------- -- Receive -- ------------- overriding procedure Receive (This : in out Instance; Data : Storage_Element) is begin if Data /= 0 then This.Input.Append (Data); else -- We reached the end of a frame so, decode and save the result declare Input : Storage_Array_Access := To_Array_Access (This.Input); Output : Storage_Array (1 .. COBS.Max_Encoding_Length (Input'Length)); Success : Boolean; Last : Storage_Offset; begin if This.In_Place then COBS.Decode_In_Place (Input.all, Last, Success); else COBS.Decode (Input.all, Output, Last, Success); end if; if not Success then raise Program_Error; end if; if This.In_Place then for Elt of Input (Input'First .. Last) loop This.Push_To_Frame (Elt); end loop; else for Elt of Output (Output'First .. Last) loop This.Push_To_Frame (Elt); end loop; end if; This.Save_Frame; This.Start_New_Frame; This.Input.Clear; Free (Input); end; end if; end Receive; ------------ -- Update -- ------------ overriding procedure Update (This : in out Instance) is begin null; end Update; ----------------- -- End_Of_Test -- ----------------- overriding procedure End_Of_Test (This : in out Instance) is begin null; end End_Of_Test; end Test_Utils.Abstract_Decoder.COBS_Simple;
------------------------------------------------------------------------------ -- -- -- Giza -- -- -- -- Copyright (C) 2016 Fabien Chouteau (chouteau@adacore.com) -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Giza.Colors; use Giza.Colors; with Giza.Types; use Giza.Types; with Giza.Font; use Giza.Font; with Giza.Backend; use Giza.Backend; with Giza.Image; with Giza.Bitmaps; use Giza.Bitmaps; with Giza.Bitmaps.Indexed_1bit; with Giza.Bitmaps.Indexed_2bits; with Giza.Bitmaps.Indexed_4bits; with Giza.Bitmaps.Indexed_8bits; package Giza.Context is type Instance is tagged private; subtype Class is Instance'Class; type Ref is access all Class; procedure Save (This : in out Instance); procedure Restore (This : in out Instance); procedure Reset (This : in out Instance); procedure Set_Color (This : in out Instance; C : Color); procedure Set_Pixel (This : in out Instance; Pt : Point_T); procedure Set_Bounds (This : in out Instance; Bounds : Rect_T); function Bounds (This : Instance) return Rect_T; procedure Set_Position (This : in out Instance; Pt : Point_T); function Position (This : Instance) return Point_T; procedure Set_Backend (This : in out Instance; Bck : Backend.Ref); -- Drawing procedure Translate (This : in out Instance; Pt : Point_T); procedure Set_Line_Width (This : in out Instance; Width : Positive); function Line_Width (This : Instance) return Positive; procedure Move_To (This : in out Instance; Pt : Point_T); procedure Line_To (This : in out Instance; Pt : Point_T); procedure Line (This : in out Instance; Start, Stop : Point_T); procedure Rectangle (This : in out Instance; Rect : Rect_T); procedure Rounded_Rectangle (This : in out Instance; Rect : Rect_T; Radius : Dim); procedure Fill_Rectangle (This : in out Instance; Rect : Rect_T); procedure Fill_Rounded_Rectangle (This : in out Instance; Rect : Rect_T; Radius : Dim); procedure Cubic_Bezier (This : in out Instance; P1, P2, P3, P4 : Point_T; N : Positive := 20); procedure Circle (This : in out Instance; Center : Point_T; Radius : Dim); procedure Fill_Circle (This : in out Instance; Center : Point_T; Radius : Dim); procedure Fill_Arc (This : in out Instance; Center : Point_T; Radius : Dim; From, To : Float); procedure Draw_Image (This : in out Instance; Img : Giza.Image.Class; Pt : Point_T); procedure Copy_Bitmap (This : in out Instance; Bmp : Bitmap; Pt : Point_T); procedure Copy_Bitmap (This : in out Instance; Bmp : Indexed_1bit.Bitmap_Indexed; Pt : Point_T); procedure Copy_Bitmap (This : in out Instance; Bmp : Indexed_2bits.Bitmap_Indexed; Pt : Point_T); procedure Copy_Bitmap (This : in out Instance; Bmp : Indexed_4bits.Bitmap_Indexed; Pt : Point_T); procedure Copy_Bitmap (This : in out Instance; Bmp : Indexed_8bits.Bitmap_Indexed; Pt : Point_T); procedure Set_Font (This : in out Instance; Font : Giza.Font.Ref_Const); function Get_Font (This : Instance) return Font.Ref_Const; procedure Print (This : in out Instance; C : Character); procedure Print (This : in out Instance; Str : String); procedure Print_In_Rect (This : in out Instance; Str : String; Box : Rect_T); procedure Box (This : Instance; Str : String; Rect : out Rect_T; Max_Width : Natural := 0); private type State; type State_Ref is access all State; type State is record Bounds : Rect_T; Pos : Point_T; Line_Width : Positive; Font : Giza.Font.Ref_Const := null; Font_Size : Float := 1.0; Font_Spacing : Dim := 1; Transform : HC_Matrix := Id; Translate_Only : Boolean := True; -- When only translations are used we can avoid four unecessary float -- multiplications for each pixel. Next : State_Ref := null; end record; type Instance is tagged record Bck : Backend.Ref := null; Current_State : State; end record; end Giza.Context;
-- This package has been generated automatically by GNATtest. -- Do not edit any part of it, see GNATtest documentation for more details. -- begin read only with Gnattest_Generated; package Crew.Test_Data.Tests is type Test is new GNATtest_Generated.GNATtest_Standard.Crew.Test_Data .Test with null record; procedure Test_GainExp_685058_5db064(Gnattest_T: in out Test); -- crew.ads:277:4:GainExp:Test_GainExp procedure Test_GenerateMemberName_b4591b_b29bd9(Gnattest_T: in out Test); -- crew.ads:291:4:GenerateMemberName:Test_GenerateMemberName procedure Test_FindCabin_c60907_006804(Gnattest_T: in out Test); -- crew.ads:307:4:FindCabin:Test_FindCabin procedure Test_UpdateCrew_123b55_011eae(Gnattest_T: in out Test); -- crew.ads:319:4:UpdateCrew:Test_UpdateCrew procedure Test_WaitForRest_237f93_b046aa(Gnattest_T: in out Test); -- crew.ads:328:4:WaitForRest:Test_WaitForRest procedure Test_GetSkillLevelName_b5615e_35c4c0(Gnattest_T: in out Test); -- crew.ads:340:4:GetSkillLevelName:Test_GetSkillLevelName procedure Test_GetAttributeLevelName_ac08df_7fd836(Gnattest_T: in out Test); -- crew.ads:352:4:GetAttributeLevelName:Test_GetAttributeLevelName procedure Test_DailyPayment_62db86_0bfd06(Gnattest_T: in out Test); -- crew.ads:361:4:DailyPayment:Test_DailyPayment procedure Test_GetTrainingToolQuality_32b7f3_512b79 (Gnattest_T: in out Test); -- crew.ads:376:4:GetTrainingToolQuality:Test_GetTrainingToolQuality end Crew.Test_Data.Tests; -- end read only
function Increment (I : Integer) return Integer; -- We declare (but don't define) a function with one -- parameter, returning an integer value
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ C A T -- -- -- -- S p e c -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- This unit contains the routines used for checking for conformance with -- the semantic restrictions required for the categorization pragmas: -- -- Preelaborate -- Pure, -- Remote_Call_Interface -- Remote_Types -- Shared_Passive -- -- Note that we treat Preelaborate as a categorization pragma, even though -- strictly, according to RM E.2(2,3), the term does not apply in this case. with Types; use Types; package Sem_Cat is function In_Preelaborated_Unit return Boolean; -- Determines if the current scope is within a preelaborated compilation -- unit, that is one to which one of the pragmas Preelaborate, Pure, -- Shared_Passive, Remote_Types, or inside a unit other than a package -- body with pragma Remote_Call_Interface. function In_Pure_Unit return Boolean; pragma Inline (In_Pure_Unit); -- Determines if the current scope is within pure compilation unit, -- that is, one to which the pragmas Pure is applied. function In_Subprogram_Task_Protected_Unit return Boolean; -- Determines if the current scope is within a subprogram, task -- or protected unit. Used to validate if the library unit is Pure -- (RM 10.2.1(16)). procedure Set_Categorization_From_Pragmas (N : Node_Id); -- Since validation of categorization dependency is done during Analyze, -- categorization flags from following pragmas should be set before -- validation begin. N is the N_Compilation_Unit node. procedure Set_Categorization_From_Scope (E : Entity_Id; Scop : Entity_Id); -- Set categorization flags Pure, Remote_Call_Interface and Remote_Types -- on entity E according to those of Scop. procedure Validate_Access_Type_Declaration (T : Entity_Id; N : Node_Id); -- Validate all constraints against declaration of access types in -- categorized library units. Usually this is a violation in Pure unit, -- Shared_Passive unit. N is the declaration node. procedure Validate_Ancestor_Part (N : Node_Id); -- Checks that a type given as the ancestor in an extension aggregate -- satisfies the restriction of 10.2.1(9). procedure Validate_Categorization_Dependency (N : Node_Id; E : Entity_Id); -- There are restrictions on lib unit that semantically depends on other -- units (RM E.2(5), 10.2.1(11). This procedure checks the restrictions -- on categorizations. N is the current unit node, and E is the current -- library unit entity. procedure Validate_Controlled_Object (E : Entity_Id); -- Given an entity for a library level controlled object, check that it is -- not in a preelaborated unit (prohibited by RM 10.2.1(9)). procedure Validate_Null_Statement_Sequence (N : Node_Id); -- Given N, a package body node, check that a handled statement sequence -- in a preelaborable body contains no statements other than labels or -- null statements, as required by RM 10.2.1(6). procedure Validate_Object_Declaration (N : Node_Id); -- Given N, an object declaration node, validates all the constraints in -- a preelaborable library unit, including creation of task objects etc. -- Note that this is called when the corresponding object is frozen since -- the checks cannot be made before knowing if the object is imported. procedure Validate_RCI_Declarations (P : Entity_Id); -- Apply semantic checks given in E2.3(10-14) procedure Validate_RCI_Subprogram_Declaration (N : Node_Id); -- Check for RCI unit subprogram declarations with respect to -- in-lined subprogram and subprogram with access parameter or -- limited type parameter without Read and Write. procedure Validate_Remote_Access_To_Class_Wide_Type (N : Node_Id); -- Checks that Storage_Pool and Storage_Size attribute references are -- not applied to remote access-to-class-wide types. And the expected -- type for an allocator shall not be a remote access-to-class-wide -- type. And a remote access-to-class-wide type shall not be an actual -- parameter for a generic formal access type. RM E.2.3(22). procedure Validate_RT_RAT_Component (N : Node_Id); -- Given N, the package library unit declaration node, we should check -- against RM:9.95 E.2.2(8): the full view of a type declared in the -- visible part of a Remote Types unit has a part that is of a non-remote -- access type which has no read/write. procedure Validate_Remote_Type_Type_Conversion (N : Node_Id); -- Check for remote-type type conversion constraints. First, a value of -- a remote access-to-subprogram type can be converted only to another -- type conformant remote access-to-subprogram type. Secondly, a value -- of a remote access-to-class-wide type can be converted only to another -- remote access-to-class-wide type (RM E.2.3(17,20)). procedure Validate_SP_Access_Object_Type_Decl (T : Entity_Id); -- Check validity of declaration if shared passive unit. It should not -- contain the declaration of an access-to-object type whose designated -- type is a class-wide type ,task type or protected type. E.2.1(7). -- T is the entity of the declared type. procedure Validate_Static_Object_Name (N : Node_Id); -- In the elaboration code of a preelaborated library unit, check -- that we do not have the evaluation of a primary that is a name of -- an object, unless the name is a static expression (RM 10.2.1(8)). -- Non-static constant and variable are the targets, generic parameters -- are not included because the generic declaration and body are -- preelaborable. end Sem_Cat;
with GNAT.OS_Lib; with GNAT.Ctrl_C; procedure Ctrl_C_Handler is procedure Flush; pragma Import (C, Flush, "__gcov_flush"); procedure SIGINT_Exit is begin Flush; GNAT.OS_Lib.OS_Exit (1); end SIGINT_Exit; begin GNAT.Ctrl_C.Install_Handler (SIGINT_Exit'Unrestricted_Access); end Ctrl_C_Handler;
with System.Native_Time; package body Ada.Real_Time is use type System.Native_Time.Nanosecond_Number; function Clock return Time is begin return Time ( System.Native_Real_Time.To_Duration (System.Native_Real_Time.Clock)); end Clock; function "*" (Left : Time_Span; Right : Integer) return Time_Span is begin return Time_Span (Duration (Left) * Right); end "*"; function "*" (Left : Integer; Right : Time_Span) return Time_Span is begin return Time_Span (Left * Duration (Right)); end "*"; function "/" (Left, Right : Time_Span) return Integer is -- not to depend on System.Arith_64 Left_Rep : constant System.Native_Time.Nanosecond_Number := System.Native_Time.Nanosecond_Number'Integer_Value (Left); Right_Rep : constant System.Native_Time.Nanosecond_Number := System.Native_Time.Nanosecond_Number'Integer_Value (Right); begin return Integer (Left_Rep / Right_Rep); end "/"; function "/" (Left : Time_Span; Right : Integer) return Time_Span is begin return Time_Span (Duration (Left) / Right); end "/"; function To_Duration (TS : Time_Span) return Duration is begin return Duration (TS); end To_Duration; function To_Time_Span (D : Duration) return Time_Span is begin return Time_Span (D); end To_Time_Span; function Nanoseconds (NS : Integer) return Time_Span is begin return NS * 0.000_000_001; end Nanoseconds; function Microseconds (US : Integer) return Time_Span is begin return US * 0.000_001; end Microseconds; function Milliseconds (MS : Integer) return Time_Span is begin return MS * 0.001; end Milliseconds; function Seconds (S : Integer) return Time_Span is begin return Time_Span (S); end Seconds; end Ada.Real_Time;
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt private with Ada.Text_IO; package Display.Log is -- This supports logging curses operations (for the purpose of troubleshooting) -- It is activated by setting LOG_RCURSES in the environment procedure start_logging; procedure stop_logging; procedure scribe (line : String); procedure log_builder_update (rec : builder_rec); private package TIO renames Ada.Text_IO; dlog_handle : TIO.File_Type; display_logging_on : Boolean := False; function timestamp return String; end Display.Log;
with STM32.SDMMC; package Media_Reader.SDCard with SPARK_Mode => Off is type SDCard_Controller is limited new Media_Controller with private; Device_Error : exception; procedure Initialize (Controller : in out SDCard_Controller); function Card_Present (Controller : in out SDCard_Controller) return Boolean; function Get_Card_Information (Controller : in out SDCard_Controller) return STM32.SDMMC.Card_Information with Pre => Controller.Card_Present; overriding function Block_Size (Controller : in out SDCard_Controller) return Unsigned_32; overriding function Read_Block (Controller : in out SDCard_Controller; Block_Number : Unsigned_32; Data : out Block) return Boolean; overriding function Write_Block (Controller : in out SDCard_Controller; Block_Number : Unsigned_32; Data : Block) return Boolean; procedure Set_DMA (on : Boolean); private type SDCard_Controller is limited new Media_Controller with record Device : STM32.SDMMC.SDMMC_Controller; Info : STM32.SDMMC.Card_Information; Has_Info : Boolean := False; Card_Detected : Boolean := False; end record; end Media_Reader.SDCard;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T . E X P E C T . N O N _ B L O C K I N G _ S P A W N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2005, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides a target dependent non-blocking spawn function -- for use by the VMS GNAT.Expect package (g-expect-vms.adb). This package -- should not be directly with'ed by an application program. -- This version is for IA64/VMS separate (GNAT.Expect) procedure Non_Blocking_Spawn (Descriptor : out Process_Descriptor'Class; Command : String; Args : GNAT.OS_Lib.Argument_List; Buffer_Size : Natural := 4096; Err_To_Out : Boolean := False) is function Alloc_Vfork_Blocks return Integer; pragma Import (C, Alloc_Vfork_Blocks, "decc$$alloc_vfork_blocks"); function Get_Vfork_Jmpbuf return System.Address; pragma Import (C, Get_Vfork_Jmpbuf, "decc$$get_vfork_jmpbuf"); function Setjmp1 (Addr : System.Address) return Process_Id; pragma Import (C, Setjmp1, "decc$setjmp1"); Pipe1, Pipe2, Pipe3 : aliased Pipe_Type; Arg : String_Access; Arg_List : aliased array (1 .. Args'Length + 2) of System.Address; Command_With_Path : String_Access; begin -- Create the rest of the pipes Set_Up_Communications (Descriptor, Err_To_Out, Pipe1'Access, Pipe2'Access, Pipe3'Access); Command_With_Path := Locate_Exec_On_Path (Command); if Command_With_Path = null then raise Invalid_Process; end if; -- Fork a new process (it is not possible to do this in a subprogram) if Alloc_Vfork_Blocks >= 0 then Descriptor.Pid := Setjmp1 (Get_Vfork_Jmpbuf); else Descriptor.Pid := -1; end if; -- Are we now in the child if Descriptor.Pid = Null_Pid then -- Prepare an array of arguments to pass to C Arg := new String (1 .. Command_With_Path'Length + 1); Arg (1 .. Command_With_Path'Length) := Command_With_Path.all; Arg (Arg'Last) := ASCII.Nul; Arg_List (1) := Arg.all'Address; for J in Args'Range loop Arg := new String (1 .. Args (J)'Length + 1); Arg (1 .. Args (J)'Length) := Args (J).all; Arg (Arg'Last) := ASCII.Nul; Arg_List (J + 2 - Args'First) := Arg.all'Address; end loop; Arg_List (Arg_List'Last) := System.Null_Address; -- This does not return on Unix systems Set_Up_Child_Communications (Descriptor, Pipe1, Pipe2, Pipe3, Command_With_Path.all, Arg_List'Address); end if; Free (Command_With_Path); -- Did we have an error when spawning the child ? if Descriptor.Pid < Null_Pid then raise Invalid_Process; else -- We are now in the parent process Set_Up_Parent_Communications (Descriptor, Pipe1, Pipe2, Pipe3); end if; -- Create the buffer Descriptor.Buffer_Size := Buffer_Size; if Buffer_Size /= 0 then Descriptor.Buffer := new String (1 .. Positive (Buffer_Size)); end if; end Non_Blocking_Spawn;
----------------------------------------------------------------------- -- security-contexts -- Context to provide security information and verify permissions -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Task_Attributes; with Ada.Unchecked_Deallocation; package body Security.Contexts is use type Security.Policies.Policy_Context_Array_Access; use type Security.Policies.Policy_Access; use type Security.Policies.Policy_Context_Access; package Task_Context is new Ada.Task_Attributes (Security_Context_Access, null); procedure Free is new Ada.Unchecked_Deallocation (Object => Security.Policies.Policy_Context'Class, Name => Security.Policies.Policy_Context_Access); -- ------------------------------ -- Get the application associated with the current service operation. -- ------------------------------ function Get_User_Principal (Context : in Security_Context'Class) return Security.Principal_Access is begin return Context.Principal; end Get_User_Principal; -- ------------------------------ -- Get the permission manager. -- ------------------------------ function Get_Permission_Manager (Context : in Security_Context'Class) return Security.Policies.Policy_Manager_Access is begin return Context.Manager; end Get_Permission_Manager; -- ------------------------------ -- Get the policy with the name <b>Name</b> registered in the policy manager. -- Returns null if there is no such policy. -- ------------------------------ function Get_Policy (Context : in Security_Context'Class; Name : in String) return Security.Policies.Policy_Access is use type Security.Policies.Policy_Manager_Access; begin if Context.Manager = null then return null; else return Context.Manager.Get_Policy (Name); end if; end Get_Policy; -- ------------------------------ -- Check if the permission identified by <b>Permission</b> is allowed according to -- the current security context. -- Returns True if the permission is granted. -- ------------------------------ function Has_Permission (Context : in Security_Context; Permission : in Permissions.Permission_Index) return Boolean is use type Security.Policies.Policy_Manager_Access; begin if Context.Manager = null then return False; end if; declare Perm : Security.Permissions.Permission (Permission); begin return Context.Manager.Has_Permission (Context, Perm); end; end Has_Permission; -- ------------------------------ -- Check if the permission identified by <b>Permission</b> is allowed according to -- the current security context. -- Returns True if the permission is granted. -- ------------------------------ function Has_Permission (Context : in Security_Context; Permission : in String) return Boolean is Index : constant Permissions.Permission_Index := Permissions.Get_Permission_Index (Permission); begin return Security_Context'Class (Context).Has_Permission (Index); end Has_Permission; -- ------------------------------ -- Check if the permission identified by <b>Permission</b> is allowed according to -- the current security context. -- Returns True if the permission is granted. -- ------------------------------ function Has_Permission (Context : in Security_Context; Permission : in Permissions.Permission'Class) return Boolean is use type Security.Policies.Policy_Manager_Access; begin if Context.Manager = null then return False; else return Context.Manager.Has_Permission (Context, Permission); end if; end Has_Permission; -- ------------------------------ -- Initializes the service context. By creating the <b>Security_Context</b> variable, -- the instance will be associated with the current task attribute. If the current task -- already has a security context, the new security context is installed, the old one -- being kept. -- ------------------------------ overriding procedure Initialize (Context : in out Security_Context) is begin Context.Previous := Task_Context.Value; Task_Context.Set_Value (Context'Unchecked_Access); end Initialize; -- ------------------------------ -- Finalize the security context releases any object. The previous security context is -- restored to the current task attribute. -- ------------------------------ overriding procedure Finalize (Context : in out Security_Context) is procedure Free is new Ada.Unchecked_Deallocation (Object => Security.Policies.Policy_Context_Array, Name => Security.Policies.Policy_Context_Array_Access); begin Task_Context.Set_Value (Context.Previous); if Context.Contexts /= null then for I in Context.Contexts'Range loop Free (Context.Contexts (I)); end loop; Free (Context.Contexts); end if; end Finalize; -- ------------------------------ -- Set a policy context information represented by <b>Value</b> and associated with -- the policy index <b>Policy</b>. -- ------------------------------ procedure Set_Policy_Context (Context : in out Security_Context; Policy : in Security.Policies.Policy_Access; Value : in Security.Policies.Policy_Context_Access) is begin if Context.Contexts = null then Context.Contexts := Context.Manager.Create_Policy_Contexts; end if; Free (Context.Contexts (Policy.Get_Policy_Index)); Context.Contexts (Policy.Get_Policy_Index) := Value; end Set_Policy_Context; -- ------------------------------ -- Get the policy context information registered for the given security policy in the security -- context <b>Context</b>. -- Raises <b>Invalid_Context</b> if there is no such information. -- Raises <b>Invalid_Policy</b> if the policy was not set. -- ------------------------------ function Get_Policy_Context (Context : in Security_Context; Policy : in Security.Policies.Policy_Access) return Security.Policies.Policy_Context_Access is Result : Security.Policies.Policy_Context_Access; begin if Policy = null then raise Invalid_Policy; end if; if Context.Contexts = null then raise Invalid_Context; end if; Result := Context.Contexts (Policy.Get_Policy_Index); return Result; end Get_Policy_Context; -- ------------------------------ -- Returns True if a context information was registered for the security policy. -- ------------------------------ function Has_Policy_Context (Context : in Security_Context; Policy : in Security.Policies.Policy_Access) return Boolean is begin return Policy /= null and then Context.Contexts /= null and then Context.Contexts (Policy.Get_Policy_Index) /= null; end Has_Policy_Context; -- ------------------------------ -- Set the current application and user context. -- ------------------------------ procedure Set_Context (Context : in out Security_Context; Manager : in Security.Policies.Policy_Manager_Access; Principal : in Security.Principal_Access) is begin Context.Manager := Manager; Context.Principal := Principal; end Set_Context; -- ------------------------------ -- Get the current security context. -- Returns null if the current thread is not associated with any security context. -- ------------------------------ function Current return Security_Context_Access is begin return Task_Context.Value; end Current; -- ------------------------------ -- Check if the permission identified by <b>Permission</b> is allowed according to -- the current security context. -- ------------------------------ function Has_Permission (Permission : in Permissions.Permission_Index) return Boolean is Context : constant Security_Context_Access := Current; begin if Context = null then return False; else return Context.Has_Permission (Permission); end if; end Has_Permission; -- ------------------------------ -- Check if the permission identified by <b>Permission</b> is allowed according to -- the current security context. -- ------------------------------ function Has_Permission (Permission : in String) return Boolean is Context : constant Security_Context_Access := Current; begin if Context = null then return False; else return Context.Has_Permission (Permission); end if; end Has_Permission; -- ------------------------------ -- Check if the permission identified by <b>Permission</b> is allowed according to -- the current security context. -- ------------------------------ function Has_Permission (Permission : in Permissions.Permission'Class) return Boolean is Context : constant Security_Context_Access := Current; begin if Context = null then return False; else return Context.Has_Permission (Permission); end if; end Has_Permission; end Security.Contexts;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ C H 3 -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Types; use Types; package Sem_Ch3 is procedure Analyze_Component_Declaration (N : Node_Id); procedure Analyze_Full_Type_Declaration (N : Node_Id); procedure Analyze_Incomplete_Type_Decl (N : Node_Id); procedure Analyze_Itype_Reference (N : Node_Id); procedure Analyze_Number_Declaration (N : Node_Id); procedure Analyze_Object_Declaration (N : Node_Id); procedure Analyze_Others_Choice (N : Node_Id); procedure Analyze_Private_Extension_Declaration (N : Node_Id); procedure Analyze_Subtype_Indication (N : Node_Id); procedure Analyze_Variant_Part (N : Node_Id); procedure Analyze_Subtype_Declaration (N : Node_Id; Skip : Boolean := False); -- Called to analyze a subtype declaration. The parameter Skip is used for -- Ada 2005 (AI-412). We set to True in order to avoid reentering the -- defining identifier of N when analyzing a rewritten incomplete subtype -- declaration. function Access_Definition (Related_Nod : Node_Id; N : Node_Id) return Entity_Id; -- An access definition defines a general access type for a formal -- parameter. The procedure is called when processing formals, when the -- current scope is the subprogram. The Implicit type is attached to the -- Related_Nod put into the enclosing scope, so that the only entities -- defined in the spec are the formals themselves. procedure Access_Subprogram_Declaration (T_Name : Entity_Id; T_Def : Node_Id); -- The subprogram specification yields the signature of an implicit -- type, whose Ekind is Access_Subprogram_Type. This implicit type is the -- designated type of the declared access type. In subprogram calls, the -- signature of the implicit type works like the profile of a regular -- subprogram. procedure Add_Internal_Interface_Entities (Tagged_Type : Entity_Id); -- Add to the list of primitives of Tagged_Type the internal entities -- associated with covered interface primitives. These entities link the -- interface primitives with the tagged type primitives that cover them. procedure Analyze_Declarations (L : List_Id); -- Called to analyze a list of declarations (in what context ???). Also -- performs necessary freezing actions (more description needed ???) procedure Analyze_Interface_Declaration (T : Entity_Id; Def : Node_Id); -- Analyze an interface declaration or a formal interface declaration procedure Array_Type_Declaration (T : in out Entity_Id; Def : Node_Id); -- Process an array type declaration. If the array is constrained, we -- create an implicit parent array type, with the same index types and -- component type. procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id); -- Process an access type declaration procedure Build_Itype_Reference (Ityp : Entity_Id; Nod : Node_Id); -- Create a reference to an internal type, for use by Gigi. The back-end -- elaborates itypes on demand, i.e. when their first use is seen. This can -- lead to scope anomalies if the first use is within a scope that is -- nested within the scope that contains the point of definition of the -- itype. The Itype_Reference node forces the elaboration of the itype -- in the proper scope. The node is inserted after Nod, which is the -- enclosing declaration that generated Ityp. -- -- A related mechanism is used during expansion, for itypes created in -- branches of conditionals. See Ensure_Defined in exp_util. Could both -- mechanisms be merged ??? procedure Check_Abstract_Overriding (T : Entity_Id); -- Check that all abstract subprograms inherited from T's parent type have -- been overridden as required, and that nonabstract subprograms have not -- been incorrectly overridden with an abstract subprogram. procedure Check_Aliased_Component_Types (T : Entity_Id); -- Given an array type or record type T, check that if the type is -- nonlimited, then the nominal subtype of any components of T that -- have discriminants must be constrained. procedure Check_Completion (Body_Id : Node_Id := Empty); -- At the end of a declarative part, verify that all entities that require -- completion have received one. If Body_Id is absent, the error indicating -- a missing completion is placed on the declaration that needs completion. -- If Body_Id is present, it is the defining identifier of a package body, -- and errors are posted on that node, rather than on the declarations that -- require completion in the package declaration. procedure Check_CPP_Type_Has_No_Defaults (T : Entity_Id); -- Check that components of imported CPP type T do not have default -- expressions because the constructor (if any) is on the C++ side. procedure Derive_Subprogram (New_Subp : out Entity_Id; Parent_Subp : Entity_Id; Derived_Type : Entity_Id; Parent_Type : Entity_Id; Actual_Subp : Entity_Id := Empty); -- Derive the subprogram Parent_Subp from Parent_Type, and replace the -- subsidiary subtypes with the derived type to build the specification of -- the inherited subprogram (returned in New_Subp). For tagged types, the -- derived subprogram is aliased to that of the actual (in the case where -- Actual_Subp is nonempty) rather than to the corresponding subprogram of -- the parent type. procedure Derive_Subprograms (Parent_Type : Entity_Id; Derived_Type : Entity_Id; Generic_Actual : Entity_Id := Empty); -- To complete type derivation, collect/retrieve the primitive operations -- of the parent type, and replace the subsidiary subtypes with the derived -- type, to build the specs of the inherited ops. For generic actuals, the -- mapping of the primitive operations to those of the parent type is also -- done by rederiving the operations within the instance. For tagged types, -- the derived subprograms are aliased to those of the actual, not those of -- the ancestor. -- -- Note: one might expect this to be private to the package body, but there -- is one rather unusual usage in package Exp_Dist. function Find_Hidden_Interface (Src : Elist_Id; Dest : Elist_Id) return Entity_Id; -- Ada 2005: Determine whether the interfaces in list Src are all present -- in the list Dest. Return the first differing interface, or Empty -- otherwise. function Find_Type_Of_Subtype_Indic (S : Node_Id) return Entity_Id; -- Given a subtype indication S (which is really an N_Subtype_Indication -- node or a plain N_Identifier), find the type of the subtype mark. function Find_Type_Name (N : Node_Id) return Entity_Id; -- Enter the identifier in a type definition, or find the entity already -- declared, in the case of the full declaration of an incomplete or -- private type. If the previous declaration is tagged then the class-wide -- entity is propagated to the identifier to prevent multiple incompatible -- class-wide types that may be created for self-referential anonymous -- access components. function Get_Discriminant_Value (Discriminant : Entity_Id; Typ_For_Constraint : Entity_Id; Constraint : Elist_Id) return Node_Id; -- ??? MORE DOCUMENTATION -- Given a discriminant somewhere in the Typ_For_Constraint tree and a -- Constraint, return the value of that discriminant. function Is_Null_Extension (T : Entity_Id) return Boolean; -- Returns True if the tagged type T has an N_Full_Type_Declaration that -- is a null extension, meaning that it has an extension part without any -- components and does not have a known discriminant part. function Is_Visible_Component (C : Entity_Id; N : Node_Id := Empty) return Boolean; -- Determines if a record component C is visible in the present context. -- Note that even though component C could appear in the entity chain of a -- record type, C may not be visible in the current context. For instance, -- C may be a component inherited in the full view of a private extension -- which is not visible in the current context. -- -- If present, N is the selected component of which C is the selector. If -- the prefix of N is a type conversion inserted for a discriminant check, -- C is automatically visible. procedure Make_Index (N : Node_Id; Related_Nod : Node_Id; Related_Id : Entity_Id := Empty; Suffix_Index : Pos := 1); -- Process an index that is given in an array declaration, an entry -- family declaration or a loop iteration. The index is given by an index -- declaration (a 'box'), or by a discrete range. The later can be the name -- of a discrete type, or a subtype indication. -- -- Related_Nod is the node where the potential generated implicit types -- will be inserted. The next last parameters are used for creating the -- name. procedure Make_Class_Wide_Type (T : Entity_Id); -- A Class_Wide_Type is created for each tagged type definition. The -- attributes of a class-wide type are inherited from those of the type T. -- If T is introduced by a private declaration, the corresponding class -- wide type is created at the same time, and therefore there is a private -- and a full declaration for the class-wide type as well. function OK_For_Limited_Init_In_05 (Typ : Entity_Id; Exp : Node_Id) return Boolean; -- Presuming Exp is an expression of an inherently limited type Typ, -- returns True if the expression is allowed in an initialization context -- by the rules of Ada 2005. We use the rule in RM-7.5(2.1/2), "...it is an -- aggregate, a function_call, or a parenthesized expression or qualified -- expression whose operand is permitted...". Note that in Ada 95 mode, -- we sometimes wish to give warnings based on whether the program _would_ -- be legal in Ada 2005. Note that Exp must already have been resolved, -- so we can know whether it's a function call (as opposed to an indexed -- component, for example). In the case where Typ is a limited interface's -- class-wide type, then the expression is allowed to be of any kind if its -- type is a nonlimited descendant of the interface. function OK_For_Limited_Init (Typ : Entity_Id; Exp : Node_Id) return Boolean; -- Always False in Ada 95 mode. Equivalent to OK_For_Limited_Init_In_05 in -- Ada 2005 mode. procedure Preanalyze_Assert_Expression (N : Node_Id; T : Entity_Id); -- Wrapper on Preanalyze_Spec_Expression for assertion expressions, so that -- In_Assertion_Expr can be properly adjusted. procedure Preanalyze_Spec_Expression (N : Node_Id; T : Entity_Id); -- Default and per object expressions do not freeze their components, and -- must be analyzed and resolved accordingly. The analysis is done by -- calling the Preanalyze_And_Resolve routine and setting the global -- In_Spec_Expression flag. See the documentation section entitled -- "Handling of Default and Per-Object Expressions" in sem.ads for full -- details. N is the expression to be analyzed, T is the expected type. -- This mechanism is also used for aspect specifications that have an -- expression parameter that needs similar preanalysis. procedure Process_Full_View (N : Node_Id; Full_T, Priv_T : Entity_Id); -- Process some semantic actions when the full view of a private type is -- encountered and analyzed. The first action is to create the full views -- of the dependant private subtypes. The second action is to recopy the -- primitive operations of the private view (in the tagged case). -- N is the N_Full_Type_Declaration node. -- -- Full_T is the full view of the type whose full declaration is in N. -- -- Priv_T is the private view of the type whose full declaration is in N. procedure Process_Range_Expr_In_Decl (R : Node_Id; T : Entity_Id; Subtyp : Entity_Id := Empty; Check_List : List_Id := No_List; R_Check_Off : Boolean := False); -- Process a range expression that appears in a declaration context. The -- range is analyzed and resolved with the base type of the given type, and -- an appropriate check for expressions in non-static contexts made on the -- bounds. R is analyzed and resolved using T, so the caller should if -- necessary link R into the tree before the call, and in particular in the -- case of a subtype declaration, it is appropriate to set the parent -- pointer of R so that the types get properly frozen. Check_List is used -- when the subprogram is called from Build_Record_Init_Proc and is used to -- return a set of constraint checking statements generated by the Checks -- package. R_Check_Off is set to True when the call to Range_Check is to -- be skipped. -- -- If Subtyp is given, then the range is for the named subtype Subtyp, and -- in this case the bounds are captured if necessary using this name. function Process_Subtype (S : Node_Id; Related_Nod : Node_Id; Related_Id : Entity_Id := Empty; Suffix : Character := ' ') return Entity_Id; -- Process a subtype indication S and return corresponding entity. -- Related_Nod is the node where the potential generated implicit types -- will be inserted. The Related_Id and Suffix parameters are used to -- build the associated Implicit type name. procedure Process_Discriminants (N : Node_Id; Prev : Entity_Id := Empty); -- Process the discriminants contained in an N_Full_Type_Declaration or -- N_Incomplete_Type_Decl node N. If the declaration is a completion, Prev -- is entity on the partial view, on which references are posted. However, -- note that Process_Discriminants is called for a completion only if -- partial view had no discriminants (else we just check conformance -- between the two views and do not call Process_Discriminants again -- for the completion). function Replace_Anonymous_Access_To_Protected_Subprogram (N : Node_Id) return Entity_Id; -- Ada 2005 (AI-254): Create and decorate an internal full type declaration -- for an anonymous access to protected subprogram. For a record component -- declaration, the type is created in the enclosing scope, for an array -- type declaration or an object declaration it is simply placed ahead of -- this declaration. procedure Set_Completion_Referenced (E : Entity_Id); -- If E is the completion of a private or incomplete type declaration, -- or the completion of a deferred constant declaration, mark the entity -- as referenced. Warnings on unused entities, if needed, go on the -- partial view. end Sem_Ch3;