repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
DrenfongWong/tkm-rpc
Ada
1,314
ads
with Tkmrpc.Types; with Tkmrpc.Operations.Ees; package Tkmrpc.Request.Ees.Esa_Acquire is Data_Size : constant := 4; type Data_Type is record Sp_Id : Types.Sp_Id_Type; end record; for Data_Type use record Sp_Id at 0 range 0 .. (4 * 8) - 1; end record; for Data_Type'Size use Data_Size * 8; Padding_Size : constant := Request.Body_Size - Data_Size; subtype Padding_Range is Natural range 1 .. Padding_Size; subtype Padding_Type is Types.Byte_Sequence (Padding_Range); type Request_Type is record Header : Request.Header_Type; Data : Data_Type; Padding : Padding_Type; end record; for Request_Type use record Header at 0 range 0 .. (Request.Header_Size * 8) - 1; Data at Request.Header_Size range 0 .. (Data_Size * 8) - 1; Padding at Request.Header_Size + Data_Size range 0 .. (Padding_Size * 8) - 1; end record; for Request_Type'Size use Request.Request_Size * 8; Null_Request : constant Request_Type := Request_Type' (Header => Request.Header_Type'(Operation => Operations.Ees.Esa_Acquire, Request_Id => 0), Data => Data_Type'(Sp_Id => Types.Sp_Id_Type'First), Padding => Padding_Type'(others => 0)); end Tkmrpc.Request.Ees.Esa_Acquire;
reznikmm/matreshka
Ada
3,765
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.Constants; package body Matreshka.ODF_Attributes.Table.Style_Name is -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Style_Name_Node) return League.Strings.Universal_String is begin return ODF.Constants.Style_Name_Name; end Get_Local_Name; end Matreshka.ODF_Attributes.Table.Style_Name;
optikos/oasis
Ada
4,730
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Discriminant_Constraints is function Create (Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Discriminants : not null Program.Elements.Discriminant_Associations .Discriminant_Association_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Discriminant_Constraint is begin return Result : Discriminant_Constraint := (Left_Bracket_Token => Left_Bracket_Token, Discriminants => Discriminants, Right_Bracket_Token => Right_Bracket_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Discriminants : not null Program.Elements.Discriminant_Associations .Discriminant_Association_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Discriminant_Constraint is begin return Result : Implicit_Discriminant_Constraint := (Discriminants => Discriminants, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Discriminants (Self : Base_Discriminant_Constraint) return not null Program.Elements.Discriminant_Associations .Discriminant_Association_Vector_Access is begin return Self.Discriminants; end Discriminants; overriding function Left_Bracket_Token (Self : Discriminant_Constraint) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Discriminant_Constraint) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Discriminant_Constraint) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Discriminant_Constraint) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Discriminant_Constraint) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Discriminant_Constraint'Class) is begin for Item in Self.Discriminants.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Discriminant_Constraint_Element (Self : Base_Discriminant_Constraint) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Discriminant_Constraint_Element; overriding function Is_Constraint_Element (Self : Base_Discriminant_Constraint) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Constraint_Element; overriding function Is_Definition_Element (Self : Base_Discriminant_Constraint) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Definition_Element; overriding procedure Visit (Self : not null access Base_Discriminant_Constraint; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Discriminant_Constraint (Self); end Visit; overriding function To_Discriminant_Constraint_Text (Self : aliased in out Discriminant_Constraint) return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Text_Access is begin return Self'Unchecked_Access; end To_Discriminant_Constraint_Text; overriding function To_Discriminant_Constraint_Text (Self : aliased in out Implicit_Discriminant_Constraint) return Program.Elements.Discriminant_Constraints .Discriminant_Constraint_Text_Access is pragma Unreferenced (Self); begin return null; end To_Discriminant_Constraint_Text; end Program.Nodes.Discriminant_Constraints;
zhmu/ananas
Ada
3,789
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ADA.NUMERICS.BIG_NUMBERS.BIG_INTEGERS_GHOST -- -- -- -- B o d y -- -- -- -- Copyright (C) 2021-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This body is provided as a work-around for a GNAT compiler bug, as GNAT -- currently does not compile instantiations of the spec with imported ghost -- generics for packages Signed_Conversions and Unsigned_Conversions. -- Ghost code in this unit is meant for analysis only, not for run-time -- checking. This is enforced by setting the assertion policy to Ignore. pragma Assertion_Policy (Ghost => Ignore); package body Ada.Numerics.Big_Numbers.Big_Integers_Ghost with SPARK_Mode => Off is package body Signed_Conversions with SPARK_Mode => Off is function To_Big_Integer (Arg : Int) return Valid_Big_Integer is begin raise Program_Error; return (null record); end To_Big_Integer; function From_Big_Integer (Arg : Valid_Big_Integer) return Int is begin raise Program_Error; return 0; end From_Big_Integer; end Signed_Conversions; package body Unsigned_Conversions with SPARK_Mode => Off is function To_Big_Integer (Arg : Int) return Valid_Big_Integer is begin raise Program_Error; return (null record); end To_Big_Integer; function From_Big_Integer (Arg : Valid_Big_Integer) return Int is begin raise Program_Error; return 0; end From_Big_Integer; end Unsigned_Conversions; end Ada.Numerics.Big_Numbers.Big_Integers_Ghost;
zhmu/ananas
Ada
5,543
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- C U D A -- -- -- -- S p e c -- -- -- -- Copyright (C) 2010-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package defines CUDA-specific datastructures and subprograms. -- -- Compiling for CUDA requires compiling for two targets. One is the CPU (more -- frequently named "host"), the other is the GPU (the "device"). Compiling -- for the host requires compiling the whole program. Compiling for the device -- only requires compiling packages that contain CUDA kernels. -- -- When compiling for the device, GNAT-LLVM is used. It produces assembly -- tailored to Nvidia's GPU (NVPTX). This NVPTX code is then assembled into -- an object file by ptxas, an assembler provided by Nvidia. This object file -- is then combined with its source code into a fat binary by a tool named -- `fatbin`, also provided by Nvidia. The resulting fat binary is turned into -- a regular object file by the host's linker and linked with the program that -- executes on the host. -- -- A CUDA kernel is a procedure marked with the CUDA_Global pragma or aspect. -- CUDA_Global does not have any effect when compiling for the device. When -- compiling for the host, the frontend stores procedures marked with -- CUDA_Global in a hash table the key of which is the Node_Id of the package -- body that contains the CUDA_Global procedure. This is done in sem_prag.adb. -- Once the declarations of a package body have been analyzed, variable, type -- and procedure declarations necessary for the initialization of the CUDA -- runtime are appended to the package that contains the CUDA_Global -- procedure. -- -- These declarations are used to register the CUDA kernel with the CUDA -- runtime when the program is launched. Registering a CUDA kernel with the -- CUDA runtime requires multiple function calls: -- - The first one registers the fat binary which corresponds to the package -- with the CUDA runtime. -- - Then, as many function calls as there are kernels in order to bind them -- with the fat binary. -- fat binary. -- - The last call lets the CUDA runtime know that we are done initializing -- CUDA. -- Expansion of the CUDA_Global aspect is triggered in sem_ch7.adb, during -- analysis of the package. All of this expansion is performed in the -- Insert_CUDA_Initialization procedure defined in GNAT_CUDA. -- -- Once a CUDA package is initialized, its kernels are ready to be used. -- Launching CUDA kernels is done by using the CUDA_Execute pragma. When -- compiling for the host, the CUDA_Execute pragma is expanded into a declare -- block which performs calls to the CUDA runtime functions. -- - The first one pushes a "launch configuration" on the "configuration -- stack" of the CUDA runtime. -- - The second call pops this call configuration, making it effective. -- - The third call actually launches the kernel. -- Light validation of the CUDA_Execute pragma is performed in sem_prag.adb -- and expansion is performed in exp_prag.adb. with Types; use Types; package GNAT_CUDA is procedure Add_CUDA_Device_Entity (Pack_Id : Entity_Id; E : Entity_Id); -- And E to the list of CUDA_Device entities that belong to Pack_Id procedure Add_CUDA_Kernel (Pack_Id : Entity_Id; Kernel : Entity_Id); -- Add Kernel to the list of CUDA_Global nodes that belong to Pack_Id. -- Kernel is a procedure entity marked with CUDA_Global, Pack_Id is the -- entity of its parent package body. procedure Expand_CUDA_Package (N : Node_Id); -- When compiling for the host: -- - Generate code to register kernels with the CUDA runtime and -- post-process kernels. -- - Empty content of CUDA_Global procedures. -- - Remove declarations of CUDA_Device entities. end GNAT_CUDA;
Fabien-Chouteau/lvgl-ada
Ada
6,133
ads
with Lv.Style; with Lv.Objx.Page; package Lv.Objx.Tabview is subtype Instance is Obj_T; type Action_T is access function (Self : access Instance; Tab_Id : Uint16_T) return Res_T; pragma Convention (C, Action_T); type Btns_Pos_T is (Pos_Top, Pos_Bottom); type Style_T is (Style_Bg, Style_Indic, Style_Btn_Bg, Style_Btn_Rel, Style_Btn_Pr, Style_Btn_Tgl_Rel, Style_Btn_Tgl_Pr); -- Create a Tab view object -- @param par pointer to an object, it will be the parent of the new tab -- @param copy pointer to a tab object, if not NULL then the new object will be copied from it -- @return pointer to the created tab function Create (Par : Obj_T; Copy : Instance) return Instance; -- Delete all children of the scrl object, without deleting scrl child. -- @param self pointer to an object procedure Clean (Self : Instance); -- Add a new tab with the given name -- @param self pointer to Tab view object where to ass the new tab -- @param name the text on the tab button -- @return pointer to the created page object (lv_page). You can create your content here function Add_Tab (Self : Instance; Name : C_String_Ptr) return Lv.Objx.Page.Instance; ---------------------- -- Setter functions -- ---------------------- -- Set a new tab -- @param self pointer to Tab view object -- @param id index of a tab to load -- @param anim_en true: set with sliding animation; false: set immediately procedure Set_Tab_Act (Self : Instance; Id : Uint16_T; Anim_En : U_Bool); -- Set an action to call when a tab is loaded (Good to create content only if required) -- lv_tabview_get_act() still gives the current (old) tab (to remove content from here) -- @param self pointer to a tabview object -- @param action pointer to a function to call when a tab is loaded procedure Set_Tab_Load_Action (Self : Instance; Action : Action_T); -- Enable horizontal sliding with touch pad -- @param self pointer to Tab view object -- @param en true: enable sliding; false: disable sliding procedure Set_Sliding (Self : Instance; En : U_Bool); -- Set the animation time of tab view when a new tab is loaded -- @param self pointer to Tab view object -- @param anim_time time of animation in milliseconds procedure Set_Anim_Time (Self : Instance; Anim_Time : Uint16_T); -- Set the style of a tab view -- @param self pointer to a tan view object -- @param type which style should be set -- @param style pointer to the new style procedure Set_Style (Self : Instance; Typ : Style_T; Style : Lv.Style.Style); -- Set the position of tab select buttons -- @param self pointer to a tan view object -- @param btns_pos which button position procedure Set_Btns_Pos (Self : Instance; Btns_Pos : Btns_Pos_T); ---------------------- -- Getter functions -- ---------------------- -- Get the index of the currently active tab -- @param self pointer to Tab view object -- @return the active tab index function Tab_Act (Self : Instance) return Uint16_T; -- Get the number of tabs -- @param self pointer to Tab view object -- @return tab count function Tab_Count (Self : Instance) return Uint16_T; -- Get the page (content area) of a tab -- @param self pointer to Tab view object -- @param id index of the tab (>= 0) -- @return pointer to page (lv_page) object function Tab (Self : Instance; Id : Uint16_T) return Lv.Objx.Page.Instance; -- Get the tab load action -- @param self pointer to a tabview object -- @param return the current tab load action function Tab_Load_Action (Self : Instance) return Action_T; -- Get horizontal sliding is enabled or not -- @param self pointer to Tab view object -- @return true: enable sliding; false: disable sliding function Sliding (Self : Instance) return U_Bool; -- Get the animation time of tab view when a new tab is loaded -- @param self pointer to Tab view object -- @return time of animation in milliseconds function Anim_Time (Self : Instance) return Uint16_T; -- Get a style of a tab view -- @param self pointer to a ab view object -- @param type which style should be get -- @return style pointer to a style function Style (Self : Instance; Style_Type : Style_T) return Lv.Style.Style; -- Get position of tab select buttons -- @param self pointer to a ab view object function Btns_Pos (Self : Instance) return Btns_Pos_T; ------------- -- Imports -- ------------- pragma Import (C, Create, "lv_tabview_create"); pragma Import (C, Clean, "lv_tabview_clean"); pragma Import (C, Add_Tab, "lv_tabview_add_tab"); pragma Import (C, Set_Tab_Act, "lv_tabview_set_tab_act"); pragma Import (C, Set_Tab_Load_Action, "lv_tabview_set_tab_load_action"); pragma Import (C, Set_Sliding, "lv_tabview_set_sliding"); pragma Import (C, Set_Anim_Time, "lv_tabview_set_anim_time"); pragma Import (C, Set_Style, "lv_tabview_set_style"); pragma Import (C, Set_Btns_Pos, "lv_tabview_set_btns_pos"); pragma Import (C, Tab_Act, "lv_tabview_get_tab_act"); pragma Import (C, Tab_Count, "lv_tabview_get_tab_count"); pragma Import (C, Tab, "lv_tabview_get_tab"); pragma Import (C, Tab_Load_Action, "lv_tabview_get_tab_load_action"); pragma Import (C, Sliding, "lv_tabview_get_sliding"); pragma Import (C, Anim_Time, "lv_tabview_get_anim_time"); pragma Import (C, Style, "lv_tabview_get_style"); pragma Import (C, Btns_Pos, "lv_tabview_get_btns_pos"); for Btns_Pos_T'Size use 8; for Btns_Pos_T use (Pos_Top => 0, Pos_Bottom => 1); for Style_T'Size use 8; for Style_T use (Style_Bg => 0, Style_Indic => 1, Style_Btn_Bg => 2, Style_Btn_Rel => 3, Style_Btn_Pr => 4, Style_Btn_Tgl_Rel => 5, Style_Btn_Tgl_Pr => 6); end Lv.Objx.Tabview;
jhumphry/auto_counters
Ada
2,051
adb
-- basic_counters.adb -- Basic non-task safe counters for use with smart_ptrs -- Copyright (c) 2016, James Humphry -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. pragma Profile (No_Implementation_Extensions); with Ada.Unchecked_Deallocation; package body Basic_Counters is function Make_New_Counter return Counter_Ptr is (new Counter'(SP_Count => 1, WP_Count => 0 ) ); procedure Deallocate_Counter is new Ada.Unchecked_Deallocation (Object => Counter, Name => Counter_Ptr); procedure Deallocate_If_Unused (C : in out Counter_Ptr) is begin if C.SP_Count = 0 and C.WP_Count = 0 then Deallocate_Counter(C); end if; end Deallocate_If_Unused; procedure Check_Increment_Use_Count (C : in out Counter) is begin if C.SP_Count > 0 then C.SP_Count := C.SP_Count + 1; end if; end Check_Increment_Use_Count; procedure Decrement_Use_Count (C : in out Counter) is begin C.SP_Count := C.SP_Count - 1; end Decrement_Use_Count; procedure Increment_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count + 1; end Increment_Weak_Ptr_Count; procedure Decrement_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count - 1; end Decrement_Weak_Ptr_Count; end Basic_Counters;
reznikmm/matreshka
Ada
4,664
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Style.Master_Page_Name_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Master_Page_Name_Attribute_Node is begin return Self : Style_Master_Page_Name_Attribute_Node do Matreshka.ODF_Style.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Style_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Style_Master_Page_Name_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Master_Page_Name_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Style_URI, Matreshka.ODF_String_Constants.Master_Page_Name_Attribute, Style_Master_Page_Name_Attribute_Node'Tag); end Matreshka.ODF_Style.Master_Page_Name_Attributes;
hgrodriguez/rp2040_zfp
Ada
274
adb
package body Runtime is procedure OS_Exit (Status : Integer) is pragma Unreferenced (Status); begin null; end OS_Exit; procedure HardFault_Handler is begin loop null; end loop; end HardFault_Handler; end Runtime;
reznikmm/matreshka
Ada
4,369
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Stream_Element_Vectors; package XML.SAX.Input_Sources.Streams.Element_Arrays is type Stream_Element_Array_Input_Source is limited new Stream_Input_Source with private; procedure Set_Stream_Element_Array (Self : in out Stream_Element_Array_Input_Source'Class; Data : Ada.Streams.Stream_Element_Array); procedure Set_Stream_Element_Vector (Self : in out Stream_Element_Array_Input_Source'Class; Data : League.Stream_Element_Vectors.Stream_Element_Vector); private type Stream_Element_Array_Input_Source is limited new Stream_Input_Source with null record; overriding procedure Read (Self : in out Stream_Element_Array_Input_Source; Buffer : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; End_Of_Data : out Boolean); -- Override subprogram to implement obtaining of next portion of data from -- the specified array of stream elements. end XML.SAX.Input_Sources.Streams.Element_Arrays;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
804
adb
with STM32GD.RTC; package body STM32GD.Timeout is Microseconds_Timeout : Microseconds; Milliseconds_Timeout : Milliseconds; Seconds_Timeout : Seconds; procedure Set (T : Microseconds) is begin null; end Set; procedure Set (T : Milliseconds) is begin null; end Set; procedure Set (T : Seconds) is package RTC is new STM32GD.RTC (Clock => Clock_Tree.RTC_Source, Clock_Tree => Clock_Tree); Alarm : RTC.Date_Time_Type; begin RTC.Read (Alarm); RTC.Add_Seconds (Alarm, RTC.Second_Delta_Type (T)); RTC.Set_Alarm (Alarm); end Set; procedure Await is begin while not Expired loop null; end loop; end Await; function Expired return Boolean is begin return False; end Expired; end STM32GD.Timeout;
zhmu/ananas
Ada
110
ads
generic type I is interface; with procedure P (X : I) is abstract; package gen_interface_p is end;
stcarrez/ada-util
Ada
2,303
adb
----------------------------------------------------------------------- -- util-http-parts -- HTTP Parts -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Ada.IO_Exceptions; with Util.Log.Loggers; package body Util.Http.Parts is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Http.Parts"); -- ------------------------------ -- Write the part data item to the file. This method is not guaranteed to succeed -- if called more than once for the same part. This allows a particular implementation -- to use, for example, file renaming, where possible, rather than copying all of -- the underlying data, thus gaining a significant performance benefit. -- ------------------------------ procedure Save (Data : in Part; Path : in String) is Old_Path : constant String := Part'Class (Data).Get_Local_Filename; begin Log.Info ("Saving uploaded file {0} to {1}", Old_Path, Path); Ada.Directories.Rename (Old_Name => Old_Path, New_Name => Path); exception when Ada.IO_Exceptions.Use_Error => Log.Error ("Cannot save uploaded file"); end Save; -- ------------------------------ -- Deletes the underlying storage for a file item, including deleting any associated -- temporary disk file. -- ------------------------------ procedure Delete (Data : in out Part) is Path : constant String := Part'Class (Data).Get_Local_Filename; begin Ada.Directories.Delete_File (Path); end Delete; end Util.Http.Parts;
gerr135/ada_composition
Ada
3,075
adb
-- -- The demo of type hierarchy use: declarations, loops, dereferencing.. -- -- 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 Ada.Command_Line, GNAT.Command_Line; with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO; with Ada.Containers.Vectors; with lists.Fixed; with lists.Dynamic; with lists.Vectors; procedure Test_list_iface is type TstType is new Integer; package ACV is new Ada.Containers.Vectors(Positive, TstType); package PL is new Lists(Natural, TstType); package PLF is new PL.Fixed; package PLD is new PL.Dynamic; package PLV is new PL.Vectors; v : ACV.Vector := ACV.To_Vector(5); lf : PLF.List(5); ld : PLD.List := PLD.To_Vector(5); lv : PLV.List := PLV.To_Vector(5); lc : PL.List_Interface'Class := PLD.To_Vector(5); begin -- main Put_Line("testing Ada.Containers.Vectors.."); Put("assigning values .. "); for i in Positive range 1 .. 5 loop v(i) := TstType(i); end loop; Put("done; values: "); for n of v loop Put(n'Img); end loop; Put("; now try direct indexing: "); for i in Positive range 1 .. 5 loop Put(TstType'Image(v(i))); end loop; New_Line; -- -- New_Line; Put_Line("testing Lists.Fixed .."); Put("assigning values .. "); for i in Positive range 1 .. 5 loop lf(i) := TstType(i); end loop; Put("done; values: "); for n of lf loop Put(n'Img); end loop; Put("; now try direct indexing: "); for i in Positive range 1 .. 5 loop Put(TstType'Image(lf(i))); end loop; New_Line; -- -- New_Line; Put_Line("testing Lists.Dynamic .."); Put("assigning values .. "); for i in Positive range 1 .. 5 loop ld(i) := TstType(i); end loop; Put("done; values: "); for n of ld loop Put(n'Img); end loop; Put("; now try direct indexing: "); for i in Positive range 1 .. 5 loop Put(TstType'Image(ld(i))); end loop; New_Line; -- -- New_Line; Put_Line("testing Lists.Vectors .."); Put("assigning values .. "); for i in Positive range 1 .. 5 loop lv(i) := TstType(i); end loop; Put("done; values: "); for n of lv loop Put(n'Img); end loop; Put("; now try direct indexing: "); for i in Positive range 1 .. 5 loop Put(TstType'Image(lv(i))); end loop; New_Line; -- -- New_Line; Put_Line("testing List_Interface'Class .."); Put("assigning values .. "); for i in Positive range 1 .. 5 loop lc(i) := TstType(i); end loop; Put("done; values: "); for n of lc loop Put(n'Img); end loop; Put("; now try direct indexing: "); for i in Positive range 1 .. 5 loop Put(TstType'Image(lc(i))); end loop; New_Line; end Test_List_iface;
jamiepg1/sdlada
Ada
21,154
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2014 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; with Interfaces.C.Strings; with SDL.Error; package body SDL.Video.GL is package C renames Interfaces.C; use type C.int; use type System.Address; type Attributes is (Attribute_Red_Size, Attribute_Green_Size, Attribute_Blue_Size, Attribute_Alpha_Size, Attribute_Buffer_Size, Attribute_Double_Buffer, Attribute_Depth_Buffer_Size, Attribute_Stencil_Size, Attribute_Accumulator_Red_Size, Attribute_Accumulator_Green_Size, Attribute_Accumulator_Blue_Size, Attribute_Accumulator_Alpha_Size, Attribute_Stereo, Attribute_Multisample_Buffers, Attribute_Multisample_Samples, Attribute_Accelerated, Attribute_Retained_Backing, Attribute_Context_Major_Version, Attribute_Context_Minor_Version, Attribute_Context_EGL, Attribute_Context_Flags, Attribute_Context_Profile, Attribute_Share_With_Current_Context) with Convention => C; Profile_Values : constant array (Profiles) of Interfaces.Unsigned_32 := (16#0000_0001#, 16#0000_0002#, 16#0000_0004#); function SDL_GL_Set_Attribute (Attr : in Attributes; Value : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_SetAttribute"; function SDL_GL_Get_Attribute (Attr : in Attributes; Value : out C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_GetAttribute"; function Red_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Red_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Red_Size; procedure Set_Red_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Red_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Red_Size; function Green_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Green_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Green_Size; procedure Set_Green_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Green_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Green_Size; function Blue_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Blue_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Blue_Size; procedure Set_Blue_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Blue_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Blue_Size; function Alpha_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Alpha_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Alpha_Size; procedure Set_Alpha_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Alpha_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Alpha_Size; function Buffer_Size return Buffer_Sizes is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Buffer_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Buffer_Sizes (Data); end Buffer_Size; procedure Set_Buffer_Size (Size : in Buffer_Sizes) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Buffer_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Buffer_Size; function Is_Double_Buffered return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Double_Buffer, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Double_Buffered; procedure Set_Double_Buffer (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Double_Buffer, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Double_Buffer; function Depth_Buffer_Size return Depth_Buffer_Sizes is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Depth_Buffer_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Depth_Buffer_Sizes (Data); end Depth_Buffer_Size; procedure Set_Depth_Buffer_Size (Size : in Depth_Buffer_Sizes) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Depth_Buffer_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Depth_Buffer_Size; function Stencil_Buffer_Size return Stencil_Buffer_Sizes is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Stencil_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Stencil_Buffer_Sizes (Data); end Stencil_Buffer_Size; procedure Set_Stencil_Buffer_Size (Size : in Stencil_Buffer_Sizes) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Stencil_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Stencil_Buffer_Size; function Accumulator_Red_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Red_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Red_Size; procedure Set_Accumulator_Red_Size (Size : in Colour_Bit_Size)is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Red_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Red_Size; function Accumulator_Green_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Green_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Green_Size; procedure Set_Accumulator_Green_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Green_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Green_Size; function Accumulator_Blue_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Blue_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Blue_Size; procedure Set_Accumulator_Blue_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Blue_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Blue_Size; function Accumulator_Alpha_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Alpha_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Alpha_Size; procedure Set_Accumulator_Alpha_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Alpha_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Alpha_Size; function Is_Stereo return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Stereo, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Stereo; procedure Set_Stereo (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Stereo, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Stereo; function Is_Multisampled return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Multisample_Buffers, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Multisampled; procedure Set_Multisampling (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Multisample_Buffers, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Multisampling; function Multisampling_Samples return Multisample_Samples is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Multisample_Samples, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Multisample_Samples (Data); end Multisampling_Samples; procedure Set_Multisampling_Samples (Samples : in Multisample_Samples) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Multisample_Samples, C.int (Samples)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Multisampling_Samples; function Is_Accelerated return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accelerated, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Result = 1); end Is_Accelerated; procedure Set_Accelerated (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Accelerated, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accelerated; function Context_Major_Version return Major_Versions is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Major_Version, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Major_Versions (Data); end Context_Major_Version; procedure Set_Context_Major_Version (Version : Major_Versions) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Major_Version, C.int (Version)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Major_Version; function Context_Minor_Version return Minor_Versions is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Minor_Version, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Minor_Versions (Data); end Context_Minor_Version; procedure Set_Context_Minor_Version (Version : Minor_Versions) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Minor_Version, C.int (Version)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Minor_Version; function Is_Context_EGL return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_EGL, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Context_EGL; procedure Set_Context_EGL (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_EGL, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_EGL; function Context_Flags return Flags is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Flags, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Flags (Data); end Context_Flags; procedure Set_Context_Flags (Context_Flags : in Flags) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Flags, C.int (Context_Flags)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Flags; function Context_Profile return Profiles is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Profile, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Profiles'Val (Data); end Context_Profile; procedure Set_Context_Profile (Profile : in Profiles) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Profile, C.int (Profile_Values (Profile))); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Profile; function Is_Sharing_With_Current_Context return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Share_With_Current_Context, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Sharing_With_Current_Context; procedure Set_Share_With_Current_Context (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Share_With_Current_Context, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Share_With_Current_Context; -- Some helper functions to get make this type work ok. function Get_Address (Window : in SDL.Video.Windows.Window) return System.Address with Import => True, Convention => Ada; function Get_Address (Texture : in SDL.Video.Textures.Texture) return System.Address with Import => True, Convention => Ada; -- The GL context. procedure Create (Self : in out Contexts; From : in SDL.Video.Windows.Window) is function SDL_GL_Create_Context (W : in System.Address) return System.Address with Import => True, Convention => C, External_Name => "SDL_GL_CreateContext"; C : System.Address := SDL_GL_Create_Context (Get_Address (Window => From)); begin if C = System.Null_Address then raise SDL_GL_Error with SDL.Error.Get; end if; Self.Internal := C; Self.Own := True; end Create; procedure Finalize (Self : in out Contexts) is procedure SDL_GL_Delete_Context (W : in System.Address) with Import => True, Convention => C, External_Name => "SDL_GL_DeleteContext"; begin -- We have to own this pointer before we go any further... -- and make sure we don't delete this twice if we do! if Self.Own and then Self.Internal /= System.Null_Address then SDL_GL_Delete_Context (Self.Internal); Self.Internal := System.Null_Address; end if; end Finalize; -- TODO: Make sure we make all similar functions across the API match this pattern. -- Create a temporary Context. function Get_Current return Contexts is function SDL_GL_Get_Current_Context return System.Address with Import => True, Convention => C, External_Name => "SDL_GL_GetCurrentContext"; begin return C : constant Contexts := (Ada.Finalization.Limited_Controlled with Internal => SDL_GL_Get_Current_Context, Own => False) do if C.Internal = System.Null_Address then raise SDL_GL_Error with SDL.Error.Get; end if; end return; end Get_Current; procedure Set_Current (Self : in Contexts; To : in SDL.Video.Windows.Window) is function SDL_GL_Make_Current (W, Context : in System.Address) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_MakeCurrent"; Result : C.int := SDL_GL_Make_Current (Self.Internal, Get_Address (Window => To)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Current; function Supports (Extension : in String) return Boolean is function SDL_GL_Extension_Supported (E : in C.Strings.chars_ptr) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_ExtensionSupported"; C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Extension); Result : C.int := SDL_GL_Extension_Supported (C_Name_Str); begin C.Strings.Free (C_Name_Str); return (Result = SDL_True); end Supports; function Get_Swap_Interval return Swap_Intervals is function SDL_GL_Get_Swap_Interval return Swap_Intervals with Import => True, Convention => C, External_Name => "SDL_GL_GetSwapInterval"; begin return SDL_GL_Get_Swap_Interval; end Get_Swap_Interval; function Set_Swap_Interval (Interval : in Allowed_Swap_Intervals; Late_Swap_Tear : in Boolean) return Boolean is function SDL_GL_Set_Swap_Interval (Interval : in Swap_Intervals) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_SetSwapInterval"; Late_Tearing : Swap_Intervals Renames Not_Supported; Result : C.int; begin if Late_Swap_Tear then -- Override the interval passed. Result := SDL_GL_Set_Swap_Interval (Late_Tearing); if Result = -1 then -- Try again with synchronised. Result := SDL_GL_Set_Swap_Interval (Synchronised); return (if Result = -1 then False else True); elsif Result = Success then return True; else raise SDL_GL_Error with "Something unexpected happend whilst setting swap interval."; end if; end if; Result := SDL_GL_Set_Swap_Interval (Synchronised); return (if Result = -1 then False else True); end Set_Swap_Interval; procedure Swap (Window : in out SDL.Video.Windows.Window) is procedure SDL_GL_Swap_Window (W : in System.Address) with Import => True, Convention => C, External_Name => "SDL_GL_SwapWindow"; begin SDL_GL_Swap_Window (Get_Address (Window)); end Swap; end SDL.Video.GL;
zhmu/ananas
Ada
120
adb
with System; with Ada.Text_IO; procedure Impbit is begin Ada.Text_IO.Put_Line (System.Address'Size'Img); end Impbit;
flyx/OpenGLAda
Ada
1,611
adb
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.API; with GL.Enums.Getter; package body GL.Framebuffer is procedure Set_Clamp_Read_Color (Enabled : Boolean) is begin API.Clamp_Color (Enums.Clamp_Read_Color, Low_Level.Bool (Enabled)); end Set_Clamp_Read_Color; procedure Set_Read_Buffer (Value : Read_Buffer_Selector) is begin API.Read_Buffer (Value); Raise_Exception_On_OpenGL_Error; end Set_Read_Buffer; function Read_Buffer return Read_Buffer_Selector is Ret : aliased Read_Buffer_Selector; begin API.Get_Read_Buffer_Selector (Enums.Getter.Read_Buffer, Ret'Access); Raise_Exception_On_OpenGL_Error; return Ret; end Read_Buffer; procedure Read_Pixels (X, Y : Int; Width, Height : Size; Format : Pixels.Framebuffer_Format; Data_Type : Pixels.Data_Type; Data : out Array_Type) is begin API.Read_Pixels (X, Y, Width, Height, Format, Data_Type, Data (Data'First)'Address); Raise_Exception_On_OpenGL_Error; end Read_Pixels; procedure Set_Logic_Op_Mode (Value : Logic_Op) is begin API.Logic_Op (Value); Raise_Exception_On_OpenGL_Error; end Set_Logic_Op_Mode; function Logic_Op_Mode return Logic_Op is Ret : aliased Logic_Op; begin API.Get_Logic_Op (Enums.Getter.Logic_Op_Mode, Ret'Access); Raise_Exception_On_OpenGL_Error; return Ret; end Logic_Op_Mode; end GL.Framebuffer;
reznikmm/matreshka
Ada
3,689
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Mode_Attributes is pragma Preelaborate; type ODF_Table_Mode_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Mode_Attribute_Access is access all ODF_Table_Mode_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Mode_Attributes;
reznikmm/matreshka
Ada
4,719
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Table_Operation_Elements; package Matreshka.ODF_Table.Operation_Elements is type Table_Operation_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Operation_Elements.ODF_Table_Operation with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Operation_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Operation_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Operation_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Table_Operation_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Table_Operation_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Table.Operation_Elements;
zhmu/ananas
Ada
4,737
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . D E C I M A L _ I O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- In Ada 95, the package Ada.Text_IO.Decimal_IO is a subpackage of Text_IO. -- This is for compatibility with Ada 83. In GNAT we make it a child package -- to avoid loading the necessary code if Decimal_IO is not instantiated. -- See routine Rtsfind.Check_Text_IO_Special_Unit for a description of how -- we patch up the difference in semantics so that it is invisible to the -- Ada programmer. private generic type Num is delta <> digits <>; package Ada.Text_IO.Decimal_IO is Default_Fore : Field := Num'Fore; Default_Aft : Field := Num'Aft; Default_Exp : Field := 0; procedure Get (File : File_Type; Item : out Num; Width : Field := 0) with Pre => Is_Open (File) and then Mode (File) = In_File, Global => (In_Out => File_System); procedure Get (Item : out Num; Width : Field := 0) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Put (File : File_Type; Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) with Pre => Is_Open (File) and then Mode (File) /= In_File, Post => Line_Length (File)'Old = Line_Length (File) and Page_Length (File)'Old = Page_Length (File), Global => (In_Out => File_System); procedure Put (Item : Num; Fore : Field := Default_Fore; Aft : Field := Default_Aft; Exp : Field := Default_Exp) with Post => Line_Length'Old = Line_Length and Page_Length'Old = Page_Length, Global => (In_Out => File_System); procedure Get (From : String; Item : out Num; Last : out Positive) with Global => null; procedure Put (To : out String; Item : Num; Aft : Field := Default_Aft; Exp : Field := Default_Exp) with Global => null; private pragma Inline (Get); pragma Inline (Put); end Ada.Text_IO.Decimal_IO;
charlie5/lace
Ada
4,310
ads
with openGL.Shader, openGL.Variable.uniform, openGL.Attribute, openGL.Light; private with GL; package openGL.Program -- -- Models an openGL program. -- is type Item is tagged limited private; type View is access all Item'Class; --------- --- Forge -- procedure define (Self : in out Item) is null; procedure define (Self : in out Item; use_vertex_Shader : in Shader.view; use_fragment_Shader : in Shader.view); procedure define (Self : in out Item; use_vertex_Shader_File : in String; use_fragment_Shader_File : in String); procedure destroy (Self : in out Item); ---------------------- -- Program Parameters -- -- These are used by individual visuals which require program Uniforms to vary from visual to visual. -- The Parmaters type is extended to contain the required varying data and 'enable' is overridden to -- apply the varying data to the programs Uniforms. 'enable' is called as part of the rendering process -- just prior to the visuals geometry being rendered. -- -- (See 'gel.Human' for an example of usage.) type Parameters is limited new openGL.Parameters with private; type Parameters_view is access all Parameters'Class; procedure Program_is (Self : in out Parameters; Now : in Program.view); function Program (Self : in Parameters) return Program.view; procedure enable (Self : in out Parameters) is null; -------------- -- Attributes -- function is_defined (Self : in Item'Class) return Boolean; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.bool; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.int; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.float; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.vec3; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.vec4; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.mat3; function uniform_Variable (Self : access Item'Class; Named : in String) return Variable.uniform.mat4; function Attribute (Self : access Item'Class; Named : in String) return Attribute.view; function attribute_Location (Self : access Item'Class; Named : in String) return gl.GLuint; function ProgramInfoLog (Self : in Item) return String; -- TODO: Better name. -------------- -- Operations -- procedure add (Self : in out Item; Attribute : in openGL.Attribute.view); procedure enable (Self : in out Item); procedure enable_Attributes (Self : in Item); ------------ -- Uniforms -- procedure mvp_Transform_is (Self : in out Item; Now : in Matrix_4x4); procedure camera_Site_is (Self : in out Item; Now : in Vector_3) is null; procedure model_Matrix_is (Self : in out Item; Now : in Matrix_4x4) is null; procedure Lights_are (Self : in out Item; Now : in Light.items) is null; procedure Scale_is (Self : in out Item; Now : in Vector_3); procedure set_Uniforms (Self : in Item); ---------- -- Privvy TODO: move this to privvy child package. -- subtype a_gl_Program is gl.GLuint; function gl_Program (Self : in Item) return a_gl_Program; private type Item is tagged limited record gl_Program : gl.GLuint := 0; vertex_Shader : Shader.view; fragment_Shader : Shader.view; Attributes : openGL.Attribute.views (1 .. 8); attribute_Count : Natural := 0; mvp_Transform : Matrix_4x4; Scale : Vector_3 := [1.0, 1.0, 1.0]; end record; ------------- -- Parameters -- type Parameters is limited new openGL.Parameters with record Program : openGL.Program.view; end record; end openGL.Program;
reznikmm/matreshka
Ada
4,836
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; with Matreshka.XML_Schema.AST.Types; package Matreshka.XML_Schema.AST.Assertions is pragma Preelaborate; type Assertion_Node is new Abstract_Node with record -- Properties: -- Annotations : Types.Annotation_Lists.List; -- {annotations} -- A sequence of Annotation components. Test : Types.XPath_Expression; -- {test} -- An XPath Expression property record. Required. end record; overriding procedure Enter_Node (Self : not null access Assertion_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Node (Self : not null access Assertion_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Node (Self : not null access Assertion_Node; Iterator : in out Matreshka.XML_Schema.Visitors.Abstract_Iterator'Class; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end Matreshka.XML_Schema.AST.Assertions;
sungyeon/drake
Ada
4,664
adb
with Ada.Exception_Identification.From_Here; with System.Zero_Terminated_Strings; with C.errno; with C.fcntl; with C.stdio; -- rename(2) with C.sys.sendfile; with C.unistd; package body System.Native_Directories.Copying is use Ada.Exception_Identification.From_Here; use type Ada.Exception_Identification.Exception_Id; use type C.signed_int; use type C.unsigned_short; -- mode_t in FreeBSD use type C.unsigned_int; -- open flag, and mode_t in Linux use type C.signed_long; -- 64bit ssize_t use type C.size_t; -- implementation procedure Copy_File ( Source_Name : String; Target_Name : String; Overwrite : Boolean := True) is Exception_Id : Ada.Exception_Identification.Exception_Id := Ada.Exception_Identification.Null_Id; C_Source_Name : C.char_array ( 0 .. Source_Name'Length * Zero_Terminated_Strings.Expanding); Source : C.signed_int; C_Target_Name : C.char_array ( 0 .. Target_Name'Length * Zero_Terminated_Strings.Expanding); Target : C.signed_int; Flag : C.unsigned_int; Data : aliased C.sys.stat.struct_stat; Written : C.sys.types.ssize_t; begin Zero_Terminated_Strings.To_C (Source_Name, C_Source_Name (0)'Access); Zero_Terminated_Strings.To_C (Target_Name, C_Target_Name (0)'Access); Source := C.fcntl.open (C_Source_Name (0)'Access, C.fcntl.O_RDONLY); if Source < 0 then Exception_Id := Named_IO_Exception_Id (C.errno.errno); else if C.sys.stat.fstat (Source, Data'Access) < 0 then Exception_Id := IO_Exception_Id (C.errno.errno); else Flag := C.fcntl.O_WRONLY or C.fcntl.O_CREAT or C.fcntl.O_EXLOCK; if not Overwrite then Flag := Flag or C.fcntl.O_EXCL; end if; Target := C.fcntl.open ( C_Target_Name (0)'Access, C.signed_int (Flag), Data.st_mode); if Target < 0 then Exception_Id := Named_IO_Exception_Id (C.errno.errno); else if C.unistd.ftruncate (Target, Data.st_size) < 0 then null; end if; Written := C.sys.sendfile.sendfile ( Target, Source, null, C.size_t (Data.st_size)); if Written < C.sys.types.ssize_t (Data.st_size) then Exception_Id := Device_Error'Identity; end if; -- close target if C.unistd.close (Target) < 0 and then Exception_Id = Ada.Exception_Identification.Null_Id then Exception_Id := IO_Exception_Id (C.errno.errno); end if; end if; end if; -- close source if C.unistd.close (Source) < 0 and then Exception_Id = Ada.Exception_Identification.Null_Id then Exception_Id := IO_Exception_Id (C.errno.errno); end if; end if; -- raising if Exception_Id /= Ada.Exception_Identification.Null_Id then Raise_Exception (Exception_Id); end if; end Copy_File; procedure Replace_File ( Source_Name : String; Target_Name : String) is C_Source_Name : C.char_array ( 0 .. Source_Name'Length * Zero_Terminated_Strings.Expanding); C_Target_Name : C.char_array ( 0 .. Target_Name'Length * Zero_Terminated_Strings.Expanding); Target_Info : aliased C.sys.stat.struct_stat; Error : Boolean; begin Zero_Terminated_Strings.To_C (Source_Name, C_Source_Name (0)'Access); Zero_Terminated_Strings.To_C (Target_Name, C_Target_Name (0)'Access); -- if the target is already existing, -- copy attributes from the target to the source. Error := False; if C.sys.stat.lstat (C_Target_Name (0)'Access, Target_Info'Access) = 0 and then (Target_Info.st_mode and C.sys.stat.S_IFMT) /= C.sys.stat.S_IFLNK -- Linux does not have lchmod then Error := C.sys.stat.chmod ( C_Source_Name (0)'Access, Target_Info.st_mode and C.sys.stat.ALLPERMS) < 0; end if; if not Error then -- overwrite the target with the source. Error := C.stdio.rename ( C_Source_Name (0)'Access, C_Target_Name (0)'Access) < 0; end if; if Error then Raise_Exception (Named_IO_Exception_Id (C.errno.errno)); end if; end Replace_File; end System.Native_Directories.Copying;
zhmu/ananas
Ada
9,051
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 4 8 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; package body System.Pack_48 is subtype Bit_Order is System.Bit_Order; Reverse_Bit_Order : constant Bit_Order := Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order)); subtype Ofs is System.Storage_Elements.Storage_Offset; subtype Uns is System.Unsigned_Types.Unsigned; subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7; use type System.Storage_Elements.Storage_Offset; use type System.Unsigned_Types.Unsigned; type Cluster is record E0, E1, E2, E3, E4, E5, E6, E7 : Bits_48; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_Cluster_Ref is access Rev_Cluster; -- The following declarations are for the case where the address -- passed to GetU_48 or SetU_48 is not guaranteed to be aligned. -- These routines are used when the packed array is itself a -- component of a packed record, and therefore may not be aligned. type ClusterU is new Cluster; for ClusterU'Alignment use 1; type ClusterU_Ref is access ClusterU; type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_ClusterU_Ref is access Rev_ClusterU; ------------ -- Get_48 -- ------------ function Get_48 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_48 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end Get_48; ------------- -- GetU_48 -- ------------- function GetU_48 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_48 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : ClusterU_Ref with Address => A'Address, Import; RC : Rev_ClusterU_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end GetU_48; ------------ -- Set_48 -- ------------ procedure Set_48 (Arr : System.Address; N : Natural; E : Bits_48; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end Set_48; ------------- -- SetU_48 -- ------------- procedure SetU_48 (Arr : System.Address; N : Natural; E : Bits_48; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : ClusterU_Ref with Address => A'Address, Import; RC : Rev_ClusterU_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end SetU_48; end System.Pack_48;
charlesdaniels/libagar
Ada
18,915
ads
with agar.core.object; with agar.core.slist; with agar.core.threads; with agar.core.types; with agar.gui.colors; with agar.gui.rect; with agar.gui.surface; with interfaces.c.strings; package agar.gui.widget is package cs renames interfaces.c.strings; -- -- forward declarations -- type widget_t; type widget_access_t is access all widget_t; pragma convention (c, widget_access_t); type binding_t; type binding_access_t is access all binding_t; pragma convention (c, binding_access_t); -- this is necessary because of a circular dependency issue -- (widget -> menu -> widget) type fake_popup_menu_access_t is access all agar.core.types.void_ptr_t; pragma convention (c, fake_popup_menu_access_t); package binding_slist is new agar.core.slist (entry_type => binding_access_t); package menu_slist is new agar.core.slist (entry_type => fake_popup_menu_access_t); -- -- constants -- binding_name_max : constant c.unsigned := 16; -- -- types -- type size_req_t is record w : c.int; h : c.int; end record; type size_req_access_t is access all size_req_t; pragma convention (c, size_req_t); pragma convention (c, size_req_access_t); type size_alloc_t is record w : c.int; h : c.int; x : c.int; y : c.int; end record; type size_alloc_access_t is access all size_alloc_t; pragma convention (c, size_alloc_t); pragma convention (c, size_alloc_access_t); type class_t is record inherit : agar.core.object.class_t; draw : access procedure (vp : agar.core.types.void_ptr_t); size_request : access procedure (vp : agar.core.types.void_ptr_t; req : size_req_access_t); size_allocate : access function (vp : agar.core.types.void_ptr_t; alloc : size_alloc_access_t) return c.int; end record; type class_access_t is access all class_t; pragma convention (c, class_t); pragma convention (c, class_access_t); type binding_type_t is ( WIDGET_NONE, WIDGET_BOOL, WIDGET_UINT, WIDGET_INT, WIDGET_UINT8, WIDGET_SINT8, WIDGET_UINT16, WIDGET_SINT16, WIDGET_UINT32, WIDGET_SINT32, WIDGET_UINT64, WIDGET_SINT64, WIDGET_FLOAT, WIDGET_DOUBLE, WIDGET_LONG_DOUBLE, WIDGET_STRING, WIDGET_POINTER, WIDGET_PROP, WIDGET_FLAG, WIDGET_FLAG8, WIDGET_FLAG16, WIDGET_FLAG32 ); for binding_type_t use ( WIDGET_NONE => 0, WIDGET_BOOL => 1, WIDGET_UINT => 2, WIDGET_INT => 3, WIDGET_UINT8 => 4, WIDGET_SINT8 => 5, WIDGET_UINT16 => 6, WIDGET_SINT16 => 7, WIDGET_UINT32 => 8, WIDGET_SINT32 => 9, WIDGET_UINT64 => 10, WIDGET_SINT64 => 11, WIDGET_FLOAT => 12, WIDGET_DOUBLE => 13, WIDGET_LONG_DOUBLE => 14, WIDGET_STRING => 15, WIDGET_POINTER => 16, WIDGET_PROP => 17, WIDGET_FLAG => 18, WIDGET_FLAG8 => 19, WIDGET_FLAG16 => 20, WIDGET_FLAG32 => 21 ); for binding_type_t'size use c.unsigned'size; pragma convention (c, binding_type_t); type size_spec_t is ( WIDGET_BAD_SPEC, WIDGET_PIXELS, WIDGET_PERCENT, WIDGET_STRINGLEN, WIDGET_FILL ); for size_spec_t use ( WIDGET_BAD_SPEC => 0, WIDGET_PIXELS => 1, WIDGET_PERCENT => 2, WIDGET_STRINGLEN => 3, WIDGET_FILL => 4 ); for size_spec_t'size use c.unsigned'size; pragma convention (c, size_spec_t); type flag_descr_t is record bitmask : c.unsigned; descr : cs.chars_ptr; writeable : c.int; end record; type flag_descr_access_t is access all flag_descr_t; pragma convention (c, flag_descr_t); pragma convention (c, flag_descr_access_t); type binding_name_t is array (1 .. binding_name_max) of aliased c.char; pragma convention (c, binding_name_t); type binding_data_prop_t is array (1 .. agar.core.object.prop_key_max) of aliased c.char; pragma convention (c, binding_data_prop_t); type binding_data_union_selector_t is (prop, size, mask); type binding_data_union_t (selector : binding_data_union_selector_t := prop) is record case selector is when prop => prop : binding_data_prop_t; when size => size : c.size_t; when mask => mask : agar.core.types.uint32_t; end case; end record; pragma convention (c, binding_data_union_t); pragma unchecked_union (binding_data_union_t); type binding_t is record name : binding_name_t; binding_type : c.int; mutex : agar.core.threads.mutex_t; p1 : agar.core.types.void_ptr_t; data : binding_data_union_t; bindings : binding_slist.entry_t; end record; pragma convention (c, binding_t); type color_t is array (1 .. 4) of aliased agar.core.types.uint8_t; pragma convention (c, color_t); type surface_id_t is new c.int; pragma convention (c, surface_id_t); subtype flags_t is c.unsigned; -- widget type type widget_private_t is limited private; type widget_t is record object : aliased agar.core.object.object_t; flags : c.unsigned; x : c.int; y : c.int; w : c.int; h : c.int; privdata : widget_private_t; end record; pragma convention (c, widget_t); -- -- API -- procedure expand (widget : widget_access_t); pragma import (c, expand, "agar_widget_expand"); procedure expand_horizontal (widget : widget_access_t); pragma import (c, expand_horizontal, "agar_widget_expand_horizontal"); procedure expand_vertical (widget : widget_access_t); pragma import (c, expand_vertical, "agar_widget_expand_vertical"); procedure size_request (widget : widget_access_t; request : size_req_t); pragma import (c, size_request, "AG_WidgetSizeReq"); function size_allocate (widget : widget_access_t; alloc : size_alloc_t) return boolean; pragma inline (size_allocate); -- input state procedure enable (widget : widget_access_t); pragma import (c, enable, "agar_widget_enable"); procedure disable (widget : widget_access_t); pragma import (c, disable, "agar_widget_disable"); function enabled (widget : widget_access_t) return boolean; pragma inline (enabled); function disabled (widget : widget_access_t) return boolean; pragma inline (disabled); -- focus function focused (widget : widget_access_t) return boolean; pragma inline (focused); procedure focus (widget : widget_access_t); pragma import (c, focus, "AG_WidgetFocus"); procedure unfocus (widget : widget_access_t); pragma import (c, unfocus, "AG_WidgetUnfocus"); -- missing: find_focused moved to agar.gui.window -- blitting function map_surface (widget : widget_access_t; surface : agar.gui.surface.surface_access_t) return surface_id_t; pragma import (c, map_surface, "AG_WidgetMapSurface"); function map_surface_no_copy (widget : widget_access_t; surface : agar.gui.surface.surface_access_t) return surface_id_t; pragma import (c, map_surface_no_copy, "AG_WidgetMapSurfaceNODUP"); procedure replace_surface (widget : widget_access_t; surface_id : surface_id_t; surface : agar.gui.surface.surface_access_t); pragma import (c, replace_surface, "AG_WidgetReplaceSurface"); procedure replace_surface_no_copy (widget : widget_access_t; surface_id : surface_id_t; surface : agar.gui.surface.surface_access_t); pragma import (c, replace_surface_no_copy, "AG_WidgetReplaceSurfaceNODUP"); procedure unmap_surface (widget : widget_access_t; surface_id : surface_id_t); pragma import (c, unmap_surface, "agar_widget_unmap_surface"); procedure update_surface (widget : widget_access_t; surface_id : surface_id_t); pragma import (c, update_surface, "agar_widget_update_surface"); procedure blit (widget : widget_access_t; surface : agar.gui.surface.surface_access_t; x : natural; y : natural); pragma inline (blit); procedure blit_from (dest_widget : widget_access_t; src_widget : widget_access_t; surface_id : surface_id_t; rect : agar.gui.rect.rect_access_t; x : integer; y : integer); pragma inline (blit_from); procedure blit_surface (widget : widget_access_t; surface_id : surface_id_t; x : integer; y : integer); pragma inline (blit_surface); -- rendering procedure push_clip_rect (widget : widget_access_t; rect : agar.gui.rect.rect_t); pragma import (c, push_clip_rect, "AG_PushClipRect"); procedure pop_clip_rect (widget : widget_access_t); pragma import (c, pop_clip_rect, "AG_PopClipRect"); -- missing: push_cursor - documented but apparently not implemented -- missing: pop_cursor procedure put_pixel (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.color_t); pragma inline (put_pixel); procedure put_pixel32 (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.uint32_t); pragma inline (put_pixel32); procedure put_pixel_rgb (widget : widget_access_t; x : natural; y : natural; r : agar.core.types.uint8_t; g : agar.core.types.uint8_t; b : agar.core.types.uint8_t); pragma inline (put_pixel_rgb); procedure blend_pixel_rgba (widget : widget_access_t; x : natural; y : natural; color : color_t; func : agar.gui.colors.blend_func_t); pragma inline (blend_pixel_rgba); procedure blend_pixel_32 (widget : widget_access_t; x : natural; y : natural; color : agar.core.types.uint32_t; func : agar.gui.colors.blend_func_t); pragma inline (blend_pixel_32); -- misc function find_point (class_mask : string; x : natural; y : natural) return widget_access_t; pragma inline (find_point); function find_rect (class_mask : string; x : natural; y : natural; w : positive; h : positive) return widget_access_t; pragma inline (find_rect); -- coordinates function absolute_coords_inside (widget : widget_access_t; x : natural; y : natural) return boolean; pragma inline (absolute_coords_inside); function relative_coords_inside (widget : widget_access_t; x : natural; y : natural) return boolean; pragma inline (relative_coords_inside); -- position and size setting procedure set_position (widget : widget_access_t; x : natural; y : natural); pragma inline (set_position); procedure modify_position (widget : widget_access_t; x : integer := 0; y : integer := 0); pragma inline (modify_position); procedure set_size (widget : widget_access_t; width : positive; height : positive); pragma inline (set_size); procedure modify_size (widget : widget_access_t; width : integer := 0; height : integer := 0); pragma inline (modify_size); -- 'casting' function object (widget : widget_access_t) return agar.core.object.object_access_t; pragma inline (object); -- bindings package bindings is procedure bind_pointer (widget : widget_access_t; binding : string; variable : agar.core.types.void_ptr_t); pragma inline (bind_pointer); procedure bind_property (widget : widget_access_t; binding : string; object : agar.core.object.object_access_t; name : string); pragma inline (bind_property); procedure bind_boolean (widget : widget_access_t; binding : string; variable : agar.core.types.boolean_access_t); pragma inline (bind_boolean); procedure bind_integer (widget : widget_access_t; binding : string; variable : agar.core.types.integer_access_t); pragma inline (bind_integer); procedure bind_unsigned (widget : widget_access_t; binding : string; variable : agar.core.types.unsigned_access_t); pragma inline (bind_unsigned); procedure bind_float (widget : widget_access_t; binding : string; variable : agar.core.types.float_access_t); pragma inline (bind_float); procedure bind_double (widget : widget_access_t; binding : string; variable : agar.core.types.double_access_t); pragma inline (bind_double); procedure bind_uint8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_ptr_t); pragma inline (bind_uint8); procedure bind_int8 (widget : widget_access_t; binding : string; variable : agar.core.types.int8_ptr_t); pragma inline (bind_int8); procedure bind_flag8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_ptr_t; mask : agar.core.types.uint8_t); pragma inline (bind_flag8); procedure bind_uint16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_ptr_t); pragma inline (bind_uint16); procedure bind_int16 (widget : widget_access_t; binding : string; variable : agar.core.types.int16_ptr_t); pragma inline (bind_int16); procedure bind_flag16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_ptr_t; mask : agar.core.types.uint16_t); pragma inline (bind_flag16); procedure bind_uint32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_ptr_t); pragma inline (bind_uint32); procedure bind_int32 (widget : widget_access_t; binding : string; variable : agar.core.types.int32_ptr_t); pragma inline (bind_int32); procedure bind_flag32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_ptr_t; mask : agar.core.types.uint32_t); pragma inline (bind_flag32); -- get function get_pointer (widget : widget_access_t; binding : string) return agar.core.types.void_ptr_t; pragma inline (get_pointer); function get_boolean (widget : widget_access_t; binding : string) return agar.core.types.boolean_t; pragma inline (get_boolean); function get_integer (widget : widget_access_t; binding : string) return agar.core.types.integer_t; pragma inline (get_integer); function get_unsigned (widget : widget_access_t; binding : string) return agar.core.types.unsigned_t; pragma inline (get_unsigned); function get_float (widget : widget_access_t; binding : string) return agar.core.types.float_t; pragma inline (get_float); function get_double (widget : widget_access_t; binding : string) return agar.core.types.double_t; pragma inline (get_double); function get_uint8 (widget : widget_access_t; binding : string) return agar.core.types.uint8_t; pragma inline (get_uint8); function get_int8 (widget : widget_access_t; binding : string) return agar.core.types.int8_t; pragma inline (get_int8); function get_uint16 (widget : widget_access_t; binding : string) return agar.core.types.uint16_t; pragma inline (get_uint16); function get_int16 (widget : widget_access_t; binding : string) return agar.core.types.int16_t; pragma inline (get_int16); function get_uint32 (widget : widget_access_t; binding : string) return agar.core.types.uint32_t; pragma inline (get_uint32); function get_int32 (widget : widget_access_t; binding : string) return agar.core.types.int32_t; pragma inline (get_int32); -- set procedure set_pointer (widget : widget_access_t; binding : string; variable : agar.core.types.void_ptr_t); pragma inline (set_pointer); procedure set_boolean (widget : widget_access_t; binding : string; variable : agar.core.types.boolean_t); pragma inline (set_boolean); procedure set_integer (widget : widget_access_t; binding : string; variable : agar.core.types.integer_t); pragma inline (set_integer); procedure set_unsigned (widget : widget_access_t; binding : string; variable : agar.core.types.unsigned_t); pragma inline (set_unsigned); procedure set_float (widget : widget_access_t; binding : string; variable : agar.core.types.float_t); pragma inline (set_float); procedure set_double (widget : widget_access_t; binding : string; variable : agar.core.types.double_t); pragma inline (set_double); procedure set_uint8 (widget : widget_access_t; binding : string; variable : agar.core.types.uint8_t); pragma inline (set_uint8); procedure set_int8 (widget : widget_access_t; binding : string; variable : agar.core.types.int8_t); pragma inline (set_int8); procedure set_uint16 (widget : widget_access_t; binding : string; variable : agar.core.types.uint16_t); pragma inline (set_uint16); procedure set_int16 (widget : widget_access_t; binding : string; variable : agar.core.types.int16_t); pragma inline (set_int16); procedure set_uint32 (widget : widget_access_t; binding : string; variable : agar.core.types.uint32_t); pragma inline (set_uint32); procedure set_int32 (widget : widget_access_t; binding : string; variable : agar.core.types.int32_t); pragma inline (set_int32); end bindings; private -- widget type type widget_private_t is record r_view : agar.gui.rect.rect2_t; r_sens : agar.gui.rect.rect2_t; surfaces : access agar.gui.surface.surface_access_t; surface_flags : access c.unsigned; nsurfaces : c.unsigned; -- openGL textures : access c.unsigned; texcoords : access c.c_float; texture_gc : access c.unsigned; ntextures_gc : c.unsigned; bindings_lock : agar.core.threads.mutex_t; bindings : binding_slist.head_t; menus : menu_slist.head_t; end record; pragma convention (c, widget_private_t); end agar.gui.widget;
tum-ei-rcs/StratoX
Ada
2,756
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . I M G _ B O O L -- -- -- -- 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. -- -- -- -- -- -- -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Boolean'Image package System.Img_Bool is pragma Pure; procedure Image_Boolean (V : Boolean; S : in out String; P : out Natural); -- Computes Boolean'Image (V) and stores the result in S (1 .. P) -- setting the resulting value of P. The caller guarantees that S -- is long enough to hold the result, and that S'First is 1. end System.Img_Bool;
micahwelf/FLTK-Ada
Ada
809
ads
package FLTK.Widgets.Valuators.Rollers is type Roller is new Valuator with private; type Roller_Reference (Data : not null access Roller'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Roller; end Forge; procedure Draw (This : in out Roller); function Handle (This : in out Roller; Event : in Event_Kind) return Event_Outcome; private type Roller is new Valuator with null record; overriding procedure Finalize (This : in out Roller); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Valuators.Rollers;
sungyeon/drake
Ada
3,818
ads
pragma License (Unrestricted); -- extended unit with Ada.IO_Exceptions; with Ada.IO_Modes; with Ada.Streams.Stream_IO; with System.Storage_Elements; private with Ada.Finalization; private with Ada.Streams.Naked_Stream_IO; private with System.Native_IO; package Ada.Storage_Mapped_IO is -- Memory-mapped I/O. type File_Mode is new IO_Modes.Inout_File_Mode; type Storage_Type is limited private; -- subtype Mapped_Storage_Type is Storage_Type -- with -- Dynamic_Predicate => Is_Mapped (Mapped_Storage_Type), -- Predicate_Failure => raise Status_Error; function Is_Mapped (Object : Storage_Type) return Boolean; pragma Inline (Is_Mapped); procedure Map ( Object : in out Storage_Type; File : Streams.Stream_IO.File_Type; Form : String; -- removed default Offset : Streams.Stream_IO.Positive_Count := 1; Size : Streams.Stream_IO.Count := 0); procedure Map ( Object : in out Storage_Type; File : Streams.Stream_IO.File_Type; Private_Copy : Boolean := False; Offset : Streams.Stream_IO.Positive_Count := 1; Size : Streams.Stream_IO.Count := 0); function Map ( File : Streams.Stream_IO.File_Type; Private_Copy : Boolean := False; Offset : Streams.Stream_IO.Positive_Count := 1; Size : Streams.Stream_IO.Count := 0) return Storage_Type; procedure Map ( Object : in out Storage_Type; Mode : File_Mode := In_File; Name : String; Form : String; -- removed default Offset : Streams.Stream_IO.Positive_Count := 1; Size : Streams.Stream_IO.Count := 0); procedure Map ( Object : in out Storage_Type; Mode : File_Mode := In_File; Name : String; Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode; Wait : Boolean := False; Overwrite : Boolean := True; Private_Copy : Boolean := False; Offset : Streams.Stream_IO.Positive_Count := 1; Size : Streams.Stream_IO.Count := 0); function Map ( Mode : File_Mode := In_File; Name : String; Shared : IO_Modes.File_Shared_Spec := IO_Modes.By_Mode; Wait : Boolean := False; Overwrite : Boolean := True; Private_Copy : Boolean := False; Offset : Streams.Stream_IO.Positive_Count := 1; Size : Streams.Stream_IO.Count := 0) return Storage_Type; procedure Unmap (Object : in out Storage_Type); function Storage_Address ( Object : Storage_Type) -- Mapped_Storage_Type return System.Address; function Storage_Size ( Object : Storage_Type) -- Mapped_Storage_Type return System.Storage_Elements.Storage_Count; pragma Inline (Storage_Address); pragma Inline (Storage_Size); Status_Error : exception renames IO_Exceptions.Status_Error; Use_Error : exception renames IO_Exceptions.Use_Error; private type Non_Controlled_Mapping is record Mapping : System.Native_IO.Mapping_Type; File : aliased Streams.Naked_Stream_IO.Non_Controlled_File_Type; end record; pragma Suppress_Initialization (Non_Controlled_Mapping); package Controlled is type Storage_Type is limited private; function Reference (Object : Storage_Mapped_IO.Storage_Type) return not null access Non_Controlled_Mapping; pragma Inline (Reference); private type Storage_Type is limited new Finalization.Limited_Controlled with record Data : aliased Non_Controlled_Mapping := ( Mapping => ( Storage_Address => System.Null_Address, others => <>), File => null); end record; overriding procedure Finalize (Object : in out Storage_Type); end Controlled; type Storage_Type is new Controlled.Storage_Type; end Ada.Storage_Mapped_IO;
reznikmm/matreshka
Ada
3,709
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Presentation_Show_Text_Elements is pragma Preelaborate; type ODF_Presentation_Show_Text is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Presentation_Show_Text_Access is access all ODF_Presentation_Show_Text'Class with Storage_Size => 0; end ODF.DOM.Presentation_Show_Text_Elements;
stcarrez/ada-security
Ada
11,035
adb
----------------------------------------------------------------------- -- security-contexts -- Context to provide security information and verify permissions -- Copyright (C) 2011, 2012, 2016, 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.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; -- If we already have a security context, setup the manager and user principal. if Context.Previous /= null then Context.Manager := Context.Previous.Manager; Context.Principal := Context.Previous.Principal; end if; 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 use type Security.Policies.Policy_Manager_Access; begin if Manager /= null then Context.Manager := Manager; end if; if Principal /= null then Context.Principal := Principal; end if; if Manager = null and then Principal = null then raise Invalid_Context with "There is no policy manager and no user principal"; end if; 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;
stcarrez/ada-keystore
Ada
15,864
adb
----------------------------------------------------------------------- -- akt-callbacks -- Callbacks for Ada Keystore GTK application -- Copyright (C) 2019, 2020 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Gtk.Main; with Gtk.Widget; with Gtk.GEntry; with Gtk.File_Filter; with Gtk.File_Chooser; with Gtk.File_Chooser_Dialog; with Gtk.Spin_Button; with Gtk.Window; with Util.Log.Loggers; with Keystore; package body AKT.Callbacks is use type Gtk.Spin_Button.Gtk_Spin_Button; use type Gtk.GEntry.Gtk_Entry; use type Gtk.Widget.Gtk_Widget; -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AKT.Callbacks"); App : AKT.Windows.Application_Access; function Get_Widget (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class; Name : in String) return Gtk.Widget.Gtk_Widget is (Gtk.Widget.Gtk_Widget (Object.Get_Object (Name))); function Get_Entry (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class; Name : in String) return Gtk.GEntry.Gtk_Entry is (Gtk.GEntry.Gtk_Entry (Object.Get_Object (Name))); function Get_Spin_Button (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class; Name : in String) return Gtk.Spin_Button.Gtk_Spin_Button is (Gtk.Spin_Button.Gtk_Spin_Button (Object.Get_Object (Name))); -- ------------------------------ -- Initialize and register the callbacks. -- ------------------------------ procedure Initialize (Application : in AKT.Windows.Application_Access; Builder : in Gtkada.Builder.Gtkada_Builder) is begin App := Application; -- AKT.Callbacks.Application := Application; Builder.Register_Handler (Handler_Name => "menu-quit", Handler => AKT.Callbacks.On_Menu_Quit'Access); -- Open file from menu and dialog. Builder.Register_Handler (Handler_Name => "menu-open", Handler => AKT.Callbacks.On_Menu_Open'Access); Builder.Register_Handler (Handler_Name => "open-file", Handler => AKT.Callbacks.On_Open_File'Access); Builder.Register_Handler (Handler_Name => "cancel-open-file", Handler => AKT.Callbacks.On_Cancel_Open_File'Access); -- Create file from menu and dialog. Builder.Register_Handler (Handler_Name => "menu-new", Handler => AKT.Callbacks.On_Menu_New'Access); Builder.Register_Handler (Handler_Name => "create-file", Handler => AKT.Callbacks.On_Create_File'Access); Builder.Register_Handler (Handler_Name => "cancel-create-file", Handler => AKT.Callbacks.On_Cancel_Create_File'Access); Builder.Register_Handler (Handler_Name => "window-close", Handler => AKT.Callbacks.On_Close_Window'Access); Builder.Register_Handler (Handler_Name => "about", Handler => AKT.Callbacks.On_Menu_About'Access); Builder.Register_Handler (Handler_Name => "close-about", Handler => AKT.Callbacks.On_Close_About'Access); Builder.Register_Handler (Handler_Name => "close-password", Handler => AKT.Callbacks.On_Close_Password'Access); Builder.Register_Handler (Handler_Name => "tool-edit", Handler => AKT.Callbacks.On_Tool_Edit'Access); Builder.Register_Handler (Handler_Name => "tool-lock", Handler => AKT.Callbacks.On_Tool_Lock'Access); Builder.Register_Handler (Handler_Name => "tool-unlock", Handler => AKT.Callbacks.On_Tool_Unlock'Access); Builder.Register_Handler (Handler_Name => "tool-save", Handler => AKT.Callbacks.On_Tool_Save'Access); Builder.Register_Handler (Handler_Name => "tool-add", Handler => AKT.Callbacks.On_Tool_Add'Access); Builder.Register_Handler (Handler_Name => "dialog-password-ok", Handler => AKT.Callbacks.On_Dialog_Password_Ok'Access); end Initialize; -- ------------------------------ -- Callback executed when the "quit" action is executed from the menu. -- ------------------------------ procedure On_Menu_Quit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); begin Gtk.Main.Main_Quit; end On_Menu_Quit; -- ------------------------------ -- Callback executed when the "about" action is executed from the menu. -- ------------------------------ procedure On_Menu_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is About : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "about"); begin About.Show; end On_Menu_About; -- ------------------------------ -- Callback executed when the "menu-new" action is executed from the file menu. -- ------------------------------ procedure On_Menu_New (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Chooser : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "create_file_chooser"); Filter : Gtk.File_Filter.Gtk_File_Filter; File_Chooser : Gtk.File_Chooser.Gtk_File_Chooser; begin if Chooser /= null then File_Chooser := Gtk.File_Chooser_Dialog."+" (Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog (Chooser)); Gtk.File_Filter.Gtk_New (Filter); Gtk.File_Filter.Add_Pattern (Filter, "*.akt"); Gtk.File_Filter.Set_Name (Filter, "Keystore Files"); Gtk.File_Chooser.Add_Filter (File_Chooser, Filter); Gtk.File_Filter.Gtk_New (Filter); Gtk.File_Filter.Add_Pattern (Filter, "*"); Gtk.File_Filter.Set_Name (Filter, "All Files"); Gtk.File_Chooser.Add_Filter (File_Chooser, Filter); end if; Chooser.Show; end On_Menu_New; -- ------------------------------ -- Callback executed when the "menu-open" action is executed from the file menu. -- ------------------------------ procedure On_Menu_Open (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Chooser : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "open_file_chooser"); Filter : Gtk.File_Filter.Gtk_File_Filter; File_Chooser : Gtk.File_Chooser.Gtk_File_Chooser; begin if Chooser /= null then File_Chooser := Gtk.File_Chooser_Dialog."+" (Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog (Chooser)); Gtk.File_Filter.Gtk_New (Filter); Gtk.File_Filter.Add_Pattern (Filter, "*.akt"); Gtk.File_Filter.Set_Name (Filter, "Keystore Files"); Gtk.File_Chooser.Add_Filter (File_Chooser, Filter); Gtk.File_Filter.Gtk_New (Filter); Gtk.File_Filter.Add_Pattern (Filter, "*"); Gtk.File_Filter.Set_Name (Filter, "All Files"); Gtk.File_Chooser.Add_Filter (File_Chooser, Filter); end if; Chooser.Show; end On_Menu_Open; -- ------------------------------ -- Callback executed when the "tool-add" action is executed from the toolbar. -- ------------------------------ procedure On_Tool_Add (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); begin App.Save_Current; App.Refresh_Toolbar; end On_Tool_Add; -- ------------------------------ -- Callback executed when the "tool-save" action is executed from the toolbar. -- ------------------------------ procedure On_Tool_Save (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); begin App.Save_Current; App.Refresh_Toolbar; end On_Tool_Save; -- ------------------------------ -- Callback executed when the "tool-edit" action is executed from the toolbar. -- ------------------------------ procedure On_Tool_Edit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); begin App.Edit_Current; App.Refresh_Toolbar; end On_Tool_Edit; -- ------------------------------ -- Callback executed when the "tool-lock" action is executed from the toolbar. -- ------------------------------ procedure On_Tool_Lock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); begin if not App.Is_Locked then App.Lock; end if; end On_Tool_Lock; -- ------------------------------ -- Callback executed when the "tool-unlock" action is executed from the toolbar. -- ------------------------------ procedure On_Tool_Unlock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Password_Dialog : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "password_dialog"); Widget : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "main"); begin if App.Is_Locked and then Password_Dialog /= null then Gtk.Window.Set_Transient_For (Gtk.Window.Gtk_Window (Password_Dialog), Gtk.Window.Gtk_Window (Widget)); Password_Dialog.Show; end if; end On_Tool_Unlock; -- ------------------------------ -- Callback executed when the "open-file" action is executed from the open_file dialog. -- ------------------------------ procedure On_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Chooser : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "open_file_chooser"); Password : constant Gtk.GEntry.Gtk_Entry := Get_Entry (Object, "open_file_password"); Filename : constant Gtk.GEntry.Gtk_Entry := Get_Entry (Object, "open_file_name"); File_Chooser : Gtk.File_Chooser.Gtk_File_Chooser; begin if Chooser /= null and Password /= null and Filename /= null then if Gtk.GEntry.Get_Text (Password) = "" then App.Message ("Password is empty"); else Chooser.Hide; File_Chooser := Gtk.File_Chooser_Dialog."+" (Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog (Chooser)); Log.Info ("Selected file {0}", Gtk.File_Chooser.Get_Filename (File_Chooser)); App.Open_File (Path => Gtk.File_Chooser.Get_Filename (File_Chooser), Password => Keystore.Create (Gtk.GEntry.Get_Text (Password))); end if; end if; end On_Open_File; -- ------------------------------ -- Callback executed when the "cancel-open-file" action is executed from the open_file dialog. -- ------------------------------ procedure On_Cancel_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Chooser : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "open_file_chooser"); begin Chooser.Hide; end On_Cancel_Open_File; -- ------------------------------ -- Callback executed when the "create-file" action is executed from the open_file dialog. -- ------------------------------ procedure On_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Chooser : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "create_file_chooser"); Password : constant Gtk.GEntry.Gtk_Entry := Get_Entry (Object, "create_file_password"); Filename : constant Gtk.GEntry.Gtk_Entry := Get_Entry (Object, "create_file_name"); Count : constant Gtk.Spin_Button.Gtk_Spin_Button := Get_Spin_Button (Object, "split_data_count"); File_Chooser : Gtk.File_Chooser.Gtk_File_Chooser; begin if Chooser /= null and Password /= null then if Gtk.GEntry.Get_Text (Password) = "" then App.Message ("Password is empty"); else Chooser.Hide; File_Chooser := Gtk.File_Chooser_Dialog."+" (Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog (Chooser)); Log.Info ("Selected file {0}", Gtk.File_Chooser.Get_Filename (File_Chooser)); App.Create_File (Path => Gtk.GEntry.Get_Text (Filename), Storage_Count => Natural (Count.Get_Value_As_Int), Password => Keystore.Create (Gtk.GEntry.Get_Text (Password))); end if; end if; end On_Create_File; -- ------------------------------ -- Callback executed when the "cancel-create-file" action is executed -- from the open_file dialog. -- ------------------------------ procedure On_Cancel_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Chooser : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "create_file_chooser"); begin Chooser.Hide; end On_Cancel_Create_File; -- ------------------------------ -- Callback executed when the "delete-event" action is executed from the main window. -- ------------------------------ function On_Close_Window (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) return Boolean is pragma Unreferenced (Object); begin Gtk.Main.Main_Quit; return True; end On_Close_Window; -- ------------------------------ -- Callback executed when the "close-about" action is executed from the about box. -- ------------------------------ procedure On_Close_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is About : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "about"); begin About.Hide; end On_Close_About; -- ------------------------------ -- Callback executed when the "close-password" action is executed from the password dialog. -- ------------------------------ procedure On_Close_Password (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Password_Dialog : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "password_dialog"); begin if Password_Dialog /= null then Password_Dialog.Hide; end if; end On_Close_Password; -- ------------------------------ -- Callback executed when the "dialog-password-ok" action is executed from the password dialog. -- ------------------------------ procedure On_Dialog_Password_Ok (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) is Password_Dialog : constant Gtk.Widget.Gtk_Widget := Get_Widget (Object, "password_dialog"); Password : constant Gtk.GEntry.Gtk_Entry := Get_Entry (Object, "password"); begin if Password_Dialog /= null and Password /= null then if Gtk.GEntry.Get_Text (Password) = "" then App.Message ("Password is empty"); else Password_Dialog.Hide; App.Unlock (Password => Keystore.Create (Gtk.GEntry.Get_Text (Password))); end if; end if; end On_Dialog_Password_Ok; end AKT.Callbacks;
reznikmm/webidl
Ada
9,087
adb
-- SPDX-FileCopyrightText: 2021 Max Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with League.Strings; package body WebIDL.Token_Handlers is ------------- -- Integer -- ------------- overriding procedure Integer (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is begin Token := WebIDL.Tokens.Integer_Token; Skip := False; end Integer; overriding procedure Decimal (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Skip); begin Token := WebIDL.Tokens.Decimal_Token; Skip := False; end Decimal; overriding procedure Delimiter (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is Text : constant League.Strings.Universal_String := Scanner.Get_Text; begin case Text (1).To_Wide_Wide_Character is when '(' => Token := '('; when ')' => Token := ')'; when ',' => Token := ','; when '-' => Token := '-'; when '.' => Token := '.'; when ':' => Token := ':'; when ';' => Token := ';'; when '<' => Token := '<'; when '=' => Token := '='; when '>' => Token := '>'; when '?' => Token := '?'; when '[' => Token := '['; when ']' => Token := ']'; when '{' => Token := '{'; when '}' => Token := '}'; when others => raise Program_Error; end case; Skip := False; end Delimiter; overriding procedure Ellipsis (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Skip); begin Token := WebIDL.Tokens.Ellipsis_Token; Skip := False; end Ellipsis; overriding procedure Identifier (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Skip); Text : constant League.Strings.Universal_String := Scanner.Get_Text; Found : constant Keyword_Maps.Cursor := Self.Map.Find (Text); begin if Keyword_Maps.Has_Element (Found) then Token := Keyword_Maps.Element (Found); else Token := WebIDL.Tokens.Identifier_Token; end if; Skip := False; end Identifier; procedure Initialize (Self : in out Handler'Class) is use all type WebIDL.Tokens.Token_Kind; function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; Map : Keyword_Maps.Map renames Self.Map; begin Map.Insert (+"any", Any_Token); Map.Insert (+"async", Async_Token); Map.Insert (+"attribute", Attribute_Token); Map.Insert (+"bigint", Bigint_Token); Map.Insert (+"boolean", Boolean_Token); Map.Insert (+"byte", Byte_Token); Map.Insert (+"callback", Callback_Token); Map.Insert (+"const", Const_Token); Map.Insert (+"constructor", Constructor_Token); Map.Insert (+"deleter", Deleter_Token); Map.Insert (+"dictionary", Dictionary_Token); Map.Insert (+"double", Double_Token); Map.Insert (+"enum", Enum_Token); Map.Insert (+"false", False_Token); Map.Insert (+"float", Float_Token); Map.Insert (+"getter", Getter_Token); Map.Insert (+"includes", Includes_Token); Map.Insert (+"inherit", Inherit_Token); Map.Insert (+"interface", Interface_Token); Map.Insert (+"iterable", Iterable_Token); Map.Insert (+"long", Long_Token); Map.Insert (+"maplike", Maplike_Token); Map.Insert (+"mixin", Mixin_Token); Map.Insert (+"namespace", Namespace_Token); Map.Insert (+"null", Null_Token); Map.Insert (+"object", Object_Token); Map.Insert (+"octet", Octet_Token); Map.Insert (+"optional", Optional_Token); Map.Insert (+"or", Or_Token); Map.Insert (+"other", Other_Token); Map.Insert (+"partial", Partial_Token); Map.Insert (+"readonly", Readonly_Token); Map.Insert (+"record", Record_Token); Map.Insert (+"required", Required_Token); Map.Insert (+"sequence", Sequence_Token); Map.Insert (+"setlike", Setlike_Token); Map.Insert (+"setter", Setter_Token); Map.Insert (+"short", Short_Token); Map.Insert (+"static", Static_Token); Map.Insert (+"stringifier", Stringifier_Token); Map.Insert (+"symbol", Symbol_Token); Map.Insert (+"true", True_Token); Map.Insert (+"typedef", Typedef_Token); Map.Insert (+"undefined", Undefined_Token); Map.Insert (+"unrestricted", Unrestricted_Token); Map.Insert (+"unsigned", Unsigned_Token); Map.Insert (+"ArrayBuffer", ArrayBuffer_Token); Map.Insert (+"ByteString", ByteString_Token); Map.Insert (+"DataView", DataView_Token); Map.Insert (+"DOMString", DOMString_Token); Map.Insert (+"Float32Array", Float32Array_Token); Map.Insert (+"Float64Array", Float64Array_Token); Map.Insert (+"FrozenArray", FrozenArray_Token); Map.Insert (+"Infinity", Infinity_Token); Map.Insert (+"Int16Array", Int16Array_Token); Map.Insert (+"Int32Array", Int32Array_Token); Map.Insert (+"Int8Array", Int8Array_Token); Map.Insert (+"NaN", NaN_Token); Map.Insert (+"ObservableArray", ObservableArray_Token); Map.Insert (+"Promise", Promise_Token); Map.Insert (+"Uint16Array", Uint16Array_Token); Map.Insert (+"Uint32Array", Uint32Array_Token); Map.Insert (+"Uint8Array", Uint8Array_Token); Map.Insert (+"Uint8ClampedArray", Uint8ClampedArray_Token); Map.Insert (+"USVString", USVString_Token); null; end Initialize; overriding procedure String (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Skip); begin Token := WebIDL.Tokens.String_Token; Skip := False; end String; overriding procedure Whitespace (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Token); begin Skip := True; end Whitespace; overriding procedure Line_Comment (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Token); begin Skip := True; end Line_Comment; overriding procedure Comment_Start (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Token); begin Scanner.Set_Start_Condition (WebIDL.Scanner_Types.In_Comment); Skip := True; end Comment_Start; overriding procedure Comment_End (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Token); begin Scanner.Set_Start_Condition (WebIDL.Scanner_Types.INITIAL); Skip := True; end Comment_End; overriding procedure Comment_Text (Self : not null access Handler; Scanner : not null access WebIDL.Scanners.Scanner'Class; Rule : WebIDL.Scanner_Types.Rule_Index; Token : out WebIDL.Tokens.Token_Kind; Skip : in out Boolean) is pragma Unreferenced (Token); begin Skip := True; end Comment_Text; end WebIDL.Token_Handlers;
reznikmm/matreshka
Ada
4,077
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Db_Default_Row_Style_Name_Attributes; package Matreshka.ODF_Db.Default_Row_Style_Name_Attributes is type Db_Default_Row_Style_Name_Attribute_Node is new Matreshka.ODF_Db.Abstract_Db_Attribute_Node and ODF.DOM.Db_Default_Row_Style_Name_Attributes.ODF_Db_Default_Row_Style_Name_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Db_Default_Row_Style_Name_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Db_Default_Row_Style_Name_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Db.Default_Row_Style_Name_Attributes;
sungyeon/drake
Ada
1,710
adb
with Ada.Exception_Identification.From_Here; with C.fcntl; with C.sys.types; with C.unistd; package body System.Random_Initiators is use Ada.Exception_Identification.From_Here; use type Storage_Elements.Storage_Offset; use type C.char_array; use type C.signed_int; -- ssize_t is signed int or signed long use type C.signed_long; Random_File_Name : constant C.char_array := "/dev/urandom" & C.char'Val (0); procedure Get ( Item : Address; Size : Storage_Elements.Storage_Count) is Handle : C.signed_int; Error : Boolean; begin Handle := C.fcntl.open ( Random_File_Name (0)'Access, C.fcntl.O_RDONLY); if Handle < 0 then Raise_Exception (Use_Error'Identity); end if; Error := False; declare Total_Read_Size : Storage_Elements.Storage_Count := 0; begin while Total_Read_Size < Size loop declare Read_Size : C.sys.types.ssize_t; begin Read_Size := C.unistd.read ( Handle, C.void_ptr (Item + Total_Read_Size), C.size_t (Size - Total_Read_Size)); if Read_Size < 0 then Error := True; exit; end if; Total_Read_Size := Total_Read_Size + Storage_Elements.Storage_Offset (Read_Size); end; end loop; end; if C.unistd.close (Handle) < 0 then Error := True; end if; if Error then Raise_Exception (Use_Error'Identity); end if; end Get; end System.Random_Initiators;
reznikmm/matreshka
Ada
4,684
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Anim_Command_Elements; package Matreshka.ODF_Anim.Command_Elements is type Anim_Command_Element_Node is new Matreshka.ODF_Anim.Abstract_Anim_Element_Node and ODF.DOM.Anim_Command_Elements.ODF_Anim_Command with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Anim_Command_Element_Node; overriding function Get_Local_Name (Self : not null access constant Anim_Command_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Anim_Command_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Anim_Command_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Anim_Command_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Anim.Command_Elements;
reznikmm/matreshka
Ada
3,764
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Table_Target_Cell_Address_Attributes is pragma Preelaborate; type ODF_Table_Target_Cell_Address_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Table_Target_Cell_Address_Attribute_Access is access all ODF_Table_Target_Cell_Address_Attribute'Class with Storage_Size => 0; end ODF.DOM.Table_Target_Cell_Address_Attributes;
godunko/adagl
Ada
3,405
adb
------------------------------------------------------------------------------ -- -- -- Ada binding for OpenGL/WebGL -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2018, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package body OpenGL.Textures.Internals is ---------------------------- -- Get_WebGL_Texture -- ---------------------------- function Get_WebGL_Texture (Self : OpenGL_Texture'Class) return GLEW.GLuint is begin return Self.Texture; end Get_WebGL_Texture; end OpenGL.Textures.Internals;
AdaCore/libadalang
Ada
104
adb
package body Foo is procedure Bar is begin Put_Line ("Hello, world!"); end Bar; end Foo;
jhumphry/parse_args
Ada
1,436
adb
-- parse_args-split_csv.adb -- A simple command line option parser -- Copyright (c) 2015, James Humphry -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. pragma Profile(No_Implementation_Extensions); with Ada.Strings.Fixed; function Parse_Args.Split_CSV (S : String) return Element_Array_Access is use Ada.Strings.Fixed; Result : Element_Array_Access; U,V : Natural; begin Result := new Element_Array(1..(Count(S, ",") + 1)); U := S'First; for I in Result.all'Range loop V := Index (Source => S, Pattern => ",", From => U); V := (if V = 0 then S'Last+1 else V); Result.all(I) := Value(S(U..(V-1))); U := V + 1; end loop; return Result; end Parse_Args.Split_CSV;
reznikmm/matreshka
Ada
3,769
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_Frame_Margin_Vertical_Attributes is pragma Preelaborate; type ODF_Draw_Frame_Margin_Vertical_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Frame_Margin_Vertical_Attribute_Access is access all ODF_Draw_Frame_Margin_Vertical_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Frame_Margin_Vertical_Attributes;
AdaCore/libadalang
Ada
41
ads
with Pkg_B; package Pkg_C is end Pkg_C;
kjseefried/coreland-cgbc
Ada
1,939
adb
with BOHT_Support; with CGBC; with Test; procedure T_BOHT_05 is package BST4 renames BOHT_Support.String_Tables4; use type CGBC.Count_Type; TC : Test.Context_t; Deleted : Boolean; Inserted : Boolean; begin Test.Initialize (Test_Context => TC, Program => "t_boht_05", Test_DB => "TEST_DB", Test_Results => "TEST_RESULTS"); BST4.Delete (Container => BOHT_Support.Map, Key => BOHT_Support.Keys (1), Deleted => Deleted); Test.Check (Test_Context => TC, Test => 410, Condition => Deleted = False, Statement => "Deleted = False"); Test.Check (Test_Context => TC, Test => 411, Condition => BST4.Length (BOHT_Support.Map) = 0, Statement => "BST4.Length (BOHT_Support.Map) = 0"); BST4.Insert (Container => BOHT_Support.Map, Key => BOHT_Support.Keys (1), Element => 1, Inserted => Inserted); pragma Assert (Inserted); BST4.Delete (Container => BOHT_Support.Map, Key => BOHT_Support.Keys (2), Deleted => Deleted); Test.Check (Test_Context => TC, Test => 412, Condition => Deleted = False, Statement => "Deleted = False"); BST4.Delete (Container => BOHT_Support.Map, Key => BOHT_Support.Keys (1), Deleted => Deleted); Test.Check (Test_Context => TC, Test => 413, Condition => Deleted, Statement => "Deleted"); Test.Check (Test_Context => TC, Test => 414, Condition => BST4.Length (BOHT_Support.Map) = 0, Statement => "BST4.Length (BOHT_Support.Map) = 0"); Test.Check (Test_Context => TC, Test => 415, Condition => BST4.Contains (BOHT_Support.Map, BOHT_Support.Keys (1)) = False, Statement => "BST4.Contains (BOHT_Support.Map, BOHT_Support.Keys (1)) = False"); end T_BOHT_05;
Fabien-Chouteau/GESTE
Ada
8,273
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with umingw_h; package ctype_h is -- unsupported macro: isascii __isascii -- unsupported macro: toascii __toascii -- unsupported macro: iscsymf __iscsymf -- unsupported macro: iscsym __iscsym -- skipped func _isctype -- skipped func _isctype_l function isalpha (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:102 pragma Import (C, isalpha, "isalpha"); -- skipped func _isalpha_l function isupper (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:104 pragma Import (C, isupper, "isupper"); -- skipped func _isupper_l function islower (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:106 pragma Import (C, islower, "islower"); -- skipped func _islower_l function isdigit (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:108 pragma Import (C, isdigit, "isdigit"); -- skipped func _isdigit_l function isxdigit (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:110 pragma Import (C, isxdigit, "isxdigit"); -- skipped func _isxdigit_l function isspace (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:112 pragma Import (C, isspace, "isspace"); -- skipped func _isspace_l function ispunct (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:114 pragma Import (C, ispunct, "ispunct"); -- skipped func _ispunct_l function isalnum (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:116 pragma Import (C, isalnum, "isalnum"); -- skipped func _isalnum_l function isprint (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:118 pragma Import (C, isprint, "isprint"); -- skipped func _isprint_l function isgraph (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:120 pragma Import (C, isgraph, "isgraph"); -- skipped func _isgraph_l function iscntrl (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:122 pragma Import (C, iscntrl, "iscntrl"); -- skipped func _iscntrl_l function toupper (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:124 pragma Import (C, toupper, "toupper"); function tolower (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:125 pragma Import (C, tolower, "tolower"); -- skipped func _tolower -- skipped func _tolower_l -- skipped func _toupper -- skipped func _toupper_l function isblank (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:136 pragma Import (C, isblank, "isblank"); function iswalpha (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:143 pragma Import (C, iswalpha, "iswalpha"); -- skipped func _iswalpha_l function iswupper (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:145 pragma Import (C, iswupper, "iswupper"); -- skipped func _iswupper_l function iswlower (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:147 pragma Import (C, iswlower, "iswlower"); -- skipped func _iswlower_l function iswdigit (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:149 pragma Import (C, iswdigit, "iswdigit"); -- skipped func _iswdigit_l function iswxdigit (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:151 pragma Import (C, iswxdigit, "iswxdigit"); -- skipped func _iswxdigit_l function iswspace (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:153 pragma Import (C, iswspace, "iswspace"); -- skipped func _iswspace_l function iswpunct (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:155 pragma Import (C, iswpunct, "iswpunct"); -- skipped func _iswpunct_l function iswalnum (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:157 pragma Import (C, iswalnum, "iswalnum"); -- skipped func _iswalnum_l function iswprint (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:159 pragma Import (C, iswprint, "iswprint"); -- skipped func _iswprint_l function iswgraph (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:161 pragma Import (C, iswgraph, "iswgraph"); -- skipped func _iswgraph_l function iswcntrl (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:163 pragma Import (C, iswcntrl, "iswcntrl"); -- skipped func _iswcntrl_l function iswascii (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:165 pragma Import (C, iswascii, "iswascii"); function isleadbyte (u_C : int) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:166 pragma Import (C, isleadbyte, "isleadbyte"); -- skipped func _isleadbyte_l function towupper (u_C : umingw_h.wint_t) return umingw_h.wint_t; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:168 pragma Import (C, towupper, "towupper"); -- skipped func _towupper_l function towlower (u_C : umingw_h.wint_t) return umingw_h.wint_t; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:170 pragma Import (C, towlower, "towlower"); -- skipped func _towlower_l function iswctype (u_C : umingw_h.wint_t; u_Type : umingw_h.wctype_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:172 pragma Import (C, iswctype, "iswctype"); -- skipped func _iswctype_l -- skipped func _iswcsymf_l -- skipped func _iswcsym_l function is_wctype (u_C : umingw_h.wint_t; u_Type : umingw_h.wctype_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:178 pragma Import (C, is_wctype, "is_wctype"); function iswblank (u_C : umingw_h.wint_t) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/ctype.h:181 pragma Import (C, iswblank, "iswblank"); end ctype_h;
psyomn/ash
Ada
3,836
adb
-- Copyright 2019-2021 Simon Symeonidis (psyomn) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings; with Ada.Strings.Unbounded; with GNAT.Sockets; use GNAT.Sockets; with Transaction_Handlers; with Common_Utils; package body Listeners is package IO renames Ada.Text_IO; package ASU renames Ada.Strings.Unbounded; task body Launch_Listener is L : Listener; begin accept Construct (The_Listener : in Listener) do L := The_Listener; end Construct; accept Start; Print_Info (L); Listen (L); accept Stop; end Launch_Listener; function Make_Listener (Port : Integer; Root : String; Host : String) return Listeners.Listener is L : Listeners.Listener; begin L.Port_Number := Port; L.WS_Root_Path (1 .. Root'Last) := Root; L.Host_Name (1 .. Host'Last) := Host; return L; end Make_Listener; procedure Print_Info (L : Listener) is Port_Str : constant String := Integer'Image (L.Port_Number); Host_Str : constant String := L.Host_Name; Root_Str : constant String := L.WS_Root_Path; begin Put_Line ("listening on " & Host_Str & ": " & Port_Str & ", root dir.: " & Root_Str); end Print_Info; -- Listen forever. Graceful shutdown if it receives some signal. procedure Listen (L : Listener) is Socket : Socket_Type; Server : Socket_Type; Address : Sock_Addr_Type; Channel : Stream_Access; The_Host : constant String := L.Host_Name; begin Address.Addr := Addresses (Get_Host_By_Name (The_Host), 1); Address.Port := Port_Type (L.Port_Number); Create_Socket (Server); Set_Socket_Option (Server, Socket_Level, (Reuse_Address, True)); Bind_Socket (Server, Address); Listen_Socket (Server); Listening_Loop : while not L.Shutdown loop Accept_Socket (Server, Socket, Address); Channel := Stream (Socket); declare Counter : Integer := 0; Request : ASU.Unbounded_String; Chara : Character; begin -- Read the request body Read_Request : loop Character'Read (Channel, Chara); ASU.Append (Source => Request, New_Item => Chara); if Chara = ASCII.LF or Chara = ASCII.CR then Counter := Counter + 1; else Counter := 0; end if; exit Read_Request when Counter = 4; end loop Read_Request; IO.Put_Line (ASU.To_String (Request)); String'Write (Channel, Transaction_Handlers.Handle_Request ( ASU.To_String (Request), L.WS_Root_Path)); exception when E : End_Error => Common_Utils.Print_Exception (E, "socket reading EOF error"); when E : Socket_Error => Common_Utils.Print_Exception (E, "generic socket error"); when E : others => Common_Utils.Print_Exception (E, "unexpected error"); end; Free (Channel); Close_Socket (Socket); end loop Listening_Loop; end Listen; end Listeners;
AaronC98/PlaneSystem
Ada
3,751
ads
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2000-2014, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with AWS.Hotplug; package AWS.Server.Hotplug is -- Messages used to register/unregister hotplug modules Register_Message : constant String := "REGISTER"; Unregister_Message : constant String := "UNREGISTER"; Request_Nonce_Message : constant String := "REQUEST_NONCE"; -- The Authorization_File below is a file that contains authorizations -- for the hotplug modules. Only modules that have an entry into this -- file will be able to register to server. Each line on this file must -- have the following format: -- -- <module_name>:<md5_password>:<host>:<port> -- -- module_name : The name of the module that will register -- md5_password : The corresponding password, use aws_password -- tool to generate such password -- host : The host name where requests will be redirected -- port : and the corresponding port procedure Activate (Web_Server : not null access HTTP; Port : Positive; Authorization_File : String; Register_Mode : AWS.Hotplug.Register_Mode := AWS.Hotplug.Add; Host : String := ""); -- Start hotplug server listening at the specified Port for the Web_Server. -- Only client modules listed in the authorization file will be able to -- connect to this server. For better securite the host of redictection -- must also be specified. procedure Shutdown; -- Shutdown hotplug server end AWS.Server.Hotplug;
AdaCore/gpr
Ada
1,623
adb
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Strings.Fixed; with Ada.Text_IO; with GPR2.Context; with GPR2.Path_Name; with GPR2.Project.Attribute.Set; with GPR2.Project.Source.Set; with GPR2.Project.Source.Artifact; with GPR2.Project.Tree; with GPR2.Project.Variable.Set; with GPR2.Project.View; procedure Main is use Ada; use GPR2; use GPR2.Project; procedure Display (Prj : Project.View.Object); procedure Output_Filename (Filename : Path_Name.Full_Name); ------------- -- Display -- ------------- procedure Display (Prj : Project.View.Object) is use GPR2.Project.Attribute.Set; use GPR2.Project.Variable.Set.Set; begin Text_IO.Put (String (Prj.Name) & " "); Text_IO.Set_Col (10); Text_IO.Put_Line (Prj.Qualifier'Img); for S of Prj.Sources loop Text_IO.Put_Line (" " & String (S.Path_Name.Base_Name)); for A of S.Artifacts.List loop Text_IO.Put (" "); Output_Filename (A.Value); end loop; end loop; end Display; --------------------- -- Output_Filename -- --------------------- procedure Output_Filename (Filename : Path_Name.Full_Name) is I : constant Positive := Strings.Fixed.Index (Filename, "aggregate-lib-3"); begin Text_IO.Put_Line (" > " & Filename (I + 16 .. Filename'Last)); end Output_Filename; Prj : Project.Tree.Object; Ctx : Context.Object; begin Project.Tree.Load_Autoconf (Prj, Create ("demo.gpr"), Ctx); for P of Prj loop Display (P); end loop; end Main;
sungyeon/drake
Ada
903
adb
with Ada.Strings.East_Asian_Width; procedure eastasianwidth is use Ada.Strings.East_Asian_Width; subtype WWC is Wide_Wide_Character; begin pragma Assert (Kind (WWC'Val (0)) = Neutral); pragma Assert (Kind ('A') = Narrow); pragma Assert (Kind (WWC'Val (16#2500#)) = Ambiguous); pragma Assert (Kind (WWC'Val (16#3042#)) = Wide); pragma Assert (Kind (WWC'Val (16#FF01#)) = Full_Width); pragma Assert (Kind (WWC'Val (16#FF71#)) = Half_Width); pragma Assert (not Is_Full_Width (Half_Width, East_Asian => False)); pragma Assert (not Is_Full_Width (Half_Width, East_Asian => True)); pragma Assert (not Is_Full_Width (Ambiguous, East_Asian => False)); pragma Assert (Is_Full_Width (Ambiguous, East_Asian => True)); pragma Assert (Is_Full_Width (Wide, East_Asian => False)); pragma Assert (Is_Full_Width (Wide, East_Asian => True)); pragma Debug (Ada.Debug.Put ("OK")); null; end eastasianwidth;
optikos/oasis
Ada
4,332
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Indexed_Components; with Program.Element_Visitors; package Program.Nodes.Indexed_Components is pragma Preelaborate; type Indexed_Component is new Program.Nodes.Node and Program.Elements.Indexed_Components.Indexed_Component and Program.Elements.Indexed_Components.Indexed_Component_Text with private; function Create (Prefix : not null Program.Elements.Expressions .Expression_Access; Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expressions : Program.Elements.Expressions .Expression_Vector_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Indexed_Component; type Implicit_Indexed_Component is new Program.Nodes.Node and Program.Elements.Indexed_Components.Indexed_Component with private; function Create (Prefix : not null Program.Elements.Expressions .Expression_Access; Expressions : Program.Elements.Expressions .Expression_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Indexed_Component with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Indexed_Component is abstract new Program.Nodes.Node and Program.Elements.Indexed_Components.Indexed_Component with record Prefix : not null Program.Elements.Expressions.Expression_Access; Expressions : Program.Elements.Expressions.Expression_Vector_Access; end record; procedure Initialize (Self : aliased in out Base_Indexed_Component'Class); overriding procedure Visit (Self : not null access Base_Indexed_Component; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Prefix (Self : Base_Indexed_Component) return not null Program.Elements.Expressions.Expression_Access; overriding function Expressions (Self : Base_Indexed_Component) return Program.Elements.Expressions.Expression_Vector_Access; overriding function Is_Indexed_Component_Element (Self : Base_Indexed_Component) return Boolean; overriding function Is_Expression_Element (Self : Base_Indexed_Component) return Boolean; type Indexed_Component is new Base_Indexed_Component and Program.Elements.Indexed_Components.Indexed_Component_Text with record Left_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Right_Bracket_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Indexed_Component_Text (Self : aliased in out Indexed_Component) return Program.Elements.Indexed_Components.Indexed_Component_Text_Access; overriding function Left_Bracket_Token (Self : Indexed_Component) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Right_Bracket_Token (Self : Indexed_Component) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Indexed_Component is new Base_Indexed_Component with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Indexed_Component_Text (Self : aliased in out Implicit_Indexed_Component) return Program.Elements.Indexed_Components.Indexed_Component_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Indexed_Component) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Indexed_Component) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Indexed_Component) return Boolean; end Program.Nodes.Indexed_Components;
AdaCore/Ada_Drivers_Library
Ada
6,594
ads
-- Copyright (c) 2013, Nordic Semiconductor ASA -- 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 Nordic Semiconductor ASA 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. -- -- This spec has been automatically generated from nrf51.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF_SVD.NVMC is pragma Preelaborate; --------------- -- Registers -- --------------- -- NVMC ready. type READY_READY_Field is (-- NVMC is busy (on-going write or erase operation). Busy, -- NVMC is ready. Ready) with Size => 1; for READY_READY_Field use (Busy => 0, Ready => 1); -- Ready flag. type READY_Register is record -- Read-only. NVMC ready. READY : READY_READY_Field; -- unspecified Reserved_1_31 : HAL.UInt31; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for READY_Register use record READY at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- Program write enable. type CONFIG_WEN_Field is (-- Read only access. Ren, -- Write enabled. Wen, -- Erase enabled. Een) with Size => 2; for CONFIG_WEN_Field use (Ren => 0, Wen => 1, Een => 2); -- Configuration register. type CONFIG_Register is record -- Program write enable. WEN : CONFIG_WEN_Field := NRF_SVD.NVMC.Ren; -- unspecified Reserved_2_31 : HAL.UInt30 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for CONFIG_Register use record WEN at 0 range 0 .. 1; Reserved_2_31 at 0 range 2 .. 31; end record; -- Starts the erasing of all user NVM (code region 0/1 and UICR registers). type ERASEALL_ERASEALL_Field is (-- No operation. Nooperation, -- Start chip erase. Erase) with Size => 1; for ERASEALL_ERASEALL_Field use (Nooperation => 0, Erase => 1); -- Register for erasing all non-volatile user memory. type ERASEALL_Register is record -- Starts the erasing of all user NVM (code region 0/1 and UICR -- registers). ERASEALL : ERASEALL_ERASEALL_Field := NRF_SVD.NVMC.Nooperation; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ERASEALL_Register use record ERASEALL at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; -- It can only be used when all contents of code region 1 are erased. type ERASEUICR_ERASEUICR_Field is (-- No operation. Nooperation, -- Start UICR erase. Erase) with Size => 1; for ERASEUICR_ERASEUICR_Field use (Nooperation => 0, Erase => 1); -- Register for start erasing User Information Congfiguration Registers. type ERASEUICR_Register is record -- It can only be used when all contents of code region 1 are erased. ERASEUICR : ERASEUICR_ERASEUICR_Field := NRF_SVD.NVMC.Nooperation; -- unspecified Reserved_1_31 : HAL.UInt31 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ERASEUICR_Register use record ERASEUICR at 0 range 0 .. 0; Reserved_1_31 at 0 range 1 .. 31; end record; ----------------- -- Peripherals -- ----------------- type NVMC_Disc is (Age, Cr1); -- Non Volatile Memory Controller. type NVMC_Peripheral (Discriminent : NVMC_Disc := Age) is record -- Ready flag. READY : aliased READY_Register; -- Configuration register. CONFIG : aliased CONFIG_Register; -- Register for erasing all non-volatile user memory. ERASEALL : aliased ERASEALL_Register; -- Register for erasing a protected non-volatile memory page. ERASEPCR0 : aliased HAL.UInt32; -- Register for start erasing User Information Congfiguration Registers. ERASEUICR : aliased ERASEUICR_Register; case Discriminent is when Age => -- Register for erasing a non-protected non-volatile memory page. ERASEPAGE : aliased HAL.UInt32; when Cr1 => -- Register for erasing a non-protected non-volatile memory page. ERASEPCR1 : aliased HAL.UInt32; end case; end record with Unchecked_Union, Volatile; for NVMC_Peripheral use record READY at 16#400# range 0 .. 31; CONFIG at 16#504# range 0 .. 31; ERASEALL at 16#50C# range 0 .. 31; ERASEPCR0 at 16#510# range 0 .. 31; ERASEUICR at 16#514# range 0 .. 31; ERASEPAGE at 16#508# range 0 .. 31; ERASEPCR1 at 16#508# range 0 .. 31; end record; -- Non Volatile Memory Controller. NVMC_Periph : aliased NVMC_Peripheral with Import, Address => NVMC_Base; end NRF_SVD.NVMC;
AdaCore/ada-traits-containers
Ada
2,774
ads
-- -- Copyright (C) 2015-2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- -- An implementation of the elements traits compatible with SPARK. -- This package hides the access types. -- Reference types are not possible with SPARK, so this package always -- return a copy of the element (as opposed to what's done in -- conts-elements-indefinite.ads) pragma Ada_2012; generic type Element_Type (<>) is private; with package Pool is new Conts.Pools (<>); -- The storage pool used for Elements. package Conts.Elements.Indefinite_SPARK with SPARK_Mode => On is package Impl with SPARK_Mode => On is type Element_Access is private; subtype Constant_Reference_Type is Element_Type; -- References are not allowed in SPARK, use the element directly instead function To_Element_Access (E : Element_Type) return Element_Access with Inline, Global => null, Post => To_Constant_Reference_Type (To_Element_Access'Result) = E; function To_Constant_Reference_Type (E : Element_Access) return Constant_Reference_Type with Inline, Global => null; function To_Element (E : Constant_Reference_Type) return Element_Type is (E) with Inline, Global => null; function Copy (E : Element_Access) return Element_Access with Inline, Global => null; procedure Free (X : in out Element_Access) with Global => null; private pragma SPARK_Mode (Off); type Element_Access is access all Element_Type; for Element_Access'Storage_Pool use Pool.Pool; function To_Element_Access (E : Element_Type) return Element_Access is (new Element_Type'(E)); function To_Element_Type (E : Element_Access) return Element_Type is (E.all); function Copy (E : Element_Access) return Element_Access is (new Element_Type'(E.all)); function To_Constant_Reference_Type (E : Element_Access) return Constant_Reference_Type is (E.all); end Impl; package Traits is new Conts.Elements.Traits (Element_Type => Element_Type, Stored_Type => Impl.Element_Access, Returned_Type => Impl.Constant_Reference_Type, Constant_Returned_Type => Impl.Constant_Reference_Type, To_Stored => Impl.To_Element_Access, To_Returned => Impl.To_Constant_Reference_Type, To_Constant_Returned => Impl.To_Constant_Reference_Type, To_Element => Impl.To_Element, Copy => Impl.Copy, Copyable => False, Movable => False, Release => Impl.Free); end Conts.Elements.Indefinite_SPARK;
sungyeon/drake
Ada
190
ads
pragma License (Unrestricted); with Ada.Numerics.Generic_Complex_Types; package Ada.Numerics.Complex_Types is new Generic_Complex_Types (Float); pragma Pure (Ada.Numerics.Complex_Types);
reznikmm/matreshka
Ada
9,063
adb
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- The primary authors of ayacc were David Taback and Deepak Tolani. -- Enhancements were made by Ronald J. Schmalz. -- -- Send requests for ayacc information to [email protected] -- Send bug reports for ayacc to [email protected] -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- Module : symbol_table_body.ada -- Component of : ayacc -- Version : 1.2 -- Date : 11/21/86 12:37:53 -- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxsymbol_table_body.ada -- $Header: symbol_table_body.a,v 0.1 86/04/01 15:13:55 ada Exp $ -- $Log: symbol_table_body.a,v $ -- Revision 0.1 86/04/01 15:13:55 ada -- This version fixes some minor bugs with empty grammars -- and $$ expansion. It also uses vads5.1b enhancements -- such as pragma inline. -- -- -- Revision 0.0 86/02/19 18:54:02 ada -- -- These files comprise the initial version of Ayacc -- designed and implemented by David Taback and Deepak Tolani. -- Ayacc has been compiled and tested under the Verdix Ada compiler -- version 4.06 on a vax 11/750 running Unix 4.2BSD. -- package body Symbol_Table is SCCS_ID : constant String := "@(#) symbol_table_body.ada, Version 1.2"; Next_Free_Terminal : Grammar_Symbol := 0; Next_Free_Nonterminal : Grammar_Symbol := -1; Start_Symbol_Pos, End_Symbol_Pos : Grammar_Symbol; type String_Pointer is access String; type Table_Entry(ID : Grammar_Symbol); type Entry_Pointer is access Table_Entry; type Table_Entry(ID :Grammar_Symbol) is record Name : String_Pointer; Next : Entry_Pointer; case ID is when 0..Grammar_Symbol'Last => -- Terminal Prec : Precedence; Assoc : Associativity; when others => -- Nonterminal null; end case; end record; Hash_Table_Size : constant := 613; -- A large prime number type Hash_Index is range 0..Hash_Table_Size-1; Hash_Table : array(Hash_Index) of Entry_Pointer; -- -- Create a 'dynamic' array for looking up an entry -- for a given grammar_symbol. -- Block_Size : constant Grammar_Symbol := 100; type Lookup_Array is array(Grammar_Symbol range 0..Block_Size-1) of Entry_Pointer; type Block; type Block_Pointer is access Block; type Block is record Lookup : Lookup_Array; Next : Block_Pointer := null; end record; -- have separate blocks for terminals and nonterminals. Terminal_Blocks, Nonterminal_Blocks : Block_Pointer := new Block; procedure Make_Lookup_Table_Entry (ID : in Grammar_Symbol; Entry_Ptr : in Entry_Pointer) is ID_Block : Block_Pointer; Block_Number : Integer; begin if ID >= 0 then ID_Block := Terminal_Blocks; else ID_Block := Nonterminal_Blocks; end if; Block_Number := Integer (abs ID / Block_Size); for I in 1..Block_Number loop if ID_Block.Next = null then ID_Block.Next := new Block; end if; ID_Block := ID_Block.Next; end loop; ID_Block.Lookup((abs ID) mod Block_Size) := Entry_Ptr; end Make_Lookup_Table_Entry; function Get_Lookup_Table_Entry(ID: Grammar_Symbol) return Entry_Pointer is ID_Block : Block_Pointer; begin if ID >= 0 then ID_Block := Terminal_Blocks; else ID_Block := Nonterminal_Blocks; end if; for I in 1.. abs ID / Block_Size loop ID_Block := ID_Block.Next; end loop; return ID_Block.Lookup((abs ID) mod Block_Size); end Get_Lookup_Table_Entry; -- some day someone should put in a good hash function. function Hash_Value (S : String) return Hash_Index is H : Integer; Mid : Integer; begin Mid := (S'First + S'Last) / 2; H := ((Character'Pos(S(S'First)) + Character'Pos(S(Mid)) + Character'Pos(S(S'Last))) * S'Length * 16 ) mod Hash_Table_Size; return Hash_Index(H); end Hash_Value; function Insert_Identifier (Name: in String) return Grammar_Symbol is Index : Hash_Index; Entry_Ptr : Entry_Pointer; begin Index := Hash_Value(Name); Entry_Ptr := Hash_Table(Index); if Entry_Ptr = null then Entry_Ptr := new Table_Entry(Next_Free_Nonterminal); Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Hash_Table(Index) := Entry_Ptr; Make_Lookup_Table_Entry(Next_Free_Nonterminal, Entry_Ptr); Next_Free_Nonterminal := Next_Free_Nonterminal - 1; else loop if Entry_Ptr.Name.all = Name then return Entry_Ptr.ID; end if; if Entry_Ptr.Next = null then exit; end if; Entry_Ptr := Entry_Ptr.Next; end loop; Entry_Ptr.Next := new Table_Entry(Next_Free_Nonterminal); Entry_Ptr := Entry_Ptr.Next; Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Make_Lookup_Table_Entry(Next_Free_Nonterminal, Entry_Ptr); Next_Free_Nonterminal := Next_Free_Nonterminal - 1; end if; return Next_Free_Nonterminal + 1; end Insert_Identifier; function Insert_Terminal (Name : String; Prec : Precedence := 0; Assoc : Associativity := Undefined) return Grammar_Symbol is Index : Hash_Index; Entry_Ptr : Entry_Pointer; begin Index := Hash_Value(Name); Entry_Ptr := Hash_Table(Index); if Entry_Ptr = null then Entry_Ptr := new Table_Entry(Next_Free_Terminal); Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Entry_Ptr.Assoc := Assoc; Entry_Ptr.Prec := Prec; Hash_Table(Index) := Entry_Ptr; Make_Lookup_Table_Entry(Next_Free_Terminal, Entry_Ptr); Next_Free_Terminal := Next_Free_Terminal + 1; else loop if Entry_Ptr.Name.all = Name then if Entry_Ptr.ID < 0 then -- Look out for nonterminals raise Illegal_Entry; end if; if Prec /= 0 then if Entry_Ptr.Prec /= 0 then raise Redefined_Precedence_Error; end if; Entry_Ptr.Prec := Prec; Entry_Ptr.Assoc := Assoc; end if; return Entry_Ptr.ID; end if; if Entry_Ptr.Next = null then exit; end if; Entry_Ptr := Entry_Ptr.Next; end loop; Entry_Ptr.Next := new Table_Entry(Next_Free_Terminal); Entry_Ptr := Entry_Ptr.Next; Entry_Ptr.Name := new String(1..Name'Length); Entry_Ptr.Name.all := Name; Entry_Ptr.Assoc := Assoc; Entry_Ptr.Prec := Prec; Make_Lookup_Table_Entry(Next_Free_Terminal, Entry_Ptr); Next_Free_Terminal := Next_Free_Terminal + 1; end if; return Next_Free_Terminal - 1; end Insert_Terminal; function Get_Associativity (ID: Grammar_Symbol) return Associativity is begin return Get_Lookup_Table_Entry(ID).Assoc; end; function Get_Precedence (ID: Grammar_Symbol) return Precedence is begin return Get_Lookup_Table_Entry(ID).Prec; end; function Get_Symbol_Name (ID: Grammar_Symbol) return String is begin return Get_Lookup_Table_Entry(ID).Name.all; end; function First_Symbol (Kind: Symbol_Type) return Grammar_Symbol is begin if Kind = Terminal then return 0; else return Next_Free_Nonterminal + 1; end if; end; function Last_Symbol (Kind: Symbol_Type) return Grammar_Symbol is begin if Kind = Terminal then return Next_Free_Terminal - 1; else return -1; end if; end; function First_Terminal return Grammar_Symbol is begin return 0; end; function Last_Terminal return Grammar_Symbol is begin return Next_Free_Terminal - 1; end; function Start_Symbol return Grammar_Symbol is begin return Start_Symbol_Pos; end; function End_Symbol return Grammar_Symbol is begin return End_Symbol_Pos; end; function Is_Terminal (ID: Grammar_Symbol) return Boolean is begin return ID >= 0; end; function Is_Nonterminal (ID: Grammar_Symbol) return Boolean is begin return ID < 0; end; begin End_Symbol_Pos := Insert_Terminal("END_OF_INPUT"); Start_Symbol_Pos := Insert_Identifier("$accept"); -- declare a dummy symbol to insert the "error" token. declare Dummy_Sym : Grammar_Symbol; begin Dummy_Sym := Insert_Terminal("ERROR"); end; end Symbol_Table;
ellamosi/Ada_BMP_Library
Ada
2,712
ads
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Bitmap.Buffer; use Bitmap.Buffer; with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; package Bitmap.File_IO is function Read_BMP_File (File : File_Type) return not null Any_Bitmap_Buffer; procedure Write_BMP_File (File : File_Type; Bitmap : Bitmap_Buffer'Class); end Bitmap.File_IO;
Fabien-Chouteau/tiled-code-gen
Ada
2,649
ads
------------------------------------------------------------------------------ -- -- -- tiled-code-gen -- -- -- -- Copyright (C) 2018 Fabien Chouteau -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ package TCG.Outputs is end TCG.Outputs;
Gabriel-Degret/adalib
Ada
7,617
ads
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <[email protected]> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with Ada.Iterator_Interfaces; generic type Element_Type is private; with function Hash (Element : Element_Type) return Hash_Type; with function Equivalent_Elements (Left, Right : Element_Type) return Boolean; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Hashed_Sets is pragma Preelaborate(Hashed_Sets); pragma Remote_Types(Hashed_Sets); type Set is tagged private with Constant_Indexing => Constant_Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type; pragma Preelaborable_Initialization(Set); type Cursor is private; pragma Preelaborable_Initialization(Cursor); Empty_Set : constant Set; No_Element : constant Cursor; function Has_Element (Position : Cursor) return Boolean; package Set_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); function "=" (Left, Right : Set) return Boolean; function Equivalent_Sets (Left, Right : Set) return Boolean; function To_Set (New_Item : Element_Type) return Set; function Capacity (Container : Set) return Count_Type; procedure Reserve_Capacity (Container : in out Set; Capacity : in Count_Type); function Length (Container : Set) return Count_Type; function Is_Empty (Container : Set) return Boolean; procedure Clear (Container : in out Set); function Element (Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Set; Position : in Cursor; New_Item : in Element_Type); procedure Query_Element (Position : in Cursor; Process : not null access procedure (Element : in Element_Type)); type Constant_Reference_Type (Element : not null access constant Element_Type) is private with Implicit_Dereference => Element; function Constant_Reference (Container : aliased in Set; Position : in Cursor) return Constant_Reference_Type; procedure Assign (Target : in out Set; Source : in Set); function Copy (Source : Set; Capacity : Count_Type := 0) return Set; procedure Move (Target : in out Set; Source : in out Set); procedure Insert (Container : in out Set; New_Item : in Element_Type; Position : out Cursor; Inserted : out Boolean); procedure Insert (Container : in out Set; New_Item : in Element_Type); procedure Include (Container : in out Set; New_Item : in Element_Type); procedure Replace (Container : in out Set; New_Item : in Element_Type); procedure Exclude (Container : in out Set; Item : in Element_Type); procedure Delete (Container : in out Set; Item : in Element_Type); procedure Delete (Container : in out Set; Position : in out Cursor); procedure Union (Target : in out Set; Source : in Set); function Union (Left, Right : Set) return Set; function "or" (Left, Right : Set) return Set renames Union; procedure Intersection (Target : in out Set; Source : in Set); function Intersection (Left, Right : Set) return Set; function "and" (Left, Right : Set) return Set renames Intersection; procedure Difference (Target : in out Set; Source : in Set); function Difference (Left, Right : Set) return Set; function "-" (Left, Right : Set) return Set renames Difference; procedure Symmetric_Difference (Target : in out Set; Source : in Set); function Symmetric_Difference (Left, Right : Set) return Set; function "xor" (Left, Right : Set) return Set renames Symmetric_Difference; function Overlap (Left, Right : Set) return Boolean; function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; function First (Container : Set) return Cursor; function Next (Position : Cursor) return Cursor; procedure Next (Position : in out Cursor); function Find (Container : Set; Item : Element_Type) return Cursor; function Contains (Container : Set; Item : Element_Type) return Boolean; function Equivalent_Elements (Left, Right : Cursor) return Boolean; function Equivalent_Elements (Left : Cursor; Right : Element_Type) return Boolean; function Equivalent_Elements (Left : Element_Type; Right : Cursor) return Boolean; procedure Iterate (Container : in Set; Process : not null access procedure (Position : in Cursor)); function Iterate (Container : in Set) return Set_Iterator_Interfaces.Forward_Iterator'Class; generic type Key_Type (<>) is private; with function Key (Element : Element_Type) return Key_Type; with function Hash (Key : Key_Type) return Hash_Type; with function Equivalent_Keys (Left, Right : Key_Type) return Boolean; package Generic_Keys is function Key (Position : Cursor) return Key_Type; function Element (Container : Set; Key : Key_Type) return Element_Type; procedure Replace (Container : in out Set; Key : in Key_Type; New_Item : in Element_Type); procedure Exclude (Container : in out Set; Key : in Key_Type); procedure Delete (Container : in out Set; Key : in Key_Type); function Find (Container : Set; Key : Key_Type) return Cursor; function Contains (Container : Set; Key : Key_Type) return Boolean; procedure Update_Element_Preserving_Key (Container : in out Set; Position : in Cursor; Process : not null access procedure (Element : in out Element_Type)); type Reference_Type (Element : not null access Element_Type) is private with Implicit_Dereference => Element; function Reference_Preserving_Key (Container : aliased in out Set; Position : in Cursor) return Reference_Type; function Constant_Reference (Container : aliased in Set; Key : in Key_Type) return Constant_Reference_Type; function Reference_Preserving_Key (Container : aliased in out Set; Key : in Key_Type) return Reference_Type; end Generic_Keys; private -- not specified by the language end Ada.Containers.Hashed_Sets;
pchapin/augusta
Ada
524
ads
--------------------------------------------------------------------------- -- FILE : augusta-wide_characters.ads -- SUBJECT : Specification of top level wide characters package. -- AUTHOR : (C) Copyright 2013 by the Augusta Contributors -- -- Please send comments or bug reports to -- -- Peter C. Chapin <[email protected]> --------------------------------------------------------------------------- -- See A.3.1. package Augusta.Wide_Characters is pragma Pure(Wide_Characters); end Augusta.Wide_Characters;
zhmu/ananas
Ada
616
ads
pragma Assertion_Policy (Ignore); with Ada.Containers; use Ada.Containers; with Ada.Containers.Formal_Hashed_Maps; with Ada.Strings; use Ada.Strings; with Ada.Strings.Hash; package Config_Pragma1_Pkg is subtype Positive10 is Positive range 1 .. 1000; subtype String10 is String (Positive10); package FHM is new Formal_Hashed_Maps (Key_Type => String10, Element_Type => Positive10, Hash => Hash, Equivalent_Keys => "="); FHMM : FHM.Map (Capacity => 1_000_000, Modulus => FHM.Default_Modulus (Count_Type (1_000_000))); end Config_Pragma1_Pkg;
zhmu/ananas
Ada
331
ads
with Interfaces.C; use Interfaces.C; package Cpp_Constructor_FP is type Class is limited record null; end record with Convention => Cpp, Import; function Constructor (Fn : access function (Val : int) return int) return Class; pragma Cpp_Constructor (Constructor, External_Name => "foo"); end Cpp_Constructor_FP;
reznikmm/matreshka
Ada
3,709
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Text_Condition_Attributes is pragma Preelaborate; type ODF_Text_Condition_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Text_Condition_Attribute_Access is access all ODF_Text_Condition_Attribute'Class with Storage_Size => 0; end ODF.DOM.Text_Condition_Attributes;
docandrew/troodon
Ada
6,765
ads
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with bits_types_h; limited with bits_types_struct_sched_param_h; limited with bits_types_struct_timespec_h; with stddef_h; limited with bits_cpu_set_h; package sched_h is -- unsupported macro: sched_priority sched_priority -- unsupported macro: CPU_SETSIZE __CPU_SETSIZE -- arg-macro: procedure CPU_SET (cpu, cpusetp) -- __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp) -- arg-macro: procedure CPU_CLR (cpu, cpusetp) -- __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp) -- arg-macro: procedure CPU_ISSET (cpu, cpusetp) -- __CPU_ISSET_S (cpu, sizeof (cpu_set_t), cpusetp) -- arg-macro: procedure CPU_ZERO (cpusetp) -- __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp) -- arg-macro: procedure CPU_COUNT (cpusetp) -- __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp) -- arg-macro: procedure CPU_SET_S (cpu, setsize, cpusetp) -- __CPU_SET_S (cpu, setsize, cpusetp) -- arg-macro: procedure CPU_CLR_S (cpu, setsize, cpusetp) -- __CPU_CLR_S (cpu, setsize, cpusetp) -- arg-macro: procedure CPU_ISSET_S (cpu, setsize, cpusetp) -- __CPU_ISSET_S (cpu, setsize, cpusetp) -- arg-macro: procedure CPU_ZERO_S (setsize, cpusetp) -- __CPU_ZERO_S (setsize, cpusetp) -- arg-macro: procedure CPU_COUNT_S (setsize, cpusetp) -- __CPU_COUNT_S (setsize, cpusetp) -- arg-macro: procedure CPU_EQUAL (cpusetp1, cpusetp2) -- __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2) -- arg-macro: procedure CPU_EQUAL_S (setsize, cpusetp1, cpusetp2) -- __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2) -- arg-macro: procedure CPU_AND (destset, srcset1, srcset2) -- __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, and) -- arg-macro: procedure CPU_OR (destset, srcset1, srcset2) -- __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, or) -- arg-macro: procedure CPU_XOR (destset, srcset1, srcset2) -- __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, xor) -- arg-macro: procedure CPU_AND_S (setsize, destset, srcset1, srcset2) -- __CPU_OP_S (setsize, destset, srcset1, srcset2, and) -- arg-macro: procedure CPU_OR_S (setsize, destset, srcset1, srcset2) -- __CPU_OP_S (setsize, destset, srcset1, srcset2, or) -- arg-macro: procedure CPU_XOR_S (setsize, destset, srcset1, srcset2) -- __CPU_OP_S (setsize, destset, srcset1, srcset2, xor) -- arg-macro: procedure CPU_ALLOC_SIZE (count) -- __CPU_ALLOC_SIZE (count) -- arg-macro: procedure CPU_ALLOC (count) -- __CPU_ALLOC (count) -- arg-macro: procedure CPU_FREE (cpuset) -- __CPU_FREE (cpuset) -- Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. -- Copyright (C) 1996-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- Get type definitions. -- Get system specific constant and data structure definitions. -- Backward compatibility. -- Set scheduling parameters for a process. function sched_setparam (uu_pid : bits_types_h.uu_pid_t; uu_param : access constant bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/sched.h:54 with Import => True, Convention => C, External_Name => "sched_setparam"; -- Retrieve scheduling parameters for a particular process. function sched_getparam (uu_pid : bits_types_h.uu_pid_t; uu_param : access bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/sched.h:58 with Import => True, Convention => C, External_Name => "sched_getparam"; -- Set scheduling algorithm and/or parameters for a process. function sched_setscheduler (uu_pid : bits_types_h.uu_pid_t; uu_policy : int; uu_param : access constant bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/sched.h:61 with Import => True, Convention => C, External_Name => "sched_setscheduler"; -- Retrieve scheduling algorithm for a particular purpose. function sched_getscheduler (uu_pid : bits_types_h.uu_pid_t) return int -- /usr/include/sched.h:65 with Import => True, Convention => C, External_Name => "sched_getscheduler"; -- Yield the processor. function sched_yield return int -- /usr/include/sched.h:68 with Import => True, Convention => C, External_Name => "sched_yield"; -- Get maximum priority value for a scheduler. function sched_get_priority_max (uu_algorithm : int) return int -- /usr/include/sched.h:71 with Import => True, Convention => C, External_Name => "sched_get_priority_max"; -- Get minimum priority value for a scheduler. function sched_get_priority_min (uu_algorithm : int) return int -- /usr/include/sched.h:74 with Import => True, Convention => C, External_Name => "sched_get_priority_min"; -- Get the SCHED_RR interval for the named process. function sched_rr_get_interval (uu_pid : bits_types_h.uu_pid_t; uu_t : access bits_types_struct_timespec_h.timespec) return int -- /usr/include/sched.h:77 with Import => True, Convention => C, External_Name => "sched_rr_get_interval"; -- Access macros for `cpu_set'. -- Set the CPU affinity for a task function sched_setaffinity (uu_pid : bits_types_h.uu_pid_t; uu_cpusetsize : stddef_h.size_t; uu_cpuset : access constant bits_cpu_set_h.cpu_set_t) return int -- /usr/include/sched.h:121 with Import => True, Convention => C, External_Name => "sched_setaffinity"; -- Get the CPU affinity for a task function sched_getaffinity (uu_pid : bits_types_h.uu_pid_t; uu_cpusetsize : stddef_h.size_t; uu_cpuset : access bits_cpu_set_h.cpu_set_t) return int -- /usr/include/sched.h:125 with Import => True, Convention => C, External_Name => "sched_getaffinity"; end sched_h;
reznikmm/matreshka
Ada
3,749
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Chart_Sort_By_X_Values_Attributes is pragma Preelaborate; type ODF_Chart_Sort_By_X_Values_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Chart_Sort_By_X_Values_Attribute_Access is access all ODF_Chart_Sort_By_X_Values_Attribute'Class with Storage_Size => 0; end ODF.DOM.Chart_Sort_By_X_Values_Attributes;
zorodc/ada-http1
Ada
325
ads
-- -- Nice little HTTP 1.x request parser. Uses a state machine. -- Operates by cutting up the incoming request string into sections. -- package HTTP with SPARK_Mode => On is type Version is delta 0.1 range 1.0 .. 9.9; type Indexes is record First : Natural := 1; Last : Natural := 0; end record; end HTTP;
reznikmm/matreshka
Ada
3,654
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Draw_Circle_Elements is pragma Preelaborate; type ODF_Draw_Circle is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Draw_Circle_Access is access all ODF_Draw_Circle'Class with Storage_Size => 0; end ODF.DOM.Draw_Circle_Elements;
reznikmm/matreshka
Ada
4,662
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Draw_Image_Elements; package Matreshka.ODF_Draw.Image_Elements is type Draw_Image_Element_Node is new Matreshka.ODF_Draw.Abstract_Draw_Element_Node and ODF.DOM.Draw_Image_Elements.ODF_Draw_Image with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Draw_Image_Element_Node; overriding function Get_Local_Name (Self : not null access constant Draw_Image_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Draw_Image_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Draw_Image_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Draw_Image_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Draw.Image_Elements;
eqcola/ada-ado
Ada
2,597
ads
----------------------------------------------------------------------- -- ADO Sequences Hilo-- HiLo Database sequence generator -- Copyright (C) 2009, 2010, 2011, 2012, 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- === HiLo Sequence Generator === -- The HiLo sequence generator. This sequence generator uses a database table -- <b>sequence</b> to allocate blocks of identifiers for a given sequence name. -- The sequence table contains one row for each sequence. It keeps track of -- the next available sequence identifier (in the <b>value</b> column). -- -- To allocate a sequence block, the HiLo generator obtains the next available -- sequence identified and updates it by adding the sequence block size. The -- HiLo sequence generator will allocate the identifiers until the block is -- full after which a new block will be allocated. package ADO.Sequences.Hilo is -- ------------------------------ -- High Low sequence generator -- ------------------------------ type HiLoGenerator is new Generator with private; DEFAULT_BLOCK_SIZE : constant Identifier := 100; -- Allocate an identifier using the generator. -- The generator allocates blocks of sequences by using a sequence -- table stored in the database. One database access is necessary -- every N allocations. overriding procedure Allocate (Gen : in out HiLoGenerator; Id : in out Objects.Object_Record'Class); -- Allocate a new sequence block. procedure Allocate_Sequence (Gen : in out HiLoGenerator); function Create_HiLo_Generator (Sess_Factory : in Session_Factory_Access) return Generator_Access; private type HiLoGenerator is new Generator with record Last_Id : Identifier := NO_IDENTIFIER; Next_Id : Identifier := NO_IDENTIFIER; Block_Size : Identifier := DEFAULT_BLOCK_SIZE; end record; end ADO.Sequences.Hilo;
reznikmm/cvsweb2git
Ada
4,410
adb
-- BSD 3-Clause License -- -- Copyright (c) 2017, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- * Neither the name of the 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 Interfaces.C.Strings; with Ada.Streams; with System; package body CvsWeb.Html2Xml is use Interfaces; type Doc_Ptr is access all C.int; procedure xmlDocDumpMemory (Doc : Doc_Ptr; Buffer : out C.Strings.chars_ptr; Size : out C.int); pragma Import (C, xmlDocDumpMemory, "xmlDocDumpMemory"); function htmlReadMemory (Buffer : System.Address; Size : C.int; URL : C.Strings.chars_ptr; Encoding : C.Strings.chars_ptr; Options : C.int) return Doc_Ptr; pragma Import (C, htmlReadMemory, "htmlReadMemory"); HTML_PARSE_RECOVER : constant := 1; -- Relaxed parsing -- HTML_PARSE_NODEFDTD : constant := 4; -- -- do not default a doctype if not found HTML_PARSE_NOERROR : constant := 32; -- suppress error reports HTML_PARSE_NOWARNING : constant := 64; -- suppress warning reports -- HTML_PARSE_PEDANTIC : constant := 128; -- pedantic error reporting -- HTML_PARSE_NOBLANKS : constant := 256; -- remove blank nodes -- HTML_PARSE_NONET : constant := 2048; -- Forbid network access -- HTML_PARSE_NOIMPLIED : constant := 8192; -- -- Do not add implied html/body... elements -- HTML_PARSE_COMPACT : constant := 65536; -- compact small text nodes -- HTML_PARSE_IGNORE_ENC : constant := 2097152; -- -- ignore internal document encoding hint procedure free (Address : C.Strings.chars_ptr); pragma Import (C, free, "free"); procedure xmlFreeDoc (Cur : Doc_Ptr); pragma Import (C, xmlFreeDoc, "xmlFreeDoc"); pragma Linker_Options ("-lxml2"); ------------- -- Convert -- ------------- function Convert (Data : League.Stream_Element_Vectors.Stream_Element_Vector; URL : League.Strings.Universal_String) return League.Strings.Universal_String is use type C.int; Doc : Doc_Ptr; C_URL : C.Strings.chars_ptr := C.Strings.New_String (URL.To_UTF_8_String); Buffer : aliased Ada.Streams.Stream_Element_Array := Data.To_Stream_Element_Array; Result : C.Strings.chars_ptr; Size : C.int; begin Doc := htmlReadMemory (Buffer => Buffer (Buffer'First)'Address, Size => Buffer'Length, URL => C_URL, Encoding => C.Strings.Null_Ptr, Options => HTML_PARSE_RECOVER + HTML_PARSE_NOERROR + HTML_PARSE_NOWARNING); xmlDocDumpMemory (Doc, Result, Size); return Value : constant League.Strings.Universal_String := League.Strings.From_UTF_8_String (C.Strings.Value (Result, C.size_t (Size))) do free (Result); xmlFreeDoc (Doc); C.Strings.Free (C_URL); end return; end Convert; end CvsWeb.Html2Xml;
reznikmm/matreshka
Ada
4,560
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Table.Row_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Row_Attribute_Node is begin return Self : Table_Row_Attribute_Node do Matreshka.ODF_Table.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Table_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Table_Row_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Row_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Row_Attribute, Table_Row_Attribute_Node'Tag); end Matreshka.ODF_Table.Row_Attributes;
sungyeon/drake
Ada
5,849
ads
pragma License (Unrestricted); -- implementation unit specialized for Windows with Ada.Exception_Identification; with Ada.IO_Exceptions; with Ada.IO_Modes; with Ada.Streams; with System.Storage_Elements; with System.Zero_Terminated_WStrings; with C.winbase; with C.windef; with C.winnt; package System.Native_IO is pragma Preelaborate; use type C.windef.DWORD; subtype Name_Character is C.winnt.WCHAR; subtype Name_String is C.winnt.WCHAR_array; subtype Name_Pointer is C.winnt.LPWSTR; subtype Handle_Type is C.winnt.HANDLE; Invalid_Handle : constant Handle_Type := C.winbase.INVALID_HANDLE_VALUE; -- modes subtype File_Mode is C.windef.DWORD; Read_Only_Mode : constant File_Mode := C.winnt.GENERIC_READ; -- 0x80000000 Write_Only_Mode : constant File_Mode := C.winnt.GENERIC_WRITE; -- 0x40000000 Read_Write_Mode : constant File_Mode := Read_Only_Mode or Write_Only_Mode; Read_Write_Mask : constant File_Mode := Read_Write_Mode; Append_Mode : constant File_Mode := 1; pragma Compile_Time_Error ( (Append_Mode and Read_Write_Mask) /= 0, "Append_Mode is overlapped with Read_Write_Mask"); -- name function Value (First : not null access constant Name_Character) return String renames Zero_Terminated_WStrings.Value; procedure Free (Item : in out Name_Pointer); procedure New_External_Name ( Item : String; Out_Item : aliased out Name_Pointer); -- '*' & Name & NUL -- file management procedure Open_Temporary ( Handle : aliased out Handle_Type; Out_Item : aliased out Name_Pointer); type Open_Method is (Open, Create, Reset); pragma Discard_Names (Open_Method); type Packed_Form is record Shared : Ada.IO_Modes.File_Shared_Spec; Wait : Boolean; Overwrite : Boolean; end record; pragma Suppress_Initialization (Packed_Form); pragma Pack (Packed_Form); procedure Open_Ordinary ( Method : Open_Method; Handle : aliased out Handle_Type; Mode : File_Mode; Name : not null Name_Pointer; Form : Packed_Form); procedure Close_Ordinary ( Handle : Handle_Type; Name : Name_Pointer; Raise_On_Error : Boolean); procedure Delete_Ordinary ( Handle : Handle_Type; Name : Name_Pointer; -- not null Raise_On_Error : Boolean); procedure Close_Temporary ( Handle : Handle_Type; Name : Name_Pointer; -- not null Raise_On_Error : Boolean) renames Close_Ordinary; -- procedure Set_Close_On_Exec (Handle : Handle_Type); procedure Unset (Handle : Handle_Type; Mask : File_Mode) is null; pragma Inline (Unset); -- [gcc-7] can not skip calling null procedure function Is_Terminal (Handle : Handle_Type) return Boolean; function Is_Seekable (Handle : Handle_Type) return Boolean; function Block_Size (Handle : Handle_Type) return Ada.Streams.Stream_Element_Count; -- read from file procedure Read ( Handle : Handle_Type; Item : Address; Length : Ada.Streams.Stream_Element_Offset; Out_Length : out Ada.Streams.Stream_Element_Offset); -- -1 when error -- write into file procedure Write ( Handle : Handle_Type; Item : Address; Length : Ada.Streams.Stream_Element_Offset; Out_Length : out Ada.Streams.Stream_Element_Offset); -- -1 when error procedure Flush (Handle : Handle_Type); -- position within file subtype Whence_Type is C.windef.DWORD; From_Begin : constant := C.winbase.FILE_BEGIN; From_Current : constant := C.winbase.FILE_CURRENT; From_End : constant := C.winbase.FILE_END; procedure Set_Relative_Index ( Handle : Handle_Type; Relative_To : Ada.Streams.Stream_Element_Offset; -- 0-origin Whence : Whence_Type; New_Index : out Ada.Streams.Stream_Element_Offset); -- 1-origin function Index (Handle : Handle_Type) return Ada.Streams.Stream_Element_Offset; -- 1-origin function Size (Handle : Handle_Type) return Ada.Streams.Stream_Element_Count; -- default input and output files function Standard_Input return Handle_Type; function Standard_Output return Handle_Type; function Standard_Error return Handle_Type; Uninitialized_Standard_Input : constant Handle_Type := C.winbase.INVALID_HANDLE_VALUE; Uninitialized_Standard_Output : constant Handle_Type := C.winbase.INVALID_HANDLE_VALUE; Uninitialized_Standard_Error : constant Handle_Type := C.winbase.INVALID_HANDLE_VALUE; procedure Initialize ( Standard_Input_Handle : aliased in out Handle_Type; Standard_Output_Handle : aliased in out Handle_Type; Standard_Error_Handle : aliased in out Handle_Type); -- pipes procedure Open_Pipe ( Reading_Handle : aliased out Handle_Type; Writing_Handle : aliased out Handle_Type); -- storage mapped I/O type Mapping_Type is record Storage_Address : Address; Storage_Size : Storage_Elements.Storage_Count; File_Mapping : C.winnt.HANDLE; end record; pragma Suppress_Initialization (Mapping_Type); procedure Map ( Mapping : out Mapping_Type; Handle : Handle_Type; Mode : File_Mode; -- masked by Read_Write_Mask Private_Copy : Boolean; Offset : Ada.Streams.Stream_Element_Offset; -- 1-origin Size : Ada.Streams.Stream_Element_Count); procedure Unmap ( Mapping : in out Mapping_Type; Raise_On_Error : Boolean); -- exceptions function IO_Exception_Id (Error : C.windef.DWORD) return Ada.Exception_Identification.Exception_Id; Name_Error : exception renames Ada.IO_Exceptions.Name_Error; Use_Error : exception renames Ada.IO_Exceptions.Use_Error; Device_Error : exception renames Ada.IO_Exceptions.Device_Error; end System.Native_IO;
reznikmm/matreshka
Ada
3,642
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with League.Holders.Generic_Holders; package AMF.DC.Holders.Colors is new League.Holders.Generic_Holders (AMF.DC.DC_Color); pragma Preelaborate (AMF.DC.Holders.Colors);
Tim-Tom/project-euler
Ada
1,467
adb
with Ada.Text_IO; with PrimeUtilities; package body Problem_72 is package IO renames Ada.Text_IO; subtype One_Million is Long_Integer range 1 .. 1_000_000; package Million_Primes is new PrimeUtilities(One_Million); -- From Farey Sequence Wikipedia Page: -- Using the fact that |F1| = 2, we can derive an expression for the length of F_n: -- | F_n | = 1 + ∑(m = 1, n) φ(m). procedure Solve is count : Long_Integer := 0; sieve : constant Million_Primes.Sieve := Million_Primes.Generate_Sieve(One_Million'Last); procedure Solve_Recursive(min_index : Positive; start_euler, so_far : One_Million) is prime : One_Million; total : One_Million; euler : One_Million; begin for prime_index in min_index .. sieve'Last loop prime := sieve(prime_index); exit when One_Million'Last / prime < so_far; total := so_far * prime; euler := start_euler * (prime - 1); count := count + euler; loop Solve_Recursive(prime_index + 1, euler, total); exit when One_Million'Last / prime < total; total := total * prime; euler := euler * prime; count := count + euler; end loop; end loop; end Solve_Recursive; begin Solve_Recursive(sieve'First, 1, 1); IO.Put_Line(Long_Integer'Image(count)); end Solve; end Problem_72;
skordal/cupcake
Ada
1,336
adb
-- The Cupcake GUI Toolkit -- (c) Kristian Klomsten Skordal 2012 <[email protected]> -- Report bugs and issues on <http://github.com/skordal/cupcake/issues> -- vim:ts=3:sw=3:et:si:sta package body Cupcake.Primitives is -- Adds two points together: function "+" (Left, Right : in Point) return Point is begin return ((Left.X + Right.X), (Left.Y + Right.Y)); end "+"; -- Subtracts two points: function "-" (Left, Right : in Point) return Point is begin return ((Left.X - Right.X), (Left.Y - Right.Y)); end "-"; -- Compares two points for equality: function "=" (Left, Right : in Point) return Boolean is begin return ((Left.X = Right.X) and (Left.Y = Right.Y)); end "="; -- Compares two dimensions: function "<" (Left, Right : in Dimension) return Boolean is begin return (Left.Width * Left.Height) < (Right.Width * Right.Height); end "<"; -- Compares two dimensions: function ">" (Left, Right : in Dimension) return Boolean is begin return (Left.Width * Left.Height) > (Right.Width * Right.Height); end ">"; -- Compares two dimensions: function "=" (Left, Right : in Dimension) return Boolean is begin return (Left.Width * Left.Height) = (Right.Width * Right.Height); end "="; end Cupcake.Primitives;
AdaCore/libadalang
Ada
46
ads
package Test is task type T; end Test;
reznikmm/matreshka
Ada
3,744
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Style_Country_Complex_Attributes is pragma Preelaborate; type ODF_Style_Country_Complex_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Style_Country_Complex_Attribute_Access is access all ODF_Style_Country_Complex_Attribute'Class with Storage_Size => 0; end ODF.DOM.Style_Country_Complex_Attributes;
reznikmm/matreshka
Ada
4,671
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Text.Default_Style_Name_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Default_Style_Name_Attribute_Node is begin return Self : Text_Default_Style_Name_Attribute_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Text_Default_Style_Name_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Default_Style_Name_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Default_Style_Name_Attribute, Text_Default_Style_Name_Attribute_Node'Tag); end Matreshka.ODF_Text.Default_Style_Name_Attributes;
jrcarter/Ada_GUI
Ada
3,004
ads
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . S E R V E R . M I M E -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 David Botton -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- 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/>. -- -- -- -- 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. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ package Ada_GUI.Gnoga.Server.Mime is function Mime_Type (File_Name : String) return String; -- Returns a Mime_Type based on File_Name extension end Ada_GUI.Gnoga.Server.Mime;
Letractively/ada-el
Ada
1,105
ads
----------------------------------------------------------------------- -- el-contexts-tests - Tests the EL contexts -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package EL.Contexts.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Context_Properties (T : in out Test); end EL.Contexts.Tests;
RREE/build-avr-ada-toolchain
Ada
10,616
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M -- -- -- -- S p e c -- -- (AVR Version) -- -- -- -- Copyright (C) 1992-2007 Free Software Foundation, Inc. -- -- Copyright (C) 2004, 2010, 2012, 2015 Rolf Ebert -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ pragma Restrictions (No_Exception_Propagation); -- Only local exception handling is supported in this profile pragma Restrictions (No_Exception_Registration); -- Disable exception name registration. This capability is not used because -- it is only required by exception stream attributes which are not supported. pragma Restrictions (No_Implicit_Dynamic_Code); -- Pointers to nested subprograms are not allowed, in order -- to prevent the compiler from building "trampolines". pragma Restrictions (No_Finalization); -- Controlled types are not supported in this run time pragma Discard_Names; -- Disable explicitly the generation of names associated with entities in -- order to reduce the amount of storage used. These names are not used anyway -- (attributes such as 'Image and 'Value are not supported in this run time). package System is pragma Pure; -- Note that we take advantage of the implementation permission to make -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; -- System-Dependent Named Numbers Min_Int : constant := Long_Long_Integer'First; Max_Int : constant := Long_Long_Integer'Last; Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; Max_Base_Digits : constant := Long_Long_Float'Digits; Max_Digits : constant := Long_Long_Float'Digits; Max_Mantissa : constant := 63; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); Tick : constant := 1.0; -- Storage-related Declarations Storage_Unit : constant := 8; Word_Size : constant := 16; Memory_Size : constant := 2 ** 16; type Address is mod Memory_Size; Null_Address : constant Address := 0; -- Address comparison function "<" (Left, Right : Address) return Boolean; function "<=" (Left, Right : Address) return Boolean; function ">" (Left, Right : Address) return Boolean; function ">=" (Left, Right : Address) return Boolean; function "=" (Left, Right : Address) return Boolean; pragma Import (Intrinsic, "<"); pragma Import (Intrinsic, "<="); pragma Import (Intrinsic, ">"); pragma Import (Intrinsic, ">="); pragma Import (Intrinsic, "="); -- Other System-Dependent Declarations type Bit_Order is (High_Order_First, Low_Order_First); Default_Bit_Order : constant Bit_Order := Low_Order_First; pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -- Priority-related Declarations (RM D.1) Max_Priority : constant Positive := 245; Max_Interrupt_Priority : constant Positive := 255; subtype Any_Priority is Integer range 0 .. 255; subtype Priority is Any_Priority range 0 .. 245; subtype Interrupt_Priority is Any_Priority range 246 .. 255; Default_Priority : constant Priority := 122; private Run_Time_Name : constant String := "AVR Zero Footprint Run Time"; -------------------------------------- -- System Implementation Parameters -- -------------------------------------- -- These parameters provide information about the target that is used -- by the compiler. They are in the private part of System, where they -- can be accessed using the special circuitry in the Targparm unit -- whose source should be consulted for more detailed descriptions -- of the individual switch values. Atomic_Sync_Default : constant Boolean := False; Backend_Divide_Checks : constant Boolean := False; Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := False; -- Set False if no command line arguments on target. Note that if this -- is False in with Configurable_Run_Time_On_Target set to True, then -- this causes suppression of generation of the argv/argc variables -- used to record command line arguments. Configurable_Run_Time : constant Boolean := True; -- Indicates that the system.ads file is for a configurable run-time -- -- In configurable run-time mode, the system run-time may not support -- the full Ada language. The effect of setting this switch is to let -- the compiler know that it is not surprising (i.e. the system is not -- misconfigured) if run-time library units or entities within units are -- not present in the run-time. -- -- This has some specific effects as follows -- -- The binder generates the gnat_argc/argv/envp variables in the -- binder file instead of being imported from the run-time library. -- If Command_Line_Args_On_Target is set to False, then the -- generation of these variables is suppressed completely. Denorm : constant Boolean := True; Duration_32_Bits : constant Boolean := True; Duration_Delta_Microseconds : constant := 1000; -- If True, then Duration is represented in 32 bits and the delta -- and small values are set to Duration_Delta_Microseconds*(10**(-6)) -- (i.e. for Duration_Delta_Microseconds = 20000 it is a count in -- units of 20 milliseconds. -- Duration_Delta_Microseconds must be named integer number. Exit_Status_Supported : constant Boolean := False; -- Set False if returning of an exit status is not supported on target. -- Note that if this False in with Configurable_Run_Time_On_Target -- set to True, then this causes suppression of the gnat_exit_status -- variable used to record the exit status. Fractional_Fixed_Ops : constant Boolean := False; Frontend_Layout : constant Boolean := False; Machine_Overflows : constant Boolean := False; Machine_Rounds : constant Boolean := True; Preallocated_Stacks : constant Boolean := False; Signed_Zeros : constant Boolean := True; Stack_Check_Default : constant Boolean := False; Stack_Check_Probes : constant Boolean := False; Stack_Check_Limits : constant Boolean := False; Support_Aggregates : constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; Support_Long_Shifts : constant Boolean := True; Always_Compatible_Rep : constant Boolean := True; Suppress_Standard_Library : constant Boolean := True; -- If this flag is True, then the standard library is not included by -- default in the executable (see unit System.Standard_Library in file -- s-stalib.ads for details of what this includes). This is for example -- set True for the zero foot print case, where these files should not -- be included by default. -- -- This flag has some other related effects: -- -- The generation of global variables in the bind file is suppressed, -- with the exception of the priority of the environment task, which -- is needed by the Ravenscar run-time. -- -- The generation of exception tables is suppressed for front end -- ZCX exception handling (since we assume no exception handling). -- -- The calls to __gnat_initialize and __gnat_finalize are omitted -- -- All finalization and initialization (controlled types) is omitted -- -- The routine __gnat_handler_installed is not imported Use_Ada_Main_Program_Name : constant Boolean := False; ZCX_By_Default : constant Boolean := False; GCC_ZCX_Support : constant Boolean := False; end System;
zhmu/ananas
Ada
523
ads
-- { dg-do compile } package Atomic2 is type Rec1 is record C : Character; I : Integer; pragma Atomic (I); end record; for Rec1 use record C at 0 range 0 .. 7; I at 1 range 0 .. 31; -- { dg-error "position for atomic|alignment" } end record; type Rec2 is record C : Character; I : Integer; pragma Atomic (I); end record; pragma Pack (Rec2); type My_Int is new Integer; for My_Int'Alignment use 1; pragma Atomic (My_Int); -- { dg-error "atomic access" } end Atomic2;
ESROCOS/control-mc_watchdog
Ada
2,269
adb
-- This file was generated automatically: DO NOT MODIFY IT ! with System.IO; use System.IO; with Ada.Unchecked_Conversion; with Ada.Numerics.Generic_Elementary_Functions; with Base_Types; use Base_Types; with TASTE_ExtendedTypes; use TASTE_ExtendedTypes; with TASTE_BasicTypes; use TASTE_BasicTypes; with UserDefs_Base_Types; use UserDefs_Base_Types; with adaasn1rtl; use adaasn1rtl; with Interfaces; use Interfaces; package body logger is type States is (wait); type ctxt_Ty is record state : States; initDone : Boolean := False; v : aliased asn1SccBase_commands_Motion2D; end record; ctxt: aliased ctxt_Ty; CS_Only : constant Integer := 2; procedure runTransition(Id: Integer); procedure log_cmd(cmd_val: access asn1SccBase_commands_Motion2D) is begin case ctxt.state is when wait => ctxt.v := cmd_val.all; runTransition(1); when others => runTransition(CS_Only); end case; end log_cmd; procedure runTransition(Id: Integer) is trId : Integer := Id; begin while (trId /= -1) loop case trId is when 0 => -- NEXT_STATE Wait (11,18) at 320, 60 trId := -1; ctxt.state := Wait; goto next_transition; when 1 => -- writeln('Logging', v!translation, v!rotation, v!heading!rad) (17,17) Put("Logging"); Put(asn1SccT_Double'Image(ctxt.v.translation)); Put(asn1SccT_Double'Image(ctxt.v.rotation)); Put(asn1SccT_Double'Image(ctxt.v.heading.rad)); New_Line; -- NEXT_STATE Wait (19,22) at 552, 175 trId := -1; ctxt.state := Wait; goto next_transition; when CS_Only => trId := -1; goto next_transition; when others => null; end case; <<next_transition>> null; end loop; end runTransition; begin runTransition(0); ctxt.initDone := True; end logger;
reznikmm/matreshka
Ada
5,937
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; with Matreshka.XML_Schema.AST.Types; package Matreshka.XML_Schema.AST.Identity_Constraints is pragma Preelaborate; type Category is (Key, Keyref, Unique); type Identity_Constraint_Definition_Node is new Abstract_Node with record -- Properties: -- Annotations : Types.Annotation_Lists.List; -- {annotations} -- A sequence of Annotation components. Name : League.Strings.Universal_String; -- {name} -- An xs:NCName value. Required. Target_Namespace : League.Strings.Universal_String; -- {target namespace} -- An xs:anyURI value. Optional. Identity_Constraint_Category : Category; -- {identity-constraint category} -- One of {key, keyref, unique}. Required. Selector : Types.XPath_Expression; -- {selector} -- An XPath Expression property record. Required. Fields : Types.XPath_Expression_Lists.List; -- {fields} -- A sequence of XPath Expression property records. Referenced_Key : Matreshka.XML_Schema.AST.Identity_Constraint_Definition_Access; -- {referenced key} -- An Identity-Constraint Definition component. Required -- if {identity-constraint category} is keyref, -- otherwise ({identity-constraint category} is key or unique) must be -- ·absent·. -- If a value is present, its {identity-constraint category} must be -- key or unique. end record; overriding procedure Enter_Node (Self : not null access Identity_Constraint_Definition_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Node (Self : not null access Identity_Constraint_Definition_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Node (Self : not null access Identity_Constraint_Definition_Node; Iterator : in out Matreshka.XML_Schema.Visitors.Abstract_Iterator'Class; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end Matreshka.XML_Schema.AST.Identity_Constraints;
pmderodat/sdlada
Ada
24,325
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Ada.Unchecked_Conversion; with Interfaces.C; with Interfaces.C.Strings; private with SDL.C_Pointers; with SDL.Error; package body SDL.Video.GL is package C renames Interfaces.C; use type C.int; use type SDL.C_Pointers.GL_Context_Pointer; type Attributes is (Attribute_Red_Size, Attribute_Green_Size, Attribute_Blue_Size, Attribute_Alpha_Size, Attribute_Buffer_Size, Attribute_Double_Buffer, Attribute_Depth_Buffer_Size, Attribute_Stencil_Size, Attribute_Accumulator_Red_Size, Attribute_Accumulator_Green_Size, Attribute_Accumulator_Blue_Size, Attribute_Accumulator_Alpha_Size, Attribute_Stereo, Attribute_Multisample_Buffers, Attribute_Multisample_Samples, Attribute_Accelerated, Attribute_Retained_Backing, Attribute_Context_Major_Version, Attribute_Context_Minor_Version, Attribute_Context_EGL, Attribute_Context_Flags, Attribute_Context_Profile, Attribute_Share_With_Current_Context) with Convention => C; function To_int is new Ada.Unchecked_Conversion (Source => Profiles, Target => C.int); function SDL_GL_Set_Attribute (Attr : in Attributes; Value : in C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_SetAttribute"; function SDL_GL_Get_Attribute (Attr : in Attributes; Value : out C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_GetAttribute"; function Red_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Red_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Red_Size; procedure Set_Red_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Red_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Red_Size; function Green_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Green_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Green_Size; procedure Set_Green_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Green_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Green_Size; function Blue_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Blue_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Blue_Size; procedure Set_Blue_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Blue_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Blue_Size; function Alpha_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Alpha_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Alpha_Size; procedure Set_Alpha_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Alpha_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Alpha_Size; function Buffer_Size return Buffer_Sizes is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Buffer_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Buffer_Sizes (Data); end Buffer_Size; procedure Set_Buffer_Size (Size : in Buffer_Sizes) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Buffer_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Buffer_Size; function Is_Double_Buffered return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Double_Buffer, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Double_Buffered; procedure Set_Double_Buffer (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Double_Buffer, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Double_Buffer; function Depth_Buffer_Size return Depth_Buffer_Sizes is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Depth_Buffer_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Depth_Buffer_Sizes (Data); end Depth_Buffer_Size; procedure Set_Depth_Buffer_Size (Size : in Depth_Buffer_Sizes) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Depth_Buffer_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Depth_Buffer_Size; function Stencil_Buffer_Size return Stencil_Buffer_Sizes is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Stencil_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Stencil_Buffer_Sizes (Data); end Stencil_Buffer_Size; procedure Set_Stencil_Buffer_Size (Size : in Stencil_Buffer_Sizes) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Stencil_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Stencil_Buffer_Size; function Accumulator_Red_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Red_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Red_Size; procedure Set_Accumulator_Red_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Red_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Red_Size; function Accumulator_Green_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Green_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Green_Size; procedure Set_Accumulator_Green_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Green_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Green_Size; function Accumulator_Blue_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Blue_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Blue_Size; procedure Set_Accumulator_Blue_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Blue_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Blue_Size; function Accumulator_Alpha_Size return Colour_Bit_Size is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accumulator_Alpha_Size, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Colour_Bit_Size (Data); end Accumulator_Alpha_Size; procedure Set_Accumulator_Alpha_Size (Size : in Colour_Bit_Size) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Accumulator_Alpha_Size, C.int (Size)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accumulator_Alpha_Size; function Is_Stereo return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Stereo, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Stereo; procedure Set_Stereo (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Stereo, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Stereo; function Is_Multisampled return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Multisample_Buffers, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Multisampled; procedure Set_Multisampling (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Multisample_Buffers, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Multisampling; function Multisampling_Samples return Multisample_Samples is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Multisample_Samples, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Multisample_Samples (Data); end Multisampling_Samples; procedure Set_Multisampling_Samples (Samples : in Multisample_Samples) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Multisample_Samples, C.int (Samples)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Multisampling_Samples; function Is_Accelerated return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Accelerated, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Result = 1); end Is_Accelerated; procedure Set_Accelerated (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Accelerated, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Accelerated; function Context_Major_Version return Major_Versions is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Major_Version, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Major_Versions (Data); end Context_Major_Version; procedure Set_Context_Major_Version (Version : Major_Versions) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Major_Version, C.int (Version)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Major_Version; function Context_Minor_Version return Minor_Versions is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Minor_Version, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Minor_Versions (Data); end Context_Minor_Version; procedure Set_Context_Minor_Version (Version : Minor_Versions) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Minor_Version, C.int (Version)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Minor_Version; function Is_Context_EGL return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_EGL, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Context_EGL; procedure Set_Context_EGL (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_EGL, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_EGL; function Context_Flags return Flags is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Flags, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Flags (Data); end Context_Flags; procedure Set_Context_Flags (Context_Flags : in Flags) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Flags, C.int (Context_Flags)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Flags; function Context_Profile return Profiles is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Context_Profile, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return Profiles'Val (Data); end Context_Profile; procedure Set_Context_Profile (Profile : in Profiles) is Result : C.int := SDL_GL_Set_Attribute (Attribute_Context_Profile, To_int (Profile)); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Context_Profile; function Is_Sharing_With_Current_Context return Boolean is Data : C.int; Result : C.int := SDL_GL_Get_Attribute (Attribute_Share_With_Current_Context, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; return (Data = 1); end Is_Sharing_With_Current_Context; procedure Set_Share_With_Current_Context (On : in Boolean) is Data : C.int := (if On = True then 1 else 0); Result : C.int := SDL_GL_Set_Attribute (Attribute_Share_With_Current_Context, Data); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Share_With_Current_Context; -- Some helper functions to get make this type work ok. function Get_Internal_Window (Self : in SDL.Video.Windows.Window) return SDL.C_Pointers.Windows_Pointer with Import => True, Convention => Ada; function Get_Internal_Texture (Self : in SDL.Video.Textures.Texture) return SDL.C_Pointers.Texture_Pointer with Import => True, Convention => Ada; -- The GL context. procedure Create (Self : in out Contexts; From : in SDL.Video.Windows.Window) is function SDL_GL_Create_Context (W : in SDL.C_Pointers.Windows_Pointer) return SDL.C_Pointers.GL_Context_Pointer with Import => True, Convention => C, External_Name => "SDL_GL_CreateContext"; C : SDL.C_Pointers.GL_Context_Pointer := SDL_GL_Create_Context (Get_Internal_Window (From)); begin if C = null then raise SDL_GL_Error with SDL.Error.Get; end if; Self.Internal := C; Self.Owns := True; end Create; overriding procedure Finalize (Self : in out Contexts) is procedure SDL_GL_Delete_Context (W : in SDL.C_Pointers.GL_Context_Pointer) with Import => True, Convention => C, External_Name => "SDL_GL_DeleteContext"; begin -- We have to own this pointer before we go any further... -- and make sure we don't delete this twice if we do! if Self.Internal /= null and then Self.Owns then SDL_GL_Delete_Context (Self.Internal); Self.Internal := null; end if; end Finalize; -- TODO: Make sure we make all similar functions across the API match this pattern. -- Create a temporary Context. function Get_Current return Contexts is function SDL_GL_Get_Current_Context return SDL.C_Pointers.GL_Context_Pointer with Import => True, Convention => C, External_Name => "SDL_GL_GetCurrentContext"; begin return C : constant Contexts := (Ada.Finalization.Limited_Controlled with Internal => SDL_GL_Get_Current_Context, Owns => False) do if C.Internal = null then raise SDL_GL_Error with SDL.Error.Get; end if; end return; end Get_Current; procedure Set_Current (Self : in Contexts; To : in SDL.Video.Windows.Window) is function SDL_GL_Make_Current (W : in SDL.C_Pointers.Windows_Pointer; Context : in SDL.C_Pointers.GL_Context_Pointer) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_MakeCurrent"; Result : C.int := SDL_GL_Make_Current (Get_Internal_Window (To), Self.Internal); begin if Result /= Success then raise SDL_GL_Error with SDL.Error.Get; end if; end Set_Current; procedure Bind_Texture (Texture : in SDL.Video.Textures.Texture) is function SDL_GL_Bind_Texture (T : in SDL.C_Pointers.Texture_Pointer) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_BindTexture"; begin if SDL_GL_Bind_Texture (Get_Internal_Texture (Texture)) /= SDL.Success then raise SDL_GL_Error with "Cannot bind texture, unsupported operation in this context."; end if; end Bind_Texture; procedure Bind_Texture (Texture : in SDL.Video.Textures.Texture; Size : out SDL.Sizes) is function SDL_GL_Bind_Texture (T : in SDL.C_Pointers.Texture_Pointer; W, H : out C.int) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_BindTexture"; begin if SDL_GL_Bind_Texture (Get_Internal_Texture (Texture), Size.Width, Size.Height) /= SDL.Success then raise SDL_GL_Error with "Cannot bind texture, unsupported operation in this context."; end if; end Bind_Texture; procedure Unbind_Texture (Texture : in SDL.Video.Textures.Texture) is function SDL_GL_Unbind_Texture (T : in SDL.C_Pointers.Texture_Pointer) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_UnbindTexture"; begin if SDL_GL_Unbind_Texture (Get_Internal_Texture (Texture)) /= SDL.Success then raise SDL_GL_Error with "Cannot unbind texture, unsupported operation in this context."; end if; end Unbind_Texture; function Get_Sub_Program (Name : in String) return Access_To_Sub_Program is function SDL_GL_Get_Proc_Address (P : in C.Strings.chars_ptr) return Access_To_Sub_Program with Import => True, Convention => C, External_Name => "SDL_GL_GetProcAddress"; C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Name); Sub_Program : Access_To_Sub_Program := SDL_GL_Get_Proc_Address (C_Name_Str); begin C.Strings.Free (C_Name_Str); return Sub_Program; end Get_Sub_Program; function Supports (Extension : in String) return Boolean is function SDL_GL_Extension_Supported (E : in C.Strings.chars_ptr) return SDL_Bool with Import => True, Convention => C, External_Name => "SDL_GL_ExtensionSupported"; C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Extension); Result : SDL_Bool := SDL_GL_Extension_Supported (C_Name_Str); begin C.Strings.Free (C_Name_Str); return (Result = SDL_True); end Supports; function Get_Swap_Interval return Swap_Intervals is function SDL_GL_Get_Swap_Interval return Swap_Intervals with Import => True, Convention => C, External_Name => "SDL_GL_GetSwapInterval"; begin return SDL_GL_Get_Swap_Interval; end Get_Swap_Interval; function Set_Swap_Interval (Interval : in Allowed_Swap_Intervals; Late_Swap_Tear : in Boolean) return Boolean is function SDL_GL_Set_Swap_Interval (Interval : in Swap_Intervals) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_SetSwapInterval"; Late_Tearing : Swap_Intervals renames Not_Supported; Result : C.int; begin if Late_Swap_Tear then -- Override the interval passed. Result := SDL_GL_Set_Swap_Interval (Late_Tearing); if Result = -1 then -- Try again with synchronised. Result := SDL_GL_Set_Swap_Interval (Synchronised); return (if Result = -1 then False else True); elsif Result = Success then return True; else raise SDL_GL_Error with "Something unexpected happend whilst setting swap interval."; end if; end if; Result := SDL_GL_Set_Swap_Interval (Synchronised); return (if Result = -1 then False else True); end Set_Swap_Interval; procedure Swap (Window : in out SDL.Video.Windows.Window) is procedure SDL_GL_Swap_Window (W : in SDL.C_Pointers.Windows_Pointer) with Import => True, Convention => C, External_Name => "SDL_GL_SwapWindow"; begin SDL_GL_Swap_Window (Get_Internal_Window (Window)); end Swap; procedure Load_Library (Path : in String) is function SDL_GL_Load_Library (P : in C.Strings.chars_ptr) return C.int with Import => True, Convention => C, External_Name => "SDL_GL_LoadLibrary"; C_Name_Str : C.Strings.chars_ptr := C.Strings.New_String (Path); Result : C.int := SDL_GL_Load_Library (C_Name_Str); begin C.Strings.Free (C_Name_Str); if Result /= SDL.Success then raise SDL_GL_Error with "Unable to load OpenGL library """ & Path & '"'; end if; end Load_Library; procedure Unload_Library is procedure SDL_GL_Unload_Library with Import => True, Convention => C, External_Name => "SDL_GL_UnloadLibrary"; begin SDL_GL_Unload_Library; end Unload_Library; end SDL.Video.GL;
reznikmm/matreshka
Ada
3,995
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Style_Scale_To_Attributes; package Matreshka.ODF_Style.Scale_To_Attributes is type Style_Scale_To_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Scale_To_Attributes.ODF_Style_Scale_To_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Scale_To_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Scale_To_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Scale_To_Attributes;
optikos/oasis
Ada
11,431
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Function_Declarations is function Create (Not_Token : Program.Lexical_Elements.Lexical_Element_Access; Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access; Function_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Return_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Null_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Subtype : not null Program.Elements.Element_Access; Is_Token : Program.Lexical_Elements.Lexical_Element_Access; Result_Expression : Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access; Abstract_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Function_Declaration is begin return Result : Function_Declaration := (Not_Token => Not_Token, Overriding_Token => Overriding_Token, Function_Token => Function_Token, Name => Name, Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters, Right_Bracket_Token => Right_Bracket_Token, Return_Token => Return_Token, Not_Token_2 => Not_Token_2, Null_Token => Null_Token, Result_Subtype => Result_Subtype, Is_Token => Is_Token, Result_Expression => Result_Expression, Abstract_Token => Abstract_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Result_Subtype : not null Program.Elements.Element_Access; Result_Expression : Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not : Boolean := False; Has_Overriding : Boolean := False; Has_Abstract : Boolean := False; Has_Not_Null : Boolean := False) return Implicit_Function_Declaration is begin return Result : Implicit_Function_Declaration := (Name => Name, Parameters => Parameters, Result_Subtype => Result_Subtype, Result_Expression => Result_Expression, Aspects => Aspects, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not => Has_Not, Has_Overriding => Has_Overriding, Has_Abstract => Has_Abstract, Has_Not_Null => Has_Not_Null, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Name (Self : Base_Function_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is begin return Self.Name; end Name; overriding function Parameters (Self : Base_Function_Declaration) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is begin return Self.Parameters; end Parameters; overriding function Result_Subtype (Self : Base_Function_Declaration) return not null Program.Elements.Element_Access is begin return Self.Result_Subtype; end Result_Subtype; overriding function Result_Expression (Self : Base_Function_Declaration) return Program.Elements.Parenthesized_Expressions .Parenthesized_Expression_Access is begin return Self.Result_Expression; end Result_Expression; overriding function Aspects (Self : Base_Function_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Not_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function Overriding_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Overriding_Token; end Overriding_Token; overriding function Function_Token (Self : Function_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Function_Token; end Function_Token; overriding function Left_Bracket_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function Return_Token (Self : Function_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Return_Token; end Return_Token; overriding function Not_Token_2 (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token_2; end Not_Token_2; overriding function Null_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Null_Token; end Null_Token; overriding function Is_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function Abstract_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Abstract_Token; end Abstract_Token; overriding function With_Token (Self : Function_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Function_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Has_Not (Self : Function_Declaration) return Boolean is begin return Self.Not_Token.Assigned; end Has_Not; overriding function Has_Overriding (Self : Function_Declaration) return Boolean is begin return Self.Overriding_Token.Assigned; end Has_Overriding; overriding function Has_Abstract (Self : Function_Declaration) return Boolean is begin return Self.Abstract_Token.Assigned; end Has_Abstract; overriding function Has_Not_Null (Self : Function_Declaration) return Boolean is begin return Self.Null_Token.Assigned; end Has_Not_Null; overriding function Is_Part_Of_Implicit (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Has_Not; end Has_Not; overriding function Has_Overriding (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Has_Overriding; end Has_Overriding; overriding function Has_Abstract (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Has_Abstract; end Has_Abstract; overriding function Has_Not_Null (Self : Implicit_Function_Declaration) return Boolean is begin return Self.Has_Not_Null; end Has_Not_Null; procedure Initialize (Self : aliased in out Base_Function_Declaration'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Result_Subtype, Self'Unchecked_Access); if Self.Result_Expression.Assigned then Set_Enclosing_Element (Self.Result_Expression, Self'Unchecked_Access); end if; for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Function_Declaration_Element (Self : Base_Function_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Function_Declaration_Element; overriding function Is_Declaration_Element (Self : Base_Function_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Function_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Function_Declaration (Self); end Visit; overriding function To_Function_Declaration_Text (Self : aliased in out Function_Declaration) return Program.Elements.Function_Declarations .Function_Declaration_Text_Access is begin return Self'Unchecked_Access; end To_Function_Declaration_Text; overriding function To_Function_Declaration_Text (Self : aliased in out Implicit_Function_Declaration) return Program.Elements.Function_Declarations .Function_Declaration_Text_Access is pragma Unreferenced (Self); begin return null; end To_Function_Declaration_Text; end Program.Nodes.Function_Declarations;
GauBen/Arbre-Genealogique
Ada
1,910
ads
generic Modulo : Integer; type T_Element is private; -- Un registre est une table de hachage. package Registre is type T_Registre is limited private; Cle_Absente_Exception : exception; -- Renvoie vrai si le registre est entièrement vide. function Est_Vide (Registre : T_Registre) return Boolean; -- Initialiser un registre vide. procedure Initialiser (Registre : out T_Registre) with Post => Est_Vide (Registre); -- Renvoie vrai si la clé est presente dans le registre. function Existe (Registre : T_Registre; Cle : Integer) return Boolean; -- Insère ou modifie un élément dans le registre. procedure Attribuer (Registre : in out T_Registre; Cle : in Integer; Element : in T_Element); -- Renvoie un élément du registre. -- Lance Cle_Absente_Exception si la clé n'est pas trouvee. function Acceder (Registre : T_Registre; Cle : Integer) return T_Element; -- Applique une procédure P sur tous les éléments du registre. generic with procedure P (Cle : in Integer; Element : in T_Element); procedure Appliquer_Sur_Tous (Registre : in T_Registre); -- Supprime un élément du registre. procedure Supprimer (Registre : in out T_Registre; Cle : in Integer); -- Supprime tous les éléments du registre. procedure Detruire (Registre : in out T_Registre) with Post => Est_Vide (Registre); private -- On choisit de representer un registre par un tableau de pointeurs. -- Une case de ce tableau contient une chaîne de tous les elements dont -- la valeur de la clé par la fonction de hachage est la même. type T_Maillon; type T_Pointeur_Sur_Maillon is access T_Maillon; type T_Maillon is record Cle : Integer; Element : T_Element; Suivant : T_Pointeur_Sur_Maillon; end record; type T_Registre is array (1 .. Modulo) of T_Pointeur_Sur_Maillon; end Registre;
annexi-strayline/AURA
Ada
6,452
ads
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019-2020, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * Richard Wai (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- This package contains the All_Library_Units and All_Subsystems sets and -- access synchronization with Unit_Names, Unit_Names.Sets; with Registrar.Protected_Set; with Registrar.Protected_Map; with Registrar.Library_Units; with Registrar.Subsystems; with Registrar.Dependency_Maps; private package Registrar.Registry is ----------------------- -- All_Library_Units -- ----------------------- package All_Library_Units is new Protected_Set (Element_Type => Registrar.Library_Units.Library_Unit, Sets => Registrar.Library_Units.Library_Unit_Sets); ------------------------------- -- Unit_Forward_Dependencies -- ------------------------------- -- A given Library_Unit name ket maps to a set of all Library_Unit -- names that the given Library_Unit depends on. This includes any -- dependencies of the unit's subunits (if any) package Unit_Forward_Dependencies is new Protected_Map (Key_Type => Unit_Names.Unit_Name, Element_Type => Unit_Names.Sets.Set, Maps => Dependency_Maps); ------------------------------- -- Unit_Reverse_Dependencies -- ------------------------------- -- A given Library_Unit name key maps to a set of all Library_Unit -- names that depend on the given Library_Unit. This is used to trace -- recompilation dependencies package Unit_Reverse_Dependencies is new Protected_Map (Key_Type => Unit_Names.Unit_Name, Element_Type => Unit_Names.Sets.Set, Maps => Dependency_Maps); -------------------- -- All_Subsystems -- -------------------- package All_Subsystems is new Protected_Set (Element_Type => Registrar.Subsystems.Subsystem, Sets => Registrar.Subsystems.Subsystem_Sets); ------------------------------------ -- Subsystem_Forward_Dependencies -- ------------------------------------ -- A given Subsystem name key maps to a set of all Subsystem names -- on which the given Subsystem depends. This is used to ensure that -- all Subsystems checked-out from a "System" repository only depend -- on other subsystems that are also from the same repository package Subsystem_Forward_Dependencies is new Protected_Map (Key_Type => Unit_Names.Unit_Name, Element_Type => Unit_Names.Sets.Set, Maps => Dependency_Maps); ------------------------------------ -- Subsystem_Reverse_Dependencies -- ------------------------------------ -- A given Subsystem name key maps to a set of all Subsystem names that -- depend on the given Subsystem. This is used to trace provide additional -- information to the user when Subsystems cannot be aquired package Subsystem_Reverse_Dependencies is new Protected_Map (Key_Type => Unit_Names.Unit_Name, Element_Type => Unit_Names.Sets.Set, Maps => Dependency_Maps); end Registrar.Registry;
sungyeon/drake
Ada
1,034
ads
pragma License (Unrestricted); -- implementation unit required by compiler with System.Packed_Arrays; package System.Pack_12 is pragma Preelaborate; -- It can not be Pure, subprograms would become __attribute__((const)). type Bits_12 is mod 2 ** 12; for Bits_12'Size use 12; package Indexing is new Packed_Arrays.Indexing (Bits_12); -- required for accessing aligned arrays by compiler function Get_12 ( Arr : Address; N : Natural; Rev_SSO : Boolean) return Bits_12 renames Indexing.Get; procedure Set_12 ( Arr : Address; N : Natural; E : Bits_12; Rev_SSO : Boolean) renames Indexing.Set; -- required for accessing unaligned arrays by compiler function GetU_12 ( Arr : Address; N : Natural; Rev_SSO : Boolean) return Bits_12 renames Indexing.Get; procedure SetU_12 ( Arr : Address; N : Natural; E : Bits_12; Rev_SSO : Boolean) renames Indexing.Set; end System.Pack_12;
reznikmm/matreshka
Ada
3,739
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_Shadow_Offset_Y_Attributes is pragma Preelaborate; type ODF_Draw_Shadow_Offset_Y_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Shadow_Offset_Y_Attribute_Access is access all ODF_Draw_Shadow_Offset_Y_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Shadow_Offset_Y_Attributes;
reznikmm/matreshka
Ada
3,719
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Db_Apply_Command_Attributes is pragma Preelaborate; type ODF_Db_Apply_Command_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Db_Apply_Command_Attribute_Access is access all ODF_Db_Apply_Command_Attribute'Class with Storage_Size => 0; end ODF.DOM.Db_Apply_Command_Attributes;
onox/orka
Ada
15,367
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2012 Felix Krause <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Unchecked_Conversion; with System; with GL.API; with GL.Enums.Getter; with GL.Pixels; package body GL.Objects.Buffers is function Minimum_Alignment return Types.Size is Ret : Types.Size := 64; begin API.Get_Size.Ref (Enums.Getter.Min_Map_Buffer_Alignment, Ret); return Ret; end Minimum_Alignment; function Max_Shader_Storage_Buffer_Bindings return Size is Value : Size := 0; begin API.Get_Size.Ref (Enums.Getter.Max_Shader_Storage_Buffer_Bindings, Value); return Value; end Max_Shader_Storage_Buffer_Bindings; function Max_Shader_Storage_Block_Size return Size is Value : Size := 0; begin API.Get_Size.Ref (Enums.Getter.Max_Shader_Storage_Block_Size, Value); return Value; end Max_Shader_Storage_Block_Size; function Max_Compute_Shader_Storage_Blocks return Size is Value : Size := 0; begin API.Get_Size.Ref (Enums.Getter.Max_Compute_Shader_Storage_Blocks, Value); return Value; end Max_Compute_Shader_Storage_Blocks; use type Enums.Buffer_Kind; type Format_Data is record Internal_Format : GL.Pixels.Internal_Format_Buffer_Texture; Format : GL.Pixels.Format; Data_Type : GL.Pixels.Data_Type; end record; function Get_Format_Data (Kind : Numeric_Type; Length : Natural) return Format_Data is use GL.Pixels; type Format_Array is array (1 .. 4) of Format; Float_Formats : constant Format_Array := (Red, RG, RGB, RGBA); Integer_Formats : constant Format_Array := (Red_Integer, RG_Integer, RGB_Integer, RGBA_Integer); type Internal_Format_Array is array (1 .. 4) of Internal_Format_Buffer_Texture; Internal_Formats : Internal_Format_Array; begin return Result : Format_Data do -- For certain data types, OpenGL does not provide a sized -- internal format [for buffer textures] that has three components case Kind is when Byte_Type => Result.Data_Type := Pixels.Byte; Internal_Formats := (R8I, RG8I, R8I, RGBA8I); -- Third position invalid when UByte_Type => Result.Data_Type := Pixels.Unsigned_Byte; Internal_Formats := (R8UI, RG8UI, R8UI, RGBA8UI); -- Third position invalid when Short_Type => Result.Data_Type := Pixels.Short; Internal_Formats := (R16I, RG16I, R16I, RGBA16I); -- Third position invalid when UShort_Type => Result.Data_Type := Pixels.Unsigned_Short; Internal_Formats := (R16UI, RG16UI, R16UI, RGBA16UI); -- Third position invalid when Int_Type => Result.Data_Type := Pixels.Int; Internal_Formats := (R32I, RG32I, RGB32I, RGBA32I); when UInt_Type => Result.Data_Type := Pixels.Unsigned_Int; Internal_Formats := (R32UI, RG32UI, RGB32UI, RGBA32UI); when Half_Type => Result.Data_Type := Pixels.Half_Float; Internal_Formats := (R16F, RG16F, R16F, RGBA16F); -- Third position invalid when Single_Type => Result.Data_Type := Pixels.Float; Internal_Formats := (R32F, RG32F, RGB32F, RGBA32F); when Double_Type => raise Constraint_Error; end case; Result.Internal_Format := Internal_Formats (Length); case Kind is when Byte_Type .. UInt_Type => Result.Format := Integer_Formats (Length); when Half_Type | Single_Type => Result.Format := Float_Formats (Length); when Double_Type => raise Constraint_Error; end case; end return; end Get_Format_Data; function Kind (Target : Buffer_Target) return Indexed_Buffer_Target is (case Target.Kind is when Enums.Shader_Storage_Buffer => Shader_Storage, when Enums.Uniform_Buffer => Uniform, when others => raise Constraint_Error); procedure Bind (Target : Buffer_Target; Object : Buffer'Class) is begin API.Bind_Buffer.Ref (Target.Kind, Object.Reference.GL_Id); end Bind; procedure Bind_Base (Target : Buffer_Target; Object : Buffer'Class; Index : Natural) is begin API.Bind_Buffer_Base.Ref (Target.Kind, UInt (Index), Object.Reference.GL_Id); end Bind_Base; procedure Allocate_Storage (Object : in out Buffer; Length : Long; Kind : Numeric_Type; Flags : Storage_Bits) is use type Low_Level.Bitfield; function Convert is new Ada.Unchecked_Conversion (Source => Storage_Bits, Target => Low_Level.Bitfield); Raw_Bits : constant Low_Level.Bitfield := Convert (Flags) and 2#0000001111000011#; Number_Of_Bytes : Long; begin case Kind is when Half_Type => Number_Of_Bytes := Length * Half'Size / System.Storage_Unit; when Single_Type => Number_Of_Bytes := Length * Single'Size / System.Storage_Unit; when Double_Type => Number_Of_Bytes := Length * Double'Size / System.Storage_Unit; when UInt_Type => Number_Of_Bytes := Length * UInt'Size / System.Storage_Unit; when UByte_Type => Number_Of_Bytes := Length * UByte'Size / System.Storage_Unit; when UShort_Type => Number_Of_Bytes := Length * UShort'Size / System.Storage_Unit; when Int_Type => Number_Of_Bytes := Length * Int'Size / System.Storage_Unit; when Byte_Type => Number_Of_Bytes := Length * Byte'Size / System.Storage_Unit; when Short_Type => Number_Of_Bytes := Length * Short'Size / System.Storage_Unit; end case; API.Named_Buffer_Storage.Ref (Object.Reference.GL_Id, Low_Level.SizeIPtr (Number_Of_Bytes), System.Null_Address, Raw_Bits); Object.Allocated := True; end Allocate_Storage; function Allocated (Object : Buffer) return Boolean is (Object.Allocated); function Mapped (Object : Buffer) return Boolean is (Object.Mapped); overriding procedure Initialize_Id (Object : in out Buffer) is New_Id : UInt := 0; begin API.Create_Buffers.Ref (1, New_Id); Object.Reference.GL_Id := New_Id; end Initialize_Id; overriding procedure Delete_Id (Object : in out Buffer) is Arr : constant Low_Level.UInt_Array := (1 => Object.Reference.GL_Id); begin API.Delete_Buffers.Ref (1, Arr); Object.Reference.GL_Id := 0; end Delete_Id; procedure Unmap (Object : in out Buffer) is begin API.Unmap_Named_Buffer.Ref (Object.Reference.GL_Id); Object.Mapped := False; end Unmap; procedure Invalidate_Data (Object : in out Buffer) is begin API.Invalidate_Buffer_Data.Ref (Object.Reference.GL_Id); end Invalidate_Data; package body Buffer_Pointers is package Map_Named_Buffer_Range is new API.Loader.Function_With_4_Params ("glMapNamedBufferRange", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr, Low_Level.Bitfield, Pointers.Pointer); package Get_Named_Buffer_Sub_Data is new API.Loader.Getter_With_4_Params ("glGetNamedBufferSubData", UInt, Low_Level.IntPtr, Low_Level.SizeIPtr, Pointers.Element_Array); Element_In_Bytes : constant Int := Pointers.Element'Size / System.Storage_Unit; procedure Bind_Range (Target : Buffer_Target; Object : Buffer'Class; Index : Natural; Offset, Length : Types.Size) is Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Length * Element_In_Bytes; begin API.Bind_Buffer_Range.Ref (Target.Kind, UInt (Index), Object.Reference.GL_Id, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes)); end Bind_Range; procedure Allocate_And_Load_From_Data (Object : in out Buffer; Data : Pointers.Element_Array; Flags : Storage_Bits) is use type Low_Level.Bitfield; function Convert is new Ada.Unchecked_Conversion (Source => Storage_Bits, Target => Low_Level.Bitfield); Raw_Bits : constant Low_Level.Bitfield := Convert (Flags) and 2#0000001111000011#; Number_Of_Bytes : constant Int := Data'Length * Element_In_Bytes; begin API.Named_Buffer_Storage.Ref (Object.Reference.GL_Id, Low_Level.SizeIPtr (Number_Of_Bytes), Data (Data'First)'Address, Raw_Bits); Object.Allocated := True; end Allocate_And_Load_From_Data; procedure Map_Range (Object : in out Buffer; Flags : Access_Bits; Offset, Length : Types.Size; Pointer : out Pointers.Pointer) is use type Low_Level.Bitfield; use type Pointers.Pointer; function Convert is new Ada.Unchecked_Conversion (Source => Access_Bits, Target => Low_Level.Bitfield); Raw_Bits : constant Low_Level.Bitfield := Convert (Flags) and 2#0000000011111111#; Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Length * Element_In_Bytes; begin Pointer := Map_Named_Buffer_Range.Ref (Object.Reference.GL_Id, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes), Raw_Bits); Object.Mapped := Pointer /= null; end Map_Range; function Get_Mapped_Data (Pointer : not null Pointers.Pointer; Offset, Length : Types.Size) return Pointers.Element_Array is package IC renames Interfaces.C; use type Pointers.Pointer; begin return Pointers.Value (Pointer + IC.ptrdiff_t (Offset), IC.ptrdiff_t (Length)); end Get_Mapped_Data; procedure Set_Mapped_Data (Pointer : not null Pointers.Pointer; Offset : Types.Size; Data : Pointers.Element_Array) is package IC renames Interfaces.C; use type Pointers.Pointer; subtype Data_Array is Pointers.Element_Array (Data'Range); type Data_Access is access Data_Array; function Convert is new Ada.Unchecked_Conversion (Source => Pointers.Pointer, Target => Data_Access); begin Convert (Pointer + IC.ptrdiff_t (Offset)).all := Data; end Set_Mapped_Data; procedure Set_Mapped_Data (Pointer : not null Pointers.Pointer; Offset : Types.Size; Value : Pointers.Element) is package IC renames Interfaces.C; use type Pointers.Pointer; Offset_Pointer : constant Pointers.Pointer := Pointer + IC.ptrdiff_t (Offset); begin Offset_Pointer.all := Value; end Set_Mapped_Data; procedure Flush_Buffer_Range (Object : in out Buffer; Offset, Length : Types.Size) is Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Length * Element_In_Bytes; begin API.Flush_Mapped_Named_Buffer_Range.Ref (Object.Reference.GL_Id, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes)); end Flush_Buffer_Range; procedure Clear_Sub_Data (Object : Buffer; Kind : Numeric_Type; Offset, Length : Types.Size; Data : in out Pointers.Element_Array) is Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Length_In_Bytes : constant Int := Length * Element_In_Bytes; Format_Info : constant Format_Data := Get_Format_Data (Kind, Natural'Max (1, Data'Length)); begin API.Clear_Named_Buffer_Sub_Data.Ref (Object.Reference.GL_Id, Format_Info.Internal_Format, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Length_In_Bytes), Format_Info.Format, Format_Info.Data_Type, (if Data'Length = 0 then System.Null_Address else Data (Data'First)'Address)); end Clear_Sub_Data; procedure Copy_Sub_Data (Object, Target_Object : Buffer; Read_Offset, Write_Offset, Length : Types.Size) is Read_Offset_In_Bytes : constant Int := Read_Offset * Element_In_Bytes; Write_Offset_In_Bytes : constant Int := Write_Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Length * Element_In_Bytes; begin API.Copy_Named_Buffer_Sub_Data.Ref (Object.Reference.GL_Id, Target_Object.Reference.GL_Id, Low_Level.IntPtr (Read_Offset_In_Bytes), Low_Level.IntPtr (Write_Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes)); end Copy_Sub_Data; procedure Set_Sub_Data (Object : Buffer; Offset : Types.Size; Data : Pointers.Element_Array) is Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Data'Length * Element_In_Bytes; begin API.Named_Buffer_Sub_Data.Ref (Object.Reference.GL_Id, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes), Data (Data'First)'Address); end Set_Sub_Data; procedure Get_Sub_Data (Object : Buffer; Offset : Types.Size; Data : out Pointers.Element_Array) is Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Data'Length * Element_In_Bytes; begin Get_Named_Buffer_Sub_Data.Ref (Object.Reference.GL_Id, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes), Data); end Get_Sub_Data; procedure Invalidate_Sub_Data (Object : Buffer; Offset, Length : Types.Size) is Offset_In_Bytes : constant Int := Offset * Element_In_Bytes; Number_Of_Bytes : constant Int := Length * Element_In_Bytes; begin API.Invalidate_Buffer_Sub_Data.Ref (Object.Reference.GL_Id, Low_Level.IntPtr (Offset_In_Bytes), Low_Level.SizeIPtr (Number_Of_Bytes)); end Invalidate_Sub_Data; end Buffer_Pointers; end GL.Objects.Buffers;
onox/orka
Ada
3,852
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2020 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with EGL.API; with EGL.Objects.Displays; with EGL.Errors; package body EGL.Objects.Devices is function Extensions (Object : Device) return String_List is begin Check_Extension (Displays.Client_Extensions, "EGL_EXT_device_query"); declare Result : constant C.Strings.chars_ptr := API.Query_Device_String.Ref (Object.ID, Extensions); use all type C.Strings.chars_ptr; begin if Result = C.Strings.Null_Ptr then Errors.Raise_Exception_On_EGL_Error; return (1 .. 0 => SU.To_Unbounded_String ("")); else return EGL.Extensions (Result); end if; end; end Extensions; function DRM_Name (Object : Device) return String is begin Check_Extension (Object.Extensions, "EGL_EXT_device_drm"); declare Result : constant C.Strings.chars_ptr := API.Query_Device_String.Ref (Object.ID, DRM_Device_File); use all type C.Strings.chars_ptr; begin if Result = C.Strings.Null_Ptr then Errors.Raise_Exception_On_EGL_Error; return ""; else return Trim (Result); end if; end; end DRM_Name; function Name (Object : Device) return String is begin return DRM_Name (Object); exception when Feature_Not_Supported => return ""; end Name; function Devices return Device_List is Max_Devices : constant := 16; Devices : ID_Array (1 .. Max_Devices); Count : Int := 0; begin Check_Extension (Displays.Client_Extensions, "EGL_EXT_device_enumeration"); if API.Query_Devices.Ref (Max_Devices, Devices, Count) then return Result : Device_List (1 .. Natural (Count)) do for Index in Result'Range loop Result (Index).Reference.ID := Devices (Index); pragma Assert (Result (Index).Display = No_Display); end loop; end return; else Errors.Raise_Exception_On_EGL_Error; return (1 .. 0 => <>); end if; end Devices; function Get_Device (Subject : Displays.Display) return Device is Device_Ext : constant Int := 16#322C#; ID : ID_Type; begin Check_Extension (Displays.Client_Extensions, "EGL_EXT_device_query"); if API.Query_Display_Attrib.Ref (Subject.ID, Device_Ext, ID) then return Result : Device do Result.Reference.ID := ID; -- The device needs to keep a reference to the display, -- otherwise the display can get finalized and any further -- use of the device would then give undefined results pragma Assert (Result.Display = No_Display); Result.Display := (Ada.Finalization.Controlled with Reference => EGL_Object (Subject).Reference); Result.Display.Reference.Count := Result.Display.Reference.Count + 1; pragma Assert (Result.Display /= No_Display); end return; else Errors.Raise_Exception_On_EGL_Error; return Result : Device; end if; end Get_Device; end EGL.Objects.Devices;
MinimSecure/unum-sdk
Ada
833
adb
-- Copyright 2017-2019 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 procedure Do_Nothing (A : System.Address) is begin null; end Do_Nothing; end pck;
charlie5/lace
Ada
12,004
adb
with openGL.Camera, openGL.Model.billboard.textured, ada.unchecked_Deallocation; package body openGL.Impostor is --------- --- Forge -- procedure destroy (Self : in out Item) is use openGL.Visual, Model, Texture; the_Model : Model.view := Self.Visual.Model; the_Texture : Texture.Object := Model.billboard.textured.view (the_Model).Texture; begin free (the_Texture); free (the_Model); free (Self.Visual); end destroy; procedure free (Self : in out View) is procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View); begin if Self /= null then destroy (Self.all); deallocate (Self); end if; end free; -------------- --- Attributes -- procedure Visual_is (Self : in out Item; Now : in openGL.Visual.view) is begin Self.Visual := Now; end Visual_is; function Visual (Self : access Item) return openGL.Visual.view is begin return Self.Visual; end Visual; function get_Target (Self : in Item) return openGL.Visual.view is begin return Self.Target; end get_Target; procedure set_Target (Self : in out Item; Target : in openGL.Visual.view) is use type openGL.Visual.view; Width : constant Real := Target.Model.Bounds.Ball * 2.00; Height : constant Real := Target.Model.Bounds.Ball * 2.00; begin if Self.Visual = null then Self.Visual := new openGL.Visual.item; end if; Self.Target := Target; Self.is_Terrain := Target.is_Terrain; Self.Visual.Model_is (Model.billboard.textured.Forge.new_Billboard (Size => (Width => Width, Height => Height), Plane => Model.billboard.xy, Texture => null_Asset).all'Access); Self.Visual.Transform_is (Target.Transform); -- Self.Visual.model_Transform_is (Target.model_Transform); end set_Target; function target_camera_Distance (Self : in Item'Class) return Real is begin return Self.target_camera_Distance; end target_camera_Distance; function is_Valid (Self : in Item'Class) return Boolean is begin return Self.is_Valid; end is_Valid; function never_Updated (Self : in Item'Class) return Boolean is begin return Self.never_Updated; end never_Updated; function frame_Count_since_last_update (Self : in Item'Class) return Natural is begin return Natural (Self.freshen_Count); end frame_Count_since_last_update; function face_Count (Self : in Item) return Natural is pragma unreferenced (Self); begin return 1; end face_Count; procedure set_Alpha (Self : in out Item; Alpha : in Real) is begin null; -- TODO end set_Alpha; function Bounds (Self : in Item) return openGL.Bounds is pragma Unreferenced (Self); begin return (others => <>); -- TODO end Bounds; pragma Unreferenced (Bounds); function is_Transparent (Self : in Item) return Boolean is pragma unreferenced (Self); begin return True; end is_Transparent; -- Update trigger configuration. -- procedure set_freshen_count_update_trigger_Mod (Self : in out Item; To : in Positive) is begin Self.freshen_count_update_trigger_Mod := Counter (To); end set_freshen_count_update_trigger_Mod; function get_freshen_count_update_trigger_Mod (Self : in Item) return Positive is begin return Positive (Self.freshen_count_update_trigger_Mod); end get_freshen_count_update_trigger_Mod; procedure set_size_update_trigger_Delta (Self : in out Item; To : in Positive) is begin Self.size_update_trigger_Delta := gl.glSizeI (To); end set_size_update_trigger_Delta; function get_size_update_trigger_Delta (Self : in Item) return Positive is begin return Positive (Self.size_update_trigger_Delta); end get_size_update_trigger_Delta; function general_Update_required (Self : access Item; the_Camera_Site : in Vector_3; the_pixel_Region : in pixel_Region) return Boolean is pragma unreferenced (the_pixel_Region); use linear_Algebra_3d; use type gl.GLsizei; Camera_has_moved : constant Boolean := the_Camera_Site /= Self.prior_camera_Position; Target_has_moved : constant Boolean := get_Translation (Self.Target.Transform) /= Self.prior_target_Position; -- Target_has_moved : constant Boolean := get_Translation (Self.Target.model_Transform) /= Self.prior_target_Position; begin Self.freshen_Count := Self.freshen_Count + 1; if Self.freshen_Count > Self.freshen_count_update_trigger_Mod then return True; end if; if Camera_has_moved and then abs (Angle (the_Camera_Site, Self.prior_target_Position, Self.prior_camera_Position)) > to_Radians (15.0) then return True; end if; if Target_has_moved and then abs (Angle (get_Translation (Self.Target.Transform), -- and then abs (Angle (get_Translation (Self.Target.model_Transform), Self.prior_camera_Position, Self.prior_target_Position)) > to_Radians (15.0) then return True; end if; if Self.prior_pixel_Region.Width > 40 -- Ignore target rotation triggered updates when target is small on screen. and then Self.prior_pixel_Region.Height > 40 -- and then Self.prior_target_Rotation /= get_Rotation (Self.Target.Transform) -- and then Self.prior_target_Rotation /= get_Rotation (Self.Target.model_Transform) then return True; end if; return False; end general_Update_required; function size_Update_required (Self : access Item; the_pixel_Region : in pixel_Region) return Boolean is use GL; use type gl.GLsizei; begin return abs (the_pixel_Region.Width - Self.prior_Width_Pixels) > Self.size_update_trigger_Delta or abs (the_pixel_Region.Height - Self.prior_Height_pixels) > Self.size_update_trigger_Delta; end size_Update_required; function get_pixel_Region (Self : access Item'Class; camera_Spin : in Matrix_3x3; camera_Site : in Vector_3; camera_projection_Transform : in Matrix_4x4; camera_Viewport : in linear_Algebra_3d.Rectangle) return pixel_Region is use linear_Algebra_3D; -- target_Centre : constant Vector_3 := camera_Spin * ( get_Translation (Self.Target.model_Transform) target_Centre : constant Vector_3 := camera_Spin * ( get_Translation (Self.Target.Transform) - camera_Site); target_lower_Left : constant Vector_3 := target_Centre - [Self.Target.Model.Bounds.Ball, Self.Target.Model.Bounds.Ball, 0.0]; target_Centre_proj : constant Vector_4 := target_Centre * camera_projection_Transform; target_Lower_Left_proj : constant Vector_4 := target_lower_Left * camera_projection_Transform; target_Centre_norm : constant Vector_3 := [target_Centre_proj (1) / target_Centre_proj (4), target_Centre_proj (2) / target_Centre_proj (4), target_Centre_proj (3) / target_Centre_proj (4)]; target_Lower_Left_norm : constant Vector_3 := [target_Lower_Left_proj (1) / target_Lower_Left_proj (4), target_Lower_Left_proj (2) / target_Lower_Left_proj (4), target_Lower_Left_proj (3) / target_Lower_Left_proj (4)]; target_Centre_norm_0to1 : constant Vector_3 := [target_Centre_norm (1) * 0.5 + 0.5, target_Centre_norm (2) * 0.5 + 0.5, target_Centre_norm (3) * 0.5 + 0.5]; target_Lower_Left_norm_0to1 : constant Vector_3 := [target_Lower_Left_norm (1) * 0.5 + 0.5, target_Lower_Left_norm (2) * 0.5 + 0.5, target_Lower_Left_norm (3) * 0.5 + 0.5]; viewport_Width : constant Integer := camera_Viewport.Max (1) - camera_Viewport.Min (1) + 1; viewport_Height : constant Integer := camera_Viewport.Max (2) - camera_Viewport.Min (2) + 1; Width : constant Real := 2.0 * Real (viewport_Width) * ( target_Centre_norm_0to1 (1) - target_Lower_Left_norm_0to1 (1)); Width_pixels : constant gl.glSizei := gl.glSizei ( Integer (Real (viewport_Width) * target_Lower_Left_norm_0to1 (1) + Width) - Integer (Real (viewport_Width) * target_Lower_Left_norm_0to1 (1)) + 1); Height : constant Real := 2.0 * Real (viewport_Height) * ( target_Centre_norm_0to1 (2) - target_Lower_Left_norm_0to1 (2)); Height_pixels : constant gl.glSizei := gl.glSizei ( Integer (Real (viewport_Height) * target_Lower_Left_norm_0to1 (2) + Height) - Integer (Real (viewport_Height) * target_Lower_Left_norm_0to1 (2)) + 1); use type gl.GLsizei; begin Self.all.target_camera_Distance := abs (target_Centre); -- NB: Cache distance from camera to target. return (X => gl.glInt (target_Lower_Left_norm_0to1 (1) * Real (Viewport_Width)) - 0, Y => gl.glInt (target_Lower_Left_norm_0to1 (2) * Real (viewport_Height)) - 0, Width => Width_pixels + 0, Height => Height_pixels + 0); end get_pixel_Region; -------------- -- Operations -- procedure update (Self : in out Item; the_Camera : access Camera.item'Class; texture_Pool : in texture.Pool_view) is pragma unreferenced (the_Camera, texture_Pool); use openGL.Visual; -- Width_size : constant openGL.texture.Size := to_Size (Natural (Self.current_Width_pixels)); -- Height_size : constant openGL.texture.Size := to_Size (Natural (Self.current_Height_pixels)); -- texture_Width : constant gl.glSizei := power_of_2_Ceiling (Natural (Self.current_Width_pixels )); -- texture_Height : constant gl.glSizei := power_of_2_Ceiling (Natural (Self.current_Height_pixels)); the_Model : constant Model.billboard.textured.view := Model.billboard.textured.view (Self.Visual.Model); -- GL_Error : Boolean; begin Self.Visual.all := Self.Target.all; Self.Visual.Model_is (the_Model.all'Access); end update; end openGL.Impostor;
charlie5/aIDE
Ada
1,248
ads
with Ada.Containers.Vectors, Ada.Streams; private with AdaM.a_Type; package AdaM.use_Clause.for_type is type Item is new use_Clause.item with private; -- View -- type View is access all Item'Class; procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View); procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View); for View'write use View_write; for View'read use View_read; -- Vector -- package Vectors is new ada.Containers.Vectors (Positive, View); subtype Vector is Vectors.Vector; -- Forge -- function new_Subprogram return use_Clause.for_type.view; procedure free (Self : in out use_Clause.for_type.view); overriding procedure destruct (Self : in out use_Clause.for_type.item); -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id; private type Item is new use_Clause.item with record all_Qualifier : Boolean; Types : AdaM.a_Type.vector; end record; end AdaM.use_Clause.for_type;
reznikmm/matreshka
Ada
37,703
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Conditional_Nodes is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Conditional_Node_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Conditional_Node (AMF.UML.Conditional_Nodes.UML_Conditional_Node_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Conditional_Node_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Conditional_Node (AMF.UML.Conditional_Nodes.UML_Conditional_Node_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Conditional_Node_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Conditional_Node (Visitor, AMF.UML.Conditional_Nodes.UML_Conditional_Node_Access (Self), Control); end if; end Visit_Element; ---------------- -- Get_Clause -- ---------------- overriding function Get_Clause (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Clauses.Collections.Set_Of_UML_Clause is begin return AMF.UML.Clauses.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Clause (Self.Element))); end Get_Clause; -------------------- -- Get_Is_Assured -- -------------------- overriding function Get_Is_Assured (Self : not null access constant UML_Conditional_Node_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Assured (Self.Element); end Get_Is_Assured; -------------------- -- Set_Is_Assured -- -------------------- overriding procedure Set_Is_Assured (Self : not null access UML_Conditional_Node_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Assured (Self.Element, To); end Set_Is_Assured; ------------------------ -- Get_Is_Determinate -- ------------------------ overriding function Get_Is_Determinate (Self : not null access constant UML_Conditional_Node_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Determinate (Self.Element); end Get_Is_Determinate; ------------------------ -- Set_Is_Determinate -- ------------------------ overriding procedure Set_Is_Determinate (Self : not null access UML_Conditional_Node_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Determinate (Self.Element, To); end Set_Is_Determinate; ---------------- -- Get_Result -- ---------------- overriding function Get_Result (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Result (Self.Element))); end Get_Result; ------------------ -- Get_Activity -- ------------------ overriding function Get_Activity (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activities.UML_Activity_Access is begin return AMF.UML.Activities.UML_Activity_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Activity (Self.Element))); end Get_Activity; ------------------ -- Set_Activity -- ------------------ overriding procedure Set_Activity (Self : not null access UML_Conditional_Node_Proxy; To : AMF.UML.Activities.UML_Activity_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Activity; -------------- -- Get_Edge -- -------------- overriding function Get_Edge (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Edge (Self.Element))); end Get_Edge; ---------------------- -- Get_Must_Isolate -- ---------------------- overriding function Get_Must_Isolate (Self : not null access constant UML_Conditional_Node_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Must_Isolate (Self.Element); end Get_Must_Isolate; ---------------------- -- Set_Must_Isolate -- ---------------------- overriding procedure Set_Must_Isolate (Self : not null access UML_Conditional_Node_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Must_Isolate (Self.Element, To); end Set_Must_Isolate; -------------- -- Get_Node -- -------------- overriding function Get_Node (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Node (Self.Element))); end Get_Node; ------------------------------- -- Get_Structured_Node_Input -- ------------------------------- overriding function Get_Structured_Node_Input (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Input_Pins.Collections.Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Structured_Node_Input (Self.Element))); end Get_Structured_Node_Input; -------------------------------- -- Get_Structured_Node_Output -- -------------------------------- overriding function Get_Structured_Node_Output (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Output_Pins.Collections.Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Structured_Node_Output (Self.Element))); end Get_Structured_Node_Output; ------------------ -- Get_Variable -- ------------------ overriding function Get_Variable (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Variables.Collections.Set_Of_UML_Variable is begin return AMF.UML.Variables.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Variable (Self.Element))); end Get_Variable; ------------------------ -- Get_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is begin return AMF.UML.Element_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin return AMF.UML.Packageable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin return AMF.UML.Named_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is begin return AMF.UML.Package_Imports.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is begin return AMF.UML.Dependencies.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access is begin return AMF.UML.String_Expressions.UML_String_Expression_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Conditional_Node_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Name_Expression; ------------------- -- Get_Namespace -- ------------------- overriding function Get_Namespace (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin return AMF.UML.Namespaces.UML_Namespace_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.Optional_String is begin declare use type Matreshka.Internals.Strings.Shared_String_Access; Aux : constant Matreshka.Internals.Strings.Shared_String_Access := AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element); begin if Aux = null then return (Is_Empty => True); else return (False, League.Strings.Internals.Create (Aux)); end if; end; end Get_Qualified_Name; ------------------------ -- Get_Contained_Edge -- ------------------------ overriding function Get_Contained_Edge (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contained_Edge (Self.Element))); end Get_Contained_Edge; ------------------------ -- Get_Contained_Node -- ------------------------ overriding function Get_Contained_Node (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Contained_Node (Self.Element))); end Get_Contained_Node; --------------------- -- Get_In_Activity -- --------------------- overriding function Get_In_Activity (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activities.UML_Activity_Access is begin return AMF.UML.Activities.UML_Activity_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Activity (Self.Element))); end Get_In_Activity; --------------------- -- Set_In_Activity -- --------------------- overriding procedure Set_In_Activity (Self : not null access UML_Conditional_Node_Proxy; To : AMF.UML.Activities.UML_Activity_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_In_Activity; ------------------ -- Get_Subgroup -- ------------------ overriding function Get_Subgroup (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is begin return AMF.UML.Activity_Groups.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Subgroup (Self.Element))); end Get_Subgroup; --------------------- -- Get_Super_Group -- --------------------- overriding function Get_Super_Group (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Groups.UML_Activity_Group_Access is begin return AMF.UML.Activity_Groups.UML_Activity_Group_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Super_Group (Self.Element))); end Get_Super_Group; ----------------- -- Get_Context -- ----------------- overriding function Get_Context (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin return AMF.UML.Classifiers.UML_Classifier_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Context (Self.Element))); end Get_Context; --------------- -- Get_Input -- --------------- overriding function Get_Input (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Input_Pins.Collections.Ordered_Set_Of_UML_Input_Pin is begin return AMF.UML.Input_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Input (Self.Element))); end Get_Input; ------------------------------ -- Get_Is_Locally_Reentrant -- ------------------------------ overriding function Get_Is_Locally_Reentrant (Self : not null access constant UML_Conditional_Node_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Locally_Reentrant (Self.Element); end Get_Is_Locally_Reentrant; ------------------------------ -- Set_Is_Locally_Reentrant -- ------------------------------ overriding procedure Set_Is_Locally_Reentrant (Self : not null access UML_Conditional_Node_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Locally_Reentrant (Self.Element, To); end Set_Is_Locally_Reentrant; ----------------------------- -- Get_Local_Postcondition -- ----------------------------- overriding function Get_Local_Postcondition (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Postcondition (Self.Element))); end Get_Local_Postcondition; ---------------------------- -- Get_Local_Precondition -- ---------------------------- overriding function Get_Local_Precondition (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is begin return AMF.UML.Constraints.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Local_Precondition (Self.Element))); end Get_Local_Precondition; ---------------- -- Get_Output -- ---------------- overriding function Get_Output (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Output_Pins.Collections.Ordered_Set_Of_UML_Output_Pin is begin return AMF.UML.Output_Pins.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Output (Self.Element))); end Get_Output; ----------------- -- Get_Handler -- ----------------- overriding function Get_Handler (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Exception_Handlers.Collections.Set_Of_UML_Exception_Handler is begin return AMF.UML.Exception_Handlers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Handler (Self.Element))); end Get_Handler; ------------------ -- Get_In_Group -- ------------------ overriding function Get_In_Group (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Groups.Collections.Set_Of_UML_Activity_Group is begin return AMF.UML.Activity_Groups.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Group (Self.Element))); end Get_In_Group; --------------------------------- -- Get_In_Interruptible_Region -- --------------------------------- overriding function Get_In_Interruptible_Region (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Interruptible_Activity_Regions.Collections.Set_Of_UML_Interruptible_Activity_Region is begin return AMF.UML.Interruptible_Activity_Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Interruptible_Region (Self.Element))); end Get_In_Interruptible_Region; ---------------------- -- Get_In_Partition -- ---------------------- overriding function Get_In_Partition (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is begin return AMF.UML.Activity_Partitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Partition (Self.Element))); end Get_In_Partition; ---------------------------- -- Get_In_Structured_Node -- ---------------------------- overriding function Get_In_Structured_Node (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access is begin return AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_In_Structured_Node (Self.Element))); end Get_In_Structured_Node; ---------------------------- -- Set_In_Structured_Node -- ---------------------------- overriding procedure Set_In_Structured_Node (Self : not null access UML_Conditional_Node_Proxy; To : AMF.UML.Structured_Activity_Nodes.UML_Structured_Activity_Node_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_In_Structured_Node (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_In_Structured_Node; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is begin return AMF.UML.Activity_Edges.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------ -- Get_Redefined_Node -- ------------------------ overriding function Get_Redefined_Node (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is begin return AMF.UML.Activity_Nodes.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Node (Self.Element))); end Get_Redefined_Node; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Conditional_Node_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Conditional_Node_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf (Self.Element, To); end Set_Is_Leaf; --------------------------- -- Get_Redefined_Element -- --------------------------- overriding function Get_Redefined_Element (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is begin return AMF.UML.Redefinable_Elements.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is begin return AMF.UML.Classifiers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Conditional_Node_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Exclude_Collisions"; return Exclude_Collisions (Self, Imps); end Exclude_Collisions; ------------------------- -- Get_Names_Of_Member -- ------------------------- overriding function Get_Names_Of_Member (Self : not null access constant UML_Conditional_Node_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Get_Names_Of_Member"; return Get_Names_Of_Member (Self, Element); end Get_Names_Of_Member; -------------------- -- Import_Members -- -------------------- overriding function Import_Members (Self : not null access constant UML_Conditional_Node_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Conditional_Node_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.All_Owning_Packages"; return All_Owning_Packages (Self); end All_Owning_Packages; ----------------------------- -- Is_Distinguishable_From -- ----------------------------- overriding function Is_Distinguishable_From (Self : not null access constant UML_Conditional_Node_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------- -- Context -- ------------- overriding function Context (Self : not null access constant UML_Conditional_Node_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Context"; return Context (Self); end Context; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Conditional_Node_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Conditional_Node_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented"); raise Program_Error with "Unimplemented procedure UML_Conditional_Node_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; end AMF.Internals.UML_Conditional_Nodes;
stcarrez/ada-css
Ada
2,235
adb
----------------------------------------------------------------------- -- css-core-errors-default -- Error handler interface -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body CSS.Core.Errors.Default is -- ------------------------------ -- Report an error message at the given CSS source position. -- ------------------------------ overriding procedure Error (Handler : in out Error_Handler; Loc : in Location; Message : in String) is L : constant String := Util.Log.Locations.To_String (Loc); begin Handler.Error_Count := Handler.Error_Count + 1; if Ada.Text_IO.Is_Open (Handler.File) then Ada.Text_IO.Put_Line (Handler.File, L & ": error: " & Message); else Ada.Text_IO.Put_Line (L & ": error: " & Message); end if; end Error; -- ------------------------------ -- Report a warning message at the given CSS source position. -- ------------------------------ overriding procedure Warning (Handler : in out Error_Handler; Loc : in Location; Message : in String) is L : constant String := Util.Log.Locations.To_String (Loc); begin Handler.Warning_Count := Handler.Warning_Count + 1; if Ada.Text_IO.Is_Open (Handler.File) then Ada.Text_IO.Put_Line (Handler.File, L & ": error: " & Message); else Ada.Text_IO.Put_Line (L & ": warning: " & Message); end if; end Warning; end CSS.Core.Errors.Default;
AdaCore/training_material
Ada
22,489
adb
with Tracks_Display; use Tracks_Display; with Screen_Interface; use Screen_Interface; with Drawing; use Drawing; with Trains; use Trains; with Fonts; use Fonts; package body Railroad is Block_Size : constant := 40; -- Pixels -- Touch Areas subtype Spawn_X is Screen_Interface.Width range Width (Block_Size * 1.5) .. Width (Block_Size * 4.5); subtype Spawn_Y is Height range Height (Block_Size * 0.9) .. Height (Block_Size * 1.9); subtype Sw1_X is Width range Width (Block_Size * 5.0) .. Width (Block_Size * 6.0 - 1.0); subtype Sw1_Y is Height range Height (Block_Size * 5.0) .. Height (Block_Size * 6.0); subtype Sw2_X is Width range Width (Block_Size * 1.5) .. Width (Block_Size * 2.5); subtype Sw2_Y is Height range Height (Block_Size * 4.0) .. Height (Block_Size * 5.0); subtype Sw3_X is Width range Width (Block_Size * 3.5) .. Width (Block_Size * 4.5 - 1.0); subtype Sw3_Y is Height range Height (Block_Size * 2.0) .. Height (Block_Size * 3.3); Out_Loop_Track_Nbr : constant Positive := (6 + 4 + 6 + 4); In_Loop_Track_Nbr : constant Positive := (3 + 1 + 3 + 1); Straight_Tracks : array (1 .. (Out_Loop_Track_Nbr + In_Loop_Track_Nbr)) of aliased Track_T (20); Curve_Tracks : array (1 .. 8) of aliased Track_T (16); Switch_Tracks : array (1 .. 3) of aliased Track_Access; Spawn_Tracks : array (1 .. 2) of aliased Track_T (20); Connection_Tracks : array (1 .. 3) of aliased Track_T (50); My_Trains : array (Trains.Train_Id) of Train_T (13); type Location_Point is record Coord : Point; Used : Boolean := False; end record; Locations_coords : array (Trains.Location) of Location_Point; procedure Create_Out_Loop is WLast : constant := Width'Last + 1; HLast : constant := Height'Last + 1; Top_Line_First : constant Positive := 1; Top_Line_Last : constant Positive := 6; Left_Line_First : constant Positive := Top_Line_Last + 1; Left_Line_Last : constant Positive := 10; Bottom_Line_First : constant Positive := Left_Line_Last + 1; Bottom_Line_Last : constant Positive := 16; Right_Line_First : constant Positive := Bottom_Line_Last + 1; Right_Line_Last : constant Positive := 20; begin -- Top Line for Cnt in 1 .. 6 loop declare X : constant := Block_Size / 2; Index : constant Positive := Cnt; begin Build_Straight_Track (Straight_Tracks (Index), (X, Height (Block_Size * Cnt)), (X, Height (Block_Size * (Cnt + 1)))); Set_Sign_Position (Straight_Tracks (Index), Top); if Cnt > 1 then Connect_Track (Straight_Tracks (Index - 1), Straight_Tracks (Index)'Access, null); end if; end; end loop; -- Left Line for Cnt in 1 .. 4 loop declare Y : constant := HLast - (Block_Size / 2); Index : constant Positive := Cnt + Top_Line_Last; begin Build_Straight_Track (Straight_Tracks (Index), (Width (Block_Size * Cnt), Y), (Width (Block_Size * (Cnt + 1)), Y)); Set_Sign_Position (Straight_Tracks (Index), Left); if Cnt > 1 then Connect_Track (Straight_Tracks (Index - 1), Straight_Tracks (Index)'Access, null); end if; end; end loop; -- Bottom Line for Cnt in 1 .. 6 loop declare X : constant := WLast - (Block_Size / 2); Index : constant Positive := Cnt + Left_Line_Last; begin Build_Straight_Track (Straight_Tracks (Index), (X, HLast - Height (Block_Size * Cnt)), (X, HLast - Height (Block_Size * (Cnt + 1)))); Set_Sign_Position (Straight_Tracks (Index), Bottom); if Cnt > 1 then Connect_Track (Straight_Tracks (Index - 1), Straight_Tracks (Index)'Access, null); end if; end; end loop; -- Right Line for Cnt in 1 .. 4 loop declare Y : constant := Block_Size / 2; Index : constant Positive := Cnt + Bottom_Line_Last; begin Build_Straight_Track (Straight_Tracks (Index), (WLast - Width (Block_Size * Cnt), Y), (WLast - Width (Block_Size * (Cnt + 1)), Y)); Set_Sign_Position (Straight_Tracks (Index), Right); if Cnt > 1 then Connect_Track (Straight_Tracks (Index - 1), Straight_Tracks (Index)'Access, null); end if; end; end loop; -- Top Right Curve Build_Curve_Track (Curve_Tracks (1), (Block_Size, Block_Size / 2), (Block_Size / 2, Block_Size / 2), (Block_Size / 2, Block_Size / 2), (Block_Size / 2, Block_Size)); Set_Sign_Position (Curve_Tracks (1), Right); Connect_Track (Straight_Tracks (Right_Line_Last), Curve_Tracks (1)'Access, null); Connect_Track (Curve_Tracks (1), Straight_Tracks (Top_Line_First)'Access, null); -- Top Left Curve Build_Curve_Track (Curve_Tracks (2), (Block_Size / 2, HLast - Block_Size), (Block_Size / 2, HLast - Block_Size / 2), (Block_Size / 2, HLast - Block_Size / 2), (Block_Size, HLast - Block_Size / 2)); Set_Sign_Position (Curve_Tracks (2), Top); Connect_Track (Straight_Tracks (Top_Line_Last), Curve_Tracks (2)'Access, null); Connect_Track (Curve_Tracks (2), Straight_Tracks (Left_Line_First)'Access, null); -- Bottom Left Curve Build_Curve_Track (Curve_Tracks (3), (WLast - Block_Size, HLast - Block_Size / 2), (WLast - Block_Size/ 2, HLast - Block_Size / 2), (WLast - Block_Size/ 2, HLast - Block_Size / 2), (WLast - Block_Size / 2, HLast - Block_Size)); Set_Sign_Position (Curve_Tracks (3), Left); Connect_Track (Straight_Tracks (Left_Line_Last), Curve_Tracks (3)'Access, null); Connect_Track (Curve_Tracks (3), Straight_Tracks (Bottom_Line_First)'Access, null); -- Bottom Right Curve Build_Curve_Track (Curve_Tracks (4), (WLast - Block_Size / 2, Block_Size), (WLast - Block_Size / 2, Block_Size / 2), (WLast - Block_Size / 2, Block_Size / 2), (WLast - Block_Size, Block_Size / 2)); Set_Sign_Position (Curve_Tracks (4), Bottom); Connect_Track (Straight_Tracks (Bottom_Line_Last), Curve_Tracks (4)'Access, null); Connect_Track (Curve_Tracks (4), Straight_Tracks (Right_Line_First)'Access, null); -- Spawn Track Build_Straight_Track (Spawn_Tracks (1), (Width (Block_Size), Height (2 * Block_Size)), (Width (Block_Size), Height (3 * Block_Size))); Build_Straight_Track (Spawn_Tracks (2), (Width (Block_Size), Height (3 * Block_Size)), (Width (Block_Size / 2), Height (4 * Block_Size))); Connect_Track (Spawn_Tracks (1), Spawn_Tracks (2)'Access, null); Connect_Track (Spawn_Tracks (2), Straight_Tracks (4)'Access, null); end Create_Out_Loop; procedure Create_In_Loop is HLast : constant := Height'Last + 1; Top_Line_First : constant Positive := Out_Loop_Track_Nbr + 1; Top_Line_Last : constant Positive := Top_Line_First + 2; Left_Line_First : constant Positive := Top_Line_Last + 1; Left_Line_Last : constant Positive := Left_Line_First; Bottom_Line_First : constant Positive := Left_Line_Last + 1; Bottom_Line_Last : constant Positive := Bottom_Line_First + 2; Right_Line_First : constant Positive := Bottom_Line_Last + 1; Right_Line_Last : constant Positive := Right_Line_First; begin -- Top Line for Cnt in 1 .. 3 loop declare X : constant Width := Width (Block_Size * 2); Y_Base : constant := Block_Size * 2; Index : constant Positive := Top_Line_First + Cnt - 1; begin Build_Straight_Track (Straight_Tracks (Index), (X, Height (Y_Base + Block_Size * Cnt)), (X, Height (Y_Base + Block_Size * (Cnt + 1)))); Set_Sign_Position (Straight_Tracks (Index), Top); if Cnt > 1 then Connect_Track (Straight_Tracks (Index - 1), Straight_Tracks (Index)'Access, null); end if; end; end loop; -- There is a switch here so we move the sign to the other side of the -- track so that it won't overlap with switche's sign. Set_Sign_Position (Straight_Tracks (Top_Line_First + 1), Bottom); -- Left Line declare Index : constant Positive := Left_Line_First; begin Build_Straight_Track (Straight_Tracks (Index), (Width (Block_Size * 2.5), Height (Block_Size * 6.5)), (Width (Block_Size * 3.5), Height (Block_Size * 6.5))); Set_Sign_Position (Straight_Tracks (Index), Left); end; -- Bottom Line for Cnt in 1 .. 3 loop declare X : constant := Width (Block_Size * 4); Y_Base : constant := Block_Size; Index : constant Positive := Cnt + Left_Line_Last; begin Build_Straight_Track (Straight_Tracks (Index), (X, HLast - Height (Y_Base + Block_Size * Cnt)), (X, HLast - Height (Y_Base + Block_Size * (Cnt + 1)))); Set_Sign_Position (Straight_Tracks (Index), Bottom); if Cnt > 1 then Connect_Track (Straight_Tracks (Index - 1), Straight_Tracks (Index)'Access, null); end if; end; end loop; -- Right Line declare Index : constant Positive := Right_Line_First; begin Build_Straight_Track (Straight_Tracks (Index), (Width (Block_Size * 3.5), Height (Block_Size * 2.5)), (Width (Block_Size * 2.5), Height (Block_Size * 2.5))); Set_Sign_Position (Straight_Tracks (Index), Right); end; -- Top Right Curve Build_Curve_Track (Curve_Tracks (5), (Width (Block_Size * 2.5), Height (Block_Size * 2.5)), (Width (Block_Size * 2.0), Height (Block_Size * 2.5)), (Width (Block_Size * 2.0), Height (Block_Size * 2.5)), (Width (Block_Size * 2.0), Height (Block_Size * 3.0))); Set_Sign_Position (Curve_Tracks (5), Right); Connect_Track (Straight_Tracks (Right_Line_Last), Curve_Tracks (5)'Access, null); Connect_Track (Curve_Tracks (5), Straight_Tracks (Top_Line_First)'Access, null); -- Top Left Curve Build_Curve_Track (Curve_Tracks (6), (Width (Block_Size * 2.0), Height (Block_Size * 6.0)), (Width (Block_Size * 2.0), Height (Block_Size * 6.5)), (Width (Block_Size * 2.0), Height (Block_Size * 6.5)), (Width (Block_Size * 2.5), Height (Block_Size * 6.5))); Set_Sign_Position (Curve_Tracks (6), Top); Connect_Track (Straight_Tracks (Top_Line_Last), Curve_Tracks (6)'Access, null); Connect_Track (Curve_Tracks (6), Straight_Tracks (Left_Line_First)'Access, null); -- Bottom Left Curve Build_Curve_Track (Curve_Tracks (7), (Width (Block_Size * 3.5), Height (Block_Size * 6.5)), (Width (Block_Size * 4.0), Height (Block_Size * 6.5)), (Width (Block_Size * 4.0), Height (Block_Size * 6.5)), (Width (Block_Size * 4.0), Height (Block_Size * 6.0))); Set_Sign_Position (Curve_Tracks (7), Left); Connect_Track (Straight_Tracks (Left_Line_Last), Curve_Tracks (7)'Access, null); Connect_Track (Curve_Tracks (7), Straight_Tracks (Bottom_Line_First)'Access, null); -- Bottom Right Curve Build_Curve_Track (Curve_Tracks (8), (Width (Block_Size * 4.0), Height (Block_Size * 3.0)), (Width (Block_Size * 4.0), Height (Block_Size * 2.5)), (Width (Block_Size * 4.0), Height (Block_Size * 2.5)), (Width (Block_Size * 3.5), Height (Block_Size * 2.5))); -- There is a switch here so we move the sign to the other side of the -- track so that it won't overlap with switche's sign. Set_Sign_Position (Curve_Tracks (8), Top); Connect_Track (Straight_Tracks (Bottom_Line_Last), Curve_Tracks (8)'Access, null); Connect_Track (Curve_Tracks (8), Straight_Tracks (Right_Line_First)'Access, null); end Create_In_Loop; procedure Create_Connection_Tracks is begin Build_Curve_Track (Connection_Tracks (1), End_Coord (Straight_Tracks (11)), End_Coord (Straight_Tracks (12)), Start_Coord (Straight_Tracks (Out_Loop_Track_Nbr + 6)), Start_Coord (Straight_Tracks (Out_Loop_Track_Nbr + 7))); Connect_Track (Connection_Tracks (1), Straight_Tracks (Out_Loop_Track_Nbr + 7)'Access, null); Connect_Track (Straight_Tracks (11), Straight_Tracks (12)'Access, Connection_Tracks (1)'Access); Switch_Tracks (1) := Straight_Tracks (11)'Access; Build_Curve_Track (Connection_Tracks (2), End_Coord (Straight_Tracks (Out_Loop_Track_Nbr + 1)), end_Coord (Straight_Tracks (Out_Loop_Track_Nbr + 2)), Start_Coord (Straight_Tracks (5)), Start_Coord (Straight_Tracks (6))); Connect_Track (Connection_Tracks (2), Straight_Tracks (6)'Access, null); Connect_Track (Straight_Tracks (Out_Loop_Track_Nbr + 1), Straight_Tracks (Out_Loop_Track_Nbr + 2)'Access, Connection_Tracks (2)'Access); Set_Sign_Position (Connection_Tracks (2), Top); Switch_Tracks (2) := Straight_Tracks (Out_Loop_Track_Nbr + 1)'Access; Build_Curve_Track (Connection_Tracks (3), End_Coord (Straight_Tracks (Out_Loop_Track_Nbr + 7)), End_Coord (Straight_Tracks (Out_Loop_Track_Nbr + 7)) - (0, Block_Size), Start_Coord (Curve_Tracks (4)) + (0, Block_Size), Start_Coord (Curve_Tracks (4))); Connect_Track (Connection_Tracks (3), Curve_Tracks (4)'Access, null); Set_Sign_Position (Connection_Tracks (3), Bottom); Connect_Track (Straight_Tracks (Out_Loop_Track_Nbr + 7), Curve_Tracks (8)'Access, Connection_Tracks (3)'Access); Switch_Tracks (3) := Straight_Tracks (Out_Loop_Track_Nbr + 7)'Access; end Create_Connection_Tracks; function Can_Spawn_Train return Boolean is begin return Cur_Num_Trains < Train_Id'Last and then Spawn_Tracks (1).Entry_Sign.Color /= Tracks_Display.Red; end Can_Spawn_Train; procedure Spawn_Train is begin if Can_Spawn_Train then Init_Train (My_Trains (Cur_Num_Trains), Spawn_Tracks (1)'Access); My_Trains (Cur_Num_Trains).Speed := 2; Trains.Trains (Cur_Num_Trains) := (Spawn_Tracks (1).Id, 1, Spawn_Tracks (1).Id); Trains.Cur_Num_Trains := Trains.Cur_Num_Trains + 1; Trains.Track_Signals (Spawn_Tracks (1).Id) := Trains.Red; end if; end; procedure Simulation_Step is begin for Index in Trains.Train_Id'First .. Trains.Cur_Num_Trains - 1 loop Move_Train (My_Trains (Index)); end loop; for Track of Straight_Tracks loop Update_Sign (Track); end loop; for Track of Spawn_Tracks loop Update_Sign (Track); end loop; for Track of Curve_Tracks loop Update_Sign (Track); end loop; for Track of Connection_Tracks loop Update_Sign (Track); end loop; end; procedure Draw (Init : Boolean := False) is begin if Init then -- Tracks for Track of Straight_Tracks loop Draw_Track (Track); end loop; for Track of Spawn_Tracks loop Draw_Track (Track); end loop; for Track of Curve_Tracks loop Draw_Track (Track); end loop; for Track of Connection_Tracks loop Draw_Track (Track); end loop; end if; -- Switches for Track of Switch_Tracks loop if Track /= null then Draw_Switch (Track.all); end if; end loop; -- Trains for Index in Trains.Train_Id'First .. Trains.Cur_Num_Trains - 1 loop Draw_Train (My_Trains (Index)); end loop; -- Draw touch areas Rect ((Sw1_X'First, Sw1_Y'First), (Sw1_X'Last, Sw1_Y'Last), White); Rect ((Sw2_X'First, Sw2_Y'First), (Sw2_X'Last, Sw2_Y'Last), White); Rect ((Sw3_X'First, Sw3_Y'First), (Sw3_X'Last, Sw3_Y'Last), White); if Can_Spawn_Train then Rect ((Spawn_X'First, Spawn_Y'First), (Spawn_X'Last, Spawn_Y'Last), White); Fonts.Draw_String (P => (Spawn_X'First + 5, Spawn_Y'First + 5), Str => "Touch here to", Font => Font8x8, FG => Screen_Interface.White, BG => Screen_Interface.Black); Fonts.Draw_String (P => (Spawn_X'First + 5, Spawn_Y'First + 22), Str => "spawn a train", Font => Font8x8, FG => Screen_Interface.White, BG => Screen_Interface.Black); else Rect_Fill ((Spawn_X'First, Spawn_Y'First), (Spawn_X'Last, Spawn_Y'Last), Screen_Interface.Black); end if; end Draw; procedure Convert_Railway_Map is Cur_Loc : Trains.Location := Trains.Location'First; Cur_Track : Trains.Track_Id := Trains.Track_Id'First; -- Return Location coresponding to a Point. -- Create a new Locatio if needed. function Get_Loc (P : Point) return Trains.Location is begin for Index in Trains.Location loop exit when not Locations_coords (Index).Used; if Locations_coords (Index).Coord = P then return Index; end if; end loop; Locations_coords (Cur_Loc).Used := True; Locations_coords (Cur_Loc).Coord := P; Cur_Loc := Cur_Loc + 1; return Cur_Loc - 1; end Get_Loc; procedure Add_Track (Track : in out Track_T) is begin Track.Id := Cur_Track; -- Define the tracks From and To locations Trains.Tracks (Cur_Track) := (Get_Loc (Start_Coord (Track)), Get_Loc (End_Coord (Track)), Track.Points'Last); Cur_Track := Cur_Track + 1; end Add_Track; procedure Add_Previous_Track (Loc : Trains.Location; Id : Trains.Track_Id) is begin for Index in Trains.Prev_Id loop if Trains.Previous_Tracks (Loc) (Index) = Trains.No_Track_Id then Trains.Previous_Tracks (Loc) (Index) := Id; return; end if; end loop; end Add_Previous_Track; begin -- Create track map for Trains package for Track of Straight_Tracks loop Add_Track (Track); Add_Previous_Track (Get_Loc (End_Coord (Track)), Track.Id); end loop; for Track of Curve_Tracks loop Add_Track (Track); Add_Previous_Track (Get_Loc (End_Coord (Track)), Track.Id); end loop; for Track of Connection_Tracks loop Add_Track (Track); Add_Previous_Track (Get_Loc (End_Coord (Track)), Track.Id); end loop; for Track of Spawn_Tracks loop Add_Track (Track); Add_Previous_Track (Get_Loc (End_Coord (Track)), Track.Id); end loop; end Convert_Railway_Map; procedure Initialize is begin Create_Out_Loop; Create_In_Loop; Create_Connection_Tracks; Convert_Railway_Map; Draw (True); end Initialize; procedure On_Touch (P : Point) is begin if P.X in Spawn_X and then P.Y in Spawn_Y then Spawn_Train; end if; if P.X in Sw1_X and then P.Y in Sw1_Y then Change_Switch (Switch_Tracks (1).all); end if; if P.X in Sw2_X and then P.Y in Sw2_Y then Change_Switch (Switch_Tracks (2).all); end if; if P.X in Sw3_X and then P.Y in Sw3_Y then Change_Switch (Switch_Tracks (3).all); end if; end On_Touch; end Railroad;
jam3st/edk2
Ada
2,485
adb
-- -- Copyright (C) 2017 Nico Huber <[email protected]> -- -- 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 HW.Config; package body HW.PCI.MMConf with Refined_State => (Address_State => (MM8.Base_Address, MM16.Base_Address, MM32.Base_Address), PCI_State => (MM8.State, MM16.State, MM32.State)) is Default_Base_Address : constant Word64 := Calc_Base_Address (Config.Default_MMConf_Base, Dev); type Index16 is new Index range 0 .. Index'Last / 2; type Index32 is new Index range 0 .. Index'Last / 4; type Array8 is array (Index) of Byte with Atomic_Components; type Array16 is array (Index16) of Word16 with Atomic_Components; type Array32 is array (Index32) of Word32 with Atomic_Components; package MM8 is new HW.MMIO_Range (Default_Base_Address, Word8, Index, Array8); package MM16 is new HW.MMIO_Range (Default_Base_Address, Word16, Index16, Array16); package MM32 is new HW.MMIO_Range (Default_Base_Address, Word32, Index32, Array32); procedure Read8 (Value : out Word8; Offset : Index) renames MM8.Read; procedure Read16 (Value : out Word16; Offset : Index) is begin MM16.Read (Value, Index16 (Offset / 2)); end Read16; procedure Read32 (Value : out Word32; Offset : Index) is begin MM32.Read (Value, Index32 (Offset / 4)); end Read32; procedure Write8 (Offset : Index; Value : Word8) renames MM8.Write; procedure Write16 (Offset : Index; Value : Word16) is begin MM16.Write (Index16 (Offset / 2), Value); end Write16; procedure Write32 (Offset : Index; Value : Word32) is begin MM32.Write (Index32 (Offset / 4), Value); end Write32; procedure Set_Base_Address (Base : Word64) is Base_Address : constant Word64 := Calc_Base_Address (16#80000000#, Dev); begin MM8.Set_Base_Address (Base_Address); MM16.Set_Base_Address (Base_Address); MM32.Set_Base_Address (Base_Address); end Set_Base_Address; end HW.PCI.MMConf;
reznikmm/matreshka
Ada
4,083
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Style_Layout_Grid_Display_Attributes; package Matreshka.ODF_Style.Layout_Grid_Display_Attributes is type Style_Layout_Grid_Display_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Layout_Grid_Display_Attributes.ODF_Style_Layout_Grid_Display_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Layout_Grid_Display_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Layout_Grid_Display_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Layout_Grid_Display_Attributes;
reznikmm/matreshka
Ada
3,739
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Text_Connection_Name_Attributes is pragma Preelaborate; type ODF_Text_Connection_Name_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Text_Connection_Name_Attribute_Access is access all ODF_Text_Connection_Name_Attribute'Class with Storage_Size => 0; end ODF.DOM.Text_Connection_Name_Attributes;
zhmu/ananas
Ada
359,356
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S I N F O -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package documents the structure of the abstract syntax tree. The Atree -- package provides a basic tree structure. Sinfo describes how this structure -- is used to represent the syntax of an Ada program. -- The grammar in the RM is followed very closely in the tree design, and is -- repeated as part of this source file. -- The tree contains not only the full syntactic representation of the -- program, but also the results of semantic analysis. In particular, the -- nodes for defining identifiers, defining character literals, and defining -- operator symbols, collectively referred to as entities, represent what -- would normally be regarded as the symbol table information. In addition a -- number of the tree nodes contain semantic information. -- See the spec of Gen_IL.Gen for instructions on making changes to this file. -- Note that the official definition of what nodes have what fields is in -- Gen_IL.Gen.Gen_Nodes; if there is a discrepancy between that and the -- comments here, Gen_IL.Gen.Gen_Nodes wins. pragma Warnings (Off); -- with/use clauses for children with Namet; use Namet; with Types; use Types; with Uintp; use Uintp; with Urealp; use Urealp; pragma Warnings (On); package Sinfo is ---------------------------------------- -- Definitions of fields in tree node -- ---------------------------------------- -- The following fields are common to all nodes: -- Nkind Indicates the kind of the node. This field is present -- in all nodes. -- Sloc Location (Source_Ptr) of the corresponding token -- in the Source buffer. The individual node definitions -- show which token is referenced by this pointer. -- In_List A flag used to indicate if the node is a member -- of a node list (see package Nlists). -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted -- node as a result of a call to Mark_Rewrite_Insertion. -- Small_Paren_Count -- A 2-bit count used in subexpression nodes to indicate -- the level of parentheses. The settings are 0,1,2 and -- 3 for many. If the value is 3, then an auxiliary table -- is used to indicate the real value, which is computed by -- Paren_Count. Set to zero for nonsubexpression nodes. -- Note: the required parentheses surrounding conditional -- and quantified expressions count as a level of parens -- for this purpose, so e.g. in X := (if A then B else C); -- Paren_Count for the right side will be 1. -- Comes_From_Source -- This flag is present in all nodes. It is set if the -- node is built by the scanner or parser, and clear if -- the node is built by the analyzer or expander. It -- indicates that the node corresponds to a construct -- that appears in the original source program. -- Analyzed This flag is present in all nodes. It is set when -- a node is analyzed, and is used to avoid analyzing -- the same node twice. Analysis includes expansion if -- expansion is active, so in this case if the flag is -- set it means the node has been analyzed and expanded. -- Error_Posted This flag is present in all nodes. It is set when -- an error message is posted which is associated with -- the flagged node. This is used to avoid posting more -- than one message on the same node. -- Link For a node, points to the Parent. For a list, points -- to the list header. Note that in the latter case, a -- client cannot modify the link field. This field is -- private to the Atree package (but is also modified -- by the Nlists package). -- The following additional fields are common to all entities (that is, -- nodes whose Nkind is in N_Entity): -- Ekind Entity type. -- Convention Entity convention (Convention_Id value) -------------------------------- -- Implicit Nodes in the Tree -- -------------------------------- -- Generally the structure of the tree very closely follows the grammar as -- defined in the RM. However, certain nodes are omitted to save space and -- simplify semantic processing. Two general classes of such omitted nodes -- are as follows: -- If the only possibilities for a non-terminal are one or more other -- non-terminals (i.e. the rule is a "skinny" rule), then usually the -- corresponding node is omitted from the tree, and the target construct -- appears directly. For example, a real type definition is either -- floating point definition or a fixed point definition. No explicit node -- appears for real type definition. Instead either the floating point -- definition or fixed point definition appears directly. -- If a non-terminal corresponds to a list of some other non-terminal -- (possibly with separating punctuation), then usually it is omitted from -- the tree, and a list of components appears instead. For example, -- sequence of statements does not appear explicitly in the tree. Instead -- a list of statements appears directly. -- Some additional cases of omitted nodes occur and are documented -- individually. In particular, many nodes are omitted in the tree -- generated for an expression. ------------------------------------------- -- Handling of Defining Identifier Lists -- ------------------------------------------- -- In several declarative forms in the syntax, lists of defining -- identifiers appear (object declarations, component declarations, number -- declarations etc.) -- The semantics of such statements are equivalent to a series of identical -- declarations of single defining identifiers (except that conformance -- checks require the same grouping of identifiers in the parameter case). -- To simplify semantic processing, the parser breaks down such multiple -- declaration cases into sequences of single declarations, duplicating -- type and initialization information as required. The flags More_Ids and -- Prev_Ids are used to record the original form of the source in the case -- where the original source used a list of names, More_Ids being set on -- all but the last name and Prev_Ids being set on all but the first name. -- These flags are used to reconstruct the original source (e.g. in the -- Sprint package), and also are included in the conformance checks, but -- otherwise have no semantic significance. -- Note: the reason that we use More_Ids and Prev_Ids rather than -- First_Name and Last_Name flags is so that the flags are off in the -- normal one identifier case, which minimizes tree print output. ----------------------- -- Use of Node Lists -- ----------------------- -- With a few exceptions, if a construction of the form {non-terminal} -- appears in the tree, lists are used in the corresponding tree node (see -- package Nlists for handling of node lists). In this case a field of the -- parent node points to a list of nodes for the non-terminal. The field -- name for such fields has a plural name which always ends in "s". For -- example, a case statement has a field Alternatives pointing to list of -- case statement alternative nodes. -- Only fields pointing to lists have names ending in "s", so generally the -- structure is strongly typed, fields not ending in s point to single -- nodes, and fields ending in s point to lists. -- The following example shows how a traversal of a list is written. We -- suppose here that Stmt points to a N_Case_Statement node which has a -- list field called Alternatives: -- Alt := First (Alternatives (Stmt)); -- while Present (Alt) loop -- .. -- -- processing for case statement alternative Alt -- .. -- Alt := Next (Alt); -- end loop; -- The Present function tests for Empty, which in this case signals the end -- of the list. First returns Empty immediately if the list is empty. -- Present is defined in Atree; First and Next are defined in Nlists. -- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all -- contexts, which is handled as described in the previous section, and -- with {,library_unit_NAME} in the N_With_Clause node, which is handled -- using the First_Name and Last_Name flags, as further detailed in the -- description of the N_With_Clause node. ------------- -- Pragmas -- ------------- -- Pragmas can appear in many different context, but are not included in -- the grammar. Still they must appear in the tree, so they can be properly -- processed. -- Two approaches are used. In some cases, an extra field is defined in an -- appropriate node that contains a list of pragmas appearing in the -- expected context. For example pragmas can appear before an -- Accept_Alternative in a Selective_Accept_Statement, and these pragmas -- appear in the Pragmas_Before field of the N_Accept_Alternative node. -- The other approach is to simply allow pragmas to appear in syntactic -- lists where the grammar (of course) does not include the possibility. -- For example, the Variants field of an N_Variant_Part node points to a -- list that can contain both N_Pragma and N_Variant nodes. -- To make processing easier in the latter case, the Nlists package -- provides a set of routines (First_Non_Pragma, Last_Non_Pragma, -- Next_Non_Pragma, Prev_Non_Pragma) that allow such lists to be handled -- ignoring all pragmas. -- In the case of the variants list, we can either write: -- Variant := First (Variants (N)); -- while Present (Variant) loop -- ... -- Variant := Next (Variant); -- end loop; -- or -- Variant := First_Non_Pragma (Variants (N)); -- while Present (Variant) loop -- ... -- Variant := Next_Non_Pragma (Variant); -- end loop; -- In the first form of the loop, Variant can either be an N_Pragma or an -- N_Variant node. In the second form, Variant can only be N_Variant since -- all pragmas are skipped. --------------------- -- Optional Fields -- --------------------- -- Fields which correspond to a section of the syntax enclosed in square -- brackets are generally omitted (and the corresponding field set to Empty -- for a node, or No_List for a list). The documentation of such fields -- notes these cases. One exception to this rule occurs in the case of -- possibly empty statement sequences (such as the sequence of statements -- in an entry call alternative). Such cases appear in the syntax rules as -- [SEQUENCE_OF_STATEMENTS] and the fields corresponding to such optional -- statement sequences always contain an empty list (not No_List) if no -- statements are present. -- Note: the utility program that constructs the body and spec of the Nmake -- package relies on the format of the comments to determine if a field -- should have a default value in the corresponding make routine. The rule -- is that if the first line of the description of the field contains the -- string "(set to xxx if", then a default value of xxx is provided for -- this field in the corresponding Make_yyy routine. ----------------------------------- -- Note on Body/Spec Terminology -- ----------------------------------- -- In informal discussions about Ada, it is customary to refer to package -- and subprogram specs and bodies. However, this is not technically -- correct, what is normally referred to as a spec or specification is in -- fact a package declaration or subprogram declaration. We are careful in -- GNAT to use the correct terminology and in particular, the full word -- specification is never used as an incorrect substitute for declaration. -- The structure and terminology used in the tree also reflects the grammar -- and thus uses declaration and specification in the technically correct -- manner. -- However, there are contexts in which the informal terminology is useful. -- We have the word "body" to refer to the Interp_Etype declared by the -- declaration of a unit body, and in some contexts we need similar term to -- refer to the entity declared by the package or subprogram declaration, -- and simply using declaration can be confusing since the body also has a -- declaration. -- An example of such a context is the link between the package body and -- its declaration. With_Declaration is confusing, since the package body -- itself is a declaration. -- To deal with this problem, we reserve the informal term Spec, i.e. the -- popular abbreviation used in this context, to refer to the entity -- declared by the package or subprogram declaration. So in the above -- example case, the field in the body is called With_Spec. -- Another important context for the use of the word Spec is in error -- messages, where a hyper-correct use of declaration would be confusing to -- a typical Ada programmer, and even for an expert programmer can cause -- confusion since the body has a declaration as well. -- So, to summarize: -- Declaration always refers to the syntactic entity that is called -- a declaration. In particular, subprogram declaration -- and package declaration are used to describe the -- syntactic entity that includes the semicolon. -- Specification always refers to the syntactic entity that is called -- a specification. In particular, the terms procedure -- specification, function specification, package -- specification, subprogram specification always refer -- to the syntactic entity that has no semicolon. -- Spec is an informal term, used to refer to the entity -- that is declared by a task declaration, protected -- declaration, generic declaration, subprogram -- declaration or package declaration. -- This convention is followed throughout the GNAT documentation -- both internal and external, and in all error message text. ------------------------ -- Internal Use Nodes -- ------------------------ -- These are Node_Kind settings used in the internal implementation which -- are not logically part of the specification. -- N_Unused_At_Start -- Completely unused entry at the start of the enumeration type. This -- is inserted so that no legitimate value is zero, which helps to get -- better debugging behavior, since zero is a likely uninitialized value). -- N_Unused_At_End -- Completely unused entry at the end of the enumeration type. This is -- handy so that arrays with Node_Kind as the index type have an extra -- entry at the end (see for example the use of the Pchar_Pos_Array in -- Treepr, where the extra entry provides the limit value when dealing with -- the last used entry in the array). ----------------------------------------- -- Note on the settings of Sloc fields -- ----------------------------------------- -- The Sloc field of nodes that come from the source is set by the parser. -- For internal nodes, and nodes generated during expansion the Sloc is -- usually set in the call to the constructor for the node. In general the -- Sloc value chosen for an internal node is the Sloc of the source node -- whose processing is responsible for the expansion. For example, the Sloc -- of an inherited primitive operation is the Sloc of the corresponding -- derived type declaration. -- For the nodes of a generic instantiation, the Sloc value is encoded to -- represent both the original Sloc in the generic unit, and the Sloc of -- the instantiation itself. See Sinput.ads for details. -- Subprogram instances create two callable entities: one is the visible -- subprogram instance, and the other is an anonymous subprogram nested -- within a wrapper package that contains the renamings for the actuals. -- Both of these entities have the Sloc of the defining entity in the -- instantiation node. This simplified for instance in the past some ASIS -- queries. ----------------------- -- Field Definitions -- ----------------------- -- In the following node definitions, all fields, both syntactic and -- semantic, are documented. The one exception is in the case of entities -- (defining identifiers, character literals, and operator symbols), where -- the usage of the fields depends on the entity kind. Entity fields are -- fully documented in the separate package Einfo. -- In the node definitions, three common sets of fields are abbreviated to -- save both space in the documentation, and also space in the string -- (defined in Tree_Print_Strings) used to print trees. The following -- abbreviations are used: -- "plus fields for binary operator" -- Chars Name_Id for the operator -- Left_Opnd left operand expression -- Right_Opnd right operand expression -- Entity defining entity for operator -- Associated_Node for generic processing -- Do_Overflow_Check set if overflow check needed -- Has_Private_View set in generic units. -- "plus fields for unary operator" -- Chars Name_Id for the operator -- Right_Opnd right operand expression -- Entity defining entity for operator -- Associated_Node for generic processing -- Do_Overflow_Check set if overflow check needed -- Has_Private_View set in generic units. -- "plus fields for expression" -- Paren_Count number of parentheses levels -- Etype type of the expression -- Is_Overloaded >1 type interpretation exists -- Is_Static_Expression set for static expression -- Raises_Constraint_Error evaluation raises CE -- Must_Not_Freeze set if must not freeze -- Do_Range_Check set if a range check needed -- Has_Dynamic_Length_Check set if length check inserted -- Assignment_OK set if modification is OK -- Is_Controlling_Actual set for controlling argument -- Note: see under (EXPRESSION) for further details on the use of -- the Paren_Count field to record the number of parentheses levels. -- Node_Kind is the type used in the Nkind field to indicate the node kind. -- The actual definition of this type is given later (the reason for this -- is that we want the descriptions ordered by logical chapter in the RM, -- but the type definition is reordered to facilitate the definition of -- some subtype ranges. The individual descriptions of the nodes show how -- the various fields are used in each node kind, as well as providing -- logical names for the fields. Functions and procedures are provided for -- accessing and setting these fields using these logical names. ----------------------- -- Gigi Restrictions -- ----------------------- -- The tree passed to Gigi is more restricted than the general tree form. -- For example, as a result of expansion, most of the tasking nodes can -- never appear. For each node to which either a complete or partial -- restriction applies, a note entitled "Gigi restriction" appears which -- documents the restriction. -- Note that most of these restrictions apply only to trees generated when -- code is being generated, since they involved expander actions that -- destroy the tree. ---------------- -- Ghost Mode -- ---------------- -- The SPARK RM 6.9 defines two classes of constructs - Ghost entities and -- Ghost statements. The intent of the feature is to treat Ghost constructs -- as non-existent when Ghost assertion policy Ignore is in effect. -- -- The corresponding nodes which map to Ghost constructs are: -- -- Ghost entities -- Declaration nodes -- N_Package_Body -- N_Subprogram_Body -- -- Ghost statements -- N_Assignment_Statement -- N_Procedure_Call_Statement -- N_Pragma -- -- In addition, the compiler treats instantiations as Ghost entities -- -- To achieve the removal of ignored Ghost constructs, the compiler relies -- on global variables Ghost_Mode and Ignored_Ghost_Region, which comprise -- a mechanism called "Ghost regions". -- -- The values of Ghost_Mode are as follows: -- -- 1. Check - All static semantics as defined in SPARK RM 6.9 are in -- effect. The Ghost region has mode Check. -- -- 2. Ignore - Same as Check, ignored Ghost code is not present in ALI -- files, object files, and the final executable. The Ghost region -- has mode Ignore. -- -- 3. None - No Ghost region is in effect -- -- The value of Ignored_Ghost_Region captures the node which initiates an -- ignored Ghost region. -- -- A Ghost region is a compiler operating mode, similar to Check_Syntax, -- however a region is much more finely grained and depends on the policy -- in effect. The region starts prior to the analysis of a Ghost construct -- and ends immediately after its expansion. The region is established as -- follows: -- -- 1. Declarations - Prior to analysis, if the declaration is subject to -- pragma Ghost. -- -- 2. Renaming declarations - Same as 1) or when the renamed entity is -- Ghost. -- -- 3. Completing declarations - Same as 1) or when the declaration is -- partially analyzed and the declaration completes a Ghost entity. -- -- 4. N_Package_Body, N_Subprogram_Body - Same as 1) or when the body is -- partially analyzed and completes a Ghost entity. -- -- 5. N_Assignment_Statement - After the left hand side is analyzed and -- references a Ghost entity. -- -- 6. N_Procedure_Call_Statement - After the name is analyzed and denotes -- a Ghost procedure. -- -- 7. N_Pragma - During analysis, when the related entity is Ghost or the -- pragma encloses a Ghost entity. -- -- 8. Instantiations - Save as 1) or when the instantiation is partially -- analyzed and the generic template is Ghost. -- -- The following routines install a new Ghost region: -- -- Install_Ghost_Region -- Mark_And_Set_Ghost_xxx -- Set_Ghost_Mode -- -- The following routine ends a Ghost region: -- -- Restore_Ghost_Region -- -- A region may be reinstalled similarly to scopes for decoupled expansion -- such as the generation of dispatch tables or the creation of a predicate -- function. -- -- If the mode of a Ghost region is Ignore, any newly created nodes as well -- as source entities are marked as ignored Ghost. In additon, the marking -- process signals all enclosing scopes that an ignored Ghost node resides -- within. The compilation unit where the node resides is also added to an -- auxiliary table for post processing. -- -- After the analysis and expansion of all compilation units takes place -- as well as the instantiation of all inlined [generic] bodies, the GNAT -- driver initiates a separate pass which removes all ignored Ghost nodes -- from all units stored in the auxiliary table. -------------------- -- GNATprove Mode -- -------------------- -- When a file is compiled in GNATprove mode (-gnatd.F), a very light -- expansion is performed and the analysis must generate a tree in a -- form that meets additional requirements. -- This light expansion does two transformations of the tree that cannot -- be postponed till after semantic analysis: -- 1. Replace object renamings by renamed object. This requires the -- introduction of temporaries at the point of the renaming, which -- must be properly analyzed. -- 2. Fully qualify entity names. This is needed to generate suitable -- local effects and call-graphs in ALI files, with the completely -- qualified names (in particular the suffix to distinguish homonyms). -- The tree after this light expansion should be fully analyzed -- semantically, which sometimes requires the insertion of semantic -- preanalysis, for example for subprogram contracts and pragma -- check/assert. In particular, all expression must have their proper type, -- and semantic links should be set between tree nodes (partial to full -- view, etc.) Some kinds of nodes should be either absent, or can be -- ignored by the formal verification backend: -- N_Object_Renaming_Declaration: can be ignored safely -- N_Expression_Function: absent (rewritten) -- N_Expression_With_Actions: absent (not generated) -- SPARK cross-references are generated from the regular cross-references -- (used for browsing and code understanding) and additional references -- collected during semantic analysis, in particular on all dereferences. -- These SPARK cross-references are output in a separate section of ALI -- files, as described in spark_xrefs.adb. They are the basis for the -- computation of data dependences in GNATprove. This implies that all -- cross-references should be generated in this mode, even those that would -- not make sense from a user point-of-view, and that cross-references that -- do not lead to data dependences for subprograms can be safely ignored. -- GNATprove relies on the following front end behaviors: -- 1. The first declarations in the list of visible declarations of -- a package declaration for a generic instance, up to the first -- declaration which comes from source, should correspond to -- the "mappings nodes" between formal and actual generic parameters. -- 2. In addition pragma Debug statements are removed from the tree -- (rewritten to NULL stmt), since they should be ignored in formal -- verification. -- 3. An error is also issued for missing subunits, similar to the -- warning issued when generating code, to avoid formal verification -- of a partial unit. -- 4. Unconstrained types are not replaced by constrained types whose -- bounds are generated from an expression: Expand_Subtype_From_Expr -- should be a no-op. -- 5. Errors (instead of warnings) are issued on compile-time-known -- constraint errors even though such cases do not correspond to -- illegalities in the Ada RM (this is simply another case where -- GNATprove implements a subset of the full language). -- -- However, there are a few exceptions to this rule for cases where -- we want to allow the GNATprove analysis to proceed (e.g. range -- checks on empty ranges, which typically appear in deactivated -- code in a particular configuration). -- 6. Subtypes should match in the AST, even after a generic is -- instantiated. In particular, GNATprove relies on the fact that, -- on a selected component, the type of the selected component is -- the type of the corresponding component in the prefix of the -- selected component. -- -- Note that, in some cases, we know that this rule is broken by the -- frontend. In particular, if the selected component is a packed -- array depending on a discriminant of a unconstrained formal object -- parameter of a generic. ---------------- -- SPARK Mode -- ---------------- -- The SPARK RM 1.6.5 defines a mode of operation called "SPARK mode" which -- starts a scope where the SPARK language semantics are either On, Off, or -- Auto, where Auto leaves the choice to the tools. A SPARK mode may be -- specified by means of an aspect or a pragma. -- The following entities may be subject to a SPARK mode. Entities marked -- with * may possess two differente SPARK modes. -- E_Entry -- E_Entry_Family -- E_Function -- E_Generic_Function -- E_Generic_Package * -- E_Generic_Procedure -- E_Operator -- E_Package * -- E_Package_Body * -- E_Procedure -- E_Protected_Body -- E_Protected_Subtype -- E_Protected_Type * -- E_Subprogram_Body -- E_Task_Body -- E_Task_Subtype -- E_Task_Type * -- E_Variable -- In order to manage SPARK scopes, the compiler relies on global variables -- SPARK_Mode and SPARK_Mode_Pragma and a mechanism called "SPARK regions." -- Routines Install_SPARK_Mode and Set_SPARK_Mode create a new SPARK region -- and routine Restore_SPARK_Mode ends a SPARK region. A region may be -- reinstalled similarly to scopes. ----------------------- -- Check Flag Fields -- ----------------------- -- The following flag fields appear in expression nodes: -- Do_Division_Check -- Do_Overflow_Check -- Do_Range_Check -- These three flags are always set by the front end during semantic -- analysis, on expression nodes that may trigger the corresponding -- check. The front end then inserts or not the check during expansion. In -- particular, these flags should also be correctly set in GNATprove mode. -- As a special case, the front end does not insert a Do_Division_Check -- flag on float exponentiation expressions, for the case where the value -- is 0.0 and the exponent is negative, although this case does lead to a -- division check failure. As another special case, the front end does not -- insert a Do_Range_Check on an allocator where the designated type is -- scalar, and the designated type is more constrained than the type of the -- initialized allocator value or the type of the default value for an -- uninitialized allocator. -- Note that the expander always takes care of the Do_Range_Check case, so -- this flag will never be set in the expanded tree passed to the back end. -- For the other two flags, the check can be generated either by the back -- end or by the front end, depending on the setting of a target parameter. -- Note that this accounts for all nodes that trigger the corresponding -- checks, except for range checks on subtype_indications, which may be -- required to check that a range_constraint is compatible with the given -- subtype (RM 3.2.2(11)). -- The following flag fields appear in various nodes: -- Do_Discriminant_Check -- Do_Length_Check -- Do_Storage_Check -- These flags are used in some specific cases by the front end, either -- during semantic analysis or during expansion, and cannot be expected -- to be set on all nodes that trigger the corresponding check. ------------------------ -- Common Flag Fields -- ------------------------ -- The following flag fields appear in all nodes: -- Analyzed -- This flag is used to indicate that a node (and all its children) have -- been analyzed. It is used to avoid reanalysis of a node that has -- already been analyzed, both for efficiency and functional correctness -- reasons. -- Comes_From_Source -- This flag is set if the node comes directly from an explicit construct -- in the source. It is normally on for any nodes built by the scanner or -- parser from the source program, with the exception that in a few cases -- the parser adds nodes to normalize the representation (in particular -- a null statement is added to a package body if there is no begin/end -- initialization section. -- -- Most nodes inserted by the analyzer or expander are not considered -- as coming from source, so the flag is off for such nodes. In a few -- cases, the expander constructs nodes closely equivalent to nodes -- from the source program (e.g. the allocator built for build-in-place -- case), and the Comes_From_Source flag is deliberately set. -- Error_Posted -- This flag is used to avoid multiple error messages being posted on or -- referring to the same node. This flag is set if an error message -- refers to a node or is posted on its source location, and has the -- effect of inhibiting further messages involving this same node. ----------------------- -- Modify_Tree_For_C -- ----------------------- -- If the flag Opt.Modify_Tree_For_C is set True, then the tree is modified -- in ways that help match the semantics better with C, easing the task of -- interfacing to C code generators (other than GCC, where the work is done -- in gigi, and there is no point in changing that), and also making life -- easier for Cprint in generating C source code. -- The current modifications implemented are as follows: -- N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic nodes -- are eliminated from the tree (since these operations do not exist in -- C), and the operations are rewritten in terms of logical shifts and -- other logical operations that do exist in C. See Exp_Ch4 expansion -- routines for these operators for details of the transformations made. -- The right operand of N_Op_Shift_Right and N_Op_Shift_Left is always -- less than the word size (since other values are not well-defined in -- C). This is done using an explicit test if necessary. -- Min and Max attributes are expanded into equivalent if expressions, -- dealing properly with side effect issues. -- Mod for signed integer types is expanded into equivalent expressions -- using Rem (which is % in C) and other C-available operators. -- Functions returning bounded arrays are transformed into procedures -- with an extra out parameter, and the calls updated accordingly. -- Aggregates are only kept unexpanded for object declarations, otherwise -- they are systematically expanded into loops (for arrays) and -- individual assignments (for records). -- Unconstrained array types are handled by means of fat pointers. -- Postconditions are inlined by the frontend since their body may have -- references to itypes defined in the enclosing subprogram. ------------------------------------ -- Description of Semantic Fields -- ------------------------------------ -- The meaning of the syntactic fields is generally clear from their names -- without any further description, since the names are chosen to -- correspond very closely to the syntax in the reference manual. This -- section describes the usage of the semantic fields, which are used to -- contain additional information determined during semantic analysis. -- Accept_Handler_Records -- This field is present only in an N_Accept_Alternative node. It is used -- to temporarily hold the exception handler records from an accept -- statement in a selective accept. These exception handlers will -- eventually be placed in the Handler_Records list of the procedure -- built for this accept (see Expand_N_Selective_Accept procedure in -- Exp_Ch9 for further details). -- Access_Types_To_Process -- Present in N_Freeze_Entity nodes for Incomplete or private types. -- Contains the list of access types which may require specific treatment -- when the nature of the type completion is completely known. An example -- of such treatment is the generation of the associated_final_chain. -- Actions -- This field contains a sequence of actions that are associated with the -- node holding the field. See the individual node types for details of -- how this field is used, as well as the description of the specific use -- for a particular node type. -- Activation_Chain_Entity -- This is used in tree nodes representing task activators (blocks, -- subprogram bodies, package declarations, and task bodies). It is -- initially Empty, and then gets set to point to the entity for the -- declared Activation_Chain variable when the first task is declared. -- When tasks are declared in the corresponding declarative region this -- entity is located by name (its name is always _Chain) and the declared -- tasks are added to the chain. Note that N_Extended_Return_Statement -- does not have this attribute, although it does have an activation -- chain. This chain is used to store the tasks temporarily, and is not -- used for activating them. On successful completion of the return -- statement, the tasks are moved to the caller's chain, and the caller -- activates them. -- Acts_As_Spec -- A flag set in the N_Subprogram_Body node for a subprogram body which -- is acting as its own spec. In the case of a library-level subprogram -- the flag is set as well on the parent compilation unit node. -- Actual_Designated_Subtype -- Present in N_Free_Statement and N_Explicit_Dereference nodes. If gigi -- needs to known the dynamic constrained subtype of the designated -- object, this attribute is set to that type. This is done for -- N_Free_Statements for access-to-classwide types and access to -- unconstrained packed array types, and for N_Explicit_Dereference when -- the designated type is an unconstrained packed array and the -- dereference is the prefix of a 'Size attribute reference. -- Address_Warning_Posted -- Present in N_Attribute_Definition nodes. Set to indicate that we have -- posted a warning for the address clause regarding size or alignment -- issues. Used to inhibit multiple redundant messages. -- Aggregate_Bounds -- Present in array N_Aggregate nodes. If the bounds of the aggregate are -- known at compile time, this field points to an N_Range node with those -- bounds. Otherwise Empty. -- Alloc_For_BIP_Return -- Present in N_Allocator nodes. True if the allocator is one of those -- generated for a build-in-place return statement. -- All_Others -- Present in an N_Others_Choice node. This flag is set for an others -- exception where all exceptions are to be caught, even those that are -- not normally handled (in particular the tasking abort signal). This -- is used for translation of the at end handler into a normal exception -- handler. -- Aspect_On_Partial_View -- Present on an N_Aspect_Specification node. For an aspect that applies -- to a type entity, indicates whether the specification appears on the -- partial view of a private type or extension. Undefined for aspects -- that apply to other entities. -- Aspect_Rep_Item -- Present in N_Aspect_Specification nodes. Points to the corresponding -- pragma/attribute definition node used to process the aspect. -- Assignment_OK -- This flag is set in a subexpression node for an object, indicating -- that the associated object can be modified, even if this would not -- normally be permissible (either by direct assignment, or by being -- passed as an out or in-out parameter). This is used by the expander -- for a number of purposes, including initialization of constants and -- limited type objects (such as tasks), setting discriminant fields, -- setting tag values, etc. N_Object_Declaration nodes also have this -- flag defined. Here it is used to indicate that an initialization -- expression is valid, even where it would normally not be allowed -- (e.g. where the type involved is limited). It is also used to stop -- a Force_Evaluation call for an unchecked conversion, but this usage -- is unclear and not documented ??? -- Associated_Node -- Present in nodes that can denote an entity: identifiers, character -- literals, operator symbols, expanded names, operator nodes, and -- attribute reference nodes (all these nodes have an Entity field). -- This field is also present in N_Aggregate, N_Selected_Component, and -- N_Extension_Aggregate nodes. This field is used in generic processing -- to create links between the generic template and the generic copy. -- See Sem_Ch12.Get_Associated_Node for full details. Note that this -- field overlaps Entity, which is fine, since, as explained in Sem_Ch12, -- the normal function of Entity is not required at the point where the -- Associated_Node is set. Note also, that in generic templates, this -- means that the Entity field does not necessarily point to an Entity. -- Since the back end is expected to ignore generic templates, this is -- harmless. -- Atomic_Sync_Required -- This flag is set on a node for which atomic synchronization is -- required for the corresponding reference or modification. -- At_End_Proc -- This field is present in an N_Handled_Sequence_Of_Statements node. -- It contains an identifier reference for the cleanup procedure to be -- called. See description of this node for further details. -- Backwards_OK -- A flag present in the N_Assignment_Statement node. It is used only -- if the type being assigned is an array type, and is set if analysis -- determines that it is definitely safe to do the copy backwards, i.e. -- starting at the highest addressed element. This is the case if either -- the operands do not overlap, or they may overlap, but if they do, -- then the left operand is at a higher address than the right operand. -- -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it -- means that the front end could not determine that either direction is -- definitely safe, and a runtime check may be required if the backend -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are -- set, it means that the front end can assure no overlap of operands. -- Body_To_Inline -- Present in subprogram declarations. Denotes analyzed but unexpanded -- body of subprogram, to be used when inlining calls. Present when the -- subprogram has an Inline pragma and inlining is enabled. If the -- declaration is completed by a renaming_as_body, and the renamed entity -- is a subprogram, the Body_To_Inline is the name of that entity, which -- is used directly in later calls to the original subprogram. -- Body_Required -- A flag that appears in the N_Compilation_Unit node indicating that -- the corresponding unit requires a body. For the package case, this -- indicates that a completion is required. In Ada 95, if the flag is not -- set for the package case, then a body may not be present. In Ada 83, -- if the flag is not set for the package case, then body is optional. -- For a subprogram declaration, the flag is set except in the case where -- a pragma Import or Interface applies, in which case no body is -- permitted (in Ada 83 or Ada 95). -- By_Ref -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement, -- this flag is set when the returned expression is already allocated on -- the secondary stack and thus the result is passed by reference rather -- than copied another time. -- Cleanup_Actions -- Present in block statements created for transient blocks, contains -- additional cleanup actions carried over from the transient scope. -- Check_Address_Alignment -- A flag present in N_Attribute_Definition clause for a 'Address -- attribute definition. This flag is set if a dynamic check should be -- generated at the freeze point for the entity to which this address -- clause applies. The reason that we need this flag is that we want to -- check for range checks being suppressed at the point where the -- attribute definition clause is given, rather than testing this at the -- freeze point. -- Comes_From_Extended_Return_Statement -- Present in N_Simple_Return_Statement nodes. True if this node was -- constructed as part of the N_Extended_Return_Statement expansion. -- Compile_Time_Known_Aggregate -- Present in N_Aggregate nodes. Set for aggregates which can be fully -- evaluated at compile time without raising constraint error. Such -- aggregates can be passed as is to the back end without any expansion. -- See Exp_Aggr for specific conditions under which this flag gets set. -- Componentwise_Assignment -- Present in N_Assignment_Statement nodes. Set for a record assignment -- where all that needs doing is to expand it into component-by-component -- assignments. This is used internally for the case of tagged types with -- rep clauses, where we need to avoid recursion (we don't want to try to -- generate a call to the primitive operation, because this is the case -- where we are compiling the primitive operation). Note that when we are -- expanding component assignments in this case, we never assign the _tag -- field, but we recursively assign components of the parent type. -- Condition_Actions -- This field appears in else-if nodes and in the iteration scheme node -- for while loops. This field is only used during semantic processing to -- temporarily hold actions inserted into the tree. In the tree passed -- to gigi, the condition actions field is always set to No_List. For -- details on how this field is used, see the routine Insert_Actions in -- package Exp_Util, and also the expansion routines for the relevant -- nodes. -- Context_Pending -- This field appears in Compilation_Unit nodes, to indicate that the -- context of the unit is being compiled. Used to detect circularities -- that are not otherwise detected by the loading mechanism. Such -- circularities can occur in the presence of limited and non-limited -- with_clauses that mention the same units. -- Controlling_Argument -- This field is set in procedure and function call nodes if the call -- is a dispatching call (it is Empty for a non-dispatching call). It -- indicates the source of the call's controlling tag. For procedure -- calls, the Controlling_Argument is one of the actuals. For function -- that has a dispatching result, it is an entity in the context of the -- call that can provide a tag, or else it is the tag of the root type -- of the class. It can also specify a tag directly rather than being a -- tagged object. The latter is needed by the implementations of AI-239 -- and AI-260. -- Conversion_OK -- A flag set on type conversion nodes to indicate that the conversion -- is to be considered as being valid, even though it is the case that -- the conversion is not valid Ada. This is used for attributes Enum_Rep, -- Pos, Val, Fixed_Value and Integer_Value, for internal conversions done -- for fixed-point operations, and for certain conversions for calls to -- initialization procedures. If Conversion_OK is set, then Etype must be -- set (the analyzer assumes that Etype has been set). For the case of -- fixed-point operands, it also indicates that the conversion is to be -- direct conversion of the underlying integer result, with no regard to -- the small operand. -- Convert_To_Return_False -- Present in N_Raise_Expression nodes that appear in the body of the -- special predicateM function used to test a predicate in the context -- of a membership test, where raise expression results in returning a -- value of False rather than raising an exception. -- Corresponding_Aspect -- Present in N_Pragma node. Used to point back to the source aspect from -- the corresponding pragma. This field is Empty for source pragmas. -- Corresponding_Body -- This field is set in subprogram declarations, package declarations, -- entry declarations of protected types, and in generic units. It points -- to the defining entity for the corresponding body (NOT the node for -- the body itself). -- Corresponding_Entry_Body -- Defined in N_Subprogram_Body. Set for subprogram bodies that implement -- a protected type entry; points to the body for the entry. -- Corresponding_Formal_Spec -- This field is set in subprogram renaming declarations, where it points -- to the defining entity for a formal subprogram in the case where the -- renaming corresponds to a generic formal subprogram association in an -- instantiation. The field is Empty if the renaming does not correspond -- to such a formal association. -- Corresponding_Generic_Association -- This field is defined for object declarations and object renaming -- declarations. It is set for the declarations within an instance that -- map generic formals to their actuals. If set, the field points either -- to a copy of a default expression for an actual of mode IN or to a -- generic_association which is the original parent of the expression or -- name appearing in the declaration. This simplifies GNATprove queries. -- Corresponding_Integer_Value -- This field is set in real literals of fixed-point types (it is not -- used for floating-point types). It contains the integer value used -- to represent the fixed-point value. It is also set on the universal -- real literals used to represent bounds of fixed-point base types -- and their first named subtypes. -- Corresponding_Spec -- This field is set in subprogram, package, task, and protected body -- nodes, where it points to the defining entity in the corresponding -- spec. The attribute is also set in N_With_Clause nodes where it points -- to the defining entity for the with'ed spec, and in a subprogram -- renaming declaration when it is a Renaming_As_Body. The field is Empty -- if there is no corresponding spec, as in the case of a subprogram body -- that serves as its own spec. -- -- In Ada 2012, Corresponding_Spec is set on expression functions that -- complete a subprogram declaration. -- Corresponding_Spec_Of_Stub -- This field is present in subprogram, package, task, and protected body -- stubs where it points to the corresponding spec of the stub. Due to -- clashes in the structure of nodes, we cannot use Corresponding_Spec. -- Corresponding_Stub -- This field is present in an N_Subunit node. It holds the node in -- the parent unit that is the stub declaration for the subunit. It is -- set when analysis of the stub forces loading of the proper body. If -- expansion of the proper body creates new declarative nodes, they are -- inserted at the point of the corresponding_stub. -- Dcheck_Function -- This field is present in an N_Variant node, It references the entity -- for the discriminant checking function for the variant. -- Default_Expression -- This field is Empty if there is no default expression. If there is a -- simple default expression (one with no side effects), then this field -- simply contains a copy of the Expression field (both point to the tree -- for the default expression). Default_Expression is used for -- conformance checking. -- Default_Storage_Pool -- This field is present in N_Compilation_Unit_Aux nodes. It is set to a -- copy of Opt.Default_Pool at the end of the compilation unit. See -- package Opt for details. This is used for inheriting the -- Default_Storage_Pool in child units. -- Discr_Check_Funcs_Built -- This flag is present in N_Full_Type_Declaration nodes. It is set when -- discriminant checking functions are constructed. The purpose is to -- avoid attempting to set these functions more than once. -- Do_Discriminant_Check -- This flag is set on N_Selected_Component nodes to indicate that a -- discriminant check is required using the discriminant check routine -- associated with the selector. The actual check is generated by the -- expander when processing selected components. In the case of -- Unchecked_Union, the flag is also set, but no discriminant check -- routine is associated with the selector, and the expander does not -- generate a check. This flag is also present in assignment statements -- (and set if the assignment requires a discriminant check), and in type -- conversion nodes (and set if the conversion requires a check). -- Do_Division_Check -- This flag is set on a division operator (/ mod rem) to indicate that -- a zero divide check is required. The actual check is either dealt with -- by the back end if Backend_Divide_Checks is set to true, or by the -- front end itself if it is set to false. -- Do_Length_Check -- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or, -- N_Op_Xor, or N_Type_Conversion node to indicate that a length check -- is required. It is not determined who deals with this flag (???). -- Do_Overflow_Check -- This flag is set on an operator where an overflow check is required on -- the operation. The actual check is either dealt with by the back end -- if Backend_Overflow_Checks is set to true, or by the front end itself -- if it is set to false. The other cases where this flag is used is on a -- Type_Conversion node as well on if and case expression nodes. -- For a type conversion, it means that the conversion is from one base -- type to another, and the value may not fit in the target base type. -- See also the description of Do_Range_Check for this case. This flag is -- also set on if and case expression nodes if we are operating in either -- MINIMIZED or ELIMINATED overflow checking mode (to make sure that we -- properly process overflow checking for dependent expressions). -- Do_Range_Check -- This flag is set on an expression which appears in a context where a -- range check is required. The target type is clear from the context. -- The contexts in which this flag can appear are the following: -- Right side of an assignment. In this case the target type is taken -- from the left side of the assignment, which is referenced by the -- Name of the N_Assignment_Statement node. -- Subscript expressions in an indexed component. In this case the -- target type is determined from the type of the array, which is -- referenced by the Prefix of the N_Indexed_Component node. -- Argument expression for a parameter, appearing either directly in -- the Parameter_Associations list of a call or as the Expression of an -- N_Parameter_Association node that appears in this list. In either -- case, the check is against the type of the formal. Note that the -- flag is relevant only in IN and IN OUT parameters, and will be -- ignored for OUT parameters, where no check is required in the call, -- and if a check is required on the return, it is generated explicitly -- with a type conversion. -- Initialization expression for the initial value in an object -- declaration. In this case the Do_Range_Check flag is set on -- the initialization expression, and the check is against the -- range of the type of the object being declared. This includes the -- cases of expressions providing default discriminant values, and -- expressions used to initialize record components. -- The expression of a type conversion. In this case the range check is -- against the target type of the conversion. See also the use of -- Do_Overflow_Check on a type conversion. The distinction is that the -- overflow check protects against a value that is outside the range of -- the target base type, whereas a range check checks that the -- resulting value (which is a value of the base type of the target -- type), satisfies the range constraint of the target type. -- Note: when a range check is required in contexts other than those -- listed above (e.g. in a return statement), an additional type -- conversion node is introduced to represent the required check. -- Do_Storage_Check -- This flag is set in an N_Allocator node to indicate that a storage -- check is required for the allocation, or in an N_Subprogram_Body node -- to indicate that a stack check is required in the subprogram prologue. -- The N_Allocator case is handled by the routine that expands the call -- to the runtime routine. The N_Subprogram_Body case is handled by the -- backend, and all the semantics does is set the flag. -- Elaborate_Present -- This flag is set in the N_With_Clause node to indicate that pragma -- Elaborate pragma appears for the with'ed units. -- Elaborate_All_Desirable -- This flag is set in the N_With_Clause mode to indicate that the static -- elaboration processing has determined that an Elaborate_All pragma is -- desirable for correct elaboration for this unit. -- Elaborate_All_Present -- This flag is set in the N_With_Clause node to indicate that a -- pragma Elaborate_All pragma appears for the with'ed units. -- Elaborate_Desirable -- This flag is set in the N_With_Clause mode to indicate that the static -- elaboration processing has determined that an Elaborate pragma is -- desirable for correct elaboration for this unit. -- Else_Actions -- This field is present in if expression nodes. During code -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert -- actions at an appropriate place in the tree to get elaborated at the -- right time. For if expressions, we have to be sure that the actions -- for the Else branch are only elaborated if the condition is False. -- The Else_Actions field is used as a temporary parking place for -- these actions. The final tree is always rewritten to eliminate the -- need for this field, so in the tree passed to Gigi, this field is -- always set to No_List. -- Enclosing_Variant -- This field is present in the N_Variant node and identifies the Node_Id -- corresponding to the immediately enclosing variant when the variant is -- nested, and N_Empty otherwise. Set during semantic processing of the -- variant part of a record type. -- Entity -- Appears in all direct names (identifiers, character literals, and -- operator symbols), as well as expanded names, and attributes that -- denote entities, such as 'Class. Points to entity for corresponding -- defining occurrence. Set after name resolution. For identifiers in a -- WITH list, the corresponding defining occurrence is in a separately -- compiled file, and Entity must be set by the library Load procedure. -- -- Note: During name resolution, the value in Entity may be temporarily -- incorrect (e.g. during overload resolution, Entity is initially set to -- the first possible correct interpretation, and then later modified if -- necessary to contain the correct value after resolution). -- -- Note: This field overlaps Associated_Node, which is used during -- generic processing (see Sem_Ch12 for details). Note also that in -- generic templates, this means that the Entity field does not always -- point to an Entity. Since the back end is expected to ignore generic -- templates, this is harmless. -- -- Note: This field also appears in N_Attribute_Definition_Clause nodes. -- It is used only for stream attributes definition clauses. In this -- case, it denotes a (possibly dummy) subprogram entity that is declared -- conceptually at the point of the clause. Thus the visibility of the -- attribute definition clause (in the sense of 8.3(23) as amended by -- AI-195) can be checked by testing the visibility of that subprogram. -- -- Note: Normally the Entity field of an identifier points to the entity -- for the corresponding defining identifier, and hence the Chars field -- of an identifier will match the Chars field of the entity. However, -- there is no requirement that these match, and there are obscure cases -- of generated code where they do not match. -- Note: Ada 2012 aspect specifications require additional links between -- identifiers and various attributes. These attributes can be of -- arbitrary types, and the entity field of identifiers that denote -- aspects must be used to store arbitrary expressions for later semantic -- checks. See section on aspect specifications for details. -- Entity_Or_Associated_Node -- A synonym for both Entity and Associated_Node. Used by convention in -- the code when referencing this field in cases where it is not known -- whether the field contains an Entity or an Associated_Node. -- Etype -- Appears in all expression nodes, all direct names, and all entities. -- Points to the entity for the related type. Set after type resolution. -- Normally this is the actual subtype of the expression. However, in -- certain contexts such as the right side of an assignment, subscripts, -- arguments to calls, returned value in a function, initial value etc. -- it is the desired target type. In the event that this is different -- from the actual type, the Do_Range_Check flag will be set if a range -- check is required. Note: if the Is_Overloaded flag is set, then Etype -- points to an essentially arbitrary choice from the possible set of -- types. -- Exception_Junk -- This flag is set in a various nodes appearing in a statement sequence -- to indicate that the corresponding node is an artifact of the -- generated code for exception handling, and should be ignored when -- analyzing the control flow of the relevant sequence of statements -- (e.g. to check that it does not end with a bad return statement). -- Exception_Label -- Appears in N_Push_xxx_Label nodes. Points to the entity of the label -- to be used for transforming the corresponding exception into a goto, -- or contains Empty, if this exception is not to be transformed. Also -- appears in N_Exception_Handler nodes, where, if set, it indicates -- that there may be a local raise for the handler, so that expansion -- to allow a goto is required (and this field contains the label for -- this goto). See Exp_Ch11.Expand_Local_Exception_Handlers for details. -- Expansion_Delayed -- Set on aggregates and extension aggregates that need a top-down rather -- than bottom-up expansion. Typically aggregate expansion happens bottom -- up. For nested aggregates the expansion is delayed until the enclosing -- aggregate itself is expanded, e.g. in the context of a declaration. To -- delay it we set this flag. This is done to avoid creating a temporary -- for each level of a nested aggregate, and also to prevent the -- premature generation of constraint checks. This is also a requirement -- if we want to generate the proper attachment to the internal -- finalization lists (for record with controlled components). Top down -- expansion of aggregates is also used for in-place array aggregate -- assignment or initialization. When the full context is known, the -- target of the assignment or initialization is used to generate the -- left-hand side of individual assignment to each subcomponent. -- Expression_Copy -- Present in N_Pragma_Argument_Association nodes. Contains a copy of the -- original expression. This field is best used to store pragma-dependent -- modifications performed on the original expression such as replacement -- of the current type instance or substitutions of primitives. -- First_Inlined_Subprogram -- Present in the N_Compilation_Unit node for the main program. Points -- to a chain of entities for subprograms that are to be inlined. The -- Next_Inlined_Subprogram field of these entities is used as a link -- pointer with Empty marking the end of the list. This field is Empty -- if there are no inlined subprograms or inlining is not active. -- First_Named_Actual -- Present in procedure call statement and function call nodes, and also -- in Intrinsic nodes. Set during semantic analysis to point to the first -- named parameter where parameters are ordered by declaration order (as -- opposed to the actual order in the call which may be different due to -- named associations). Note: this field points to the explicit actual -- parameter itself, not the N_Parameter_Association node (its parent). -- First_Real_Statement -- Present in N_Handled_Sequence_Of_Statements node. Normally set to -- Empty. Used only when declarations are moved into the statement part -- of a construct as a result of wrapping an AT END handler that is -- required to cover the declarations. In this case, this field is used -- to remember the location in the statements list of the first real -- statement, i.e. the statement that used to be first in the statement -- list before the declarations were prepended. -- First_Subtype_Link -- Present in N_Freeze_Entity node for an anonymous base type that is -- implicitly created by the declaration of a first subtype. It points -- to the entity for the first subtype. -- Float_Truncate -- A flag present in type conversion nodes. This is used for float to -- integer conversions where truncation is required rather than rounding. -- Forwards_OK -- A flag present in the N_Assignment_Statement node. It is used only -- if the type being assigned is an array type, and is set if analysis -- determines that it is definitely safe to do the copy forwards, i.e. -- starting at the lowest addressed element. This is the case if either -- the operands do not overlap, or they may overlap, but if they do, -- then the left operand is at a lower address than the right operand. -- -- Note: If neither of the flags Forwards_OK or Backwards_OK is set, it -- means that the front end could not determine that either direction is -- definitely safe, and a runtime check may be required if the backend -- cannot figure it out. If both flags Forwards_OK and Backwards_OK are -- set, it means that the front end can assure no overlap of operands. -- From_Aspect_Specification -- Processing of aspect specifications typically results in insertion in -- the tree of corresponding pragma or attribute definition clause nodes. -- These generated nodes have the From_Aspect_Specification flag set to -- indicate that they came from aspect specifications originally. -- From_At_End -- This flag is set on an N_Raise_Statement node if it corresponds to -- the reraise statement generated as the last statement of an AT END -- handler when SJLJ exception handling is active. It is used to stop -- a bogus violation of restriction (No_Exception_Propagation), bogus -- because if the restriction is set, the reraise is not generated. -- From_At_Mod -- This flag is set on the attribute definition clause node that is -- generated by a transformation of an at mod phrase in a record -- representation clause. This is used to give slightly different (Ada 83 -- compatible) semantics to such a clause, namely it is used to specify a -- minimum acceptable alignment for the base type and all subtypes. In -- Ada 95 terms, the actual alignment of the base type and all subtypes -- must be a multiple of the given value, and the representation clause -- is considered to be type specific instead of subtype specific. -- From_Conditional_Expression -- This flag is set on if and case statements generated by the expansion -- of if and case expressions respectively. The flag is used to suppress -- any finalization of controlled objects found within these statements. -- From_Default -- This flag is set on the subprogram renaming declaration created in an -- instance for a formal subprogram, when the formal is declared with a -- box, and there is no explicit actual. If the flag is present, the -- declaration is treated as an implicit reference to the formal in the -- ali file. -- Generalized_Indexing -- Present in N_Indexed_Component nodes. Set for Indexed_Component nodes -- that are Ada 2012 container indexing operations. The value of the -- attribute is a function call (possibly dereferenced) that corresponds -- to the proper expansion of the source indexing operation. Before -- expansion, the source node is rewritten as the resolved generalized -- indexing. -- Generic_Parent -- Generic_Parent is defined on declaration nodes that are instances. The -- value of Generic_Parent is the generic entity from which the instance -- is obtained. -- Generic_Parent_Type -- Generic_Parent_Type is defined on Subtype_Declaration nodes for the -- actuals of formal private and derived types. Within the instance, the -- operations on the actual are those inherited from the parent. For a -- formal private type, the parent type is the generic type itself. The -- Generic_Parent_Type is also used in an instance to determine whether a -- private operation overrides an inherited one. -- Handler_List_Entry -- This field is present in N_Object_Declaration nodes. It is set only -- for the Handler_Record entry generated for an exception in zero cost -- exception handling mode. It references the corresponding item in the -- handler list, and is used to delete this entry if the corresponding -- handler is deleted during optimization. For further details on why -- this is required, see Exp_Ch11.Remove_Handler_Entries. -- Has_Dereference_Action -- This flag is present in N_Explicit_Dereference nodes. It is set to -- indicate that the expansion has aready produced a call to primitive -- Dereference of a System.Checked_Pools.Checked_Pool implementation. -- Such dereference actions are produced for debugging purposes. -- Has_Dynamic_Length_Check -- This flag is present in all expression nodes. It is set to indicate -- that one of the routines in unit Checks has generated a length check -- action which has been inserted at the flagged node. This is used to -- avoid the generation of duplicate checks. -- Has_Local_Raise -- Present in exception handler nodes. Set if the handler can be entered -- via a local raise that gets transformed to a goto statement. This will -- always be set if Local_Raise_Statements is non-empty, but can also be -- set as a result of generation of N_Raise_xxx nodes, or flags set in -- nodes requiring generation of back end checks. -- Has_No_Elaboration_Code -- A flag that appears in the N_Compilation_Unit node to indicate whether -- or not elaboration code is present for this unit. It is initially set -- true for subprogram specs and bodies and for all generic units and -- false for non-generic package specs and bodies. Gigi may set the flag -- in the non-generic package case if it determines that no elaboration -- code is generated. Note that this flag is not related to the -- Is_Preelaborated status, there can be preelaborated packages that -- generate elaboration code, and non-preelaborated packages which do -- not generate elaboration code. -- Has_Pragma_Suppress_All -- This flag is set in an N_Compilation_Unit node if the Suppress_All -- pragma appears anywhere in the unit. This accommodates the rather -- strange placement rules of other compilers (DEC permits it at the -- end of a unit, and Rational allows it as a program unit pragma). We -- allow it anywhere at all, and consider it equivalent to a pragma -- Suppress (All_Checks) appearing at the start of the configuration -- pragmas for the unit. -- Has_Private_View -- A flag present in generic nodes that have an entity, to indicate that -- the node has a private type. Used to exchange private and full -- declarations if the visibility at instantiation is different from the -- visibility at generic definition. -- Has_Relative_Deadline_Pragma -- A flag present in N_Subprogram_Body and N_Task_Definition nodes to -- flag the presence of a pragma Relative_Deadline. -- Has_Self_Reference -- Present in N_Aggregate and N_Extension_Aggregate. Indicates that one -- of the expressions contains an access attribute reference to the -- enclosing type. Such a self-reference can only appear in default- -- initialized aggregate for a record type. -- Has_SP_Choice -- Present in all nodes containing a Discrete_Choices field (N_Variant, -- N_Case_Expression_Alternative, N_Case_Statement_Alternative). Set to -- True if the Discrete_Choices list has at least one occurrence of a -- statically predicated subtype. -- Has_Storage_Size_Pragma -- A flag present in an N_Task_Definition node to flag the presence of a -- Storage_Size pragma. -- Has_Target_Names -- Present in assignment statements. Indicates that the RHS contains -- target names (see AI12-0125-3) and must be expanded accordingly. -- Has_Wide_Character -- Present in string literals, set if any wide character (i.e. character -- code outside the Character range but within Wide_Character range) -- appears in the string. Used to implement pragma preference rules. -- Has_Wide_Wide_Character -- Present in string literals, set if any wide character (i.e. character -- code outside the Wide_Character range) appears in the string. Used to -- implement pragma preference rules. -- Header_Size_Added -- Present in N_Attribute_Reference nodes, set only for attribute -- Max_Size_In_Storage_Elements. The flag indicates that the size of the -- hidden list header used by the runtime finalization support has been -- added to the size of the prefix. The flag also prevents the infinite -- expansion of the same attribute in the said context. -- Hidden_By_Use_Clause -- An entity list present in use clauses that appear within -- instantiations. For the resolution of local entities, entities -- introduced by these use clauses have priority over global ones, -- and outer entities must be explicitly hidden/restored on exit. -- Implicit_With -- Present in N_With_Clause nodes. The flag indicates that the clause -- does not comes from source and introduces an implicit dependency on -- a particular unit. Such implicit with clauses are generated by: -- -- * ABE mechanism - The static elaboration model of both the default -- and the legacy ABE mechanism use with clauses to encode implicit -- Elaborate[_All] pragmas. -- -- * Analysis - A with clause for child unit A.B.C is equivalent to -- a series of clauses that with A, A.B, and A.B.C. Manipulation of -- contexts utilizes implicit with clauses to emulate the visibility -- of a particular unit. -- -- * RTSfind - The compiler generates code which references entities -- from the runtime. -- Import_Interface_Present -- This flag is set in an Interface or Import pragma if a matching -- pragma of the other kind is also present. This is used to avoid -- generating some unwanted error messages. -- Includes_Infinities -- This flag is present in N_Range nodes. It is set for the range of -- unconstrained float types defined in Standard, which include not only -- the given range of values, but also legitimately can include infinite -- values. This flag is false for any float type for which an explicit -- range is given by the programmer, even if that range is identical to -- the range for Float. -- Incomplete_View -- Present in full type declarations that are completions of incomplete -- type declarations. Denotes the corresponding incomplete type -- declaration. Used to simplify the retrieval of primitive operations -- that may be declared between the partial and the full view of an -- untagged type. -- Inherited_Discriminant -- This flag is present in N_Component_Association nodes. It indicates -- that a given component association in an extension aggregate is the -- value obtained from a constraint on an ancestor. Used to prevent -- double expansion when the aggregate has expansion delayed. -- Instance_Spec -- This field is present in generic instantiation nodes, and also in -- formal package declaration nodes (formal package declarations are -- treated in a manner very similar to package instantiations). It points -- to the node for the spec of the instance, inserted as part of the -- semantic processing for instantiations in Sem_Ch12. -- Is_Abort_Block -- Present in N_Block_Statement nodes. True if the block protects a list -- of statements with an Abort_Defer / Abort_Undefer_Direct pair. -- Is_Accessibility_Actual -- Present in N_Parameter_Association nodes. True if the parameter is -- an extra actual that carries the accessibility level of the actual -- for an access parameter, in a function that dispatches on result and -- is called in a dispatching context. Used to prevent a formal/actual -- mismatch when the call is rewritten as a dispatching call. -- Is_Analyzed_Pragma -- Present in N_Pragma nodes. Set for delayed pragmas that require a two -- step analysis. The initial step is peformed by routine Analyze_Pragma -- and verifies the overall legality of the pragma. The second step takes -- place in the various Analyze_xxx_In_Decl_Part routines which perform -- full analysis. The flag prevents the reanalysis of a delayed pragma. -- Is_Asynchronous_Call_Block -- A flag set in a Block_Statement node to indicate that it is the -- expansion of an asynchronous entry call. Such a block needs cleanup -- handler to assure that the call is cancelled. -- Is_Boolean_Aspect -- Present in N_Aspect_Specification node. Set if the aspect is for a -- boolean aspect (i.e. Aspect_Id is in Boolean_Aspect subtype). -- Is_Checked -- Present in N_Aspect_Specification and N_Pragma nodes. Set for an -- assertion aspect or pragma, or check pragma for an assertion, that -- is to be checked at run time. If either Is_Checked or Is_Ignored -- is set (they cannot both be set), then this means that the status of -- the pragma has been checked at the appropriate point and should not -- be further modified (in some cases these flags are copied when a -- pragma is rewritten). -- Is_Checked_Ghost_Pragma -- This flag is present in N_Pragma nodes. It is set when the pragma is -- related to a checked Ghost entity or encloses a checked Ghost entity. -- This flag has no relation to Is_Checked. -- Is_Component_Left_Opnd -- Is_Component_Right_Opnd -- Present in concatenation nodes, to indicate that the corresponding -- operand is of the component type of the result. Used in resolving -- concatenation nodes in instances. -- Is_Controlling_Actual -- This flag is set on an expression that is a controlling argument in -- a dispatching call. It is off in all other cases. See Sem_Disp for -- details of its use. -- Is_Declaration_Level_Node -- Present in call marker and instantiation nodes. Set when the constuct -- appears within the declarations of a block statement, an entry body, -- a subprogram body, or a task body. The flag aids the ABE Processing -- phase to catch certain forms of guaranteed ABEs. -- Is_Delayed_Aspect -- Present in N_Pragma and N_Attribute_Definition_Clause nodes which -- come from aspect specifications, where the evaluation of the aspect -- must be delayed to the freeze point. This flag is also set True in -- the corresponding N_Aspect_Specification node. -- Is_Disabled -- A flag set in an N_Aspect_Specification or N_Pragma node if there was -- a Check_Policy or Assertion_Policy (or in the case of a Debug_Pragma) -- a Debug_Policy pragma that resulted in totally disabling the flagged -- aspect or policy as a result of using the GNAT-defined policy DISABLE. -- If this flag is set, the aspect or policy is not analyzed for semantic -- correctness, so any expressions etc will not be marked as analyzed. -- Is_Dispatching_Call -- Present in call marker nodes. Set when the related call which prompted -- the creation of the marker is dispatching. -- Is_Dynamic_Coextension -- Present in allocator nodes, to indicate that this is an allocator -- for an access discriminant of a dynamically allocated object. The -- coextension must be deallocated and finalized at the same time as -- the enclosing object. The partner flag Is_Static_Coextension must -- be cleared before setting this flag to True. -- Is_Effective_Use_Clause -- Present in both N_Use_Type_Clause and N_Use_Package_Clause to indicate -- a use clause is "used" in the current source. -- Is_Elaboration_Checks_OK_Node -- Present in the following nodes: -- -- assignment statement -- attribute reference -- call marker -- entry call statement -- expanded name -- function call -- function instantiation -- identifier -- package instantiation -- procedure call statement -- procedure instantiation -- requeue statement -- variable reference marker -- -- Set when the node appears within a context which allows the generation -- of run-time ABE checks. This flag detemines whether the ABE Processing -- phase generates conditional ABE checks and guaranteed ABE failures. -- Is_Elaboration_Code -- Present in assignment statements. Set for an assignment which updates -- the elaboration flag of a package or subprogram when the corresponding -- body is successfully elaborated. -- Is_Elaboration_Warnings_OK_Node -- Present in the following nodes: -- -- attribute reference -- call marker -- entry call statement -- expanded name -- function call -- function instantiation -- identifier -- package instantiation -- procedure call statement -- procedure instantiation -- requeue statement -- variable reference marker -- -- Set when the node appears within a context where elaboration warnings -- are enabled. This flag determines whether the ABE processing phase -- generates diagnostics on various elaboration issues. -- Is_Entry_Barrier_Function -- This flag is set on N_Subprogram_Declaration and N_Subprogram_Body -- nodes which emulate the barrier function of a protected entry body. -- The flag is used when checking for incorrect use of Current_Task. -- Is_Expanded_Build_In_Place_Call -- This flag is set in an N_Function_Call node to indicate that the extra -- actuals to support a build-in-place style of call have been added to -- the call. -- Is_Expanded_Contract -- Present in N_Contract nodes. Set if the contract has already undergone -- expansion activities. -- Is_Finalization_Wrapper -- This flag is present in N_Block_Statement nodes. It is set when the -- block acts as a wrapper of a handled construct which has controlled -- objects. The wrapper prevents interference between exception handlers -- and At_End handlers. -- Is_Generic_Contract_Pragma -- This flag is present in N_Pragma nodes. It is set when the pragma is -- a source construct, applies to a generic unit or its body, and denotes -- one of the following contract-related annotations: -- Abstract_State -- Contract_Cases -- Depends -- Extensions_Visible -- Global -- Initial_Condition -- Initializes -- Post -- Post_Class -- Postcondition -- Pre -- Pre_Class -- Precondition -- Refined_Depends -- Refined_Global -- Refined_Post -- Refined_State -- Test_Case -- Is_Homogeneous_Aggregate -- A flag set on an Ada 2022 aggregate that uses square brackets as -- delimiters, and thus denotes an array or container aggregate, or -- the prefix of a reduction attribute. -- Is_Ignored -- A flag set in an N_Aspect_Specification or N_Pragma node if there was -- a Check_Policy or Assertion_Policy (or in the case of a Debug_Pragma) -- a Debug_Policy pragma that specified a policy of IGNORE, DISABLE, or -- OFF, for the pragma/aspect. If there was a Policy pragma specifying -- a Policy of ON or CHECK, then this flag is reset. If no Policy pragma -- gives a policy for the aspect or pragma, then there are two cases. For -- an assertion aspect or pragma (one of the assertion kinds allowed in -- an Assertion_Policy pragma), then Is_Ignored is set if assertions are -- ignored because of the absence of a -gnata switch. For any other -- aspects or pragmas, the flag is off. If this flag is set, the -- aspect/pragma is fully analyzed and checked for other syntactic -- and semantic errors, but it does not have any semantic effect. -- Is_Ignored_Ghost_Pragma -- This flag is present in N_Pragma nodes. It is set when the pragma is -- related to an ignored Ghost entity or encloses ignored Ghost entity. -- This flag has no relation to Is_Ignored. -- Is_In_Discriminant_Check -- This flag is present in a selected component, and is used to indicate -- that the reference occurs within a discriminant check. The -- significance is that optimizations based on assuming that the -- discriminant check has a correct value cannot be performed in this -- case (or the discriminant check may be optimized away). -- Is_Inherited_Pragma -- This flag is set in an N_Pragma node that appears in a N_Contract node -- to indicate that the pragma has been inherited from a parent context. -- Is_Initialization_Block -- Defined in block nodes. Set when the block statement was created by -- the finalization machinery to wrap initialization statements. This -- flag aids the ABE Processing phase to suppress the diagnostics of -- finalization actions in initialization contexts. -- Is_Known_Guaranteed_ABE -- NOTE: this flag is shared between the legacy ABE mechanism and the -- default ABE mechanism. -- -- Present in the following nodes: -- -- call marker -- formal package declaration -- function call -- function instantiation -- package instantiation -- procedure call statement -- procedure instantiation -- -- Set when the elaboration or evaluation of the scenario results in -- a guaranteed ABE. The flag is used to suppress the instantiation of -- generic bodies because gigi cannot handle certain forms of premature -- instantiation, as well as to prevent the reexamination of the node by -- the ABE Processing phase. -- Is_Machine_Number -- This flag is set in an N_Real_Literal node to indicate that the value -- is a machine number. This avoids some unnecessary cases of converting -- real literals to machine numbers. -- Is_Null_Loop -- This flag is set in an N_Loop_Statement node if the corresponding loop -- can be determined to be null at compile time. This is used to remove -- the loop entirely at expansion time. -- Is_Overloaded -- A flag present in all expression nodes. Used temporarily during -- overloading determination. The setting of this flag is not relevant -- once overloading analysis is complete. -- Is_Power_Of_2_For_Shift -- A flag present only in N_Op_Expon nodes. It is set when the -- exponentiation is of the form 2 ** N, where the type of N is an -- unsigned integral subtype whose size does not exceed the size of -- Standard_Integer (i.e. a type that can be safely converted to -- Natural), and the exponentiation appears as the right operand of an -- integer multiplication or an integer division where the dividend is -- unsigned. It is also required that overflow checking is off for both -- the exponentiation and the multiply/divide node. If this set of -- conditions holds, and the flag is set, then the division or -- multiplication can be (and is) converted to a shift. -- Is_Preelaborable_Call -- Present in call marker nodes. Set when the related call is non-static -- but preelaborable. -- Is_Prefixed_Call -- This flag is set in a selected component within a generic unit, if -- it resolves to a prefixed call to a primitive operation. The flag -- is used to prevent accidental overloadings in an instance, when a -- primitive operation and a private record component may be homographs. -- Is_Protected_Subprogram_Body -- A flag set in a Subprogram_Body block to indicate that it is the -- implementation of a protected subprogram. Such a body needs cleanup -- handler to make sure that the associated protected object is unlocked -- when the subprogram completes. -- Is_Qualified_Universal_Literal -- Present in N_Qualified_Expression nodes. Set when the qualification is -- converting a universal literal to a specific type. Such qualifiers aid -- the resolution of accidental overloading of binary or unary operators -- which may occur in instances. -- Is_Read -- Present in variable reference markers. Set when the original variable -- reference constitutes a read of the variable. -- Is_Source_Call -- Present in call marker nodes. Set when the related call came from -- source. -- Is_SPARK_Mode_On_Node -- Present in the following nodes: -- -- assignment statement -- attribute reference -- call marker -- entry call statement -- expanded name -- function call -- function instantiation -- identifier -- package instantiation -- procedure call statement -- procedure instantiation -- requeue statement -- variable reference marker -- -- Set when the node appears within a context subject to SPARK_Mode On. -- This flag determines when the SPARK model of elaboration be activated -- by the ABE Processing phase. -- Is_Static_Coextension -- Present in N_Allocator nodes. Set if the allocator is a coextension -- of an object allocated on the stack rather than the heap. The partner -- flag Is_Dynamic_Coextension must be cleared before setting this flag -- to True. -- Is_Static_Expression -- Indicates that an expression is a static expression according to the -- rules in RM-4.9. See Sem_Eval for details. -- Is_Subprogram_Descriptor -- Present in N_Object_Declaration, and set only for the object -- declaration generated for a subprogram descriptor in fast exception -- mode. See Exp_Ch11 for details of use. -- Is_Task_Allocation_Block -- A flag set in a Block_Statement node to indicate that it is the -- expansion of a task allocator, or the allocator of an object -- containing tasks. Such a block requires a cleanup handler to call -- Expunge_Unactivated_Tasks to complete any tasks that have been -- allocated but not activated when the allocator completes abnormally. -- Is_Task_Body_Procedure -- This flag is set on N_Subprogram_Declaration and N_Subprogram_Body -- nodes which emulate the body of a task unit. -- Is_Task_Master -- A flag set in a Subprogram_Body, Block_Statement, or Task_Body node to -- indicate that the construct is a task master (i.e. has declared tasks -- or declares an access to a task type). -- Is_Write -- Present in variable reference markers. Set when the original variable -- reference constitutes a write of the variable. -- Itype -- Used in N_Itype_Reference node to reference an itype for which it is -- important to ensure that it is defined. See description of this node -- for further details. -- Kill_Range_Check -- Used in an N_Unchecked_Type_Conversion node to indicate that the -- result should not be subjected to range checks. This is used for the -- implementation of Normalize_Scalars. -- Label_Construct -- Used in an N_Implicit_Label_Declaration node. Refers to an N_Label, -- N_Block_Statement or N_Loop_Statement node to which the label -- declaration applies. The field is left empty for the special labels -- generated as part of expanding raise statements with a local exception -- handler. -- Library_Unit -- In a stub node, Library_Unit points to the compilation unit node of -- the corresponding subunit. -- -- In a with clause node, Library_Unit points to the spec of the with'ed -- unit. -- -- In a compilation unit node, the usage depends on the unit type: -- -- For a library unit body, Library_Unit points to the compilation unit -- node of the corresponding spec, unless it's a subprogram body with -- Acts_As_Spec set, in which case it points to itself. -- -- For a spec, Library_Unit points to the compilation unit node of the -- corresponding body, if present. The body will be present if the spec -- is or contains generics that we needed to instantiate. Similarly, the -- body will be present if we needed it for inlining purposes. Thus, if -- we have a spec/body pair, both of which are present, they point to -- each other via Library_Unit. -- -- For a subunit, Library_Unit points to the compilation unit node of -- the parent body. -- ??? not (always) true, in (at least some, maybe all?) cases it points -- to the corresponding spec for the parent body. -- -- Note that this field is not used to hold the parent pointer for child -- unit (which might in any case need to use it for some other purpose as -- described above). Instead for a child unit, implicit with's are -- generated for all parents. -- Local_Raise_Statements -- This field is present in exception handler nodes. It is set to -- No_Elist in the normal case. If there is at least one raise statement -- which can potentially be handled as a local raise, then this field -- points to a list of raise nodes, which are calls to a routine to raise -- an exception. These are raise nodes which can be optimized into gotos -- if the handler turns out to meet the conditions which permit this -- transformation. Note that this does NOT include instances of the -- N_Raise_xxx_Error nodes since the transformation of these nodes is -- handled by the back end (using the N_Push/N_Pop mechanism). -- Loop_Actions -- A list present in Component_Association nodes in array aggregates. -- Used to collect actions that must be executed within the loop because -- they may need to be evaluated anew each time through. -- Limited_View_Installed -- Present in With_Clauses and in package specifications. If set on -- with_clause, it indicates that this clause has created the current -- limited view of the designated package. On a package specification, it -- indicates that the limited view has already been created because the -- package is mentioned in a limited_with_clause in the closure of the -- unit being compiled. -- Local_Raise_Not_OK -- Present in N_Exception_Handler nodes. Set if the handler contains -- a construct (reraise statement, or call to subprogram in package -- GNAT.Current_Exception) that makes the handler unsuitable as a target -- for a local raise (one that could otherwise be converted to a goto). -- Must_Be_Byte_Aligned -- This flag is present in N_Attribute_Reference nodes. It can be set -- only for the Address and Unrestricted_Access attributes. If set it -- means that the object for which the address/access is given must be on -- a byte (more accurately a storage unit) boundary. If necessary, a copy -- of the object is to be made before taking the address (this copy is in -- the current scope on the stack frame). This is used for certain cases -- of code generated by the expander that passes parameters by address. -- -- The reason the copy is not made by the front end is that the back end -- has more information about type layout and may be able to (but is not -- guaranteed to) prevent making unnecessary copies. -- Must_Not_Freeze -- A flag present in all expression nodes. Normally expressions cause -- freezing as described in the RM. If this flag is set, then this is -- inhibited. This is used by the analyzer and expander to label nodes -- that are created by semantic analysis or expansion and which must not -- cause freezing even though they normally would. This flag is also -- present in an N_Subtype_Indication node, since we also use these in -- calls to Freeze_Expression. -- Next_Entity -- Present in defining identifiers, defining character literals, and -- defining operator symbols (i.e. in all entities). The entities of a -- scope are chained, and this field is used as the forward pointer for -- this list. See Einfo for further details. -- Next_Exit_Statement -- Present in N_Exit_Statement nodes. The exit statements for a loop are -- chained (in reverse order of appearance) from the First_Exit_Statement -- field of the E_Loop entity for the loop. Next_Exit_Statement points to -- the next entry on this chain (Empty = end of list). -- Next_Implicit_With -- Present in N_With_Clause. Part of a chain of with_clauses generated -- in rtsfind to indicate implicit dependencies on predefined units. Used -- to prevent multiple with_clauses for the same unit in a given context. -- A postorder traversal of the tree whose nodes are units and whose -- links are with_clauses defines the order in which CodePeer must -- examine a compiled unit and its full context. This ordering ensures -- that any subprogram call is examined after the subprogram declaration -- has been seen. -- Next_Named_Actual -- Present in parameter association nodes. Set during semantic analysis -- to point to the next named parameter, where parameters are ordered by -- declaration order (as opposed to the actual order in the call, which -- may be different due to named associations). Not that this field -- points to the explicit actual parameter itself, not to the -- N_Parameter_Association node (its parent). -- Next_Pragma -- Present in N_Pragma nodes. Used to create a linked list of pragma -- nodes. Currently used for two purposes: -- -- Create a list of linked Check_Policy pragmas. The head of this list -- is stored in Opt.Check_Policy_List (which has further details). -- -- Used by processing for Pre/Postcondition pragmas to store a list of -- pragmas associated with the spec of a subprogram (see Sem_Prag for -- details). -- -- Used by processing for pragma SPARK_Mode to store multiple pragmas -- the apply to the same construct. These are visible/private mode for -- a package spec and declarative/statement mode for package body. -- Next_Rep_Item -- Present in pragma nodes, attribute definition nodes, enumeration rep -- clauses, record rep clauses, aspect specification and null statement -- nodes. Used to link representation items that apply to an entity. See -- full description of First_Rep_Item field in Einfo for further details. -- Next_Use_Clause -- While use clauses are active during semantic processing, they are -- chained from the scope stack entry, using Next_Use_Clause as a link -- pointer, with Empty marking the end of the list. The head pointer is -- in the scope stack entry (First_Use_Clause). At the end of semantic -- processing (i.e. when Gigi sees the tree, the contents of this field -- is undefined and should not be read). -- No_Ctrl_Actions -- Present in N_Assignment_Statement to indicate that no Finalize nor -- Adjust should take place on this assignment even though the RHS is -- controlled. Also indicates that the primitive _assign should not be -- used for a tagged assignment. This is used in init procs and aggregate -- expansions where the generated assignments are initializations, not -- real assignments. -- No_Elaboration_Check -- NOTE: this flag is relevant only for the legacy ABE mechanism and -- should not be used outside of that context. -- -- Present in N_Function_Call and N_Procedure_Call_Statement. Indicates -- that no elaboration check is needed on the call, because it appears in -- the context of a local Suppress pragma. This is used on calls within -- task bodies, where the actual elaboration checks are applied after -- analysis, when the local scope stack is not present. -- No_Entities_Ref_In_Spec -- Present in N_With_Clause nodes. Set if the with clause is on the -- package or subprogram spec where the main unit is the corresponding -- body, and no entities of the with'ed unit are referenced by the spec -- (an entity may still be referenced in the body, so this flag is used -- to generate the proper message (see Sem_Util.Check_Unused_Withs for -- full details). -- No_Initialization -- Present in N_Object_Declaration and N_Allocator to indicate that the -- object must not be initialized (by Initialize or call to an init -- proc). This is needed for controlled aggregates. When the Object -- declaration has an expression, this flag means that this expression -- should not be taken into account (needed for in place initialization -- with aggregates, and for object with an address clause, which are -- initialized with an assignment at freeze time). -- No_Minimize_Eliminate -- This flag is present in membership operator nodes (N_In/N_Not_In). -- It is used to indicate that processing for extended overflow checking -- modes is not required (this is used to prevent infinite recursion). -- No_Side_Effect_Removal -- Present in N_Function_Call nodes. Set when a function call does not -- require side effect removal. This attribute suppresses the generation -- of a temporary to capture the result of the function which eventually -- replaces the function call. -- No_Truncation -- Present in N_Unchecked_Type_Conversion node. This flag has an effect -- only if the RM_Size of the source is greater than the RM_Size of the -- target for scalar operands. Normally in such a case we truncate some -- higher order bits of the source, and then sign/zero extend the result -- to form the output value. But if this flag is set, then we do not do -- any truncation, so for example, if an 8 bit input is converted to 5 -- bit result which is in fact stored in 8 bits, then the high order -- three bits of the target result will be copied from the source. This -- is used for properly setting out of range values for use by pragmas -- Initialize_Scalars and Normalize_Scalars. -- Null_Excluding_Subtype -- Present in N_Access_To_Object_Definition. Indicates that the subtype -- indication carries a null-exclusion indicator, which is distinct from -- the null-exclusion indicator that may precede the access keyword. -- Original_Discriminant -- Present in identifiers. Used in references to discriminants that -- appear in generic units. Because the names of the discriminants may be -- different in an instance, we use this field to recover the position of -- the discriminant in the original type, and replace it with the -- discriminant at the same position in the instantiated type. -- Original_Entity -- Present in numeric literals. Used to denote the named number that has -- been constant-folded into the given literal. If literal is from -- source, or the result of some other constant-folding operation, then -- Original_Entity is empty. This field is needed to handle properly -- named numbers in generic units, where the Associated_Node field -- interferes with the Entity field, making it impossible to preserve the -- original entity at the point of instantiation. -- Others_Discrete_Choices -- When a case statement or variant is analyzed, the semantic checks -- determine the actual list of choices that correspond to an others -- choice. This list is materialized for later use by the expander and -- the Others_Discrete_Choices field of an N_Others_Choice node points to -- this materialized list of choices, which is in standard format for a -- list of discrete choices, except that of course it cannot contain an -- N_Others_Choice entry. -- Parent_Spec -- For a library unit that is a child unit spec (package or subprogram -- declaration, generic declaration or instantiation, or library level -- rename) this field points to the compilation unit node for the parent -- package specification. This field is Empty for library bodies (the -- parent spec in this case can be found from the corresponding spec). -- Parent_With -- Present in N_With_Clause nodes. The flag indicates that the clause -- was generated for an ancestor unit to provide proper visibility. A -- with clause for child unit A.B.C produces two implicit parent with -- clauses for A and A.B. -- Premature_Use -- Present in N_Incomplete_Type_Declaration node. Used for improved -- error diagnostics: if there is a premature usage of an incomplete -- type, a subsequently generated error message indicates the position -- of its full declaration. -- Present_Expr -- Present in an N_Variant node. This has a meaningful value only after -- Gigi has back annotated the tree with representation information. At -- this point, it contains a reference to a gcc expression that depends -- on the values of one or more discriminants. Given a set of -- discriminant values, this expression evaluates to False (zero) if -- variant is not present, and True (non-zero) if it is present. See -- unit Repinfo for further details on gigi back annotation. This field -- is used during back-annotation processing (for -gnatR -gnatc) to -- determine if a field is present or not. -- Prev_Use_Clause -- Present in both N_Use_Package_Clause and N_Use_Type_Clause. Used in -- detection of ineffective use clauses by allowing a chain of related -- clauses together to avoid traversing the current scope stack. -- Print_In_Hex -- Set on an N_Integer_Literal node to indicate that the value should be -- printed in hexadecimal in the sprint listing. Has no effect on -- legality or semantics of program, only on the displayed output. This -- is used to clarify output from the packed array cases. -- Procedure_To_Call -- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement, -- and N_Extended_Return_Statement nodes. References the entity for the -- declaration of the procedure to be called to accomplish the required -- operation (i.e. for the Allocate procedure in the case of N_Allocator -- and N_Simple_Return_Statement and N_Extended_Return_Statement (for -- allocating the return value), and for the Deallocate procedure in the -- case of N_Free_Statement. -- Raises_Constraint_Error -- Set on an expression whose evaluation will definitely fail constraint -- error check. See Sem_Eval for details. -- Redundant_Use -- Present in nodes that can appear as an operand in a use clause or use -- type clause (identifiers, expanded names, attribute references). Set -- to indicate that a use is redundant (and therefore need not be undone -- on scope exit). -- Renaming_Exception -- Present in N_Exception_Declaration node. Used to point back to the -- exception renaming for an exception declared within a subprogram. -- What happens is that an exception declared in a subprogram is moved -- to the library level with a unique name, and the original exception -- becomes a renaming. This link from the library level exception to the -- renaming declaration allows registering of the proper exception name. -- Return_Statement_Entity -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement. -- Points to an E_Return_Statement representing the return statement. -- Return_Object_Declarations -- Present in N_Extended_Return_Statement. Points to a list initially -- containing a single N_Object_Declaration representing the return -- object. We use a list (instead of just a pointer to the object decl) -- because Analyze wants to insert extra actions on this list, before the -- N_Object_Declaration, which always remains last on the list. -- Rounded_Result -- Present in N_Type_Conversion, N_Op_Divide, and N_Op_Multiply nodes. -- Used in the fixed-point cases to indicate that the result must be -- rounded as a result of the use of the 'Round attribute. Also used for -- integer N_Op_Divide nodes to indicate that the result should be -- rounded to the nearest integer (breaking ties away from zero), rather -- than truncated towards zero as usual. These rounded integer operations -- are the result of expansion of rounded fixed-point divide, conversion -- and multiplication operations. -- Save_Invocation_Graph_Of_Body -- Present in compilation unit nodes. Set when the elaboration mechanism -- must record all invocation constructs and invocation relations within -- the body of the compilation unit. -- -- SCIL_Entity -- Present in SCIL nodes. References the specific tagged type associated -- with the SCIL node (for an N_SCIL_Dispatching_Call node, this is -- the controlling type of the call; for an N_SCIL_Membership_Test node -- generated as part of testing membership in T'Class, this is T; for an -- N_SCIL_Dispatch_Table_Tag_Init node, this is the type being declared). -- SCIL_Controlling_Tag -- Present in N_SCIL_Dispatching_Call nodes. References the controlling -- tag of a dispatching call. This is usually an N_Selected_Component -- node (for a _tag component), but may be an N_Object_Declaration or -- N_Parameter_Specification node in some cases (e.g., for a call to -- a classwide streaming operation or a call to an instance of -- Ada.Tags.Generic_Dispatching_Constructor). -- SCIL_Tag_Value -- Present in N_SCIL_Membership_Test nodes. Used to reference the tag -- of the value that is being tested. -- SCIL_Target_Prim -- Present in N_SCIL_Dispatching_Call nodes. References the primitive -- operation named (statically) in a dispatching call. -- Scope -- Present in defining identifiers, defining character literals, and -- defining operator symbols (i.e. in all entities). The entities of a -- scope all use this field to reference the corresponding scope entity. -- See Einfo for further details. -- Shift_Count_OK -- A flag present in shift nodes to indicate that the shift count is -- known to be in range, i.e. is in the range from zero to word length -- minus one. If this flag is not set, then the shift count may be -- outside this range, i.e. larger than the word length, and the code -- must ensure that such shift counts give the appropriate result. -- Source_Type -- Used in an N_Validate_Unchecked_Conversion node to point to the -- source type entity for the unchecked conversion instantiation -- which gigi must do size validation for. -- Split_PPC -- When a Pre or Post aspect specification is processed, it is broken -- into AND THEN sections. The leftmost section has Split_PPC set to -- False, indicating that it is the original specification (e.g. for -- posting errors). For other sections, Split_PPC is set to True. -- This flag is set in both the N_Aspect_Specification node itself, -- and in the pragma which is generated from this node. -- Storage_Pool -- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement, -- and N_Extended_Return_Statement nodes. References the entity for the -- storage pool to be used for the allocate or free call or for the -- allocation of the returned value from function. Empty indicates that -- the global default pool is to be used. Note that in the case -- of a return statement, this field is set only if the function returns -- value of a type whose size is not known at compile time on the -- secondary stack. -- Suppress_Assignment_Checks -- Used in generated N_Assignment_Statement nodes to suppress predicate -- and range checks in cases where the generated code knows that the -- value being assigned is in range and satisfies any predicate. Also -- can be set in N_Object_Declaration nodes, to similarly suppress any -- checks on the initializing value. In assignment statements it also -- suppresses access checks in the generated code for out- and in-out -- parameters in entry calls. -- Suppress_Loop_Warnings -- Used in N_Loop_Statement node to indicate that warnings within the -- body of the loop should be suppressed. This is set when the range -- of a FOR loop is known to be null, or is probably null (loop would -- only execute if invalid values are present). -- Target -- Present in call and variable reference marker nodes. References the -- entity of the original entity, operator, or subprogram being invoked, -- or the original variable being read or written. -- Target_Type -- Used in an N_Validate_Unchecked_Conversion node to point to the target -- type entity for the unchecked conversion instantiation which gigi must -- do size validation for. -- Then_Actions -- This field is present in if expression nodes. During code expansion -- we use the Insert_Actions procedure (in Exp_Util) to insert actions -- at an appropriate place in the tree to get elaborated at the right -- time. For if expressions, we have to be sure that the actions for -- for the Then branch are only elaborated if the condition is True. -- The Then_Actions field is used as a temporary parking place for -- these actions. The final tree is always rewritten to eliminate the -- need for this field, so in the tree passed to Gigi, this field is -- always set to No_List. -- TSS_Elist -- Present in N_Freeze_Entity nodes. Holds an element list containing -- entries for each TSS (type support subprogram) associated with the -- frozen type. The elements of the list are the entities for the -- subprograms (see package Exp_TSS for further details). Set to No_Elist -- if there are no type support subprograms for the type or if the freeze -- node is not for a type. -- Uneval_Old_Accept -- Present in N_Pragma nodes. Set True if Opt.Uneval_Old is set to 'A' -- (accept) at the point where the pragma is encountered (including the -- case of a pragma generated from an aspect specification). It is this -- setting that is relevant, rather than the setting at the point where -- a contract is finally analyzed after the delay till the freeze point. -- Uneval_Old_Warn -- Present in N_Pragma nodes. Set True if Opt.Uneval_Old is set to 'W' -- (warn) at the point where the pragma is encountered (including the -- case of a pragma generated from an aspect specification). It is this -- setting that is relevant, rather than the setting at the point where -- a contract is finally analyzed after the delay till the freeze point. -- Unreferenced_In_Spec -- Present in N_With_Clause nodes. Set if the with clause is on the -- package or subprogram spec where the main unit is the corresponding -- body, and is not referenced by the spec (it may still be referenced by -- the body, so this flag is used to generate the proper message (see -- Sem_Util.Check_Unused_Withs for details) -- Uninitialized_Variable -- Present in N_Formal_Private_Type_Definition and in N_Private_ -- Extension_Declarations. Indicates that a variable in a generic unit -- whose type is a formal private or derived type is read without being -- initialized. Used to warn if the corresponding actual type is not -- a fully initialized type. -- Used_Operations -- Present in N_Use_Type_Clause nodes. Holds the list of operations that -- are made potentially use-visible by the clause. Simplifies processing -- on exit from the scope of the use_type_clause, in particular in the -- case of Use_All_Type, when those operations several scopes. -- Was_Attribute_Reference -- Present in N_Subprogram_Body. Set to True if the original source is an -- attribute reference which is an actual in a generic instantiation. The -- instantiation prologue renames these attributes, and expansion later -- converts them into subprogram bodies. -- Was_Expression_Function -- Present in N_Subprogram_Body. True if the original source had an -- N_Expression_Function, which was converted to the N_Subprogram_Body -- by Analyze_Expression_Function. -- Was_Originally_Stub -- This flag is set in the node for a proper body that replaces stub. -- During the analysis procedure, stubs in some situations get rewritten -- by the corresponding bodies, and we set this flag to remember that -- this happened. Note that it is not good enough to rely on the use of -- Original_Node here because of the case of nested instantiations where -- the substituted node can be copied. -------------------------------------------------- -- Note on Use of End_Label and End_Span Fields -- -------------------------------------------------- -- Several constructs have end lines: -- Loop Statement end loop [loop_IDENTIFIER]; -- Package Specification end [[PARENT_UNIT_NAME .] IDENTIFIER] -- Task Definition end [task_IDENTIFIER] -- Protected Definition end [protected_IDENTIFIER] -- Protected Body end [protected_IDENTIFIER] -- Block Statement end [block_IDENTIFIER]; -- Subprogram Body end [DESIGNATOR]; -- Package Body end [[PARENT_UNIT_NAME .] IDENTIFIER]; -- Task Body end [task_IDENTIFIER]; -- Accept Statement end [entry_IDENTIFIER]]; -- Entry Body end [entry_IDENTIFIER]; -- If Statement end if; -- Case Statement end case; -- Record Definition end record; -- Enumeration Definition ); -- The End_Label and End_Span fields are used to mark the locations of -- these lines, and also keep track of the label in the case where a label -- is present. -- For the first group above, the End_Label field of the corresponding node -- is used to point to the label identifier. In the case where there is no -- label in the source, the parser supplies a dummy identifier (with -- Comes_From_Source set to False), and the Sloc of this dummy identifier -- marks the location of the token following the END token. -- For the second group, the use of End_Label is similar, but the End_Label -- is found in the N_Handled_Sequence_Of_Statements node. This is done -- simply because in some cases there is no room in the parent node. -- For the third group, there is never any label, and instead of using -- End_Label, we use the End_Span field which gives the location of the -- token following END, relative to the starting Sloc of the construct, -- i.e. add Sloc (Node) + End_Span (Node) to get the Sloc of the IF or CASE -- following the End_Label. -- The record definition case is handled specially, we treat it as though -- it required an optional label which is never present, and so the parser -- always builds a dummy identifier with Comes From Source set False. The -- reason we do this, rather than using End_Span in this case, is that we -- want to generate a cross-ref entry for the end of a record, since it -- represents a scope for name declaration purposes. -- The enumeration definition case is handled in an exactly similar manner, -- building a dummy identifier to get a cross-reference. -- Note: the reason we store the difference as a Uint, instead of storing -- the Source_Ptr value directly, is that Source_Ptr values cannot be -- distinguished from other types of values, and we count on all general -- use fields being self describing. To make things easier for clients, -- note that we provide function End_Location, and procedure -- Set_End_Location to allow access to the logical value (which is the -- Source_Ptr value for the end token). --------------------- -- Syntactic Nodes -- --------------------- --------------------- -- 2.3 Identifier -- --------------------- -- IDENTIFIER ::= IDENTIFIER_LETTER {[UNDERLINE] LETTER_OR_DIGIT} -- LETTER_OR_DIGIT ::= IDENTIFIER_LETTER | DIGIT -- An IDENTIFIER shall not be a reserved word -- In the Ada grammar identifiers are the bottom level tokens which have -- very few semantics. Actual program identifiers are direct names. If -- we were being 100% honest with the grammar, then we would have a node -- called N_Direct_Name which would point to an identifier. However, -- that's too many extra nodes, so we just use the N_Identifier node -- directly as a direct name, and it contains the expression fields and -- Entity field that correspond to its use as a direct name. In those -- few cases where identifiers appear in contexts where they are not -- direct names (pragmas, pragma argument associations, attribute -- references and attribute definition clauses), the Chars field of the -- node contains the Name_Id for the identifier name. -- Note: in GNAT, a reserved word can be treated as an identifier in two -- cases. First, an incorrect use of a reserved word as an identifier is -- diagnosed and then treated as a normal identifier. Second, an -- attribute designator of the form of a reserved word (access, delta, -- digits, range) is treated as an identifier. -- Note: The set of letters that is permitted in an identifier depends -- on the character set in use. See package Csets for full details. -- N_Identifier -- Sloc points to identifier -- Chars contains the Name_Id for the identifier -- Entity -- Associated_Node -- Original_Discriminant -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Has_Private_View (set in generic units) -- Redundant_Use -- Atomic_Sync_Required -- plus fields for expression -------------------------- -- 2.4 Numeric Literal -- -------------------------- -- NUMERIC_LITERAL ::= DECIMAL_LITERAL | BASED_LITERAL ---------------------------- -- 2.4.1 Decimal Literal -- ---------------------------- -- DECIMAL_LITERAL ::= NUMERAL [.NUMERAL] [EXPONENT] -- NUMERAL ::= DIGIT {[UNDERLINE] DIGIT} -- EXPONENT ::= E [+] NUMERAL | E - NUMERAL -- Decimal literals appear in the tree as either integer literal nodes -- or real literal nodes, depending on whether a period is present. -- Note: literal nodes appear as a result of direct use of literals -- in the source program, and also as the result of evaluating -- expressions at compile time. In the latter case, it is possible -- to construct real literals that have no syntactic representation -- using the standard literal format. Such literals are listed by -- Sprint using the notation [numerator / denominator]. -- Note: the value of an integer literal node created by the front end -- is never outside the range of values of the base type. However, it -- can be the case that the created value is outside the range of the -- particular subtype. This happens in the case of integer overflows -- with checks suppressed. -- N_Integer_Literal -- Sloc points to literal -- Original_Entity If not Empty, holds Named_Number that -- has been constant-folded into its literal value. -- Intval contains integer value of literal -- Print_In_Hex -- plus fields for expression -- N_Real_Literal -- Sloc points to literal -- Original_Entity If not Empty, holds Named_Number that -- has been constant-folded into its literal value. -- Realval contains real value of literal -- Corresponding_Integer_Value -- Is_Machine_Number -- plus fields for expression -------------------------- -- 2.4.2 Based Literal -- -------------------------- -- BASED_LITERAL ::= -- BASE # BASED_NUMERAL [.BASED_NUMERAL] # [EXPONENT] -- BASE ::= NUMERAL -- BASED_NUMERAL ::= -- EXTENDED_DIGIT {[UNDERLINE] EXTENDED_DIGIT} -- EXTENDED_DIGIT ::= DIGIT | A | B | C | D | E | F -- Based literals appear in the tree as either integer literal nodes -- or real literal nodes, depending on whether a period is present. ---------------------------- -- 2.5 Character Literal -- ---------------------------- -- CHARACTER_LITERAL ::= ' GRAPHIC_CHARACTER ' -- N_Character_Literal -- Sloc points to literal -- Chars contains the Name_Id for the identifier -- Char_Literal_Value contains the literal value -- Entity -- Associated_Node -- Has_Private_View (set in generic units) -- plus fields for expression -- Note: the Entity field will be missing (set to Empty) for character -- literals whose type is Standard.Wide_Character or Standard.Character -- or a type derived from one of these two. In this case the character -- literal stands for its own coding. The reason we take this irregular -- short cut is to avoid the need to build lots of junk defining -- character literal nodes. ------------------------- -- 2.6 String Literal -- ------------------------- -- STRING LITERAL ::= "{STRING_ELEMENT}" -- A STRING_ELEMENT is either a pair of quotation marks ("), or a -- single GRAPHIC_CHARACTER other than a quotation mark. -- -- Is_Folded_In_Parser is True if the parser created this literal by -- folding a sequence of "&" operators. For example, if the source code -- says "aaa" & "bbb" & "ccc", and this produces "aaabbbccc", the flag -- is set. This flag is needed because the parser doesn't know about -- visibility, so the folded result might be wrong, and semantic -- analysis needs to check for that. -- N_String_Literal -- Sloc points to literal -- Strval contains Id of string value -- Has_Wide_Character -- Has_Wide_Wide_Character -- Is_Folded_In_Parser -- plus fields for expression ------------------ -- 2.7 Comment -- ------------------ -- A COMMENT starts with two adjacent hyphens and extends up to the -- end of the line. A COMMENT may appear on any line of a program. -- Comments are skipped by the scanner and do not appear in the tree. -- It is possible to reconstruct the position of comments with respect -- to the elements of the tree by using the source position (Sloc) -- pointers that appear in every tree node. ----------------- -- 2.8 Pragma -- ----------------- -- PRAGMA ::= pragma IDENTIFIER -- [(PRAGMA_ARGUMENT_ASSOCIATION {, PRAGMA_ARGUMENT_ASSOCIATION})]; -- Note that a pragma may appear in the tree anywhere a declaration -- or a statement may appear, as well as in some other situations -- which are explicitly documented. -- N_Pragma -- Sloc points to PRAGMA -- Next_Pragma -- Pragma_Argument_Associations (set to No_List if none) -- Corresponding_Aspect (set to Empty if not present) -- Pragma_Identifier -- Next_Rep_Item -- Is_Generic_Contract_Pragma -- Is_Checked_Ghost_Pragma -- Is_Inherited_Pragma -- Is_Analyzed_Pragma -- Class_Present set if from Aspect with 'Class -- Uneval_Old_Accept -- Is_Ignored_Ghost_Pragma -- Is_Ignored -- Is_Checked -- From_Aspect_Specification -- Is_Delayed_Aspect -- Is_Disabled -- Import_Interface_Present -- Split_PPC set if corresponding aspect had Split_PPC set -- Uneval_Old_Warn -- Note: we should have a section on what pragmas are passed on to -- the back end to be processed. This section should note that pragma -- Psect_Object is always converted to Common_Object, but there are -- undoubtedly many other similar notes required ??? -- Note: utility functions Pragma_Name_Unmapped and Pragma_Name may be -- applied to pragma nodes to obtain the Chars or its mapped version. -- Note: if From_Aspect_Specification is set, then Sloc points to the -- aspect name, as does the Pragma_Identifier. In this case if the -- pragma has a local name argument (such as pragma Inline), it is -- resolved to point to the specific entity affected by the pragma. -------------------------------------- -- 2.8 Pragma Argument Association -- -------------------------------------- -- PRAGMA_ARGUMENT_ASSOCIATION ::= -- [pragma_argument_IDENTIFIER =>] NAME -- | [pragma_argument_IDENTIFIER =>] EXPRESSION -- In Ada 2012, there are two more possibilities: -- PRAGMA_ARGUMENT_ASSOCIATION ::= -- [pragma_argument_ASPECT_MARK =>] NAME -- | [pragma_argument_ASPECT_MARK =>] EXPRESSION -- where the interesting allowed cases (which do not fit the syntax of -- the first alternative above) are -- ASPECT_MARK => Pre'Class | -- Post'Class | -- Type_Invariant'Class | -- Invariant'Class -- We allow this special usage in all Ada modes, but it would be a -- pain to allow these aspects to pervade the pragma syntax, and the -- representation of pragma nodes internally. So what we do is to -- replace these ASPECT_MARK forms with identifiers whose name is one -- of the special internal names _Pre, _Post, or _Type_Invariant. -- We do a similar replacement of these Aspect_Mark forms in the -- Expression of a pragma argument association for the cases of -- the first arguments of any Check pragmas and Check_Policy pragmas -- N_Pragma_Argument_Association -- Sloc points to first token in association -- Chars (set to No_Name if no pragma argument identifier) -- Expression_Copy -- Expression ------------------------ -- 2.9 Reserved Word -- ------------------------ -- Reserved words are parsed by the scanner, and returned as the -- corresponding token types (e.g. PACKAGE is returned as Tok_Package) ---------------------------- -- 3.1 Basic Declaration -- ---------------------------- -- BASIC_DECLARATION ::= -- TYPE_DECLARATION | SUBTYPE_DECLARATION -- | OBJECT_DECLARATION | NUMBER_DECLARATION -- | SUBPROGRAM_DECLARATION | ABSTRACT_SUBPROGRAM_DECLARATION -- | PACKAGE_DECLARATION | RENAMING_DECLARATION -- | EXCEPTION_DECLARATION | GENERIC_DECLARATION -- | GENERIC_INSTANTIATION -- Basic declaration also includes IMPLICIT_LABEL_DECLARATION -- see further description in section on semantic nodes. -- Also, in the tree that is constructed, a pragma may appear -- anywhere that a declaration may appear. ------------------------------ -- 3.1 Defining Identifier -- ------------------------------ -- DEFINING_IDENTIFIER ::= IDENTIFIER -- A defining identifier is an entity, which has additional fields -- depending on the setting of the Ekind field. These additional -- fields are defined (and access subprograms declared) in package -- Einfo. -- Note: N_Defining_Identifier is an extended node whose fields are -- deliberately laid out to match the layout of fields in an ordinary -- N_Identifier node allowing for easy alteration of an identifier -- node into a defining identifier node. For details, see procedure -- Sinfo.CN.Change_Identifier_To_Defining_Identifier. -- N_Defining_Identifier -- Sloc points to identifier -- Chars contains the Name_Id for the identifier -- Next_Entity -- Scope -- Etype ----------------------------- -- 3.2.1 Type Declaration -- ----------------------------- -- TYPE_DECLARATION ::= -- FULL_TYPE_DECLARATION -- | INCOMPLETE_TYPE_DECLARATION -- | PRIVATE_TYPE_DECLARATION -- | PRIVATE_EXTENSION_DECLARATION ---------------------------------- -- 3.2.1 Full Type Declaration -- ---------------------------------- -- FULL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] -- is TYPE_DEFINITION -- [ASPECT_SPECIFICATIONS]; -- | TASK_TYPE_DECLARATION -- | PROTECTED_TYPE_DECLARATION -- The full type declaration node is used only for the first case. The -- second case (concurrent type declaration), is represented directly -- by a task type declaration or a protected type declaration. -- N_Full_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier -- Incomplete_View -- Discriminant_Specifications (set to No_List if none) -- Type_Definition -- Discr_Check_Funcs_Built ---------------------------- -- 3.2.1 Type Definition -- ---------------------------- -- TYPE_DEFINITION ::= -- ENUMERATION_TYPE_DEFINITION | INTEGER_TYPE_DEFINITION -- | REAL_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION -- | RECORD_TYPE_DEFINITION | ACCESS_TYPE_DEFINITION -- | DERIVED_TYPE_DEFINITION | INTERFACE_TYPE_DEFINITION -------------------------------- -- 3.2.2 Subtype Declaration -- -------------------------------- -- SUBTYPE_DECLARATION ::= -- subtype DEFINING_IDENTIFIER is [NULL_EXCLUSION] SUBTYPE_INDICATION -- [ASPECT_SPECIFICATIONS]; -- The subtype indication field is set to Empty for subtypes -- declared in package Standard (Positive, Natural). -- N_Subtype_Declaration -- Sloc points to SUBTYPE -- Defining_Identifier -- Null_Exclusion_Present -- Subtype_Indication -- Generic_Parent_Type (set for an actual derived type). -- Exception_Junk ------------------------------- -- 3.2.2 Subtype Indication -- ------------------------------- -- SUBTYPE_INDICATION ::= SUBTYPE_MARK [CONSTRAINT] -- Note: if no constraint is present, the subtype indication appears -- directly in the tree as a subtype mark. The N_Subtype_Indication -- node is used only if a constraint is present. -- Note: [For Ada 2005 (AI-231)]: Because Ada 2005 extends this rule -- with the null-exclusion part (see AI-231), we had to introduce a new -- attribute in all the parents of subtype_indication nodes to indicate -- if the null-exclusion is present. -- Note: the reason that this node has expression fields is that a -- subtype indication can appear as an operand of a membership test. -- N_Subtype_Indication -- Sloc points to first token of subtype mark -- Subtype_Mark -- Constraint -- Etype -- Must_Not_Freeze -- Note: Depending on context, the Etype is either the entity of the -- Subtype_Mark field, or it is an itype constructed to reify the -- subtype indication. In particular, such itypes are created for a -- subtype indication that appears in an array type declaration. This -- simplifies constraint checking in indexed components. -- For subtype indications that appear in scalar type and subtype -- declarations, the Etype is the entity of the subtype mark. ------------------------- -- 3.2.2 Subtype Mark -- ------------------------- -- SUBTYPE_MARK ::= subtype_NAME ----------------------- -- 3.2.2 Constraint -- ----------------------- -- CONSTRAINT ::= SCALAR_CONSTRAINT | COMPOSITE_CONSTRAINT ------------------------------ -- 3.2.2 Scalar Constraint -- ------------------------------ -- SCALAR_CONSTRAINT ::= -- RANGE_CONSTRAINT | DIGITS_CONSTRAINT | DELTA_CONSTRAINT --------------------------------- -- 3.2.2 Composite Constraint -- --------------------------------- -- COMPOSITE_CONSTRAINT ::= -- INDEX_CONSTRAINT | DISCRIMINANT_CONSTRAINT ------------------------------- -- 3.3.1 Object Declaration -- ------------------------------- -- OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION] -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] -- ACCESS_DEFINITION [:= EXPRESSION] -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] -- ARRAY_TYPE_DEFINITION [:= EXPRESSION] -- [ASPECT_SPECIFICATIONS]; -- | SINGLE_TASK_DECLARATION -- | SINGLE_PROTECTED_DECLARATION -- Note: aliased is not permitted in Ada 83 mode -- The N_Object_Declaration node is only for the first three cases. -- Single task declaration is handled by P_Task (9.1) -- Single protected declaration is handled by P_protected (9.5) -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single declarations, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- The flag Has_Init_Expression is set if an initializing expression -- is present. Normally it is set if and only if Expression contains -- a non-empty value, but there is an exception to this. When the -- initializing expression is an aggregate which requires explicit -- assignments, the Expression field gets set to Empty, but this flag -- is still set, so we don't forget we had an initializing expression. -- Note: if a range check is required for the initialization -- expression then the Do_Range_Check flag is set in the Expression, -- with the check being done against the type given by the object -- definition, which is also the Etype of the defining identifier. -- Note: the contents of the Expression field must be ignored (i.e. -- treated as though it were Empty) if No_Initialization is set True. -- Note: the back end places some restrictions on the form of the -- Expression field. If the object being declared is Atomic, then -- the Expression may not have the form of an aggregate (since this -- might cause the back end to generate separate assignments). In this -- case the front end must generate an extra temporary and initialize -- this temporary as required (the temporary itself is not atomic). -- Note: there is no node kind for object definition. Instead, the -- corresponding field holds a subtype indication, an array type -- definition, or (Ada 2005, AI-406) an access definition. -- N_Object_Declaration -- Sloc points to first identifier -- Defining_Identifier -- Aliased_Present -- Constant_Present set if CONSTANT appears -- Null_Exclusion_Present -- Object_Definition subtype indic./array type def./access def. -- Expression (set to Empty if not present) -- Handler_List_Entry -- Corresponding_Generic_Association -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) -- No_Initialization -- Assignment_OK -- Exception_Junk -- Is_Subprogram_Descriptor -- Has_Init_Expression -- Suppress_Assignment_Checks ------------------------------------- -- 3.3.1 Defining Identifier List -- ------------------------------------- -- DEFINING_IDENTIFIER_LIST ::= -- DEFINING_IDENTIFIER {, DEFINING_IDENTIFIER} ------------------------------- -- 3.3.2 Number Declaration -- ------------------------------- -- NUMBER_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : constant := static_EXPRESSION; -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with -- identical expressions. To simplify semantic processing, the parser -- represents a multiple declaration case as a sequence of single -- declarations, using the More_Ids and Prev_Ids flags to preserve -- the original source form as described in the section on "Handling -- of Defining Identifier Lists". -- N_Number_Declaration -- Sloc points to first identifier -- Defining_Identifier -- Expression -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) ---------------------------------- -- 3.4 Derived Type Definition -- ---------------------------------- -- DERIVED_TYPE_DEFINITION ::= -- [abstract] [limited] new [NULL_EXCLUSION] parent_SUBTYPE_INDICATION -- [[and INTERFACE_LIST] RECORD_EXTENSION_PART] -- Note: ABSTRACT, LIMITED, and record extension part are not permitted -- in Ada 83 mode. -- Note: a record extension part is required if ABSTRACT is present -- N_Derived_Type_Definition -- Sloc points to NEW -- Abstract_Present -- Null_Exclusion_Present (set to False if not present) -- Subtype_Indication -- Record_Extension_Part (set to Empty if not present) -- Limited_Present -- Task_Present set in task interfaces -- Protected_Present set in protected interfaces -- Synchronized_Present set in interfaces -- Interface_List (set to No_List if none) -- Interface_Present set in abstract interfaces -- Note: Task_Present, Protected_Present, Synchronized_Present, -- Interface_List, and Interface_Present are used for abstract -- interfaces (see comments for INTERFACE_TYPE_DEFINITION). --------------------------- -- 3.5 Range Constraint -- --------------------------- -- RANGE_CONSTRAINT ::= range RANGE -- N_Range_Constraint -- Sloc points to RANGE -- Range_Expression ---------------- -- 3.5 Range -- ---------------- -- RANGE ::= -- RANGE_ATTRIBUTE_REFERENCE -- | SIMPLE_EXPRESSION .. SIMPLE_EXPRESSION -- Note: the case of a range given as a range attribute reference -- appears directly in the tree as an attribute reference. -- Note: the field name for a reference to a range is Range_Expression -- rather than Range, because range is a reserved keyword in Ada. -- Note: the reason that this node has expression fields is that a -- range can appear as an operand of a membership test. The Etype -- field is the type of the range (we do NOT construct an implicit -- subtype to represent the range exactly). -- N_Range -- Sloc points to .. -- Low_Bound -- High_Bound -- Includes_Infinities -- plus fields for expression -- Note: if the range appears in a context, such as a subtype -- declaration, where range checks are required on one or both of -- the expression fields, then type conversion nodes are inserted -- to represent the required checks. ---------------------------------------- -- 3.5.1 Enumeration Type Definition -- ---------------------------------------- -- ENUMERATION_TYPE_DEFINITION ::= -- (ENUMERATION_LITERAL_SPECIFICATION -- {, ENUMERATION_LITERAL_SPECIFICATION}) -- Note: the Literals field in the node described below is null for -- the case of the standard types CHARACTER and WIDE_CHARACTER, for -- which special processing handles these types as special cases. -- N_Enumeration_Type_Definition -- Sloc points to left parenthesis -- Literals (Empty for CHARACTER or WIDE_CHARACTER) -- End_Label (set to Empty if internally generated record) ---------------------------------------------- -- 3.5.1 Enumeration Literal Specification -- ---------------------------------------------- -- ENUMERATION_LITERAL_SPECIFICATION ::= -- DEFINING_IDENTIFIER | DEFINING_CHARACTER_LITERAL --------------------------------------- -- 3.5.1 Defining Character Literal -- --------------------------------------- -- DEFINING_CHARACTER_LITERAL ::= CHARACTER_LITERAL -- A defining character literal is an entity, which has additional -- fields depending on the setting of the Ekind field. These -- additional fields are defined (and access subprograms declared) -- in package Einfo. -- Note: N_Defining_Character_Literal is an extended node whose fields -- are deliberately laid out to match layout of fields in an ordinary -- N_Character_Literal node, allowing for easy alteration of a character -- literal node into a defining character literal node. For details, see -- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal. -- N_Defining_Character_Literal -- Sloc points to literal -- Chars contains the Name_Id for the identifier -- Next_Entity -- Scope -- Etype ------------------------------------ -- 3.5.4 Integer Type Definition -- ------------------------------------ -- Note: there is an error in this rule in the latest version of the -- grammar, so we have retained the old rule pending clarification. -- INTEGER_TYPE_DEFINITION ::= -- SIGNED_INTEGER_TYPE_DEFINITION -- | MODULAR_TYPE_DEFINITION ------------------------------------------- -- 3.5.4 Signed Integer Type Definition -- ------------------------------------------- -- SIGNED_INTEGER_TYPE_DEFINITION ::= -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION -- Note: the Low_Bound and High_Bound fields are set to Empty -- for integer types defined in package Standard. -- N_Signed_Integer_Type_Definition -- Sloc points to RANGE -- Low_Bound -- High_Bound ------------------------------------ -- 3.5.4 Modular Type Definition -- ------------------------------------ -- MODULAR_TYPE_DEFINITION ::= mod static_EXPRESSION -- N_Modular_Type_Definition -- Sloc points to MOD -- Expression --------------------------------- -- 3.5.6 Real Type Definition -- --------------------------------- -- REAL_TYPE_DEFINITION ::= -- FLOATING_POINT_DEFINITION | FIXED_POINT_DEFINITION -------------------------------------- -- 3.5.7 Floating Point Definition -- -------------------------------------- -- FLOATING_POINT_DEFINITION ::= -- digits static_SIMPLE_EXPRESSION [REAL_RANGE_SPECIFICATION] -- Note: The Digits_Expression and Real_Range_Specifications fields -- are set to Empty for floating-point types declared in Standard. -- N_Floating_Point_Definition -- Sloc points to DIGITS -- Digits_Expression -- Real_Range_Specification (set to Empty if not present) ------------------------------------- -- 3.5.7 Real Range Specification -- ------------------------------------- -- REAL_RANGE_SPECIFICATION ::= -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION -- N_Real_Range_Specification -- Sloc points to RANGE -- Low_Bound -- High_Bound ----------------------------------- -- 3.5.9 Fixed Point Definition -- ----------------------------------- -- FIXED_POINT_DEFINITION ::= -- ORDINARY_FIXED_POINT_DEFINITION | DECIMAL_FIXED_POINT_DEFINITION -------------------------------------------- -- 3.5.9 Ordinary Fixed Point Definition -- -------------------------------------------- -- ORDINARY_FIXED_POINT_DEFINITION ::= -- delta static_EXPRESSION REAL_RANGE_SPECIFICATION -- Note: In Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION -- N_Ordinary_Fixed_Point_Definition -- Sloc points to DELTA -- Delta_Expression -- Real_Range_Specification ------------------------------------------- -- 3.5.9 Decimal Fixed Point Definition -- ------------------------------------------- -- DECIMAL_FIXED_POINT_DEFINITION ::= -- delta static_EXPRESSION -- digits static_EXPRESSION [REAL_RANGE_SPECIFICATION] -- Note: decimal types are not permitted in Ada 83 mode -- N_Decimal_Fixed_Point_Definition -- Sloc points to DELTA -- Delta_Expression -- Digits_Expression -- Real_Range_Specification (set to Empty if not present) ------------------------------ -- 3.5.9 Digits Constraint -- ------------------------------ -- DIGITS_CONSTRAINT ::= -- digits static_EXPRESSION [RANGE_CONSTRAINT] -- Note: in Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION -- Note: in Ada 95, reduced accuracy subtypes are obsolescent -- N_Digits_Constraint -- Sloc points to DIGITS -- Digits_Expression -- Range_Constraint (set to Empty if not present) -------------------------------- -- 3.6 Array Type Definition -- -------------------------------- -- ARRAY_TYPE_DEFINITION ::= -- UNCONSTRAINED_ARRAY_DEFINITION | CONSTRAINED_ARRAY_DEFINITION ----------------------------------------- -- 3.6 Unconstrained Array Definition -- ----------------------------------------- -- UNCONSTRAINED_ARRAY_DEFINITION ::= -- array (INDEX_SUBTYPE_DEFINITION {, INDEX_SUBTYPE_DEFINITION}) of -- COMPONENT_DEFINITION -- Note: dimensionality of array is indicated by number of entries in -- the Subtype_Marks list, which has one entry for each dimension. -- N_Unconstrained_Array_Definition -- Sloc points to ARRAY -- Subtype_Marks -- Component_Definition ----------------------------------- -- 3.6 Index Subtype Definition -- ----------------------------------- -- INDEX_SUBTYPE_DEFINITION ::= SUBTYPE_MARK range <> -- There is no explicit node in the tree for an index subtype -- definition since the N_Unconstrained_Array_Definition node -- incorporates the type marks which appear in this context. --------------------------------------- -- 3.6 Constrained Array Definition -- --------------------------------------- -- CONSTRAINED_ARRAY_DEFINITION ::= -- array (DISCRETE_SUBTYPE_DEFINITION -- {, DISCRETE_SUBTYPE_DEFINITION}) -- of COMPONENT_DEFINITION -- Note: dimensionality of array is indicated by number of entries -- in the Discrete_Subtype_Definitions list, which has one entry -- for each dimension. -- N_Constrained_Array_Definition -- Sloc points to ARRAY -- Discrete_Subtype_Definitions -- Component_Definition -- Note: although the language allows the full syntax for discrete -- subtype definitions (i.e. a discrete subtype indication or a range), -- in the generated tree, we always rewrite these as N_Range nodes. -------------------------------------- -- 3.6 Discrete Subtype Definition -- -------------------------------------- -- DISCRETE_SUBTYPE_DEFINITION ::= -- discrete_SUBTYPE_INDICATION | RANGE ------------------------------- -- 3.6 Component Definition -- ------------------------------- -- COMPONENT_DEFINITION ::= -- [aliased] [NULL_EXCLUSION] SUBTYPE_INDICATION | ACCESS_DEFINITION -- Note: although the syntax does not permit a component definition to -- be an anonymous array (and the parser will diagnose such an attempt -- with an appropriate message), it is possible for anonymous arrays -- to appear as component definitions. The semantics and back end handle -- this case properly, and the expander in fact generates such cases. -- Access_Definition is an optional field that gives support to -- Ada 2005 (AI-230). The parser generates nodes that have either the -- Subtype_Indication field or else the Access_Definition field. -- N_Component_Definition -- Sloc points to ALIASED, ACCESS, or to first token of subtype mark -- Aliased_Present -- Null_Exclusion_Present -- Subtype_Indication (set to Empty if not present) -- Access_Definition (set to Empty if not present) ----------------------------- -- 3.6.1 Index Constraint -- ----------------------------- -- INDEX_CONSTRAINT ::= (DISCRETE_RANGE {, DISCRETE_RANGE}) -- It is not in general possible to distinguish between discriminant -- constraints and index constraints at parse time, since a simple -- name could be either the subtype mark of a discrete range, or an -- expression in a discriminant association with no name. Either -- entry appears simply as the name, and the semantic parse must -- distinguish between the two cases. Thus we use a common tree -- node format for both of these constraint types. -- See Discriminant_Constraint for format of node --------------------------- -- 3.6.1 Discrete Range -- --------------------------- -- DISCRETE_RANGE ::= discrete_SUBTYPE_INDICATION | RANGE ---------------------------- -- 3.7 Discriminant Part -- ---------------------------- -- DISCRIMINANT_PART ::= -- UNKNOWN_DISCRIMINANT_PART | KNOWN_DISCRIMINANT_PART ------------------------------------ -- 3.7 Unknown Discriminant Part -- ------------------------------------ -- UNKNOWN_DISCRIMINANT_PART ::= (<>) -- Note: unknown discriminant parts are not permitted in Ada 83 mode -- There is no explicit node in the tree for an unknown discriminant -- part. Instead the Unknown_Discriminants_Present flag is set in the -- parent node. ---------------------------------- -- 3.7 Known Discriminant Part -- ---------------------------------- -- KNOWN_DISCRIMINANT_PART ::= -- (DISCRIMINANT_SPECIFICATION {; DISCRIMINANT_SPECIFICATION}) ------------------------------------- -- 3.7 Discriminant Specification -- ------------------------------------- -- DISCRIMINANT_SPECIFICATION ::= -- DEFINING_IDENTIFIER_LIST : [NULL_EXCLUSION] SUBTYPE_MARK -- [:= DEFAULT_EXPRESSION] -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION -- [:= DEFAULT_EXPRESSION] -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive specifications were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single specifications, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Discriminant_Specification -- Sloc points to first identifier -- Defining_Identifier -- Null_Exclusion_Present -- Discriminant_Type subtype mark or access parameter definition -- Expression (set to Empty if no default expression) -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) ----------------------------- -- 3.7 Default Expression -- ----------------------------- -- DEFAULT_EXPRESSION ::= EXPRESSION ------------------------------------ -- 3.7.1 Discriminant Constraint -- ------------------------------------ -- DISCRIMINANT_CONSTRAINT ::= -- (DISCRIMINANT_ASSOCIATION {, DISCRIMINANT_ASSOCIATION}) -- It is not in general possible to distinguish between discriminant -- constraints and index constraints at parse time, since a simple -- name could be either the subtype mark of a discrete range, or an -- expression in a discriminant association with no name. Either -- entry appears simply as the name, and the semantic parse must -- distinguish between the two cases. Thus we use a common tree -- node format for both of these constraint types. -- N_Index_Or_Discriminant_Constraint -- Sloc points to left paren -- Constraints points to list of discrete ranges or -- discriminant associations ------------------------------------- -- 3.7.1 Discriminant Association -- ------------------------------------- -- DISCRIMINANT_ASSOCIATION ::= -- [discriminant_SELECTOR_NAME -- {| discriminant_SELECTOR_NAME} =>] EXPRESSION -- Note: a discriminant association that has no selector name list -- appears directly as an expression in the tree. -- N_Discriminant_Association -- Sloc points to first token of discriminant association -- Selector_Names (always non-empty, since if no selector -- names are present, this node is not used, see comment above) -- Expression --------------------------------- -- 3.8 Record Type Definition -- --------------------------------- -- RECORD_TYPE_DEFINITION ::= -- [[abstract] tagged] [limited] RECORD_DEFINITION -- Note: ABSTRACT, TAGGED, LIMITED are not permitted in Ada 83 mode -- There is no explicit node in the tree for a record type definition. -- Instead the flags for Tagged_Present and Limited_Present appear in -- the N_Record_Definition node for a record definition appearing in -- the context of a record type definition. ---------------------------- -- 3.8 Record Definition -- ---------------------------- -- RECORD_DEFINITION ::= -- record -- COMPONENT_LIST -- end record -- | null record -- Note: the Abstract_Present, Tagged_Present, and Limited_Present -- flags appear only for a record definition appearing in a record -- type definition. -- Note: the NULL RECORD case is not permitted in Ada 83 -- N_Record_Definition -- Sloc points to RECORD or NULL -- End_Label (set to Empty if internally generated record) -- Abstract_Present -- Tagged_Present -- Limited_Present -- Component_List empty in null record case -- Null_Present set in null record case -- Task_Present set in task interfaces -- Protected_Present set in protected interfaces -- Synchronized_Present set in interfaces -- Interface_Present set in abstract interfaces -- Interface_List (set to No_List if none) -- Note: Task_Present, Protected_Present, Synchronized _Present, -- Interface_List and Interface_Present are used for abstract -- interfaces (see comments for INTERFACE_TYPE_DEFINITION). ------------------------- -- 3.8 Component List -- ------------------------- -- COMPONENT_LIST ::= -- COMPONENT_ITEM {COMPONENT_ITEM} -- | {COMPONENT_ITEM} VARIANT_PART -- | null; -- N_Component_List -- Sloc points to first token of component list -- Component_Items -- Variant_Part (set to Empty if no variant part) -- Null_Present ------------------------- -- 3.8 Component Item -- ------------------------- -- COMPONENT_ITEM ::= COMPONENT_DECLARATION | REPRESENTATION_CLAUSE -- Note: A component item can also be a pragma, and in the tree -- that is obtained after semantic processing, a component item -- can be an N_Null node resulting from a non-recognized pragma. -------------------------------- -- 3.8 Component Declaration -- -------------------------------- -- COMPONENT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION -- [:= DEFAULT_EXPRESSION] -- [ASPECT_SPECIFICATIONS]; -- Note: although the syntax does not permit a component definition to -- be an anonymous array (and the parser will diagnose such an attempt -- with an appropriate message), it is possible for anonymous arrays -- to appear as component definitions. The semantics and back end handle -- this case properly, and the expander in fact generates such cases. -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with the -- same component definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single declarations, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Component_Declaration -- Sloc points to first identifier -- Defining_Identifier -- Component_Definition -- Expression (set to Empty if no default expression) -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) ------------------------- -- 3.8.1 Variant Part -- ------------------------- -- VARIANT_PART ::= -- case discriminant_DIRECT_NAME is -- VARIANT {VARIANT} -- end case; -- Note: the variants list can contain pragmas as well as variants. -- In a properly formed program there is at least one variant. -- N_Variant_Part -- Sloc points to CASE -- Name -- Variants -------------------- -- 3.8.1 Variant -- -------------------- -- VARIANT ::= -- when DISCRETE_CHOICE_LIST => -- COMPONENT_LIST -- N_Variant -- Sloc points to WHEN -- Discrete_Choices -- Component_List -- Enclosing_Variant -- Present_Expr -- Dcheck_Function -- Has_SP_Choice -- Note: in the list of Discrete_Choices, the tree passed to the back -- end does not have choice entries corresponding to names of statically -- predicated subtypes. Such entries are always expanded out to the list -- of equivalent values or ranges. --------------------------------- -- 3.8.1 Discrete Choice List -- --------------------------------- -- DISCRETE_CHOICE_LIST ::= DISCRETE_CHOICE {| DISCRETE_CHOICE} ---------------------------- -- 3.8.1 Discrete Choice -- ---------------------------- -- DISCRETE_CHOICE ::= EXPRESSION | DISCRETE_RANGE | others -- Note: in Ada 83 mode, the expression must be a simple expression -- The only choice that appears explicitly is the OTHERS choice, as -- defined here. Other cases of discrete choice (expression and -- discrete range) appear directly. This production is also used -- for the OTHERS possibility of an exception choice. -- Note: in accordance with the syntax, the parser does not check that -- OTHERS appears at the end on its own in a choice list context. This -- is a semantic check. -- N_Others_Choice -- Sloc points to OTHERS -- Others_Discrete_Choices -- All_Others ---------------------------------- -- 3.9.1 Record Extension Part -- ---------------------------------- -- RECORD_EXTENSION_PART ::= with RECORD_DEFINITION -- Note: record extension parts are not permitted in Ada 83 mode -------------------------------------- -- 3.9.4 Interface Type Definition -- -------------------------------------- -- INTERFACE_TYPE_DEFINITION ::= -- [limited | task | protected | synchronized] -- interface [interface_list] -- Note: Interfaces are implemented with N_Record_Definition and -- N_Derived_Type_Definition nodes because most of the support -- for the analysis of abstract types has been reused to -- analyze abstract interfaces. ---------------------------------- -- 3.10 Access Type Definition -- ---------------------------------- -- ACCESS_TYPE_DEFINITION ::= -- ACCESS_TO_OBJECT_DEFINITION -- | ACCESS_TO_SUBPROGRAM_DEFINITION -------------------------- -- 3.10 Null Exclusion -- -------------------------- -- NULL_EXCLUSION ::= not null --------------------------------------- -- 3.10 Access To Object Definition -- --------------------------------------- -- ACCESS_TO_OBJECT_DEFINITION ::= -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] -- SUBTYPE_INDICATION -- N_Access_To_Object_Definition -- Sloc points to ACCESS -- All_Present -- Null_Exclusion_Present -- Null_Excluding_Subtype -- Subtype_Indication -- Constant_Present ----------------------------------- -- 3.10 General Access Modifier -- ----------------------------------- -- GENERAL_ACCESS_MODIFIER ::= all | constant -- Note: general access modifiers are not permitted in Ada 83 mode -- There is no explicit node in the tree for general access modifier. -- Instead the All_Present or Constant_Present flags are set in the -- parent node. ------------------------------------------- -- 3.10 Access To Subprogram Definition -- ------------------------------------------- -- ACCESS_TO_SUBPROGRAM_DEFINITION -- [NULL_EXCLUSION] access [protected] procedure PARAMETER_PROFILE -- | [NULL_EXCLUSION] access [protected] function -- PARAMETER_AND_RESULT_PROFILE -- Note: access to subprograms are not permitted in Ada 83 mode -- N_Access_Function_Definition -- Sloc points to ACCESS -- Null_Exclusion_Present -- Null_Exclusion_In_Return_Present -- Protected_Present -- Parameter_Specifications (set to No_List if no formal part) -- Result_Definition result subtype (subtype mark or access def) -- N_Access_Procedure_Definition -- Sloc points to ACCESS -- Null_Exclusion_Present -- Protected_Present -- Parameter_Specifications (set to No_List if no formal part) ----------------------------- -- 3.10 Access Definition -- ----------------------------- -- ACCESS_DEFINITION ::= -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] SUBTYPE_MARK -- | ACCESS_TO_SUBPROGRAM_DEFINITION -- Note: access to subprograms are an Ada 2005 (AI-254) extension -- N_Access_Definition -- Sloc points to ACCESS -- Null_Exclusion_Present -- All_Present -- Constant_Present -- Subtype_Mark -- Access_To_Subprogram_Definition (set to Empty if not present) ----------------------------------------- -- 3.10.1 Incomplete Type Declaration -- ----------------------------------------- -- INCOMPLETE_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [IS TAGGED]; -- N_Incomplete_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier -- Discriminant_Specifications (set to No_List if no -- discriminant part, or if the discriminant part is an -- unknown discriminant part) -- Premature_Use used for improved diagnostics. -- Unknown_Discriminants_Present set if (<>) discriminant -- Tagged_Present ---------------------------- -- 3.11 Declarative Part -- ---------------------------- -- DECLARATIVE_PART ::= {DECLARATIVE_ITEM} -- Note: although the parser enforces the syntactic requirement that -- a declarative part can contain only declarations, the semantic -- processing may add statements to the list of actions in a -- declarative part, so the code generator should be prepared -- to accept a statement in this position. ---------------------------- -- 3.11 Declarative Item -- ---------------------------- -- DECLARATIVE_ITEM ::= BASIC_DECLARATIVE_ITEM | BODY ---------------------------------- -- 3.11 Basic Declarative Item -- ---------------------------------- -- BASIC_DECLARATIVE_ITEM ::= -- BASIC_DECLARATION | REPRESENTATION_CLAUSE | USE_CLAUSE ---------------- -- 3.11 Body -- ---------------- -- BODY ::= PROPER_BODY | BODY_STUB ----------------------- -- 3.11 Proper Body -- ----------------------- -- PROPER_BODY ::= -- SUBPROGRAM_BODY | PACKAGE_BODY | TASK_BODY | PROTECTED_BODY --------------- -- 4.1 Name -- --------------- -- NAME ::= -- DIRECT_NAME | EXPLICIT_DEREFERENCE -- | INDEXED_COMPONENT | SLICE -- | SELECTED_COMPONENT | ATTRIBUTE_REFERENCE -- | TYPE_CONVERSION | FUNCTION_CALL -- | CHARACTER_LITERAL ---------------------- -- 4.1 Direct Name -- ---------------------- -- DIRECT_NAME ::= IDENTIFIER | OPERATOR_SYMBOL ----------------- -- 4.1 Prefix -- ----------------- -- PREFIX ::= NAME | IMPLICIT_DEREFERENCE ------------------------------- -- 4.1 Explicit Dereference -- ------------------------------- -- EXPLICIT_DEREFERENCE ::= NAME . all -- N_Explicit_Dereference -- Sloc points to ALL -- Prefix -- Actual_Designated_Subtype -- Has_Dereference_Action -- Atomic_Sync_Required -- plus fields for expression ------------------------------- -- 4.1 Implicit Dereference -- ------------------------------- -- IMPLICIT_DEREFERENCE ::= NAME ------------------------------ -- 4.1.1 Indexed Component -- ------------------------------ -- INDEXED_COMPONENT ::= PREFIX (EXPRESSION {, EXPRESSION}) -- Note: the parser may generate this node in some situations where it -- should be a function call. The semantic pass must correct this -- misidentification (which is inevitable at the parser level). -- N_Indexed_Component -- Sloc contains a copy of the Sloc value of the Prefix -- Prefix -- Expressions -- Generalized_Indexing -- Atomic_Sync_Required -- plus fields for expression -- Note: if any of the subscripts requires a range check, then the -- Do_Range_Check flag is set on the corresponding expression, with -- the index type being determined from the type of the Prefix, which -- references the array being indexed. -- Note: in a fully analyzed and expanded indexed component node, and -- hence in any such node that gigi sees, if the prefix is an access -- type, then an explicit dereference operation has been inserted. ------------------ -- 4.1.2 Slice -- ------------------ -- SLICE ::= PREFIX (DISCRETE_RANGE) -- Note: an implicit subtype is created to describe the resulting -- type, so that the bounds of this type are the bounds of the slice. -- N_Slice -- Sloc points to first token of prefix -- Prefix -- Discrete_Range -- plus fields for expression ------------------------------- -- 4.1.3 Selected Component -- ------------------------------- -- SELECTED_COMPONENT ::= PREFIX . SELECTOR_NAME -- Note: selected components that are semantically expanded names get -- changed during semantic processing into the separate N_Expanded_Name -- node. See description of this node in the section on semantic nodes. -- N_Selected_Component -- Sloc points to the period -- Prefix -- Selector_Name -- Associated_Node -- Do_Discriminant_Check -- Is_In_Discriminant_Check -- Atomic_Sync_Required -- Is_Prefixed_Call -- plus fields for expression -------------------------- -- 4.1.3 Selector Name -- -------------------------- -- SELECTOR_NAME ::= IDENTIFIER | CHARACTER_LITERAL | OPERATOR_SYMBOL -------------------------------- -- 4.1.4 Attribute Reference -- -------------------------------- -- ATTRIBUTE_REFERENCE ::= PREFIX ' ATTRIBUTE_DESIGNATOR -- Note: the syntax is quite ambiguous at this point. Consider: -- A'Length (X) X is part of the attribute designator -- A'Pos (X) X is an explicit actual parameter of function A'Pos -- A'Class (X) X is the expression of a type conversion -- It would be possible for the parser to distinguish these cases -- by looking at the attribute identifier. However, that would mean -- more work in introducing new implementation defined attributes, -- and also it would mean that special processing for attributes -- would be scattered around, instead of being centralized in the -- semantic routine that handles an N_Attribute_Reference node. -- Consequently, the parser in all the above cases stores the -- expression (X in these examples) as a single element list in -- in the Expressions field of the N_Attribute_Reference node. -- Similarly, for attributes like Max which take two arguments, -- we store the two arguments as a two element list in the -- Expressions field. Of course it is clear at parse time that -- this case is really a function call with an attribute as the -- prefix, but it turns out to be convenient to handle the two -- argument case in a similar manner to the one argument case, -- and indeed in general the parser will accept any number of -- expressions in this position and store them as a list in the -- attribute reference node. This allows for future addition of -- attributes that take more than two arguments. -- Note: named associates are not permitted in function calls where -- the function is an attribute (see RM 6.4(3)) so it is legitimate -- to skip the normal subprogram argument processing. -- Note: for the attributes whose designators are technically keywords, -- i.e. digits, access, delta, range, the Attribute_Name field contains -- the corresponding name, even though no identifier is involved. -- Note: the generated code may contain stream attributes applied to -- limited types for which no stream routines exist officially. In such -- case, the result is to use the stream attribute for the underlying -- full type, or in the case of a protected type, the components -- (including any discriminants) are merely streamed in order. -- See Exp_Attr for a complete description of which attributes are -- passed onto Gigi, and which are handled entirely by the front end. -- Gigi restriction: For the Pos attribute, the prefix cannot be -- a non-standard enumeration type or a nonzero/zero semantics -- boolean type, so the value is simply the stored representation. -- Gigi requirement: For the Mechanism_Code attribute, if the prefix -- references a subprogram that is a renaming, then the front end must -- rewrite the attribute to refer directly to the renamed entity. -- Note: syntactically the prefix of an attribute reference must be a -- name, and this (somewhat artificial) requirement is enforced by the -- parser. However, for many attributes, such as 'Valid, it is quite -- reasonable to apply the attribute to any value, and hence to any -- expression. Internally in the tree, the prefix is an expression which -- does not have to be a name, and this is handled fine by the semantic -- analysis and expansion, and back ends. This arises for the case of -- attribute references built by the expander (e.g. 'Valid for the case -- of an implicit validity check). -- Note: In generated code, the Address and Unrestricted_Access -- attributes can be applied to any expression, and the meaning is -- to create an object containing the value (the object is in the -- current stack frame), and pass the address of this value. If the -- Must_Be_Byte_Aligned flag is set, then the object whose address -- is taken must be on a byte (storage unit) boundary, and if it is -- not (or may not be), then the generated code must create a copy -- that is byte aligned, and pass the address of this copy. -- N_Attribute_Reference -- Sloc points to apostrophe -- Prefix (general expression, see note above) -- Attribute_Name identifier name from attribute designator -- Expressions (set to No_List if no associated expressions) -- Entity used if the attribute yields a type -- Associated_Node -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Header_Size_Added -- Redundant_Use -- Must_Be_Byte_Aligned -- plus fields for expression -- Note: in Modify_Tree_For_C mode, Max and Min attributes are expanded -- into equivalent if expressions, properly taking care of side effects. --------------------------------- -- 4.1.4 Attribute Designator -- --------------------------------- -- ATTRIBUTE_DESIGNATOR ::= -- IDENTIFIER [(static_EXPRESSION)] -- | access | delta | digits -- There is no explicit node in the tree for an attribute designator. -- Instead the Attribute_Name and Expressions fields of the parent -- node (N_Attribute_Reference node) hold the information. -- Note: if ACCESS, DELTA, or DIGITS appears in an attribute -- designator, then they are treated as identifiers internally -- rather than the keywords of the same name. -------------------------------------- -- 4.1.4 Range Attribute Reference -- -------------------------------------- -- RANGE_ATTRIBUTE_REFERENCE ::= PREFIX ' RANGE_ATTRIBUTE_DESIGNATOR -- A range attribute reference is represented in the tree using the -- normal N_Attribute_Reference node. --------------------------------------- -- 4.1.4 Range Attribute Designator -- --------------------------------------- -- RANGE_ATTRIBUTE_DESIGNATOR ::= Range [(static_EXPRESSION)] -- A range attribute designator is represented in the tree using the -- normal N_Attribute_Reference node. -------------------- -- 4.3 Aggregate -- -------------------- -- AGGREGATE ::= -- RECORD_AGGREGATE | EXTENSION_AGGREGATE | ARRAY_AGGREGATE ----------------------------- -- 4.3.1 Record Aggregate -- ----------------------------- -- RECORD_AGGREGATE ::= (RECORD_COMPONENT_ASSOCIATION_LIST) -- N_Aggregate -- Sloc points to left parenthesis -- Expressions (set to No_List if none or null record case) -- Component_Associations (set to No_List if none) -- Null_Record_Present -- Aggregate_Bounds -- Associated_Node -- Compile_Time_Known_Aggregate -- Expansion_Delayed -- Has_Self_Reference -- Is_Homogeneous_Aggregate -- plus fields for expression -- Note: this structure is used for both record and array aggregates -- since the two cases are not separable by the parser. The parser -- makes no attempt to enforce consistency here, so it is up to the -- semantic phase to make sure that the aggregate is consistent (i.e. -- that it is not a "half-and-half" case that mixes record and array -- syntax). In particular, for a record aggregate, the expressions -- field will be set if there are positional associations. -- Note: N_Aggregate is not used for all aggregates; in particular, -- there is a separate node kind for extension aggregates. -- Note: gigi/gcc can handle array aggregates correctly providing that -- they are entirely positional, and the array subtype involved has a -- known at compile time length and is not bit packed, or a convention -- Fortran array with more than one dimension. If these conditions -- are not met, then the front end must translate the aggregate into -- an appropriate set of assignments into a temporary. -- Note: for the record aggregate case, gigi/gcc can handle most cases -- of record aggregates, including those for packed, and rep-claused -- records, and also variant records, providing that there are no -- variable length fields whose size is not known at compile time, -- and providing that the aggregate is presented in fully named form. -- The other situation in which array aggregates and record aggregates -- cannot be passed to the back end is if assignment to one or more -- components itself needs expansion, e.g. in the case of an assignment -- of an object of a controlled type. In such cases, the front end -- must expand the aggregate to a series of assignments, and apply -- the required expansion to the individual assignment statements. ---------------------------------------------- -- 4.3.1 Record Component Association List -- ---------------------------------------------- -- RECORD_COMPONENT_ASSOCIATION_LIST ::= -- RECORD_COMPONENT_ASSOCIATION {, RECORD_COMPONENT_ASSOCIATION} -- | null record -- There is no explicit node in the tree for a record component -- association list. Instead the Null_Record_Present flag is set in -- the parent node for the NULL RECORD case. ------------------------------------------------------ -- 4.3.1 Record Component Association (also 4.3.3) -- ------------------------------------------------------ -- RECORD_COMPONENT_ASSOCIATION ::= -- [COMPONENT_CHOICE_LIST =>] EXPRESSION -- N_Component_Association -- Sloc points to first selector name -- Choices -- Expression (empty if Box_Present) -- Loop_Actions -- Box_Present -- Inherited_Discriminant -- Binding_Chars -- Note: this structure is used for both record component associations -- and array component associations, since the two cases aren't always -- separable by the parser. The choices list may represent either a -- list of selector names in the record aggregate case, or a list of -- discrete choices in the array aggregate case or an N_Others_Choice -- node (which appears as a singleton list). Box_Present gives support -- to Ada 2005 (AI-287). Binding_Chars is only set if GNAT extensions -- are enabled and the given component association occurs within a -- choice_expression; in this case, it is the Name_Id, if any, specified -- via either of two syntactic forms: "Foo => Bar is Abc" or -- "Foo => <Abc>". ---------------------------------- -- 4.3.1 Component Choice List -- ---------------------------------- -- COMPONENT_CHOICE_LIST ::= -- component_SELECTOR_NAME {| component_SELECTOR_NAME} -- | others -- The entries of a component choice list appear in the Choices list of -- the associated N_Component_Association, as either selector names, or -- as an N_Others_Choice node. -------------------------------- -- 4.3.2 Extension Aggregate -- -------------------------------- -- EXTENSION_AGGREGATE ::= -- (ANCESTOR_PART with RECORD_COMPONENT_ASSOCIATION_LIST) -- Note: extension aggregates are not permitted in Ada 83 mode -- N_Extension_Aggregate -- Sloc points to left parenthesis -- Ancestor_Part -- Associated_Node -- Expressions (set to No_List if none or null record case) -- Component_Associations (set to No_List if none) -- Null_Record_Present -- Expansion_Delayed -- Has_Self_Reference -- plus fields for expression -------------------------- -- 4.3.2 Ancestor Part -- -------------------------- -- ANCESTOR_PART ::= EXPRESSION | SUBTYPE_MARK ---------------------------- -- 4.3.3 Array Aggregate -- ---------------------------- -- ARRAY_AGGREGATE ::= -- POSITIONAL_ARRAY_AGGREGATE | NAMED_ARRAY_AGGREGATE --------------------------------------- -- 4.3.3 Positional Array Aggregate -- --------------------------------------- -- POSITIONAL_ARRAY_AGGREGATE ::= -- (EXPRESSION, EXPRESSION {, EXPRESSION}) -- | (EXPRESSION {, EXPRESSION}, others => EXPRESSION) -- See Record_Aggregate (4.3.1) for node structure ---------------------------------- -- 4.3.3 Named Array Aggregate -- ---------------------------------- -- NAMED_ARRAY_AGGREGATE ::= -- (ARRAY_COMPONENT_ASSOCIATION {, ARRAY_COMPONENT_ASSOCIATION}) -- See Record_Aggregate (4.3.1) for node structure ---------------------------------------- -- 4.3.3 Array Component Association -- ---------------------------------------- -- ARRAY_COMPONENT_ASSOCIATION ::= -- DISCRETE_CHOICE_LIST => EXPRESSION -- | ITERATED_COMPONENT_ASSOCIATION -- See Record_Component_Association (4.3.1) for node structure -- The iterated_component_association is introduced into the -- Corrigendum of Ada_2012 by AI12-061. ------------------------------------------ -- 4.3.3 Iterated component Association -- ------------------------------------------ -- ITERATED_COMPONENT_ASSOCIATION ::= -- for DEFINING_IDENTIFIER in DISCRETE_CHOICE_LIST => EXPRESSION -- N_Iterated_Component_Association -- Sloc points to FOR -- Defining_Identifier -- Iterator_Specification (set to Empty if no Iterator_Spec) -- Expression -- Discrete_Choices -- Loop_Actions -- Box_Present -- Note that Box_Present is always False, but it is intentionally added -- for completeness. ---------------------------- -- 4.3.4 Delta Aggregate -- ---------------------------- -- N_Delta_Aggregate -- Sloc points to left parenthesis -- Expression -- Component_Associations -- Etype --------------------------------- -- 3.4.5 Comtainer_Aggregates -- --------------------------------- -- N_Iterated_Element_Association -- Key_Expression -- Iterator_Specification -- Expression -- Loop_Parameter_Specification -- Loop_Actions -- Box_Present -- Exactly one of Iterator_Specification or Loop_Parameter_ -- specification is present. If the Key_Expression is absent, -- the construct is parsed as an Iterated_Component_Association, -- and legality checks are performed during semantic analysis. -- Both iterated associations are Ada 2022 features that are -- expanded during aggregate construction, and do not appear in -- expanded code. -------------------------------------------------- -- 4.4 Expression/Relation/Term/Factor/Primary -- -------------------------------------------------- -- EXPRESSION ::= -- RELATION {LOGICAL_OPERATOR RELATION} -- CHOICE_EXPRESSION ::= -- CHOICE_RELATION {LOGICAL_OPERATOR CHOICE_RELATION} -- CHOICE_RELATION ::= -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] -- RELATION ::= -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST -- | RAISE_EXPRESSION -- MEMBERSHIP_CHOICE_LIST ::= -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE} -- MEMBERSHIP_CHOICE ::= -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK -- LOGICAL_OPERATOR ::= and | and then | or | or else | xor -- SIMPLE_EXPRESSION ::= -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM} -- TERM ::= FACTOR {MULTIPLYING_OPERATOR FACTOR} -- FACTOR ::= PRIMARY [** PRIMARY] | abs PRIMARY | not PRIMARY -- No nodes are generated for any of these constructs. Instead, the -- node for the operator appears directly. When we refer to an -- expression in this description, we mean any of the possible -- constituent components of an expression (e.g. identifier is -- an example of an expression). -- Note: the above syntax is that Ada 2012 syntax which restricts -- choice relations to simple expressions to avoid ambiguities in -- some contexts with set membership notation. It has been decided -- that in retrospect, the Ada 95 change allowing general expressions -- in this context was a mistake, so we have reverted to the above -- syntax in Ada 95 and Ada 2005 modes (the restriction to simple -- expressions was there in Ada 83 from the start). ------------------ -- 4.4 Primary -- ------------------ -- PRIMARY ::= -- NUMERIC_LITERAL | null -- | STRING_LITERAL | AGGREGATE -- | NAME | QUALIFIED_EXPRESSION -- | ALLOCATOR | (EXPRESSION) -- Usually there is no explicit node in the tree for primary. Instead -- the constituent (e.g. AGGREGATE) appears directly. There are two -- exceptions. First, there is an explicit node for a null primary. -- N_Null -- Sloc points to NULL -- plus fields for expression -- Second, the case of (EXPRESSION) is handled specially. Ada requires -- that the parser keep track of which subexpressions are enclosed -- in parentheses, and how many levels of parentheses are used. This -- information is required for optimization purposes, and also for -- some semantic checks (e.g. (((1))) in a procedure spec does not -- conform with ((((1)))) in the body). -- The parentheses are recorded by keeping a Paren_Count field in every -- subexpression node (it is actually present in all nodes, but only -- used in subexpression nodes). This count records the number of -- levels of parentheses. If the number of levels in the source exceeds -- the maximum accommodated by this count, then the count is simply left -- at the maximum value. This means that there are some pathological -- cases of failure to detect conformance failures (e.g. an expression -- with 500 levels of parens will conform with one with 501 levels), -- but we do not need to lose sleep over this. -- Historical note: in versions of GNAT prior to 1.75, there was a node -- type N_Parenthesized_Expression used to accurately record unlimited -- numbers of levels of parentheses. However, it turned out to be a -- real nuisance to have to take into account the possible presence of -- this node during semantic analysis, since basically parentheses have -- zero relevance to semantic analysis. -- Note: the level of parentheses always present in things like -- aggregates does not count, only the parentheses in the primary -- (EXPRESSION) affect the setting of the Paren_Count field. -- 2nd Note: the contents of the Expression field must be ignored (i.e. -- treated as though it were Empty) if No_Initialization is set True. -------------------------------------- -- 4.5 Short-Circuit Control Forms -- -------------------------------------- -- EXPRESSION ::= -- RELATION {and then RELATION} | RELATION {or else RELATION} -- Gigi restriction: For both these control forms, the operand and -- result types are always Standard.Boolean. The expander inserts the -- required conversion operations where needed to ensure this is the -- case. -- N_And_Then -- Sloc points to AND of AND THEN -- Left_Opnd -- Right_Opnd -- Actions -- plus fields for expression -- N_Or_Else -- Sloc points to OR of OR ELSE -- Left_Opnd -- Right_Opnd -- Actions -- plus fields for expression -- Note: The Actions field is used to hold actions associated with -- the right hand operand. These have to be treated specially since -- they are not unconditionally executed. See Insert_Actions for a -- more detailed description of how these actions are handled. --------------------------- -- 4.5 Membership Tests -- --------------------------- -- RELATION ::= -- SIMPLE_EXPRESSION [not] in MEMBERSHIP_CHOICE_LIST -- MEMBERSHIP_CHOICE_LIST ::= -- MEMBERSHIP_CHOICE {'|' MEMBERSHIP CHOICE} -- MEMBERSHIP_CHOICE ::= -- CHOICE_EXPRESSION | RANGE | SUBTYPE_MARK -- Note: although the grammar above allows only a range or a subtype -- mark, the parser in fact will accept any simple expression in place -- of a subtype mark. This means that the semantic analyzer must be able -- to deal with, and diagnose a simple expression other than a name for -- the right operand. This simplifies error recovery in the parser. -- The Alternatives field below is present only if there is more than -- one Membership_Choice present (which is legitimate only in Ada 2012 -- mode) in which case Right_Opnd is Empty, and Alternatives contains -- the list of choices. In the tree passed to the back end, Alternatives -- is always No_List, and Right_Opnd is set (i.e. the expansion circuit -- expands out the complex set membership case using simple membership -- and equality operations). -- Should we rename Alternatives here to Membership_Choices ??? -- N_In -- Sloc points to IN -- Left_Opnd -- Right_Opnd -- Alternatives (set to No_List if only one set alternative) -- No_Minimize_Eliminate -- plus fields for expression -- N_Not_In -- Sloc points to NOT of NOT IN -- Left_Opnd -- Right_Opnd -- Alternatives (set to No_List if only one set alternative) -- No_Minimize_Eliminate -- plus fields for expression -------------------- -- 4.5 Operators -- -------------------- -- LOGICAL_OPERATOR ::= and | or | xor -- RELATIONAL_OPERATOR ::= = | /= | < | <= | > | >= -- BINARY_ADDING_OPERATOR ::= + | - | & -- UNARY_ADDING_OPERATOR ::= + | - -- MULTIPLYING_OPERATOR ::= * | / | mod | rem -- HIGHEST_PRECEDENCE_OPERATOR ::= ** | abs | not -- Gigi restriction: Gigi will never be given * / mod rem nodes with -- fixed-point operands. All handling of smalls for multiplication and -- division is handled by the front end (mod and rem result only from -- expansion). Gigi thus never needs to worry about small values (for -- other operators operating on fixed-point, e.g. addition, the small -- value does not have any semantic effect anyway, these are always -- integer operations). -- Gigi restriction: For all operators taking Boolean operands, the -- type is always Standard.Boolean. The expander inserts the required -- conversion operations where needed to ensure this is the case. -- N_Op_And -- Sloc points to AND -- Do_Length_Check -- plus fields for binary operator -- plus fields for expression -- N_Op_Or -- Sloc points to OR -- Do_Length_Check -- plus fields for binary operator -- plus fields for expression -- N_Op_Xor -- Sloc points to XOR -- Do_Length_Check -- plus fields for binary operator -- plus fields for expression -- N_Op_Eq -- Sloc points to = -- plus fields for binary operator -- plus fields for expression -- N_Op_Ne -- Sloc points to /= -- plus fields for binary operator -- plus fields for expression -- N_Op_Lt -- Sloc points to < -- plus fields for binary operator -- plus fields for expression -- N_Op_Le -- Sloc points to <= -- plus fields for binary operator -- plus fields for expression -- N_Op_Gt -- Sloc points to > -- plus fields for binary operator -- plus fields for expression -- N_Op_Ge -- Sloc points to >= -- plus fields for binary operator -- plus fields for expression -- N_Op_Add -- Sloc points to + (binary) -- plus fields for binary operator -- plus fields for expression -- N_Op_Subtract -- Sloc points to - (binary) -- plus fields for binary operator -- plus fields for expression -- N_Op_Concat -- Sloc points to & -- Is_Component_Left_Opnd -- Is_Component_Right_Opnd -- plus fields for binary operator -- plus fields for expression -- N_Op_Multiply -- Sloc points to * -- Rounded_Result -- plus fields for binary operator -- plus fields for expression -- N_Op_Divide -- Sloc points to / -- Do_Division_Check -- Rounded_Result -- plus fields for binary operator -- plus fields for expression -- N_Op_Mod -- Sloc points to MOD -- Do_Division_Check -- plus fields for binary operator -- plus fields for expression -- N_Op_Rem -- Sloc points to REM -- Do_Division_Check -- plus fields for binary operator -- plus fields for expression -- N_Op_Expon -- Sloc points to ** -- Is_Power_Of_2_For_Shift -- plus fields for binary operator -- plus fields for expression -- N_Op_Plus -- Sloc points to + (unary) -- plus fields for unary operator -- plus fields for expression -- N_Op_Minus -- Sloc points to - (unary) -- plus fields for unary operator -- plus fields for expression -- N_Op_Abs -- Sloc points to ABS -- plus fields for unary operator -- plus fields for expression -- N_Op_Not -- Sloc points to NOT -- plus fields for unary operator -- plus fields for expression -- See also shift operators in section B.2 -- Note on fixed-point operations passed to Gigi: For adding operators, -- the semantics is to treat these simply as integer operations, with -- the small values being ignored (the bounds are already stored in -- units of small, so that constraint checking works as usual). For the -- case of multiply/divide/rem/mod operations, Gigi will never see them. -- Note on equality/inequality tests for records. In the expanded tree, -- record comparisons are always expanded to be a series of component -- comparisons, so the back end will never see an equality or inequality -- operation with operands of a record type. -- Note on overflow handling: When the overflow checking mode is set to -- MINIMIZED or ELIMINATED, nodes for signed arithmetic operations may -- be modified to use a larger type for the operands and result. In -- the case where the computed range exceeds that of Long_Long_Integer, -- and we are running in ELIMINATED mode, the operator node will be -- changed to be a call to the appropriate routine in System.Bignums. -- Note: In Modify_Tree_For_C mode, we do not generate an N_Op_Mod node -- for signed integer types (since there is no equivalent operator in -- C). Instead we rewrite such an operation in terms of REM (which is -- % in C) and other C-available operators. ------------------------------------ -- 4.5.7 Conditional Expressions -- ------------------------------------ -- CONDITIONAL_EXPRESSION ::= IF_EXPRESSION | CASE_EXPRESSION -------------------------- -- 4.5.7 If Expression -- -------------------------- -- IF_EXPRESSION ::= -- if CONDITION then DEPENDENT_EXPRESSION -- {elsif CONDITION then DEPENDENT_EXPRESSION} -- [else DEPENDENT_EXPRESSION] -- DEPENDENT_EXPRESSION ::= EXPRESSION -- Note: if we have (IF x1 THEN x2 ELSIF x3 THEN x4 ELSE x5) then it -- is represented as (IF x1 THEN x2 ELSE (IF x3 THEN x4 ELSE x5)) and -- the Is_Elsif flag is set on the inner if expression. -- N_If_Expression -- Sloc points to IF or ELSIF keyword -- Expressions -- Then_Actions -- Else_Actions -- Is_Elsif (set if comes from ELSIF) -- Do_Overflow_Check -- plus fields for expression -- Expressions here is a three-element list, whose first element is the -- condition, the second element is the dependent expression after THEN -- and the third element is the dependent expression after the ELSE -- (explicitly set to True if missing). -- Note: the Then_Actions and Else_Actions fields are always set to -- No_List in the tree passed to the back end. These are used only -- for temporary processing purposes in the expander. Even though they -- are semantic fields, their parent pointers are set because analysis -- of actions nodes in those lists may generate additional actions that -- need to know their insertion point (for example for the creation of -- transient scopes). -- Note: in the tree passed to the back end, if the result type is -- an unconstrained array, the if expression can only appears in the -- initializing expression of an object declaration (this avoids the -- back end having to create a variable length temporary on the fly). ---------------------------- -- 4.5.7 Case Expression -- ---------------------------- -- CASE_EXPRESSION ::= -- case SELECTING_EXPRESSION is -- CASE_EXPRESSION_ALTERNATIVE -- {,CASE_EXPRESSION_ALTERNATIVE} -- Note that the Alternatives cannot include pragmas (this contrasts -- with the situation of case statements where pragmas are allowed). -- N_Case_Expression -- Sloc points to CASE -- Expression (the selecting expression) -- Alternatives (the case expression alternatives) -- Etype -- Do_Overflow_Check ---------------------------------------- -- 4.5.7 Case Expression Alternative -- ---------------------------------------- -- CASE_EXPRESSION_ALTERNATIVE ::= -- when DISCRETE_CHOICE_LIST => -- DEPENDENT_EXPRESSION -- N_Case_Expression_Alternative -- Sloc points to WHEN -- Actions -- Discrete_Choices -- Expression -- Has_SP_Choice -- Note: The Actions field temporarily holds any actions associated with -- evaluation of the Expression. During expansion of the case expression -- these actions are wrapped into an N_Expressions_With_Actions node -- replacing the original expression. -- Note: this node never appears in the tree passed to the back end, -- since the expander converts case expressions into case statements. --------------------------------- -- 4.5.8 Quantified Expression -- --------------------------------- -- QUANTIFIED_EXPRESSION ::= -- for QUANTIFIER LOOP_PARAMETER_SPECIFICATION => PREDICATE -- | for QUANTIFIER ITERATOR_SPECIFICATION => PREDICATE -- -- QUANTIFIER ::= all | some -- At most one of (Iterator_Specification, Loop_Parameter_Specification) -- is present at a time, in which case the other one is empty. -- N_Quantified_Expression -- Sloc points to FOR -- Iterator_Specification -- Loop_Parameter_Specification -- Condition -- All_Present -------------------------- -- 4.6 Type Conversion -- -------------------------- -- TYPE_CONVERSION ::= -- SUBTYPE_MARK (EXPRESSION) | SUBTYPE_MARK (NAME) -- In the (NAME) case, the name is stored as the expression -- Note: the parser never generates a type conversion node, since it -- looks like an indexed component which is generated by preference. -- The semantic pass must correct this misidentification. -- Gigi handles conversions that involve no change in the root type, -- and also all conversions from integer to floating-point types. -- Conversions from floating-point to integer are only handled in -- the case where Float_Truncate flag set. Other conversions from -- floating-point to integer (involving rounding) and all conversions -- involving fixed-point types are handled by the expander, unless the -- Conversion_OK flag is set. -- Sprint syntax if Float_Truncate set: X^(Y) -- Sprint syntax if Conversion_OK set X?(Y) -- Sprint syntax if both flags set X?^(Y) -- Note: If either the operand or result type is fixed-point, Gigi will -- only see a type conversion node with Conversion_OK set. The front end -- takes care of all handling of small's for fixed-point conversions. -- N_Type_Conversion -- Sloc points to first token of subtype mark -- Subtype_Mark -- Expression -- Do_Discriminant_Check -- Do_Length_Check -- Float_Truncate -- Conversion_OK -- Do_Overflow_Check -- Rounded_Result -- plus fields for expression -- Note: if a range check is required, then the Do_Range_Check flag -- is set in the Expression with the check being done against the -- target type range (after the base type conversion, if any). ------------------------------- -- 4.7 Qualified Expression -- ------------------------------- -- QUALIFIED_EXPRESSION ::= -- SUBTYPE_MARK ' (EXPRESSION) | SUBTYPE_MARK ' AGGREGATE -- Note: the parentheses in the (EXPRESSION) case are deemed to enclose -- the expression, so the Expression field of this node always points -- to a parenthesized expression in this case (i.e. Paren_Count will -- always be non-zero for the referenced expression if it is not an -- aggregate). -- N_Qualified_Expression -- Sloc points to apostrophe -- Subtype_Mark -- Expression expression or aggregate -- Is_Qualified_Universal_Literal -- plus fields for expression -------------------- -- 4.8 Allocator -- -------------------- -- ALLOCATOR ::= -- new [SUBPOOL_SPECIFICATION] SUBTYPE_INDICATION -- | new [SUBPOOL_SPECIFICATION] QUALIFIED_EXPRESSION -- -- SUBPOOL_SPECIFICATION ::= (subpool_handle_NAME) -- Sprint syntax (when storage pool present) -- new xxx (storage_pool = pool) -- or -- new (subpool) xxx (storage_pool = pool) -- N_Allocator -- Sloc points to NEW -- Expression subtype indication or qualified expression -- Subpool_Handle_Name (set to Empty if not present) -- Storage_Pool -- Procedure_To_Call -- Alloc_For_BIP_Return -- Null_Exclusion_Present -- No_Initialization -- Is_Static_Coextension -- Do_Storage_Check -- Is_Dynamic_Coextension -- plus fields for expression -- Note: like all nodes, the N_Allocator has the Comes_From_Source flag. -- This flag has a special function in conjunction with the restriction -- No_Implicit_Heap_Allocations, which will be triggered if this flag -- is not set. This means that if a source allocator is replaced with -- a constructed allocator, the Comes_From_Source flag should be copied -- to the newly created allocator. --------------------------------- -- 5.1 Sequence Of Statements -- --------------------------------- -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT} -- Note: Although the parser will not accept a declaration as a -- statement, the semantic analyzer may insert declarations (e.g. -- declarations of implicit types needed for execution of other -- statements) into a sequence of statements, so the code generator -- should be prepared to accept a declaration where a statement is -- expected. Note also that pragmas can appear as statements. -------------------- -- 5.1 Statement -- -------------------- -- STATEMENT ::= -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT -- There is no explicit node in the tree for a statement. Instead, the -- individual statement appears directly. Labels are treated as a -- kind of statement, i.e. they are linked into a statement list at -- the point they appear, so the labeled statement appears following -- the label or labels in the statement list. --------------------------- -- 5.1 Simple Statement -- --------------------------- -- SIMPLE_STATEMENT ::= NULL_STATEMENT -- | ASSIGNMENT_STATEMENT | EXIT_STATEMENT -- | GOTO_STATEMENT | PROCEDURE_CALL_STATEMENT -- | SIMPLE_RETURN_STATEMENT | ENTRY_CALL_STATEMENT -- | REQUEUE_STATEMENT | DELAY_STATEMENT -- | ABORT_STATEMENT | RAISE_STATEMENT -- | CODE_STATEMENT ----------------------------- -- 5.1 Compound Statement -- ----------------------------- -- COMPOUND_STATEMENT ::= -- IF_STATEMENT | CASE_STATEMENT -- | LOOP_STATEMENT | BLOCK_STATEMENT -- | EXTENDED_RETURN_STATEMENT -- | ACCEPT_STATEMENT | SELECT_STATEMENT ------------------------- -- 5.1 Null Statement -- ------------------------- -- NULL_STATEMENT ::= null; -- N_Null_Statement -- Sloc points to NULL -- Next_Rep_Item ---------------- -- 5.1 Label -- ---------------- -- LABEL ::= <<label_STATEMENT_IDENTIFIER>> -- Note that the occurrence of a label is not a defining identifier, -- but rather a referencing occurrence. The defining occurrence is -- in the implicit label declaration which occurs in the innermost -- enclosing block. -- N_Label -- Sloc points to << -- Identifier direct name of statement identifier -- Exception_Junk -- Note: Before Ada 2012, a label is always followed by a statement, -- and this is true in the tree even in Ada 2012 mode (the parser -- inserts a null statement marked with Comes_From_Source False). ------------------------------- -- 5.1 Statement Identifier -- ------------------------------- -- STATEMENT_IDENTIFIER ::= DIRECT_NAME -- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier -- (not an OPERATOR_SYMBOL) ------------------------------- -- 5.2 Assignment Statement -- ------------------------------- -- ASSIGNMENT_STATEMENT ::= -- variable_NAME := EXPRESSION; -- N_Assignment_Statement -- Sloc points to := -- Name -- Expression -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Do_Discriminant_Check -- Do_Length_Check -- Forwards_OK -- Backwards_OK -- No_Ctrl_Actions -- Has_Target_Names -- Is_Elaboration_Code -- Componentwise_Assignment -- Suppress_Assignment_Checks -- Note: if a range check is required, then the Do_Range_Check flag -- is set in the Expression (right hand side), with the check being -- done against the type of the Name (left hand side). -- Note: the back end places some restrictions on the form of the -- Expression field. If the object being assigned to is Atomic, then -- the Expression may not have the form of an aggregate (since this -- might cause the back end to generate separate assignments). In this -- case the front end must generate an extra temporary and initialize -- this temporary as required (the temporary itself is not atomic). ------------------ -- Target_Name -- ------------------ -- N_Target_Name -- Sloc points to @ -- Etype -- Note (Ada 2022): node is used during analysis as a placeholder for -- the value of the LHS of the enclosing assignment statement. Node is -- eventually rewritten together with enclosing assignment, and backends -- are not aware of it. ----------------------- -- 5.3 If Statement -- ----------------------- -- IF_STATEMENT ::= -- if CONDITION then -- SEQUENCE_OF_STATEMENTS -- {elsif CONDITION then -- SEQUENCE_OF_STATEMENTS} -- [else -- SEQUENCE_OF_STATEMENTS] -- end if; -- Gigi restriction: This expander ensures that the type of the -- Condition fields is always Standard.Boolean, even if the type -- in the source is some non-standard boolean type. -- N_If_Statement -- Sloc points to IF -- Condition -- Then_Statements -- Elsif_Parts (set to No_List if none present) -- Else_Statements (set to No_List if no else part present) -- End_Span (set to Uint_0 if expander generated) -- From_Conditional_Expression -- N_Elsif_Part -- Sloc points to ELSIF -- Condition -- Then_Statements -- Condition_Actions -------------------- -- 5.3 Condition -- -------------------- -- CONDITION ::= boolean_EXPRESSION ------------------------- -- 5.4 Case Statement -- ------------------------- -- CASE_STATEMENT ::= -- case EXPRESSION is -- CASE_STATEMENT_ALTERNATIVE -- {CASE_STATEMENT_ALTERNATIVE} -- end case; -- Note: the Alternatives can contain pragmas. These only occur at -- the start of the list, since any pragmas occurring after the first -- alternative are absorbed into the corresponding statement sequence. -- N_Case_Statement -- Sloc points to CASE -- Expression -- Alternatives -- End_Span (set to Uint_0 if expander generated) -- From_Conditional_Expression -- Note: Before Ada 2012, a pragma in a statement sequence is always -- followed by a statement, and this is true in the tree even in Ada -- 2012 mode (the parser inserts a null statement marked with the flag -- Comes_From_Source False). ------------------------------------- -- 5.4 Case Statement Alternative -- ------------------------------------- -- CASE_STATEMENT_ALTERNATIVE ::= -- when DISCRETE_CHOICE_LIST => -- SEQUENCE_OF_STATEMENTS -- N_Case_Statement_Alternative -- Sloc points to WHEN -- Discrete_Choices -- Statements -- Has_SP_Choice -- Multidefined_Bindings -- Note: in the list of Discrete_Choices, the tree passed to the back -- end does not have choice entries corresponding to names of statically -- predicated subtypes. Such entries are always expanded out to the list -- of equivalent values or ranges. Multidefined_Bindings is True iff -- more than one choice is present and each choice contains -- at least one component association having a non-null Binding_Chars -- attribute; this can only occur if GNAT extensions are enabled -- and the type of the case selector is composite. ------------------------- -- 5.5 Loop Statement -- ------------------------- -- LOOP_STATEMENT ::= -- [loop_STATEMENT_IDENTIFIER :] -- [ITERATION_SCHEME] loop -- SEQUENCE_OF_STATEMENTS -- end loop [loop_IDENTIFIER]; -- Note: The occurrence of a loop label is not a defining identifier -- but rather a referencing occurrence. The defining occurrence is in -- the implicit label declaration which occurs in the innermost -- enclosing block. -- Note: there is always a loop statement identifier present in the -- tree, even if none was given in the source. In the case where no loop -- identifier is given in the source, the parser creates a name of the -- form _Loop_n, where n is a decimal integer (the two underlines ensure -- that the loop names created in this manner do not conflict with any -- user defined identifiers), and the flag Has_Created_Identifier is set -- to True. The only exception to the rule that all loop statement nodes -- have identifiers occurs for loops constructed by the expander, and -- the semantic analyzer will create and supply dummy loop identifiers -- in these cases. -- N_Loop_Statement -- Sloc points to LOOP -- Identifier loop identifier (set to Empty if no identifier) -- Iteration_Scheme (set to Empty if no iteration scheme) -- Statements -- End_Label -- Has_Created_Identifier -- Is_Null_Loop -- Suppress_Loop_Warnings -- Note: the parser fills in the Identifier field if there is an -- explicit loop identifier. Otherwise the parser leaves this field -- set to Empty, and then the semantic processing for a loop statement -- creates an identifier, setting the Has_Created_Identifier flag to -- True. So after semantic analysis, the Identifier is always set, -- referencing an identifier whose entity has an Ekind of E_Loop. --------------------------- -- 5.5 Iteration Scheme -- --------------------------- -- ITERATION_SCHEME ::= -- while CONDITION -- | for LOOP_PARAMETER_SPECIFICATION -- | for ITERATOR_SPECIFICATION -- At most one of (Iterator_Specification, Loop_Parameter_Specification) -- is present at a time, in which case the other one is empty. Both are -- empty in the case of a WHILE loop. -- Gigi restriction: The expander ensures that the type of the Condition -- field is always Standard.Boolean, even if the type in the source is -- some non-standard boolean type. -- N_Iteration_Scheme -- Sloc points to WHILE or FOR -- Condition (set to Empty if FOR case) -- Condition_Actions -- Iterator_Specification (set to Empty if WHILE case) -- Loop_Parameter_Specification (set to Empty if WHILE case) --------------------------------------- -- 5.5 Loop Parameter Specification -- --------------------------------------- -- LOOP_PARAMETER_SPECIFICATION ::= -- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION -- [Iterator_Filter] -- Note: the optional Iterator_Filter is an Ada 2022 construct. -- N_Loop_Parameter_Specification -- Sloc points to first identifier -- Defining_Identifier -- Reverse_Present -- Iterator_Filter (set to Empty if not present) -- Discrete_Subtype_Definition ----------------------------------- -- 5.5.1 Iterator Specification -- ----------------------------------- -- ITERATOR_SPECIFICATION ::= -- DEFINING_IDENTIFIER in [reverse] NAME -- | DEFINING_IDENTIFIER [: SUBTYPE_INDICATION] of [reverse] NAME -- N_Iterator_Specification -- Sloc points to defining identifier -- Defining_Identifier -- Name -- Reverse_Present -- Of_Present -- Iterator_Filter (set to Empty if not present) -- Subtype_Indication -- Note: The Of_Present flag distinguishes the two forms -------------------------- -- 5.6 Block Statement -- -------------------------- -- BLOCK_STATEMENT ::= -- [block_STATEMENT_IDENTIFIER:] -- [declare -- DECLARATIVE_PART] -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [block_IDENTIFIER]; -- Note that the occurrence of a block identifier is not a defining -- identifier, but rather a referencing occurrence. The defining -- occurrence is an E_Block entity declared by the implicit label -- declaration which occurs in the innermost enclosing block statement -- or body; the block identifier denotes that E_Block. -- For block statements that come from source code, there is always a -- block statement identifier present in the tree, denoting an E_Block. -- In the case where no block identifier is given in the source, -- the parser creates a name of the form B_n, where n is a decimal -- integer, and the flag Has_Created_Identifier is set to True. Blocks -- constructed by the expander usually have no identifier, and no -- corresponding entity. -- Note: the block statement created for an extended return statement -- has an entity, and this entity is an E_Return_Statement, rather than -- the usual E_Block. -- Note: Exception_Junk is set for the wrapping blocks created during -- local raise optimization (Exp_Ch11.Expand_Local_Exception_Handlers). -- Note: from a control flow viewpoint, a block statement defines an -- extended basic block, i.e. the entry of the block dominates every -- statement in the sequence. When generating new statements with -- exception handlers in the expander at the end of a sequence that -- comes from source code, it can be necessary to wrap them all in a -- block statement in order to expose the implicit control flow to -- gigi and thus prevent it from issuing bogus control flow warnings. -- N_Block_Statement -- Sloc points to DECLARE or BEGIN -- Identifier block direct name (set to Empty if not present) -- Declarations (set to No_List if no DECLARE part) -- Handled_Statement_Sequence -- Activation_Chain_Entity -- Cleanup_Actions -- Has_Created_Identifier -- Is_Asynchronous_Call_Block -- Is_Task_Allocation_Block -- Exception_Junk -- Is_Abort_Block -- Is_Finalization_Wrapper -- Is_Initialization_Block -- Is_Task_Master ------------------------- -- 5.7 Exit Statement -- ------------------------- -- EXIT_STATEMENT ::= exit [loop_NAME] [when CONDITION]; -- Gigi restriction: The expander ensures that the type of the Condition -- field is always Standard.Boolean, even if the type in the source is -- some non-standard boolean type. -- N_Exit_Statement -- Sloc points to EXIT -- Name (set to Empty if no loop name present) -- Condition (set to Empty if no WHEN part present) -- Next_Exit_Statement : Next exit on chain ------------------------- -- 5.9 Goto Statement -- ------------------------- -- GOTO_STATEMENT ::= goto label_NAME; -- N_Goto_Statement -- Sloc points to GOTO -- Name -- Exception_Junk --------------------------------- -- 6.1 Subprogram Declaration -- --------------------------------- -- SUBPROGRAM_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION -- [ASPECT_SPECIFICATIONS]; -- N_Subprogram_Declaration -- Sloc points to FUNCTION or PROCEDURE -- Specification -- Body_To_Inline -- Corresponding_Body -- Parent_Spec -- Is_Entry_Barrier_Function -- Is_Task_Body_Procedure ------------------------------------------ -- 6.1 Abstract Subprogram Declaration -- ------------------------------------------ -- ABSTRACT_SUBPROGRAM_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION is abstract -- [ASPECT_SPECIFICATIONS]; -- N_Abstract_Subprogram_Declaration -- Sloc points to ABSTRACT -- Specification ----------------------------------- -- 6.1 Subprogram Specification -- ----------------------------------- -- SUBPROGRAM_SPECIFICATION ::= -- [[not] overriding] -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE -- | [[not] overriding] -- function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE -- Note: there are no separate nodes for the profiles, instead the -- information appears directly in the following nodes. -- N_Function_Specification -- Sloc points to FUNCTION -- Defining_Unit_Name (the designator) -- Parameter_Specifications (set to No_List if no formal part) -- Null_Exclusion_Present -- Result_Definition for result subtype -- Generic_Parent -- Must_Override set if overriding indicator present -- Must_Not_Override set if not_overriding indicator present -- N_Procedure_Specification -- Sloc points to PROCEDURE -- Defining_Unit_Name -- Null_Statement NULL statement for body, if Null_Present -- Parameter_Specifications (set to No_List if no formal part) -- Generic_Parent -- Null_Present set for null procedure case (Ada 2005 feature) -- Must_Override set if overriding indicator present -- Must_Not_Override set if not_overriding indicator present -- Note: overriding indicator is an Ada 2005 feature --------------------- -- 6.1 Designator -- --------------------- -- DESIGNATOR ::= -- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL -- Designators that are simply identifiers or operator symbols appear -- directly in the tree in this form. The following node is used only -- in the case where the designator has a parent unit name component. -- N_Designator -- Sloc points to period -- Name holds the parent unit name -- Identifier -- Note: Name is always non-Empty, since this node is only used for the -- case where a parent library unit package name is present. -- Note that the identifier can also be an operator symbol here ------------------------------ -- 6.1 Defining Designator -- ------------------------------ -- DEFINING_DESIGNATOR ::= -- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL ------------------------------------- -- 6.1 Defining Program Unit Name -- ------------------------------------- -- DEFINING_PROGRAM_UNIT_NAME ::= -- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER -- The parent unit name is present only in the case of a child unit name -- (permissible only for Ada 95 for a library level unit, i.e. a unit -- at scope level one). If no such name is present, the defining program -- unit name is represented simply as the defining identifier. In the -- child unit case, the following node is used to represent the child -- unit name. -- N_Defining_Program_Unit_Name -- Sloc points to period -- Name holds the parent unit name -- Defining_Identifier -- Note: Name is always non-Empty, since this node is only used for the -- case where a parent unit name is present. -------------------------- -- 6.1 Operator Symbol -- -------------------------- -- OPERATOR_SYMBOL ::= STRING_LITERAL -- Note: the fields of the N_Operator_Symbol node are laid out to match -- the corresponding fields of an N_Character_Literal node. This allows -- easy conversion of the operator symbol node into a character literal -- node in the case where a string constant of the form of an operator -- symbol is scanned out as such, but turns out semantically to be a -- string literal that is not an operator. For details see Sinfo.CN. -- Change_Operator_Symbol_To_String_Literal. -- N_Operator_Symbol -- Sloc points to literal -- Chars contains the Name_Id for the operator symbol -- Strval Id of string value. This is used if the operator -- symbol turns out to be a normal string after all. -- Entity -- Associated_Node Note this is shared with Entity -- Etype -- Has_Private_View (set in generic units) -- Note: the Strval field may be set to No_String for generated -- operator symbols that are known not to be string literals -- semantically. ----------------------------------- -- 6.1 Defining Operator Symbol -- ----------------------------------- -- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL -- A defining operator symbol is an entity, which has additional -- fields depending on the setting of the Ekind field. These -- additional fields are defined (and access subprograms declared) -- in package Einfo. -- Note: N_Defining_Operator_Symbol is an extended node whose fields -- are deliberately laid out to match the layout of fields in an -- ordinary N_Operator_Symbol node allowing for easy alteration of -- an operator symbol node into a defining operator symbol node. -- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol -- for further details. -- N_Defining_Operator_Symbol -- Sloc points to literal -- Chars contains the Name_Id for the operator symbol -- Next_Entity -- Scope -- Etype ---------------------------- -- 6.1 Parameter Profile -- ---------------------------- -- PARAMETER_PROFILE ::= [FORMAL_PART] --------------------------------------- -- 6.1 Parameter and Result Profile -- --------------------------------------- -- PARAMETER_AND_RESULT_PROFILE ::= -- [FORMAL_PART] return [NULL_EXCLUSION] SUBTYPE_MARK -- | [FORMAL_PART] return ACCESS_DEFINITION -- There is no explicit node in the tree for a parameter and result -- profile. Instead the information appears directly in the parent. ---------------------- -- 6.1 Formal Part -- ---------------------- -- FORMAL_PART ::= -- (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION}) ---------------------------------- -- 6.1 Parameter Specification -- ---------------------------------- -- PARAMETER_SPECIFICATION ::= -- DEFINING_IDENTIFIER_LIST : [ALIASED] MODE [NULL_EXCLUSION] -- SUBTYPE_MARK [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS] -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION -- [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS] -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive specifications were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single Specifications, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- ALIASED can only be present in Ada 2012 mode -- N_Parameter_Specification -- Sloc points to first identifier -- Defining_Identifier -- Aliased_Present -- In_Present -- Out_Present -- Null_Exclusion_Present -- Parameter_Type subtype mark or access definition -- Expression (set to Empty if no default expression present) -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) -- Default_Expression --------------- -- 6.1 Mode -- --------------- -- MODE ::= [in] | in out | out -- There is no explicit node in the tree for the Mode. Instead the -- In_Present and Out_Present flags are set in the parent node to -- record the presence of keywords specifying the mode. -------------------------- -- 6.3 Subprogram Body -- -------------------------- -- SUBPROGRAM_BODY ::= -- SUBPROGRAM_SPECIFICATION [ASPECT_SPECIFICATIONS] is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [DESIGNATOR]; -- N_Subprogram_Body -- Sloc points to FUNCTION or PROCEDURE -- Specification -- Declarations -- Handled_Statement_Sequence -- Activation_Chain_Entity -- Corresponding_Spec -- Acts_As_Spec -- Bad_Is_Detected used only by parser -- Do_Storage_Check -- Has_Relative_Deadline_Pragma -- Is_Entry_Barrier_Function -- Is_Protected_Subprogram_Body -- Is_Task_Body_Procedure -- Is_Task_Master -- Was_Attribute_Reference -- Was_Expression_Function -- Was_Originally_Stub ----------------------------------- -- 6.4 Procedure Call Statement -- ----------------------------------- -- PROCEDURE_CALL_STATEMENT ::= -- procedure_NAME; | procedure_PREFIX ACTUAL_PARAMETER_PART; -- Note: the reason that a procedure call has expression fields is that -- it semantically resembles an expression, e.g. overloading is allowed -- and a type is concocted for semantic processing purposes. Certain of -- these fields, such as Parens are not relevant, but it is easier to -- just supply all of them together. -- N_Procedure_Call_Statement -- Sloc points to first token of name or prefix -- Name stores name or prefix -- Parameter_Associations (set to No_List if no -- actual parameter part) -- First_Named_Actual -- Controlling_Argument (set to Empty if not dispatching) -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- No_Elaboration_Check -- Is_Known_Guaranteed_ABE -- plus fields for expression -- If any IN parameter requires a range check, then the corresponding -- argument expression has the Do_Range_Check flag set, and the range -- check is done against the formal type. Note that this argument -- expression may appear directly in the Parameter_Associations list, -- or may be a descendant of an N_Parameter_Association node that -- appears in this list. ------------------------ -- 6.4 Function Call -- ------------------------ -- FUNCTION_CALL ::= -- function_NAME | function_PREFIX ACTUAL_PARAMETER_PART -- Note: the parser may generate an indexed component node or simply -- a name node instead of a function call node. The semantic pass must -- correct this misidentification. -- N_Function_Call -- Sloc points to first token of name or prefix -- Name stores name or prefix -- Parameter_Associations (set to No_List if no -- actual parameter part) -- First_Named_Actual -- Controlling_Argument (set to Empty if not dispatching) -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- No_Elaboration_Check -- Is_Expanded_Build_In_Place_Call -- No_Side_Effect_Removal -- Is_Known_Guaranteed_ABE -- plus fields for expression -------------------------------- -- 6.4 Actual Parameter Part -- -------------------------------- -- ACTUAL_PARAMETER_PART ::= -- (PARAMETER_ASSOCIATION {,PARAMETER_ASSOCIATION}) -------------------------------- -- 6.4 Parameter Association -- -------------------------------- -- PARAMETER_ASSOCIATION ::= -- [formal_parameter_SELECTOR_NAME =>] EXPLICIT_ACTUAL_PARAMETER -- Note: the N_Parameter_Association node is built only if a formal -- parameter selector name is present, otherwise the parameter -- association appears in the tree simply as the node for the -- explicit actual parameter. -- N_Parameter_Association -- Sloc points to formal parameter -- Selector_Name (always non-Empty) -- Explicit_Actual_Parameter -- Next_Named_Actual -- Is_Accessibility_Actual --------------------------- -- 6.4 Actual Parameter -- --------------------------- -- EXPLICIT_ACTUAL_PARAMETER ::= -- EXPRESSION | variable_NAME | REDUCTION_EXPRESSION_PARAMETER --------------------------- -- 6.5 Return Statement -- --------------------------- -- SIMPLE_RETURN_STATEMENT ::= return [EXPRESSION]; -- EXTENDED_RETURN_STATEMENT ::= -- return DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION -- [:= EXPRESSION] [do -- HANDLED_SEQUENCE_OF_STATEMENTS -- end return]; -- RETURN_SUBTYPE_INDICATION ::= SUBTYPE_INDICATION | ACCESS_DEFINITION -- The term "return statement" is defined in 6.5 to mean either a -- SIMPLE_RETURN_STATEMENT or an EXTENDED_RETURN_STATEMENT. We avoid -- the use of this term, since it used to mean someting else in earlier -- versions of Ada. -- N_Simple_Return_Statement -- Sloc points to RETURN -- Return_Statement_Entity -- Expression (set to Empty if no expression present) -- Storage_Pool -- Procedure_To_Call -- By_Ref -- Comes_From_Extended_Return_Statement -- Note: Return_Statement_Entity points to an E_Return_Statement -- If a range check is required, then Do_Range_Check is set on the -- Expression. The check is against the return subtype of the function. -- N_Extended_Return_Statement -- Sloc points to RETURN -- Return_Statement_Entity -- Return_Object_Declarations -- Handled_Statement_Sequence (set to Empty if not present) -- Storage_Pool -- Procedure_To_Call -- By_Ref -- Note: Return_Statement_Entity points to an E_Return_Statement. -- Note that Return_Object_Declarations is a list containing the -- N_Object_Declaration -- see comment on this field above. -- The declared object will have Is_Return_Object = True. -- There is no such syntactic category as return_object_declaration -- in the RM. Return_Object_Declarations represents this portion of -- the syntax for EXTENDED_RETURN_STATEMENT: -- DEFINING_IDENTIFIER : [aliased] RETURN_SUBTYPE_INDICATION -- [:= EXPRESSION] -- There are two entities associated with an extended_return_statement: -- the Return_Statement_Entity represents the statement itself, -- and the Defining_Identifier of the Object_Declaration in -- Return_Object_Declarations represents the object being -- returned. N_Simple_Return_Statement has only the former. ------------------------------ -- 6.8 Expression Function -- ------------------------------ -- EXPRESSION_FUNCTION ::= -- FUNCTION SPECIFICATION IS (EXPRESSION) -- [ASPECT_SPECIFICATIONS]; -- N_Expression_Function -- Sloc points to FUNCTION -- Specification -- Expression -- Corresponding_Spec ------------------------------ -- 7.1 Package Declaration -- ------------------------------ -- PACKAGE_DECLARATION ::= -- PACKAGE_SPECIFICATION; -- Note: the activation chain entity for a package spec is used for -- all tasks declared in the package spec, or in the package body. -- N_Package_Declaration -- Sloc points to PACKAGE -- Specification -- Corresponding_Body -- Parent_Spec -- Activation_Chain_Entity -------------------------------- -- 7.1 Package Specification -- -------------------------------- -- PACKAGE_SPECIFICATION ::= -- package DEFINING_PROGRAM_UNIT_NAME -- [ASPECT_SPECIFICATIONS] -- is -- {BASIC_DECLARATIVE_ITEM} -- [private -- {BASIC_DECLARATIVE_ITEM}] -- end [[PARENT_UNIT_NAME .] IDENTIFIER] -- N_Package_Specification -- Sloc points to PACKAGE -- Defining_Unit_Name -- Visible_Declarations -- Private_Declarations (set to No_List if no private -- part present) -- End_Label -- Generic_Parent -- Limited_View_Installed ----------------------- -- 7.1 Package Body -- ----------------------- -- PACKAGE_BODY ::= -- package body DEFINING_PROGRAM_UNIT_NAME -- [ASPECT_SPECIFICATIONS] -- is -- DECLARATIVE_PART -- [begin -- HANDLED_SEQUENCE_OF_STATEMENTS] -- end [[PARENT_UNIT_NAME .] IDENTIFIER]; -- N_Package_Body -- Sloc points to PACKAGE -- Defining_Unit_Name -- Declarations -- Handled_Statement_Sequence (set to Empty if no HSS present) -- Corresponding_Spec -- Was_Originally_Stub -- Note: if a source level package does not contain a handled sequence -- of statements, then the parser supplies a dummy one with a null -- sequence of statements. Comes_From_Source will be False in this -- constructed sequence. The reason we need this is for the End_Label -- field in the HSS. ----------------------------------- -- 7.4 Private Type Declaration -- ----------------------------------- -- PRIVATE_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] -- is [[abstract] tagged] [limited] private -- [ASPECT_SPECIFICATIONS]; -- Note: TAGGED is not permitted in Ada 83 mode -- N_Private_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier -- Discriminant_Specifications (set to No_List if no -- discriminant part) -- Unknown_Discriminants_Present set if (<>) discriminant -- Abstract_Present -- Tagged_Present -- Limited_Present ---------------------------------------- -- 7.4 Private Extension Declaration -- ---------------------------------------- -- PRIVATE_EXTENSION_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is -- [abstract] [limited | synchronized] -- new ancestor_SUBTYPE_INDICATION [and INTERFACE_LIST] -- with private [ASPECT_SPECIFICATIONS]; -- Note: LIMITED, and private extension declarations are not allowed -- in Ada 83 mode. -- N_Private_Extension_Declaration -- Sloc points to TYPE -- Defining_Identifier -- Uninitialized_Variable -- Discriminant_Specifications (set to No_List if no -- discriminant part) -- Unknown_Discriminants_Present set if (<>) discriminant -- Abstract_Present -- Limited_Present -- Synchronized_Present -- Subtype_Indication -- Interface_List (set to No_List if none) --------------------- -- 8.4 Use Clause -- --------------------- -- USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE ----------------------------- -- 8.4 Use Package Clause -- ----------------------------- -- USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME}; -- N_Use_Package_Clause -- Sloc points to USE -- Prev_Use_Clause -- Name -- Next_Use_Clause -- Associated_Node -- Hidden_By_Use_Clause -- Is_Effective_Use_Clause -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) -------------------------- -- 8.4 Use Type Clause -- -------------------------- -- USE_TYPE_CLAUSE ::= use [ALL] type SUBTYPE_MARK {, SUBTYPE_MARK}; -- Note: use type clause is not permitted in Ada 83 mode -- Note: the ALL keyword can appear only in Ada 2012 mode -- N_Use_Type_Clause -- Sloc points to USE -- Prev_Use_Clause -- Used_Operations -- Next_Use_Clause -- Subtype_Mark -- Hidden_By_Use_Clause -- Is_Effective_Use_Clause -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) -- All_Present ------------------------------- -- 8.5 Renaming Declaration -- ------------------------------- -- RENAMING_DECLARATION ::= -- OBJECT_RENAMING_DECLARATION -- | EXCEPTION_RENAMING_DECLARATION -- | PACKAGE_RENAMING_DECLARATION -- | SUBPROGRAM_RENAMING_DECLARATION -- | GENERIC_RENAMING_DECLARATION -------------------------------------- -- 8.5 Object Renaming Declaration -- -------------------------------------- -- OBJECT_RENAMING_DECLARATION ::= -- DEFINING_IDENTIFIER : -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER : -- ACCESS_DEFINITION renames object_NAME -- [ASPECT_SPECIFICATIONS]; -- Note: Access_Definition is an optional field that gives support to -- Ada 2005 (AI-230). The parser generates nodes that have either the -- Subtype_Indication field or else the Access_Definition field. -- N_Object_Renaming_Declaration -- Sloc points to first identifier -- Defining_Identifier -- Null_Exclusion_Present (set to False if not present) -- Subtype_Mark (set to Empty if not present) -- Access_Definition (set to Empty if not present) -- Name -- Corresponding_Generic_Association ----------------------------------------- -- 8.5 Exception Renaming Declaration -- ----------------------------------------- -- EXCEPTION_RENAMING_DECLARATION ::= -- DEFINING_IDENTIFIER : exception renames exception_NAME -- [ASPECT_SPECIFICATIONS]; -- N_Exception_Renaming_Declaration -- Sloc points to first identifier -- Defining_Identifier -- Name --------------------------------------- -- 8.5 Package Renaming Declaration -- --------------------------------------- -- PACKAGE_RENAMING_DECLARATION ::= -- package DEFINING_PROGRAM_UNIT_NAME renames package_NAME -- [ASPECT_SPECIFICATIONS]; -- N_Package_Renaming_Declaration -- Sloc points to PACKAGE -- Defining_Unit_Name -- Name -- Parent_Spec ------------------------------------------ -- 8.5 Subprogram Renaming Declaration -- ------------------------------------------ -- SUBPROGRAM_RENAMING_DECLARATION ::= -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME -- [ASPECT_SPECIFICATIONS]; -- N_Subprogram_Renaming_Declaration -- Sloc points to RENAMES -- Specification -- Name -- Parent_Spec -- Corresponding_Spec -- Corresponding_Formal_Spec -- From_Default ----------------------------------------- -- 8.5.5 Generic Renaming Declaration -- ----------------------------------------- -- GENERIC_RENAMING_DECLARATION ::= -- generic package DEFINING_PROGRAM_UNIT_NAME -- renames generic_package_NAME -- [ASPECT_SPECIFICATIONS]; -- | generic procedure DEFINING_PROGRAM_UNIT_NAME -- renames generic_procedure_NAME -- [ASPECT_SPECIFICATIONS]; -- | generic function DEFINING_PROGRAM_UNIT_NAME -- renames generic_function_NAME -- [ASPECT_SPECIFICATIONS]; -- N_Generic_Package_Renaming_Declaration -- Sloc points to GENERIC -- Defining_Unit_Name -- Name -- Parent_Spec -- N_Generic_Procedure_Renaming_Declaration -- Sloc points to GENERIC -- Defining_Unit_Name -- Name -- Parent_Spec -- N_Generic_Function_Renaming_Declaration -- Sloc points to GENERIC -- Defining_Unit_Name -- Name -- Parent_Spec -------------------------------- -- 9.1 Task Type Declaration -- -------------------------------- -- TASK_TYPE_DECLARATION ::= -- task type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] -- [ASPECT_SPECIFICATIONS] -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- N_Task_Type_Declaration -- Sloc points to TASK -- Defining_Identifier -- Discriminant_Specifications (set to No_List if no -- discriminant part) -- Interface_List (set to No_List if none) -- Task_Definition (set to Empty if not present) -- Corresponding_Body ---------------------------------- -- 9.1 Single Task Declaration -- ---------------------------------- -- SINGLE_TASK_DECLARATION ::= -- task DEFINING_IDENTIFIER -- [ASPECT_SPECIFICATIONS] -- [is [new INTERFACE_LIST with] TASK_DEFINITION]; -- N_Single_Task_Declaration -- Sloc points to TASK -- Defining_Identifier -- Interface_List (set to No_List if none) -- Task_Definition (set to Empty if not present) -------------------------- -- 9.1 Task Definition -- -------------------------- -- TASK_DEFINITION ::= -- {TASK_ITEM} -- [private -- {TASK_ITEM}] -- end [task_IDENTIFIER] -- Note: as a result of semantic analysis, the list of task items can -- include implicit type declarations resulting from entry families. -- N_Task_Definition -- Sloc points to first token of task definition -- Visible_Declarations -- Private_Declarations (set to No_List if no private part) -- End_Label -- Has_Storage_Size_Pragma -- Has_Relative_Deadline_Pragma -------------------- -- 9.1 Task Item -- -------------------- -- TASK_ITEM ::= ENTRY_DECLARATION | REPRESENTATION_CLAUSE -------------------- -- 9.1 Task Body -- -------------------- -- TASK_BODY ::= -- task body task_DEFINING_IDENTIFIER -- [ASPECT_SPECIFICATIONS] -- is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [task_IDENTIFIER]; -- Gigi restriction: This node never appears -- N_Task_Body -- Sloc points to TASK -- Defining_Identifier -- Declarations -- Handled_Statement_Sequence -- Is_Task_Master -- Activation_Chain_Entity -- Corresponding_Spec -- Was_Originally_Stub ------------------------------------- -- 9.4 Protected Type Declaration -- ------------------------------------- -- PROTECTED_TYPE_DECLARATION ::= -- protected type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] -- [ASPECT_SPECIFICATIONS] -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- Note: protected type declarations are not permitted in Ada 83 mode -- N_Protected_Type_Declaration -- Sloc points to PROTECTED -- Defining_Identifier -- Discriminant_Specifications (set to No_List if no -- discriminant part) -- Interface_List (set to No_List if none) -- Protected_Definition -- Corresponding_Body --------------------------------------- -- 9.4 Single Protected Declaration -- --------------------------------------- -- SINGLE_PROTECTED_DECLARATION ::= -- protected DEFINING_IDENTIFIER -- [ASPECT_SPECIFICATIONS] -- is [new INTERFACE_LIST with] PROTECTED_DEFINITION; -- Note: single protected declarations are not allowed in Ada 83 mode -- N_Single_Protected_Declaration -- Sloc points to PROTECTED -- Defining_Identifier -- Interface_List (set to No_List if none) -- Protected_Definition ------------------------------- -- 9.4 Protected Definition -- ------------------------------- -- PROTECTED_DEFINITION ::= -- {PROTECTED_OPERATION_DECLARATION} -- [private -- {PROTECTED_ELEMENT_DECLARATION}] -- end [protected_IDENTIFIER] -- N_Protected_Definition -- Sloc points to first token of protected definition -- Visible_Declarations -- Private_Declarations (set to No_List if no private part) -- End_Label ------------------------------------------ -- 9.4 Protected Operation Declaration -- ------------------------------------------ -- PROTECTED_OPERATION_DECLARATION ::= -- SUBPROGRAM_DECLARATION -- | ENTRY_DECLARATION -- | REPRESENTATION_CLAUSE ---------------------------------------- -- 9.4 Protected Element Declaration -- ---------------------------------------- -- PROTECTED_ELEMENT_DECLARATION ::= -- PROTECTED_OPERATION_DECLARATION | COMPONENT_DECLARATION ------------------------- -- 9.4 Protected Body -- ------------------------- -- PROTECTED_BODY ::= -- protected body DEFINING_IDENTIFIER -- [ASPECT_SPECIFICATIONS]; -- is -- {PROTECTED_OPERATION_ITEM} -- end [protected_IDENTIFIER]; -- Note: protected bodies are not allowed in Ada 83 mode -- Gigi restriction: This node never appears -- N_Protected_Body -- Sloc points to PROTECTED -- Defining_Identifier -- Declarations protected operation items (and pragmas) -- End_Label -- Corresponding_Spec -- Was_Originally_Stub ----------------------------------- -- 9.4 Protected Operation Item -- ----------------------------------- -- PROTECTED_OPERATION_ITEM ::= -- SUBPROGRAM_DECLARATION -- | SUBPROGRAM_BODY -- | ENTRY_BODY -- | REPRESENTATION_CLAUSE ------------------------------ -- 9.5.2 Entry Declaration -- ------------------------------ -- ENTRY_DECLARATION ::= -- [[not] overriding] -- entry DEFINING_IDENTIFIER -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE -- [ASPECT_SPECIFICATIONS]; -- N_Entry_Declaration -- Sloc points to ENTRY -- Defining_Identifier -- Discrete_Subtype_Definition (set to Empty if not present) -- Parameter_Specifications (set to No_List if no formal part) -- Corresponding_Body -- Must_Override set if overriding indicator present -- Must_Not_Override set if not_overriding indicator present -- Note: overriding indicator is an Ada 2005 feature ----------------------------- -- 9.5.2 Accept statement -- ----------------------------- -- ACCEPT_STATEMENT ::= -- accept entry_DIRECT_NAME -- [(ENTRY_INDEX)] PARAMETER_PROFILE [do -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [entry_IDENTIFIER]]; -- Gigi restriction: This node never appears -- Note: there are no explicit declarations allowed in an accept -- statement. However, the implicit declarations for any statement -- identifiers (labels and block/loop identifiers) are declarations -- that belong logically to the accept statement, and that is why -- there is a Declarations field in this node. -- N_Accept_Statement -- Sloc points to ACCEPT -- Entry_Direct_Name -- Entry_Index (set to Empty if not present) -- Parameter_Specifications (set to No_List if no formal part) -- Handled_Statement_Sequence -- Declarations (set to No_List if no declarations) ------------------------ -- 9.5.2 Entry Index -- ------------------------ -- ENTRY_INDEX ::= EXPRESSION ----------------------- -- 9.5.2 Entry Body -- ----------------------- -- ENTRY_BODY ::= -- entry DEFINING_IDENTIFIER ENTRY_BODY_FORMAL_PART ENTRY_BARRIER is -- DECLARATIVE_PART -- begin -- HANDLED_SEQUENCE_OF_STATEMENTS -- end [entry_IDENTIFIER]; -- ENTRY_BARRIER ::= when CONDITION -- Note: we store the CONDITION of the ENTRY_BARRIER in the node for -- the ENTRY_BODY_FORMAL_PART to avoid the N_Entry_Body node getting -- too full (it would otherwise have too many fields) -- Gigi restriction: This node never appears -- N_Entry_Body -- Sloc points to ENTRY -- Defining_Identifier -- Entry_Body_Formal_Part -- Declarations -- Handled_Statement_Sequence -- Activation_Chain_Entity ----------------------------------- -- 9.5.2 Entry Body Formal Part -- ----------------------------------- -- ENTRY_BODY_FORMAL_PART ::= -- [(ENTRY_INDEX_SPECIFICATION)] PARAMETER_PROFILE -- Note that an entry body formal part node is present even if it is -- empty. This reflects the grammar, in which it is the components of -- the entry body formal part that are optional, not the entry body -- formal part itself. Also this means that the barrier condition -- always has somewhere to be stored. -- Gigi restriction: This node never appears -- N_Entry_Body_Formal_Part -- Sloc points to first token -- Entry_Index_Specification (set to Empty if not present) -- Parameter_Specifications (set to No_List if no formal part) -- Condition from entry barrier of entry body -------------------------- -- 9.5.2 Entry Barrier -- -------------------------- -- ENTRY_BARRIER ::= when CONDITION -------------------------------------- -- 9.5.2 Entry Index Specification -- -------------------------------------- -- ENTRY_INDEX_SPECIFICATION ::= -- for DEFINING_IDENTIFIER in DISCRETE_SUBTYPE_DEFINITION -- Gigi restriction: This node never appears -- N_Entry_Index_Specification -- Sloc points to FOR -- Defining_Identifier -- Discrete_Subtype_Definition --------------------------------- -- 9.5.3 Entry Call Statement -- --------------------------------- -- ENTRY_CALL_STATEMENT ::= entry_NAME [ACTUAL_PARAMETER_PART]; -- The parser may generate a procedure call for this construct. The -- semantic pass must correct this misidentification where needed. -- Gigi restriction: This node never appears -- N_Entry_Call_Statement -- Sloc points to first token of name -- Name -- Parameter_Associations (set to No_List if no -- actual parameter part) -- First_Named_Actual -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node ------------------------------ -- 9.5.4 Requeue Statement -- ------------------------------ -- REQUEUE_STATEMENT ::= requeue entry_NAME [with abort]; -- Note: requeue statements are not permitted in Ada 83 mode -- Gigi restriction: This node never appears -- N_Requeue_Statement -- Sloc points to REQUEUE -- Name -- Abort_Present -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -------------------------- -- 9.6 Delay Statement -- -------------------------- -- DELAY_STATEMENT ::= -- DELAY_UNTIL_STATEMENT -- | DELAY_RELATIVE_STATEMENT -------------------------------- -- 9.6 Delay Until Statement -- -------------------------------- -- DELAY_UNTIL_STATEMENT ::= delay until delay_EXPRESSION; -- Note: delay until statements are not permitted in Ada 83 mode -- Gigi restriction: This node never appears -- N_Delay_Until_Statement -- Sloc points to DELAY -- Expression ----------------------------------- -- 9.6 Delay Relative Statement -- ----------------------------------- -- DELAY_RELATIVE_STATEMENT ::= delay delay_EXPRESSION; -- Gigi restriction: This node never appears -- N_Delay_Relative_Statement -- Sloc points to DELAY -- Expression --------------------------- -- 9.7 Select Statement -- --------------------------- -- SELECT_STATEMENT ::= -- SELECTIVE_ACCEPT -- | TIMED_ENTRY_CALL -- | CONDITIONAL_ENTRY_CALL -- | ASYNCHRONOUS_SELECT ----------------------------- -- 9.7.1 Selective Accept -- ----------------------------- -- SELECTIVE_ACCEPT ::= -- select -- [GUARD] -- SELECT_ALTERNATIVE -- {or -- [GUARD] -- SELECT_ALTERNATIVE} -- [else -- SEQUENCE_OF_STATEMENTS] -- end select; -- Gigi restriction: This node never appears -- Note: the guard expression, if present, appears in the node for -- the select alternative. -- N_Selective_Accept -- Sloc points to SELECT -- Select_Alternatives -- Else_Statements (set to No_List if no else part) ------------------ -- 9.7.1 Guard -- ------------------ -- GUARD ::= when CONDITION => -- As noted above, the CONDITION that is part of a GUARD is included -- in the node for the select alternative for convenience. ------------------------------- -- 9.7.1 Select Alternative -- ------------------------------- -- SELECT_ALTERNATIVE ::= -- ACCEPT_ALTERNATIVE -- | DELAY_ALTERNATIVE -- | TERMINATE_ALTERNATIVE ------------------------------- -- 9.7.1 Accept Alternative -- ------------------------------- -- ACCEPT_ALTERNATIVE ::= -- ACCEPT_STATEMENT [SEQUENCE_OF_STATEMENTS] -- Gigi restriction: This node never appears -- N_Accept_Alternative -- Sloc points to ACCEPT -- Accept_Statement -- Condition from the guard (set to Empty if no guard present) -- Statements (set to Empty_List if no statements) -- Pragmas_Before pragmas before alt (set to No_List if none) -- Accept_Handler_Records ------------------------------ -- 9.7.1 Delay Alternative -- ------------------------------ -- DELAY_ALTERNATIVE ::= -- DELAY_STATEMENT [SEQUENCE_OF_STATEMENTS] -- Gigi restriction: This node never appears -- N_Delay_Alternative -- Sloc points to DELAY -- Delay_Statement -- Condition from the guard (set to Empty if no guard present) -- Statements (set to Empty_List if no statements) -- Pragmas_Before pragmas before alt (set to No_List if none) ---------------------------------- -- 9.7.1 Terminate Alternative -- ---------------------------------- -- TERMINATE_ALTERNATIVE ::= terminate; -- Gigi restriction: This node never appears -- N_Terminate_Alternative -- Sloc points to TERMINATE -- Condition from the guard (set to Empty if no guard present) -- Pragmas_Before pragmas before alt (set to No_List if none) -- Pragmas_After pragmas after alt (set to No_List if none) ----------------------------- -- 9.7.2 Timed Entry Call -- ----------------------------- -- TIMED_ENTRY_CALL ::= -- select -- ENTRY_CALL_ALTERNATIVE -- or -- DELAY_ALTERNATIVE -- end select; -- Gigi restriction: This node never appears -- N_Timed_Entry_Call -- Sloc points to SELECT -- Entry_Call_Alternative -- Delay_Alternative ----------------------------------- -- 9.7.2 Entry Call Alternative -- ----------------------------------- -- ENTRY_CALL_ALTERNATIVE ::= -- PROCEDURE_OR_ENTRY_CALL [SEQUENCE_OF_STATEMENTS] -- PROCEDURE_OR_ENTRY_CALL ::= -- PROCEDURE_CALL_STATEMENT | ENTRY_CALL_STATEMENT -- Gigi restriction: This node never appears -- N_Entry_Call_Alternative -- Sloc points to first token of entry call statement -- Entry_Call_Statement -- Statements (set to Empty_List if no statements) -- Pragmas_Before pragmas before alt (set to No_List if none) ----------------------------------- -- 9.7.3 Conditional Entry Call -- ----------------------------------- -- CONDITIONAL_ENTRY_CALL ::= -- select -- ENTRY_CALL_ALTERNATIVE -- else -- SEQUENCE_OF_STATEMENTS -- end select; -- Gigi restriction: This node never appears -- N_Conditional_Entry_Call -- Sloc points to SELECT -- Entry_Call_Alternative -- Else_Statements -------------------------------- -- 9.7.4 Asynchronous Select -- -------------------------------- -- ASYNCHRONOUS_SELECT ::= -- select -- TRIGGERING_ALTERNATIVE -- then abort -- ABORTABLE_PART -- end select; -- Note: asynchronous select is not permitted in Ada 83 mode -- Gigi restriction: This node never appears -- N_Asynchronous_Select -- Sloc points to SELECT -- Triggering_Alternative -- Abortable_Part ----------------------------------- -- 9.7.4 Triggering Alternative -- ----------------------------------- -- TRIGGERING_ALTERNATIVE ::= -- TRIGGERING_STATEMENT [SEQUENCE_OF_STATEMENTS] -- Gigi restriction: This node never appears -- N_Triggering_Alternative -- Sloc points to first token of triggering statement -- Triggering_Statement -- Statements (set to Empty_List if no statements) -- Pragmas_Before pragmas before alt (set to No_List if none) --------------------------------- -- 9.7.4 Triggering Statement -- --------------------------------- -- TRIGGERING_STATEMENT ::= PROCEDURE_OR_ENTRY_CALL | DELAY_STATEMENT --------------------------- -- 9.7.4 Abortable Part -- --------------------------- -- ABORTABLE_PART ::= SEQUENCE_OF_STATEMENTS -- Gigi restriction: This node never appears -- N_Abortable_Part -- Sloc points to ABORT -- Statements -------------------------- -- 9.8 Abort Statement -- -------------------------- -- ABORT_STATEMENT ::= abort task_NAME {, task_NAME}; -- Gigi restriction: This node never appears -- N_Abort_Statement -- Sloc points to ABORT -- Names ------------------------- -- 10.1.1 Compilation -- ------------------------- -- COMPILATION ::= {COMPILATION_UNIT} -- There is no explicit node in the tree for a compilation, since in -- general the compiler is processing only a single compilation unit -- at a time. It is possible to parse multiple units in syntax check -- only mode, but the trees are discarded in that case. ------------------------------ -- 10.1.1 Compilation Unit -- ------------------------------ -- COMPILATION_UNIT ::= -- CONTEXT_CLAUSE LIBRARY_ITEM -- | CONTEXT_CLAUSE SUBUNIT -- The N_Compilation_Unit node itself represents the above syntax. -- However, there are two additional items not reflected in the above -- syntax. First we have the global declarations that are added by the -- code generator. These are outer level declarations (so they cannot -- be represented as being inside the units). An example is the wrapper -- subprograms that are created to do ABE checking. As always a list of -- declarations can contain actions as well (i.e. statements), and such -- statements are executed as part of the elaboration of the unit. Note -- that all such declarations are elaborated before the library unit. -- Similarly, certain actions need to be elaborated at the completion -- of elaboration of the library unit (notably the statement that sets -- the Boolean flag indicating that elaboration is complete). -- The third item not reflected in the syntax is pragmas that appear -- after the compilation unit. As always pragmas are a problem since -- they are not part of the formal syntax, but can be stuck into the -- source following a set of ad hoc rules, and we have to find an ad -- hoc way of sticking them into the tree. For pragmas that appear -- before the library unit, we just consider them to be part of the -- context clause, and pragmas can appear in the Context_Items list -- of the compilation unit. However, pragmas can also appear after -- the library item. -- To deal with all these problems, we create an auxiliary node for -- a compilation unit, referenced from the N_Compilation_Unit node, -- that contains these items. -- N_Compilation_Unit -- Sloc points to first token of defining unit name -- Context_Items context items and pragmas preceding unit -- Private_Present set if library unit has private keyword -- Unit library item or subunit -- Aux_Decls_Node points to the N_Compilation_Unit_Aux node -- First_Inlined_Subprogram -- Library_Unit corresponding/parent spec/body -- Save_Invocation_Graph_Of_Body -- Acts_As_Spec flag for subprogram body with no spec -- Body_Required set for spec if body is required -- Has_Pragma_Suppress_All -- Context_Pending -- Has_No_Elaboration_Code -- N_Compilation_Unit_Aux -- Sloc is a copy of the Sloc from the N_Compilation_Unit node -- Declarations (set to No_List if no global declarations) -- Actions (set to No_List if no actions) -- Pragmas_After pragmas after unit (set to No_List if none) -- Config_Pragmas config pragmas (set to Empty_List if none) -- Default_Storage_Pool -------------------------- -- 10.1.1 Library Item -- -------------------------- -- LIBRARY_ITEM ::= -- [private] LIBRARY_UNIT_DECLARATION -- | LIBRARY_UNIT_BODY -- | [private] LIBRARY_UNIT_RENAMING_DECLARATION -- Note: PRIVATE is not allowed in Ada 83 mode -- There is no explicit node in the tree for library item, instead -- the declaration or body, and the flag for private if present, -- appear in the N_Compilation_Unit node. -------------------------------------- -- 10.1.1 Library Unit Declaration -- -------------------------------------- -- LIBRARY_UNIT_DECLARATION ::= -- SUBPROGRAM_DECLARATION | PACKAGE_DECLARATION -- | GENERIC_DECLARATION | GENERIC_INSTANTIATION ----------------------------------------------- -- 10.1.1 Library Unit Renaming Declaration -- ----------------------------------------------- -- LIBRARY_UNIT_RENAMING_DECLARATION ::= -- PACKAGE_RENAMING_DECLARATION -- | GENERIC_RENAMING_DECLARATION -- | SUBPROGRAM_RENAMING_DECLARATION ------------------------------- -- 10.1.1 Library unit body -- ------------------------------- -- LIBRARY_UNIT_BODY ::= SUBPROGRAM_BODY | PACKAGE_BODY ------------------------------ -- 10.1.1 Parent Unit Name -- ------------------------------ -- PARENT_UNIT_NAME ::= NAME ---------------------------- -- 10.1.2 Context clause -- ---------------------------- -- CONTEXT_CLAUSE ::= {CONTEXT_ITEM} -- The context clause can include pragmas, and any pragmas that appear -- before the context clause proper (i.e. all configuration pragmas, -- also appear at the front of this list). -------------------------- -- 10.1.2 Context_Item -- -------------------------- -- CONTEXT_ITEM ::= WITH_CLAUSE | USE_CLAUSE | WITH_TYPE_CLAUSE ------------------------- -- 10.1.2 With clause -- ------------------------- -- WITH_CLAUSE ::= -- with library_unit_NAME {,library_unit_NAME}; -- A separate With clause is built for each name, so that we have -- a Corresponding_Spec field for each with'ed spec. The flags -- First_Name and Last_Name are used to reconstruct the exact -- source form. When a list of names appears in one with clause, -- the first name in the list has First_Name set, and the last -- has Last_Name set. If the with clause has only one name, then -- both of the flags First_Name and Last_Name are set in this name. -- Note: in the case of implicit with's that are installed by the -- Rtsfind routine, Implicit_With is set, and the Sloc is typically -- set to Standard_Location, but it is incorrect to test the Sloc -- to find out if a with clause is implicit, test the flag instead. -- N_With_Clause -- Sloc points to first token of library unit name -- Name -- Private_Present set if with_clause has private keyword -- Limited_Present set if LIMITED is present -- Next_Implicit_With -- Library_Unit -- Corresponding_Spec -- First_Name (set to True if first name or only one name) -- Last_Name (set to True if last name or only one name) -- Context_Installed -- Elaborate_Present -- Elaborate_All_Present -- Elaborate_All_Desirable -- Elaborate_Desirable -- Implicit_With -- Limited_View_Installed -- Parent_With -- Unreferenced_In_Spec -- No_Entities_Ref_In_Spec -- Note: Limited_Present and Limited_View_Installed are used to support -- the implementation of Ada 2005 (AI-50217). -- Similarly, Private_Present is used to support the implementation of -- Ada 2005 (AI-50262). -- Note: if the WITH clause refers to a standard library unit, then a -- limited with clause is changed into a normal with clause, because we -- are not prepared to deal with limited with in the context of Rtsfind. -- So in this case, the Limited_Present flag will be False in the final -- tree. ---------------------- -- With_Type clause -- ---------------------- -- This is a GNAT extension, used to implement mutually recursive -- types declared in different packages. -- Note: this is now obsolete. The functionality of this construct -- is now implemented by the Ada 2005 limited_with_clause. --------------------- -- 10.2 Body stub -- --------------------- -- BODY_STUB ::= -- SUBPROGRAM_BODY_STUB -- | PACKAGE_BODY_STUB -- | TASK_BODY_STUB -- | PROTECTED_BODY_STUB ---------------------------------- -- 10.1.3 Subprogram Body Stub -- ---------------------------------- -- SUBPROGRAM_BODY_STUB ::= -- SUBPROGRAM_SPECIFICATION is separate -- [ASPECT_SPECIFICATION]; -- N_Subprogram_Body_Stub -- Sloc points to FUNCTION or PROCEDURE -- Specification -- Corresponding_Spec_Of_Stub -- Library_Unit points to the subunit -- Corresponding_Body ------------------------------- -- 10.1.3 Package Body Stub -- ------------------------------- -- PACKAGE_BODY_STUB ::= -- package body DEFINING_IDENTIFIER is separate -- [ASPECT_SPECIFICATION]; -- N_Package_Body_Stub -- Sloc points to PACKAGE -- Defining_Identifier -- Corresponding_Spec_Of_Stub -- Library_Unit points to the subunit -- Corresponding_Body ---------------------------- -- 10.1.3 Task Body Stub -- ---------------------------- -- TASK_BODY_STUB ::= -- task body DEFINING_IDENTIFIER is separate -- [ASPECT_SPECIFICATION]; -- N_Task_Body_Stub -- Sloc points to TASK -- Defining_Identifier -- Corresponding_Spec_Of_Stub -- Library_Unit points to the subunit -- Corresponding_Body --------------------------------- -- 10.1.3 Protected Body Stub -- --------------------------------- -- PROTECTED_BODY_STUB ::= -- protected body DEFINING_IDENTIFIER is separate -- [ASPECT_SPECIFICATION]; -- Note: protected body stubs are not allowed in Ada 83 mode -- N_Protected_Body_Stub -- Sloc points to PROTECTED -- Defining_Identifier -- Corresponding_Spec_Of_Stub -- Library_Unit points to the subunit -- Corresponding_Body --------------------- -- 10.1.3 Subunit -- --------------------- -- SUBUNIT ::= separate (PARENT_UNIT_NAME) PROPER_BODY -- N_Subunit -- Sloc points to SEPARATE -- Name is the name of the parent unit -- Proper_Body is the subunit body -- Corresponding_Stub is the stub declaration for the unit. --------------------------------- -- 11.1 Exception Declaration -- --------------------------------- -- EXCEPTION_DECLARATION ::= DEFINING_IDENTIFIER_LIST : exception -- [ASPECT_SPECIFICATIONS]; -- For consistency with object declarations etc., the parser converts -- the case of multiple identifiers being declared to a series of -- declarations in which the expression is copied, using the More_Ids -- and Prev_Ids flags to remember the source form as described in the -- section on "Handling of Defining Identifier Lists". -- N_Exception_Declaration -- Sloc points to EXCEPTION -- Defining_Identifier -- Expression -- Renaming_Exception -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) ------------------------------------------ -- 11.2 Handled Sequence Of Statements -- ------------------------------------------ -- HANDLED_SEQUENCE_OF_STATEMENTS ::= -- SEQUENCE_OF_STATEMENTS -- [exception -- EXCEPTION_HANDLER -- {EXCEPTION_HANDLER}] -- [at end -- cleanup_procedure_call (param, param, param, ...);] -- The AT END phrase is a GNAT extension to provide for cleanups. It is -- used only internally currently, but is considered to be syntactic. -- At the moment, the only cleanup action allowed is a single call to -- a parameterless procedure, and the Identifier field of the node is -- the procedure to be called. The cleanup action occurs whenever the -- sequence of statements is left for any reason. The possible reasons -- are: -- 1. reaching the end of the sequence -- 2. exit, return, or goto -- 3. exception or abort -- For some back ends, such as gcc with ZCX, "at end" is implemented -- entirely in the back end. In this case, a handled sequence of -- statements with an "at end" cannot also have exception handlers. -- For other back ends, such as gcc with front-end SJLJ, the -- implementation is split between the front end and back end; the front -- end implements 3, and the back end implements 1 and 2. In this case, -- if there is an "at end", the front end inserts the appropriate -- exception handler, and this handler takes precedence over "at end" -- in case of exception. -- The inserted exception handler is of the form: -- when all others => -- cleanup; -- raise; -- where cleanup is the procedure to be called. The reason we do this is -- so that the front end can handle the necessary entries in the -- exception tables, and other exception handler actions required as -- part of the normal handling for exception handlers. -- The AT END cleanup handler protects only the sequence of statements -- (not the associated declarations of the parent), just like exception -- handlers. The big difference is that the cleanup procedure is called -- on either a normal or an abnormal exit from the statement sequence. -- Note: the list of Exception_Handlers can contain pragmas as well -- as actual handlers. In practice these pragmas can only occur at -- the start of the list, since any pragmas occurring later on will -- be included in the statement list of the corresponding handler. -- Note: although in the Ada syntax, the sequence of statements in -- a handled sequence of statements can only contain statements, we -- allow free mixing of declarations and statements in the resulting -- expanded tree. This is for example used to deal with the case of -- a cleanup procedure that must handle declarations as well as the -- statements of a block. -- Note: the cleanup_procedure_call does not go through the common -- processing for calls, which in particular means that it will not be -- automatically inlined in all cases, even though the procedure to be -- called is marked inline. More specifically, if the procedure comes -- from another unit than the main source unit, for example a run-time -- unit, then it needs to be manually added to the list of bodies to be -- inlined by invoking Add_Inlined_Body on it. -- N_Handled_Sequence_Of_Statements -- Sloc points to first token of first statement -- Statements -- End_Label (set to Empty if expander generated) -- Exception_Handlers (set to No_List if none present) -- At_End_Proc (set to Empty if no clean up procedure) -- First_Real_Statement -- Note: the parent always contains a Declarations field which contains -- declarations associated with the handled sequence of statements. This -- is true even in the case of an accept statement (see description of -- the N_Accept_Statement node). -- End_Label refers to the containing construct ----------------------------- -- 11.2 Exception Handler -- ----------------------------- -- EXCEPTION_HANDLER ::= -- when [CHOICE_PARAMETER_SPECIFICATION :] -- EXCEPTION_CHOICE {| EXCEPTION_CHOICE} => -- SEQUENCE_OF_STATEMENTS -- Note: choice parameter specification is not allowed in Ada 83 mode -- N_Exception_Handler -- Sloc points to WHEN -- Choice_Parameter (set to Empty if not present) -- Exception_Choices -- Statements -- Exception_Label (set to Empty if not present) -- Local_Raise_Statements (set to No_Elist if not present) -- Local_Raise_Not_OK -- Has_Local_Raise ------------------------------------------ -- 11.2 Choice parameter specification -- ------------------------------------------ -- CHOICE_PARAMETER_SPECIFICATION ::= DEFINING_IDENTIFIER ---------------------------- -- 11.2 Exception Choice -- ---------------------------- -- EXCEPTION_CHOICE ::= exception_NAME | others -- Except in the case of OTHERS, no explicit node appears in the tree -- for exception choice. Instead the exception name appears directly. -- An OTHERS choice is represented by a N_Others_Choice node (see -- section 3.8.1. -- Note: for the exception choice created for an at end handler, the -- exception choice is an N_Others_Choice node with All_Others set. --------------------------- -- 11.3 Raise Statement -- --------------------------- -- RAISE_STATEMENT ::= raise [exception_NAME]; -- In Ada 2005, we have -- RAISE_STATEMENT ::= -- raise; | raise exception_NAME [with string_EXPRESSION]; -- N_Raise_Statement -- Sloc points to RAISE -- Name (set to Empty if no exception name present) -- Expression (set to Empty if no expression present) -- From_At_End ---------------------------- -- 11.3 Raise Expression -- ---------------------------- -- RAISE_EXPRESSION ::= raise exception_NAME [with string_EXPRESSION] -- N_Raise_Expression -- Sloc points to RAISE -- Name (always present) -- Expression (set to Empty if no expression present) -- Convert_To_Return_False -- plus fields for expression ------------------------------- -- 12.1 Generic Declaration -- ------------------------------- -- GENERIC_DECLARATION ::= -- GENERIC_SUBPROGRAM_DECLARATION | GENERIC_PACKAGE_DECLARATION ------------------------------------------ -- 12.1 Generic Subprogram Declaration -- ------------------------------------------ -- GENERIC_SUBPROGRAM_DECLARATION ::= -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION -- [ASPECT_SPECIFICATIONS]; -- Note: Generic_Formal_Declarations can include pragmas -- N_Generic_Subprogram_Declaration -- Sloc points to GENERIC -- Specification subprogram specification -- Corresponding_Body -- Generic_Formal_Declarations from generic formal part -- Parent_Spec --------------------------------------- -- 12.1 Generic Package Declaration -- --------------------------------------- -- GENERIC_PACKAGE_DECLARATION ::= -- GENERIC_FORMAL_PART PACKAGE_SPECIFICATION -- [ASPECT_SPECIFICATIONS]; -- Note: when we do generics right, the Activation_Chain_Entity entry -- for this node can be removed (since the expander won't see generic -- units any more)???. -- Note: Generic_Formal_Declarations can include pragmas -- N_Generic_Package_Declaration -- Sloc points to GENERIC -- Specification package specification -- Corresponding_Body -- Generic_Formal_Declarations from generic formal part -- Parent_Spec -- Activation_Chain_Entity ------------------------------- -- 12.1 Generic Formal Part -- ------------------------------- -- GENERIC_FORMAL_PART ::= -- generic {GENERIC_FORMAL_PARAMETER_DECLARATION | USE_CLAUSE} ------------------------------------------------ -- 12.1 Generic Formal Parameter Declaration -- ------------------------------------------------ -- GENERIC_FORMAL_PARAMETER_DECLARATION ::= -- FORMAL_OBJECT_DECLARATION -- | FORMAL_TYPE_DECLARATION -- | FORMAL_SUBPROGRAM_DECLARATION -- | FORMAL_PACKAGE_DECLARATION --------------------------------- -- 12.3 Generic Instantiation -- --------------------------------- -- GENERIC_INSTANTIATION ::= -- package DEFINING_PROGRAM_UNIT_NAME is -- new generic_package_NAME [GENERIC_ACTUAL_PART] -- [ASPECT_SPECIFICATIONS]; -- | [[not] overriding] -- procedure DEFINING_PROGRAM_UNIT_NAME is -- new generic_procedure_NAME [GENERIC_ACTUAL_PART] -- [ASPECT_SPECIFICATIONS]; -- | [[not] overriding] -- function DEFINING_DESIGNATOR is -- new generic_function_NAME [GENERIC_ACTUAL_PART] -- [ASPECT_SPECIFICATIONS]; -- N_Package_Instantiation -- Sloc points to PACKAGE -- Defining_Unit_Name -- Name -- Generic_Associations (set to No_List if no -- generic actual part) -- Parent_Spec -- Instance_Spec -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Is_Declaration_Level_Node -- Is_Known_Guaranteed_ABE -- N_Procedure_Instantiation -- Sloc points to PROCEDURE -- Defining_Unit_Name -- Name -- Parent_Spec -- Generic_Associations (set to No_List if no -- generic actual part) -- Instance_Spec -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Is_Declaration_Level_Node -- Must_Override set if overriding indicator present -- Must_Not_Override set if not_overriding indicator present -- Is_Known_Guaranteed_ABE -- N_Function_Instantiation -- Sloc points to FUNCTION -- Defining_Unit_Name -- Name -- Generic_Associations (set to No_List if no -- generic actual part) -- Parent_Spec -- Instance_Spec -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Is_Declaration_Level_Node -- Must_Override set if overriding indicator present -- Must_Not_Override set if not_overriding indicator present -- Is_Known_Guaranteed_ABE -- Note: overriding indicator is an Ada 2005 feature ------------------------------- -- 12.3 Generic Actual Part -- ------------------------------- -- GENERIC_ACTUAL_PART ::= -- (GENERIC_ASSOCIATION {, GENERIC_ASSOCIATION}) ------------------------------- -- 12.3 Generic Association -- ------------------------------- -- GENERIC_ASSOCIATION ::= -- [generic_formal_parameter_SELECTOR_NAME =>] -- Note: unlike the procedure call case, a generic association node -- is generated for every association, even if no formal parameter -- selector name is present. In this case the parser will leave the -- Selector_Name field set to Empty, to be filled in later by the -- semantic pass. -- In Ada 2005, a formal may be associated with a box, if the -- association is part of the list of actuals for a formal package. -- If the association is given by OTHERS => <>, the association is -- an N_Others_Choice. -- N_Generic_Association -- Sloc points to first token of generic association -- Selector_Name (set to Empty if no formal -- parameter selector name) -- Explicit_Generic_Actual_Parameter (Empty if box present) -- Box_Present (for formal_package associations with a box) --------------------------------------------- -- 12.3 Explicit Generic Actual Parameter -- --------------------------------------------- -- EXPLICIT_GENERIC_ACTUAL_PARAMETER ::= -- EXPRESSION | variable_NAME | subprogram_NAME -- | entry_NAME | SUBTYPE_MARK | package_instance_NAME ------------------------------------- -- 12.4 Formal Object Declaration -- ------------------------------------- -- FORMAL_OBJECT_DECLARATION ::= -- DEFINING_IDENTIFIER_LIST : -- MODE [NULL_EXCLUSION] SUBTYPE_MARK [:= DEFAULT_EXPRESSION] -- [ASPECT_SPECIFICATIONS]; -- | DEFINING_IDENTIFIER_LIST : -- MODE ACCESS_DEFINITION [:= DEFAULT_EXPRESSION] -- [ASPECT_SPECIFICATIONS]; -- Although the syntax allows multiple identifiers in the list, the -- semantics is as though successive declarations were given with -- identical type definition and expression components. To simplify -- semantic processing, the parser represents a multiple declaration -- case as a sequence of single declarations, using the More_Ids and -- Prev_Ids flags to preserve the original source form as described -- in the section on "Handling of Defining Identifier Lists". -- N_Formal_Object_Declaration -- Sloc points to first identifier -- Defining_Identifier -- In_Present -- Out_Present -- Null_Exclusion_Present (set to False if not present) -- Subtype_Mark (set to Empty if not present) -- Access_Definition (set to Empty if not present) -- Default_Expression (set to Empty if no default expression) -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) ----------------------------------- -- 12.5 Formal Type Declaration -- ----------------------------------- -- FORMAL_TYPE_DECLARATION ::= -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] -- is FORMAL_TYPE_DEFINITION -- [ASPECT_SPECIFICATIONS]; -- | type DEFINING_IDENTIFIER [DISCRIMINANT_PART] [is tagged] -- N_Formal_Type_Declaration -- Sloc points to TYPE -- Defining_Identifier -- Formal_Type_Definition -- Discriminant_Specifications (set to No_List if no -- discriminant part) -- Unknown_Discriminants_Present set if (<>) discriminant -- Default_Subtype_Mark ---------------------------------- -- 12.5 Formal type definition -- ---------------------------------- -- FORMAL_TYPE_DEFINITION ::= -- FORMAL_PRIVATE_TYPE_DEFINITION -- | FORMAL_DERIVED_TYPE_DEFINITION -- | FORMAL_DISCRETE_TYPE_DEFINITION -- | FORMAL_SIGNED_INTEGER_TYPE_DEFINITION -- | FORMAL_MODULAR_TYPE_DEFINITION -- | FORMAL_FLOATING_POINT_DEFINITION -- | FORMAL_ORDINARY_FIXED_POINT_DEFINITION -- | FORMAL_DECIMAL_FIXED_POINT_DEFINITION -- | FORMAL_ARRAY_TYPE_DEFINITION -- | FORMAL_ACCESS_TYPE_DEFINITION -- | FORMAL_INTERFACE_TYPE_DEFINITION -- | FORMAL_INCOMPLETE_TYPE_DEFINITION -- The Ada 2012 syntax introduces two new non-terminals: -- Formal_{Complete,Incomplete}_Type_Declaration just to introduce -- the latter category. Here we introduce an incomplete type definition -- in order to preserve as much as possible the existing structure. --------------------------------------------- -- 12.5.1 Formal Private Type Definition -- --------------------------------------------- -- FORMAL_PRIVATE_TYPE_DEFINITION ::= -- [[abstract] tagged] [limited] private -- Note: TAGGED is not allowed in Ada 83 mode -- N_Formal_Private_Type_Definition -- Sloc points to PRIVATE -- Uninitialized_Variable -- Abstract_Present -- Tagged_Present -- Limited_Present -------------------------------------------- -- 12.5.1 Formal Derived Type Definition -- -------------------------------------------- -- FORMAL_DERIVED_TYPE_DEFINITION ::= -- [abstract] [limited | synchronized] -- new SUBTYPE_MARK [[and INTERFACE_LIST] with private] -- Note: this construct is not allowed in Ada 83 mode -- N_Formal_Derived_Type_Definition -- Sloc points to NEW -- Subtype_Mark -- Private_Present -- Abstract_Present -- Limited_Present -- Synchronized_Present -- Interface_List (set to No_List if none) ----------------------------------------------- -- 12.5.1 Formal Incomplete Type Definition -- ----------------------------------------------- -- FORMAL_INCOMPLETE_TYPE_DEFINITION ::= [tagged] -- N_Formal_Incomplete_Type_Definition -- Sloc points to identifier of parent -- Tagged_Present --------------------------------------------- -- 12.5.2 Formal Discrete Type Definition -- --------------------------------------------- -- FORMAL_DISCRETE_TYPE_DEFINITION ::= (<>) -- N_Formal_Discrete_Type_Definition -- Sloc points to ( --------------------------------------------------- -- 12.5.2 Formal Signed Integer Type Definition -- --------------------------------------------------- -- FORMAL_SIGNED_INTEGER_TYPE_DEFINITION ::= range <> -- N_Formal_Signed_Integer_Type_Definition -- Sloc points to RANGE -------------------------------------------- -- 12.5.2 Formal Modular Type Definition -- -------------------------------------------- -- FORMAL_MODULAR_TYPE_DEFINITION ::= mod <> -- N_Formal_Modular_Type_Definition -- Sloc points to MOD ---------------------------------------------- -- 12.5.2 Formal Floating Point Definition -- ---------------------------------------------- -- FORMAL_FLOATING_POINT_DEFINITION ::= digits <> -- N_Formal_Floating_Point_Definition -- Sloc points to DIGITS ---------------------------------------------------- -- 12.5.2 Formal Ordinary Fixed Point Definition -- ---------------------------------------------------- -- FORMAL_ORDINARY_FIXED_POINT_DEFINITION ::= delta <> -- N_Formal_Ordinary_Fixed_Point_Definition -- Sloc points to DELTA --------------------------------------------------- -- 12.5.2 Formal Decimal Fixed Point Definition -- --------------------------------------------------- -- FORMAL_DECIMAL_FIXED_POINT_DEFINITION ::= delta <> digits <> -- Note: formal decimal fixed point definition not allowed in Ada 83 -- N_Formal_Decimal_Fixed_Point_Definition -- Sloc points to DELTA ------------------------------------------ -- 12.5.3 Formal Array Type Definition -- ------------------------------------------ -- FORMAL_ARRAY_TYPE_DEFINITION ::= ARRAY_TYPE_DEFINITION ------------------------------------------- -- 12.5.4 Formal Access Type Definition -- ------------------------------------------- -- FORMAL_ACCESS_TYPE_DEFINITION ::= ACCESS_TYPE_DEFINITION ---------------------------------------------- -- 12.5.5 Formal Interface Type Definition -- ---------------------------------------------- -- FORMAL_INTERFACE_TYPE_DEFINITION ::= INTERFACE_TYPE_DEFINITION ----------------------------------------- -- 12.6 Formal Subprogram Declaration -- ----------------------------------------- -- FORMAL_SUBPROGRAM_DECLARATION ::= -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION -- | FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION -------------------------------------------------- -- 12.6 Formal Concrete Subprogram Declaration -- -------------------------------------------------- -- FORMAL_CONCRETE_SUBPROGRAM_DECLARATION ::= -- with SUBPROGRAM_SPECIFICATION [is SUBPROGRAM_DEFAULT] -- [ASPECT_SPECIFICATIONS]; -- N_Formal_Concrete_Subprogram_Declaration -- Sloc points to WITH -- Specification -- Default_Name (set to Empty if no subprogram default) -- Box_Present -- Note: if no subprogram default is present, then Name is set -- to Empty, and Box_Present is False. -------------------------------------------------- -- 12.6 Formal Abstract Subprogram Declaration -- -------------------------------------------------- -- FORMAL_ABSTRACT_SUBPROGRAM_DECLARATION ::= -- with SUBPROGRAM_SPECIFICATION is abstract [SUBPROGRAM_DEFAULT] -- [ASPECT_SPECIFICATIONS]; -- N_Formal_Abstract_Subprogram_Declaration -- Sloc points to WITH -- Specification -- Default_Name (set to Empty if no subprogram default) -- Box_Present -- Note: if no subprogram default is present, then Name is set -- to Empty, and Box_Present is False. ------------------------------ -- 12.6 Subprogram Default -- ------------------------------ -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <> -- There is no separate node in the tree for a subprogram default. -- Instead the parent (N_Formal_Concrete_Subprogram_Declaration -- or N_Formal_Abstract_Subprogram_Declaration) node contains the -- default name or box indication, as needed. ------------------------ -- 12.6 Default Name -- ------------------------ -- DEFAULT_NAME ::= NAME -------------------------------------- -- 12.7 Formal Package Declaration -- -------------------------------------- -- FORMAL_PACKAGE_DECLARATION ::= -- with package DEFINING_IDENTIFIER -- is new generic_package_NAME FORMAL_PACKAGE_ACTUAL_PART -- [ASPECT_SPECIFICATIONS]; -- Note: formal package declarations not allowed in Ada 83 mode -- N_Formal_Package_Declaration -- Sloc points to WITH -- Defining_Identifier -- Name -- Generic_Associations (set to No_List if (<>) case or -- empty generic actual part) -- Box_Present -- Instance_Spec -- Is_Known_Guaranteed_ABE -------------------------------------- -- 12.7 Formal Package Actual Part -- -------------------------------------- -- FORMAL_PACKAGE_ACTUAL_PART ::= -- ([OTHERS] => <>) -- | [GENERIC_ACTUAL_PART] -- (FORMAL_PACKAGE_ASSOCIATION {. FORMAL_PACKAGE_ASSOCIATION} -- FORMAL_PACKAGE_ASSOCIATION ::= -- GENERIC_ASSOCIATION -- | GENERIC_FORMAL_PARAMETER_SELECTOR_NAME => <> -- There is no explicit node in the tree for a formal package actual -- part. Instead the information appears in the parent node (i.e. the -- formal package declaration node itself). -- There is no explicit node for a formal package association. All of -- them are represented either by a generic association, possibly with -- Box_Present, or by an N_Others_Choice. --------------------------------- -- 13.1 Representation clause -- --------------------------------- -- REPRESENTATION_CLAUSE ::= -- ATTRIBUTE_DEFINITION_CLAUSE -- | ENUMERATION_REPRESENTATION_CLAUSE -- | RECORD_REPRESENTATION_CLAUSE -- | AT_CLAUSE ---------------------- -- 13.1 Local Name -- ---------------------- -- LOCAL_NAME := -- DIRECT_NAME -- | DIRECT_NAME'ATTRIBUTE_DESIGNATOR -- | library_unit_NAME -- The construct DIRECT_NAME'ATTRIBUTE_DESIGNATOR appears in the tree -- as an attribute reference, which has essentially the same form. --------------------------------------- -- 13.3 Attribute definition clause -- --------------------------------------- -- ATTRIBUTE_DEFINITION_CLAUSE ::= -- for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use EXPRESSION; -- | for LOCAL_NAME'ATTRIBUTE_DESIGNATOR use NAME; -- In Ada 83, the expression must be a simple expression and the -- local name must be a direct name. -- Note: the only attribute definition clause that is processed by -- gigi is an address clause. For all other cases, the information -- is extracted by the front end and either results in setting entity -- information, e.g. Esize for the Size clause, or in appropriate -- expansion actions (e.g. in the case of Storage_Size). -- For an address clause, Gigi constructs the appropriate addressing -- code. It also ensures that no aliasing optimizations are made -- for the object for which the address clause appears. -- Note: for an address clause used to achieve an overlay: -- A : Integer; -- B : Integer; -- for B'Address use A'Address; -- the above rule means that Gigi will ensure that no optimizations -- will be made for B that would violate the implementation advice -- of RM 13.3(19). However, this advice applies only to B and not -- to A, which seems unfortunate. The GNAT front end will mark the -- object A as volatile to also prevent unwanted optimization -- assumptions based on no aliasing being made for B. -- N_Attribute_Definition_Clause -- Sloc points to FOR -- Name the local name -- Chars the identifier name from the attribute designator -- Expression the expression or name -- Entity -- Next_Rep_Item -- From_At_Mod -- Check_Address_Alignment -- From_Aspect_Specification -- Is_Delayed_Aspect -- Address_Warning_Posted -- Note: if From_Aspect_Specification is set, then Sloc points to the -- aspect name, and Entity is resolved already to reference the entity -- to which the aspect applies. ----------------------------------- -- 13.3.1 Aspect Specifications -- ----------------------------------- -- We modify the RM grammar here, the RM grammar is: -- ASPECT_SPECIFICATION ::= -- with ASPECT_MARK [=> ASPECT_DEFINITION] {, -- ASPECT_MARK [=> ASPECT_DEFINITION] } -- ASPECT_MARK ::= aspect_IDENTIFIER['Class] -- ASPECT_DEFINITION ::= NAME | EXPRESSION -- That's inconvenient, since there is no non-terminal name for a single -- entry in the list of aspects. So we use this grammar instead: -- ASPECT_SPECIFICATIONS ::= -- with ASPECT_SPECIFICATION {, ASPECT_SPECIFICATION} -- ASPECT_SPECIFICATION => -- ASPECT_MARK [=> ASPECT_DEFINITION] -- ASPECT_MARK ::= aspect_IDENTIFIER['Class] -- ASPECT_DEFINITION ::= NAME | EXPRESSION -- Note that for Annotate, the ASPECT_DEFINITION is a pure positional -- aggregate with the elements of the aggregate corresponding to the -- successive arguments of the corresponding pragma. -- See separate package Aspects for details on the incorporation of -- these nodes into the tree, and how aspect specifications for a given -- declaration node are associated with that node. -- N_Aspect_Specification -- Sloc points to aspect identifier -- Identifier aspect identifier -- Aspect_Rep_Item -- Expression (set to Empty if none) -- Entity entity to which the aspect applies -- Next_Rep_Item -- Class_Present Set if 'Class present -- Is_Ignored -- Is_Checked -- Is_Delayed_Aspect -- Is_Disabled -- Is_Boolean_Aspect -- Split_PPC Set if split pre/post attribute -- Aspect_On_Partial_View -- Note: Aspect_Specification is an Ada 2012 feature -- Note: The Identifier serves to identify the aspect involved (it -- is the aspect whose name corresponds to the Chars field). This -- means that the other fields of this identifier are unused, and -- in particular we use the Entity field of this identifier to save -- a copy of the expression for visibility analysis, see spec of -- Sem_Ch13 for full details of this usage. -- In the case of aspects of the form xxx'Class, the aspect identifier -- is for xxx, and Class_Present is set to True. -- Note: When a Pre or Post aspect specification is processed, it is -- broken into AND THEN sections. The left most section has Split_PPC -- set to False, indicating that it is the original specification (e.g. -- for posting errors). For the other sections, Split_PPC is set True. --------------------------------------------- -- 13.4 Enumeration representation clause -- --------------------------------------------- -- ENUMERATION_REPRESENTATION_CLAUSE ::= -- for first_subtype_LOCAL_NAME use ENUMERATION_AGGREGATE; -- In Ada 83, the name must be a direct name -- N_Enumeration_Representation_Clause -- Sloc points to FOR -- Identifier direct name -- Array_Aggregate -- Next_Rep_Item --------------------------------- -- 13.4 Enumeration aggregate -- --------------------------------- -- ENUMERATION_AGGREGATE ::= ARRAY_AGGREGATE ------------------------------------------ -- 13.5.1 Record representation clause -- ------------------------------------------ -- RECORD_REPRESENTATION_CLAUSE ::= -- for first_subtype_LOCAL_NAME use -- record [MOD_CLAUSE] -- {COMPONENT_CLAUSE} -- end record; -- Gigi restriction: Mod_Clause is always Empty (if present it is -- replaced by a corresponding Alignment attribute definition clause). -- Note: Component_Clauses can include pragmas -- N_Record_Representation_Clause -- Sloc points to FOR -- Identifier direct name -- Mod_Clause (set to Empty if no mod clause present) -- Component_Clauses -- Next_Rep_Item ------------------------------ -- 13.5.1 Component clause -- ------------------------------ -- COMPONENT_CLAUSE ::= -- component_LOCAL_NAME at POSITION -- range FIRST_BIT .. LAST_BIT; -- N_Component_Clause -- Sloc points to AT -- Component_Name points to Name or Attribute_Reference -- Position -- First_Bit -- Last_Bit ---------------------- -- 13.5.1 Position -- ---------------------- -- POSITION ::= static_EXPRESSION ----------------------- -- 13.5.1 First_Bit -- ----------------------- -- FIRST_BIT ::= static_SIMPLE_EXPRESSION ---------------------- -- 13.5.1 Last_Bit -- ---------------------- -- LAST_BIT ::= static_SIMPLE_EXPRESSION -------------------------- -- 13.8 Code statement -- -------------------------- -- CODE_STATEMENT ::= QUALIFIED_EXPRESSION; -- Note: in GNAT, the qualified expression has the form -- Asm_Insn'(Asm (...)); -- See package System.Machine_Code in file s-maccod.ads for details on -- the allowed parameters to Asm. There are two ways this node can -- arise, as a code statement, in which case the expression is the -- qualified expression, or as a result of the expansion of an intrinsic -- call to the Asm or Asm_Input procedure. -- N_Code_Statement -- Sloc points to first token of the expression -- Expression -- Note: package Exp_Code contains an abstract functional interface -- for use by Gigi in accessing the data from N_Code_Statement nodes. ------------------------ -- 13.12 Restriction -- ------------------------ -- RESTRICTION ::= -- restriction_IDENTIFIER -- | restriction_parameter_IDENTIFIER => EXPRESSION -- There is no explicit node for restrictions. Instead the restriction -- appears in normal pragma syntax as a pragma argument association, -- which has the same syntactic form. -------------------------- -- B.2 Shift Operators -- -------------------------- -- Calls to the intrinsic shift functions are converted to one of -- the following shift nodes, which have the form of normal binary -- operator names. Note that for a given shift operation, one node -- covers all possible types, as for normal operators. -- Note: it is perfectly permissible for the expander to generate -- shift operation nodes directly, in which case they will be analyzed -- and parsed in the usual manner. -- Sprint syntax: shift-function-name!(expr, count) -- Note: the Left_Opnd field holds the first argument (the value to -- be shifted). The Right_Opnd field holds the second argument (the -- shift count). The Chars field is the name of the intrinsic function. -- N_Op_Rotate_Left -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK -- N_Op_Rotate_Right -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK -- N_Op_Shift_Left -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK -- N_Op_Shift_Right_Arithmetic -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK -- N_Op_Shift_Right -- Sloc points to the function name -- plus fields for binary operator -- plus fields for expression -- Shift_Count_OK -- Note: N_Op_Rotate_Left, N_Op_Rotate_Right, N_Shift_Right_Arithmetic -- never appear in the expanded tree if Modify_Tree_For_C mode is set. -- Note: For N_Op_Shift_Left and N_Op_Shift_Right, the right operand is -- always less than the word size if Modify_Tree_For_C mode is set. -------------------------- -- Obsolescent Features -- -------------------------- -- The syntax descriptions and tree nodes for obsolescent features are -- grouped together, corresponding to their location in appendix I in -- the RM. However, parsing and semantic analysis for these constructs -- is located in an appropriate chapter (see individual notes). --------------------------- -- J.3 Delta Constraint -- --------------------------- -- Note: the parse routine for this construct is located in section -- 3.5.9 of Par-Ch3, and semantic analysis is in Sem_Ch3, which is -- where delta constraint logically belongs. -- DELTA_CONSTRAINT ::= DELTA static_EXPRESSION [RANGE_CONSTRAINT] -- N_Delta_Constraint -- Sloc points to DELTA -- Delta_Expression -- Range_Constraint (set to Empty if not present) -------------------- -- J.7 At Clause -- -------------------- -- AT_CLAUSE ::= for DIRECT_NAME use at EXPRESSION; -- Note: the parse routine for this construct is located in Par-Ch13, -- and the semantic analysis is in Sem_Ch13, where at clause logically -- belongs if it were not obsolescent. -- Note: in Ada 83 the expression must be a simple expression -- Gigi restriction: This node never appears, it is rewritten as an -- address attribute definition clause. -- N_At_Clause -- Sloc points to FOR -- Identifier -- Expression --------------------- -- J.8 Mod clause -- --------------------- -- MOD_CLAUSE ::= at mod static_EXPRESSION; -- Note: the parse routine for this construct is located in Par-Ch13, -- and the semantic analysis is in Sem_Ch13, where mod clause logically -- belongs if it were not obsolescent. -- Note: in Ada 83, the expression must be a simple expression -- Gigi restriction: this node never appears. It is replaced -- by a corresponding Alignment attribute definition clause. -- Note: pragmas can appear before and after the MOD_CLAUSE since -- its name has "clause" in it. This is rather strange, but is quite -- definitely specified. The pragmas before are collected in the -- Pragmas_Before field of the mod clause node itself, and pragmas -- after are simply swallowed up in the list of component clauses. -- N_Mod_Clause -- Sloc points to AT -- Expression -- Pragmas_Before Pragmas before mod clause (No_List if none) -------------------- -- Semantic Nodes -- -------------------- -- These semantic nodes are used to hold additional semantic information. -- They are inserted into the tree as a result of semantic processing. -- Although there are no legitimate source syntax constructions that -- correspond directly to these nodes, we need a source syntax for the -- reconstructed tree printed by Sprint, and the node descriptions here -- show this syntax. ----------------- -- Call_Marker -- ----------------- -- This node is created during the analysis/resolution of entry calls, -- requeues, and subprogram calls. It performs several functions: -- * Call markers provide a uniform model for handling calls by the -- ABE mechanism, regardless of whether expansion took place. -- * The call marker captures the target of the related call along -- with other attributes which are either unavailabe or expensive -- to recompute once analysis, resolution, and expansion are over. -- * The call marker aids the ABE Processing phase by signaling the -- presence of a call in case the original call was transformed by -- expansion. -- * The call marker acts as a reference point for the insertion of -- run-time conditional ABE checks or guaranteed ABE failures. -- Sprint syntax: #target# -- The Sprint syntax shown above is not enabled by default -- N_Call_Marker -- Sloc points to Sloc of original call -- Target -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Is_Source_Call -- Is_Declaration_Level_Node -- Is_Dispatching_Call -- Is_Preelaborable_Call -- Is_Known_Guaranteed_ABE ------------------------ -- Compound Statement -- ------------------------ -- This node is created by the analyzer/expander to handle some -- expansion cases where a sequence of actions needs to be captured -- within a single node (which acts as a container and allows the -- entire list of actions to be moved around as a whole) appearing -- in a sequence of statements. -- This is the statement counterpart to the expression node -- N_Expression_With_Actions. -- The required semantics is that the set of actions is executed in -- the order in which it appears, as though they appeared by themselves -- in the enclosing list of declarations or statements. Unlike what -- happens when using an N_Block_Statement, no new scope is introduced. -- Note: for the time being, this is used only as a transient -- representation during expansion, and all compound statement nodes -- must be exploded back to their constituent statements before handing -- the tree to the back end. -- Sprint syntax: do -- action; -- action; -- ... -- action; -- end; -- N_Compound_Statement -- Actions -------------- -- Contract -- -------------- -- This node is used to hold the various parts of an entry, subprogram -- [body] or package [body] contract, in particular: -- Abstract states declared by a package declaration -- Contract cases that apply to a subprogram -- Dependency relations of inputs and output of a subprogram -- Global annotations classifying data as input or output -- Initialization sequences for a package declaration -- Pre- and postconditions that apply to a subprogram -- The node appears in an entry and [generic] subprogram [body] entity. -- Sprint syntax: <none> as the node should not appear in the tree, but -- only attached to an entry or [generic] subprogram -- entity. -- N_Contract -- Sloc points to the subprogram's name -- Pre_Post_Conditions (set to Empty if none) -- Contract_Test_Cases (set to Empty if none) -- Classifications (set to Empty if none) -- Is_Expanded_Contract -- Pre_Post_Conditions contains a collection of pragmas that correspond -- to pre- and postconditions associated with an entry or a subprogram -- [body or stub]. The pragmas can either come from source or be the -- byproduct of aspect expansion. Currently the following pragmas appear -- in this list: -- Post -- Postcondition -- Pre -- Precondition -- Refined_Post -- The ordering in the list is in LIFO fashion. -- Note that there might be multiple preconditions or postconditions -- in this list, either because they come from separate pragmas in the -- source, or because a Pre (resp. Post) aspect specification has been -- broken into AND THEN sections. See Split_PPC for details. -- In GNATprove mode, the inherited classwide pre- and postconditions -- (suitably specialized for the specific type of the overriding -- operation) are also in this list. -- Contract_Test_Cases contains a collection of pragmas that correspond -- to aspects/pragmas Contract_Cases, Test_Case and Subprogram_Variant. -- The ordering in the list is in LIFO fashion. -- Classifications contains pragmas that either declare, categorize, or -- establish dependencies between subprogram or package inputs and -- outputs. Currently the following pragmas appear in this list: -- Abstract_States -- Async_Readers -- Async_Writers -- Constant_After_Elaboration -- Depends -- Effective_Reads -- Effective_Writes -- Extensions_Visible -- Global -- Initial_Condition -- Initializes -- Part_Of -- Refined_Depends -- Refined_Global -- Refined_States -- Volatile_Function -- The ordering is in LIFO fashion. ------------------- -- Expanded Name -- ------------------- -- The N_Expanded_Name node is used to represent a selected component -- name that has been resolved to an expanded name. The semantic phase -- replaces N_Selected_Component nodes that represent names by the use -- of this node, leaving the N_Selected_Component node used only when -- the prefix is a record or protected type. -- The fields of the N_Expanded_Name node are laid out identically -- to those of the N_Selected_Component node, allowing conversion of -- an expanded name node to a selected component node to be done -- easily, see Sinfo.CN.Change_Selected_Component_To_Expanded_Name. -- There is no special sprint syntax for an expanded name -- N_Expanded_Name -- Sloc points to the period -- Chars copy of Chars field of selector name -- Prefix -- Selector_Name -- Entity -- Associated_Node -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Has_Private_View (set in generic units) -- Redundant_Use -- Atomic_Sync_Required -- plus fields for expression ----------------------------- -- Expression With Actions -- ----------------------------- -- This node is created by the analyzer/expander to handle some -- expansion cases, notably short-circuit forms where there are -- actions associated with the right-hand side operand. -- The N_Expression_With_Actions node represents an expression with -- an associated set of actions (which are executable statements and -- declarations, as might occur in a handled statement sequence). -- The required semantics is that the set of actions is executed in -- the order in which it appears just before the expression is -- evaluated (and these actions must only be executed if the value -- of the expression is evaluated). The node is considered to be -- a subexpression, whose value is the value of the Expression after -- executing all the actions. -- If the actions contain declarations, then these declarations may -- be referenced within the expression. -- (AI12-0236-1): In Ada 2022, for a declare_expression, the parser -- generates an N_Expression_With_Actions. Declare_expressions have -- various restrictions, which we do not enforce on -- N_Expression_With_Actions nodes that are generated by the -- expander. The two cases can be distinguished by looking at -- Comes_From_Source. -- ???Perhaps we should change the name of this node to -- N_Declare_Expression, and perhaps we should change the Sprint syntax -- to match the RM syntax for declare_expression. -- Sprint syntax: do -- action; -- action; -- ... -- action; -- in expression end -- N_Expression_With_Actions -- Actions -- Expression -- plus fields for expression -- Note: In the final generated tree presented to the code generator, -- the actions list is always non-null, since there is no point in this -- node if the actions are Empty. During semantic analysis there are -- cases where it is convenient to temporarily generate an empty actions -- list. This arises in cases where we create such an empty actions -- list, and it may or may not end up being a place where additional -- actions are inserted. The expander removes such empty cases after -- the expression of the node is fully analyzed and expanded, at which -- point it is safe to remove it, since no more actions can be inserted. -- Note: In Modify_Tree_For_C, we never generate any declarations in -- the action list, which can contain only non-declarative statements. -------------------- -- Free Statement -- -------------------- -- The N_Free_Statement node is generated as a result of a call to an -- instantiation of Unchecked_Deallocation. The instantiation of this -- generic is handled specially and generates this node directly. -- Sprint syntax: free expression -- N_Free_Statement -- Sloc is copied from the unchecked deallocation call -- Expression argument to unchecked deallocation call -- Storage_Pool -- Procedure_To_Call -- Actual_Designated_Subtype -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the FREE keyword in the Sprint file output. ------------------- -- Freeze Entity -- ------------------- -- This node marks the point in a declarative part at which an entity -- declared therein becomes frozen. The expander places initialization -- procedures for types at those points. Gigi uses the freezing point -- to elaborate entities that may depend on previous private types. -- See the section in Einfo "Delayed Freezing and Elaboration" for -- a full description of the use of this node. -- The Entity field points back to the entity for the type (whose -- Freeze_Node field points back to this freeze node). -- The Actions field contains a list of declarations and statements -- generated by the expander which are associated with the freeze -- node, and are elaborated as though the freeze node were replaced -- by this sequence of actions. -- Note: the Sloc field in the freeze node references a construct -- associated with the freezing point. This is used for posting -- messages in some error/warning situations, e.g. the case where -- a primitive operation of a tagged type is declared too late. -- Sprint syntax: freeze entity-name [ -- freeze actions -- ] -- N_Freeze_Entity -- Sloc points near freeze point (see above special note) -- Entity -- Access_Types_To_Process (set to No_Elist if none) -- TSS_Elist (set to No_Elist if no associated TSS's) -- Actions (set to No_List if no freeze actions) -- First_Subtype_Link (set to Empty if no link) -- The Actions field holds actions associated with the freeze. These -- actions are elaborated at the point where the type is frozen. -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the FREEZE keyword in the Sprint file output. --------------------------- -- Freeze Generic Entity -- --------------------------- -- The freeze point of an entity indicates the point at which the -- information needed to generate code for the entity is complete. -- The freeze node for an entity triggers expander activities, such as -- build initialization procedures, and backend activities, such as -- completing the elaboration of packages. -- For entities declared within a generic unit, for which no code is -- generated, the freeze point is not equally meaningful. However, in -- Ada 2012 several semantic checks on declarations must be delayed to -- the freeze point, and we need to include such a mark in the tree to -- trigger these checks. The Freeze_Generic_Entity node plays no other -- role, and is ignored by the expander and the back-end. -- Sprint syntax: freeze_generic entity-name -- N_Freeze_Generic_Entity -- Sloc points near freeze point -- Entity -------------------------------- -- Implicit Label Declaration -- -------------------------------- -- An implicit label declaration is created for every occurrence of a -- label on a statement or a label on a block or loop. It is chained -- in the declarations of the innermost enclosing block as specified -- in RM section 5.1 (3). -- The Defining_Identifier is the actual identifier for the statement -- identifier. Note that the occurrence of the label is a reference, NOT -- the defining occurrence. The defining occurrence occurs at the head -- of the innermost enclosing block, and is represented by this node. -- Note: from the grammar, this might better be called an implicit -- statement identifier declaration, but the term we choose seems -- friendlier, since at least informally statement identifiers are -- called labels in both cases (i.e. when used in labels, and when -- used as the identifiers of blocks and loops). -- Note: although this is logically a semantic node, since it does not -- correspond directly to a source syntax construction, these nodes are -- actually created by the parser in a post pass done just after parsing -- is complete, before semantic analysis is started (see Par.Labl). -- Sprint syntax: labelname : label; -- N_Implicit_Label_Declaration -- Sloc points to the << token for a statement identifier, or to the -- LOOP, DECLARE, or BEGIN token for a loop or block identifier -- Defining_Identifier -- Label_Construct -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the label name in the generated declaration. --------------------- -- Itype Reference -- --------------------- -- This node is used to create a reference to an Itype. The only purpose -- is to make sure the Itype is defined if this is the first reference. -- A typical use of this node is when an Itype is to be referenced in -- two branches of an IF statement. In this case it is important that -- the first use of the Itype not be inside the conditional, since then -- it might not be defined if the other branch of the IF is taken, in -- the case where the definition generates elaboration code. -- The Itype field points to the referenced Itype -- Sprint syntax: reference itype-name -- N_Itype_Reference -- Sloc points to the node generating the reference -- Itype -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the REFERENCE keyword in the file output. --------------------- -- Raise xxx Error -- --------------------- -- One of these nodes is created during semantic analysis to replace -- a node for an expression that is determined to definitely raise -- the corresponding exception. -- The N_Raise_xxx_Error node may also stand alone in place -- of a declaration or statement, in which case it simply causes -- the exception to be raised (i.e. it is equivalent to a raise -- statement that raises the corresponding exception). This use -- is distinguished by the fact that the Etype in this case is -- Standard_Void_Type; in the subexpression case, the Etype is the -- same as the type of the subexpression which it replaces. -- If Condition is empty, then the raise is unconditional. If the -- Condition field is non-empty, it is a boolean expression which is -- first evaluated, and the exception is raised only if the value of the -- expression is True. In the unconditional case, the creation of this -- node is usually accompanied by a warning message (unless it appears -- within the right operand of a short-circuit form whose left argument -- is static and decisively eliminates elaboration of the raise -- operation). The condition field can ONLY be present when the node is -- used as a statement form; it must NOT be present in the case where -- the node appears within an expression. -- The exception is generated with a message that contains the -- file name and line number, and then appended text. The Reason -- code shows the text to be added. The Reason code is an element -- of the type Types.RT_Exception_Code, and indicates both the -- message to be added, and the exception to be raised (which must -- match the node type). The value is stored by storing a Uint which -- is the Pos value of the enumeration element in this type. -- Gigi restriction: This expander ensures that the type of the -- Condition field is always Standard.Boolean, even if the type -- in the source is some non-standard boolean type. -- Sprint syntax: [xxx_error "msg"] -- or: [xxx_error when condition "msg"] -- N_Raise_Constraint_Error -- Sloc references related construct -- Condition (set to Empty if no condition) -- Reason -- plus fields for expression -- N_Raise_Program_Error -- Sloc references related construct -- Condition (set to Empty if no condition) -- Reason -- plus fields for expression -- N_Raise_Storage_Error -- Sloc references related construct -- Condition (set to Empty if no condition) -- Reason -- plus fields for expression -- Note: Sloc is copied from the expression generating the exception. -- In the case where a debug source file is generated, the Sloc for -- this node points to the left bracket in the Sprint file output. -- Note: the back end may be required to translate these nodes into -- appropriate goto statements. See description of N_Push/Pop_xxx_Label. --------------------------------------------- -- Optimization of Exception Raise to Goto -- --------------------------------------------- -- In some cases, the front end will determine that any exception raised -- by the back end for a certain exception should be transformed into a -- goto statement. -- There are three kinds of exceptions raised by the back end (note that -- for this purpose we consider gigi to be part of the back end in the -- gcc case): -- 1. Exceptions resulting from N_Raise_xxx_Error nodes -- 2. Exceptions from checks triggered by Do_xxx_Check flags -- 3. Other cases not specifically marked by the front end -- Normally all such exceptions are translated into calls to the proper -- Rcheck_xx procedure, where xx encodes both the exception to be raised -- and the exception message. -- The front end may determine that for a particular sequence of code, -- exceptions in any of these three categories for a particular builtin -- exception should result in a goto, rather than a call to Rcheck_xx. -- The exact sequence to be generated is: -- Local_Raise (exception'Identity); -- goto Label -- The front end marks such a sequence of code by bracketing it with -- push and pop nodes: -- N_Push_xxx_Label (referencing the label) -- ... -- (code where transformation is expected for exception xxx) -- ... -- N_Pop_xxx_Label -- The use of push/pop reflects the fact that such regions can properly -- nest, and one special case is a subregion in which no transformation -- is allowed. Such a region is marked by a N_Push_xxx_Label node whose -- Exception_Label field is Empty. -- N_Push_Constraint_Error_Label -- Sloc references first statement in region covered -- Exception_Label -- N_Push_Program_Error_Label -- Sloc references first statement in region covered -- Exception_Label -- N_Push_Storage_Error_Label -- Sloc references first statement in region covered -- Exception_Label -- N_Pop_Constraint_Error_Label -- Sloc references last statement in region covered -- N_Pop_Program_Error_Label -- Sloc references last statement in region covered -- N_Pop_Storage_Error_Label -- Sloc references last statement in region covered --------------- -- Reference -- --------------- -- For a number of purposes, we need to construct references to objects. -- These references are subsequently treated as normal access values. -- An example is the construction of the parameter block passed to a -- task entry. The N_Reference node is provided for this purpose. It is -- similar in effect to the use of the Unrestricted_Access attribute, -- and like Unrestricted_Access can be applied to objects which would -- not be valid prefixes for the Unchecked_Access attribute (e.g. -- objects which are not aliased, and slices). In addition it can be -- applied to composite type values as well as objects, including string -- values and aggregates. -- Note: we use the Prefix field for this expression so that the -- resulting node can be treated using common code with the attribute -- nodes for the 'Access and related attributes. Logically it would make -- more sense to call it an Expression field, but then we would have to -- special case the treatment of the N_Reference node. -- Note: evaluating a N_Reference node is guaranteed to yield a non-null -- value at run time. Therefore, it is valid to set Is_Known_Non_Null on -- a temporary initialized to a N_Reference node in order to eliminate -- superfluous access checks. -- Sprint syntax: prefix'reference -- N_Reference -- Sloc is copied from the expression -- Prefix -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the quote in the Sprint file output. ---------------- -- SCIL Nodes -- ---------------- -- SCIL nodes are special nodes added to the tree when the CodePeer mode -- is active. They are only generated if SCIL generation is enabled. -- A standard tree-walk will not encounter these nodes even if they -- are present; these nodes are only accessible via the function -- SCIL_LL.Get_SCIL_Node. These nodes have no associated dynamic -- semantics. -- Sprint syntax: [ <node kind> ] -- No semantic field values are displayed. -- N_SCIL_Dispatch_Table_Tag_Init -- Sloc references a node for a tag initialization -- SCIL_Entity -- -- An N_SCIL_Dispatch_Table_Tag_Init node may be associated (via -- Get_SCIL_Node) with the N_Object_Declaration node corresponding to -- the declaration of the dispatch table for a tagged type. -- N_SCIL_Dispatching_Call -- Sloc references the node of a dispatching call -- SCIL_Target_Prim -- SCIL_Entity -- SCIL_Controlling_Tag -- -- An N_Scil_Dispatching call node may be associated (via Get_SCIL_Node) -- with the N_Procedure_Call_Statement or N_Function_Call node (or a -- rewriting thereof) corresponding to a dispatching call. -- N_SCIL_Membership_Test -- Sloc references the node of a membership test -- SCIL_Tag_Value -- SCIL_Entity -- -- An N_Scil_Membership_Test node may be associated (via Get_SCIL_Node) -- with the N_In node (or a rewriting thereof) corresponding to a -- classwide membership test. -------------------------- -- Unchecked Expression -- -------------------------- -- An unchecked expression is one that must be analyzed and resolved -- with all checks off, regardless of the current setting of scope -- suppress flags. -- Sprint syntax: `(expression) -- Note: this node is always removed from the tree (and replaced by -- its constituent expression) on completion of analysis, so it only -- appears in intermediate trees, and will never be seen by Gigi. -- N_Unchecked_Expression -- Sloc is a copy of the Sloc of the expression -- Expression -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the back quote in the Sprint file output. ------------------------------- -- Unchecked Type Conversion -- ------------------------------- -- An unchecked type conversion node represents the semantic action -- corresponding to a call to an instantiation of Unchecked_Conversion. -- It is generated as a result of actual use of Unchecked_Conversion -- and also by the expander. -- Unchecked type conversion nodes should be created by calling -- Tbuild.Unchecked_Convert_To, rather than by directly calling -- Nmake.Make_Unchecked_Type_Conversion. -- Note: an unchecked type conversion is a variable as far as the -- semantics are concerned, which is convenient for the expander. -- This does not change what Ada source programs are legal, since -- clearly a function call to an instantiation of Unchecked_Conversion -- is not a variable in any case. -- Sprint syntax: subtype-mark!(expression) -- N_Unchecked_Type_Conversion -- Sloc points to related node in source -- Subtype_Mark -- Expression -- Kill_Range_Check -- No_Truncation -- plus fields for expression -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the exclamation in the Sprint file output. ----------------------------------- -- Validate_Unchecked_Conversion -- ----------------------------------- -- The front end does most of the validation of unchecked conversion, -- including checking sizes (this is done after the back end is called -- to take advantage of back-annotation of calculated sizes). -- The front end also deals with specific cases that are not allowed -- e.g. involving unconstrained array types. -- For the case of the standard gigi backend, this means that all -- checks are done in the front end. -- However, in the case of specialized back-ends, in particular the JVM -- backend in the past, additional requirements and restrictions may -- apply to unchecked conversion, and these are most conveniently -- performed in the specialized back-end. -- To accommodate this requirement, for such back ends, the following -- special node is generated recording an unchecked conversion that -- needs to be validated. The back end should post an appropriate -- error message if the unchecked conversion is invalid or warrants -- a special warning message. -- Source_Type and Target_Type point to the entities for the two -- types involved in the unchecked conversion instantiation that -- is to be validated. -- Sprint syntax: validate Unchecked_Conversion (source, target); -- N_Validate_Unchecked_Conversion -- Sloc points to instantiation (location for warning message) -- Source_Type -- Target_Type -- Note: in the case where a debug source file is generated, the Sloc -- for this node points to the VALIDATE keyword in the file output. ------------------------------- -- Variable_Reference_Marker -- ------------------------------- -- This node is created during the analysis of direct or expanded names, -- and the resolution of entry and subprogram calls. It performs several -- functions: -- * Variable reference markers provide a uniform model for handling -- variable references by the ABE mechanism, regardless of whether -- expansion took place. -- * The variable reference marker captures the entity of the variable -- being read or written. -- * The variable reference markers aid the ABE Processing phase by -- signaling the presence of a call in case the original variable -- reference was transformed by expansion. -- Sprint syntax: r#target# -- for a read -- rw#target# -- for a read/write -- w#target# -- for a write -- The Sprint syntax shown above is not enabled by default -- N_Variable_Reference_Marker -- Sloc points to Sloc of original variable reference -- Target -- Is_Elaboration_Checks_OK_Node -- Is_SPARK_Mode_On_Node -- Is_Elaboration_Warnings_OK_Node -- Is_Read -- Is_Write ----------- -- Empty -- ----------- -- Used as the contents of the Nkind field of the dummy Empty node and in -- some other situations to indicate an uninitialized value. -- N_Empty -- Chars is set to No_Name ----------- -- Error -- ----------- -- Used as the contents of the Nkind field of the dummy Error node. -- Has an Etype field, which gets set to Any_Type later on, to help -- error recovery (Error_Posted is also set in the Error node). -- N_Error -- Chars is set to Error_Name -- Etype end Sinfo;