repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
reznikmm/matreshka | Ada | 4,830 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, 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$
------------------------------------------------------------------------------
private with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
package Matreshka.Internals.Translator.XLIFF_Readers is
type XLIFF_Reader is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler with private;
private
type XLIFF_Reader is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler with
record
Context : Context_Access;
Source : League.Strings.Universal_String;
In_Source : Boolean := False;
Target : League.Strings.Universal_String;
In_Target : Boolean := False;
end record;
overriding procedure Characters
(Self : in out XLIFF_Reader;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out XLIFF_Reader;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding function Error_String
(Self : XLIFF_Reader) return League.Strings.Universal_String;
overriding procedure Start_Element
(Self : in out XLIFF_Reader;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
end Matreshka.Internals.Translator.XLIFF_Readers;
|
reznikmm/matreshka | Ada | 4,673 | 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.Dr3d_Sphere_Elements;
package Matreshka.ODF_Dr3d.Sphere_Elements is
type Dr3d_Sphere_Element_Node is
new Matreshka.ODF_Dr3d.Abstract_Dr3d_Element_Node
and ODF.DOM.Dr3d_Sphere_Elements.ODF_Dr3d_Sphere
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Dr3d_Sphere_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Dr3d_Sphere_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Dr3d_Sphere_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 Dr3d_Sphere_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 Dr3d_Sphere_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_Dr3d.Sphere_Elements;
|
sungyeon/drake | Ada | 3,418 | adb | pragma Check_Policy (Validate => Disable);
with Ada.Strings.Canonical_Composites;
-- with Ada.Strings.Naked_Maps.Debug;
with System.Once;
with System.Reference_Counting;
package body Ada.Strings.Naked_Maps.Canonical_Composites is
-- Base_Set
type Character_Set_Access_With_Pool is access Character_Set_Data;
Base_Set_Data : Character_Set_Access_With_Pool;
Base_Set_Flag : aliased System.Once.Flag := 0;
procedure Base_Set_Init;
procedure Base_Set_Init is
begin
Strings.Canonical_Composites.Initialize_D;
declare
Ranges : Character_Ranges (
1 .. Strings.Canonical_Composites.D_Map_Array'Length + 1);
Ranges_Last : Natural := 1;
Next : Character_Type;
begin
Ranges (1).Low := Character_Type'Val (0);
Ranges (1).High := Character_Type'Pred (
Strings.Canonical_Composites.D_Map (1).From);
Next := Character_Type'Succ (
Strings.Canonical_Composites.D_Map (1).From);
for I in 2 .. Strings.Canonical_Composites.D_Map_Array'Last loop
declare
Item : constant Character_Type :=
Strings.Canonical_Composites.D_Map (I).From;
begin
if Item > Next then
Ranges_Last := Ranges_Last + 1;
Ranges (Ranges_Last).Low := Next;
Ranges (Ranges_Last).High := Character_Type'Pred (Item);
end if;
Next := Character_Type'Succ (Item);
end;
end loop;
Base_Set_Data := new Character_Set_Data'(
Length => Ranges_Last,
Reference_Count => System.Reference_Counting.Static,
Items => Ranges (1 .. Ranges_Last));
end;
pragma Check (Validate, Debug.Valid (Base_Set_Data.all));
end Base_Set_Init;
-- implementation of Base_Set
function Base_Set return not null Character_Set_Access is
begin
System.Once.Initialize (Base_Set_Flag'Access, Base_Set_Init'Access);
return Character_Set_Access (Base_Set_Data);
end Base_Set;
-- Basic_Map
type Character_Mapping_Access_With_Pool is access Character_Mapping_Data;
Basic_Mapping : Character_Mapping_Access_With_Pool;
Basic_Mapping_Flag : aliased System.Once.Flag := 0;
procedure Basic_Mapping_Init;
procedure Basic_Mapping_Init is
begin
Strings.Canonical_Composites.Initialize_D;
Basic_Mapping := new Character_Mapping_Data'(
Length => Strings.Canonical_Composites.D_Map_Array'Length,
Reference_Count => System.Reference_Counting.Static,
From => <>,
To => <>);
for I in Strings.Canonical_Composites.D_Map_Array'Range loop
declare
E : Strings.Canonical_Composites.D_Map_Element
renames Strings.Canonical_Composites.D_Map (I);
begin
Basic_Mapping.From (I) := E.From;
Basic_Mapping.To (I) := E.To (1);
end;
end loop;
pragma Check (Validate, Debug.Valid (Basic_Mapping.all));
end Basic_Mapping_Init;
-- implementation of Basic_Map
function Basic_Map return not null Character_Mapping_Access is
begin
System.Once.Initialize (
Basic_Mapping_Flag'Access,
Basic_Mapping_Init'Access);
return Character_Mapping_Access (Basic_Mapping);
end Basic_Map;
end Ada.Strings.Naked_Maps.Canonical_Composites;
|
reznikmm/matreshka | Ada | 5,429 | ads | ------------------------------------------------------------------------------
-- --
-- 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.Internals.AMF_Links;
package AMF.Internals.Tables.AMF_Types is
-----------
-- Links --
-----------
-- Link can connect:
-- - single slot to single slot
-- - collection slot to single slot
-- - single slot to connetion slot
-- - connection slot to connection slot
-- - ? element and collection?
type Link_Kinds is
(L_None,
L_Single_Single,
L_Single_Multiple,
L_Multiple_Single,
L_Multiple_Multiple);
type Link_Record (Kind : Link_Kinds := L_None) is record
case Kind is
when L_None =>
null;
when L_Single_Single
| L_Single_Multiple
| L_Multiple_Single
| L_Multiple_Multiple
=>
Proxy : AMF.Internals.AMF_Links.AMF_Link_Proxy_Access;
Association : CMOF_Element;
First_Element : AMF_Element;
Second_Element : AMF_Element;
Next : AMF_Link;
-- Next link in the set of links. Set of links is one or more
-- links which destruction is atomic operation. It is implemented
-- as ring list.
end case;
end record;
-- type Link_Kinds is (L_None, L_Slot_Slot, L_Slot_Collection, L_Collection_Slot, L_Collection_Collection);
--
-- type Link_Record (Kind : Link_Kinds := L_None) is record
-- First_Element : Cmof_Element;
-- First_Property : Cmof_Element;
---- First_Collection : Collection_Of_CMOF_Element;
-- Second_Element : Cmof_Element;
-- Second_Property : Cmof_Element;
---- Second_Collection : Collection_Of_CMOF_Element;
--
-- case Kind is
-- when L_None =>
-- null;
--
-- when L_Slot_Slot | L_Slot_Collection =>
-- null;
--
-- when L_Collection_Slot | L_Collection_Collection =>
-- null;
---- First_Collection_Element : Collection_Element_Identifier;
---- Second_Collection_Element : Collection_Element_Identifier;
-- end case;
-- end record;
end AMF.Internals.Tables.AMF_Types;
|
docandrew/troodon | Ada | 1,262 | ads | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
package bits_types_u_mbstate_t_h is
-- Integral type unchanged by default argument promotions that can
-- hold any value corresponding to members of the extended character
-- set, as well as at least one value that does not correspond to any
-- member of the extended character set.
-- Conversion state information.
-- skipped anonymous struct anon_2
subtype uu_mbstate_t_array853 is Interfaces.C.char_array (0 .. 3);
type anon_3 (discr : unsigned := 0) is record
case discr is
when 0 =>
uu_wch : aliased unsigned; -- /usr/include/bits/types/__mbstate_t.h:18
when others =>
uu_wchb : aliased uu_mbstate_t_array853; -- /usr/include/bits/types/__mbstate_t.h:19
end case;
end record
with Convention => C_Pass_By_Copy,
Unchecked_Union => True;
type uu_mbstate_t is record
uu_count : aliased int; -- /usr/include/bits/types/__mbstate_t.h:15
uu_value : aliased anon_3; -- /usr/include/bits/types/__mbstate_t.h:20
end record
with Convention => C_Pass_By_Copy; -- /usr/include/bits/types/__mbstate_t.h:21
-- Value so far.
end bits_types_u_mbstate_t_h;
|
skordal/ada-regex | Ada | 705 | adb | -- Ada regular expression library
-- (c) Kristian Klomsten Skordal 2023 <[email protected]>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Regex.Utilities is
function Escape (Input : in String) return String is
Retval : Unbounded_String := Null_Unbounded_String;
begin
for C of Input loop
if C not in '(' | ')' | '[' | ']' | '*' | '.' | '|' | '\' | '+' | '?' | '-' | '$' then
Retval := Retval & C;
else
Retval := Retval & '\' & C;
end if;
end loop;
return To_String (Retval);
end Escape;
end Regex.Utilities;
|
reznikmm/matreshka | Ada | 3,635 | ads | ------------------------------------------------------------------------------
-- --
-- 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 XML.DOM.Attributes;
package ODF.DOM.Attributes.FO.Text_Align is
type ODF_FO_Text_Align is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_FO_Text_Align is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.FO.Text_Align;
|
reznikmm/matreshka | Ada | 4,187 | 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 Matreshka.DOM_Nodes;
with XML.DOM.Elements.Internals;
package body ODF.DOM.Elements.Style.Style.Internals is
------------
-- Create --
------------
function Create
(Node : Matreshka.ODF_Elements.Style.Style.Style_Style_Access)
return ODF.DOM.Elements.Style.Style.ODF_Style_Style is
begin
return
(XML.DOM.Elements.Internals.Create
(Matreshka.DOM_Nodes.Element_Access (Node)) with null record);
end Create;
----------
-- Wrap --
----------
function Wrap
(Node : Matreshka.ODF_Elements.Style.Style.Style_Style_Access)
return ODF.DOM.Elements.Style.Style.ODF_Style_Style is
begin
return
(XML.DOM.Elements.Internals.Wrap
(Matreshka.DOM_Nodes.Element_Access (Node)) with null record);
end Wrap;
end ODF.DOM.Elements.Style.Style.Internals;
|
reznikmm/matreshka | Ada | 55,644 | 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_Association_Classes is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Association_Class_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_Association_Class
(AMF.UML.Association_Classes.UML_Association_Class_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Association_Class_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_Association_Class
(AMF.UML.Association_Classes.UML_Association_Class_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Association_Class_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_Association_Class
(Visitor,
AMF.UML.Association_Classes.UML_Association_Class_Access (Self),
Control);
end if;
end Visit_Element;
------------------
-- Get_End_Type --
------------------
overriding function Get_End_Type
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is
begin
return
AMF.UML.Types.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_End_Type
(Self.Element)));
end Get_End_Type;
--------------------
-- Get_Is_Derived --
--------------------
overriding function Get_Is_Derived
(Self : not null access constant UML_Association_Class_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Derived
(Self.Element);
end Get_Is_Derived;
--------------------
-- Set_Is_Derived --
--------------------
overriding procedure Set_Is_Derived
(Self : not null access UML_Association_Class_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Derived
(Self.Element, To);
end Set_Is_Derived;
--------------------
-- Get_Member_End --
--------------------
overriding function Get_Member_End
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Member_End
(Self.Element)));
end Get_Member_End;
-----------------------------
-- Get_Navigable_Owned_End --
-----------------------------
overriding function Get_Navigable_Owned_End
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Navigable_Owned_End
(Self.Element)));
end Get_Navigable_Owned_End;
-------------------
-- Get_Owned_End --
-------------------
overriding function Get_Owned_End
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_End
(Self.Element)));
end Get_Owned_End;
-------------------------
-- Get_Related_Element --
-------------------------
overriding function Get_Related_Element
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element
(Self.Element)));
end Get_Related_Element;
-------------------
-- Get_Attribute --
-------------------
overriding function Get_Attribute
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Attribute
(Self.Element)));
end Get_Attribute;
---------------------------
-- Get_Collaboration_Use --
---------------------------
overriding function Get_Collaboration_Use
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is
begin
return
AMF.UML.Collaboration_Uses.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Collaboration_Use
(Self.Element)));
end Get_Collaboration_Use;
-----------------
-- Get_Feature --
-----------------
overriding function Get_Feature
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
return
AMF.UML.Features.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Feature
(Self.Element)));
end Get_Feature;
-----------------
-- Get_General --
-----------------
overriding function Get_General
(Self : not null access constant UML_Association_Class_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_General
(Self.Element)));
end Get_General;
------------------------
-- Get_Generalization --
------------------------
overriding function Get_Generalization
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is
begin
return
AMF.UML.Generalizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization
(Self.Element)));
end Get_Generalization;
--------------------------
-- Get_Inherited_Member --
--------------------------
overriding function Get_Inherited_Member
(Self : not null access constant UML_Association_Class_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_Inherited_Member
(Self.Element)));
end Get_Inherited_Member;
---------------------
-- Get_Is_Abstract --
---------------------
overriding function Get_Is_Abstract
(Self : not null access constant UML_Association_Class_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract
(Self.Element);
end Get_Is_Abstract;
---------------------------------
-- Get_Is_Final_Specialization --
---------------------------------
overriding function Get_Is_Final_Specialization
(Self : not null access constant UML_Association_Class_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Final_Specialization
(Self.Element);
end Get_Is_Final_Specialization;
---------------------------------
-- Set_Is_Final_Specialization --
---------------------------------
overriding procedure Set_Is_Final_Specialization
(Self : not null access UML_Association_Class_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Final_Specialization
(Self.Element, To);
end Set_Is_Final_Specialization;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is
begin
return
AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
------------------------
-- Get_Owned_Use_Case --
------------------------
overriding function Get_Owned_Use_Case
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Use_Case
(Self.Element)));
end Get_Owned_Use_Case;
--------------------------
-- Get_Powertype_Extent --
--------------------------
overriding function Get_Powertype_Extent
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is
begin
return
AMF.UML.Generalization_Sets.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype_Extent
(Self.Element)));
end Get_Powertype_Extent;
------------------------------
-- Get_Redefined_Classifier --
------------------------------
overriding function Get_Redefined_Classifier
(Self : not null access constant UML_Association_Class_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_Redefined_Classifier
(Self.Element)));
end Get_Redefined_Classifier;
------------------------
-- Get_Representation --
------------------------
overriding function Get_Representation
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is
begin
return
AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Representation
(Self.Element)));
end Get_Representation;
------------------------
-- Set_Representation --
------------------------
overriding procedure Set_Representation
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Representation
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Representation;
----------------------
-- Get_Substitution --
----------------------
overriding function Get_Substitution
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is
begin
return
AMF.UML.Substitutions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Substitution
(Self.Element)));
end Get_Substitution;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is
begin
return
AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
------------------
-- Get_Use_Case --
------------------
overriding function Get_Use_Case
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case
(Self.Element)));
end Get_Use_Case;
------------------------
-- Get_Element_Import --
------------------------
overriding function Get_Element_Import
(Self : not null access constant UML_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Package --
-----------------
overriding function Get_Package
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Packages.UML_Package_Access is
begin
return
AMF.UML.Packages.UML_Package_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Package
(Self.Element)));
end Get_Package;
-----------------
-- Set_Package --
-----------------
overriding procedure Set_Package
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Packages.UML_Package_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Package
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Package;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
begin
return
AMF.UML.Template_Signatures.UML_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
--------------------------
-- Get_Template_Binding --
--------------------------
overriding function Get_Template_Binding
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is
begin
return
AMF.UML.Template_Bindings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding
(Self.Element)));
end Get_Template_Binding;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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;
-------------------
-- Get_Extension --
-------------------
overriding function Get_Extension
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Extensions.Collections.Set_Of_UML_Extension is
begin
return
AMF.UML.Extensions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Extension
(Self.Element)));
end Get_Extension;
-------------------
-- Get_Is_Active --
-------------------
overriding function Get_Is_Active
(Self : not null access constant UML_Association_Class_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Active
(Self.Element);
end Get_Is_Active;
-------------------
-- Set_Is_Active --
-------------------
overriding procedure Set_Is_Active
(Self : not null access UML_Association_Class_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Active
(Self.Element, To);
end Set_Is_Active;
---------------------------
-- Get_Nested_Classifier --
---------------------------
overriding function Get_Nested_Classifier
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Classifiers.Collections.Ordered_Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Nested_Classifier
(Self.Element)));
end Get_Nested_Classifier;
-------------------------
-- Get_Owned_Attribute --
-------------------------
overriding function Get_Owned_Attribute
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Attribute
(Self.Element)));
end Get_Owned_Attribute;
-------------------------
-- Get_Owned_Operation --
-------------------------
overriding function Get_Owned_Operation
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation is
begin
return
AMF.UML.Operations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Operation
(Self.Element)));
end Get_Owned_Operation;
-------------------------
-- Get_Owned_Reception --
-------------------------
overriding function Get_Owned_Reception
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Receptions.Collections.Set_Of_UML_Reception is
begin
return
AMF.UML.Receptions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Reception
(Self.Element)));
end Get_Owned_Reception;
---------------------
-- Get_Super_Class --
---------------------
overriding function Get_Super_Class
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Classes.Collections.Set_Of_UML_Class is
begin
return
AMF.UML.Classes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Super_Class
(Self.Element)));
end Get_Super_Class;
-----------------------------
-- Get_Classifier_Behavior --
-----------------------------
overriding function Get_Classifier_Behavior
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access is
begin
return
AMF.UML.Behaviors.UML_Behavior_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier_Behavior
(Self.Element)));
end Get_Classifier_Behavior;
-----------------------------
-- Set_Classifier_Behavior --
-----------------------------
overriding procedure Set_Classifier_Behavior
(Self : not null access UML_Association_Class_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Classifier_Behavior
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Classifier_Behavior;
-------------------------------
-- Get_Interface_Realization --
-------------------------------
overriding function Get_Interface_Realization
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Interface_Realizations.Collections.Set_Of_UML_Interface_Realization is
begin
return
AMF.UML.Interface_Realizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Interface_Realization
(Self.Element)));
end Get_Interface_Realization;
------------------------
-- Get_Owned_Behavior --
------------------------
overriding function Get_Owned_Behavior
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is
begin
return
AMF.UML.Behaviors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Behavior
(Self.Element)));
end Get_Owned_Behavior;
--------------------
-- Get_Owned_Port --
--------------------
overriding function Get_Owned_Port
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Ports.Collections.Set_Of_UML_Port is
begin
return
AMF.UML.Ports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Port
(Self.Element)));
end Get_Owned_Port;
-------------------------
-- Get_Owned_Connector --
-------------------------
overriding function Get_Owned_Connector
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is
begin
return
AMF.UML.Connectors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Connector
(Self.Element)));
end Get_Owned_Connector;
--------------
-- Get_Part --
--------------
overriding function Get_Part
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Part
(Self.Element)));
end Get_Part;
--------------
-- Get_Role --
--------------
overriding function Get_Role
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Connectable_Elements.Collections.Set_Of_UML_Connectable_Element is
begin
return
AMF.UML.Connectable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Role
(Self.Element)));
end Get_Role;
--------------
-- End_Type --
--------------
overriding function End_Type
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Types.Collections.Ordered_Set_Of_UML_Type is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "End_Type unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.End_Type";
return End_Type (Self);
end End_Type;
------------------
-- All_Features --
------------------
overriding function All_Features
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.All_Features";
return All_Features (Self);
end All_Features;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant UML_Association_Class_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
-------------
-- General --
-------------
overriding function General
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "General unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.General";
return General (Self);
end General;
-----------------------
-- Has_Visibility_Of --
-----------------------
overriding function Has_Visibility_Of
(Self : not null access constant UML_Association_Class_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Has_Visibility_Of";
return Has_Visibility_Of (Self, N);
end Has_Visibility_Of;
-------------
-- Inherit --
-------------
overriding function Inherit
(Self : not null access constant UML_Association_Class_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
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, "Inherit unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Inherit";
return Inherit (Self, Inhs);
end Inherit;
-------------------------
-- Inheritable_Members --
-------------------------
overriding function Inheritable_Members
(Self : not null access constant UML_Association_Class_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
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, "Inheritable_Members unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Inheritable_Members";
return Inheritable_Members (Self, C);
end Inheritable_Members;
----------------------
-- Inherited_Member --
----------------------
overriding function Inherited_Member
(Self : not null access constant UML_Association_Class_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, "Inherited_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Inherited_Member";
return Inherited_Member (Self);
end Inherited_Member;
-----------------
-- Is_Template --
-----------------
overriding function Is_Template
(Self : not null access constant UML_Association_Class_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Is_Template";
return Is_Template (Self);
end Is_Template;
-------------------------
-- May_Specialize_Type --
-------------------------
overriding function May_Specialize_Type
(Self : not null access constant UML_Association_Class_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.May_Specialize_Type";
return May_Specialize_Type (Self, C);
end May_Specialize_Type;
------------------------
-- Exclude_Collisions --
------------------------
overriding function Exclude_Collisions
(Self : not null access constant UML_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_Proxy.Import_Members";
return Import_Members (Self, Imps);
end Import_Members;
---------------------
-- Imported_Member --
---------------------
overriding function Imported_Member
(Self : not null access constant UML_Association_Class_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_Association_Class_Proxy.Imported_Member";
return Imported_Member (Self);
end Imported_Member;
---------------------------------
-- Members_Are_Distinguishable --
---------------------------------
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_Proxy.Owned_Member";
return Owned_Member (Self);
end Owned_Member;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_Proxy.Namespace";
return Namespace (Self);
end Namespace;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant UML_Association_Class_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Association_Class_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Association_Class_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
----------------------------
-- Parameterable_Elements --
----------------------------
overriding function Parameterable_Elements
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Parameterable_Elements";
return Parameterable_Elements (Self);
end Parameterable_Elements;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Association_Class_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_Association_Class_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_Association_Class_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_Association_Class_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
---------------
-- Extension --
---------------
overriding function Extension
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Extensions.Collections.Set_Of_UML_Extension is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Extension unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Extension";
return Extension (Self);
end Extension;
-----------------
-- Super_Class --
-----------------
overriding function Super_Class
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Classes.Collections.Set_Of_UML_Class is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Super_Class unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Super_Class";
return Super_Class (Self);
end Super_Class;
----------------
-- Owned_Port --
----------------
overriding function Owned_Port
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Ports.Collections.Set_Of_UML_Port is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Owned_Port unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Owned_Port";
return Owned_Port (Self);
end Owned_Port;
----------
-- Part --
----------
overriding function Part
(Self : not null access constant UML_Association_Class_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Part unimplemented");
raise Program_Error with "Unimplemented procedure UML_Association_Class_Proxy.Part";
return Part (Self);
end Part;
end AMF.Internals.UML_Association_Classes;
|
afrl-rq/OpenUxAS | Ada | 8,096 | adb | package body Bounded_Dynamic_Arrays is
-----------
-- Clear --
-----------
procedure Clear (This : out Sequence) is
begin
This.Current_Length := 0;
This.Content := (others => Default_Value);
end Clear;
-------------------
-- Null_Sequence --
-------------------
function Null_Sequence return Sequence is
Result : Sequence (Capacity => 0);
begin
Result.Current_Length := 0;
Result.Content (1 .. 0) := Null_List;
pragma Assert (Value (Result) = Null_List);
return Result;
end Null_Sequence;
--------------
-- Instance --
--------------
function Instance
(Capacity : Natural_Index;
Content : List)
return Sequence
is
Result : Sequence (Capacity);
begin
Result.Current_Length := Content'Length;
Result.Content (1 .. Result.Current_Length) := Content;
pragma Assert (Content'Length = 0 or else
Contains_At (Result, 1, Content));
pragma Assert (Value (Result) = Content);
return Result;
end Instance;
--------------
-- Instance --
--------------
function Instance
(Content : List)
return Sequence
is
Result : Sequence (Capacity => Content'Length);
begin
pragma Assert (for all K in Result.Content'Range => Result.Content (K) = Default_Value);
Result.Current_Length := Content'Length;
Result.Content (1 .. Result.Current_Length) := Content;
pragma Assert (Content'Length = 0 or else
Contains_At (Result, 1, Content));
pragma Assert (Value (Result) = Content);
return Result;
end Instance;
--------------
-- Instance --
--------------
function Instance
(Capacity : Natural_Index;
Content : Component)
return Sequence
is
Result : Sequence (Capacity);
begin
Result.Current_Length := 1;
Result.Content (1) := Content;
return Result;
end Instance;
---------
-- "&" --
---------
function "&" (Left : Sequence; Right : Sequence) return Sequence is
begin
return Instance
(Capacity => Left.Current_Length + Right.Current_Length,
Content => Value (Left) & Value (Right));
end "&";
---------
-- "&" --
---------
function "&" (Left : Sequence; Right : List) return Sequence is
begin
return Instance
(Capacity => Left.Current_Length + Right'Length,
Content => Value (Left) & Right);
end "&";
---------
-- "&" --
---------
function "&" (Left : List; Right : Sequence) return Sequence is
begin
return Instance
(Capacity => Left'Length + Right.Current_Length,
Content => Normalized (Left) & Value (Right));
end "&";
---------
-- "&" --
---------
function "&" (Left : Sequence; Right : Component) return Sequence is
begin
return Instance
(Capacity => Left.Current_Length + 1,
Content => Value (Left) & Right);
end "&";
---------
-- "&" --
---------
function "&" (Left : Component; Right : Sequence) return Sequence is
begin
return Instance
(Capacity => Right.Current_Length + 1,
Content => Left & Value (Right));
end "&";
----------
-- Copy --
----------
procedure Copy (Source : Sequence; To : in out Sequence) is
begin
To.Current_Length := Source.Current_Length;
To.Content (1 .. To.Current_Length) := Source.Content (1 .. Source.Current_Length);
-- pragma Assert (Source.Current_Length = 0 or else
-- Contains_At (To, 1, Value (Source)));
end Copy;
----------
-- Copy --
----------
procedure Copy (Source : List; To : in out Sequence) is
begin
To.Current_Length := Source'Length;
To.Content (1 .. To.Current_Length) := Source;
-- pragma Assert (Source'Length = 0 or else
-- Contains_At (To, 1, Source));
-- pragma Assert (Value (To) = Source);
-- pragma Assert (To.Current_Length <= To.Capacity);
end Copy;
----------
-- Copy --
----------
procedure Copy (Source : Component; To : in out Sequence) is
begin
To.Content (1) := Source;
To.Current_Length := 1;
end Copy;
------------
-- Append --
------------
procedure Append (Tail : Sequence; To : in out Sequence) is
New_Length : constant Natural_Index := Length (Tail) + To.Current_Length;
begin
To.Content (1 .. New_Length) := Value (To) & Value (Tail);
To.Current_Length := New_Length;
end Append;
------------
-- Append --
------------
procedure Append (Tail : List; To : in out Sequence) is
New_Length : constant Natural_Index := Tail'Length + To.Current_Length;
begin
To.Content (1 .. New_Length) := Value (To) & Tail;
To.Current_Length := New_Length;
end Append;
------------
-- Append --
------------
procedure Append (Tail : Component; To : in out Sequence) is
New_Length : constant Index := 1 + To.Current_Length;
begin
To.Content (New_Length) := Tail;
To.Current_Length := New_Length;
end Append;
-----------
-- Amend --
-----------
procedure Amend (This : in out Sequence; By : Sequence; Start : Index) is
begin
Amend (This, Value (By), Start);
end Amend;
-----------
-- Amend --
-----------
procedure Amend (This : in out Sequence; By : List; Start : Index) is
Last : constant Index := Start + By'Length - 1;
begin
This.Content (Start .. Last) := By;
if Last > This.Current_Length then
This.Current_Length := Last;
end if;
end Amend;
-----------
-- Amend --
-----------
procedure Amend (This : in out Sequence; By : Component; Start : Index) is
begin
This.Content (Start) := By;
end Amend;
--------------
-- Location --
--------------
function Location (Fragment : Sequence; Within : Sequence) return Natural_Index is
begin
return Location (Value (Fragment), Within);
end Location;
--------------
-- Location --
--------------
function Location (Fragment : List; Within : Sequence) return Natural_Index is
begin
-- We must check for the empty Fragment since that would be found, but
-- we want to return zero (indicating not found) in that case. It would
-- be found because on the first iteration with K = 1, the condition in
-- the if-statement would be computing a null slice on the LHS of the
-- comparison (ie, the range would be 1 .. 1+0-1), and that LHS would
-- equal the RHS empty array fragment. We must also check for the
-- fragment not being longer than the content of Within itself.
if Fragment'Length in 1 .. Within.Current_Length then
for K in 1 .. (Within.Current_Length - Fragment'Length + 1) loop
if Contains_At (Within, K, Fragment) then
return K;
end if;
pragma Loop_Invariant
(for all J in 1 .. K => not Contains_At (Within, J, Fragment));
end loop;
end if;
return 0;
end Location;
--------------
-- Location --
--------------
function Location (Fragment : Component; Within : Sequence) return Natural_Index is
begin
for K in 1 .. Within.Current_Length loop
if Within.Content (K) = Fragment then
pragma Assert (Contains_At (Within, K, Fragment));
return K;
end if;
pragma Loop_Invariant ((for all J in 1 .. K => Within.Content (J) /= Fragment));
end loop;
return 0;
end Location;
----------------
-- Normalized --
----------------
function Normalized (L : List) return List is
-- This is a function instead of a subtype because we need it in a
-- postcondition as well as the "&" subprogram body, and we cannot
-- define subtypes in postconditions.
Result : constant List (1 .. L'Length) := L;
begin
return Result;
end Normalized;
end Bounded_Dynamic_Arrays;
|
zhmu/ananas | Ada | 5,442 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY COMPONENTS --
-- --
-- S Y S T E M . S T R I N G _ C O M P A R E --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-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 Ada.Unchecked_Conversion;
package body System.String_Compare is
type Word is mod 2 ** 32;
-- Used to process operands by words
type Big_Words is array (Natural) of Word;
type Big_Words_Ptr is access Big_Words;
for Big_Words_Ptr'Storage_Size use 0;
-- Array type used to access by words
type Byte is mod 2 ** 8;
-- Used to process operands by bytes
type Big_Bytes is array (Natural) of Byte;
type Big_Bytes_Ptr is access Big_Bytes;
for Big_Bytes_Ptr'Storage_Size use 0;
-- Array type used to access by bytes
function To_Big_Words is new
Ada.Unchecked_Conversion (System.Address, Big_Words_Ptr);
function To_Big_Bytes is new
Ada.Unchecked_Conversion (System.Address, Big_Bytes_Ptr);
-----------------
-- Str_Compare --
-----------------
function Str_Compare
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer
is
Compare_Len : constant Natural := Natural'Min (Left_Len, Right_Len);
begin
-- If operands are non-aligned, or length is too short, go by bytes
if (((Left or Right) and 2#11#) /= 0) or else Compare_Len < 4 then
return Str_Compare_Bytes (Left, Right, Left_Len, Right_Len);
end if;
-- Here we can go by words
declare
LeftP : constant Big_Words_Ptr := To_Big_Words (Left);
RightP : constant Big_Words_Ptr := To_Big_Words (Right);
Clen4 : constant Natural := Compare_Len / 4 - 1;
Clen4F : constant Natural := Clen4 * 4;
begin
for J in 0 .. Clen4 loop
if LeftP (J) /= RightP (J) then
return Str_Compare_Bytes
(Left + Address (4 * J),
Right + Address (4 * J),
4, 4);
end if;
end loop;
return Str_Compare_Bytes
(Left + Address (Clen4F),
Right + Address (Clen4F),
Left_Len - Clen4F,
Right_Len - Clen4F);
end;
end Str_Compare;
-----------------------
-- Str_Compare_Bytes --
-----------------------
function Str_Compare_Bytes
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer
is
Compare_Len : constant Natural := Natural'Min (Left_Len, Right_Len);
LeftP : constant Big_Bytes_Ptr := To_Big_Bytes (Left);
RightP : constant Big_Bytes_Ptr := To_Big_Bytes (Right);
begin
for J in 0 .. Compare_Len - 1 loop
if LeftP (J) /= RightP (J) then
if LeftP (J) > RightP (J) then
return +1;
else
return -1;
end if;
end if;
end loop;
if Left_Len = Right_Len then
return 0;
elsif Left_Len > Right_Len then
return +1;
else
return -1;
end if;
end Str_Compare_Bytes;
end System.String_Compare;
|
zhmu/ananas | Ada | 712 | adb | -- { dg-do compile }
-- { dg-options "-O2 -fno-inline -fdump-tree-optimized" }
-- { dg-additional-options "-cargs --param=sra-max-scalarization-size-Ospeed=32 -margs" { target aarch64-*-* powerpc*-*-* } }
procedure Opt39 (I : Integer) is
type Rec is record
I1 : Integer;
I2 : Integer;
I3 : Integer;
I4 : Integer;
I5 : Integer;
end record;
procedure Set (A : access Rec; I : Integer) is
Tmp : Rec := A.all;
begin
Tmp.I1 := I;
A.all := Tmp;
end;
R : aliased Rec;
begin
Set (R'Access, I);
if R.I1 /= I then
raise Program_Error;
end if;
end;
-- { dg-final { scan-tree-dump-not "MEM" "optimized" } }
-- { dg-final { scan-tree-dump-not "tmp" "optimized" } }
|
charlie5/cBound | Ada | 2,000 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with swig;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_glx_create_context_attribs_arb_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
context : aliased xcb.xcb_glx_context_t;
fbconfig : aliased xcb.xcb_glx_fbconfig_t;
screen : aliased Interfaces.Unsigned_32;
share_list : aliased xcb.xcb_glx_context_t;
is_direct : aliased Interfaces.Unsigned_8;
pad0 : aliased swig.int8_t_Array (0 .. 2);
num_attribs : aliased Interfaces.Unsigned_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_create_context_attribs_arb_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_create_context_attribs_arb_request_t.Item,
Element_Array =>
xcb.xcb_glx_create_context_attribs_arb_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_glx_create_context_attribs_arb_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_create_context_attribs_arb_request_t.Pointer,
Element_Array =>
xcb.xcb_glx_create_context_attribs_arb_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_create_context_attribs_arb_request_t;
|
tum-ei-rcs/StratoX | Ada | 3,440 | ads | -- This spec has been automatically generated from STM32F429x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with HAL;
with System;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- CR_Register --
-----------------
subtype CR_T_Field is HAL.UInt7;
-- Control register
type CR_Register is record
-- 7-bit counter (MSB to LSB)
T : CR_T_Field := 16#7F#;
-- Activation bit
WDGA : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
------------------
-- CFR_Register --
------------------
subtype CFR_W_Field is HAL.UInt7;
---------------
-- CFR.WDGTB --
---------------
-- CFR_WDGTB array
type CFR_WDGTB_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CFR_WDGTB
type CFR_WDGTB_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDGTB as a value
Val : HAL.UInt2;
when True =>
-- WDGTB as an array
Arr : CFR_WDGTB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CFR_WDGTB_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : CFR_W_Field := 16#7F#;
-- Timer base
WDGTB : CFR_WDGTB_Field := (As_Array => False, Val => 16#0#);
-- Early wakeup interrupt
EWI : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- SR_Register --
-----------------
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Window watchdog
type WWDG_Peripheral is record
-- Control register
CR : CR_Register;
-- Configuration register
CFR : CFR_Register;
-- Status register
SR : SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 0 range 0 .. 31;
CFR at 4 range 0 .. 31;
SR at 8 range 0 .. 31;
end record;
-- Window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => WWDG_Base;
end STM32_SVD.WWDG;
|
charlie5/lace | Ada | 154 | ads | with
eGL;
package opengl.Display.privvy
is
function to_eGL (Self : in Display.item'Class) return eGL.EGLDisplay;
end opengl.Display.privvy;
|
AdaCore/Ada_Drivers_Library | Ada | 3,272 | ads | -- This spec has been automatically generated from STM32F7x9.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.WWDG is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_T_Field is HAL.UInt7;
-- Control register
type CR_Register is record
-- 7-bit counter (MSB to LSB)
T : CR_T_Field := 16#7F#;
-- Activation bit
WDGA : Boolean := False;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
T at 0 range 0 .. 6;
WDGA at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype CFR_W_Field is HAL.UInt7;
-- CFR_WDGTB array
type CFR_WDGTB_Field_Array is array (0 .. 1) of Boolean
with Component_Size => 1, Size => 2;
-- Type definition for CFR_WDGTB
type CFR_WDGTB_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- WDGTB as a value
Val : HAL.UInt2;
when True =>
-- WDGTB as an array
Arr : CFR_WDGTB_Field_Array;
end case;
end record
with Unchecked_Union, Size => 2;
for CFR_WDGTB_Field use record
Val at 0 range 0 .. 1;
Arr at 0 range 0 .. 1;
end record;
-- Configuration register
type CFR_Register is record
-- 7-bit window value
W : CFR_W_Field := 16#7F#;
-- Timer base
WDGTB : CFR_WDGTB_Field := (As_Array => False, Val => 16#0#);
-- Early wakeup interrupt
EWI : Boolean := False;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFR_Register use record
W at 0 range 0 .. 6;
WDGTB at 0 range 7 .. 8;
EWI at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-- Status register
type SR_Register is record
-- Early wakeup interrupt flag
EWIF : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SR_Register use record
EWIF at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Window watchdog
type WWDG_Peripheral is record
-- Control register
CR : aliased CR_Register;
-- Configuration register
CFR : aliased CFR_Register;
-- Status register
SR : aliased SR_Register;
end record
with Volatile;
for WWDG_Peripheral use record
CR at 16#0# range 0 .. 31;
CFR at 16#4# range 0 .. 31;
SR at 16#8# range 0 .. 31;
end record;
-- Window watchdog
WWDG_Periph : aliased WWDG_Peripheral
with Import, Address => System'To_Address (16#40002C00#);
end STM32_SVD.WWDG;
|
zhmu/ananas | Ada | 77,744 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . M U L T I W A Y _ T R E E S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-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/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
with System.Put_Images;
package body Ada.Containers.Multiway_Trees with
SPARK_Mode => Off
is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
--------------------
-- Root_Iterator --
--------------------
type Root_Iterator is abstract new Limited_Controlled and
Tree_Iterator_Interfaces.Forward_Iterator with
record
Container : Tree_Access;
Subtree : Tree_Node_Access;
end record
with Disable_Controlled => not T_Check;
overriding procedure Finalize (Object : in out Root_Iterator);
-----------------------
-- Subtree_Iterator --
-----------------------
-- ??? these headers are a bit odd, but for sure they do not substitute
-- for documenting things, what *is* a Subtree_Iterator?
type Subtree_Iterator is new Root_Iterator with null record;
overriding function First (Object : Subtree_Iterator) return Cursor;
overriding function Next
(Object : Subtree_Iterator;
Position : Cursor) return Cursor;
---------------------
-- Child_Iterator --
---------------------
type Child_Iterator is new Root_Iterator and
Tree_Iterator_Interfaces.Reversible_Iterator with null record
with Disable_Controlled => not T_Check;
overriding function First (Object : Child_Iterator) return Cursor;
overriding function Next
(Object : Child_Iterator;
Position : Cursor) return Cursor;
overriding function Last (Object : Child_Iterator) return Cursor;
overriding function Previous
(Object : Child_Iterator;
Position : Cursor) return Cursor;
-----------------------
-- Local Subprograms --
-----------------------
function Root_Node (Container : Tree) return Tree_Node_Access;
procedure Deallocate_Node is
new Ada.Unchecked_Deallocation (Tree_Node_Type, Tree_Node_Access);
procedure Deallocate_Children
(Subtree : Tree_Node_Access;
Count : in out Count_Type);
procedure Deallocate_Subtree
(Subtree : in out Tree_Node_Access;
Count : in out Count_Type);
function Equal_Children
(Left_Subtree, Right_Subtree : Tree_Node_Access) return Boolean;
function Equal_Subtree
(Left_Subtree, Right_Subtree : Tree_Node_Access) return Boolean;
procedure Iterate_Children
(Container : Tree_Access;
Subtree : Tree_Node_Access;
Process : not null access procedure (Position : Cursor));
procedure Iterate_Subtree
(Container : Tree_Access;
Subtree : Tree_Node_Access;
Process : not null access procedure (Position : Cursor));
procedure Copy_Children
(Source : Children_Type;
Parent : Tree_Node_Access;
Count : in out Count_Type);
procedure Copy_Subtree
(Source : Tree_Node_Access;
Parent : Tree_Node_Access;
Target : out Tree_Node_Access;
Count : in out Count_Type);
function Find_In_Children
(Subtree : Tree_Node_Access;
Item : Element_Type) return Tree_Node_Access;
function Find_In_Subtree
(Subtree : Tree_Node_Access;
Item : Element_Type) return Tree_Node_Access;
function Child_Count (Children : Children_Type) return Count_Type;
function Subtree_Node_Count
(Subtree : Tree_Node_Access) return Count_Type;
function Is_Reachable (From, To : Tree_Node_Access) return Boolean;
procedure Remove_Subtree (Subtree : Tree_Node_Access);
procedure Insert_Subtree_Node
(Subtree : Tree_Node_Access;
Parent : Tree_Node_Access;
Before : Tree_Node_Access);
procedure Insert_Subtree_List
(First : Tree_Node_Access;
Last : Tree_Node_Access;
Parent : Tree_Node_Access;
Before : Tree_Node_Access);
procedure Splice_Children
(Target_Parent : Tree_Node_Access;
Before : Tree_Node_Access;
Source_Parent : Tree_Node_Access);
---------
-- "=" --
---------
function "=" (Left, Right : Tree) return Boolean is
begin
return Equal_Children (Root_Node (Left), Root_Node (Right));
end "=";
------------
-- Adjust --
------------
procedure Adjust (Container : in out Tree) is
Source : constant Children_Type := Container.Root.Children;
Source_Count : constant Count_Type := Container.Count;
Target_Count : Count_Type;
begin
-- We first restore the target container to its default-initialized
-- state, before we attempt any allocation, to ensure that invariants
-- are preserved in the event that the allocation fails.
Container.Root.Children := Children_Type'(others => null);
Zero_Counts (Container.TC);
Container.Count := 0;
-- Copy_Children returns a count of the number of nodes that it
-- allocates, but it works by incrementing the value that is passed
-- in. We must therefore initialize the count value before calling
-- Copy_Children.
Target_Count := 0;
-- Now we attempt the allocation of subtrees. The invariants are
-- satisfied even if the allocation fails.
Copy_Children (Source, Root_Node (Container), Target_Count);
pragma Assert (Target_Count = Source_Count);
Container.Count := Source_Count;
end Adjust;
-------------------
-- Ancestor_Find --
-------------------
function Ancestor_Find
(Position : Cursor;
Item : Element_Type) return Cursor
is
R, N : Tree_Node_Access;
begin
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
-- Commented-out pending official ruling from ARG. ???
-- if Position.Container /= Container'Unrestricted_Access then
-- raise Program_Error with "Position cursor not in container";
-- end if;
-- AI-0136 says to raise PE if Position equals the root node. This does
-- not seem correct, as this value is just the limiting condition of the
-- search. For now we omit this check, pending a ruling from the ARG.???
-- if Checks and then Is_Root (Position) then
-- raise Program_Error with "Position cursor designates root";
-- end if;
R := Root_Node (Position.Container.all);
N := Position.Node;
while N /= R loop
if N.Element = Item then
return Cursor'(Position.Container, N);
end if;
N := N.Parent;
end loop;
return No_Element;
end Ancestor_Find;
------------------
-- Append_Child --
------------------
procedure Append_Child
(Container : in out Tree;
Parent : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
is
First : Tree_Node_Access;
Last : Tree_Node_Access;
begin
TC_Check (Container.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Container'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
if Count = 0 then
return;
end if;
First := new Tree_Node_Type'(Parent => Parent.Node,
Element => New_Item,
others => <>);
Last := First;
for J in Count_Type'(2) .. Count loop
-- Reclaim other nodes if Storage_Error. ???
Last.Next := new Tree_Node_Type'(Parent => Parent.Node,
Prev => Last,
Element => New_Item,
others => <>);
Last := Last.Next;
end loop;
Insert_Subtree_List
(First => First,
Last => Last,
Parent => Parent.Node,
Before => null); -- null means "insert at end of list"
-- In order for operation Node_Count to complete in O(1) time, we cache
-- the count value. Here we increment the total count by the number of
-- nodes we just inserted.
Container.Count := Container.Count + Count;
end Append_Child;
------------
-- Assign --
------------
procedure Assign (Target : in out Tree; Source : Tree) is
Source_Count : constant Count_Type := Source.Count;
Target_Count : Count_Type;
begin
if Target'Address = Source'Address then
return;
end if;
Target.Clear; -- checks busy bit
-- Copy_Children returns the number of nodes that it allocates, but it
-- does this by incrementing the count value passed in, so we must
-- initialize the count before calling Copy_Children.
Target_Count := 0;
-- Note that Copy_Children inserts the newly-allocated children into
-- their parent list only after the allocation of all the children has
-- succeeded. This preserves invariants even if the allocation fails.
Copy_Children (Source.Root.Children, Root_Node (Target), Target_Count);
pragma Assert (Target_Count = Source_Count);
Target.Count := Source_Count;
end Assign;
-----------------
-- Child_Count --
-----------------
function Child_Count (Parent : Cursor) return Count_Type is
begin
return (if Parent = No_Element
then 0 else Child_Count (Parent.Node.Children));
end Child_Count;
function Child_Count (Children : Children_Type) return Count_Type is
Result : Count_Type;
Node : Tree_Node_Access;
begin
Result := 0;
Node := Children.First;
while Node /= null loop
Result := Result + 1;
Node := Node.Next;
end loop;
return Result;
end Child_Count;
-----------------
-- Child_Depth --
-----------------
function Child_Depth (Parent, Child : Cursor) return Count_Type is
Result : Count_Type;
N : Tree_Node_Access;
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Child = No_Element then
raise Constraint_Error with "Child cursor has no element";
end if;
if Checks and then Parent.Container /= Child.Container then
raise Program_Error with "Parent and Child in different containers";
end if;
Result := 0;
N := Child.Node;
while N /= Parent.Node loop
Result := Result + 1;
N := N.Parent;
if Checks and then N = null then
raise Program_Error with "Parent is not ancestor of Child";
end if;
end loop;
return Result;
end Child_Depth;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Tree) is
Container_Count, Children_Count : Count_Type;
begin
TC_Check (Container.TC);
-- We first set the container count to 0, in order to preserve
-- invariants in case the deallocation fails. (This works because
-- Deallocate_Children immediately removes the children from their
-- parent, and then does the actual deallocation.)
Container_Count := Container.Count;
Container.Count := 0;
-- Deallocate_Children returns the number of nodes that it deallocates,
-- but it does this by incrementing the count value that is passed in,
-- so we must first initialize the count return value before calling it.
Children_Count := 0;
-- See comment above. Deallocate_Children immediately removes the
-- children list from their parent node (here, the root of the tree),
-- and only after that does it attempt the actual deallocation. So even
-- if the deallocation fails, the representation invariants for the tree
-- are preserved.
Deallocate_Children (Root_Node (Container), Children_Count);
pragma Assert (Children_Count = Container_Count);
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Tree;
Position : Cursor) return Constant_Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with
"Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
if Checks and then Position.Node = Root_Node (Container) then
raise Program_Error with "Position cursor designates root";
end if;
-- Implement Vet for multiway tree???
-- pragma Assert (Vet (Position),
-- "Position cursor in Constant_Reference is bad");
declare
C : Tree renames Position.Container.all;
TC : constant Tamper_Counts_Access :=
C.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => Position.Node.Element'Access,
Control => (Controlled with TC))
do
Busy (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains
(Container : Tree;
Item : Element_Type) return Boolean
is
begin
return Find (Container, Item) /= No_Element;
end Contains;
----------
-- Copy --
----------
function Copy (Source : Tree) return Tree is
begin
return Target : Tree do
Copy_Children
(Source => Source.Root.Children,
Parent => Root_Node (Target),
Count => Target.Count);
pragma Assert (Target.Count = Source.Count);
end return;
end Copy;
-------------------
-- Copy_Children --
-------------------
procedure Copy_Children
(Source : Children_Type;
Parent : Tree_Node_Access;
Count : in out Count_Type)
is
pragma Assert (Parent /= null);
pragma Assert (Parent.Children.First = null);
pragma Assert (Parent.Children.Last = null);
CC : Children_Type;
C : Tree_Node_Access;
begin
-- We special-case the first allocation, in order to establish the
-- representation invariants for type Children_Type.
C := Source.First;
if C = null then
return;
end if;
Copy_Subtree
(Source => C,
Parent => Parent,
Target => CC.First,
Count => Count);
CC.Last := CC.First;
-- The representation invariants for the Children_Type list have been
-- established, so we can now copy the remaining children of Source.
C := C.Next;
while C /= null loop
Copy_Subtree
(Source => C,
Parent => Parent,
Target => CC.Last.Next,
Count => Count);
CC.Last.Next.Prev := CC.Last;
CC.Last := CC.Last.Next;
C := C.Next;
end loop;
-- Add the newly-allocated children to their parent list only after the
-- allocation has succeeded, so as to preserve invariants of the parent.
Parent.Children := CC;
end Copy_Children;
------------------
-- Copy_Subtree --
------------------
procedure Copy_Subtree
(Target : in out Tree;
Parent : Cursor;
Before : Cursor;
Source : Cursor)
is
Target_Subtree : Tree_Node_Access;
Target_Count : Count_Type;
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Target'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Target'Unrestricted_Access then
raise Program_Error with "Before cursor not in container";
end if;
if Checks and then Before.Node.Parent /= Parent.Node then
raise Constraint_Error with "Before cursor not child of Parent";
end if;
end if;
if Source = No_Element then
return;
end if;
if Checks and then Is_Root (Source) then
raise Constraint_Error with "Source cursor designates root";
end if;
-- Copy_Subtree returns a count of the number of nodes that it
-- allocates, but it works by incrementing the value that is passed
-- in. We must therefore initialize the count value before calling
-- Copy_Subtree.
Target_Count := 0;
Copy_Subtree
(Source => Source.Node,
Parent => Parent.Node,
Target => Target_Subtree,
Count => Target_Count);
pragma Assert (Target_Subtree /= null);
pragma Assert (Target_Subtree.Parent = Parent.Node);
pragma Assert (Target_Count >= 1);
Insert_Subtree_Node
(Subtree => Target_Subtree,
Parent => Parent.Node,
Before => Before.Node);
-- In order for operation Node_Count to complete in O(1) time, we cache
-- the count value. Here we increment the total count by the number of
-- nodes we just inserted.
Target.Count := Target.Count + Target_Count;
end Copy_Subtree;
procedure Copy_Subtree
(Source : Tree_Node_Access;
Parent : Tree_Node_Access;
Target : out Tree_Node_Access;
Count : in out Count_Type)
is
begin
Target := new Tree_Node_Type'(Element => Source.Element,
Parent => Parent,
others => <>);
Count := Count + 1;
Copy_Children
(Source => Source.Children,
Parent => Target,
Count => Count);
end Copy_Subtree;
-------------------------
-- Deallocate_Children --
-------------------------
procedure Deallocate_Children
(Subtree : Tree_Node_Access;
Count : in out Count_Type)
is
pragma Assert (Subtree /= null);
CC : Children_Type := Subtree.Children;
C : Tree_Node_Access;
begin
-- We immediately remove the children from their parent, in order to
-- preserve invariants in case the deallocation fails.
Subtree.Children := Children_Type'(others => null);
while CC.First /= null loop
C := CC.First;
CC.First := C.Next;
Deallocate_Subtree (C, Count);
end loop;
end Deallocate_Children;
------------------------
-- Deallocate_Subtree --
------------------------
procedure Deallocate_Subtree
(Subtree : in out Tree_Node_Access;
Count : in out Count_Type)
is
begin
Deallocate_Children (Subtree, Count);
Deallocate_Node (Subtree);
Count := Count + 1;
end Deallocate_Subtree;
---------------------
-- Delete_Children --
---------------------
procedure Delete_Children
(Container : in out Tree;
Parent : Cursor)
is
Count : Count_Type;
begin
TC_Check (Container.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Container'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
-- Deallocate_Children returns a count of the number of nodes that it
-- deallocates, but it works by incrementing the value that is passed
-- in. We must therefore initialize the count value before calling
-- Deallocate_Children.
Count := 0;
Deallocate_Children (Parent.Node, Count);
pragma Assert (Count <= Container.Count);
Container.Count := Container.Count - Count;
end Delete_Children;
-----------------
-- Delete_Leaf --
-----------------
procedure Delete_Leaf
(Container : in out Tree;
Position : in out Cursor)
is
X : Tree_Node_Access;
begin
TC_Check (Container.TC);
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor not in container";
end if;
if Checks and then Is_Root (Position) then
raise Program_Error with "Position cursor designates root";
end if;
if Checks and then not Is_Leaf (Position) then
raise Constraint_Error with "Position cursor does not designate leaf";
end if;
X := Position.Node;
Position := No_Element;
-- Restore represention invariants before attempting the actual
-- deallocation.
Remove_Subtree (X);
Container.Count := Container.Count - 1;
-- It is now safe to attempt the deallocation. This leaf node has been
-- disassociated from the tree, so even if the deallocation fails,
-- representation invariants will remain satisfied.
Deallocate_Node (X);
end Delete_Leaf;
--------------------
-- Delete_Subtree --
--------------------
procedure Delete_Subtree
(Container : in out Tree;
Position : in out Cursor)
is
X : Tree_Node_Access;
Count : Count_Type;
begin
TC_Check (Container.TC);
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor not in container";
end if;
if Checks and then Is_Root (Position) then
raise Program_Error with "Position cursor designates root";
end if;
X := Position.Node;
Position := No_Element;
-- Here is one case where a deallocation failure can result in the
-- violation of a representation invariant. We disassociate the subtree
-- from the tree now, but we only decrement the total node count after
-- we attempt the deallocation. However, if the deallocation fails, the
-- total node count will not get decremented.
-- One way around this dilemma is to count the nodes in the subtree
-- before attempt to delete the subtree, but that is an O(n) operation,
-- so it does not seem worth it.
-- Perhaps this is much ado about nothing, since the only way
-- deallocation can fail is if Controlled Finalization fails: this
-- propagates Program_Error so all bets are off anyway. ???
Remove_Subtree (X);
-- Deallocate_Subtree returns a count of the number of nodes that it
-- deallocates, but it works by incrementing the value that is passed
-- in. We must therefore initialize the count value before calling
-- Deallocate_Subtree.
Count := 0;
Deallocate_Subtree (X, Count);
pragma Assert (Count <= Container.Count);
-- See comments above. We would prefer to do this sooner, but there's no
-- way to satisfy that goal without a potentially severe execution
-- penalty.
Container.Count := Container.Count - Count;
end Delete_Subtree;
-----------
-- Depth --
-----------
function Depth (Position : Cursor) return Count_Type is
Result : Count_Type;
N : Tree_Node_Access;
begin
Result := 0;
N := Position.Node;
while N /= null loop
N := N.Parent;
Result := Result + 1;
end loop;
return Result;
end Depth;
-------------
-- Element --
-------------
function Element (Position : Cursor) return Element_Type is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Node = Root_Node (Position.Container.all)
then
raise Program_Error with "Position cursor designates root";
end if;
return Position.Node.Element;
end Element;
--------------------
-- Equal_Children --
--------------------
function Equal_Children
(Left_Subtree : Tree_Node_Access;
Right_Subtree : Tree_Node_Access) return Boolean
is
Left_Children : Children_Type renames Left_Subtree.Children;
Right_Children : Children_Type renames Right_Subtree.Children;
L, R : Tree_Node_Access;
begin
if Child_Count (Left_Children) /= Child_Count (Right_Children) then
return False;
end if;
L := Left_Children.First;
R := Right_Children.First;
while L /= null loop
if not Equal_Subtree (L, R) then
return False;
end if;
L := L.Next;
R := R.Next;
end loop;
return True;
end Equal_Children;
-------------------
-- Equal_Subtree --
-------------------
function Equal_Subtree
(Left_Position : Cursor;
Right_Position : Cursor) return Boolean
is
begin
if Checks and then Left_Position = No_Element then
raise Constraint_Error with "Left cursor has no element";
end if;
if Checks and then Right_Position = No_Element then
raise Constraint_Error with "Right cursor has no element";
end if;
if Left_Position = Right_Position then
return True;
end if;
if Is_Root (Left_Position) then
if not Is_Root (Right_Position) then
return False;
end if;
return Equal_Children (Left_Position.Node, Right_Position.Node);
end if;
if Is_Root (Right_Position) then
return False;
end if;
return Equal_Subtree (Left_Position.Node, Right_Position.Node);
end Equal_Subtree;
function Equal_Subtree
(Left_Subtree : Tree_Node_Access;
Right_Subtree : Tree_Node_Access) return Boolean
is
begin
if Left_Subtree.Element /= Right_Subtree.Element then
return False;
end if;
return Equal_Children (Left_Subtree, Right_Subtree);
end Equal_Subtree;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Root_Iterator) is
begin
Unbusy (Object.Container.TC);
end Finalize;
----------
-- Find --
----------
function Find
(Container : Tree;
Item : Element_Type) return Cursor
is
N : constant Tree_Node_Access :=
Find_In_Children (Root_Node (Container), Item);
begin
if N = null then
return No_Element;
else
return Cursor'(Container'Unrestricted_Access, N);
end if;
end Find;
-----------
-- First --
-----------
overriding function First (Object : Subtree_Iterator) return Cursor is
begin
if Object.Subtree = Root_Node (Object.Container.all) then
return First_Child (Root (Object.Container.all));
else
return Cursor'(Object.Container, Object.Subtree);
end if;
end First;
overriding function First (Object : Child_Iterator) return Cursor is
begin
return First_Child (Cursor'(Object.Container, Object.Subtree));
end First;
-----------------
-- First_Child --
-----------------
function First_Child (Parent : Cursor) return Cursor is
Node : Tree_Node_Access;
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
Node := Parent.Node.Children.First;
if Node = null then
return No_Element;
end if;
return Cursor'(Parent.Container, Node);
end First_Child;
-------------------------
-- First_Child_Element --
-------------------------
function First_Child_Element (Parent : Cursor) return Element_Type is
begin
return Element (First_Child (Parent));
end First_Child_Element;
----------------------
-- Find_In_Children --
----------------------
function Find_In_Children
(Subtree : Tree_Node_Access;
Item : Element_Type) return Tree_Node_Access
is
N, Result : Tree_Node_Access;
begin
N := Subtree.Children.First;
while N /= null loop
Result := Find_In_Subtree (N, Item);
if Result /= null then
return Result;
end if;
N := N.Next;
end loop;
return null;
end Find_In_Children;
---------------------
-- Find_In_Subtree --
---------------------
function Find_In_Subtree
(Position : Cursor;
Item : Element_Type) return Cursor
is
Result : Tree_Node_Access;
begin
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
-- Commented out pending official ruling by ARG. ???
-- if Checks and then
-- Position.Container /= Container'Unrestricted_Access
-- then
-- raise Program_Error with "Position cursor not in container";
-- end if;
Result :=
(if Is_Root (Position)
then Find_In_Children (Position.Node, Item)
else Find_In_Subtree (Position.Node, Item));
if Result = null then
return No_Element;
end if;
return Cursor'(Position.Container, Result);
end Find_In_Subtree;
function Find_In_Subtree
(Subtree : Tree_Node_Access;
Item : Element_Type) return Tree_Node_Access
is
begin
if Subtree.Element = Item then
return Subtree;
end if;
return Find_In_Children (Subtree, Item);
end Find_In_Subtree;
------------------------
-- Get_Element_Access --
------------------------
function Get_Element_Access
(Position : Cursor) return not null Element_Access is
begin
return Position.Node.Element'Access;
end Get_Element_Access;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
return (if Position = No_Element then False
else Position.Node.Parent /= null);
end Has_Element;
------------------
-- Insert_Child --
------------------
procedure Insert_Child
(Container : in out Tree;
Parent : Cursor;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
is
Position : Cursor;
begin
Insert_Child (Container, Parent, Before, New_Item, Position, Count);
end Insert_Child;
procedure Insert_Child
(Container : in out Tree;
Parent : Cursor;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1)
is
First : Tree_Node_Access;
Last : Tree_Node_Access;
begin
TC_Check (Container.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Container'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor not in container";
end if;
if Checks and then Before.Node.Parent /= Parent.Node then
raise Constraint_Error with "Parent cursor not parent of Before";
end if;
end if;
if Count = 0 then
Position := No_Element; -- Need ruling from ARG ???
return;
end if;
First := new Tree_Node_Type'(Parent => Parent.Node,
Element => New_Item,
others => <>);
Last := First;
for J in Count_Type'(2) .. Count loop
-- Reclaim other nodes if Storage_Error. ???
Last.Next := new Tree_Node_Type'(Parent => Parent.Node,
Prev => Last,
Element => New_Item,
others => <>);
Last := Last.Next;
end loop;
Insert_Subtree_List
(First => First,
Last => Last,
Parent => Parent.Node,
Before => Before.Node);
-- In order for operation Node_Count to complete in O(1) time, we cache
-- the count value. Here we increment the total count by the number of
-- nodes we just inserted.
Container.Count := Container.Count + Count;
Position := Cursor'(Parent.Container, First);
end Insert_Child;
procedure Insert_Child
(Container : in out Tree;
Parent : Cursor;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1)
is
First : Tree_Node_Access;
Last : Tree_Node_Access;
begin
TC_Check (Container.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Container'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor not in container";
end if;
if Checks and then Before.Node.Parent /= Parent.Node then
raise Constraint_Error with "Parent cursor not parent of Before";
end if;
end if;
if Count = 0 then
Position := No_Element; -- Need ruling from ARG ???
return;
end if;
First := new Tree_Node_Type'(Parent => Parent.Node,
Element => <>,
others => <>);
Last := First;
for J in Count_Type'(2) .. Count loop
-- Reclaim other nodes if Storage_Error. ???
Last.Next := new Tree_Node_Type'(Parent => Parent.Node,
Prev => Last,
Element => <>,
others => <>);
Last := Last.Next;
end loop;
Insert_Subtree_List
(First => First,
Last => Last,
Parent => Parent.Node,
Before => Before.Node);
-- In order for operation Node_Count to complete in O(1) time, we cache
-- the count value. Here we increment the total count by the number of
-- nodes we just inserted.
Container.Count := Container.Count + Count;
Position := Cursor'(Parent.Container, First);
end Insert_Child;
-------------------------
-- Insert_Subtree_List --
-------------------------
procedure Insert_Subtree_List
(First : Tree_Node_Access;
Last : Tree_Node_Access;
Parent : Tree_Node_Access;
Before : Tree_Node_Access)
is
pragma Assert (Parent /= null);
C : Children_Type renames Parent.Children;
begin
-- This is a simple utility operation to insert a list of nodes (from
-- First..Last) as children of Parent. The Before node specifies where
-- the new children should be inserted relative to the existing
-- children.
if First = null then
pragma Assert (Last = null);
return;
end if;
pragma Assert (Last /= null);
pragma Assert (Before = null or else Before.Parent = Parent);
if C.First = null then
C.First := First;
C.First.Prev := null;
C.Last := Last;
C.Last.Next := null;
elsif Before = null then -- means "insert after existing nodes"
C.Last.Next := First;
First.Prev := C.Last;
C.Last := Last;
C.Last.Next := null;
elsif Before = C.First then
Last.Next := C.First;
C.First.Prev := Last;
C.First := First;
C.First.Prev := null;
else
Before.Prev.Next := First;
First.Prev := Before.Prev;
Last.Next := Before;
Before.Prev := Last;
end if;
end Insert_Subtree_List;
-------------------------
-- Insert_Subtree_Node --
-------------------------
procedure Insert_Subtree_Node
(Subtree : Tree_Node_Access;
Parent : Tree_Node_Access;
Before : Tree_Node_Access)
is
begin
-- This is a simple wrapper operation to insert a single child into the
-- Parent's children list.
Insert_Subtree_List
(First => Subtree,
Last => Subtree,
Parent => Parent,
Before => Before);
end Insert_Subtree_Node;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Tree) return Boolean is
begin
return Container.Root.Children.First = null;
end Is_Empty;
-------------
-- Is_Leaf --
-------------
function Is_Leaf (Position : Cursor) return Boolean is
begin
return (if Position = No_Element then False
else Position.Node.Children.First = null);
end Is_Leaf;
------------------
-- Is_Reachable --
------------------
function Is_Reachable (From, To : Tree_Node_Access) return Boolean is
pragma Assert (From /= null);
pragma Assert (To /= null);
N : Tree_Node_Access;
begin
N := From;
while N /= null loop
if N = To then
return True;
end if;
N := N.Parent;
end loop;
return False;
end Is_Reachable;
-------------
-- Is_Root --
-------------
function Is_Root (Position : Cursor) return Boolean is
begin
return (if Position.Container = null then False
else Position = Root (Position.Container.all));
end Is_Root;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : Tree;
Process : not null access procedure (Position : Cursor))
is
Busy : With_Busy (Container.TC'Unrestricted_Access);
begin
Iterate_Children
(Container => Container'Unrestricted_Access,
Subtree => Root_Node (Container),
Process => Process);
end Iterate;
function Iterate (Container : Tree)
return Tree_Iterator_Interfaces.Forward_Iterator'Class
is
begin
return Iterate_Subtree (Root (Container));
end Iterate;
----------------------
-- Iterate_Children --
----------------------
procedure Iterate_Children
(Parent : Cursor;
Process : not null access procedure (Position : Cursor))
is
C : Tree_Node_Access;
Busy : With_Busy (Parent.Container.TC'Unrestricted_Access);
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
C := Parent.Node.Children.First;
while C /= null loop
Process (Position => Cursor'(Parent.Container, Node => C));
C := C.Next;
end loop;
end Iterate_Children;
procedure Iterate_Children
(Container : Tree_Access;
Subtree : Tree_Node_Access;
Process : not null access procedure (Position : Cursor))
is
Node : Tree_Node_Access;
begin
-- This is a helper function to recursively iterate over all the nodes
-- in a subtree, in depth-first fashion. This particular helper just
-- visits the children of this subtree, not the root of the subtree node
-- itself. This is useful when starting from the ultimate root of the
-- entire tree (see Iterate), as that root does not have an element.
Node := Subtree.Children.First;
while Node /= null loop
Iterate_Subtree (Container, Node, Process);
Node := Node.Next;
end loop;
end Iterate_Children;
function Iterate_Children
(Container : Tree;
Parent : Cursor)
return Tree_Iterator_Interfaces.Reversible_Iterator'Class
is
C : constant Tree_Access := Container'Unrestricted_Access;
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= C then
raise Program_Error with "Parent cursor not in container";
end if;
return It : constant Child_Iterator :=
(Limited_Controlled with
Container => C,
Subtree => Parent.Node)
do
Busy (C.TC);
end return;
end Iterate_Children;
---------------------
-- Iterate_Subtree --
---------------------
function Iterate_Subtree
(Position : Cursor)
return Tree_Iterator_Interfaces.Forward_Iterator'Class
is
C : constant Tree_Access := Position.Container;
begin
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
-- Implement Vet for multiway trees???
-- pragma Assert (Vet (Position), "bad subtree cursor");
return It : constant Subtree_Iterator :=
(Limited_Controlled with
Container => C,
Subtree => Position.Node)
do
Busy (C.TC);
end return;
end Iterate_Subtree;
procedure Iterate_Subtree
(Position : Cursor;
Process : not null access procedure (Position : Cursor))
is
Busy : With_Busy (Position.Container.TC'Unrestricted_Access);
begin
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Is_Root (Position) then
Iterate_Children (Position.Container, Position.Node, Process);
else
Iterate_Subtree (Position.Container, Position.Node, Process);
end if;
end Iterate_Subtree;
procedure Iterate_Subtree
(Container : Tree_Access;
Subtree : Tree_Node_Access;
Process : not null access procedure (Position : Cursor))
is
begin
-- This is a helper function to recursively iterate over all the nodes
-- in a subtree, in depth-first fashion. It first visits the root of the
-- subtree, then visits its children.
Process (Cursor'(Container, Subtree));
Iterate_Children (Container, Subtree, Process);
end Iterate_Subtree;
----------
-- Last --
----------
overriding function Last (Object : Child_Iterator) return Cursor is
begin
return Last_Child (Cursor'(Object.Container, Object.Subtree));
end Last;
----------------
-- Last_Child --
----------------
function Last_Child (Parent : Cursor) return Cursor is
Node : Tree_Node_Access;
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
Node := Parent.Node.Children.Last;
if Node = null then
return No_Element;
end if;
return (Parent.Container, Node);
end Last_Child;
------------------------
-- Last_Child_Element --
------------------------
function Last_Child_Element (Parent : Cursor) return Element_Type is
begin
return Element (Last_Child (Parent));
end Last_Child_Element;
----------
-- Move --
----------
procedure Move (Target : in out Tree; Source : in out Tree) is
Node : Tree_Node_Access;
begin
if Target'Address = Source'Address then
return;
end if;
TC_Check (Source.TC);
Target.Clear; -- checks busy bit
Target.Root.Children := Source.Root.Children;
Source.Root.Children := Children_Type'(others => null);
Node := Target.Root.Children.First;
while Node /= null loop
Node.Parent := Root_Node (Target);
Node := Node.Next;
end loop;
Target.Count := Source.Count;
Source.Count := 0;
end Move;
----------
-- Next --
----------
function Next
(Object : Subtree_Iterator;
Position : Cursor) return Cursor
is
Node : Tree_Node_Access;
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong tree";
end if;
Node := Position.Node;
if Node.Children.First /= null then
return Cursor'(Object.Container, Node.Children.First);
end if;
while Node /= Object.Subtree loop
if Node.Next /= null then
return Cursor'(Object.Container, Node.Next);
end if;
Node := Node.Parent;
end loop;
return No_Element;
end Next;
function Next
(Object : Child_Iterator;
Position : Cursor) return Cursor
is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong tree";
end if;
return Next_Sibling (Position);
end Next;
------------------
-- Next_Sibling --
------------------
function Next_Sibling (Position : Cursor) return Cursor is
begin
if Position = No_Element then
return No_Element;
end if;
if Position.Node.Next = null then
return No_Element;
end if;
return Cursor'(Position.Container, Position.Node.Next);
end Next_Sibling;
procedure Next_Sibling (Position : in out Cursor) is
begin
Position := Next_Sibling (Position);
end Next_Sibling;
----------------
-- Node_Count --
----------------
function Node_Count (Container : Tree) return Count_Type is
begin
-- Container.Count is the number of nodes we have actually allocated. We
-- cache the value specifically so this Node_Count operation can execute
-- in O(1) time, which makes it behave similarly to how the Length
-- selector function behaves for other containers.
-- The cached node count value only describes the nodes we have
-- allocated; the root node itself is not included in that count. The
-- Node_Count operation returns a value that includes the root node
-- (because the RM says so), so we must add 1 to our cached value.
return 1 + Container.Count;
end Node_Count;
------------
-- Parent --
------------
function Parent (Position : Cursor) return Cursor is
begin
if Position = No_Element then
return No_Element;
end if;
if Position.Node.Parent = null then
return No_Element;
end if;
return Cursor'(Position.Container, Position.Node.Parent);
end Parent;
-------------------
-- Prepend_Child --
-------------------
procedure Prepend_Child
(Container : in out Tree;
Parent : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
is
First, Last : Tree_Node_Access;
begin
TC_Check (Container.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Container'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
if Count = 0 then
return;
end if;
First := new Tree_Node_Type'(Parent => Parent.Node,
Element => New_Item,
others => <>);
Last := First;
for J in Count_Type'(2) .. Count loop
-- Reclaim other nodes if Storage_Error???
Last.Next := new Tree_Node_Type'(Parent => Parent.Node,
Prev => Last,
Element => New_Item,
others => <>);
Last := Last.Next;
end loop;
Insert_Subtree_List
(First => First,
Last => Last,
Parent => Parent.Node,
Before => Parent.Node.Children.First);
-- In order for operation Node_Count to complete in O(1) time, we cache
-- the count value. Here we increment the total count by the number of
-- nodes we just inserted.
Container.Count := Container.Count + Count;
end Prepend_Child;
--------------
-- Previous --
--------------
overriding function Previous
(Object : Child_Iterator;
Position : Cursor) return Cursor
is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Previous designates wrong tree";
end if;
return Previous_Sibling (Position);
end Previous;
----------------------
-- Previous_Sibling --
----------------------
function Previous_Sibling (Position : Cursor) return Cursor is
begin
return
(if Position = No_Element then No_Element
elsif Position.Node.Prev = null then No_Element
else Cursor'(Position.Container, Position.Node.Prev));
end Previous_Sibling;
procedure Previous_Sibling (Position : in out Cursor) is
begin
Position := Previous_Sibling (Position);
end Previous_Sibling;
----------------------
-- Pseudo_Reference --
----------------------
function Pseudo_Reference
(Container : aliased Tree'Class) return Reference_Control_Type
is
TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Control_Type := (Controlled with TC) do
Busy (TC.all);
end return;
end Pseudo_Reference;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
T : Tree renames Position.Container.all'Unrestricted_Access.all;
Lock : With_Lock (T.TC'Unrestricted_Access);
begin
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Is_Root (Position) then
raise Program_Error with "Position cursor designates root";
end if;
Process (Position.Node.Element);
end Query_Element;
---------------
-- Put_Image --
---------------
procedure Put_Image
(S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : Tree)
is
use System.Put_Images;
procedure Rec (Position : Cursor);
-- Recursive routine operating on cursors
procedure Rec (Position : Cursor) is
First_Time : Boolean := True;
begin
Array_Before (S);
for X in Iterate_Children (V, Position) loop
if First_Time then
First_Time := False;
else
Array_Between (S);
end if;
Element_Type'Put_Image (S, Element (X));
if Child_Count (X) > 0 then
Simple_Array_Between (S);
Rec (X);
end if;
end loop;
Array_After (S);
end Rec;
begin
if First_Child (Root (V)) = No_Element then
Array_Before (S);
Array_After (S);
else
Rec (First_Child (Root (V)));
end if;
end Put_Image;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Tree)
is
procedure Read_Children (Subtree : Tree_Node_Access);
function Read_Subtree
(Parent : Tree_Node_Access) return Tree_Node_Access;
Total_Count : Count_Type'Base;
-- Value read from the stream that says how many elements follow
Read_Count : Count_Type'Base;
-- Actual number of elements read from the stream
-------------------
-- Read_Children --
-------------------
procedure Read_Children (Subtree : Tree_Node_Access) is
pragma Assert (Subtree /= null);
pragma Assert (Subtree.Children.First = null);
pragma Assert (Subtree.Children.Last = null);
Count : Count_Type'Base;
-- Number of child subtrees
C : Children_Type;
begin
Count_Type'Read (Stream, Count);
if Checks and then Count < 0 then
raise Program_Error with "attempt to read from corrupt stream";
end if;
if Count = 0 then
return;
end if;
C.First := Read_Subtree (Parent => Subtree);
C.Last := C.First;
for J in Count_Type'(2) .. Count loop
C.Last.Next := Read_Subtree (Parent => Subtree);
C.Last.Next.Prev := C.Last;
C.Last := C.Last.Next;
end loop;
-- Now that the allocation and reads have completed successfully, it
-- is safe to link the children to their parent.
Subtree.Children := C;
end Read_Children;
------------------
-- Read_Subtree --
------------------
function Read_Subtree
(Parent : Tree_Node_Access) return Tree_Node_Access
is
Subtree : constant Tree_Node_Access :=
new Tree_Node_Type'
(Parent => Parent,
Element => Element_Type'Input (Stream),
others => <>);
begin
Read_Count := Read_Count + 1;
Read_Children (Subtree);
return Subtree;
end Read_Subtree;
-- Start of processing for Read
begin
Container.Clear; -- checks busy bit
Count_Type'Read (Stream, Total_Count);
if Checks and then Total_Count < 0 then
raise Program_Error with "attempt to read from corrupt stream";
end if;
if Total_Count = 0 then
return;
end if;
Read_Count := 0;
Read_Children (Root_Node (Container));
if Checks and then Read_Count /= Total_Count then
raise Program_Error with "attempt to read from corrupt stream";
end if;
Container.Count := Total_Count;
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Position : out Cursor)
is
begin
raise Program_Error with "attempt to read tree cursor from stream";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
---------------
-- Reference --
---------------
function Reference
(Container : aliased in out Tree;
Position : Cursor) return Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with
"Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
if Checks and then Position.Node = Root_Node (Container) then
raise Program_Error with "Position cursor designates root";
end if;
-- Implement Vet for multiway tree???
-- pragma Assert (Vet (Position),
-- "Position cursor in Constant_Reference is bad");
declare
C : Tree renames Position.Container.all;
TC : constant Tamper_Counts_Access :=
C.TC'Unrestricted_Access;
begin
return R : constant Reference_Type :=
(Element => Position.Node.Element'Access,
Control => (Controlled with TC))
do
Busy (TC.all);
end return;
end;
end Reference;
--------------------
-- Remove_Subtree --
--------------------
procedure Remove_Subtree (Subtree : Tree_Node_Access) is
C : Children_Type renames Subtree.Parent.Children;
begin
-- This is a utility operation to remove a subtree node from its
-- parent's list of children.
if C.First = Subtree then
pragma Assert (Subtree.Prev = null);
if C.Last = Subtree then
pragma Assert (Subtree.Next = null);
C.First := null;
C.Last := null;
else
C.First := Subtree.Next;
C.First.Prev := null;
end if;
elsif C.Last = Subtree then
pragma Assert (Subtree.Next = null);
C.Last := Subtree.Prev;
C.Last.Next := null;
else
Subtree.Prev.Next := Subtree.Next;
Subtree.Next.Prev := Subtree.Prev;
end if;
end Remove_Subtree;
----------------------
-- Replace_Element --
----------------------
procedure Replace_Element
(Container : in out Tree;
Position : Cursor;
New_Item : Element_Type)
is
begin
TE_Check (Container.TC);
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor not in container";
end if;
if Checks and then Is_Root (Position) then
raise Program_Error with "Position cursor designates root";
end if;
Position.Node.Element := New_Item;
end Replace_Element;
------------------------------
-- Reverse_Iterate_Children --
------------------------------
procedure Reverse_Iterate_Children
(Parent : Cursor;
Process : not null access procedure (Position : Cursor))
is
C : Tree_Node_Access;
Busy : With_Busy (Parent.Container.TC'Unrestricted_Access);
begin
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
C := Parent.Node.Children.Last;
while C /= null loop
Process (Position => Cursor'(Parent.Container, Node => C));
C := C.Prev;
end loop;
end Reverse_Iterate_Children;
----------
-- Root --
----------
function Root (Container : Tree) return Cursor is
begin
return (Container'Unrestricted_Access, Root_Node (Container));
end Root;
---------------
-- Root_Node --
---------------
function Root_Node (Container : Tree) return Tree_Node_Access is
type Root_Node_Access is access all Root_Node_Type;
for Root_Node_Access'Storage_Size use 0;
pragma Convention (C, Root_Node_Access);
function To_Tree_Node_Access is
new Ada.Unchecked_Conversion (Root_Node_Access, Tree_Node_Access);
-- Start of processing for Root_Node
begin
-- This is a utility function for converting from an access type that
-- designates the distinguished root node to an access type designating
-- a non-root node. The representation of a root node does not have an
-- element, but is otherwise identical to a non-root node, so the
-- conversion itself is safe.
return To_Tree_Node_Access (Container.Root'Unrestricted_Access);
end Root_Node;
---------------------
-- Splice_Children --
---------------------
procedure Splice_Children
(Target : in out Tree;
Target_Parent : Cursor;
Before : Cursor;
Source : in out Tree;
Source_Parent : Cursor)
is
Count : Count_Type;
begin
TC_Check (Target.TC);
TC_Check (Source.TC);
if Checks and then Target_Parent = No_Element then
raise Constraint_Error with "Target_Parent cursor has no element";
end if;
if Checks and then Target_Parent.Container /= Target'Unrestricted_Access
then
raise Program_Error
with "Target_Parent cursor not in Target container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Target'Unrestricted_Access then
raise Program_Error
with "Before cursor not in Target container";
end if;
if Checks and then Before.Node.Parent /= Target_Parent.Node then
raise Constraint_Error
with "Before cursor not child of Target_Parent";
end if;
end if;
if Checks and then Source_Parent = No_Element then
raise Constraint_Error with "Source_Parent cursor has no element";
end if;
if Checks and then Source_Parent.Container /= Source'Unrestricted_Access
then
raise Program_Error
with "Source_Parent cursor not in Source container";
end if;
if Target'Address = Source'Address then
if Target_Parent = Source_Parent then
return;
end if;
if Checks and then Is_Reachable (From => Target_Parent.Node,
To => Source_Parent.Node)
then
raise Constraint_Error
with "Source_Parent is ancestor of Target_Parent";
end if;
Splice_Children
(Target_Parent => Target_Parent.Node,
Before => Before.Node,
Source_Parent => Source_Parent.Node);
return;
end if;
-- We cache the count of the nodes we have allocated, so that operation
-- Node_Count can execute in O(1) time. But that means we must count the
-- nodes in the subtree we remove from Source and insert into Target, in
-- order to keep the count accurate.
Count := Subtree_Node_Count (Source_Parent.Node);
pragma Assert (Count >= 1);
Count := Count - 1; -- because Source_Parent node does not move
Splice_Children
(Target_Parent => Target_Parent.Node,
Before => Before.Node,
Source_Parent => Source_Parent.Node);
Source.Count := Source.Count - Count;
Target.Count := Target.Count + Count;
end Splice_Children;
procedure Splice_Children
(Container : in out Tree;
Target_Parent : Cursor;
Before : Cursor;
Source_Parent : Cursor)
is
begin
TC_Check (Container.TC);
if Checks and then Target_Parent = No_Element then
raise Constraint_Error with "Target_Parent cursor has no element";
end if;
if Checks and then
Target_Parent.Container /= Container'Unrestricted_Access
then
raise Program_Error
with "Target_Parent cursor not in container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error
with "Before cursor not in container";
end if;
if Checks and then Before.Node.Parent /= Target_Parent.Node then
raise Constraint_Error
with "Before cursor not child of Target_Parent";
end if;
end if;
if Checks and then Source_Parent = No_Element then
raise Constraint_Error with "Source_Parent cursor has no element";
end if;
if Checks and then
Source_Parent.Container /= Container'Unrestricted_Access
then
raise Program_Error
with "Source_Parent cursor not in container";
end if;
if Target_Parent = Source_Parent then
return;
end if;
if Checks and then Is_Reachable (From => Target_Parent.Node,
To => Source_Parent.Node)
then
raise Constraint_Error
with "Source_Parent is ancestor of Target_Parent";
end if;
Splice_Children
(Target_Parent => Target_Parent.Node,
Before => Before.Node,
Source_Parent => Source_Parent.Node);
end Splice_Children;
procedure Splice_Children
(Target_Parent : Tree_Node_Access;
Before : Tree_Node_Access;
Source_Parent : Tree_Node_Access)
is
CC : constant Children_Type := Source_Parent.Children;
C : Tree_Node_Access;
begin
-- This is a utility operation to remove the children from
-- Source parent and insert them into Target parent.
Source_Parent.Children := Children_Type'(others => null);
-- Fix up the Parent pointers of each child to designate
-- its new Target parent.
C := CC.First;
while C /= null loop
C.Parent := Target_Parent;
C := C.Next;
end loop;
Insert_Subtree_List
(First => CC.First,
Last => CC.Last,
Parent => Target_Parent,
Before => Before);
end Splice_Children;
--------------------
-- Splice_Subtree --
--------------------
procedure Splice_Subtree
(Target : in out Tree;
Parent : Cursor;
Before : Cursor;
Source : in out Tree;
Position : in out Cursor)
is
Subtree_Count : Count_Type;
begin
TC_Check (Target.TC);
TC_Check (Source.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Target'Unrestricted_Access then
raise Program_Error with "Parent cursor not in Target container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Target'Unrestricted_Access then
raise Program_Error with "Before cursor not in Target container";
end if;
if Checks and then Before.Node.Parent /= Parent.Node then
raise Constraint_Error with "Before cursor not child of Parent";
end if;
end if;
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Source'Unrestricted_Access then
raise Program_Error with "Position cursor not in Source container";
end if;
if Checks and then Is_Root (Position) then
raise Program_Error with "Position cursor designates root";
end if;
if Target'Address = Source'Address then
if Position.Node.Parent = Parent.Node then
if Position.Node = Before.Node then
return;
end if;
if Position.Node.Next = Before.Node then
return;
end if;
end if;
if Checks and then
Is_Reachable (From => Parent.Node, To => Position.Node)
then
raise Constraint_Error with "Position is ancestor of Parent";
end if;
Remove_Subtree (Position.Node);
Position.Node.Parent := Parent.Node;
Insert_Subtree_Node (Position.Node, Parent.Node, Before.Node);
return;
end if;
-- This is an unfortunate feature of this API: we must count the nodes
-- in the subtree that we remove from the source tree, which is an O(n)
-- operation. It would have been better if the Tree container did not
-- have a Node_Count selector; a user that wants the number of nodes in
-- the tree could simply call Subtree_Node_Count, with the understanding
-- that such an operation is O(n).
-- Of course, we could choose to implement the Node_Count selector as an
-- O(n) operation, which would turn this splice operation into an O(1)
-- operation. ???
Subtree_Count := Subtree_Node_Count (Position.Node);
pragma Assert (Subtree_Count <= Source.Count);
Remove_Subtree (Position.Node);
Source.Count := Source.Count - Subtree_Count;
Position.Node.Parent := Parent.Node;
Insert_Subtree_Node (Position.Node, Parent.Node, Before.Node);
Target.Count := Target.Count + Subtree_Count;
Position.Container := Target'Unrestricted_Access;
end Splice_Subtree;
procedure Splice_Subtree
(Container : in out Tree;
Parent : Cursor;
Before : Cursor;
Position : Cursor)
is
begin
TC_Check (Container.TC);
if Checks and then Parent = No_Element then
raise Constraint_Error with "Parent cursor has no element";
end if;
if Checks and then Parent.Container /= Container'Unrestricted_Access then
raise Program_Error with "Parent cursor not in container";
end if;
if Before /= No_Element then
if Checks and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor not in container";
end if;
if Checks and then Before.Node.Parent /= Parent.Node then
raise Constraint_Error with "Before cursor not child of Parent";
end if;
end if;
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor not in container";
end if;
if Checks and then Is_Root (Position) then
-- Should this be PE instead? Need ARG confirmation. ???
raise Constraint_Error with "Position cursor designates root";
end if;
if Position.Node.Parent = Parent.Node then
if Position.Node = Before.Node then
return;
end if;
if Position.Node.Next = Before.Node then
return;
end if;
end if;
if Checks and then
Is_Reachable (From => Parent.Node, To => Position.Node)
then
raise Constraint_Error with "Position is ancestor of Parent";
end if;
Remove_Subtree (Position.Node);
Position.Node.Parent := Parent.Node;
Insert_Subtree_Node (Position.Node, Parent.Node, Before.Node);
end Splice_Subtree;
------------------------
-- Subtree_Node_Count --
------------------------
function Subtree_Node_Count (Position : Cursor) return Count_Type is
begin
if Position = No_Element then
return 0;
end if;
return Subtree_Node_Count (Position.Node);
end Subtree_Node_Count;
function Subtree_Node_Count
(Subtree : Tree_Node_Access) return Count_Type
is
Result : Count_Type;
Node : Tree_Node_Access;
begin
Result := 1;
Node := Subtree.Children.First;
while Node /= null loop
Result := Result + Subtree_Node_Count (Node);
Node := Node.Next;
end loop;
return Result;
end Subtree_Node_Count;
----------
-- Swap --
----------
procedure Swap
(Container : in out Tree;
I, J : Cursor)
is
begin
TE_Check (Container.TC);
if Checks and then I = No_Element then
raise Constraint_Error with "I cursor has no element";
end if;
if Checks and then I.Container /= Container'Unrestricted_Access then
raise Program_Error with "I cursor not in container";
end if;
if Checks and then Is_Root (I) then
raise Program_Error with "I cursor designates root";
end if;
if I = J then -- make this test sooner???
return;
end if;
if Checks and then J = No_Element then
raise Constraint_Error with "J cursor has no element";
end if;
if Checks and then J.Container /= Container'Unrestricted_Access then
raise Program_Error with "J cursor not in container";
end if;
if Checks and then Is_Root (J) then
raise Program_Error with "J cursor designates root";
end if;
declare
EI : constant Element_Type := I.Node.Element;
begin
I.Node.Element := J.Node.Element;
J.Node.Element := EI;
end;
end Swap;
--------------------
-- Update_Element --
--------------------
procedure Update_Element
(Container : in out Tree;
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type))
is
T : Tree renames Position.Container.all'Unrestricted_Access.all;
Lock : With_Lock (T.TC'Unrestricted_Access);
begin
if Checks and then Position = No_Element then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor not in container";
end if;
if Checks and then Is_Root (Position) then
raise Program_Error with "Position cursor designates root";
end if;
Process (Position.Node.Element);
end Update_Element;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Tree)
is
procedure Write_Children (Subtree : Tree_Node_Access);
procedure Write_Subtree (Subtree : Tree_Node_Access);
--------------------
-- Write_Children --
--------------------
procedure Write_Children (Subtree : Tree_Node_Access) is
CC : Children_Type renames Subtree.Children;
C : Tree_Node_Access;
begin
Count_Type'Write (Stream, Child_Count (CC));
C := CC.First;
while C /= null loop
Write_Subtree (C);
C := C.Next;
end loop;
end Write_Children;
-------------------
-- Write_Subtree --
-------------------
procedure Write_Subtree (Subtree : Tree_Node_Access) is
begin
Element_Type'Output (Stream, Subtree.Element);
Write_Children (Subtree);
end Write_Subtree;
-- Start of processing for Write
begin
Count_Type'Write (Stream, Container.Count);
if Container.Count = 0 then
return;
end if;
Write_Children (Root_Node (Container));
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Position : Cursor)
is
begin
raise Program_Error with "attempt to write tree cursor to stream";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Ada.Containers.Multiway_Trees;
|
AdaCore/gpr | Ada | 88 | ads | with Ada_Pkg3;
package Ada_Pkg1 is
procedure Method1 (Name : String);
end Ada_Pkg1;
|
bracke/Ext2Dir | Ada | 9,654 | adb | -- StrongEd$WrapWidth=256
-- StrongEd$Mode=Ada
--
with Ada.Command_Line;
with Ada.Text_IO;
with Ada.Characters.Handling;
with Ada.Strings.Unbounded;-- use Ada.Strings.Unbounded;
with System.Unsigned_Types; use System.Unsigned_Types;
With Ada.Strings; use Ada.Strings;
With Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Reporter;
with RASCAL.FileExternal; use RASCAL.FileExternal;
with RASCAL.FileName; use RASCAL.FileName;
package body Main is
--
package FileExternal renames RASCAL.FileExternal;
package Utility renames RASCAL.Utility;
--
procedure Main is
Object_Type : File_Object_Type;
arg_type : Options;
nr : integer :=0;
nr_of_args : natural;
argument : ustring;
path : ustring;
single_option : character := 'H';
Source_Not_Found : Exception;
Target_Not_Found : Exception;
Source_Is_A_File : Exception;
Target_Is_A_File : Exception;
Too_Manny_Arguments : Exception;
Print_Help : Exception;
Unknown_Parameter : Exception;
begin
nr_of_args := Ada.Command_line.Argument_Count;
if nr_of_args > (Options'Pos(Options'Last)+2) then
raise Too_Manny_Arguments;
end if;
for x in 1..nr_of_args loop
argument := U(Ada.Command_Line.Argument(x));
if Ada.Strings.Unbounded.Element(argument,1) = '-' then
for y in 2..Ada.Strings.Unbounded.Length(argument) loop
single_option := Ada.Strings.Unbounded.Element(argument,y);
case single_option is
when 'E'|'e' => arg_type := Remove_Extension;
when 'N'|'n' => arg_type := Change_Name;
when 'T'|'t' => arg_type := Set_Filetype;
when 'A'|'a' => arg_type := Set_access;
when 'R'|'r' => arg_type := Remove_Original;
when 'V'|'v' => arg_type := Verbose;
when 'D'|'d' => arg_type := Descend;
when 'H'|'h' => arg_type := Help;
when 'S'|'s' => arg_type := Move_Sub_Content;
when others => raise Unknown_Parameter;
end case;
bits(arg_type) := true;
end loop;
else
if S(paths(Source)) = "" then
paths(source) := argument;
else
paths(target) := argument;
end if;
end if;
end loop;
if bits(Help) then
raise Print_Help;
end if;
if Ada.Strings.Unbounded.Length(paths(target)) > 0 then
path := paths(target);
Object_Type := FileExternal.Get_ObjectType(S(path));
case Object_Type is
when not_found => raise Target_Not_Found;
when file_object => raise Target_Is_A_File;
when dir|image => null;
end case;
if Ada.Strings.Unbounded.Length(paths(source)) > 0 then
path := paths(source);
Object_Type := FileExternal.Get_ObjectType(S(path));
case Object_Type is
when not_found => raise Source_Not_Found;
when file_object => raise Source_Is_A_File;
when dir|image => Proces_Dir(S(paths(Source)),S(paths(target)));
end case;
else
Ada.Text_IO.Put_Line("Source path needed");
end if;
else
Ada.Text_IO.Put_Line("Target path needed");
end if;
exception
when Print_Help => Help;
when Unknown_Parameter => Ada.Text_IO.Put_Line("Error: Unknown parameter");
when Target_Not_Found => Ada.Text_IO.Put_Line("Error: Target not found");
when Target_Is_A_File => Ada.Text_IO.Put_Line("Error: Target is a file, should be a directory");
when Source_Not_Found => Ada.Text_IO.Put_Line("Error: Source not found");
when Source_Is_A_File => Ada.Text_IO.Put_Line("Error: Source is a file, should be a directory");
when others => raise;
end Main;
--
procedure Proces_File(FilePath : in String;
Target : in String) is
FileName : string := Get_Leaf(FilePath);
path : string := Target & ".";
ending : string := FileName;
name : string := FileName;
new_name : ustring := U("");
target_dir : ustring := U(Trim(Target,both));
new_path : ustring := U("");
source_path : ustring := U(StripTrailingSpaces(StripTrailingZeroes(FilePath)));
i : natural := 0;
Object_Type : File_Object_Type;
File_Has_No_Ending : exception;
Target_exist_but_is_a_file : exception;
begin
if Bits(Verbose) then
Ada.Text_IO.Put_Line(filename);
end if;
i := Count(ending,"/");
if i = 0 then
raise File_Has_No_Ending;
end if;
i := index(ending,"/",backward);
if i > ending'first then
Delete(ending,ending'first,i);
end if;
i := index(name,"/",backward);
if i > name'First then
if Bits(Remove_Extension) then
Delete(name,i,name'last);
end if;
end if;
if ending /= name then
if Ada.Strings.Unbounded.Length(target_dir) = 0 then
target_dir := U(path & ending);
else
target_dir := U(S(target_dir) & "." & ending);
end if;
target_dir := U(StripTrailingSpaces(StripTrailingZeroes(S(target_dir))));
-- Find or create directory
Object_Type := FileExternal.Get_ObjectType(S(target_dir));
case Object_Type is
when not_found => FileExternal.Create_Directory(S(target_dir));
when file_object => raise Target_exist_but_is_a_file;
when dir|image => null;
end case;
if Bits(Change_Name) then
-- Change name to lowercase bdy
-- and uppercase first character
new_name := U(Ada.Characters.Handling.To_Lower(StripTrailingSpaces(name)));
Ada.Strings.Unbounded.Replace_Element(new_Name,1,
Ada.Characters.Handling.To_Upper(Ada.Strings.Unbounded.Element(new_name,1)));
new_path := U(S(target_dir) & "." & S(new_name));
else
new_path := U(S(target_dir) & "." & StripTrailingSpaces(name));
end if;
else
new_path := U(S(target_dir) & "." & StripTrailingSpaces(name));
end if;
-- Copy file
FileExternal.Set_Attributes(S(source_path),FileExternal.Get_Attributes(S(source_path)) or Attribute_Owner_Read);
FileExternal.Copy(S(source_path),S(new_path));
if Bits(Set_Access) then
-- Set access attributes
FileExternal.Set_Attributes(S(new_path),FileExternal.Get_Attributes(S(source_path)) or Attribute_Owner_Read+Attribute_Owner_Write);
end if;
if Bits(Set_FileType) then
-- Set filetype
FileExternal.Set_FileType(S(new_path),16#fff#);
end if;
exception
when File_Has_No_Ending => null;
when others => raise;
end Proces_File;
--
procedure Proces_Dir (Path : in String;
Target : in String) is
Object_Type : File_Object_Type;
Dir_List : Directory_Pointer := Get_DirectoryList(Path);
begin
for i in Dir_List'Range loop
Object_Type := FileExternal.Get_ObjectType(Path & "." & S(Dir_List(i)));
case Object_Type is
when not_found => null;
when file_object => if Ada.Strings.Unbounded.Count(Dir_List(i),"/") > 0 then
Proces_File(Path & "." & S(Dir_List(i)),Target);
if Bits(Remove_Original) then
FileExternal.Delete_File(Path & "." & S(Dir_List(i)));
end if;
end if;
when dir|image => if Bits(Descend) then
if Bits(Move_Sub_Content) then
Proces_Dir(Path & "." & S(Dir_List(i)),Target);
else
if not Exists(Target & "." & S(Dir_List(i))) then
Create_Directory (Target & "." & S(Dir_List(i)));
end if;
Proces_Dir(Path & "." & S(Dir_List(i)),Target & "." & S(Dir_List(i)));
end if;
end if;
end case;
end loop;
end Proces_Dir;
--
procedure Help is
begin
Ada.Text_IO.Put_Line("Usage: FileSort [-[a][e][d][s][n][t][r]] source [target]");
Ada.Text_IO.Put_Line("");
Ada.Text_IO.Put_Line(" -a Set access attributes of files in target to unprotected");
Ada.Text_IO.Put_Line(" -e Remove file extension");
Ada.Text_IO.Put_Line(" -d Descend - recursive descend through directory structure");
Ada.Text_IO.Put_Line(" -s Move subdirectory files up to start directory.");
Ada.Text_IO.Put_Line(" -n Change name");
Ada.Text_IO.Put_Line(" -t Set filetype to text (&fff)");
Ada.Text_IO.Put_Line(" -r Remove original");
Ada.Text_IO.Put_Line(" -v verbose mode, provides progress info");
Ada.Text_IO.Put_Line("");
end Help;
--
end Main;
|
reznikmm/matreshka | Ada | 3,719 | ads | ------------------------------------------------------------------------------
-- --
-- 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 XML.DOM.Attributes;
package ODF.DOM.Attributes.Draw.Start_Line_Spacing_Horizontal is
type ODF_Draw_Start_Line_Spacing_Horizontal is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_Draw_Start_Line_Spacing_Horizontal is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.Draw.Start_Line_Spacing_Horizontal;
|
dbanetto/uni | Ada | 105 | ads | package Fib is
type Nat is range 1..Integer'Last;
function fib( X : Integer) return Nat;
end Fib;
|
reznikmm/matreshka | Ada | 5,917 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Web API Definition --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2016, 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 WebAPI.UI_Events.Mouse;
package WebAPI.UI_Events.Wheel is
pragma Preelaborate;
type Wheel_Event is
limited interface and WebAPI.UI_Events.Mouse.Mouse_Event;
type Delta_Modes is (Pixel, Line, Page);
not overriding function Get_Delta_X
(Self : not null access constant Wheel_Event)
return WebAPI.DOM_Double is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "deltaX";
-- In user agents where the default action of the wheel event is to scroll,
-- the value MUST be the measurement along the x-axis (in pixels, lines, or
-- pages) to be scrolled in the case where the event is not cancelled.
-- Otherwise, this is an implementation-specific measurement (in pixels,
-- lines, or pages) of the movement of a wheel device around the x-axis.
not overriding function Get_Delta_Y
(Self : not null access constant Wheel_Event)
return WebAPI.DOM_Double is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "deltaY";
-- In user agents where the default action of the wheel event is to scroll,
-- the value MUST be the measurement along the y-axis (in pixels, lines, or
-- pages) to be scrolled in the case where the event is not cancelled.
-- Otherwise, this is an implementation-specific measurement (in pixels,
-- lines, or pages) of the movement of a wheel device around the y-axis.
not overriding function Get_Delta_Z
(Self : not null access constant Wheel_Event)
return WebAPI.DOM_Double is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "deltaZ";
-- In user agents where the default action of the wheel event is to scroll,
-- the value MUST be the measurement along the z-axis (in pixels, lines, or
-- pages) to be scrolled in the case where the event is not cancelled.
-- Otherwise, this is an implementation-specific measurement (in pixels,
-- lines, or pages) of the movement of a wheel device around the z-axis.
not overriding function Get_Delta_Mode
(Self : not null access constant Wheel_Event)
return Delta_Modes is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "deltaMode";
-- The deltaMode attribute contains an indication of the units of
-- measurement for the delta values.
end WebAPI.UI_Events.Wheel;
|
reznikmm/matreshka | Ada | 8,455 | 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 AMF.DC;
with AMF.DG.Clip_Paths;
with AMF.DG.Groups;
with AMF.DG.Markers;
with AMF.DG.Polylines;
with AMF.DG.Styles.Collections;
with AMF.Internals.DG_Elements;
with AMF.Visitors;
package AMF.Internals.DG_Polylines is
type DG_Polyline_Proxy is
limited new AMF.Internals.DG_Elements.DG_Element_Proxy
and AMF.DG.Polylines.DG_Polyline with null record;
overriding function Get_Point
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DC.Sequence_Of_DC_Point;
-- Getter of Polyline::point.
--
-- a list of 2 or more points making up the polyline.
overriding function Get_Start_Marker
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Markers.DG_Marker_Access;
-- Getter of MarkedElement::startMarker.
--
-- an optional start marker that aligns with the first vertex of the
-- marked element.
overriding procedure Set_Start_Marker
(Self : not null access DG_Polyline_Proxy;
To : AMF.DG.Markers.DG_Marker_Access);
-- Setter of MarkedElement::startMarker.
--
-- an optional start marker that aligns with the first vertex of the
-- marked element.
overriding function Get_End_Marker
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Markers.DG_Marker_Access;
-- Getter of MarkedElement::endMarker.
--
-- an optional end marker that aligns with the last vertex of the marked
-- element.
overriding procedure Set_End_Marker
(Self : not null access DG_Polyline_Proxy;
To : AMF.DG.Markers.DG_Marker_Access);
-- Setter of MarkedElement::endMarker.
--
-- an optional end marker that aligns with the last vertex of the marked
-- element.
overriding function Get_Mid_Marker
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Markers.DG_Marker_Access;
-- Getter of MarkedElement::midMarker.
--
-- an optional mid marker that aligns with all vertices of the marked
-- element except the first and the last.
overriding procedure Set_Mid_Marker
(Self : not null access DG_Polyline_Proxy;
To : AMF.DG.Markers.DG_Marker_Access);
-- Setter of MarkedElement::midMarker.
--
-- an optional mid marker that aligns with all vertices of the marked
-- element except the first and the last.
overriding function Get_Group
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Groups.DG_Group_Access;
-- Getter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding procedure Set_Group
(Self : not null access DG_Polyline_Proxy;
To : AMF.DG.Groups.DG_Group_Access);
-- Setter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding function Get_Local_Style
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::localStyle.
--
-- a list of locally-owned styles for this graphical element.
overriding function Get_Shared_Style
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::sharedStyle.
--
-- a list of shared styles for this graphical element.
overriding function Get_Transform
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Sequence_Of_DG_Transform;
-- Getter of GraphicalElement::transform.
--
-- a list of zero or more transforms to apply to this graphical element.
overriding function Get_Clip_Path
(Self : not null access constant DG_Polyline_Proxy)
return AMF.DG.Clip_Paths.DG_Clip_Path_Access;
-- Getter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Set_Clip_Path
(Self : not null access DG_Polyline_Proxy;
To : AMF.DG.Clip_Paths.DG_Clip_Path_Access);
-- Setter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Enter_Element
(Self : not null access constant DG_Polyline_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant DG_Polyline_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant DG_Polyline_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.DG_Polylines;
|
stcarrez/ada-awa | Ada | 1,555 | ads | -----------------------------------------------------------------------
-- awa-workspaces -- Module workspaces
-- Copyright (C) 2011, 2012, 2015, 2017, 2018 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.
-----------------------------------------------------------------------
-- = Workspaces Module =
-- The *workspaces* plugin defines a workspace area for other plugins.
-- The workspace is intended to link together all the data objects that an application
-- manages for a given user or group of users. A workspace is a possible mechanism
-- to provide and implement multi-tenancy in a web application. By using the workspace plugin,
-- application data from different customers can be kept separate from each other in the
-- same database.
--
-- @include awa-workspaces-modules.ads
--
-- == Ada Beans ==
-- @include workspaces.xml
--
-- == Data Model ==
-- [images/awa_workspace_model.png]
--
package AWA.Workspaces is
end AWA.Workspaces;
|
reznikmm/matreshka | Ada | 3,675 | ads | ------------------------------------------------------------------------------
-- --
-- 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 XML.DOM.Attributes;
package ODF.DOM.Attributes.Style.Print_Orientation is
type ODF_Style_Print_Orientation is
new XML.DOM.Attributes.DOM_Attribute with private;
private
type ODF_Style_Print_Orientation is
new XML.DOM.Attributes.DOM_Attribute with null record;
end ODF.DOM.Attributes.Style.Print_Orientation;
|
reznikmm/matreshka | Ada | 3,961 | 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.Draw_Dots1_Attributes;
package Matreshka.ODF_Draw.Dots1_Attributes is
type Draw_Dots1_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Dots1_Attributes.ODF_Draw_Dots1_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Dots1_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Dots1_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Dots1_Attributes;
|
AdaCore/langkit | Ada | 4,124 | adb | with Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Libfoolang.Analysis; use Libfoolang.Analysis;
with Libfoolang.Common;
with Libfoolang.Rewriting; use Libfoolang.Rewriting;
with Process_Apply;
procedure General_API is
Buffer : constant String :=
("def a = 1" & ASCII.LF
& "def b = (2 + a) + 3" & ASCII.LF
& "def c = a + b" & ASCII.LF);
procedure Try (Label : String; Proc : access procedure);
---------
-- Try --
---------
procedure Try (Label : String; Proc : access procedure) is
begin
Put_Line (Label & "...");
Proc.all;
Put_Line (" Done with no precondition failure");
exception
when Libfoolang.Common.Precondition_Failure =>
Put_Line (" Got a precondition failure");
end Try;
Ctx : constant Analysis_Context := Create_Context;
U : constant Analysis_Unit := Get_From_Buffer
(Ctx, "main.txt", Buffer => Buffer);
RH : Rewriting_Handle;
UH : Unit_Rewriting_Handle;
begin
if Has_Diagnostics (U) then
Put_Line ("Errors:");
for D of Diagnostics (U) loop
Put_Line (Format_GNU_Diagnostic (U, D));
end loop;
return;
end if;
if Handle (Ctx) /= No_Rewriting_Handle then
raise Program_Error;
end if;
declare
procedure Proc;
procedure Proc is
Dummy : constant Unit_Rewriting_Handle := Handle (U);
begin
null;
end Proc;
begin
Try ("Try to get a unit rewriting handle out of a rewriting session",
Proc'Access);
end;
declare
procedure Proc;
procedure Proc is
begin
RH := Start_Rewriting (Ctx);
end Proc;
begin
Put_Line ("Create a rewriting handle");
Proc;
Try ("Try to create a second rewriting handle", Proc'Access);
end;
if Handle (Ctx) /= RH then
raise Program_Error;
elsif Context (RH) /= Ctx then
raise Program_Error;
end if;
-- Test that analysis context getters that return units are properly
-- protected against invalid uses when there is an active rewriting
-- context.
declare
procedure Do_Get_From_File;
procedure Do_Get_From_File_Reparse;
procedure Do_Get_From_Buffer_Str;
procedure Do_Get_From_Buffer_Unb_Str;
procedure Do_Get_With_Error;
Dummy : Analysis_Unit;
procedure Do_Get_From_File is
begin
Dummy := Ctx.Get_From_File ("helper.txt");
end Do_Get_From_File;
procedure Do_Get_From_File_Reparse is
begin
Dummy := Ctx.Get_From_File ("helper.txt", Reparse => True);
end Do_Get_From_File_Reparse;
procedure Do_Get_From_Buffer_Str is
begin
Dummy := Ctx.Get_From_Buffer ("helper.txt", Buffer => "");
end Do_Get_From_Buffer_Str;
procedure Do_Get_From_Buffer_Unb_Str is
begin
Dummy := Ctx.Get_From_Buffer
("helper.txt",
Buffer => Ada.Strings.Unbounded.Null_Unbounded_String);
end Do_Get_From_Buffer_Unb_Str;
procedure Do_Get_With_Error is
begin
Dummy := Ctx.Get_With_Error ("helper.txt", "error message");
end Do_Get_With_Error;
begin
Try ("Call Get_From_File (Reparse => False)", Do_Get_From_File'Access);
Try ("Call Get_From_File (Reparse => True)",
Do_Get_From_File_Reparse'Access);
Try ("Call Get_From_Buffer_Str", Do_Get_From_Buffer_Str'Access);
Try ("Call Get_From_Buffer_Unb_Str", Do_Get_From_Buffer_Unb_Str'Access);
Try ("Call Get_With_Error", Do_Get_With_Error'Access);
end;
Put_Line ("Get a rewriting handle for the analysis unit");
UH := Handle (U);
pragma Unreferenced (UH);
Put_Line ("Apply the rewriting");
Process_Apply (RH);
if Handle (Ctx) /= No_Rewriting_Handle then
raise Program_Error;
end if;
-- Test that we can do a new rewriting session once the previous one is
-- done.
Put_Line ("Create a second rewriting handler");
RH := Start_Rewriting (Ctx);
Put_Line ("Apply the rewriting");
Process_Apply (RH);
Put_Line ("main.adb: Done.");
end General_API;
|
tum-ei-rcs/StratoX | Ada | 14,698 | ads | -- Based on AdaCore's Ada Drivers Library,
-- see https://github.com/AdaCore/Ada_Drivers_Library,
-- checkout 93b5f269341f970698af18f9182fac82a0be66c3.
-- Copyright (C) Adacore
-- Initially based on stm32f7xx_hal_sd.h
-- V1.0.4
-- 09-December-2015
--
-- Tailored to StratoX project.
-- Author: Martin Becker ([email protected])
--
-- @summary
-- low-level SDCard driver. Controls the SD peripheral, SDIO version.
with System;
with STM32_SVD.SDIO; use STM32_SVD.SDIO;
with STM32.DMA;
package STM32.SDMMC is
type SDMMC_Controller is private;
function As_Controller
(Periph : access STM32_SVD.SDIO.SDIO_Peripheral)
return SDMMC_Controller;
type SD_Error is
(OK,
Error,
Timeout_Error,
Unsupported_Card,
Rx_Overrun,
Tx_Underrun,
Startbit_Not_Detected,
Request_Not_Applicable,
CRC_Check_Fail,
Illegal_Cmd,
Address_Out_Of_Range,
Address_Missaligned,
Block_Length_Error,
Erase_Seq_Error,
Bad_Erase_Parameter,
Write_Protection_Violation,
Lock_Unlock_Failed,
Card_ECC_Failed,
Card_ECC_Disabled,
CC_Error,
General_Unknown_Error,
Stream_Read_Underrun,
Stream_Write_Underrun,
CID_CSD_Overwrite,
WP_Erase_Skip,
Erase_Reset,
AKE_SEQ_Error,
Invalid_Voltage_Range,
DMA_Alignment_Error);
type Supported_SD_Memory_Cards is
(STD_Capacity_SD_Card_V1_1,
STD_Capacity_SD_Card_v2_0,
High_Capacity_SD_Card,
Multimedia_Card,
Secure_Digital_IO_Card,
High_Speed_Multimedia_Card,
Secure_Digital_IO_Combo_Card,
High_Capacity_MMC_Card);
type Card_Specific_Data_Register is record
CSD_Structure : Byte;
System_Specification_Version : Byte;
Reserved : Byte;
Data_Read_Access_Time_1 : Byte;
Data_Read_Access_Time_2 : Byte; -- In CLK Cycles
Max_Bus_Clock_Frequency : Byte;
Card_Command_Class : Short;
Max_Read_Data_Block_Length : Byte; -- ld (blocksize in bytes)
Partial_Block_For_Read_Allowed : Boolean;
Write_Block_Missalignment : Boolean;
Read_Block_Missalignment : Boolean;
DSR_Implemented : Boolean;
Reserved_2 : Byte;
Device_Size : Word;
Max_Read_Current_At_VDD_Min : Byte;
Max_Read_Current_At_VDD_Max : Byte;
Max_Write_Current_At_VDD_Min : Byte;
Max_Write_Current_At_VDD_Max : Byte;
Device_Size_Multiplier : Byte;
Erase_Group_Size : Byte;
Erase_Group_Size_Multiplier : Byte;
Write_Protect_Group_Size : Byte;
Write_Protect_Group_Enable : Boolean;
Manufacturer_Default_ECC : Byte;
Write_Speed_Factor : Byte;
Max_Write_Data_Block_Length : Byte; -- =Max_Read_Data_Block_Length
Partial_Blocks_For_Write_Allowed : Boolean;
Reserved_3 : Byte;
Content_Protection_Application : Boolean;
File_Format_Group : Boolean;
Copy_Flag : Boolean;
Permanent_Write_Protection : Boolean;
Temporary_Write_Protection : Boolean;
File_Format : Byte;
ECC_Code : Byte;
CSD_CRC : Byte;
Reserved_4 : Byte; -- Always 1
end record;
type Card_Revision is record
Major : UInt4;
Minor : UInt4;
end record with Pack;
type Manufacturing_Year is range 2000 .. 2255;
type Manufacturing_Month is
(January,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December) with Size => 4;
type Manufacturing_Date_Type is record
Year : Manufacturing_Year;
Month : Manufacturing_Month;
end record;
type Card_Identification_Data_Register is record
Manufacturer_ID : Byte;
OEM_Application_ID : String (1 .. 2);
Product_Name : String (1 .. 5);
Product_Revision : Card_Revision;
Product_Serial_Number : Word;
Reserved_1 : Byte;
Manufacturing_Date : Manufacturing_Date_Type;
CID_CRC : Byte;
Reserved_2 : Byte; -- Always 1
end record;
type Card_Information is record
SD_CSD : Card_Specific_Data_Register;
SD_CID : Card_Identification_Data_Register;
Card_Capacity : Unsigned_64;
Card_Block_Size : Unsigned_32;
RCA : Short; -- SD relative card address
Card_Type : Supported_SD_Memory_Cards :=
STD_Capacity_SD_Card_V1_1;
end record;
-- Wide bus mode
type Wide_Bus_Mode is
(
-- Default bus mode: SDMMC_D0 is used.
Wide_Bus_1B,
-- 4-wide bus mode: SDMMC_D[3:0] used.
Wide_Bus_4B,
-- 8-wide bus mode: SDMMC_D[7:0] used.
Wide_Bus_8B)
with Size => 2;
for Wide_Bus_Mode use
(Wide_Bus_1B => 0,
Wide_Bus_4B => 1,
Wide_Bus_8B => 2);
function Initialize
(Controller : in out SDMMC_Controller;
Info : out Card_Information) return SD_Error;
function Initialized (Controller : SDMMC_Controller) return Boolean;
function Get_Card_Type
(Controller : SDMMC_Controller) return Supported_SD_Memory_Cards
with Pre => Initialized (Controller);
function Configure_Wide_Bus_Mode
(Controller : in out SDMMC_Controller;
Wide_Mode : Wide_Bus_Mode) return SD_Error;
type SD_Data is array (Unsigned_32 range <>) of Byte
with Pack;
function Read_Blocks
(Controller : in out SDMMC_Controller;
Addr : Unsigned_64;
Data : out SD_Data) return SD_Error
with Pre => Data'Length mod 512 = 0;
function Write_Blocks
(Controller : in out SDMMC_Controller;
Addr : Unsigned_64;
Data : SD_Data) return SD_Error
with Pre => Data'Length mod 512 = 0;
function Read_Blocks_DMA
(Controller : in out SDMMC_Controller;
Addr : Unsigned_64;
DMA : STM32.DMA.DMA_Controller;
Stream : STM32.DMA.DMA_Stream_Selector;
Data : out SD_Data) return SD_Error
with Pre => Data'Length <= 65535;
function Write_Blocks_DMA
(Controller : in out SDMMC_Controller;
Addr : Unsigned_64;
DMA : STM32.DMA.DMA_Controller;
Stream : STM32.DMA.DMA_Stream_Selector;
Data : SD_Data) return SD_Error
with Pre => Data'Length <= 65535;
function Stop_Transfer
(Controller : in out SDMMC_Controller) return SD_Error;
function Get_FIFO_Address
(Controller : SDMMC_Controller) return System.Address;
-- function Get_Transfer_Status
-- (Controller : in out SDMMC_Controller) return SD_Error;
type SDMMC_Flags is
(Data_End,
Data_CRC_Fail,
Data_Timeout,
RX_Overrun,
TX_Underrun,
RX_Active,
TX_Active);
subtype SDMMC_Clearable_Flags is SDMMC_Flags range Data_End .. TX_Underrun;
function Get_Flag
(Controller : SDMMC_Controller;
Flag : SDMMC_Flags) return Boolean;
procedure Clear_Flag
(Controller : in out SDMMC_Controller;
Flag : SDMMC_Clearable_Flags);
procedure Clear_Static_Flags (Controller : in out SDMMC_Controller);
type SDMMC_Interrupts is
(Data_End_Interrupt,
Data_CRC_Fail_Interrupt,
Data_Timeout_Interrupt,
TX_FIFO_Empty_Interrupt,
RX_FIFO_Full_Interrupt,
TX_Underrun_Interrupt,
RX_Overrun_Interrupt);
procedure Enable_Interrupt
(Controller : in out SDMMC_Controller;
Interrupt : SDMMC_Interrupts);
procedure Disable_Interrupt
(Controller : in out SDMMC_Controller;
Interrupt : SDMMC_Interrupts);
type SDMMC_Operation is
(No_Operation,
Read_Single_Block_Operation,
Read_Multiple_Blocks_Operation,
Write_Single_Block_Operation,
Write_Multiple_Blocks_Operation);
function Last_Operation
(Controller : SDMMC_Controller) return SDMMC_Operation;
function Read_FIFO
(Controller : in out SDMMC_Controller) return Word; -- originally this was in the body
private
type SDMMC_Command is new Byte;
-- Resets the SD memory card
Go_Idle_State : constant SDMMC_Command := 0;
-- Sends host capacity support information and activates the card's
-- initialization process
Send_Op_Cond : constant SDMMC_Command := 1;
-- Asks any card connected to the host to send the CID numbers on the
-- CMD line.
All_Send_CID : constant SDMMC_Command := 2;
-- Asks the card to publish a new relative address (RCA).
Set_Rel_Addr : constant SDMMC_Command := 3;
-- Programs the DSR of all cards.
Set_DSR : constant SDMMC_Command := 4;
-- Sends host capacity support information (HCS) and asks the accessed
-- card to send its operating condition register (OCR) content in the
-- response on the CMD line.
SDMMC_Send_Op_Cond : constant SDMMC_Command := 5;
-- Checks switchable function (mode 0) and switch card function (mode
-- 1).
HS_Switch : constant SDMMC_Command := 6;
-- Selects the card by its own relative address and gets deselected by
-- any other address
Sel_Desel_Card : constant SDMMC_Command := 7;
-- Sends SD Memory Card interface condition
HS_Send_Ext_CSD : constant SDMMC_Command := 8;
-- Addressed card sends its card specific data
Send_CSD : constant SDMMC_Command := 9;
-- Addressed card sends its card identification (CID) on the CMD line.
Send_CID : constant SDMMC_Command := 10;
Read_Dat_Until_Stop : constant SDMMC_Command := 11;
Stop_Transmission : constant SDMMC_Command := 12;
Send_Status : constant SDMMC_Command := 13;
HS_Bustest_Read : constant SDMMC_Command := 14;
Go_Inactive_State : constant SDMMC_Command := 15;
Set_Blocklen : constant SDMMC_Command := 16;
Read_Single_Block : constant SDMMC_Command := 17;
Read_Multi_Block : constant SDMMC_Command := 18;
HS_Bustest_Write : constant SDMMC_Command := 19;
Write_Dat_Until_Stop : constant SDMMC_Command := 20;
Set_Block_Count : constant SDMMC_Command := 23; -- Only for MMC
Write_Single_Block : constant SDMMC_Command := 24;
Write_Multi_Block : constant SDMMC_Command := 25;
Prog_CID : constant SDMMC_Command := 26;
Prog_CSD : constant SDMMC_Command := 27;
Set_Write_Prot : constant SDMMC_Command := 28;
Clr_Write_Prot : constant SDMMC_Command := 29;
Send_Write_Prot : constant SDMMC_Command := 30;
SD_Erase_Grp_Start : constant SDMMC_Command := 32;
SD_Erase_Grp_End : constant SDMMC_Command := 33;
Erase_Grp_Start : constant SDMMC_Command := 35;
Erase_Grp_End : constant SDMMC_Command := 36;
Erase : constant SDMMC_Command := 38;
Fast_IO : constant SDMMC_Command := 39;
Go_IRQ_State : constant SDMMC_Command := 40;
Lock_Unlock : constant SDMMC_Command := 42;
App_Cmd : constant SDMMC_Command := 55;
Gen_Cmd : constant SDMMC_Command := 56;
No_Cmd : constant SDMMC_Command := 64;
-- SD-Card speciric commands
-- App_Cmd should be sent before sending these commands
subtype SD_Specific_Command is SDMMC_Command;
SD_App_Set_Buswidth : constant SD_Specific_Command := 6;
SD_App_Status : constant SD_Specific_Command := 13;
SD_App_Secure_Read_Multi_Block : constant SD_Specific_Command := 18;
SD_App_Send_Num_Write_Blocks : constant SD_Specific_Command := 22;
SD_App_Set_Write_Block_Erase_Count : constant SD_Specific_Command := 23;
SD_App_Secure_Write_Multi_Block : constant SD_Specific_Command := 25;
SD_App_Secure_Erase : constant SD_Specific_Command := 38;
SD_App_Op_Cond : constant SD_Specific_Command := 41;
SD_App_Get_MKB : constant SD_Specific_Command := 43;
SD_App_Get_MID : constant SD_Specific_Command := 44;
SD_App_Set_CER_RN1 : constant SD_Specific_Command := 45;
SD_App_Get_CER_RN2 : constant SD_Specific_Command := 46;
SD_App_Set_CER_RES2 : constant SD_Specific_Command := 47;
SD_App_Get_CER_RES1 : constant SD_Specific_Command := 48;
SD_App_Change_Secure_Area : constant SD_Specific_Command := 49;
SD_App_Send_SCR : constant SD_Specific_Command := 51;
type Card_Data_Table is array (0 .. 3) of Word;
type SDMMC_Controller is record
Periph : access STM32_SVD.SDIO.SDIO_Peripheral;
CID : Card_Data_Table;
CSD : Card_Data_Table;
Card_Type : Supported_SD_Memory_Cards :=
STD_Capacity_SD_Card_V1_1;
RCA : Word;
Operation : SDMMC_Operation := No_Operation;
end record;
function As_Controller
(Periph : access STM32_SVD.SDIO.SDIO_Peripheral)
return SDMMC_Controller
is (Periph, CID => (others => 0), CSD => (others => 0), others => <>);
function Initialized (Controller : SDMMC_Controller) return Boolean
is (Controller.CID /= (0, 0, 0, 0));
function Get_Card_Type
(Controller : SDMMC_Controller) return Supported_SD_Memory_Cards
is (Controller.Card_Type);
type Data_Direction is (Read, Write);
function Get_FIFO_Address
(Controller : SDMMC_Controller) return System.Address
is (Controller.Periph.FIFO'Address);
function Get_Flag
(Controller : SDMMC_Controller;
Flag : SDMMC_Flags) return Boolean
is (case Flag is
when Data_End => Controller.Periph.STA.DATAEND,
when Data_CRC_Fail => Controller.Periph.STA.DCRCFAIL,
when Data_Timeout => Controller.Periph.STA.DTIMEOUT,
when RX_Overrun => Controller.Periph.STA.RXOVERR,
when TX_Underrun => Controller.Periph.STA.TXUNDERR,
when RX_Active => Controller.Periph.STA.RXACT,
when TX_Active => Controller.Periph.STA.TXACT);
function Last_Operation
(Controller : SDMMC_Controller) return SDMMC_Operation
is (Controller.Operation);
end STM32.SDMMC;
|
AdaCore/langkit | Ada | 2,787 | adb | -- Check that Adalog aborts solving with a ``Timeout_Error`` exception when
-- the number of solving steps involved exceeds the requested limit.
with Langkit_Support.Adalog.Main_Support;
use Langkit_Support.Adalog.Main_Support;
procedure Main is
use T_Solver, Refs, Solver_Ifc;
function Is_Even (I : Integer) return Boolean
is (I mod 2 = 0);
P_Is_Even : constant Predicate_Type'Class :=
Predicate (Is_Even'Access, "Is_Even");
function Is_Next (Values : Value_Array) return Boolean
is (Values (1) + 1 = Values (2));
P_Is_Next : constant N_Predicate_Type'Class :=
N_Predicate (Is_Next'Access, 2, "Is_Next");
X1 : constant Refs.Logic_Var := Create ("X1");
X2 : constant Refs.Logic_Var := Create ("X2");
X3 : constant Refs.Logic_Var := Create ("X3");
X4 : constant Refs.Logic_Var := Create ("X4");
X5 : constant Refs.Logic_Var := Create ("X5");
X6 : constant Refs.Logic_Var := Create ("X6");
X7 : constant Refs.Logic_Var := Create ("X7");
X8 : constant Refs.Logic_Var := Create ("X8");
X9 : constant Refs.Logic_Var := Create ("X9");
Thirty_Ints : constant Value_Array :=
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30);
R1 : constant Relation := R_All ((
Predicate (X1, P_Is_Even),
N_Predicate ((X1, X2), P_Is_Next),
Predicate (X3, P_Is_Even),
R_Any ((R_All ((X1 = 2, X2 = 4), "A1.1"),
R_All ((X1 = 1, X2 = 2), "A1.2"),
R_All ((X1 = 0, X2 = 2), "A1.3"),
R_All ((X1 = 10, X2 = 11), "A1.4")), "A1"),
Domain (X3, (1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20, 21, 23, 25, 27, 29),
"A2"),
Domain (X2, (4, 2, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22),
"A3"),
N_Predicate ((X4, X5), P_Is_Next),
N_Predicate ((X5, X6), P_Is_Next),
N_Predicate ((X6, X7), P_Is_Next),
N_Predicate ((X7, X8), P_Is_Next),
N_Predicate ((X8, X9), P_Is_Next),
X6 = 19,
Domain (X4, Thirty_Ints, "A4"),
Domain (X5, Thirty_Ints, "A5"),
Domain (X6, Thirty_Ints, "A6"),
Domain (X7, Thirty_Ints, "A7"),
Domain (X8, Thirty_Ints, "A8"),
Domain (X9, Thirty_Ints, "A9")
));
R2 : constant Relation := R_All ((
Domain (X1, Thirty_Ints),
Domain (X2, Thirty_Ints),
Predicate (X1, P_Is_Even),
N_Predicate ((X1, X2), P_Is_Next)
));
begin
-- Check that the timeout triggers on R1: if it did not, solving this
-- equation would take a looong time because of all the disjunctions
-- involved (``Domain``).
Solve_All (R1, Timeout => 10000);
-- But check that it does not trigger on R2, a smaller equation
Solve_All (R2, Timeout => 10000);
end Main;
|
AdaCore/libadalang | Ada | 1,364 | adb | -- style: non-ascii
procedure Test is
type My_C is ('a', 'é');
-- The following node.f_defaut_expr.p_referenced_decl()s are real
-- declarations.
M_A : My_C := 'a';
--% decl = node.f_default_expr.p_referenced_decl()
--% decl.p_defining_name.p_unique_identifying_name
--% decl.p_subp_spec_or_null().p_returns
M_E : My_C := 'é';
--% decl = node.f_default_expr.p_referenced_decl()
--% decl.p_defining_name.p_unique_identifying_name
--% decl.p_subp_spec_or_null().p_returns
AA : Wide_Character := 'A';
--% decl = node.f_default_expr.p_referenced_decl()
--% decl.p_defining_name.p_unique_identifying_name
--% decl.p_subp_spec_or_null().p_returns
-- The following node.f_defaut_expr.p_referenced_decl()s are synthetic
-- nodes.
A : Wide_Character := 'a';
--% decl = node.f_default_expr.p_referenced_decl()
--% decl.p_defining_name.p_unique_identifying_name
--% decl.p_subp_spec_or_null().p_returns
E : Character := 'é';
--% decl = node.f_default_expr.p_referenced_decl()
--% decl.p_defining_name.p_unique_identifying_name
--% decl.p_subp_spec_or_null().p_returns
EM : Wide_Wide_Character := '!';
--% decl = node.f_default_expr.p_referenced_decl()
--% decl.p_defining_name.p_unique_identifying_name
--% decl.p_subp_spec_or_null().p_returns
begin
null;
end Test;
|
Samsung/TizenRT | Ada | 3,744 | adb | --------------------------------------------------------------- -
-- ZLib for Ada thick binding. --
-- --
-- Copyright(C) 2002 - 2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- Continuous test for ZLib multithreading. If the test would fail
-- we should provide thread safe allocation routines for the Z_Stream.
--
-- $Id: mtest.adb, v 1.4 2004 / 07 / 23 07:49:54 vagul Exp $
with ZLib;
with Ada.Streams;
with Ada.Numerics.Discrete_Random;
with Ada.Text_IO;
with Ada.Exceptions;
with Ada.Task_Identification;
procedure MTest is
use Ada.Streams;
use ZLib;
Stop :
Boolean :
= False;
pragma Atomic(Stop);
subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
package Random_Elements is
new Ada.Numerics.Discrete_Random(Visible_Symbols);
task type Test_Task;
task body Test_Task is
Buffer :
Stream_Element_Array(1 .. 100_000);
Gen :
Random_Elements.Generator;
Buffer_First :
Stream_Element_Offset;
Compare_First :
Stream_Element_Offset;
Deflate :
Filter_Type;
Inflate :
Filter_Type;
procedure Further(Item : in Stream_Element_Array);
procedure Read_Buffer
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-------------
-- Further --
------------ -
procedure Further(Item : in Stream_Element_Array) is
procedure Compare(Item : in Stream_Element_Array);
-------------
-- Compare --
------------ -
procedure Compare(Item : in Stream_Element_Array) is
Next_First : Stream_Element_Offset : = Compare_First + Item'Length;
begin
if Buffer(Compare_First .. Next_First - 1) /= Item then
raise Program_Error;
end if ;
Compare_First :
= Next_First;
end Compare;
procedure Compare_Write is new ZLib.Write(Write => Compare);
begin
Compare_Write(Inflate, Item, No_Flush);
end Further;
-----------------
-- Read_Buffer --
---------------- -
procedure Read_Buffer
(Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
Buff_Diff :
Stream_Element_Offset :
= Buffer'Last - Buffer_First;
Next_First :
Stream_Element_Offset;
begin
if Item'Length <= Buff_Diff then
Last :
= Item'Last;
Next_First :
= Buffer_First + Item'Length;
Item :
= Buffer(Buffer_First .. Next_First - 1);
Buffer_First :
= Next_First;
else
Last :
= Item'First + Buff_Diff;
Item(Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
Buffer_First :
= Buffer'Last + 1;
end if ;
end Read_Buffer;
procedure Translate is new Generic_Translate
(Data_In => Read_Buffer,
Data_Out => Further);
begin
Random_Elements.Reset(Gen);
Buffer :
= (others => 20);
Main :
loop
for J in Buffer'Range loop
Buffer(J)
{
:
= Random_Elements.Random(Gen);
}
Deflate_Init(Deflate);
Inflate_Init(Inflate);
Buffer_First :
= Buffer'First;
Compare_First :
= Buffer'First;
Translate(Deflate);
if Compare_First /= Buffer'Last + 1 then
raise Program_Error;
end if ;
Ada.Text_IO.Put_Line
(Ada.Task_Identification.Image
(Ada.Task_Identification.Current_Task)
& Stream_Element_Offset'Image (J)
& ZLib.Count'Image (Total_Out (Deflate)));
Close(Deflate);
Close(Inflate);
exit Main when Stop;
end loop;
end loop Main;
exception
when E : others =>
Ada.Text_IO.Put_Line(Ada.Exceptions.Exception_Information(E));
Stop : = True;
end Test_Task;
Test : array(1 .. 4) of Test_Task;
pragma Unreferenced(Test);
Dummy : Character;
begin
Ada.Text_IO.Get_Immediate(Dummy);
Stop : = True;
end MTest;
|
io7m/coreland-openal-ada | Ada | 57 | ads | package OpenAL_Info is
procedure Run;
end OpenAL_Info;
|
zhmu/ananas | Ada | 323 | ads | generic
type Real is digits <>;
package Interface9_Root is
type Base_Interface is limited interface;
procedure Primitive1 (B : in out Base_Interface) is abstract;
procedure Primitive2 (B : in out Base_Interface) is null;
type Derived_Interface is limited interface and Base_Interface;
end Interface9_Root;
|
pok-kernel/pok | Ada | 515 | ads | -- POK header
--
-- The following file is a part of the POK project. Any modification should
-- be made according to the POK licence. You CANNOT use this file or a part
-- of a file for your own project.
--
-- For more information on the POK licence, please see our LICENCE FILE
--
-- Please follow the coding guidelines described in doc/CODING_GUIDELINES
--
-- Copyright (c) 2007-2022 POK team
package User is
procedure Hello_Part1;
end User;
|
onox/orka | Ada | 925 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2022 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 Orka.SIMD.SSE2.Integers;
package Orka.SIMD.SSSE3.Integers.Shift is
pragma Pure;
use SIMD.SSE2.Integers;
function Align_Right_Bytes (Left, Right : m128i; Mask : Integer_32) return m128i
with Inline_Always;
end Orka.SIMD.SSSE3.Integers.Shift;
|
LiberatorUSA/GUCEF | Ada | 1,219 | adb | package body agar.gui.widget.console is
package cbinds is
procedure set_padding
(console : console_access_t;
padding : c.int);
pragma import (c, set_padding, "AG_ConsoleSetPadding");
function message
(console : console_access_t;
text : cs.chars_ptr) return line_access_t;
pragma import (c, message, "AG_ConsoleMsgS");
function append_line
(console : console_access_t;
text : cs.chars_ptr) return line_access_t;
pragma import (c, append_line, "AG_ConsoleAppendLine");
end cbinds;
procedure set_padding
(console : console_access_t;
padding : natural) is
begin
cbinds.set_padding
(console => console,
padding => c.int (padding));
end set_padding;
function append_line
(console : console_access_t;
text : string) return line_access_t
is
ca_text : aliased c.char_array := c.to_c (text);
begin
return cbinds.append_line
(console => console,
text => cs.to_chars_ptr (ca_text'unchecked_access));
end append_line;
function widget (console : console_access_t) return widget_access_t is
begin
return console.widget'access;
end widget;
end agar.gui.widget.console;
|
MinimSecure/unum-sdk | Ada | 811 | adb | -- Copyright 2013-2016 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 Put(S : String) is
begin
null;
end Put;
end Pck;
|
charlie5/cBound | Ada | 1,535 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with xcb.xcb_render_glyphinfo_t;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_render_glyphinfo_iterator_t is
-- Item
--
type Item is record
data : access xcb.xcb_render_glyphinfo_t.Item;
the_rem : aliased Interfaces.C.int;
index : aliased Interfaces.C.int;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_render_glyphinfo_iterator_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_glyphinfo_iterator_t.Item,
Element_Array => xcb.xcb_render_glyphinfo_iterator_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_render_glyphinfo_iterator_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_glyphinfo_iterator_t.Pointer,
Element_Array => xcb.xcb_render_glyphinfo_iterator_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_render_glyphinfo_iterator_t;
|
reznikmm/matreshka | Ada | 4,139 | 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_Percentage_Data_Style_Name_Attributes;
package Matreshka.ODF_Style.Percentage_Data_Style_Name_Attributes is
type Style_Percentage_Data_Style_Name_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Percentage_Data_Style_Name_Attributes.ODF_Style_Percentage_Data_Style_Name_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Percentage_Data_Style_Name_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Percentage_Data_Style_Name_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Percentage_Data_Style_Name_Attributes;
|
houey/Amass | Ada | 2,375 | ads | -- Copyright 2017-2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "SecurityTrails"
type = "api"
function start()
setratelimit(1)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local resp, err = request(ctx, {
url=verturl(domain),
headers={
APIKEY=c.key,
['Content-Type']="application/json",
},
})
if (err ~= nil and err ~= "") then
return
end
local j = json.decode(resp)
if (j == nil or #(j.subdomains) == 0) then
return
end
for i, sub in pairs(j.subdomains) do
sendnames(ctx, sub .. "." .. domain)
end
end
function verturl(domain)
return "https://api.securitytrails.com/v1/domain/" .. domain .. "/subdomains"
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if (names == nil) then
return
end
local found = {}
for i, v in pairs(names) do
if (found[v] == nil) then
newname(ctx, v)
found[v] = true
end
end
end
function horizontal(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local resp, err = request(ctx, {
url=horizonurl(domain),
headers={
APIKEY=c.key,
['Content-Type']="application/json",
},
})
if (err ~= nil and err ~= "") then
return
end
local j = json.decode(resp)
if (j == nil or #(j.records) == 0) then
return
end
for _, r in pairs(j.records) do
if (r.hostname ~= "") then
associated(ctx, domain, r.hostname)
end
end
end
function horizonurl(domain)
return "https://api.securitytrails.com/v1/domain/" .. domain .. "/associated"
end
|
AdaCore/libadalang | Ada | 268 | adb | with Ada.Containers.Vectors;
procedure Test is
package Int_Vectors is new Ada.Containers.Vectors (Positive, Integer);
subtype Int_Vector is Int_Vectors.Vector;
X : Int_Vector;
Y : Integer := X (2);
pragma Test_Statement_UID;
begin
null;
end Test;
|
reznikmm/matreshka | Ada | 3,678 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- 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: 3559 $ $Date: 2012-12-07 13:08:31 +0200 (Пт., 07 дек. 2012) $
------------------------------------------------------------------------------
with League.String_Vectors;
package XSD_To_Ada.Mappings is
type Mapping is abstract tagged record
Map_Vector : League.String_Vectors.Universal_String_Vector;
Ada_Vector : League.String_Vectors.Universal_String_Vector;
end record;
end XSD_To_Ada.Mappings;
|
reznikmm/matreshka | Ada | 3,933 | 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.Fo_Clip_Attributes;
package Matreshka.ODF_Fo.Clip_Attributes is
type Fo_Clip_Attribute_Node is
new Matreshka.ODF_Fo.Abstract_Fo_Attribute_Node
and ODF.DOM.Fo_Clip_Attributes.ODF_Fo_Clip_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Fo_Clip_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Fo_Clip_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Fo.Clip_Attributes;
|
alexcamposruiz/dds-requestreply | Ada | 1,275 | ads | with DDS.ReadCondition;
with DDS.DataReader;
with DDS.DataWriter;
with DDS.Topic;
with DDS.Entity_Params;
with DDS.Request_Reply;
package DDS.Request_Reply.Requester is
type Ref is limited interface and DDS.Request_Reply.Ref;
type Ref_Access is access all Ref'Class;
function Get_Request_Data_Writer
(Self : not null access Ref)
return DDS.DataWriter.Ref_Access is abstract;
function Get_Reply_Data_Reader
(Self : not null access Ref)
return DDS.DataReader.Ref_Access is abstract;
function Touch_Samples
(Self : not null access Ref;
Max_Count : DDS.Integer;
Read_Condition : DDS.ReadCondition.Ref_Access) return Integer is abstract;
function Wait_For_Any_Sample
(Self : not null access Ref;
Max_Wait : DDS.Duration_T;
Min_Sample_Count : DDS.Integer) return DDS.ReturnCode_T is abstract;
function Create_Request_Topic_Name_From_Service_Name
(Self : not null access Ref;
Service_Name : DDS.String) return DDS.String is abstract;
function Create_Reply_Topic_Name_From_Service_Name
(Self : not null access Ref;
Service_Name : DDS.String) return DDS.String is abstract;
end DDS.Request_Reply.Requester;
|
reznikmm/matreshka | Ada | 3,679 | 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.Svg_Name_Attributes is
pragma Preelaborate;
type ODF_Svg_Name_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Svg_Name_Attribute_Access is
access all ODF_Svg_Name_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Svg_Name_Attributes;
|
RREE/ada-util | Ada | 3,311 | adb | -----------------------------------------------------------------------
-- util-mail -- Mail Utility Library
-- Copyright (C) 2017, 2018 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.Strings.Fixed;
package body Util.Mail is
use Ada.Strings.Unbounded;
use Ada.Strings.Fixed;
use Ada.Strings;
-- ------------------------------
-- Parse the email address and separate the name from the address.
-- ------------------------------
function Parse_Address (E_Mail : in String) return Email_Address is
Result : Email_Address;
First_Pos : constant Natural := Index (E_Mail, "<");
Last_Pos : constant Natural := Index (E_Mail, ">");
At_Pos : constant Natural := Index (E_Mail, "@");
begin
if First_Pos > 0 and Last_Pos > 0 then
Result.Name := To_Unbounded_String (Trim (E_Mail (E_Mail'First .. First_Pos - 1),
Both));
Result.Address := To_Unbounded_String (Trim (E_Mail (First_Pos + 1 .. Last_Pos - 1),
Both));
if Length (Result.Name) = 0 and At_Pos < Last_Pos then
Result.Name := To_Unbounded_String (Trim (E_Mail (First_Pos + 1 .. At_Pos - 1), Both));
end if;
else
Result.Address := To_Unbounded_String (Trim (E_Mail, Both));
Result.Name := To_Unbounded_String (Trim (E_Mail (E_Mail'First .. At_Pos - 1), Both));
end if;
return Result;
end Parse_Address;
-- ------------------------------
-- Extract a first name from the email address.
-- ------------------------------
function Get_First_Name (From : in Email_Address) return String is
Name : constant String := To_String (From.Name);
Pos : Natural := Index (Name, " ");
begin
if Pos > 0 then
return Name (Name'First .. Pos - 1);
end if;
Pos := Index (Name, ".");
if Pos > 0 then
return Name (Name'First .. Pos - 1);
else
return "";
end if;
end Get_First_Name;
-- ------------------------------
-- Extract a last name from the email address.
-- ------------------------------
function Get_Last_Name (From : in Email_Address) return String is
Name : constant String := To_String (From.Name);
Pos : Natural := Index (Name, " ");
begin
if Pos > 0 then
return Trim (Name (Pos + 1 .. Name'Last), Both);
end if;
Pos := Index (Name, ".");
if Pos > 0 then
return Name (Pos + 1 .. Name'Last);
else
return Name;
end if;
end Get_Last_Name;
end Util.Mail;
|
zhmu/ananas | Ada | 7,021 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.TEXT_BUFFERS.BOUNDED --
-- --
-- B o d y --
-- --
-- Copyright (C) 2020-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 Ada.Strings.UTF_Encoding.Conversions;
with Ada.Strings.UTF_Encoding.Strings;
with Ada.Strings.UTF_Encoding.Wide_Strings;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
package body Ada.Strings.Text_Buffers.Bounded is
-- Pretty much the same as the Unbounded version, except where different.
--
-- One could imagine inventing an Input_Mapping generic analogous to
-- the existing Output_Mapping generic to address the Get-related
-- Bounded/Unbounded code duplication issues, but let's not. In the
-- Output case, there was more substantial duplication and there were
-- 3 clients (Bounded, Unbounded, and Files) instead of 2.
function Text_Truncated (Buffer : Buffer_Type) return Boolean is
(Buffer.Truncated);
function Get (Buffer : in out Buffer_Type) return String is
-- If all characters are 7 bits, we don't need to decode;
-- this is an optimization.
-- Otherwise, if all are 8 bits, we need to decode to get Latin-1.
-- Otherwise, the result is implementation defined, so we return a
-- String encoded as UTF-8. Note that the RM says "if any character
-- in the sequence is not defined in Character, the result is
-- implementation-defined", so we are not obliged to decode ANY
-- Latin-1 characters if ANY character is bigger than 8 bits.
begin
if Buffer.All_8_Bits and not Buffer.All_7_Bits then
return UTF_Encoding.Strings.Decode (Get_UTF_8 (Buffer));
else
return Get_UTF_8 (Buffer);
end if;
end Get;
function Wide_Get (Buffer : in out Buffer_Type) return Wide_String is
begin
return UTF_Encoding.Wide_Strings.Decode (Get_UTF_8 (Buffer));
end Wide_Get;
function Wide_Wide_Get (Buffer : in out Buffer_Type) return Wide_Wide_String
is
begin
return UTF_Encoding.Wide_Wide_Strings.Decode (Get_UTF_8 (Buffer));
end Wide_Wide_Get;
function Get_UTF_8
(Buffer : in out Buffer_Type) return UTF_Encoding.UTF_8_String
is
begin
return
Result : constant UTF_Encoding.UTF_8_String :=
UTF_Encoding.UTF_8_String
(Buffer.Chars (1 .. Text_Buffer_Count (Buffer.UTF_8_Length)))
do
-- Reset buffer to default initial value.
declare
Defaulted : Buffer_Type (0);
-- If this aggregate becomes illegal due to new field, don't
-- forget to add corresponding assignment statement below.
Dummy : array (1 .. 0) of Buffer_Type (0) :=
[others =>
[Max_Characters => 0, Chars => <>, Indentation => <>,
Indent_Pending => <>, UTF_8_Length => <>, UTF_8_Column => <>,
All_7_Bits => <>, All_8_Bits => <>, Truncated => <>]];
begin
Buffer.Indentation := Defaulted.Indentation;
Buffer.Indent_Pending := Defaulted.Indent_Pending;
Buffer.UTF_8_Length := Defaulted.UTF_8_Length;
Buffer.UTF_8_Column := Defaulted.UTF_8_Column;
Buffer.All_7_Bits := Defaulted.All_7_Bits;
Buffer.All_8_Bits := Defaulted.All_8_Bits;
Buffer.Truncated := Defaulted.Truncated;
end;
end return;
end Get_UTF_8;
function Wide_Get_UTF_16
(Buffer : in out Buffer_Type) return UTF_Encoding.UTF_16_Wide_String
is
begin
return
UTF_Encoding.Conversions.Convert
(Get_UTF_8 (Buffer), Input_Scheme => UTF_Encoding.UTF_8);
end Wide_Get_UTF_16;
procedure Put_UTF_8_Implementation
(Buffer : in out Root_Buffer_Type'Class;
Item : UTF_Encoding.UTF_8_String)
is
procedure Buffer_Type_Implementation (Buffer : in out Buffer_Type);
-- View the passed-in Buffer parameter as being of type Buffer_Type,
-- not of Root_Buffer_Type'Class.
procedure Buffer_Type_Implementation (Buffer : in out Buffer_Type) is
begin
for Char of Item loop
if Buffer.UTF_8_Length = Integer (Buffer.Max_Characters) then
Buffer.Truncated := True;
return;
end if;
Buffer.All_7_Bits := @ and then Character'Pos (Char) < 128;
Buffer.UTF_8_Length := @ + 1;
Buffer.UTF_8_Column := @ + 1;
Buffer.Chars (Text_Buffer_Count (Buffer.UTF_8_Length)) := Char;
end loop;
end Buffer_Type_Implementation;
begin
if Item'Length > 0 then
Buffer_Type_Implementation (Buffer_Type (Buffer));
end if;
end Put_UTF_8_Implementation;
end Ada.Strings.Text_Buffers.Bounded;
|
mfkiwl/ewok-kernel-security-OS | Ada | 2,278 | ads | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with config;
with config.memlayout; use config.memlayout;
package ewok.layout
with spark_mode => on
is
VTORS_SIZE : constant := 392;
FLASH_SIZE : constant := 1024 * KBYTE;
LDR_BASE : constant system_address := 16#0800_0000#;
LDR_SIZE : constant := 32 * KBYTE;
SHR_BASE : constant system_address := 16#0800_8000#;
SHR_SIZE : constant := 32 * KBYTE;
-- +----------------+ <- 16#top_kernel_ram#
-- | IDLE_STACK | 4K
-- +----------------+
-- | SOFTIRQ_STACK | 4K
-- +----------------+
-- | ISR_STACK | 4K
-- +----------------+
-- | INITIAL_STACK | downto bottom kernel ram
-- +----------------+
--
STACK_TOP_IDLE : constant system_address :=
config.memlayout.kernel_region.ram_memory_addr
+ config.memlayout.kernel_region.ram_memory_size;
STACK_SIZE_IDLE : constant := 4 * KBYTE;
STACK_TOP_SOFTIRQ : constant system_address :=
STACK_TOP_IDLE
- STACK_SIZE_IDLE;
STACK_SIZE_SOFTIRQ : constant := 4 * KBYTE;
STACK_TOP_TASK_ISR : constant system_address :=
STACK_TOP_SOFTIRQ
- STACK_SIZE_SOFTIRQ;
STACK_SIZE_TASK_ISR : constant := 4 * KBYTE;
STACK_BOTTOM_TASK_ISR : constant system_address :=
STACK_TOP_TASK_ISR
- STACK_SIZE_TASK_ISR;
-- Transient stack. Used only during kernel initialization
STACK_TOP_TASK_INITIAL : constant system_address := STACK_BOTTOM_TASK_ISR;
end ewok.layout;
|
reznikmm/matreshka | Ada | 6,818 | 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_Db.Key_Column_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Db_Key_Column_Element_Node is
begin
return Self : Db_Key_Column_Element_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Db_Key_Column_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Db_Key_Column
(ODF.DOM.Db_Key_Column_Elements.ODF_Db_Key_Column_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Key_Column_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Key_Column_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Db_Key_Column_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Db_Key_Column
(ODF.DOM.Db_Key_Column_Elements.ODF_Db_Key_Column_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Db_Key_Column_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Db_Key_Column
(Visitor,
ODF.DOM.Db_Key_Column_Elements.ODF_Db_Key_Column_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Key_Column_Element,
Db_Key_Column_Element_Node'Tag);
end Matreshka.ODF_Db.Key_Column_Elements;
|
Kurinkitos/Twizy-Security | Ada | 307 | adb | package body Interface_utils
with SPARK_Mode
is
function Convert_C_Bool(input : Extensions.bool) return Boolean
is
begin
if (input > 0) then
return True;
else
return False;
end if;
end Convert_C_Bool;
begin
null;
end Interface_utils;
|
AdaCore/libadalang | Ada | 211 | adb | package Test is
type R is record
A : Integer;
B : Boolean;
end record;
for R use record
A at 0 range 0 .. 31;
B at 1 range 32 .. 32;
end record;
end Test;
pragma Test_Block;
|
sungyeon/drake | Ada | 328 | ads | pragma License (Unrestricted);
-- implementation unit required by compiler
package System.Img_LLI is
pragma Pure;
-- required for Long_Long_Integer'Image by compiler (s-imgint.ads)
procedure Image_Long_Long_Integer (
V : Long_Long_Integer;
S : in out String;
P : out Natural);
end System.Img_LLI;
|
stcarrez/ada-asf | Ada | 906 | ads | -----------------------------------------------------------------------
-- components-ajax -- AJAX Components
-- 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.
-----------------------------------------------------------------------
package ASF.Components.Ajax is
end ASF.Components.Ajax;
|
AdaCore/libadalang | Ada | 274 | adb | procedure P is
package Q is
procedure P (B : Boolean);
private
X : Boolean;
end Q;
package body Q is
procedure P (B : Boolean) is
begin
null;
end P;
end Q;
begin
Q.;
--% list(node.f_call.p_complete)
end P;
|
reznikmm/matreshka | Ada | 4,576 | 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.Table_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Table_Attribute_Node is
begin
return Self : Table_Table_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_Table_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Table_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Table_Attribute,
Table_Table_Attribute_Node'Tag);
end Matreshka.ODF_Table.Table_Attributes;
|
sungyeon/drake | Ada | 36 | adb | ../machine-apple-darwin/s-nainve.adb |
SSOCsoft/FSAM | Ada | 1,754 | adb | Pragma Ada_2012;
Pragma Assertion_Policy( Check );
Pragma Restrictions( No_Implementation_Aspect_Specifications );
Pragma Restrictions( No_Implementation_Attributes );
Pragma Restrictions( No_Implementation_Pragmas );
Package Body FITS with Pure, SPARK_Mode => On is
Subtype Positive_Offset is Offset_64 range 1..Maximum_Axis_Value;
Function EF( Item : FITS.Axis_Dimensions ) return Offset_64 is
Function Start return Axis_Count'Base is (Item'First) with Inline;
Function Stop return Axis_Count'Base is (Item'Last) with Inline;
Function First return Axis_Value is ( Item( Start ) )
with Inline, Pre => Item'Length > 0;
Function Last return Axis_Value is ( Item( Stop ) )
with Inline, Pre => Item'Length > 0;
Function Head return Positive_Offset is ( Positive_Offset(First) )
with Inline, Pre => Item'Length > 0;
Function Tail return Positive_Offset is ( Positive_Offset(Last) )
with Inline, Pre => Item'Length > 0;
Begin
case Item'Length is
when 0 => return 1;
when 1 => return Head;
when 2 => return Head * Tail;
when others =>
Declare
Middle : Constant Axis_Count := Item'Length/2 + Start;
Subtype Head is Axis_Count range Item'First..Middle;
Subtype Tail is Axis_Count range Axis_Count'Succ(Middle)..Stop;
Begin
Return EF(Item(Head)) * EF(Item(Tail));
End;
end case;
End EF;
Function Flatten( Item : Axis_Dimensions ) return Offset_64 is--Interfaces.Unsigned_64 is
Begin
Return Result : Offset_64 := 1 do
For Element of Item loop
Result := Result * Offset_64( Element );
End loop;
End return;
End Flatten;
End FITS;
|
reznikmm/matreshka | Ada | 4,637 | 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_Db.Is_Autoincrement_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Db_Is_Autoincrement_Attribute_Node is
begin
return Self : Db_Is_Autoincrement_Attribute_Node do
Matreshka.ODF_Db.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Db_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Db_Is_Autoincrement_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Is_Autoincrement_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Db_URI,
Matreshka.ODF_String_Constants.Is_Autoincrement_Attribute,
Db_Is_Autoincrement_Attribute_Node'Tag);
end Matreshka.ODF_Db.Is_Autoincrement_Attributes;
|
reznikmm/matreshka | Ada | 5,949 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- 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 League.Strings.Hash;
package body XML.DOM.Nodes.Elements is
---------------------------
-- Get_Attribute_Node_NS --
---------------------------
function Get_Attribute_Node_NS
(Self : not null access DOM_Element'Class;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String)
return XML.DOM.Nodes.Attrs.DOM_Attr_Access
is
Position : Attribute_Maps.Cursor;
begin
-- Lookup for attribute.
Position := Self.Attributes.Find ((Namespace_URI, Local_Name));
if Attribute_Maps.Has_Element (Position) then
return Attribute_Maps.Element (Position);
else
return null;
end if;
end Get_Attribute_Node_NS;
----------
-- Hash --
----------
function Hash (Item : Qualified_Name) return Ada.Containers.Hash_Type is
use type Ada.Containers.Hash_Type;
begin
return
League.Strings.Hash (Item.Namespace_URI)
+ League.Strings.Hash (Item.Local_Name);
end Hash;
---------------------------
-- Set_Attribute_Node_NS --
---------------------------
function Set_Attribute_Node_NS
(Self : not null access DOM_Element'Class;
New_Attr : not null XML.DOM.Nodes.Attrs.DOM_Attr_Access)
return XML.DOM.Nodes.Attrs.DOM_Attr_Access
is
Key : Qualified_Name;
Old : XML.DOM.Nodes.Attrs.DOM_Attr_Access;
Position : Attribute_Maps.Cursor;
begin
-- Construct key to access attribute in the map.
Key.Namespace_URI := New_Attr.Get_Namespace_URI;
Key.Local_Name := New_Attr.Get_Local_Name;
-- Lookup for existing attribute.
Position := Self.Attributes.Find (Key);
if Attribute_Maps.Has_Element (Position) then
Old := Attribute_Maps.Element (Position);
end if;
-- Insert or replace attribute in the map.
XML.DOM.Nodes.Reference (XML.DOM.Nodes.DOM_Node_Access (New_Attr));
Self.Attributes.Include (Key, New_Attr);
return Old;
end Set_Attribute_Node_NS;
---------------------------
-- Set_Attribute_Node_NS --
---------------------------
procedure Set_Attribute_Node_NS
(Self : not null access DOM_Element'Class;
New_Attr : not null XML.DOM.Nodes.Attrs.DOM_Attr_Access)
is
Aux : XML.DOM.Nodes.DOM_Node_Access
:= XML.DOM.Nodes.DOM_Node_Access
(Self.Set_Attribute_Node_NS (New_Attr));
begin
if Aux /= null then
XML.DOM.Nodes.Dereference (Aux);
end if;
end Set_Attribute_Node_NS;
end XML.DOM.Nodes.Elements;
|
sungyeon/drake | Ada | 588 | adb | with Ada.Exception_Identification;
package body Ada.Assertions is
pragma Suppress (All_Checks);
-- implementation
procedure Assert (
Check : Boolean;
Message : String := Debug.Source_Location) is
begin
if not Check then
Raise_Assertion_Error (Message);
end if;
end Assert;
procedure Raise_Assertion_Error (
Message : String := Debug.Source_Location) is
begin
Exception_Identification.Raise_Exception (
Assertion_Error'Identity,
Message => Message);
end Raise_Assertion_Error;
end Ada.Assertions;
|
AdaCore/libadalang | Ada | 22 | ads | package P2 is
end P2;
|
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.Elements;
package ODF.DOM.Config_Config_Item_Map_Entry_Elements is
pragma Preelaborate;
type ODF_Config_Config_Item_Map_Entry is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Config_Config_Item_Map_Entry_Access is
access all ODF_Config_Config_Item_Map_Entry'Class
with Storage_Size => 0;
end ODF.DOM.Config_Config_Item_Map_Entry_Elements;
|
Rodeo-McCabe/orka | Ada | 951 | ads | -- 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 GL.Low_Level;
with GL.Types.Colors;
private package GL.Helpers is
pragma Preelaborate;
use GL.Types;
function Float_Array (Value : Colors.Color) return Low_Level.Single_Array;
function Color (Value : Low_Level.Single_Array) return Colors.Color;
end GL.Helpers;
|
stcarrez/ada-el | Ada | 1,212 | ads | -----------------------------------------------------------------------
-- EL.Objects.Time.Tests - Testsuite time objects
-- Copyright (C) 2010, 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.Objects.Time.Tests is
procedure Add_Tests (Suite : Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Time_Object (T : in out Test);
procedure Test_Time_To_String (T : in out Test);
procedure Test_Time_Add (T : in out Test);
end EL.Objects.Time.Tests;
|
Rodeo-McCabe/orka | Ada | 4,929 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 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 GL.Blending;
with GL.Buffers;
with GL.Rasterization;
with GL.Toggles;
with GL.Types;
with Orka.Rendering.Drawing;
with Orka.Rendering.Programs.Modules;
package body Orka.Rendering.Debug.Spheres is
function Create_Sphere
(Location : Resources.Locations.Location_Ptr;
Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0);
Normals : Boolean := False;
Cells_Horizontal : Positive := 36;
Cells_Vertical : Positive := 18) return Sphere
is
use Rendering.Programs;
begin
return Result : Sphere :=
(Program => Create_Program (Modules.Create_Module
(Location, VS => "debug/sphere.vert", FS => "debug/sphere.frag")),
Cells_Horizontal => Cells_Horizontal,
Cells_Vertical => Cells_Vertical,
others => <>)
do
Result.Program.Uniform ("color").Set_Vector (Color);
Result.Program.Uniform ("useNormal").Set_Boolean (Normals);
Result.Program.Uniform ("cellsHorizontal").Set_Int (GL.Types.Int (Cells_Horizontal));
Result.Program.Uniform ("cellsVertical").Set_Int (GL.Types.Int (Cells_Vertical));
Result.Uniform_Visible := Result.Program.Uniform ("visible");
Result.Uniform_View := Result.Program.Uniform ("view");
Result.Uniform_Proj := Result.Program.Uniform ("proj");
end return;
end Create_Sphere;
procedure Render
(Object : in out Sphere;
View, Proj : Transforms.Matrix4;
Transforms, Spheres : Rendering.Buffers.Bindable_Buffer'Class)
is
use all type GL.Blending.Blend_Factor;
use all type GL.Blending.Equation;
use all type GL.Types.Compare_Function;
use all type Rendering.Buffers.Indexed_Buffer_Target;
Reverse_Function : constant array (GL.Types.Compare_Function) of GL.Types.Compare_Function :=
(Never => Always,
Always => Never,
Less => GEqual,
Greater => LEqual,
LEqual => Greater,
GEqual => Less,
Equal => Not_Equal,
Not_Equal => Equal);
Original_Function : constant GL.Types.Compare_Function := GL.Buffers.Depth_Function;
Original_Mask : constant Boolean := GL.Buffers.Depth_Mask;
Original_Polygon_Mode : constant GL.Rasterization.Polygon_Mode_Type
:= GL.Rasterization.Polygon_Mode;
Original_Blend_Func : constant GL.Blending.Blend_Factors := GL.Blending.Blend_Func;
Original_Blend_Eq : constant GL.Blending.Blend_Equations := GL.Blending.Blend_Equation;
Original_Blend_State : constant GL.Toggles.Toggle_State
:= GL.Toggles.State (GL.Toggles.Blend, 0);
Vertex_Count : constant Positive :=
(Object.Cells_Horizontal + 1) * Object.Cells_Vertical * 6 - 2;
begin
Object.Uniform_View.Set_Matrix (View);
Object.Uniform_Proj.Set_Matrix (Proj);
Object.Program.Use_Program;
Transforms.Bind (Shader_Storage, 0);
Spheres.Bind (Shader_Storage, 1);
GL.Rasterization.Set_Polygon_Mode (GL.Rasterization.Line);
-- Set up blending for the hidden lines
GL.Blending.Set_Blend_Func ((Src_Alpha, One_Minus_Src_Alpha, One, Zero));
GL.Blending.Set_Blend_Equation ((Func_Add, Func_Add));
GL.Toggles.Enable (GL.Toggles.Blend, 0);
-- Hidden lines of sphere
GL.Buffers.Set_Depth_Function (Reverse_Function (Original_Function));
GL.Buffers.Set_Depth_Mask (Enabled => False);
Object.Uniform_Visible.Set_Boolean (False);
Orka.Rendering.Drawing.Draw (GL.Types.Triangle_Strip, 0,
Vertex_Count, Instances => Transforms.Length);
GL.Buffers.Set_Depth_Function (Original_Function);
GL.Buffers.Set_Depth_Mask (Enabled => Original_Mask);
-- Visible lines of sphere
Object.Uniform_Visible.Set_Boolean (True);
Orka.Rendering.Drawing.Draw (GL.Types.Triangle_Strip, 0,
Vertex_Count, Instances => Transforms.Length);
GL.Blending.Set_Blend_Func (Original_Blend_Func);
GL.Blending.Set_Blend_Equation (Original_Blend_Eq);
GL.Toggles.Set (GL.Toggles.Blend, 0, Original_Blend_State);
GL.Rasterization.Set_Polygon_Mode (Original_Polygon_Mode);
end Render;
end Orka.Rendering.Debug.Spheres;
|
reznikmm/matreshka | Ada | 4,019 | 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_Font_Relief_Attributes;
package Matreshka.ODF_Style.Font_Relief_Attributes is
type Style_Font_Relief_Attribute_Node is
new Matreshka.ODF_Style.Abstract_Style_Attribute_Node
and ODF.DOM.Style_Font_Relief_Attributes.ODF_Style_Font_Relief_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Font_Relief_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Style_Font_Relief_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Style.Font_Relief_Attributes;
|
reznikmm/matreshka | Ada | 6,902 | 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_Number.Text_Style_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Number_Text_Style_Element_Node is
begin
return Self : Number_Text_Style_Element_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Number_Text_Style_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Number_Text_Style
(ODF.DOM.Number_Text_Style_Elements.ODF_Number_Text_Style_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Number_Text_Style_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Text_Style_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Number_Text_Style_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Number_Text_Style
(ODF.DOM.Number_Text_Style_Elements.ODF_Number_Text_Style_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Number_Text_Style_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Number_Text_Style
(Visitor,
ODF.DOM.Number_Text_Style_Elements.ODF_Number_Text_Style_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Text_Style_Element,
Number_Text_Style_Element_Node'Tag);
end Matreshka.ODF_Number.Text_Style_Elements;
|
reznikmm/matreshka | Ada | 4,183 | ads | ------------------------------------------------------------------------------
-- --
-- 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$
------------------------------------------------------------------------------
private with Ada.Finalization;
package AMF.Boolean_Collections is
pragma Preelaborate;
type Collection_Of_Boolean is tagged private;
type Set_Of_Boolean is new Collection_Of_Boolean with private;
type Ordered_Set_Of_Boolean is new Collection_Of_Boolean with private;
type Bag_Of_Boolean is new Collection_Of_Boolean with private;
type Sequence_Of_Boolean is new Collection_Of_Boolean with private;
private
type Collection_Of_Boolean is
new Ada.Finalization.Controlled with null record;
type Set_Of_Boolean is new Collection_Of_Boolean with null record;
type Ordered_Set_Of_Boolean is new Collection_Of_Boolean with null record;
type Bag_Of_Boolean is new Collection_Of_Boolean with null record;
type Sequence_Of_Boolean is new Collection_Of_Boolean with null record;
end AMF.Boolean_Collections;
|
charlie5/aIDE | Ada | 2,324 | ads | with
AdaM.context_Line,
AdaM.a_Package,
Gtk.Button,
gtk.Widget,
Ada.Streams;
private
with
Gtk.gEntry,
Gtk.Window,
Gtk.Notebook,
Gtk.Table;
package aIDE.Palette.of_packages
is
type Item is new Palette.item with private;
type View is access all Item'Class;
-- Forge
--
function to_packages_Palette return View;
-- Attributes
--
function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget;
-- Operations
--
procedure show (Self : in out Item; Invoked_by : in Gtk.Button.gtk_Button;
Target : in AdaM.context_Line.view);
procedure show (Self : in out Item; Invoked_by : in Gtk.Button.gtk_Button;
Target : in AdaM.a_Package.view);
procedure choice_is (Self : in out Item; package_Name : in String;
the_Package : in AdaM.a_Package.view);
procedure freshen (Self : in out Item);
-- Recent Packages - ToDo: Refactor this out, if possible.
--
package recent_Packages
is
-- procedure register_Usage (package_Name : in AdaM.Text;
-- the_Package : in AdaM.a_Package.view);
-- function fetch return AdaM.text_Lines;
procedure register_Usage (the_Package : in AdaM.a_Package.view);
function fetch return AdaM.a_Package.vector;
procedure read (From : access Ada.Streams.Root_Stream_Type'Class);
procedure write (To : access Ada.Streams.Root_Stream_Type'Class);
end recent_Packages;
private
use gtk.Window,
gtk.Button,
gtk.gEntry,
gtk.Notebook,
Gtk.Table;
type Item is new Palette.item with
record
Invoked_by : gtk_Button;
Target : AdaM.context_Line.view;
Target_2 : AdaM.a_Package.view;
recent_Table : gtk_Table;
top_Notebook,
all_Notebook : gtk_Notebook;
Top : gtk_Window;
new_package_Entry : gtk_Entry;
ok_Button : gtk_Button;
close_Button : gtk_Button;
end record;
procedure build_recent_List (Self : in out Item);
end aIDE.Palette.of_packages;
|
zhmu/ananas | Ada | 8,308 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M --
-- --
-- S p e c --
-- (Darwin/ARM Version) --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
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).
pragma No_Elaboration_Code_All;
-- Allow the use of that restriction in units that WITH this unit
type Name is (SYSTEM_NAME_GNAT);
System_Name : constant Name := SYSTEM_NAME_GNAT;
-- System-Dependent Named Numbers
Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
Max_Binary_Modulus : constant := 2 ** Standard'Max_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 := Standard'Max_Integer_Size - 1;
Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
Tick : constant := 0.01;
-- Storage-related Declarations
type Address is private;
pragma Preelaborable_Initialization (Address);
Null_Address : constant Address;
Storage_Unit : constant := 8;
Word_Size : constant := Standard'Word_Size;
Memory_Size : constant := 2 ** Word_Size;
-- 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)
-- The values defined here are derived from the following Darwin
-- sources:
--
-- Libc/pthreads/pthread.c
-- pthread_init calls host_info to retrieve the HOST_PRIORITY_INFO.
-- This file includes "pthread_internals".
-- Libc/pthreads/pthread_internals.h
-- This file includes <mach/mach.h>.
-- xnu/osfmk/mach/mach.h
-- This file includes <mach/mach_types.h>.
-- xnu/osfmk/mach/mach_types.h
-- This file includes <mach/host_info.h>.
-- xnu/osfmk/mach/host_info.h
-- This file contains the definition of the host_info_t data structure
-- and the function prototype for host_info.
-- xnu/osfmk/kern/host.c
-- This file defines the function host_info which sets the
-- priority_info field of struct host_info_t. This file includes
-- <kern/processor.h>.
-- xnu/osfmk/kern/processor.h
-- This file includes <kern/sched.h>.
-- xnu/osfmk/kern/sched.h
-- This file defines the values for each level of priority.
Max_Interrupt_Priority : constant Positive := 63;
Max_Priority : constant Positive := Max_Interrupt_Priority - 1;
subtype Any_Priority is Integer range 0 .. Max_Interrupt_Priority;
subtype Priority is Any_Priority range 0 .. Max_Priority;
subtype Interrupt_Priority is Any_Priority
range Priority'Last + 1 .. Max_Interrupt_Priority;
Default_Priority : constant Priority :=
(Priority'Last - Priority'First) / 2;
private
type Address is mod Memory_Size;
Null_Address : constant Address := 0;
--------------------------------------
-- 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.
Backend_Divide_Checks : constant Boolean := False;
Backend_Overflow_Checks : constant Boolean := True;
Command_Line_Args : constant Boolean := True;
Configurable_Run_Time : constant Boolean := False;
Denorm : constant Boolean := True;
Duration_32_Bits : constant Boolean := False;
Exit_Status_Supported : constant Boolean := True;
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 := True;
Stack_Check_Limits : constant Boolean := False;
Support_Aggregates : constant Boolean := True;
Support_Atomic_Primitives : 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 := False;
Suppress_Standard_Library : constant Boolean := False;
Use_Ada_Main_Program_Name : constant Boolean := False;
Frontend_Exceptions : constant Boolean := False;
ZCX_By_Default : constant Boolean := True;
end System;
|
stcarrez/ada-ado | Ada | 30,669 | adb | -----------------------------------------------------------------------
-- ado-statements-postgresql -- Postgresql query statements
-- Copyright (C) 2018, 2019, 2021, 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 Interfaces.C;
with Interfaces.C.Strings;
with Ada.Unchecked_Conversion;
with Util.Log;
with Util.Log.Loggers;
with ADO.C;
with ADO.Sessions;
with ADO.Dialects;
with PQ.Perfect_Hash;
package body ADO.Statements.Postgresql is
use type Interfaces.C.Strings.chars_ptr;
use type PQ.PGresult_Access;
use type PQ.ExecStatusType;
use type ADO.Schemas.Class_Mapping_Access;
use type ADO.Schemas.Column_Index;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ADO.Statements.Postgresql");
type Dialect is new ADO.Dialects.Dialect with null record;
-- Check if the string is a reserved keyword.
overriding
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean;
-- Append the item in the buffer escaping some characters if necessary.
-- The default implementation only escapes the single quote ' by doubling them.
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in String);
-- Append the item in the buffer escaping some characters if necessary
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref);
-- Append the boolean item in the buffer.
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in Boolean);
-- Get the quote character to escape an identifier.
overriding
function Get_Identifier_Quote (D : in Dialect) return Character;
Postgresql_Dialect : aliased Dialect;
-- Execute the SQL query on the given Postgresql connection.
-- Returns the query execution status
function Execute (Connection : in PQ.PGconn_Access;
Query : in String) return PQ.PGresult_Access;
function Get_Affected_Rows (Result : in PQ.PGresult_Access) return Natural;
-- ------------------------------
-- Check if the string is a reserved keyword.
-- ------------------------------
overriding
function Is_Reserved (D : in Dialect;
Name : in String) return Boolean is
pragma Unreferenced (D);
begin
return PQ.Perfect_Hash.Is_Keyword (Name);
end Is_Reserved;
-- ------------------------------
-- Get the quote character to escape an identifier.
-- ------------------------------
overriding
function Get_Identifier_Quote (D : in Dialect) return Character is
pragma Unreferenced (D);
begin
return '"';
end Get_Identifier_Quote;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary.
-- The default implementation only escapes the single quote ' by doubling them.
-- ------------------------------
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in String) is
pragma Unreferenced (D);
C : Character;
begin
Append (Buffer, 'E');
Append (Buffer, ''');
for I in Item'Range loop
C := Item (I);
case C is
when ASCII.NUL =>
Append (Buffer, '\');
Append (Buffer, '0');
when ASCII.CR =>
Append (Buffer, '\');
Append (Buffer, 'r');
when ASCII.LF =>
Append (Buffer, '\');
Append (Buffer, 'n');
when '\' | ''' | '"' =>
Append (Buffer, '\');
Append (Buffer, C);
when others =>
Append (Buffer, C);
end case;
end loop;
Append (Buffer, ''');
end Escape_Sql;
-- ------------------------------
-- Append the item in the buffer escaping some characters if necessary
-- ------------------------------
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in ADO.Blob_Ref) is
pragma Unreferenced (D);
use type Ada.Streams.Stream_Element;
Hex : constant String := "0123456789ABCDEF";
C : Ada.Streams.Stream_Element;
Blob : constant ADO.Blob_Accessor := Item.Value;
begin
Append (Buffer, "BYTEA(E'\\x");
for I in Blob.Data'Range loop
C := Blob.Data (I);
Append (Buffer, Hex (1 + Natural (C / 16)));
Append (Buffer, Hex (1 + Natural (C mod 16)));
end loop;
Append (Buffer, "')");
end Escape_Sql;
-- ------------------------------
-- Append the boolean item in the buffer.
-- ------------------------------
overriding
procedure Escape_Sql (D : in Dialect;
Buffer : in out Unbounded_String;
Item : in Boolean) is
pragma Unreferenced (D);
begin
Append (Buffer, (if Item then "TRUE" else "FALSE"));
end Escape_Sql;
function Get_Affected_Rows (Result : in PQ.PGresult_Access) return Natural is
Count : PQ.chars_ptr;
begin
if PQ.PQresultStatus (Result) /= PQ.PGRES_COMMAND_OK then
return 0;
end if;
Count := PQ.PQcmdTuples (Result);
declare
Val : constant String := Interfaces.C.Strings.Value (Count);
begin
if Val'Length = 0 then
return 0;
else
return Natural'Value (Val);
end if;
exception
when Constraint_Error =>
Log.Info ("Affected rows is not a number: {0}", Val);
return 0;
end;
end Get_Affected_Rows;
-- ------------------------------
-- Execute the SQL query on the given Postgresql connection.
-- Returns the query execution status
-- ------------------------------
function Execute (Connection : in PQ.PGconn_Access;
Query : in String) return PQ.PGresult_Access is
use type PQ.PGconn_Access;
Sql : constant ADO.C.String_Ptr := ADO.C.To_String_Ptr (Query);
Result : PQ.PGresult_Access;
Status : PQ.ExecStatusType;
begin
Log.Debug ("Execute {0}", Query);
if Connection = PQ.Null_PGconn then
Log.Warn ("Database connection is closed");
raise ADO.Sessions.Session_Error with "Database connection is closed";
end if;
-- Execute the query
Result := PQ.PQexec (Connection, ADO.C.To_C (Sql));
Status := PQ.PQresultStatus (Result);
case Status is
when PQ.PGRES_COMMAND_OK | PQ.PGRES_TUPLES_OK =>
null;
when others =>
declare
Error : constant Strings.chars_ptr := PQ.PQresultErrorMessage (Result);
Msg : constant String := Strings.Value (Error);
begin
Log.Error ("Error: {0}", Msg);
PQ.PQclear (Result);
raise ADO.Statements.SQL_Error with "SQL error: " & Msg;
end;
end case;
return Result;
end Execute;
-- ------------------------------
-- Delete statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Delete_Statement;
Result : out Natural) is
begin
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => "DELETE FROM ");
ADO.SQL.Append_Name (Target => Stmt.Query.SQL, Name => Stmt.Table.Table.all);
if Stmt.Query.Has_Join then
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Join);
end if;
if Stmt.Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.Query.SQL, SQL => Stmt.Query.Get_Filter);
end if;
declare
Sql_Query : constant String := Stmt.Query.Expand;
Delete_Result : PQ.PGresult_Access;
begin
Delete_Result := Execute (Stmt.Connection, Sql_Query);
Result := Get_Affected_Rows (Delete_Result);
PQ.PQclear (Delete_Result);
if Log.Get_Level >= Util.Log.DEBUG_LEVEL then
Log.Debug ("Deleted {0} rows", Natural'Image (Result));
end if;
end;
end Execute;
-- ------------------------------
-- Create the delete statement
-- ------------------------------
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access is
Result : constant Postgresql_Delete_Statement_Access := new Postgresql_Delete_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Query := Result.Delete_Query'Access;
Result.Delete_Query.Set_Dialect (Postgresql_Dialect'Access);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Update statement
-- ------------------------------
-- Execute the query
overriding
procedure Execute (Stmt : in out Postgresql_Update_Statement) is
Result : Integer;
begin
Postgresql_Update_Statement'Class (Stmt).Execute (Result);
end Execute;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Update_Statement;
Result : out Integer) is
begin
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "UPDATE ");
ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " AS o SET ");
ADO.SQL.Append_Fields (Update => Stmt.This_Query);
if Stmt.This_Query.Has_Join then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Join);
end if;
if Stmt.This_Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Filter);
end if;
declare
Sql_Query : constant String := Stmt.This_Query.Expand;
Update_Result : PQ.PGresult_Access;
begin
Update_Result := Execute (Stmt.Connection, Sql_Query);
Result := Get_Affected_Rows (Update_Result);
PQ.PQclear (Update_Result);
if Log.Get_Level >= Util.Log.DEBUG_LEVEL then
Log.Debug ("Updated {0} rows", Integer'Image (Result));
end if;
end;
end Execute;
-- ------------------------------
-- Create an update statement.
-- ------------------------------
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access is
Result : constant Postgresql_Update_Statement_Access := new Postgresql_Update_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Update := Result.This_Query'Access;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Insert statement
-- ------------------------------
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Insert_Statement;
Result : out Integer) is
begin
if Stmt.Table /= null then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => "INSERT INTO ");
ADO.SQL.Append_Name (Target => Stmt.This_Query.SQL, Name => Stmt.Table.Table.all);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " (");
ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => False);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ") VALUES(");
ADO.SQL.Append_Fields (Update => Stmt.This_Query, Mode => True);
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => ")");
end if;
declare
Sql_Query : constant String := Stmt.This_Query.Expand;
Insert_Result : PQ.PGresult_Access;
begin
Insert_Result := Execute (Stmt.Connection, Sql_Query);
Result := Get_Affected_Rows (Insert_Result);
PQ.PQclear (Insert_Result);
if Log.Get_Level >= Util.Log.DEBUG_LEVEL then
Log.Debug ("Inserted {0} rows", Integer'Image (Result));
end if;
end;
end Execute;
-- ------------------------------
-- Create an insert statement.
-- ------------------------------
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access is
Result : constant Postgresql_Insert_Statement_Access := new Postgresql_Insert_Statement;
begin
Result.Connection := Database;
Result.Table := Table;
Result.Update := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
ADO.SQL.Set_Insert_Mode (Result.This_Query);
return Result.all'Access;
end Create_Statement;
-- ------------------------------
-- Query statement for Postgresql
-- ------------------------------
-- ------------------------------
-- Get a column field address.
-- If the query was not executed, raises Invalid_Statement
-- If the column is out of bound, raises Constraint_Error
-- ------------------------------
function Get_Field (Query : in Postgresql_Query_Statement'Class;
Column : in Natural) return chars_ptr is
Result : PQ.chars_ptr;
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "Null statement";
end if;
if Column >= Query.Max_Column then
Log.Warn ("Column {0} is not valid", Natural'Image (Column));
raise Invalid_Column with "Invalid column" & Natural'Image (Column);
end if;
if PQ.PQgetisnull (Query.Result, Query.Row, Interfaces.C.int (Column)) = 1 then
Log.Warn ("Null column {0} in row {1}", Natural'Image (Column),
Interfaces.C.int'Image (Query.Row));
raise Invalid_Type with "Null column";
end if;
Result := PQ.PQgetvalue (Query.Result, Query.Row, Interfaces.C.int (Column));
return ADO.Statements.To_Chars_Ptr (Result);
end Get_Field;
-- ------------------------------
-- Get a column field length.
-- If the query was not executed, raises Invalid_Statement
-- If the column is out of bound, raises Constraint_Error
-- ------------------------------
function Get_Field_Length (Query : in Postgresql_Query_Statement'Class;
Column : in Natural) return Natural is
begin
if Query.Row >= Query.Row_Count then
raise Invalid_Statement with "Null statement";
end if;
if Column >= Query.Max_Column then
Log.Warn ("Column {0} is not valid", Natural'Image (Column));
raise Invalid_Column with "Invalid column" & Natural'Image (Column);
end if;
return Natural (PQ.PQgetlength (Query.Result, Query.Row, Interfaces.C.int (Column)));
end Get_Field_Length;
-- ------------------------------
-- Execute the query
-- ------------------------------
overriding
procedure Execute (Stmt : in out Postgresql_Query_Statement) is
begin
if Stmt.This_Query.Has_Join then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Join);
end if;
if Stmt.This_Query.Has_Filter then
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => " WHERE ");
ADO.SQL.Append (Target => Stmt.This_Query.SQL, SQL => Stmt.This_Query.Get_Filter);
end if;
if Stmt.Result /= PQ.Null_PGresult then
PQ.PQclear (Stmt.Result);
Stmt.Result := PQ.Null_PGresult;
end if;
declare
Expanded_Query : constant String := Stmt.Query.Expand;
Status : PQ.ExecStatusType;
begin
-- Execute the query
Stmt.Result := Execute (Stmt.Connection, Expanded_Query);
-- Report an error if the query failed
Status := PQ.PQresultStatus (Stmt.Result);
if Status /= PQ.PGRES_TUPLES_OK and then Status /= PQ.PGRES_COMMAND_OK then
declare
Message : constant String := Strings.Value (PQ.PQerrorMessage (Stmt.Connection));
begin
Log.Error ("Query failed: '{0}'", Expanded_Query);
Log.Error (" with error: '{0}'", Message);
raise ADO.Statements.SQL_Error with "Query failed: " & Message;
end;
end if;
Stmt.Row := 0;
Stmt.Row_Count := PQ.PQntuples (Stmt.Result);
Stmt.Max_Column := Natural (PQ.PQnfields (Stmt.Result));
end;
end Execute;
-- ------------------------------
-- Get the number of rows returned by the query
-- ------------------------------
overriding
function Get_Row_Count (Query : in Postgresql_Query_Statement) return Natural is
begin
return Natural (Query.Row_Count);
end Get_Row_Count;
-- ------------------------------
-- Returns True if there is more data (row) to fetch
-- ------------------------------
overriding
function Has_Elements (Query : in Postgresql_Query_Statement) return Boolean is
begin
return Query.Row < Query.Row_Count;
end Has_Elements;
-- ------------------------------
-- Fetch the next row
-- ------------------------------
overriding
procedure Next (Query : in out Postgresql_Query_Statement) is
begin
if Query.Row < Query.Row_Count then
Query.Row := Query.Row + 1;
else
Log.Warn ("Next has no more element in the result set.");
end if;
end Next;
-- ------------------------------
-- Returns true if the column <b>Column</b> is null.
-- ------------------------------
overriding
function Is_Null (Query : in Postgresql_Query_Statement;
Column : in Natural) return Boolean is
begin
if Query.Result = PQ.Null_PGresult then
return True;
end if;
if Column >= Query.Max_Column or else Query.Row >= Query.Row_Count then
return True;
end if;
return PQ.PQgetisnull (Query.Result, Query.Row, Interfaces.C.int (Column)) = 1;
end Is_Null;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Int64</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Int64 (Query : Postgresql_Query_Statement;
Column : Natural) return Int64 is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to Integer";
else
return Get_Int64 (Field);
end if;
end Get_Int64;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Long_Float</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Long_Float (Query : Postgresql_Query_Statement;
Column : Natural) return Long_Float is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to Long_Float";
else
return Get_Long_Float (Field);
end if;
end Get_Long_Float;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Boolean</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Boolean (Query : Postgresql_Query_Statement;
Column : Natural) return Boolean is
Field : chars_ptr := Query.Get_Field (Column);
C : Character;
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to Boolean";
end if;
C := Field.all;
Field := Field + 1;
case C is
when '0' =>
if Field.all /= ASCII.NUL then
raise Invalid_Type with "Invalid boolean value";
end if;
return False;
when '1' =>
if Field.all /= ASCII.NUL then
raise Invalid_Type with "Invalid boolean value";
end if;
return True;
when 'T' | 't' =>
C := Field.all;
if C = ASCII.NUL then
return True;
end if;
if C /= 'r' and then C /= 'R' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'u' and then C /= 'U' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'e' and then C /= 'E' then
raise Invalid_Type with "Invalid boolean value";
end if;
return True;
when 'F' | 'f' =>
C := Field.all;
if C = ASCII.NUL then
return False;
end if;
if C /= 'a' and then C /= 'A' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'l' and then C /= 'L' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 's' and then C /= 'S' then
raise Invalid_Type with "Invalid boolean value";
end if;
C := Field.all;
if C /= 'e' and then C /= 'E' then
raise Invalid_Type with "Invalid boolean value";
end if;
return False;
when others =>
raise Invalid_Type with "Invalid boolean value";
end case;
end Get_Boolean;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Unbounded_String (Query : Postgresql_Query_Statement;
Column : Natural) return Unbounded_String is
Field : chars_ptr := Query.Get_Field (Column);
begin
if Field = null then
raise Invalid_Type with "NULL cannot be converted to String";
end if;
declare
Result : Unbounded_String;
C : Character;
begin
loop
C := Field.all;
exit when C = ASCII.NUL;
Append (Result, C);
Field := Field + 1;
end loop;
return Result;
end;
end Get_Unbounded_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_String (Query : Postgresql_Query_Statement;
Column : Natural) return String is
begin
return To_String (Query.Get_Unbounded_String (Column));
end Get_String;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Blob</b> reference.
-- ------------------------------
overriding
function Get_Blob (Query : in Postgresql_Query_Statement;
Column : in Natural) return ADO.Blob_Ref is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
if Field /= null then
return Get_Blob (Size => Query.Get_Field_Length (Column),
Data => Field);
else
return Null_Blob;
end if;
end Get_Blob;
-- ------------------------------
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Time</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Time (Query : Postgresql_Query_Statement;
Column : Natural) return Ada.Calendar.Time is
Field : constant chars_ptr := Query.Get_Field (Column);
begin
return ADO.Statements.Get_Time (Field);
end Get_Time;
-- ------------------------------
-- Get the column type
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Column_Type (Query : Postgresql_Query_Statement;
Column : Natural)
return ADO.Schemas.Column_Type is
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "No statement";
end if;
if Column >= Query.Max_Column then
raise Invalid_Column with "Invalid column: " & Natural'Image (Column);
end if;
return ADO.Schemas.T_UNKNOWN;
end Get_Column_Type;
-- ------------------------------
-- Get the column name
-- Raises <b>Invalid_Column</b> if the column does not exist.
-- ------------------------------
overriding
function Get_Column_Name (Query : in Postgresql_Query_Statement;
Column : in Natural)
return String is
Name : PQ.chars_ptr;
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "No statement";
end if;
if Column >= Query.Max_Column then
raise Invalid_Column with "Invalid column: " & Natural'Image (Column);
end if;
Name := PQ.PQfname (Query.Result, Interfaces.C.int (Column));
if Name = Interfaces.C.Strings.Null_Ptr then
raise Invalid_Column with "Invalid column: " & Natural'Image (Column);
else
return Interfaces.C.Strings.Value (Name);
end if;
end Get_Column_Name;
-- ------------------------------
-- Get the number of columns in the result.
-- ------------------------------
overriding
function Get_Column_Count (Query : in Postgresql_Query_Statement)
return Natural is
begin
if Query.Result = PQ.Null_PGresult then
raise Invalid_Statement with "No statement";
end if;
return Query.Max_Column;
end Get_Column_Count;
overriding
procedure Finalize (Query : in out Postgresql_Query_Statement) is
begin
if Query.Result /= PQ.Null_PGresult then
PQ.PQclear (Query.Result);
Query.Result := PQ.Null_PGresult;
end if;
end Finalize;
function Create_Statement (Database : in PQ.PGconn_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access is
Result : constant Postgresql_Query_Statement_Access := new Postgresql_Query_Statement;
begin
Result.Connection := Database;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
if Table /= null then
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "SELECT ");
for I in Table.Members'Range loop
if I > Table.Members'First then
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => ", ");
end if;
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => "o.");
ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Members (I).all);
end loop;
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " FROM ");
ADO.SQL.Append_Name (Target => Result.This_Query.SQL, Name => Table.Table.all);
ADO.SQL.Append (Target => Result.This_Query.SQL, SQL => " AS o ");
end if;
return Result.all'Access;
end Create_Statement;
function Create_Statement (Database : in PQ.PGconn_Access;
Query : in String)
return Query_Statement_Access is
Result : constant Postgresql_Query_Statement_Access := new Postgresql_Query_Statement;
begin
Result.Connection := Database;
Result.Query := Result.This_Query'Access;
Result.This_Query.Set_Dialect (Postgresql_Dialect'Access);
Append (Query => Result.all, SQL => Query);
return Result.all'Access;
end Create_Statement;
end ADO.Statements.Postgresql;
|
mapcode-foundation/mapcode-ada | Ada | 2,323 | ads | -- -----------------------------------------------------------------------------
-- Copyright (C) 2003-2019 Stichting Mapcode Foundation (http://www.mapcode.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
with Language_Defs, Language_Utils;
package Mapcodes.Languages is
-- The supported languages
-- The language names in Roman are the Mixed_Str images of these enums
type Language_List is new Language_Defs.Language_List;
-- Roman, Greek, Cyrillic, Hebrew, Devanagari, Malayalam, Georgian, Katakana,
-- Thai, Lao, Armenian, Bengali, Gurmukhi, Tibetan, Arabic, Korean, Burmese,
-- Khmer, Sinhalese, Thaana, Chinese, Tifinagh, Tamil, Amharic, Telugu, Odia,
-- Kannada, Gujarati
-- The unicode sequence to provide a language name in its language
subtype Unicode_Sequence is Language_Utils.Unicode_Sequence;
-- Get the Language from its name, either in Roman or in its own language
-- Raises, if the output language is not known:
Unknown_Language : exception;
function Get_Language (Name : Unicode_Sequence) return Language_List;
-- Get the language of a text (territory name or mapcode)
-- All the characters must be of the same language, otherwise raises
Invalid_Text : exception;
function Get_Language (Input : Wide_String) return Language_List;
-- The default language
Default_Language : constant Language_List := Roman;
-- Conversion of a text (territory name or mapcode) into a given language
-- The language of the input is detected automatically
-- Raises Invalid_Text if the input is not valid
function Convert (Input : Wide_String;
Output_Language : Language_List := Default_Language)
return Wide_String;
end Mapcodes.Languages;
|
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.Start_Numbering_At_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Start_Numbering_At_Attribute_Node is
begin
return Self : Text_Start_Numbering_At_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_Start_Numbering_At_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Start_Numbering_At_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Start_Numbering_At_Attribute,
Text_Start_Numbering_At_Attribute_Node'Tag);
end Matreshka.ODF_Text.Start_Numbering_At_Attributes;
|
docandrew/sdlada | Ada | 10,552 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C.Strings;
with SDL.Error;
package body SDL.RWops is
use type C.int;
use type C.size_t;
use type C.Strings.chars_ptr;
procedure SDL_Free (Mem : in C.Strings.chars_ptr) with
Import => True,
Convention => C,
External_Name => "SDL_free";
function Base_Path return UTF_Strings.UTF_String is
function SDL_Get_Base_Path return C.Strings.chars_ptr with
Import => True,
Convention => C,
External_Name => "SDL_GetBasePath";
C_Path : constant C.Strings.chars_ptr := SDL_Get_Base_Path;
begin
if C_Path = C.Strings.Null_Ptr then
raise RWops_Error with SDL.Error.Get;
end if;
declare
Ada_Path : constant UTF_Strings.UTF_String := C.Strings.Value (C_Path);
begin
SDL_Free (C_Path);
return Ada_Path;
end;
end Base_Path;
function Preferences_Path (Organisation : in UTF_Strings.UTF_String;
Application : in UTF_Strings.UTF_String) return UTF_Strings.UTF_String
is
function SDL_Get_Pref_Path (Organisation : in C.Strings.chars_ptr;
Application : in C.Strings.chars_ptr) return C.Strings.chars_ptr with
Import => True,
Convention => C,
External_Name => "SDL_GetPrefPath";
C_Organisation : C.Strings.chars_ptr;
C_Application : C.Strings.chars_ptr;
C_Path : C.Strings.chars_ptr;
begin
C_Organisation := C.Strings.New_String (Organisation);
C_Application := C.Strings.New_String (Application);
C_Path := SDL_Get_Pref_Path (Organisation => C_Organisation,
Application => C_Application);
C.Strings.Free (C_Organisation);
C.Strings.Free (C_Application);
if C_Path = C.Strings.Null_Ptr then
raise RWops_Error with SDL.Error.Get;
end if;
declare
Ada_Path : constant UTF_Strings.UTF_String := C.Strings.Value (C_Path);
begin
SDL_Free (C_Path);
return Ada_Path;
end;
end Preferences_Path;
procedure Close (Ops : in RWops) is
Result : C.int := -1;
begin
Result := Ops.Close (RWops_Pointer (Ops));
if Result /= 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Close;
function From_File (File_Name : in UTF_Strings.UTF_String;
Mode : in File_Mode) return RWops
is
function SDL_RW_From_File (File : in C.Strings.chars_ptr;
Mode : in C.Strings.chars_ptr) return RWops_Pointer with
Import => True,
Convention => C,
External_Name => "SDL_RWFromFile";
Mode_String : String (1 .. 3) := " ";
RWop : RWops_Pointer;
C_File_Name : C.Strings.chars_ptr := C.Strings.Null_Ptr;
C_File_Mode : C.Strings.chars_ptr := C.Strings.Null_Ptr;
begin
case Mode is
when Read =>
Mode_String := "r ";
when Create_To_Write =>
Mode_String := "w ";
when Append =>
Mode_String := "a ";
when Read_Write =>
Mode_String := "r+ ";
when Create_To_Read_Write =>
Mode_String := "w+ ";
when Append_And_Read =>
Mode_String := "a+ ";
when Read_Binary =>
Mode_String := "rb ";
when Create_To_Write_Binary =>
Mode_String := "wb ";
when Append_Binary =>
Mode_String := "ab ";
when Read_Write_Binary =>
Mode_String := "r+b";
when Create_To_Read_Write_Binary =>
Mode_String := "w+b";
when Append_And_Read_Binary =>
Mode_String := "a+b";
end case;
C_File_Name := C.Strings.New_String (File_Name);
C_File_Mode := C.Strings.New_String (Mode_String);
RWop := SDL_RW_From_File (File => C_File_Name, Mode => C_File_Mode);
C.Strings.Free (C_File_Name);
C.Strings.Free (C_File_Mode);
if RWop = null then
raise RWops_Error with SDL.Error.Get;
end if;
return RWops (RWop);
end From_File;
procedure From_File (File_Name : in UTF_Strings.UTF_String;
Mode : in File_Mode;
Ops : out RWops) is
begin
Ops := From_File (File_Name, Mode);
end From_File;
function Seek (Context : in RWops;
Offset : in Offsets;
Whence : in Whence_Type) return Offsets
is
Returned_Offset : SDL.RWops.Offsets := SDL.RWops.Error_Offset;
begin
Returned_Offset := Context.Seek (Context => RWops_Pointer (Context),
Offset => Offset,
Whence => Whence);
if Returned_Offset = SDL.RWops.Error_Offset then
raise RWops_Error with SDL.Error.Get;
end if;
return Returned_Offset;
end Seek;
function Size (Context : in RWops) return Offsets is
Returned_Offset : SDL.RWops.Offsets := SDL.RWops.Error_Offset;
begin
Returned_Offset := Context.Size (Context => RWops_Pointer (Context));
if Returned_Offset < Null_Offset then
raise RWops_Error with SDL.Error.Get;
end if;
return Returned_Offset;
end Size;
function Tell (Context : in RWops) return Offsets is
Returned_Offset : SDL.RWops.Offsets := SDL.RWops.Error_Offset;
begin
-- In C SDL_RWtell is a macro doing just this.
Returned_Offset := Context.Seek (Context => RWops_Pointer (Context),
Offset => Null_Offset,
Whence => RW_Seek_Cur);
if Returned_Offset = SDL.RWops.Error_Offset then
raise RWops_Error with SDL.Error.Get;
end if;
return Returned_Offset;
end Tell;
procedure Write_BE_16 (Destination : in RWops; Value : in Uint16) is
function SDL_Write_BE_16 (Destination : in RWops; Value : in Uint16) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteBE16";
Result : C.size_t := 0;
begin
Result := SDL_Write_BE_16 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_BE_16;
procedure Write_BE_32 (Destination : in RWops; Value : in Uint32) is
function SDL_Write_BE_32 (Destination : in RWops; Value : in Uint32) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteBE32";
Result : C.size_t := 0;
begin
Result := SDL_Write_BE_32 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_BE_32;
procedure Write_BE_64 (Destination : in RWops; Value : in Uint64) is
function SDL_Write_BE_64 (Destination : in RWops; Value : in Uint64) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteBE64";
Result : C.size_t := 0;
begin
Result := SDL_Write_BE_64 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_BE_64;
procedure Write_LE_16 (Destination : in RWops; Value : in Uint16) is
function SDL_Write_LE_16 (Destination : in RWops; Value : in Uint16) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteLE16";
Result : C.size_t := 0;
begin
Result := SDL_Write_LE_16 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_LE_16;
procedure Write_LE_32 (Destination : in RWops; Value : in Uint32) is
function SDL_Write_LE_32 (Destination : in RWops; Value : in Uint32) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteLE32";
Result : C.size_t := 0;
begin
Result := SDL_Write_LE_32 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_LE_32;
procedure Write_LE_64 (Destination : in RWops; Value : in Uint64) is
function SDL_Write_LE_64 (Destination : in RWops; Value : in Uint64) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteLE64";
Result : C.size_t := 0;
begin
Result := SDL_Write_LE_64 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_LE_64;
procedure Write_U_8 (Destination : in RWops; Value : in Uint8) is
function SDL_Write_U_8 (Destination : in RWops; Value : in Uint8) return C.size_t with
Import => True,
Convention => C,
External_Name => "SDL_WriteU8";
Result : C.size_t := 0;
begin
Result := SDL_Write_U_8 (Destination, Value);
if Result = 0 then
raise RWops_Error with SDL.Error.Get;
end if;
end Write_U_8;
function Is_Null (Source : in RWops) return Boolean is
begin
return (if Source = null then True else False);
end Is_Null;
end SDL.RWops;
|
reznikmm/matreshka | Ada | 4,575 | 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.Number_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Number_Attribute_Node is
begin
return Self : Text_Number_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_Number_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Number_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Number_Attribute,
Text_Number_Attribute_Node'Tag);
end Matreshka.ODF_Text.Number_Attributes;
|
zhmu/ananas | Ada | 161 | ads | generic
type T;
with procedure Foo (X : not null access T) is null;
with procedure Bar (X : not null access T) is null;
package Generic_Inst2_C is end;
|
jwarwick/aoc_2020 | Ada | 607 | ads | -- AOC 2020, Day 5
with Ada.Containers.Vectors;
package Day is
type Row_Type is range 0..127;
type Seat_Type is range 0..7;
type Boarding_Pass is record
Row : Row_Type := 0;
Seat : Seat_Type := 0;
end record;
package Boarding_Pass_Vectors is new Ada.Containers.Vectors
(Index_Type => Natural,
Element_Type => Boarding_Pass);
function load_batch(filename : in String) return Boarding_Pass_Vectors.Vector;
function highest_id(passes : in Boarding_Pass_Vectors.Vector) return Natural;
function missing_id(passes : in Boarding_Pass_Vectors.Vector) return Natural;
end Day;
|
AdaCore/gpr | Ada | 43 | ads | package Pck is
procedure Call;
end Pck;
|
reznikmm/matreshka | Ada | 4,583 | 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.Display_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Display_Attribute_Node is
begin
return Self : Text_Display_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_Display_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Display_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Display_Attribute,
Text_Display_Attribute_Node'Tag);
end Matreshka.ODF_Text.Display_Attributes;
|
zhmu/ananas | Ada | 329 | ads | package Pure_Function3_Pkg is
type T is limited private;
function F (Self : T) return Integer with Pure_Function;
procedure Set (Self : in out T);
function F_And_Set (Self : in out T) return Integer with Pure_Function;
private
type T is limited record
F : Integer;
end record;
end Pure_Function3_Pkg;
|
AdaCore/langkit | Ada | 920 | adb | with Ada.Text_IO; use Ada.Text_IO;
with Libfoolang.Analysis; use Libfoolang.Analysis;
procedure Main is
procedure Check_Parents (Node, Parent : Foo_Node; Prefix : String);
-------------------
-- Check_Parents --
-------------------
procedure Check_Parents (Node, Parent : Foo_Node; Prefix : String) is
begin
if Node = No_Foo_Node then
return;
end if;
Put_Line (Prefix & Node.Short_Image);
if Node.Parent /= Parent then
Put_Line (Prefix & "Invalid parent...");
end if;
for C of Node.Children loop
Check_Parents (C, Node, Prefix & " ");
end loop;
end Check_Parents;
Buffer : constant String :=
("def a def b");
Unit : constant Analysis_Unit := Create_Context.Get_From_Buffer
("main.txt", Buffer => Buffer);
begin
Check_Parents (Unit.Root, No_Foo_Node, "");
Put_Line ("main.adb: Done.");
end Main;
|
AdaCore/gpr | Ada | 34 | adb | package body c is
null;
end C;
|
reznikmm/matreshka | Ada | 8,029 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-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$
------------------------------------------------------------------------------
-- The XSObject is a base object for the XML Schema component model.
------------------------------------------------------------------------------
private with Ada.Finalization;
with League.Strings;
private with Matreshka.XML_Schema.AST;
limited with XML.Schema.Namespace_Items;
limited with XML.Schema.Objects.Attribute_Uses;
limited with XML.Schema.Objects.Particles;
limited with XML.Schema.Objects.Terms.Element_Declarations;
limited with XML.Schema.Objects.Terms.Model_Groups;
limited with XML.Schema.Objects.Type_Definitions;
limited with XML.Schema.Objects.Type_Definitions.Complex_Type_Definitions;
limited with XML.Schema.Objects.Type_Definitions.Simple_Type_Definitions;
package XML.Schema.Objects is
pragma Preelaborate;
type XS_Object is tagged private;
Null_XS_Object : constant XS_Object;
function Get_Type (Self : XS_Object'Class) return XML.Schema.Component_Type;
-- The type of this object, i.e. ELEMENT_DECLARATION.
function Get_Name
(Self : XS_Object'Class) return League.Strings.Universal_String;
-- The name of type NCName, as defined in XML Namespaces, of this
-- declaration specified in the {name} property of the component or null if
-- the definition of this component does not have a {name} property. For
-- anonymous types, the processor must construct and expose an anonymous
-- type name that is distinct from the name of every named type and the
-- name of every other anonymous type.
function Get_Namespace
(Self : XS_Object'Class) return League.Strings.Universal_String;
-- The [target namespace] of this object, or null if it is unspecified.
function Get_Namespace_Item
(Self : XS_Object'Class)
return XML.Schema.Namespace_Items.XS_Namespace_Item;
-- A namespace schema information item corresponding to the target
-- namespace of the component, if it is globally declared; or null
-- otherwise.
-- Object type classification subprograms.
function Is_Annotation (Self : XS_Object'Class) return Boolean;
function Is_Attribute_Declaration (Self : XS_Object'Class) return Boolean;
function Is_Attribute_Group (Self : XS_Object'Class) return Boolean;
function Is_Attribute_Use (Self : XS_Object'Class) return Boolean;
function Is_Complex_Type_Definition (Self : XS_Object'Class) return Boolean;
function Is_Element_Declaration (Self : XS_Object'Class) return Boolean;
function Is_Facet (Self : XS_Object'Class) return Boolean;
function Is_Identity_Constraint (Self : XS_Object'Class) return Boolean;
function Is_Model_Group (Self : XS_Object'Class) return Boolean;
function Is_Model_Group_Definition (Self : XS_Object'Class) return Boolean;
function Is_Multivalue_Facet (Self : XS_Object'Class) return Boolean;
function Is_Notation_Declaration (Self : XS_Object'Class) return Boolean;
function Is_Particle (Self : XS_Object'Class) return Boolean;
function Is_Simple_Type_Definition (Self : XS_Object'Class) return Boolean;
function Is_Type_Definition (Self : XS_Object'Class) return Boolean;
function Is_Wildcard (Self : XS_Object'Class) return Boolean;
-- Object type conversion subprograms.
function To_Attribute_Use
(Self : XS_Object'Class)
return XML.Schema.Objects.Attribute_Uses.XS_Attribute_Use;
function To_Complex_Type_Definition
(Self : XS_Object'Class)
return
XML.Schema.Objects.Type_Definitions.Complex_Type_Definitions
.XS_Complex_Type_Definition;
function To_Element_Declaration
(Self : XS_Object'Class)
return
XML.Schema.Objects.Terms.Element_Declarations.XS_Element_Declaration;
function To_Model_Group
(Self : XS_Object'Class)
return XML.Schema.Objects.Terms.Model_Groups.XS_Model_Group;
function To_Particle
(Self : XS_Object'Class)
return XML.Schema.Objects.Particles.XS_Particle;
function To_Simple_Type_Definition
(Self : XS_Object'Class)
return
XML.Schema.Objects.Type_Definitions.Simple_Type_Definitions
.XS_Simple_Type_Definition;
function To_Type_Definition
(Self : XS_Object'Class)
return XML.Schema.Objects.Type_Definitions.XS_Type_Definition;
function "=" (Left : XS_Object; Right : XS_Object) return Boolean;
function Is_Equal
(Left : XS_Object; Right : XS_Object'Class) return Boolean;
function Is_Null (Self : XS_Object'Class) return Boolean;
private
type XS_Object is new Ada.Finalization.Controlled with record
Node : Matreshka.XML_Schema.AST.Object_Access;
end record;
Null_XS_Object : constant XS_Object
:= (Ada.Finalization.Controlled with Node => null);
end XML.Schema.Objects;
|
zhmu/ananas | Ada | 18,371 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ C H 9 --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Expand routines for chapter 9 constructs
with Types; use Types;
package Exp_Ch9 is
type Subprogram_Protection_Mode is
(Dispatching_Mode,
Protected_Mode,
Unprotected_Mode);
-- This type is used to distinguish the different protection modes of a
-- protected subprogram.
procedure Build_Activation_Chain_Entity (N : Node_Id);
-- Given a declaration N of an object that is a task, or contains tasks
-- (other than allocators to tasks) this routine ensures that an activation
-- chain has been declared in the appropriate scope, building the required
-- declaration for the chain variable if not. The name of this variable
-- is always _Chain and it is accessed by name.
function Build_Call_With_Task (N : Node_Id; E : Entity_Id) return Node_Id;
-- N is a node representing the name of a task or an access to a task.
-- The value returned is a call to the function whose name is the entity
-- E (typically a runtime routine entity obtained using RTE) with the
-- Task_Id of the associated task as the parameter. The caller is
-- responsible for analyzing and resolving the resulting tree.
procedure Build_Class_Wide_Master (Typ : Entity_Id);
-- Given an access-to-limited class-wide type or an access-to-limited
-- interface, ensure that the designated type has a _master and generate
-- a renaming of the said master to service the access type.
function Build_Master_Declaration (Loc : Source_Ptr) return Node_Id;
-- For targets supporting tasks, generate:
-- _Master : constant Integer := Current_Master.all;
-- For targets where tasks or tasking hierarchies are prohibited, generate:
-- _Master : constant Master_Id := 3;
procedure Build_Master_Entity (Obj_Or_Typ : Entity_Id);
-- Given the name of an object or a type which is either a task, contains
-- tasks or designates tasks, create a _master in the appropriate scope
-- which captures the value of Current_Master. Mark the nearest enclosing
-- body or block as being a task master.
procedure Build_Master_Renaming
(Ptr_Typ : Entity_Id;
Ins_Nod : Node_Id := Empty);
-- Given an access type Ptr_Typ whose designated type is either a task or
-- contains tasks, create a renaming of the form:
--
-- <Ptr_Typ>M : Master_Id renames _Master;
--
-- where _master denotes the task master of the enclosing context. Ins_Nod
-- is used to provide a specific insertion node for the renaming.
function Build_Protected_Sub_Specification
(N : Node_Id;
Prot_Typ : Entity_Id;
Mode : Subprogram_Protection_Mode) return Node_Id;
-- Build the specification for protected subprogram. This is called when
-- expanding a protected type, and also when expanding the declaration for
-- an Access_To_Protected_Subprogram type. In the latter case, Prot_Typ is
-- empty, and the first parameter of the signature of the protected op is
-- of type System.Address.
procedure Build_Protected_Subprogram_Call
(N : Node_Id;
Name : Node_Id;
Rec : Node_Id;
External : Boolean := True);
-- The node N is a subprogram or entry call to a protected subprogram. This
-- procedure rewrites this call with the appropriate expansion. Name is the
-- subprogram, and Rec is the record corresponding to the protected object.
-- External is False if the call is to another protected subprogram within
-- the same object.
procedure Build_Protected_Subprogram_Call_Cleanup
(Op_Spec : Node_Id;
Conc_Typ : Node_Id;
Loc : Source_Ptr;
Stmts : List_Id);
-- Append to Stmts the cleanups after a call to a protected subprogram
-- whose specification is Op_Spec. Conc_Typ is the concurrent type and Loc
-- the sloc for appended statements. The cleanup will either unlock the
-- protected object or serve pending entries.
procedure Build_Task_Activation_Call (N : Node_Id);
-- This procedure is called for constructs that can be task activators,
-- i.e. task bodies, subprogram bodies, package bodies and blocks. If the
-- construct is a task activator (as indicated by the non-empty setting of
-- Activation_Chain_Entity, either in the construct, or, in the case of a
-- package body, in its associated package spec), then a call to
-- Activate_Tasks with this entity as the single parameter is inserted at
-- the start of the statements of the activator.
procedure Build_Task_Allocate_Block
(Actions : List_Id;
N : Node_Id;
Args : List_Id);
-- This routine is used in the case of allocators where the designated type
-- is a task or contains tasks. In this case, the normal initialize call
-- is replaced by:
--
-- blockname : label;
-- blockname : declare
-- _Chain : Activation_Chain;
--
-- procedure _Expunge is
-- begin
-- Expunge_Unactivated_Tasks (_Chain);
-- end;
--
-- begin
-- Init (Args);
-- Activate_Tasks (_Chain);
-- at end
-- _Expunge;
-- end;
--
-- to get the task or tasks created and initialized. The expunge call
-- ensures that any tasks that get created but not activated due to an
-- exception are properly expunged (it has no effect in the normal case).
-- The argument N is the allocator, and Args is the list of arguments for
-- the initialization call, constructed by the caller, which uses the
-- Master_Id of the access type as the _Master parameter, and _Chain
-- (defined above) as the _Chain parameter.
procedure Build_Task_Allocate_Block_With_Init_Stmts
(Actions : List_Id;
N : Node_Id;
Init_Stmts : List_Id);
-- Ada 2005 (AI-287): Similar to previous routine, but used to expand
-- allocated aggregates with default initialized components. Init_Stmts
-- contains the list of statements required to initialize the allocated
-- aggregate. It replaces the call to Init (Args) done by
-- Build_Task_Allocate_Block. Also used to expand allocators containing
-- build-in-place function calls.
function Build_Wrapper_Spec
(Subp_Id : Entity_Id;
Obj_Typ : Entity_Id;
Formals : List_Id) return Node_Id;
-- Ada 2005 (AI-345): Build the specification of a primitive operation
-- associated with a protected or task type. This is required to implement
-- dispatching calls through interfaces. Subp_Id is the primitive to be
-- wrapped, Obj_Typ is the type of the newly added formal parameter to
-- handle object notation, Formals are the original entry formals that
-- will be explicitly replicated.
function Concurrent_Ref (N : Node_Id) return Node_Id;
-- Given the name of a concurrent object (task or protected object), or
-- the name of an access to a concurrent object, this function returns an
-- expression referencing the associated Task_Id or Protection object,
-- respectively. Note that a special case is when the name is a reference
-- to a task type name. This can only happen within a task body, and the
-- meaning is to get the Task_Id for the currently executing task.
function Convert_Concurrent
(N : Node_Id;
Typ : Entity_Id) return Node_Id;
-- N is an expression of type Typ. If the type is not a concurrent type
-- then it is returned unchanged. If it is a task or protected reference,
-- Convert_Concurrent creates an unchecked conversion node from this
-- expression to the corresponding concurrent record type value. We need
-- this in any situation where the concurrent type is used, because the
-- actual concurrent object is an object of the corresponding concurrent
-- type, and manipulations on the concurrent object actually manipulate the
-- corresponding object of the record type.
function Entry_Index_Expression
(Sloc : Source_Ptr;
Ent : Entity_Id;
Index : Node_Id;
Ttyp : Entity_Id)
return Node_Id;
-- Returns an expression to compute a task entry index given the name of
-- the entry or entry family. For the case of a task entry family, the
-- Index parameter contains the expression for the subscript. Ttyp is the
-- task type.
procedure Establish_Task_Master (N : Node_Id);
-- Given a subprogram body, or a block statement, or a task body, this
-- procedure makes the necessary transformations required of a task master
-- (add Enter_Master call at start, and establish a cleanup routine to make
-- sure Complete_Master is called on exit).
procedure Expand_Access_Protected_Subprogram_Type (N : Node_Id);
-- Build Equivalent_Type for an Access_To_Protected_Subprogram.
-- Equivalent_Type is a record type with two components: a pointer to the
-- protected object, and a pointer to the operation itself.
procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id);
-- Expand declarations required for accept statement. See bodies of both
-- Expand_Accept_Declarations and Expand_N_Accept_Statement for full
-- details of the nature and use of these declarations, which are inserted
-- immediately before the accept node N. The second argument is the entity
-- for the corresponding entry.
procedure Expand_Entry_Barrier (N : Node_Id; Ent : Entity_Id);
-- Expand the entry barrier into a function. This is called directly
-- from Analyze_Entry_Body so that the discriminals and privals of the
-- barrier can be attached to the function declaration list, and a new
-- set prepared for the entry body procedure, before the entry body
-- statement sequence can be expanded. The resulting function is analyzed
-- now, within the context of the protected object, to resolve calls to
-- other protected functions.
procedure Expand_N_Abort_Statement (N : Node_Id);
procedure Expand_N_Accept_Statement (N : Node_Id);
procedure Expand_N_Asynchronous_Select (N : Node_Id);
procedure Expand_N_Conditional_Entry_Call (N : Node_Id);
procedure Expand_N_Delay_Relative_Statement (N : Node_Id);
procedure Expand_N_Delay_Until_Statement (N : Node_Id);
procedure Expand_N_Entry_Body (N : Node_Id);
procedure Expand_N_Entry_Call_Statement (N : Node_Id);
procedure Expand_N_Entry_Declaration (N : Node_Id);
procedure Expand_N_Protected_Body (N : Node_Id);
procedure Expand_N_Protected_Type_Declaration (N : Node_Id);
-- Expands protected type declarations. This results, among other things,
-- in the declaration of a record type for the representation of protected
-- objects and (if there are entries) in an entry service procedure. The
-- Protection value used by the GNARL to control the object will always be
-- the first field of the record, and the entry service procedure spec (if
-- it exists) will always immediately follow the record declaration. This
-- allows these two nodes to be found from the type, without benefit of
-- further attributes, using Corresponding_Record.
procedure Expand_N_Requeue_Statement (N : Node_Id);
procedure Expand_N_Selective_Accept (N : Node_Id);
procedure Expand_N_Single_Protected_Declaration (N : Node_Id);
procedure Expand_N_Single_Task_Declaration (N : Node_Id);
procedure Expand_N_Task_Body (N : Node_Id);
procedure Expand_N_Task_Type_Declaration (N : Node_Id);
procedure Expand_N_Timed_Entry_Call (N : Node_Id);
procedure Expand_Protected_Body_Declarations
(N : Node_Id;
Spec_Id : Entity_Id);
-- Expand declarations required for a protected body. See bodies of both
-- Expand_Protected_Body_Declarations and Expand_N_Protected_Body for full
-- details of the nature and use of these declarations. The second argument
-- is the entity for the corresponding protected type declaration.
function External_Subprogram (E : Entity_Id) return Entity_Id;
-- Return the external version of a protected operation, which locks
-- the object before invoking the internal protected subprogram body.
function Find_Master_Scope (E : Entity_Id) return Entity_Id;
-- When a type includes tasks, a master entity is created in the scope, to
-- be used by the runtime during activation. In general the master is the
-- immediate scope in which the type is declared, but in Ada 2005, in the
-- presence of synchronized classwide interfaces, the immediate scope of
-- an anonymous access type may be a transient scope, which has no run-time
-- presence. In this case, the scope of the master is the innermost scope
-- that comes from source.
function First_Protected_Operation (D : List_Id) return Node_Id;
-- Given the declarations list for a protected body, find the
-- first protected operation body.
procedure Install_Private_Data_Declarations
(Loc : Source_Ptr;
Spec_Id : Entity_Id;
Conc_Typ : Entity_Id;
Body_Nod : Node_Id;
Decls : List_Id;
Barrier : Boolean := False;
Family : Boolean := False);
-- This routines generates several types, objects and object renamings used
-- in the handling of discriminants and private components of protected and
-- task types. It also generates the entry index for entry families. Formal
-- Spec_Id denotes an entry, entry family or a subprogram, Conc_Typ is the
-- concurrent type where Spec_Id resides, Body_Nod is the corresponding
-- body of Spec_Id, Decls are the declarations of the subprogram or entry.
-- Flag Barrier denotes whether the context is an entry barrier function.
-- Flag Family is used in conjunction with Barrier to denote a barrier for
-- an entry family.
--
-- The generated types, entities and renamings are:
--
-- * If flag Barrier is set or Spec_Id denotes a protected entry or an
-- entry family, generate:
--
-- type prot_typVP is access prot_typV;
-- _object : prot_typVP := prot_typV (_O);
--
-- where prot_typV is the corresponding record of a protected type and
-- _O is a formal parameter representing the concurrent object of either
-- the barrier function or the entry (family).
--
-- * If Conc_Typ is a protected type, create a renaming for the Protection
-- field _object:
--
-- conc_typR : protection_typ renames _object._object;
--
-- * If Conc_Typ has discriminants, create renamings of the form:
--
-- discr_nameD : discr_typ renames _object.discr_name;
-- or
-- discr_nameD : discr_typ renames _task.discr_name;
--
-- * If Conc_Typ denotes a protected type and has private components,
-- generate renamings of the form:
--
-- comp_name : comp_typ renames _object.comp_name;
--
-- * Finally, is flag Barrier and Family are set or Spec_Id denotes an
-- entry family, generate the entry index constant:
--
-- subtype Jnn is <Type of Index> range Low .. High;
-- J : constant Jnn :=
-- Jnn'Val (_E - <Index expression> + Jnn'Pos (Jnn'First));
--
-- All the above declarations are inserted in the order shown to the front
-- of Decls.
function Make_Task_Create_Call (Task_Rec : Entity_Id) return Node_Id;
-- Given the entity of the record type created for a task type, build
-- the call to Create_Task
function Make_Initialize_Protection
(Protect_Rec : Entity_Id) return List_Id;
-- Given the entity of the record type created for a protected type, build
-- a list of statements needed for proper initialization of the object.
function Next_Protected_Operation (N : Node_Id) return Node_Id;
-- Given a protected operation node (a subprogram or entry body), find the
-- following node in the declarations list.
procedure Set_Discriminals (Dec : Node_Id);
-- Replace discriminals in a protected type for use by the next protected
-- operation on the type. Each operation needs a new set of discriminals,
-- since it needs a unique renaming of the discriminant fields in the
-- record used to implement the protected type.
end Exp_Ch9;
|
zhmu/ananas | Ada | 32,822 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ U N S T --
-- --
-- S p e c --
-- --
-- Copyright (C) 2014-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. --
-- --
------------------------------------------------------------------------------
-- Expand routines for unnesting subprograms
with Table;
with Types; use Types;
package Exp_Unst is
-- -----------------
-- -- The Problem --
-- -----------------
-- Normally, nested subprograms in the source result in corresponding
-- nested subprograms in the resulting tree. We then expect the back end
-- to handle such nested subprograms, including all cases of uplevel
-- references. For example, the GCC back end can do this relatively easily
-- since GNU C (as an extension) allows nested functions with uplevel
-- references, and implements an appropriate static chain approach to
-- dealing with such uplevel references.
-- However, we also want to be able to interface with back ends that do
-- not easily handle such uplevel references. One example is the back end
-- that translates the tree into standard C source code. In the future,
-- other back ends might need the same capability (e.g. a back end that
-- generated LLVM intermediate code).
-- We could imagine simply handling such references in the appropriate
-- back end. For example the back end that generates C could recognize
-- nested subprograms and rig up some way of translating them, e.g. by
-- making a static-link source level visible.
-- Rather than take that approach, we prefer to do a semantics-preserving
-- transformation on the GNAT tree, that eliminates the problem before we
-- hand the tree over to the back end. There are two reasons for preferring
-- this approach:
-- First: the work needs only to be done once for all affected back ends
-- and we can remain within the semantics of the tree. The front end is
-- full of tree transformations, so we have all the infrastructure for
-- doing transformations of this type.
-- Second: given that the transformation will be semantics-preserving,
-- we can still use the standard GCC back end to build code from it.
-- This means we can easily run our full test suite to verify that the
-- transformations are indeed semantics preserving. It is a lot more
-- work to thoroughly test the output of specialized back ends.
-- Looking at the problem, we have three situations to deal with. Note
-- that in these examples, we use all lower case, since that is the way
-- the internal tree is cased.
-- First, cases where there are no uplevel references, for example
-- procedure case1 is
-- function max (m, n : Integer) return integer is
-- begin
-- return integer'max (m, n);
-- end max;
-- ...
-- end case1;
-- Second, cases where there are explicit uplevel references.
-- procedure case2 (b : integer) is
-- procedure Inner (bb : integer);
--
-- procedure inner2 is
-- begin
-- inner(5);
-- end;
--
-- x : integer := 77;
-- y : constant integer := 15 * 16;
-- rv : integer := 10;
--
-- procedure inner (bb : integer) is
-- begin
-- x := rv + y + bb + b;
-- end;
--
-- begin
-- inner2;
-- end case2;
-- In this second example, B, X, RV are uplevel referenced. Y is not
-- considered as an uplevel reference since it is a static constant
-- where references are replaced by the value at compile time.
-- Third, cases where there are implicit uplevel references via types
-- whose bounds depend on locally declared constants or variables:
-- function case3 (x, y : integer) return boolean is
-- subtype dynam is integer range x .. y + 3;
-- subtype static is integer range 42 .. 73;
-- xx : dynam := y;
--
-- type darr is array (dynam) of Integer;
-- type darec is record
-- A : darr;
-- B : integer;
-- end record;
-- darecv : darec;
--
-- function inner (b : integer) return boolean is
-- begin
-- return b in dynam and then darecv.b in static;
-- end inner;
--
-- begin
-- return inner (42) and then inner (xx * 3 - y * 2);
-- end case3;
--
-- In this third example, the membership test implicitly references the
-- the bounds of Dynam, which both involve uplevel references.
-- ------------------
-- -- The Solution --
-- ------------------
-- Looking at the three cases above, the first case poses no problem at
-- all. Indeed the subprogram could have been declared at the outer level
-- (perhaps changing the name). But this style is quite common as a way
-- of limiting the scope of a local procedure called only within the outer
-- procedure. We could move it to the outer level (with a name change if
-- needed), but we don't bother. We leave it nested, and the back end just
-- translates it as though it were not nested.
-- In general we leave nested procedures nested, rather than trying to move
-- them to the outer level (the back end may do that, e.g. as part of the
-- translation to C, but we don't do it in the tree itself). This saves a
-- LOT of trouble in terms of visibility and semantics.
-- But of course we have to deal with the uplevel references. The idea is
-- to rewrite these nested subprograms so that they no longer have any such
-- uplevel references, so by the time they reach the back end, they all are
-- case 1 (no uplevel references) and thus easily handled.
-- To deal with explicit uplevel references (case 2 above), we proceed with
-- the following steps:
-- All entities marked as being uplevel referenced are marked as aliased
-- since they will be accessed indirectly via an activation record as
-- described below.
-- An activation record is created containing system address values
-- for each uplevel referenced entity in a given scope. In the example
-- given before, we would have:
-- type AREC1T is record
-- b : Address;
-- x : Address;
-- rv : Address;
-- end record;
-- type AREC1PT is access all AREC1T;
-- AREC1 : aliased AREC1T;
-- AREC1P : constant AREC1PT := AREC1'Access;
-- The fields of AREC1 are set at the point the corresponding entity
-- is declared (immediately for parameters).
-- Note: the 1 in all these names is a unique index number. Different
-- scopes requiring different ARECnT declarations will have different
-- values of n to ensure uniqueness.
-- Note: normally the field names in the activation record match the
-- name of the entity. An exception is when the entity is declared in
-- a declare block, in which case we append the entity number, to avoid
-- clashes between the same name declared in different declare blocks.
-- For all subprograms nested immediately within the corresponding scope,
-- a parameter AREC1F is passed, and all calls to these routines have
-- AREC1P added as an additional formal.
-- Now within the nested procedures, any reference to an uplevel entity
-- xxx is replaced by typ'Deref(AREC1.xxx) where typ is the type of the
-- reference.
-- Note: the reason that we use Address as the component type in the
-- declaration of AREC1T is that we may create this type before we see
-- the declaration of this type.
-- The following shows example 2 above after this translation:
-- procedure case2x (b : aliased Integer) is
-- type AREC1T is record
-- b : Address;
-- x : Address;
-- rv : Address;
-- end record;
--
-- type AREC1PT is access all AREC1T;
--
-- AREC1 : aliased AREC1T;
-- AREC1P : constant AREC1PT := AREC1'Access;
--
-- AREC1.b := b'Address;
--
-- procedure inner (bb : integer; AREC1F : AREC1PT);
--
-- procedure inner2 (AREC1F : AREC1PT) is
-- begin
-- inner(5, AREC1F);
-- end;
--
-- x : aliased integer := 77;
-- AREC1.x := X'Address;
--
-- y : constant Integer := 15 * 16;
--
-- rv : aliased Integer;
-- AREC1.rv := rv'Address;
--
-- procedure inner (bb : integer; AREC1F : AREC1PT) is
-- begin
-- Integer'Deref(AREC1F.x) :=
-- Integer'Deref(AREC1F.rv) + y + b + Integer'Deref(AREC1F.b);
-- end;
--
-- begin
-- inner2 (AREC1P);
-- end case2x;
-- And now the inner procedures INNER2 and INNER have no uplevel references
-- so they have been reduced to case 1, which is the case easily handled by
-- the back end. Note that the generated code is not strictly legal Ada
-- because of the assignments to AREC1 in the declarative sequence, but the
-- GNAT tree always allows such mixing of declarations and statements, so
-- the back end must be prepared to handle this in any case.
-- Case 3 where we have uplevel references to types is a bit more complex.
-- That would especially be the case if we did a full transformation that
-- completely eliminated such uplevel references as we did for case 2. But
-- instead of trying to do that, we rewrite the subprogram so that the code
-- generator can easily detect and deal with these uplevel type references.
-- First we distinguish two cases
-- Static types are one of the two following cases:
-- Discrete types whose bounds are known at compile time. This is not
-- quite the same as what is tested by Is_OK_Static_Subtype, in that
-- it allows compile time known values that are not static expressions.
-- Composite types, whose components are (recursively) static types.
-- Dynamic types are one of the two following cases:
-- Discrete types with at least one bound not known at compile time.
-- Composite types with at least one component that is (recursively)
-- a dynamic type.
-- Uplevel references to static types are not a problem, the front end
-- or the code generator fetches the bounds as required, and since they
-- are compile time known values, this value can just be extracted and
-- no actual uplevel reference is required.
-- Uplevel references to dynamic types are a potential problem, since
-- such references may involve an implicit access to a dynamic bound,
-- and this reference is an implicit uplevel access.
-- To fully unnest such references would be messy, since we would have
-- to create local copies of the dynamic types involved, so that the
-- front end or code generator could generate an explicit uplevel
-- reference to the bound involved. Rather than do that, we set things
-- up so that this situation can be easily detected and dealt with when
-- there is an implicit reference to the bounds.
-- What we do is to always generate a local constant for any dynamic
-- bound in a dynamic subtype xx with name xx_FIRST or xx_LAST. The one
-- case where we can skip this is where the bound is already a constant.
-- E.g. in the third example above, subtype dynam is expanded as
-- dynam_LAST : constant Integer := y + 3;
-- subtype dynam is integer range x .. dynam_LAST;
-- Now if type dynam is uplevel referenced (as it is in this case), then
-- the bounds x and dynam_LAST are marked as uplevel references
-- so that appropriate entries are made in the activation record. Any
-- explicit reference to such a bound in the front end generated code
-- will be handled by the normal uplevel reference mechanism which we
-- described above for case 2. For implicit references by a back end
-- that needs to unnest things, any such implicit reference to one of
-- these bounds can be replaced by an appropriate reference to the entry
-- in the activation record for xx_FIRST or xx_LAST. Thus the back end
-- can eliminate the problematical uplevel reference without the need to
-- do the heavy tree modification to do that at the code expansion level.
-- Looking at case 3 again, here is the normal -gnatG expanded code
-- function case3 (x : integer; y : integer) return boolean is
-- dynam_LAST : constant integer := y {+} 3;
-- subtype dynam is integer range x .. dynam_LAST;
-- subtype static is integer range 42 .. 73;
--
-- [constraint_error when
-- not (y in x .. dynam_LAST)
-- "range check failed"]
--
-- xx : dynam := y;
--
-- type darr is array (x .. dynam_LAST) of integer;
-- type darec is record
-- a : darr;
-- b : integer;
-- end record;
-- [type TdarrB is array (x .. dynam_LAST range <>) of integer]
-- freeze TdarrB []
-- darecv : darec;
--
-- function inner (b : integer) return boolean is
-- begin
-- return b in x .. dynam_LAST and then darecv.b in 42 .. 73;
-- end inner;
-- begin
-- return inner (42) and then inner (xx {*} 3 {-} y {*} 2);
-- end case3;
-- Note: the actual expanded code has fully qualified names so for
-- example function inner is actually function case3__inner. For now
-- we ignore that detail to clarify the examples.
-- Here we see that some of the bounds references are expanded by the
-- front end, so that we get explicit references to y or dynam_Last. These
-- cases are handled by the normal uplevel reference mechanism described
-- above for case 2. This is the case for the constraint check for the
-- initialization of xx, and the range check in function inner.
-- But the reference darecv.b in the return statement of function
-- inner has an implicit reference to the bounds of dynam, since to
-- compute the location of b in the record, we need the length of a.
-- Here is the full translation of the third example:
-- function case3x (x, y : integer) return boolean is
-- type AREC1T is record
-- x : Address;
-- dynam_LAST : Address;
-- end record;
--
-- type AREC1PT is access all AREC1T;
--
-- AREC1 : aliased AREC1T;
-- AREC1P : constant AREC1PT := AREC1'Access;
--
-- AREC1.x := x'Address;
--
-- dynam_LAST : constant integer := y {+} 3;
-- AREC1.dynam_LAST := dynam_LAST'Address;
-- subtype dynam is integer range x .. dynam_LAST;
-- xx : dynam := y;
--
-- [constraint_error when
-- not (y in x .. dynam_LAST)
-- "range check failed"]
--
-- subtype static is integer range 42 .. 73;
--
-- type darr is array (x .. dynam_LAST) of Integer;
-- type darec is record
-- A : darr;
-- B : integer;
-- end record;
-- darecv : darec;
--
-- function inner (b : integer; AREC1F : AREC1PT) return boolean is
-- begin
-- return b in x .. Integer'Deref(AREC1F.dynam_LAST)
-- and then darecv.b in 42 .. 73;
-- end inner;
--
-- begin
-- return inner (42, AREC1P) and then inner (xx * 3, AREC1P);
-- end case3x;
-- And now the back end when it processes darecv.b will access the bounds
-- of darecv.a by referencing the d and dynam_LAST fields of AREC1P.
-----------------------------
-- Multiple Nesting Levels --
-----------------------------
-- In our examples so far, we have only nested to a single level, but the
-- scheme generalizes to multiple levels of nesting and in this section we
-- discuss how this generalization works.
-- Consider this example with two nesting levels
-- To deal with elimination of uplevel references, we follow the same basic
-- approach described above for case 2, except that we need an activation
-- record at each nested level. Basically the rule is that any procedure
-- that has nested procedures needs an activation record. When we do this,
-- the inner activation records have a pointer (uplink) to the immediately
-- enclosing activation record, the normal arrangement of static links. The
-- following shows the full translation of this fourth case.
-- function case4x (x : integer) return integer is
-- type AREC1T is record
-- v1 : Address;
-- end record;
--
-- type AREC1PT is access all AREC1T;
--
-- AREC1 : aliased AREC1T;
-- AREC1P : constant AREC1PT := AREC1'Access;
--
-- v1 : integer := x;
-- AREC1.v1 := v1'Address;
--
-- function inner1 (y : integer; AREC1F : AREC1PT) return integer is
-- type AREC2T is record
-- AREC1U : AREC1PT;
-- v2 : Address;
-- end record;
--
-- type AREC2PT is access all AREC2T;
--
-- AREC2 : aliased AREC2T;
-- AREC2P : constant AREC2PT := AREC2'Access;
--
-- AREC2.AREC1U := AREC1F;
--
-- v2 : integer := Integer'Deref (AREC1F.v1) {+} 1;
-- AREC2.v2 := v2'Address;
--
-- function inner2
-- (z : integer; AREC2F : AREC2PT) return integer
-- is
-- begin
-- return integer(z {+}
-- Integer'Deref (AREC2F.AREC1U.v1) {+}
-- Integer'Deref (AREC2F.v2).all);
-- end inner2;
-- begin
-- return integer(y {+}
-- inner2 (Integer'Deref (AREC1F.v1), AREC2P));
-- end inner1;
-- begin
-- return inner1 (x, AREC1P);
-- end case4x;
-- As can be seen in this example, the index numbers following AREC in the
-- generated names avoid confusion between AREC names at different levels.
-------------------------
-- Name Disambiguation --
-------------------------
-- As described above, the translation scheme would raise issues when the
-- code generator did the actual unnesting if identically named nested
-- subprograms exist. Similarly overloading would cause a naming issue.
-- In fact, the expanded code includes qualified names which eliminate this
-- problem. We omitted the qualification from the expanded examples above
-- for simplicity. But to see this in action, consider this example:
-- function Mnames return Boolean is
-- procedure Inner is
-- procedure Inner is
-- begin
-- null;
-- end;
-- begin
-- Inner;
-- end;
-- function F (A : Boolean) return Boolean is
-- begin
-- return not A;
-- end;
-- function F (A : Integer) return Boolean is
-- begin
-- return A > 42;
-- end;
-- begin
-- Inner;
-- return F (42) or F (True);
-- end;
-- The expanded code actually looks like:
-- function mnames return boolean is
-- procedure mnames__inner is
-- procedure mnames__inner__inner is
-- begin
-- null;
-- return;
-- end mnames__inner__inner;
-- begin
-- mnames__inner__inner;
-- return;
-- end mnames__inner;
-- function mnames__f (a : boolean) return boolean is
-- begin
-- return not a;
-- end mnames__f;
-- function mnames__f__2 (a : integer) return boolean is
-- begin
-- return a > 42;
-- end mnames__f__2;
-- begin
-- mnames__inner;
-- return mnames__f__2 (42) or mnames__f (true);
-- end mnames;
-- As can be seen from studying this example, the qualification deals both
-- with the issue of clashing names (mnames__inner, mnames__inner__inner),
-- and with overloading (mnames__f, mnames__f__2).
-- In addition, the declarations of ARECnT and ARECnPT get moved to the
-- outer level when we actually generate C code, so we suffix these names
-- with the corresponding entity name to make sure they are unique.
---------------------------
-- Terminology for Calls --
---------------------------
-- The level of a subprogram in the nest being analyzed is defined to be
-- the level of nesting, so the outer level subprogram (the one passed to
-- Unnest_Subprogram) is 1, subprograms immediately nested within this
-- outer level subprogram have a level of 2, etc.
-- Calls within the nest being analyzed are of three types:
-- Downward call: this is a call from a subprogram to a subprogram that
-- is immediately nested with in the caller, and thus has a level that
-- is one greater than the caller. It is a fundamental property of the
-- nesting structure and visibility that it is not possible to make a
-- call from level N to level M, where M is greater than N + 1.
-- Parallel call: this is a call from a nested subprogram to another
-- nested subprogram that is at the same level.
-- Upward call: this is a call from a subprogram to a subprogram that
-- encloses the caller. The level of the callee is less than the level
-- of the caller, and there is no limit on the difference, e.g. for an
-- uplevel call, a subprogram at level 5 can call one at level 2 or even
-- the outer level subprogram at level 1.
-------------------------------------
-- Handling of unconstrained types --
-------------------------------------
-- Objects whose nominal subtype is an unconstrained array type present
-- additional complications for translation into LLVM. The address
-- attribute of such objects points to the first component of the
-- array, and the bounds are found elsewhere, typically ahead of the
-- components. In many cases the bounds of an object are stored ahead
-- of the components and can be retrieved from it. However, if the
-- object is an expression (e.g. a slice) the bounds are not adjacent
-- and thus must be conveyed explicitly by means of a so-called
-- fat pointer. This leads to the following enhancements to the
-- handling of uplevel references described so far. This applies only
-- to uplevel references to unconstrained formals of enclosing
-- subprograms:
--
-- a) Uplevel references are detected as before during the tree traversal
-- in Visit_Node. For reference to uplevel formals, we include those with
-- an unconstrained array type (e.g. String) even if such a type has
-- static bounds.
--
-- b) references to unconstrained formals are recognized in the Subp
-- table by means of the predicate Needs_Fat_Pointer.
--
-- c) When constructing the required activation record we also construct
-- a named access type whose designated type is the unconstrained array
-- type. The activation record of a subprogram that contains such an
-- uplevel reference includes a component of this access type. The
-- declaration for that access type is introduced and analyzed before
-- that of the activation record, so it appears in the subprogram that
-- has that formal.
--
-- d) The uplevel reference is rewritten as an explicit dereference (.all)
-- of the corresponding pointer component.
--
-----------
-- Subps --
-----------
-- Table to record subprograms within the nest being currently analyzed.
-- Entries in this table are made for each subprogram expanded, and do not
-- get cleared as we complete the expansion, since we want the table info
-- around in Cprint for the actual unnesting operation. Subps_First in this
-- unit records the starting entry in the table for the entries for Subp
-- and this is also recorded in the Subps_Index field of the outer level
-- subprogram in the nest. The last subps index for the nest can be found
-- in the Subp_Entry Last field of this first entry.
subtype SI_Type is Nat;
-- Index type for the table
Subps_First : SI_Type;
-- Record starting index for entries in the current nest (this is the table
-- index of the entry for Subp itself, and is recorded in the Subps_Index
-- field of the entity for this subprogram).
type Subp_Entry is record
Ent : Entity_Id;
-- Entity of the subprogram
Bod : Node_Id;
-- Subprogram_Body node for this subprogram
Lev : Nat;
-- Subprogram level (1 = outer subprogram (Subp argument), 2 = nested
-- immediately within this outer subprogram etc.)
Reachable : Boolean;
-- This flag is set True if there is a call path from the outer level
-- subprogram to this subprogram. If Reachable is False, it means that
-- the subprogram is declared but not actually referenced. We remove
-- such subprograms from the tree, which simplifies our task, because
-- we don't have to worry about e.g. uplevel references from such an
-- unreferenced subprogram, which might require (useless) activation
-- records to be created. This is computed by setting the outer level
-- subprogram (Subp itself) as reachable, and then doing a transitive
-- closure following all calls.
Uplevel_Ref : Nat;
-- The outermost level which defines entities which this subprogram
-- references either directly or indirectly via a call. This cannot
-- be greater than Lev. If it is equal to Lev, then it means that the
-- subprogram does not make any uplevel references and that thus it
-- does not need an activation record pointer passed. If it is less than
-- Lev, then an activation record pointer is needed, since there is at
-- least one uplevel reference. This is computed by initially setting
-- Uplevel_Ref to Lev for all subprograms. Then on the initial tree
-- traversal, decreasing Uplevel_Ref for an explicit uplevel reference,
-- and finally by doing a transitive closure that follows calls (if A
-- calls B and B has an uplevel reference to level X, then A references
-- level X indirectly).
Declares_AREC : Boolean;
-- This is set True for a subprogram which include the declarations
-- for a local activation record to be passed on downward calls. It
-- is set True for the target level of an uplevel reference, and for
-- all intervening nested subprograms. For example, if a subprogram X
-- at level 5 makes an uplevel reference to an entity declared in a
-- level 2 subprogram, then the subprograms at levels 4,3,2 enclosing
-- the level 5 subprogram will have this flag set True.
Uents : Elist_Id;
-- This is a list of entities declared in this subprogram which are
-- uplevel referenced. It contains both objects (which will be put in
-- the corresponding AREC activation record), and types. The types are
-- not put in the AREC activation record, but referenced bounds (i.e.
-- generated _FIRST and _LAST entities, and formal parameters) will be
-- in the list in their own right.
Last : SI_Type;
-- This field is set only in the entry for the outer level subprogram
-- in a nest, and records the last index in the Subp table for all the
-- entries for subprograms in this nest.
ARECnF : Entity_Id;
-- This entity is defined for all subprograms which need an extra formal
-- that contains a pointer to the activation record needed for uplevel
-- references. ARECnF must be defined for any subprogram which has a
-- direct or indirect uplevel reference (i.e. Reference_Level < Lev).
ARECn : Entity_Id;
ARECnT : Entity_Id;
ARECnPT : Entity_Id;
ARECnP : Entity_Id;
-- These AREC entities are defined only for subprograms for which we
-- generate an activation record declaration, i.e. for subprograms for
-- which the Declares_AREC flag is set True.
ARECnU : Entity_Id;
-- This AREC entity is the uplink component. It is other than Empty only
-- for nested subprograms that declare an activation record as indicated
-- by Declares_AREC being True, and which have uplevel references (Lev
-- greater than Uplevel_Ref). It is the additional component in the
-- activation record that references the ARECnF pointer (which points
-- the activation record one level higher, thus forming the chain).
end record;
package Subps is new Table.Table (
Table_Component_Type => Subp_Entry,
Table_Index_Type => SI_Type,
Table_Low_Bound => 1,
Table_Initial => 1000,
Table_Increment => 200,
Table_Name => "Unnest_Subps");
-- Records the subprograms in the nest whose outer subprogram is Subp
-----------------
-- Subprograms --
-----------------
function Get_Level (Subp : Entity_Id; Sub : Entity_Id) return Nat;
-- Sub is either Subp itself, or a subprogram nested within Subp. This
-- function returns the level of nesting (Subp = 1, subprograms that
-- are immediately nested within Subp = 2, etc.).
function In_Synchronized_Unit (Subp : Entity_Id) return Boolean;
-- Predicate to identify subprograms declared in task and protected types.
-- These subprograms are called from outside the compilation and therefore
-- must be considered reachable (and cannot be eliminated) because we must
-- generate code for them.
function Subp_Index (Sub : Entity_Id) return SI_Type;
-- Given the entity for a subprogram, return corresponding Subp's index
procedure Unnest_Subprograms (N : Node_Id);
-- Called to unnest subprograms. If we are in unnest subprogram mode, this
-- is the call that traverses the tree N and locates all the library-level
-- subprograms with nested subprograms to process them.
end Exp_Unst;
|
reznikmm/matreshka | Ada | 25,226 | 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_Accept_Call_Actions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action
(AMF.UML.Accept_Call_Actions.UML_Accept_Call_Action_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action
(AMF.UML.Accept_Call_Actions.UML_Accept_Call_Action_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action
(Visitor,
AMF.UML.Accept_Call_Actions.UML_Accept_Call_Action_Access (Self),
Control);
end if;
end Visit_Element;
----------------------------
-- Get_Return_Information --
----------------------------
overriding function Get_Return_Information
(Self : not null access constant UML_Accept_Call_Action_Proxy)
return AMF.UML.Output_Pins.UML_Output_Pin_Access is
begin
return
AMF.UML.Output_Pins.UML_Output_Pin_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Return_Information
(Self.Element)));
end Get_Return_Information;
----------------------------
-- Set_Return_Information --
----------------------------
overriding procedure Set_Return_Information
(Self : not null access UML_Accept_Call_Action_Proxy;
To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Return_Information
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Return_Information;
-----------------------
-- Get_Is_Unmarshall --
-----------------------
overriding function Get_Is_Unmarshall
(Self : not null access constant UML_Accept_Call_Action_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Unmarshall
(Self.Element);
end Get_Is_Unmarshall;
-----------------------
-- Set_Is_Unmarshall --
-----------------------
overriding procedure Set_Is_Unmarshall
(Self : not null access UML_Accept_Call_Action_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Unmarshall
(Self.Element, To);
end Set_Is_Unmarshall;
----------------
-- Get_Result --
----------------
overriding function Get_Result
(Self : not null access constant UML_Accept_Call_Action_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_Result
(Self.Element)));
end Get_Result;
-----------------
-- Get_Trigger --
-----------------
overriding function Get_Trigger
(Self : not null access constant UML_Accept_Call_Action_Proxy)
return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger is
begin
return
AMF.UML.Triggers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Trigger
(Self.Element)));
end Get_Trigger;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Activity --
------------------
overriding function Get_Activity
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_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_In_Group --
------------------
overriding function Get_In_Group
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_Proxy.Context";
return Context (Self);
end Context;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_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_Accept_Call_Action_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Accept_Call_Actions;
|
AdaCore/libadalang | Ada | 662 | adb | procedure Testexp is
Cst_R : constant := 3.1415;
Cst_I : constant := 2;
type Floating_Point_Def is digits Cst_I range 0.0 .. 2.0 * Cst_R;
pragma Test_Statement;
type Floating_Point_Def_2 is digits Cst_I;
pragma Test_Statement;
type Ordinary_Fixed_Point_Def is delta Cst_R range 0.0 .. 2.0 * Cst_R;
pragma Test_Statement;
type Ordinary_Fixed_Point_Def_2 is delta Cst_R;
pragma Test_Statement;
type Decimal_Fixed_Point_Def is
delta Cst_R digits Cst_I range 0.0 .. 2.0 * Cst_R;
pragma Test_Statement;
type Decimal_Fixed_Point_Def_2 is delta Cst_R digits Cst_I;
pragma Test_Statement;
begin
null;
end Testexp;
|
docandrew/troodon | Ada | 75,322 | ads | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with xcb;
with bits_stdint_uintn_h;
with xproto;
with bits_stdint_intn_h;
with xcb_shape;
with xcb_render;
with System;
with Interfaces.C.Strings;
package xcb_xfixes is
CONST_XCB_XFIXES_MAJOR_VERSION : constant := 5; -- /usr/include/xcb/xfixes.h:24
CONST_XCB_XFIXES_MINOR_VERSION : constant := 0; -- /usr/include/xcb/xfixes.h:25
CONST_XCB_XFIXES_QUERY_VERSION : constant := 0; -- /usr/include/xcb/xfixes.h:37
CONST_XCB_XFIXES_CHANGE_SAVE_SET : constant := 1; -- /usr/include/xcb/xfixes.h:79
CONST_XCB_XFIXES_SELECTION_NOTIFY : constant := 0; -- /usr/include/xcb/xfixes.h:108
CONST_XCB_XFIXES_SELECT_SELECTION_INPUT : constant := 2; -- /usr/include/xcb/xfixes.h:126
CONST_XCB_XFIXES_CURSOR_NOTIFY : constant := 1; -- /usr/include/xcb/xfixes.h:149
CONST_XCB_XFIXES_SELECT_CURSOR_INPUT : constant := 3; -- /usr/include/xcb/xfixes.h:166
CONST_XCB_XFIXES_GET_CURSOR_IMAGE : constant := 4; -- /usr/include/xcb/xfixes.h:187
CONST_XCB_XFIXES_BAD_REGION : constant := 0; -- /usr/include/xcb/xfixes.h:228
CONST_XCB_XFIXES_CREATE_REGION : constant := 5; -- /usr/include/xcb/xfixes.h:244
CONST_XCB_XFIXES_CREATE_REGION_FROM_BITMAP : constant := 6; -- /usr/include/xcb/xfixes.h:257
CONST_XCB_XFIXES_CREATE_REGION_FROM_WINDOW : constant := 7; -- /usr/include/xcb/xfixes.h:271
CONST_XCB_XFIXES_CREATE_REGION_FROM_GC : constant := 8; -- /usr/include/xcb/xfixes.h:287
CONST_XCB_XFIXES_CREATE_REGION_FROM_PICTURE : constant := 9; -- /usr/include/xcb/xfixes.h:301
CONST_XCB_XFIXES_DESTROY_REGION : constant := 10; -- /usr/include/xcb/xfixes.h:315
CONST_XCB_XFIXES_SET_REGION : constant := 11; -- /usr/include/xcb/xfixes.h:328
CONST_XCB_XFIXES_COPY_REGION : constant := 12; -- /usr/include/xcb/xfixes.h:341
CONST_XCB_XFIXES_UNION_REGION : constant := 13; -- /usr/include/xcb/xfixes.h:355
CONST_XCB_XFIXES_INTERSECT_REGION : constant := 14; -- /usr/include/xcb/xfixes.h:370
CONST_XCB_XFIXES_SUBTRACT_REGION : constant := 15; -- /usr/include/xcb/xfixes.h:385
CONST_XCB_XFIXES_INVERT_REGION : constant := 16; -- /usr/include/xcb/xfixes.h:400
CONST_XCB_XFIXES_TRANSLATE_REGION : constant := 17; -- /usr/include/xcb/xfixes.h:415
CONST_XCB_XFIXES_REGION_EXTENTS : constant := 18; -- /usr/include/xcb/xfixes.h:430
CONST_XCB_XFIXES_FETCH_REGION : constant := 19; -- /usr/include/xcb/xfixes.h:451
CONST_XCB_XFIXES_SET_GC_CLIP_REGION : constant := 20; -- /usr/include/xcb/xfixes.h:476
CONST_XCB_XFIXES_SET_WINDOW_SHAPE_REGION : constant := 21; -- /usr/include/xcb/xfixes.h:492
CONST_XCB_XFIXES_SET_PICTURE_CLIP_REGION : constant := 22; -- /usr/include/xcb/xfixes.h:510
CONST_XCB_XFIXES_SET_CURSOR_NAME : constant := 23; -- /usr/include/xcb/xfixes.h:526
CONST_XCB_XFIXES_GET_CURSOR_NAME : constant := 24; -- /usr/include/xcb/xfixes.h:548
CONST_XCB_XFIXES_GET_CURSOR_IMAGE_AND_NAME : constant := 25; -- /usr/include/xcb/xfixes.h:581
CONST_XCB_XFIXES_CHANGE_CURSOR : constant := 26; -- /usr/include/xcb/xfixes.h:613
CONST_XCB_XFIXES_CHANGE_CURSOR_BY_NAME : constant := 27; -- /usr/include/xcb/xfixes.h:627
CONST_XCB_XFIXES_EXPAND_REGION : constant := 28; -- /usr/include/xcb/xfixes.h:642
CONST_XCB_XFIXES_IDE_CURSOR : constant := 29; -- /usr/include/xcb/xfixes.h:660
CONST_XCB_XFIXES_SHOW_CURSOR : constant := 30; -- /usr/include/xcb/xfixes.h:673
CONST_XCB_XFIXES_CREATE_POINTER_BARRIER : constant := 31; -- /usr/include/xcb/xfixes.h:704
CONST_XCB_XFIXES_DELETE_POINTER_BARRIER : constant := 32; -- /usr/include/xcb/xfixes.h:725
xcb_xfixes_id : aliased xcb.xcb_extension_t -- /usr/include/xcb/xfixes.h:27
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_id";
type xcb_xfixes_query_version_cookie_t is record
sequence : aliased unsigned; -- /usr/include/xcb/xfixes.h:33
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:32
type xcb_xfixes_query_version_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:43
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:44
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:45
client_major_version : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:46
client_minor_version : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:47
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:42
type xcb_xfixes_query_version_reply_t_array4353 is array (0 .. 15) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_query_version_reply_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:54
pad0 : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:55
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:56
length : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:57
major_version : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:58
minor_version : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:59
pad1 : aliased xcb_xfixes_query_version_reply_t_array4353; -- /usr/include/xcb/xfixes.h:60
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:53
type xcb_xfixes_save_set_mode_t is
(XCB_XFIXES_SAVE_SET_MODE_INSERT,
XCB_XFIXES_SAVE_SET_MODE_DELETE)
with Convention => C; -- /usr/include/xcb/xfixes.h:63
type xcb_xfixes_save_set_target_t is
(XCB_XFIXES_SAVE_SET_TARGET_NEAREST,
XCB_XFIXES_SAVE_SET_TARGET_ROOT)
with Convention => C; -- /usr/include/xcb/xfixes.h:68
type xcb_xfixes_save_set_mapping_t is
(XCB_XFIXES_SAVE_SET_MAPPING_MAP,
XCB_XFIXES_SAVE_SET_MAPPING_UNMAP)
with Convention => C; -- /usr/include/xcb/xfixes.h:73
type xcb_xfixes_change_save_set_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:85
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:86
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:87
mode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:88
target : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:89
map : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:90
pad0 : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:91
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:92
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:84
type xcb_xfixes_selection_event_t is
(XCB_XFIXES_SELECTION_EVENT_SET_SELECTION_OWNER,
XCB_XFIXES_SELECTION_EVENT_SELECTION_WINDOW_DESTROY,
XCB_XFIXES_SELECTION_EVENT_SELECTION_CLIENT_CLOSE)
with Convention => C; -- /usr/include/xcb/xfixes.h:95
subtype xcb_xfixes_selection_event_mask_t is unsigned;
XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER : constant unsigned := 1;
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY : constant unsigned := 2;
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE : constant unsigned := 4; -- /usr/include/xcb/xfixes.h:101
type xcb_xfixes_selection_notify_event_t_array2620 is array (0 .. 7) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_selection_notify_event_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:114
c_subtype : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:115
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:116
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:117
owner : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:118
selection : aliased xproto.xcb_atom_t; -- /usr/include/xcb/xfixes.h:119
timestamp : aliased xproto.xcb_timestamp_t; -- /usr/include/xcb/xfixes.h:120
selection_timestamp : aliased xproto.xcb_timestamp_t; -- /usr/include/xcb/xfixes.h:121
pad0 : aliased xcb_xfixes_selection_notify_event_t_array2620; -- /usr/include/xcb/xfixes.h:122
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:113
type xcb_xfixes_select_selection_input_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:132
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:133
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:134
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:135
selection : aliased xproto.xcb_atom_t; -- /usr/include/xcb/xfixes.h:136
event_mask : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:137
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:131
type xcb_xfixes_cursor_notify_t is
(XCB_XFIXES_CURSOR_NOTIFY_DISPLAY_CURSOR)
with Convention => C; -- /usr/include/xcb/xfixes.h:140
subtype xcb_xfixes_cursor_notify_mask_t is unsigned;
XCB_XFIXES_CURSOR_NOTIFY_MASK_DISPLAY_CURSOR : constant unsigned := 1; -- /usr/include/xcb/xfixes.h:144
type xcb_xfixes_cursor_notify_event_t_array2180 is array (0 .. 11) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_cursor_notify_event_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:155
c_subtype : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:156
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:157
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:158
cursor_serial : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:159
timestamp : aliased xproto.xcb_timestamp_t; -- /usr/include/xcb/xfixes.h:160
name : aliased xproto.xcb_atom_t; -- /usr/include/xcb/xfixes.h:161
pad0 : aliased xcb_xfixes_cursor_notify_event_t_array2180; -- /usr/include/xcb/xfixes.h:162
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:154
type xcb_xfixes_select_cursor_input_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:172
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:173
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:174
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:175
event_mask : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:176
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:171
type xcb_xfixes_get_cursor_image_cookie_t is record
sequence : aliased unsigned; -- /usr/include/xcb/xfixes.h:183
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:182
type xcb_xfixes_get_cursor_image_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:193
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:194
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:195
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:192
type xcb_xfixes_get_cursor_image_reply_t_array2620 is array (0 .. 7) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_get_cursor_image_reply_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:202
pad0 : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:203
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:204
length : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:205
x : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:206
y : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:207
width : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:208
height : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:209
xhot : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:210
yhot : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:211
cursor_serial : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:212
pad1 : aliased xcb_xfixes_get_cursor_image_reply_t_array2620; -- /usr/include/xcb/xfixes.h:213
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:201
subtype xcb_xfixes_region_t is bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:216
type xcb_xfixes_region_iterator_t is record
data : access xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:222
c_rem : aliased int; -- /usr/include/xcb/xfixes.h:223
index : aliased int; -- /usr/include/xcb/xfixes.h:224
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:221
type xcb_xfixes_bad_region_error_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:234
error_code : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:235
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:236
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:233
type xcb_xfixes_region_enum_t is
(XCB_XFIXES_REGION_NONE)
with Convention => C; -- /usr/include/xcb/xfixes.h:239
type xcb_xfixes_create_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:250
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:251
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:252
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:253
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:249
type xcb_xfixes_create_region_from_bitmap_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:263
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:264
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:265
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:266
bitmap : aliased xproto.xcb_pixmap_t; -- /usr/include/xcb/xfixes.h:267
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:262
type xcb_xfixes_create_region_from_window_request_t_array1897 is array (0 .. 2) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_create_region_from_window_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:277
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:278
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:279
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:280
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:281
kind : aliased xcb_shape.xcb_shape_kind_t; -- /usr/include/xcb/xfixes.h:282
pad0 : aliased xcb_xfixes_create_region_from_window_request_t_array1897; -- /usr/include/xcb/xfixes.h:283
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:276
type xcb_xfixes_create_region_from_gc_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:293
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:294
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:295
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:296
gc : aliased xproto.xcb_gcontext_t; -- /usr/include/xcb/xfixes.h:297
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:292
type xcb_xfixes_create_region_from_picture_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:307
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:308
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:309
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:310
picture : aliased xcb_render.xcb_render_picture_t; -- /usr/include/xcb/xfixes.h:311
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:306
type xcb_xfixes_destroy_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:321
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:322
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:323
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:324
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:320
type xcb_xfixes_set_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:334
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:335
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:336
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:337
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:333
type xcb_xfixes_copy_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:347
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:348
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:349
source : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:350
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:351
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:346
type xcb_xfixes_union_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:361
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:362
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:363
source1 : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:364
source2 : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:365
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:366
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:360
type xcb_xfixes_intersect_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:376
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:377
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:378
source1 : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:379
source2 : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:380
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:381
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:375
type xcb_xfixes_subtract_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:391
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:392
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:393
source1 : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:394
source2 : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:395
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:396
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:390
type xcb_xfixes_invert_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:406
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:407
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:408
source : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:409
bounds : aliased xproto.xcb_rectangle_t; -- /usr/include/xcb/xfixes.h:410
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:411
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:405
type xcb_xfixes_translate_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:421
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:422
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:423
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:424
dx : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:425
dy : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:426
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:420
type xcb_xfixes_region_extents_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:436
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:437
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:438
source : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:439
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:440
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:435
type xcb_xfixes_fetch_region_cookie_t is record
sequence : aliased unsigned; -- /usr/include/xcb/xfixes.h:447
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:446
type xcb_xfixes_fetch_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:457
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:458
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:459
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:460
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:456
type xcb_xfixes_fetch_region_reply_t_array4353 is array (0 .. 15) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_fetch_region_reply_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:467
pad0 : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:468
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:469
length : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:470
extents : aliased xproto.xcb_rectangle_t; -- /usr/include/xcb/xfixes.h:471
pad1 : aliased xcb_xfixes_fetch_region_reply_t_array4353; -- /usr/include/xcb/xfixes.h:472
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:466
type xcb_xfixes_set_gc_clip_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:482
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:483
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:484
gc : aliased xproto.xcb_gcontext_t; -- /usr/include/xcb/xfixes.h:485
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:486
x_origin : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:487
y_origin : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:488
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:481
type xcb_xfixes_set_window_shape_region_request_t_array1897 is array (0 .. 2) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_set_window_shape_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:498
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:499
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:500
dest : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:501
dest_kind : aliased xcb_shape.xcb_shape_kind_t; -- /usr/include/xcb/xfixes.h:502
pad0 : aliased xcb_xfixes_set_window_shape_region_request_t_array1897; -- /usr/include/xcb/xfixes.h:503
x_offset : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:504
y_offset : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:505
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:506
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:497
type xcb_xfixes_set_picture_clip_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:516
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:517
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:518
picture : aliased xcb_render.xcb_render_picture_t; -- /usr/include/xcb/xfixes.h:519
region : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:520
x_origin : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:521
y_origin : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:522
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:515
type xcb_xfixes_set_cursor_name_request_t_array1823 is array (0 .. 1) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_set_cursor_name_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:532
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:533
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:534
cursor : aliased xproto.xcb_cursor_t; -- /usr/include/xcb/xfixes.h:535
nbytes : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:536
pad0 : aliased xcb_xfixes_set_cursor_name_request_t_array1823; -- /usr/include/xcb/xfixes.h:537
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:531
type xcb_xfixes_get_cursor_name_cookie_t is record
sequence : aliased unsigned; -- /usr/include/xcb/xfixes.h:544
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:543
type xcb_xfixes_get_cursor_name_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:554
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:555
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:556
cursor : aliased xproto.xcb_cursor_t; -- /usr/include/xcb/xfixes.h:557
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:553
type xcb_xfixes_get_cursor_name_reply_t_array2771 is array (0 .. 17) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_get_cursor_name_reply_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:564
pad0 : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:565
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:566
length : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:567
atom : aliased xproto.xcb_atom_t; -- /usr/include/xcb/xfixes.h:568
nbytes : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:569
pad1 : aliased xcb_xfixes_get_cursor_name_reply_t_array2771; -- /usr/include/xcb/xfixes.h:570
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:563
type xcb_xfixes_get_cursor_image_and_name_cookie_t is record
sequence : aliased unsigned; -- /usr/include/xcb/xfixes.h:577
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:576
type xcb_xfixes_get_cursor_image_and_name_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:587
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:588
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:589
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:586
type xcb_xfixes_get_cursor_image_and_name_reply_t_array1823 is array (0 .. 1) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_get_cursor_image_and_name_reply_t is record
response_type : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:596
pad0 : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:597
sequence : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:598
length : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:599
x : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:600
y : aliased bits_stdint_intn_h.int16_t; -- /usr/include/xcb/xfixes.h:601
width : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:602
height : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:603
xhot : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:604
yhot : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:605
cursor_serial : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:606
cursor_atom : aliased xproto.xcb_atom_t; -- /usr/include/xcb/xfixes.h:607
nbytes : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:608
pad1 : aliased xcb_xfixes_get_cursor_image_and_name_reply_t_array1823; -- /usr/include/xcb/xfixes.h:609
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:595
type xcb_xfixes_change_cursor_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:619
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:620
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:621
source : aliased xproto.xcb_cursor_t; -- /usr/include/xcb/xfixes.h:622
destination : aliased xproto.xcb_cursor_t; -- /usr/include/xcb/xfixes.h:623
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:618
type xcb_xfixes_change_cursor_by_name_request_t_array1823 is array (0 .. 1) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_change_cursor_by_name_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:633
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:634
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:635
src : aliased xproto.xcb_cursor_t; -- /usr/include/xcb/xfixes.h:636
nbytes : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:637
pad0 : aliased xcb_xfixes_change_cursor_by_name_request_t_array1823; -- /usr/include/xcb/xfixes.h:638
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:632
type xcb_xfixes_expand_region_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:648
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:649
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:650
source : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:651
destination : aliased xcb_xfixes_region_t; -- /usr/include/xcb/xfixes.h:652
left : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:653
right : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:654
top : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:655
bottom : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:656
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:647
type xcb_xfixeside_cursor_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:666
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:667
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:668
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:669
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:665
type xcb_xfixes_show_cursor_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:679
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:680
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:681
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:682
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:678
subtype xcb_xfixes_barrier_t is bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:685
type xcb_xfixes_barrier_iterator_t is record
data : access xcb_xfixes_barrier_t; -- /usr/include/xcb/xfixes.h:691
c_rem : aliased int; -- /usr/include/xcb/xfixes.h:692
index : aliased int; -- /usr/include/xcb/xfixes.h:693
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:690
subtype xcb_xfixes_barrier_directions_t is unsigned;
XCB_XFIXES_BARRIER_DIRECTIONS_POSITIVE_X : constant unsigned := 1;
XCB_XFIXES_BARRIER_DIRECTIONS_POSITIVE_Y : constant unsigned := 2;
XCB_XFIXES_BARRIER_DIRECTIONS_NEGATIVE_X : constant unsigned := 4;
XCB_XFIXES_BARRIER_DIRECTIONS_NEGATIVE_Y : constant unsigned := 8; -- /usr/include/xcb/xfixes.h:696
type xcb_xfixes_create_pointer_barrier_request_t_array1823 is array (0 .. 1) of aliased bits_stdint_uintn_h.uint8_t;
type xcb_xfixes_create_pointer_barrier_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:710
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:711
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:712
barrier : aliased xcb_xfixes_barrier_t; -- /usr/include/xcb/xfixes.h:713
window : aliased xproto.xcb_window_t; -- /usr/include/xcb/xfixes.h:714
x1 : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:715
y1 : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:716
x2 : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:717
y2 : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:718
directions : aliased bits_stdint_uintn_h.uint32_t; -- /usr/include/xcb/xfixes.h:719
pad0 : aliased xcb_xfixes_create_pointer_barrier_request_t_array1823; -- /usr/include/xcb/xfixes.h:720
num_devices : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:721
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:709
type xcb_xfixes_delete_pointer_barrier_request_t is record
major_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:731
minor_opcode : aliased bits_stdint_uintn_h.uint8_t; -- /usr/include/xcb/xfixes.h:732
length : aliased bits_stdint_uintn_h.uint16_t; -- /usr/include/xcb/xfixes.h:733
barrier : aliased xcb_xfixes_barrier_t; -- /usr/include/xcb/xfixes.h:734
end record
with Convention => C_Pass_By_Copy; -- /usr/include/xcb/xfixes.h:730
function xcb_xfixes_query_version
(c : access xcb.xcb_connection_t;
client_major_version : bits_stdint_uintn_h.uint32_t;
client_minor_version : bits_stdint_uintn_h.uint32_t) return xcb_xfixes_query_version_cookie_t -- /usr/include/xcb/xfixes.h:746
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_query_version";
function xcb_xfixes_query_version_unchecked
(c : access xcb.xcb_connection_t;
client_major_version : bits_stdint_uintn_h.uint32_t;
client_minor_version : bits_stdint_uintn_h.uint32_t) return xcb_xfixes_query_version_cookie_t -- /usr/include/xcb/xfixes.h:762
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_query_version_unchecked";
function xcb_xfixes_query_version_reply
(c : access xcb.xcb_connection_t;
cookie : xcb_xfixes_query_version_cookie_t;
e : System.Address) return access xcb_xfixes_query_version_reply_t -- /usr/include/xcb/xfixes.h:781
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_query_version_reply";
function xcb_xfixes_change_save_set_checked
(c : access xcb.xcb_connection_t;
mode : bits_stdint_uintn_h.uint8_t;
target : bits_stdint_uintn_h.uint8_t;
map : bits_stdint_uintn_h.uint8_t;
window : xproto.xcb_window_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:797
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_save_set_checked";
function xcb_xfixes_change_save_set
(c : access xcb.xcb_connection_t;
mode : bits_stdint_uintn_h.uint8_t;
target : bits_stdint_uintn_h.uint8_t;
map : bits_stdint_uintn_h.uint8_t;
window : xproto.xcb_window_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:812
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_save_set";
function xcb_xfixes_select_selection_input_checked
(c : access xcb.xcb_connection_t;
window : xproto.xcb_window_t;
selection : xproto.xcb_atom_t;
event_mask : bits_stdint_uintn_h.uint32_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:830
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_select_selection_input_checked";
function xcb_xfixes_select_selection_input
(c : access xcb.xcb_connection_t;
window : xproto.xcb_window_t;
selection : xproto.xcb_atom_t;
event_mask : bits_stdint_uintn_h.uint32_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:844
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_select_selection_input";
function xcb_xfixes_select_cursor_input_checked
(c : access xcb.xcb_connection_t;
window : xproto.xcb_window_t;
event_mask : bits_stdint_uintn_h.uint32_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:861
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_select_cursor_input_checked";
function xcb_xfixes_select_cursor_input
(c : access xcb.xcb_connection_t;
window : xproto.xcb_window_t;
event_mask : bits_stdint_uintn_h.uint32_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:874
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_select_cursor_input";
function xcb_xfixes_get_cursor_image_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:879
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_sizeof";
function xcb_xfixes_get_cursor_image (c : access xcb.xcb_connection_t) return xcb_xfixes_get_cursor_image_cookie_t -- /usr/include/xcb/xfixes.h:890
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image";
function xcb_xfixes_get_cursor_image_unchecked (c : access xcb.xcb_connection_t) return xcb_xfixes_get_cursor_image_cookie_t -- /usr/include/xcb/xfixes.h:904
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_unchecked";
function xcb_xfixes_get_cursor_image_cursor_image (R : access constant xcb_xfixes_get_cursor_image_reply_t) return access bits_stdint_uintn_h.uint32_t -- /usr/include/xcb/xfixes.h:907
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_cursor_image";
function xcb_xfixes_get_cursor_image_cursor_image_length (R : access constant xcb_xfixes_get_cursor_image_reply_t) return int -- /usr/include/xcb/xfixes.h:910
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_cursor_image_length";
function xcb_xfixes_get_cursor_image_cursor_image_end (R : access constant xcb_xfixes_get_cursor_image_reply_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:913
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_cursor_image_end";
function xcb_xfixes_get_cursor_image_reply
(c : access xcb.xcb_connection_t;
cookie : xcb_xfixes_get_cursor_image_cookie_t;
e : System.Address) return access xcb_xfixes_get_cursor_image_reply_t -- /usr/include/xcb/xfixes.h:930
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_reply";
procedure xcb_xfixes_region_next (i : access xcb_xfixes_region_iterator_t) -- /usr/include/xcb/xfixes.h:943
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_region_next";
function xcb_xfixes_region_end (i : xcb_xfixes_region_iterator_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:955
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_region_end";
function xcb_xfixes_create_region_sizeof (u_buffer : System.Address; rectangles_len : bits_stdint_uintn_h.uint32_t) return int -- /usr/include/xcb/xfixes.h:958
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_sizeof";
function xcb_xfixes_create_region_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
rectangles_len : bits_stdint_uintn_h.uint32_t;
rectangles : access constant xproto.xcb_rectangle_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:973
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_checked";
function xcb_xfixes_create_region
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
rectangles_len : bits_stdint_uintn_h.uint32_t;
rectangles : access constant xproto.xcb_rectangle_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:987
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region";
function xcb_xfixes_create_region_rectangles (R : access constant xcb_xfixes_create_region_request_t) return access xproto.xcb_rectangle_t -- /usr/include/xcb/xfixes.h:993
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_rectangles";
function xcb_xfixes_create_region_rectangles_length (R : access constant xcb_xfixes_create_region_request_t) return int -- /usr/include/xcb/xfixes.h:996
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_rectangles_length";
function xcb_xfixes_create_region_rectangles_iterator (R : access constant xcb_xfixes_create_region_request_t) return xproto.xcb_rectangle_iterator_t -- /usr/include/xcb/xfixes.h:999
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_rectangles_iterator";
function xcb_xfixes_create_region_from_bitmap_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
bitmap : xproto.xcb_pixmap_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1013
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_bitmap_checked";
function xcb_xfixes_create_region_from_bitmap
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
bitmap : xproto.xcb_pixmap_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1026
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_bitmap";
function xcb_xfixes_create_region_from_window_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
window : xproto.xcb_window_t;
kind : xcb_shape.xcb_shape_kind_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1042
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_window_checked";
function xcb_xfixes_create_region_from_window
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
window : xproto.xcb_window_t;
kind : xcb_shape.xcb_shape_kind_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1056
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_window";
function xcb_xfixes_create_region_from_gc_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
gc : xproto.xcb_gcontext_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1073
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_gc_checked";
function xcb_xfixes_create_region_from_gc
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
gc : xproto.xcb_gcontext_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1086
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_gc";
function xcb_xfixes_create_region_from_picture_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
picture : xcb_render.xcb_render_picture_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1102
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_picture_checked";
function xcb_xfixes_create_region_from_picture
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
picture : xcb_render.xcb_render_picture_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1115
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_region_from_picture";
function xcb_xfixes_destroy_region_checked (c : access xcb.xcb_connection_t; region : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1131
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_destroy_region_checked";
function xcb_xfixes_destroy_region (c : access xcb.xcb_connection_t; region : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1143
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_destroy_region";
function xcb_xfixes_set_region_sizeof (u_buffer : System.Address; rectangles_len : bits_stdint_uintn_h.uint32_t) return int -- /usr/include/xcb/xfixes.h:1147
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_region_sizeof";
function xcb_xfixes_set_region_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
rectangles_len : bits_stdint_uintn_h.uint32_t;
rectangles : access constant xproto.xcb_rectangle_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1162
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_region_checked";
function xcb_xfixes_set_region
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
rectangles_len : bits_stdint_uintn_h.uint32_t;
rectangles : access constant xproto.xcb_rectangle_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1176
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_region";
function xcb_xfixes_set_region_rectangles (R : access constant xcb_xfixes_set_region_request_t) return access xproto.xcb_rectangle_t -- /usr/include/xcb/xfixes.h:1182
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_region_rectangles";
function xcb_xfixes_set_region_rectangles_length (R : access constant xcb_xfixes_set_region_request_t) return int -- /usr/include/xcb/xfixes.h:1185
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_region_rectangles_length";
function xcb_xfixes_set_region_rectangles_iterator (R : access constant xcb_xfixes_set_region_request_t) return xproto.xcb_rectangle_iterator_t -- /usr/include/xcb/xfixes.h:1188
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_region_rectangles_iterator";
function xcb_xfixes_copy_region_checked
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1202
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_copy_region_checked";
function xcb_xfixes_copy_region
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1215
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_copy_region";
function xcb_xfixes_union_region_checked
(c : access xcb.xcb_connection_t;
source1 : xcb_xfixes_region_t;
source2 : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1231
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_union_region_checked";
function xcb_xfixes_union_region
(c : access xcb.xcb_connection_t;
source1 : xcb_xfixes_region_t;
source2 : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1245
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_union_region";
function xcb_xfixes_intersect_region_checked
(c : access xcb.xcb_connection_t;
source1 : xcb_xfixes_region_t;
source2 : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1262
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_intersect_region_checked";
function xcb_xfixes_intersect_region
(c : access xcb.xcb_connection_t;
source1 : xcb_xfixes_region_t;
source2 : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1276
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_intersect_region";
function xcb_xfixes_subtract_region_checked
(c : access xcb.xcb_connection_t;
source1 : xcb_xfixes_region_t;
source2 : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1293
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_subtract_region_checked";
function xcb_xfixes_subtract_region
(c : access xcb.xcb_connection_t;
source1 : xcb_xfixes_region_t;
source2 : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1307
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_subtract_region";
function xcb_xfixes_invert_region_checked
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
bounds : xproto.xcb_rectangle_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1324
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_invert_region_checked";
function xcb_xfixes_invert_region
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
bounds : xproto.xcb_rectangle_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1338
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_invert_region";
function xcb_xfixes_translate_region_checked
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
dx : bits_stdint_intn_h.int16_t;
dy : bits_stdint_intn_h.int16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1355
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_translate_region_checked";
function xcb_xfixes_translate_region
(c : access xcb.xcb_connection_t;
region : xcb_xfixes_region_t;
dx : bits_stdint_intn_h.int16_t;
dy : bits_stdint_intn_h.int16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1369
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_translate_region";
function xcb_xfixes_region_extents_checked
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1386
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_region_extents_checked";
function xcb_xfixes_region_extents
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1399
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_region_extents";
function xcb_xfixes_fetch_region_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:1404
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region_sizeof";
function xcb_xfixes_fetch_region (c : access xcb.xcb_connection_t; region : xcb_xfixes_region_t) return xcb_xfixes_fetch_region_cookie_t -- /usr/include/xcb/xfixes.h:1415
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region";
function xcb_xfixes_fetch_region_unchecked (c : access xcb.xcb_connection_t; region : xcb_xfixes_region_t) return xcb_xfixes_fetch_region_cookie_t -- /usr/include/xcb/xfixes.h:1430
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region_unchecked";
function xcb_xfixes_fetch_region_rectangles (R : access constant xcb_xfixes_fetch_region_reply_t) return access xproto.xcb_rectangle_t -- /usr/include/xcb/xfixes.h:1434
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region_rectangles";
function xcb_xfixes_fetch_region_rectangles_length (R : access constant xcb_xfixes_fetch_region_reply_t) return int -- /usr/include/xcb/xfixes.h:1437
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region_rectangles_length";
function xcb_xfixes_fetch_region_rectangles_iterator (R : access constant xcb_xfixes_fetch_region_reply_t) return xproto.xcb_rectangle_iterator_t -- /usr/include/xcb/xfixes.h:1440
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region_rectangles_iterator";
function xcb_xfixes_fetch_region_reply
(c : access xcb.xcb_connection_t;
cookie : xcb_xfixes_fetch_region_cookie_t;
e : System.Address) return access xcb_xfixes_fetch_region_reply_t -- /usr/include/xcb/xfixes.h:1457
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_fetch_region_reply";
function xcb_xfixes_set_gc_clip_region_checked
(c : access xcb.xcb_connection_t;
gc : xproto.xcb_gcontext_t;
region : xcb_xfixes_region_t;
x_origin : bits_stdint_intn_h.int16_t;
y_origin : bits_stdint_intn_h.int16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1473
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_gc_clip_region_checked";
function xcb_xfixes_set_gc_clip_region
(c : access xcb.xcb_connection_t;
gc : xproto.xcb_gcontext_t;
region : xcb_xfixes_region_t;
x_origin : bits_stdint_intn_h.int16_t;
y_origin : bits_stdint_intn_h.int16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1488
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_gc_clip_region";
function xcb_xfixes_set_window_shape_region_checked
(c : access xcb.xcb_connection_t;
dest : xproto.xcb_window_t;
dest_kind : xcb_shape.xcb_shape_kind_t;
x_offset : bits_stdint_intn_h.int16_t;
y_offset : bits_stdint_intn_h.int16_t;
region : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1506
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_window_shape_region_checked";
function xcb_xfixes_set_window_shape_region
(c : access xcb.xcb_connection_t;
dest : xproto.xcb_window_t;
dest_kind : xcb_shape.xcb_shape_kind_t;
x_offset : bits_stdint_intn_h.int16_t;
y_offset : bits_stdint_intn_h.int16_t;
region : xcb_xfixes_region_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1522
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_window_shape_region";
function xcb_xfixes_set_picture_clip_region_checked
(c : access xcb.xcb_connection_t;
picture : xcb_render.xcb_render_picture_t;
region : xcb_xfixes_region_t;
x_origin : bits_stdint_intn_h.int16_t;
y_origin : bits_stdint_intn_h.int16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1541
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_picture_clip_region_checked";
function xcb_xfixes_set_picture_clip_region
(c : access xcb.xcb_connection_t;
picture : xcb_render.xcb_render_picture_t;
region : xcb_xfixes_region_t;
x_origin : bits_stdint_intn_h.int16_t;
y_origin : bits_stdint_intn_h.int16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1556
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_picture_clip_region";
function xcb_xfixes_set_cursor_name_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:1563
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_cursor_name_sizeof";
function xcb_xfixes_set_cursor_name_checked
(c : access xcb.xcb_connection_t;
cursor : xproto.xcb_cursor_t;
nbytes : bits_stdint_uintn_h.uint16_t;
name : Interfaces.C.Strings.chars_ptr) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1577
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_cursor_name_checked";
function xcb_xfixes_set_cursor_name
(c : access xcb.xcb_connection_t;
cursor : xproto.xcb_cursor_t;
nbytes : bits_stdint_uintn_h.uint16_t;
name : Interfaces.C.Strings.chars_ptr) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1591
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_cursor_name";
function xcb_xfixes_set_cursor_name_name (R : access constant xcb_xfixes_set_cursor_name_request_t) return Interfaces.C.Strings.chars_ptr -- /usr/include/xcb/xfixes.h:1597
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_cursor_name_name";
function xcb_xfixes_set_cursor_name_name_length (R : access constant xcb_xfixes_set_cursor_name_request_t) return int -- /usr/include/xcb/xfixes.h:1600
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_cursor_name_name_length";
function xcb_xfixes_set_cursor_name_name_end (R : access constant xcb_xfixes_set_cursor_name_request_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1603
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_set_cursor_name_name_end";
function xcb_xfixes_get_cursor_name_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:1606
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name_sizeof";
function xcb_xfixes_get_cursor_name (c : access xcb.xcb_connection_t; cursor : xproto.xcb_cursor_t) return xcb_xfixes_get_cursor_name_cookie_t -- /usr/include/xcb/xfixes.h:1617
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name";
function xcb_xfixes_get_cursor_name_unchecked (c : access xcb.xcb_connection_t; cursor : xproto.xcb_cursor_t) return xcb_xfixes_get_cursor_name_cookie_t -- /usr/include/xcb/xfixes.h:1632
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name_unchecked";
function xcb_xfixes_get_cursor_name_name (R : access constant xcb_xfixes_get_cursor_name_reply_t) return Interfaces.C.Strings.chars_ptr -- /usr/include/xcb/xfixes.h:1636
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name_name";
function xcb_xfixes_get_cursor_name_name_length (R : access constant xcb_xfixes_get_cursor_name_reply_t) return int -- /usr/include/xcb/xfixes.h:1639
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name_name_length";
function xcb_xfixes_get_cursor_name_name_end (R : access constant xcb_xfixes_get_cursor_name_reply_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1642
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name_name_end";
function xcb_xfixes_get_cursor_name_reply
(c : access xcb.xcb_connection_t;
cookie : xcb_xfixes_get_cursor_name_cookie_t;
e : System.Address) return access xcb_xfixes_get_cursor_name_reply_t -- /usr/include/xcb/xfixes.h:1659
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_name_reply";
function xcb_xfixes_get_cursor_image_and_name_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:1664
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_sizeof";
function xcb_xfixes_get_cursor_image_and_name (c : access xcb.xcb_connection_t) return xcb_xfixes_get_cursor_image_and_name_cookie_t -- /usr/include/xcb/xfixes.h:1675
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name";
function xcb_xfixes_get_cursor_image_and_name_unchecked (c : access xcb.xcb_connection_t) return xcb_xfixes_get_cursor_image_and_name_cookie_t -- /usr/include/xcb/xfixes.h:1689
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_unchecked";
function xcb_xfixes_get_cursor_image_and_name_cursor_image (R : access constant xcb_xfixes_get_cursor_image_and_name_reply_t) return access bits_stdint_uintn_h.uint32_t -- /usr/include/xcb/xfixes.h:1692
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_cursor_image";
function xcb_xfixes_get_cursor_image_and_name_cursor_image_length (R : access constant xcb_xfixes_get_cursor_image_and_name_reply_t) return int -- /usr/include/xcb/xfixes.h:1695
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_cursor_image_length";
function xcb_xfixes_get_cursor_image_and_name_cursor_image_end (R : access constant xcb_xfixes_get_cursor_image_and_name_reply_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1698
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_cursor_image_end";
function xcb_xfixes_get_cursor_image_and_name_name (R : access constant xcb_xfixes_get_cursor_image_and_name_reply_t) return Interfaces.C.Strings.chars_ptr -- /usr/include/xcb/xfixes.h:1701
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_name";
function xcb_xfixes_get_cursor_image_and_name_name_length (R : access constant xcb_xfixes_get_cursor_image_and_name_reply_t) return int -- /usr/include/xcb/xfixes.h:1704
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_name_length";
function xcb_xfixes_get_cursor_image_and_name_name_end (R : access constant xcb_xfixes_get_cursor_image_and_name_reply_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1707
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_name_end";
function xcb_xfixes_get_cursor_image_and_name_reply
(c : access xcb.xcb_connection_t;
cookie : xcb_xfixes_get_cursor_image_and_name_cookie_t;
e : System.Address) return access xcb_xfixes_get_cursor_image_and_name_reply_t -- /usr/include/xcb/xfixes.h:1724
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_get_cursor_image_and_name_reply";
function xcb_xfixes_change_cursor_checked
(c : access xcb.xcb_connection_t;
source : xproto.xcb_cursor_t;
destination : xproto.xcb_cursor_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1740
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_checked";
function xcb_xfixes_change_cursor
(c : access xcb.xcb_connection_t;
source : xproto.xcb_cursor_t;
destination : xproto.xcb_cursor_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1753
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor";
function xcb_xfixes_change_cursor_by_name_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:1758
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_by_name_sizeof";
function xcb_xfixes_change_cursor_by_name_checked
(c : access xcb.xcb_connection_t;
src : xproto.xcb_cursor_t;
nbytes : bits_stdint_uintn_h.uint16_t;
name : Interfaces.C.Strings.chars_ptr) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1772
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_by_name_checked";
function xcb_xfixes_change_cursor_by_name
(c : access xcb.xcb_connection_t;
src : xproto.xcb_cursor_t;
nbytes : bits_stdint_uintn_h.uint16_t;
name : Interfaces.C.Strings.chars_ptr) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1786
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_by_name";
function xcb_xfixes_change_cursor_by_name_name (R : access constant xcb_xfixes_change_cursor_by_name_request_t) return Interfaces.C.Strings.chars_ptr -- /usr/include/xcb/xfixes.h:1792
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_by_name_name";
function xcb_xfixes_change_cursor_by_name_name_length (R : access constant xcb_xfixes_change_cursor_by_name_request_t) return int -- /usr/include/xcb/xfixes.h:1795
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_by_name_name_length";
function xcb_xfixes_change_cursor_by_name_name_end (R : access constant xcb_xfixes_change_cursor_by_name_request_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1798
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_change_cursor_by_name_name_end";
function xcb_xfixes_expand_region_checked
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t;
left : bits_stdint_uintn_h.uint16_t;
right : bits_stdint_uintn_h.uint16_t;
top : bits_stdint_uintn_h.uint16_t;
bottom : bits_stdint_uintn_h.uint16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1812
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_expand_region_checked";
function xcb_xfixes_expand_region
(c : access xcb.xcb_connection_t;
source : xcb_xfixes_region_t;
destination : xcb_xfixes_region_t;
left : bits_stdint_uintn_h.uint16_t;
right : bits_stdint_uintn_h.uint16_t;
top : bits_stdint_uintn_h.uint16_t;
bottom : bits_stdint_uintn_h.uint16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1829
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_expand_region";
function xcb_xfixeside_cursor_checked (c : access xcb.xcb_connection_t; window : xproto.xcb_window_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1849
with Import => True,
Convention => C,
External_Name => "xcb_xfixeside_cursor_checked";
function xcb_xfixeside_cursor (c : access xcb.xcb_connection_t; window : xproto.xcb_window_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1861
with Import => True,
Convention => C,
External_Name => "xcb_xfixeside_cursor";
function xcb_xfixes_show_cursor_checked (c : access xcb.xcb_connection_t; window : xproto.xcb_window_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1876
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_show_cursor_checked";
function xcb_xfixes_show_cursor (c : access xcb.xcb_connection_t; window : xproto.xcb_window_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1888
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_show_cursor";
procedure xcb_xfixes_barrier_next (i : access xcb_xfixes_barrier_iterator_t) -- /usr/include/xcb/xfixes.h:1900
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_barrier_next";
function xcb_xfixes_barrier_end (i : xcb_xfixes_barrier_iterator_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1912
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_barrier_end";
function xcb_xfixes_create_pointer_barrier_sizeof (u_buffer : System.Address) return int -- /usr/include/xcb/xfixes.h:1915
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_pointer_barrier_sizeof";
function xcb_xfixes_create_pointer_barrier_checked
(c : access xcb.xcb_connection_t;
barrier : xcb_xfixes_barrier_t;
window : xproto.xcb_window_t;
x1 : bits_stdint_uintn_h.uint16_t;
y1 : bits_stdint_uintn_h.uint16_t;
x2 : bits_stdint_uintn_h.uint16_t;
y2 : bits_stdint_uintn_h.uint16_t;
directions : bits_stdint_uintn_h.uint32_t;
num_devices : bits_stdint_uintn_h.uint16_t;
devices : access bits_stdint_uintn_h.uint16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1929
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_pointer_barrier_checked";
function xcb_xfixes_create_pointer_barrier
(c : access xcb.xcb_connection_t;
barrier : xcb_xfixes_barrier_t;
window : xproto.xcb_window_t;
x1 : bits_stdint_uintn_h.uint16_t;
y1 : bits_stdint_uintn_h.uint16_t;
x2 : bits_stdint_uintn_h.uint16_t;
y2 : bits_stdint_uintn_h.uint16_t;
directions : bits_stdint_uintn_h.uint32_t;
num_devices : bits_stdint_uintn_h.uint16_t;
devices : access bits_stdint_uintn_h.uint16_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1949
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_pointer_barrier";
function xcb_xfixes_create_pointer_barrier_devices (R : access constant xcb_xfixes_create_pointer_barrier_request_t) return access bits_stdint_uintn_h.uint16_t -- /usr/include/xcb/xfixes.h:1961
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_pointer_barrier_devices";
function xcb_xfixes_create_pointer_barrier_devices_length (R : access constant xcb_xfixes_create_pointer_barrier_request_t) return int -- /usr/include/xcb/xfixes.h:1964
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_pointer_barrier_devices_length";
function xcb_xfixes_create_pointer_barrier_devices_end (R : access constant xcb_xfixes_create_pointer_barrier_request_t) return xcb.xcb_generic_iterator_t -- /usr/include/xcb/xfixes.h:1967
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_create_pointer_barrier_devices_end";
function xcb_xfixes_delete_pointer_barrier_checked (c : access xcb.xcb_connection_t; barrier : xcb_xfixes_barrier_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1981
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_delete_pointer_barrier_checked";
function xcb_xfixes_delete_pointer_barrier (c : access xcb.xcb_connection_t; barrier : xcb_xfixes_barrier_t) return xcb.xcb_void_cookie_t -- /usr/include/xcb/xfixes.h:1993
with Import => True,
Convention => C,
External_Name => "xcb_xfixes_delete_pointer_barrier";
end xcb_xfixes;
|
AdaCore/training_material | Ada | 6,681 | adb | -----------------------------------------------------------------------
-- Ada Labs --
-- --
-- Copyright (C) 2008-2009, AdaCore --
-- --
-- Labs is free software; you can redistribute it and/or modify it --
-- under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or --
-- (at your option) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received --
-- a copy of the GNU General Public License along with this program; --
-- if not, write to the Free Software Foundation, Inc., 59 Temple --
-- Place - Suite 330, Boston, MA 02111-1307, USA. --
-----------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Libm_Single; use Libm_Single;
with Ada.Real_Time; use Ada.Real_Time;
with Display; use Display;
with Display.Basic; use Display.Basic;
procedure Main is
-- define type Bodies_Enum_T as an enumeration of Sun, Earth, Moon, Satellite
type Bodies_Enum_T is (Sun, Earth, Moon, Satellite);
-- define a type Body_T to store every information about a body
-- X, Y, Distance, Speed, Angle, Color, Radius
type Body_T is record
X : Float;
Y : Float;
Distance : Float;
Speed : Float;
Angle : Float;
Color : RGBA_T;
Radius : Float;
Turns_Around : Bodies_Enum_T;
end record;
-- define type Bodies_Array_T as an array of Body_Type_T indexed by bodies enumeration
type Bodies_Array_T is array (Bodies_Enum_T) of Body_T;
-- declare variable Bodies which is an array of Body_Type
Bodies : Bodies_Array_T;
-- declare a variable Next of type Time to store the Next step time
Next : Time;
-- declare a constant Period of 40 milliseconds of type Time_Span defining the loop period
Period : constant Time_Span := Milliseconds (40);
-- reference to the application window
Window : Window_ID;
-- reference to the graphical canvas associated with the application window
Canvas : Canvas_ID;
-- implement a function to compute the X coordinate
-- x of the reference + distance * cos(angle)
function Compute_X(Body_To_Move : Body_T; Turns_Around : Body_T) return Float;
-- implement a function to compute the Y coordinate
-- y of the reference + distance * sin(angle)
function Compute_Y(Body_To_Move : Body_T; Turns_Around : Body_T) return Float;
procedure Move (Body_To_Move : in out Body_T; Bodies : Bodies_Array_T);
-- procedure Draw_Body( taking 2 parameters of your choice.......
begin
-- Create the main window
Window := Create_Window(Width => 240,
Height => 320,
Name => "Solar System");
-- retrieve the graphical canvas associated with the main window
Canvas := Get_Canvas (Window);
-- initialize Bodies variable with parameters for each body using an aggregate
-- Sun Distance = 0.0, Angle = 0.0, Speed = 0.0, Radius = 20.0, Color = Yellow
-- Earth Distance = 50.0, Angle = 0.0, Speed = 0.02, Radius = 5.0, Color = Blue
-- Moon Distance = 15.0, Angle = 0.0, Speed = 0.04, Radius = 2.0, Color = White
-- Satellite Distance = 8.0, Angle = 0.0, Speed = 0.1, Radius = 1.0, Color = Red
Bodies := (Sun => (Distance => 0.0,
Speed => 0.0,
Radius => 20.0,
X => 0.0,
Y => 0.0,
Angle => 0.0,
Color => Yellow,
Turns_Around => Sun),
Earth => (Distance => 50.0,
Speed => 0.02,
Radius => 5.0,
X => 0.0,
Y => 0.0,
Angle => 0.0,
Color => Blue,
Turns_Around => Sun),
Moon => (Distance => 15.0,
Speed => 0.04,
Radius => 2.0,
X => 0.0,
Y => 0.0,
Angle => 0.0,
Color => White,
Turns_Around => Earth),
Satellite => (Distance => 8.0,
Speed => 0.1,
Radius => 1.0,
X => 0.0,
Y => 0.0,
Angle => 0.0,
Color => Red,
Turns_Around => Earth));
-- initialize the Next step time begin the current time (Clock) + the period
Next := Clock + Period;
while not Is_Killed loop
-- create a loop to update each body position and angles
-- the position of an object around (0,0) at distance d with an angle a
-- is (d*cos(a), d*sin(a))
-- update angle parameter of each body adding speed to the previous angle
for B in Earth .. Satellite loop
Bodies(B).X := Bodies(Bodies (B).Turns_Around).X
+ Bodies (B).Distance
* Cos (Bodies (B).Angle);
Bodies(B).Y := Bodies(Bodies(B).Turns_Around).Y
+ Bodies (B).Distance
* Sin (Bodies (B).Angle);
Bodies (B).Angle := Bodies (B).Angle +
Bodies (B).Speed;
end loop;
-- create a loop to draw every objects
-- use the Draw_Sphere procedure to do it
for B in Bodies_Enum_T loop
Draw_Sphere(Canvas => Canvas,
Position => (Bodies (B).X, Bodies (B).Y, 0.0),
Radius => Bodies (B).Radius,
Color => Bodies(B).Color);
end loop;
-- update the screen using procedure Swap_Buffers
Swap_Buffers(Window);
-- wait until Next
delay until Next;
-- update the Next time adding the period for the next step
Next := Next + Period;
end loop;
end Main;
|
stcarrez/ada-util | Ada | 3,019 | adb | -----------------------------------------------------------------------
-- Util.Concurrent -- Concurrent Counters
-- Copyright (C) 2009, 2010 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.
-----------------------------------------------------------------------
-- This implementation of atomic counters is the portable Ada05 implementation.
-- It uses a protected type to implement the increment/decrement operations,
-- thus providing the thread-safe capability.
package body Util.Concurrent.Counters is
function ONE return Counter is
begin
return C : Counter do
C.Value.Increment;
end return;
end ONE;
-- ------------------------------
-- Increment the counter atomically.
-- ------------------------------
procedure Increment (C : in out Counter) is
begin
C.Value.Increment;
end Increment;
-- ------------------------------
-- Increment the counter atomically and return the value before increment.
-- ------------------------------
procedure Increment (C : in out Counter;
Value : out Integer) is
begin
C.Value.Increment (Value);
end Increment;
-- ------------------------------
-- Decrement the counter atomically.
-- ------------------------------
procedure Decrement (C : in out Counter) is
Is_Zero : Boolean;
begin
C.Value.Decrement (Is_Zero);
end Decrement;
-- ------------------------------
-- Decrement the counter atomically and return a status.
-- ------------------------------
procedure Decrement (C : in out Counter;
Is_Zero : out Boolean) is
begin
C.Value.Decrement (Is_Zero);
end Decrement;
-- ------------------------------
-- Get the counter value
-- ------------------------------
function Value (C : in Counter) return Integer is
begin
return C.Value.Get;
end Value;
protected body Cnt is
procedure Increment is
begin
N := N + 1;
end Increment;
procedure Increment (Value : out Integer) is
begin
Value := N;
N := N + 1;
end Increment;
procedure Decrement (Is_Zero : out Boolean) is
begin
N := N - 1;
Is_Zero := N = 0;
end Decrement;
function Get return Natural is
begin
return N;
end Get;
end Cnt;
end Util.Concurrent.Counters;
|
wookey-project/ewok-legacy | Ada | 27 | ads | ../../stm32f439/Ada/soc.ads |
Fabien-Chouteau/tiled-code-gen | Ada | 5,259 | 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. --
-- --
------------------------------------------------------------------------------
with Interfaces;
package TCG.Palette is
subtype Component is Interfaces.Unsigned_8;
type ARGB_Color is record
A, R, G, B : Component;
end record;
type Color_Id is new Natural;
type Output_Color_Format is (ARGB, RGB565, RGB565_Swap, RGB555, RGB888);
function Add_Color (C : ARGB_Color) return Color_Id;
function Convert (Id : Color_Id) return ARGB_Color;
function In_Palette (C : ARGB_Color) return Boolean;
-- Return True is the given color is already definied in the palette
function Transparent_Defined return Boolean;
-- Return True is the the transparent collor is alreadty defined
function Transparent return Color_Id
with Pre => Transparent_Defined;
-- Return the color defined as transparent
function Transparent return ARGB_Color
with Pre => Transparent_Defined;
-- Return the color defined as transparent
procedure Set_Transparent (C : ARGB_Color)
with Pre => (not Transparent_Defined or else Transparent = C)
and then not In_Palette (C),
Post => Transparent_Defined and then Transparent = C;
-- Set the color that will be treated as transparent.
function Number_Of_Colors return Natural;
function First_Id return Color_Id;
-- Return the first valid Color_Id
function Last_Id return Color_Id;
-- Return the last valid Color_Id
function Image (Id : Color_Id) return String;
-- Return a string representing a color id (not the color itself)
function Image (C : ARGB_Color;
Format : Output_Color_Format)
return String;
-- Return a string representing the color using the given format
function Format_Supported (Fmt : String) return Boolean;
-- Return True if the Fmt string represent a supported color format
function Supported_Formats return String;
-- Return a String that contains the names of all supported color formats
function Convert (Fmt : String) return Output_Color_Format
with Pre => Format_Supported (Fmt);
-- Return the Output_Color_Format designated by the Fmt string
function To_ARGB (Str : String) return ARGB_Color
with Pre => Str'Length = 6;
-- Convert and 6 hexadecimal characters string to ARGB_Color
procedure Put;
private
function Image (C : ARGB_Color) return String;
function To_RGB565 (C : ARGB_Color) return Interfaces.Unsigned_16;
function To_RGB565_Swap (C : ARGB_Color) return Interfaces.Unsigned_16;
function To_RGB555 (C : ARGB_Color) return Interfaces.Unsigned_16;
function To_RGB888 (C : ARGB_Color) return Interfaces.Unsigned_32;
end TCG.Palette;
|
reznikmm/matreshka | Ada | 6,982 | 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_Number.Currency_Style_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Number_Currency_Style_Element_Node is
begin
return Self : Number_Currency_Style_Element_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Number_Currency_Style_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Number_Currency_Style
(ODF.DOM.Number_Currency_Style_Elements.ODF_Number_Currency_Style_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Number_Currency_Style_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Currency_Style_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Number_Currency_Style_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Number_Currency_Style
(ODF.DOM.Number_Currency_Style_Elements.ODF_Number_Currency_Style_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Number_Currency_Style_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) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Number_Currency_Style
(Visitor,
ODF.DOM.Number_Currency_Style_Elements.ODF_Number_Currency_Style_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Currency_Style_Element,
Number_Currency_Style_Element_Node'Tag);
end Matreshka.ODF_Number.Currency_Style_Elements;
|
reznikmm/matreshka | Ada | 18,577 | 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_Information_Flows is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Information_Flow_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_Information_Flow
(AMF.UML.Information_Flows.UML_Information_Flow_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Information_Flow_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_Information_Flow
(AMF.UML.Information_Flows.UML_Information_Flow_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Information_Flow_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_Information_Flow
(Visitor,
AMF.UML.Information_Flows.UML_Information_Flow_Access (Self),
Control);
end if;
end Visit_Element;
------------------
-- Get_Conveyed --
------------------
overriding function Get_Conveyed
(Self : not null access constant UML_Information_Flow_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_Conveyed
(Self.Element)));
end Get_Conveyed;
----------------------------
-- Get_Information_Source --
----------------------------
overriding function Get_Information_Source
(Self : not null access constant UML_Information_Flow_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_Information_Source
(Self.Element)));
end Get_Information_Source;
----------------------------
-- Get_Information_Target --
----------------------------
overriding function Get_Information_Target
(Self : not null access constant UML_Information_Flow_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_Information_Target
(Self.Element)));
end Get_Information_Target;
---------------------
-- Get_Realization --
---------------------
overriding function Get_Realization
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Relationships.Collections.Set_Of_UML_Relationship is
begin
return
AMF.UML.Relationships.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Realization
(Self.Element)));
end Get_Realization;
---------------------------------
-- Get_Realizing_Activity_Edge --
---------------------------------
overriding function Get_Realizing_Activity_Edge
(Self : not null access constant UML_Information_Flow_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_Realizing_Activity_Edge
(Self.Element)));
end Get_Realizing_Activity_Edge;
-----------------------------
-- Get_Realizing_Connector --
-----------------------------
overriding function Get_Realizing_Connector
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is
begin
return
AMF.UML.Connectors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Realizing_Connector
(Self.Element)));
end Get_Realizing_Connector;
---------------------------
-- Get_Realizing_Message --
---------------------------
overriding function Get_Realizing_Message
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Messages.Collections.Set_Of_UML_Message is
begin
return
AMF.UML.Messages.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Realizing_Message
(Self.Element)));
end Get_Realizing_Message;
----------------
-- Get_Source --
----------------
overriding function Get_Source
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Source
(Self.Element)));
end Get_Source;
----------------
-- Get_Target --
----------------
overriding function Get_Target
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Target
(Self.Element)));
end Get_Target;
-------------------------
-- Get_Related_Element --
-------------------------
overriding function Get_Related_Element
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Related_Element
(Self.Element)));
end Get_Related_Element;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Information_Flow_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_Information_Flow_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_Information_Flow_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_Information_Flow_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_Information_Flow_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_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Information_Flow_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Information_Flow_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Information_Flow_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Information_Flow_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_Information_Flow_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_Information_Flow_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_Information_Flow_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_Information_Flow_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_Information_Flow_Proxy.Namespace";
return Namespace (Self);
end Namespace;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Information_Flow_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Information_Flow_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Information_Flow_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Information_Flow_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
end AMF.Internals.UML_Information_Flows;
|
RajaSrinivasan/srctrace | Ada | 528 | ads | package revisions is
-- Ada spec generator
-- File: revisions.ads
BUILD_TIME : constant String := "Fri Nov 15 2019 18:23:05" ;
VERSION_MAJOR : constant := 0 ;
VERSION_MINOR : constant := 0 ;
VERSION_BUILD : constant := 999 ;
REPO_URL : constant String := "[email protected]:privatetutor/projectlets/go.git" ;
BRANCH_NAME : constant String := "master" ;
SHORT_COMMIT_ID : constant String := "ec60c09" ;
LONG_COMMIT_ID : constant String := "ec60c0924b215757ed2ba1edb2ff3cdd0aac84d3" ;
end revisions ;
|
marcello-s/AeonFlux | Ada | 1,936 | ads | -- Copyright (c) 2015-2019 Marcel Schneider
-- for details see License.txt
with Tokens; use Tokens;
with TokenValue; use TokenValue;
with Position; use Position;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Lexer_Base is
type Object is tagged private;
procedure OpenFile (O : in out Object;
File_Name : String);
function ReadToken (O : Object) return TokenValue.Object;
private
type Object is tagged record
Line : Natural;
Column : Natural;
StartLine : Natural;
StartColumns : Natural;
Last : Token;
NumberPunctuation : Unbounded_String := To_Unbounded_String (".-+abcdefx");
HexNumberPunctuation : Unbounded_String := To_Unbounded_String ("abcdef");
File_Name : Unbounded_String;
end record;
function ReadWhiteSpace return TokenValue.Object;
function ReadString return TokenValue.Object;
function ReadLineComment return TokenValue.Object;
function ReadBlockComment return TokenValue.Object;
function ReadRegEx return TokenValue.Object;
function ReadOperator return TokenValue.Object;
function ReadNumber return TokenValue.Object;
function IsPunctuationUsed (C : Character) return Boolean;
function SetNumberPunctuation (C : Character;
IsHexNumber : Boolean) return Boolean;
function ReadIdentifier return TokenValue.Object;
function IsName (C : Character) return Boolean;
function IsOperator (C : Character) return Boolean;
function IsDigit (C : Character) return Boolean;
function IsPunctuation (C : Character) return Boolean;
function Peek return Character;
function Advance return Character;
function CreateToken (TokenId : Token;
Literal : Unbounded_String;
Message : Unbounded_String) return TokenValue.Object;
function CreatePosition return Position.Object;
end Lexer_Base;
|
reznikmm/matreshka | Ada | 3,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.Elements;
package ODF.DOM.Text_Sequence_Ref_Elements is
pragma Preelaborate;
type ODF_Text_Sequence_Ref is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Text_Sequence_Ref_Access is
access all ODF_Text_Sequence_Ref'Class
with Storage_Size => 0;
end ODF.DOM.Text_Sequence_Ref_Elements;
|
guillaume-lin/tsc | Ada | 34,530 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Menus --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer, 1996
-- Version Control:
-- $Revision: 1.22 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Interfaces.C.Pointers;
with Ada.Unchecked_Conversion;
package body Terminal_Interface.Curses.Menus is
type C_Item_Array is array (Natural range <>) of aliased Item;
package I_Array is new
Interfaces.C.Pointers (Natural, Item, C_Item_Array, Null_Item);
use type System.Bit_Order;
subtype chars_ptr is Interfaces.C.Strings.chars_ptr;
function MOS_2_CInt is new
Ada.Unchecked_Conversion (Menu_Option_Set,
C_Int);
function CInt_2_MOS is new
Ada.Unchecked_Conversion (C_Int,
Menu_Option_Set);
function IOS_2_CInt is new
Ada.Unchecked_Conversion (Item_Option_Set,
C_Int);
function CInt_2_IOS is new
Ada.Unchecked_Conversion (C_Int,
Item_Option_Set);
------------------------------------------------------------------------------
procedure Request_Name (Key : in Menu_Request_Code;
Name : out String)
is
function Request_Name (Key : C_Int) return chars_ptr;
pragma Import (C, Request_Name, "menu_request_name");
begin
Fill_String (Request_Name (C_Int (Key)), Name);
end Request_Name;
function Request_Name (Key : Menu_Request_Code) return String
is
function Request_Name (Key : C_Int) return chars_ptr;
pragma Import (C, Request_Name, "menu_request_name");
begin
return Fill_String (Request_Name (C_Int (Key)));
end Request_Name;
function Create (Name : String;
Description : String := "") return Item
is
type Char_Ptr is access all Interfaces.C.char;
function Newitem (Name, Desc : Char_Ptr) return Item;
pragma Import (C, Newitem, "new_item");
type Name_String is new char_array (0 .. Name'Length);
type Name_String_Ptr is access Name_String;
pragma Controlled (Name_String_Ptr);
type Desc_String is new char_array (0 .. Description'Length);
type Desc_String_Ptr is access Desc_String;
pragma Controlled (Desc_String_Ptr);
Name_Str : Name_String_Ptr := new Name_String;
Desc_Str : Desc_String_Ptr := new Desc_String;
Name_Len, Desc_Len : size_t;
Result : Item;
begin
To_C (Name, Name_Str.all, Name_Len);
To_C (Description, Desc_Str.all, Desc_Len);
Result := Newitem (Name_Str.all (Name_Str.all'First)'Access,
Desc_Str.all (Desc_Str.all'First)'Access);
if Result = Null_Item then
raise Eti_System_Error;
end if;
return Result;
end Create;
procedure Delete (Itm : in out Item)
is
function Descname (Itm : Item) return chars_ptr;
pragma Import (C, Descname, "item_description");
function Itemname (Itm : Item) return chars_ptr;
pragma Import (C, Itemname, "item_name");
function Freeitem (Itm : Item) return C_Int;
pragma Import (C, Freeitem, "free_item");
Res : Eti_Error;
Ptr : chars_ptr;
begin
Ptr := Descname (Itm);
if Ptr /= Null_Ptr then
Interfaces.C.Strings.Free (Ptr);
end if;
Ptr := Itemname (Itm);
if Ptr /= Null_Ptr then
Interfaces.C.Strings.Free (Ptr);
end if;
Res := Freeitem (Itm);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Itm := Null_Item;
end Delete;
-------------------------------------------------------------------------------
procedure Set_Value (Itm : in Item;
Value : in Boolean := True)
is
function Set_Item_Val (Itm : Item;
Val : C_Int) return C_Int;
pragma Import (C, Set_Item_Val, "set_item_value");
Res : constant Eti_Error := Set_Item_Val (Itm, Boolean'Pos (Value));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Value;
function Value (Itm : Item) return Boolean
is
function Item_Val (Itm : Item) return C_Int;
pragma Import (C, Item_Val, "item_value");
begin
if Item_Val (Itm) = Curses_False then
return False;
else
return True;
end if;
end Value;
-------------------------------------------------------------------------------
function Visible (Itm : Item) return Boolean
is
function Item_Vis (Itm : Item) return C_Int;
pragma Import (C, Item_Vis, "item_visible");
begin
if Item_Vis (Itm) = Curses_False then
return False;
else
return True;
end if;
end Visible;
-------------------------------------------------------------------------------
procedure Set_Options (Itm : in Item;
Options : in Item_Option_Set)
is
function Set_Item_Opts (Itm : Item;
Opt : C_Int) return C_Int;
pragma Import (C, Set_Item_Opts, "set_item_opts");
Opt : C_Int := IOS_2_CInt (Options);
Res : Eti_Error;
begin
Res := Set_Item_Opts (Itm, Opt);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Options;
procedure Switch_Options (Itm : in Item;
Options : in Item_Option_Set;
On : Boolean := True)
is
function Item_Opts_On (Itm : Item;
Opt : C_Int) return C_Int;
pragma Import (C, Item_Opts_On, "item_opts_on");
function Item_Opts_Off (Itm : Item;
Opt : C_Int) return C_Int;
pragma Import (C, Item_Opts_Off, "item_opts_off");
Opt : C_Int := IOS_2_CInt (Options);
Err : Eti_Error;
begin
if On then
Err := Item_Opts_On (Itm, Opt);
else
Err := Item_Opts_Off (Itm, Opt);
end if;
if Err /= E_Ok then
Eti_Exception (Err);
end if;
end Switch_Options;
procedure Get_Options (Itm : in Item;
Options : out Item_Option_Set)
is
function Item_Opts (Itm : Item) return C_Int;
pragma Import (C, Item_Opts, "item_opts");
Res : C_Int := Item_Opts (Itm);
begin
Options := CInt_2_IOS (Res);
end Get_Options;
function Get_Options (Itm : Item := Null_Item) return Item_Option_Set
is
Ios : Item_Option_Set;
begin
Get_Options (Itm, Ios);
return Ios;
end Get_Options;
-------------------------------------------------------------------------------
procedure Name (Itm : in Item;
Name : out String)
is
function Itemname (Itm : Item) return chars_ptr;
pragma Import (C, Itemname, "item_name");
begin
Fill_String (Itemname (Itm), Name);
end Name;
function Name (Itm : in Item) return String
is
function Itemname (Itm : Item) return chars_ptr;
pragma Import (C, Itemname, "item_name");
begin
return Fill_String (Itemname (Itm));
end Name;
procedure Description (Itm : in Item;
Description : out String)
is
function Descname (Itm : Item) return chars_ptr;
pragma Import (C, Descname, "item_description");
begin
Fill_String (Descname (Itm), Description);
end Description;
function Description (Itm : in Item) return String
is
function Descname (Itm : Item) return chars_ptr;
pragma Import (C, Descname, "item_description");
begin
return Fill_String (Descname (Itm));
end Description;
-------------------------------------------------------------------------------
procedure Set_Current (Men : in Menu;
Itm : in Item)
is
function Set_Curr_Item (Men : Menu;
Itm : Item) return C_Int;
pragma Import (C, Set_Curr_Item, "set_current_item");
Res : constant Eti_Error := Set_Curr_Item (Men, Itm);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Current;
function Current (Men : Menu) return Item
is
function Curr_Item (Men : Menu) return Item;
pragma Import (C, Curr_Item, "current_item");
Res : constant Item := Curr_Item (Men);
begin
if Res = Null_Item then
raise Menu_Exception;
end if;
return Res;
end Current;
procedure Set_Top_Row (Men : in Menu;
Line : in Line_Position)
is
function Set_Toprow (Men : Menu;
Line : C_Int) return C_Int;
pragma Import (C, Set_Toprow, "set_top_row");
Res : constant Eti_Error := Set_Toprow (Men, C_Int (Line));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Top_Row;
function Top_Row (Men : Menu) return Line_Position
is
function Toprow (Men : Menu) return C_Int;
pragma Import (C, Toprow, "top_row");
Res : constant C_Int := Toprow (Men);
begin
if Res = Curses_Err then
raise Menu_Exception;
end if;
return Line_Position (Res);
end Top_Row;
function Get_Index (Itm : Item) return Positive
is
function Get_Itemindex (Itm : Item) return C_Int;
pragma Import (C, Get_Itemindex, "item_index");
Res : constant C_Int := Get_Itemindex (Itm);
begin
if Res = Curses_Err then
raise Menu_Exception;
end if;
return Positive (Natural (Res) + Positive'First);
end Get_Index;
-------------------------------------------------------------------------------
procedure Post (Men : in Menu;
Post : in Boolean := True)
is
function M_Post (Men : Menu) return C_Int;
pragma Import (C, M_Post, "post_menu");
function M_Unpost (Men : Menu) return C_Int;
pragma Import (C, M_Unpost, "unpost_menu");
Res : Eti_Error;
begin
if Post then
Res := M_Post (Men);
else
Res := M_Unpost (Men);
end if;
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Post;
-------------------------------------------------------------------------------
procedure Set_Options (Men : in Menu;
Options : in Menu_Option_Set)
is
function Set_Menu_Opts (Men : Menu;
Opt : C_Int) return C_Int;
pragma Import (C, Set_Menu_Opts, "set_menu_opts");
Opt : C_Int := MOS_2_CInt (Options);
Res : Eti_Error;
begin
Res := Set_Menu_Opts (Men, Opt);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Options;
procedure Switch_Options (Men : in Menu;
Options : in Menu_Option_Set;
On : in Boolean := True)
is
function Menu_Opts_On (Men : Menu;
Opt : C_Int) return C_Int;
pragma Import (C, Menu_Opts_On, "menu_opts_on");
function Menu_Opts_Off (Men : Menu;
Opt : C_Int) return C_Int;
pragma Import (C, Menu_Opts_Off, "menu_opts_off");
Opt : C_Int := MOS_2_CInt (Options);
Err : Eti_Error;
begin
if On then
Err := Menu_Opts_On (Men, Opt);
else
Err := Menu_Opts_Off (Men, Opt);
end if;
if Err /= E_Ok then
Eti_Exception (Err);
end if;
end Switch_Options;
procedure Get_Options (Men : in Menu;
Options : out Menu_Option_Set)
is
function Menu_Opts (Men : Menu) return C_Int;
pragma Import (C, Menu_Opts, "menu_opts");
Res : C_Int := Menu_Opts (Men);
begin
Options := CInt_2_MOS (Res);
end Get_Options;
function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set
is
Mos : Menu_Option_Set;
begin
Get_Options (Men, Mos);
return Mos;
end Get_Options;
-------------------------------------------------------------------------------
procedure Set_Window (Men : in Menu;
Win : in Window)
is
function Set_Menu_Win (Men : Menu;
Win : Window) return C_Int;
pragma Import (C, Set_Menu_Win, "set_menu_win");
Res : constant Eti_Error := Set_Menu_Win (Men, Win);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Window;
function Get_Window (Men : Menu) return Window
is
function Menu_Win (Men : Menu) return Window;
pragma Import (C, Menu_Win, "menu_win");
W : constant Window := Menu_Win (Men);
begin
return W;
end Get_Window;
procedure Set_Sub_Window (Men : in Menu;
Win : in Window)
is
function Set_Menu_Sub (Men : Menu;
Win : Window) return C_Int;
pragma Import (C, Set_Menu_Sub, "set_menu_sub");
Res : constant Eti_Error := Set_Menu_Sub (Men, Win);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Sub_Window;
function Get_Sub_Window (Men : Menu) return Window
is
function Menu_Sub (Men : Menu) return Window;
pragma Import (C, Menu_Sub, "menu_sub");
W : constant Window := Menu_Sub (Men);
begin
return W;
end Get_Sub_Window;
procedure Scale (Men : in Menu;
Lines : out Line_Count;
Columns : out Column_Count)
is
type C_Int_Access is access all C_Int;
function M_Scale (Men : Menu;
Yp, Xp : C_Int_Access) return C_Int;
pragma Import (C, M_Scale, "scale_menu");
X, Y : aliased C_Int;
Res : constant Eti_Error := M_Scale (Men, Y'Access, X'Access);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Lines := Line_Count (Y);
Columns := Column_Count (X);
end Scale;
-------------------------------------------------------------------------------
procedure Position_Cursor (Men : Menu)
is
function Pos_Menu_Cursor (Men : Menu) return C_Int;
pragma Import (C, Pos_Menu_Cursor, "pos_menu_cursor");
Res : constant Eti_Error := Pos_Menu_Cursor (Men);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Position_Cursor;
-------------------------------------------------------------------------------
procedure Set_Mark (Men : in Menu;
Mark : in String)
is
type Char_Ptr is access all Interfaces.C.char;
function Set_Mark (Men : Menu;
Mark : Char_Ptr) return C_Int;
pragma Import (C, Set_Mark, "set_menu_mark");
Txt : char_array (0 .. Mark'Length);
Len : size_t;
Res : Eti_Error;
begin
To_C (Mark, Txt, Len);
Res := Set_Mark (Men, Txt (Txt'First)'Access);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Mark;
procedure Mark (Men : in Menu;
Mark : out String)
is
function Get_Menu_Mark (Men : Menu) return chars_ptr;
pragma Import (C, Get_Menu_Mark, "menu_mark");
begin
Fill_String (Get_Menu_Mark (Men), Mark);
end Mark;
function Mark (Men : Menu) return String
is
function Get_Menu_Mark (Men : Menu) return chars_ptr;
pragma Import (C, Get_Menu_Mark, "menu_mark");
begin
return Fill_String (Get_Menu_Mark (Men));
end Mark;
-------------------------------------------------------------------------------
procedure Set_Foreground
(Men : in Menu;
Fore : in Character_Attribute_Set := Normal_Video;
Color : in Color_Pair := Color_Pair'First)
is
function Set_Menu_Fore (Men : Menu;
Attr : C_Chtype) return C_Int;
pragma Import (C, Set_Menu_Fore, "set_menu_fore");
Ch : constant Attributed_Character := (Ch => Character'First,
Color => Color,
Attr => Fore);
Res : constant Eti_Error := Set_Menu_Fore (Men, AttrChar_To_Chtype (Ch));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Foreground;
procedure Foreground (Men : in Menu;
Fore : out Character_Attribute_Set)
is
function Menu_Fore (Men : Menu) return C_Chtype;
pragma Import (C, Menu_Fore, "menu_fore");
begin
Fore := Chtype_To_AttrChar (Menu_Fore (Men)).Attr;
end Foreground;
procedure Foreground (Men : in Menu;
Fore : out Character_Attribute_Set;
Color : out Color_Pair)
is
function Menu_Fore (Men : Menu) return C_Chtype;
pragma Import (C, Menu_Fore, "menu_fore");
begin
Fore := Chtype_To_AttrChar (Menu_Fore (Men)).Attr;
Color := Chtype_To_AttrChar (Menu_Fore (Men)).Color;
end Foreground;
procedure Set_Background
(Men : in Menu;
Back : in Character_Attribute_Set := Normal_Video;
Color : in Color_Pair := Color_Pair'First)
is
function Set_Menu_Back (Men : Menu;
Attr : C_Chtype) return C_Int;
pragma Import (C, Set_Menu_Back, "set_menu_back");
Ch : constant Attributed_Character := (Ch => Character'First,
Color => Color,
Attr => Back);
Res : constant Eti_Error := Set_Menu_Back (Men, AttrChar_To_Chtype (Ch));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Background;
procedure Background (Men : in Menu;
Back : out Character_Attribute_Set)
is
function Menu_Back (Men : Menu) return C_Chtype;
pragma Import (C, Menu_Back, "menu_back");
begin
Back := Chtype_To_AttrChar (Menu_Back (Men)).Attr;
end Background;
procedure Background (Men : in Menu;
Back : out Character_Attribute_Set;
Color : out Color_Pair)
is
function Menu_Back (Men : Menu) return C_Chtype;
pragma Import (C, Menu_Back, "menu_back");
begin
Back := Chtype_To_AttrChar (Menu_Back (Men)).Attr;
Color := Chtype_To_AttrChar (Menu_Back (Men)).Color;
end Background;
procedure Set_Grey (Men : in Menu;
Grey : in Character_Attribute_Set := Normal_Video;
Color : in Color_Pair := Color_Pair'First)
is
function Set_Menu_Grey (Men : Menu;
Attr : C_Chtype) return C_Int;
pragma Import (C, Set_Menu_Grey, "set_menu_grey");
Ch : constant Attributed_Character := (Ch => Character'First,
Color => Color,
Attr => Grey);
Res : constant Eti_Error := Set_Menu_Grey (Men, AttrChar_To_Chtype (Ch));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Grey;
procedure Grey (Men : in Menu;
Grey : out Character_Attribute_Set)
is
function Menu_Grey (Men : Menu) return C_Chtype;
pragma Import (C, Menu_Grey, "menu_grey");
begin
Grey := Chtype_To_AttrChar (Menu_Grey (Men)).Attr;
end Grey;
procedure Grey (Men : in Menu;
Grey : out Character_Attribute_Set;
Color : out Color_Pair)
is
function Menu_Grey (Men : Menu) return C_Chtype;
pragma Import (C, Menu_Grey, "menu_grey");
begin
Grey := Chtype_To_AttrChar (Menu_Grey (Men)).Attr;
Color := Chtype_To_AttrChar (Menu_Grey (Men)).Color;
end Grey;
procedure Set_Pad_Character (Men : in Menu;
Pad : in Character := Space)
is
function Set_Menu_Pad (Men : Menu;
Ch : C_Int) return C_Int;
pragma Import (C, Set_Menu_Pad, "set_menu_pad");
Res : constant Eti_Error := Set_Menu_Pad (Men,
C_Int (Character'Pos (Pad)));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Pad_Character;
procedure Pad_Character (Men : in Menu;
Pad : out Character)
is
function Menu_Pad (Men : Menu) return C_Int;
pragma Import (C, Menu_Pad, "menu_pad");
begin
Pad := Character'Val (Menu_Pad (Men));
end Pad_Character;
-------------------------------------------------------------------------------
procedure Set_Spacing (Men : in Menu;
Descr : in Column_Position := 0;
Row : in Line_Position := 0;
Col : in Column_Position := 0)
is
function Set_Spacing (Men : Menu;
D, R, C : C_Int) return C_Int;
pragma Import (C, Set_Spacing, "set_menu_spacing");
Res : constant Eti_Error := Set_Spacing (Men,
C_Int (Descr),
C_Int (Row),
C_Int (Col));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Spacing;
procedure Spacing (Men : in Menu;
Descr : out Column_Position;
Row : out Line_Position;
Col : out Column_Position)
is
type C_Int_Access is access all C_Int;
function Get_Spacing (Men : Menu;
D, R, C : C_Int_Access) return C_Int;
pragma Import (C, Get_Spacing, "menu_spacing");
D, R, C : aliased C_Int;
Res : constant Eti_Error := Get_Spacing (Men,
D'Access,
R'Access,
C'Access);
begin
if Res /= E_Ok then
Eti_Exception (Res);
else
Descr := Column_Position (D);
Row := Line_Position (R);
Col := Column_Position (C);
end if;
end Spacing;
-------------------------------------------------------------------------------
function Set_Pattern (Men : Menu;
Text : String) return Boolean
is
type Char_Ptr is access all Interfaces.C.char;
function Set_Pattern (Men : Menu;
Pattern : Char_Ptr) return C_Int;
pragma Import (C, Set_Pattern, "set_menu_pattern");
S : char_array (0 .. Text'Length);
L : size_t;
Res : Eti_Error;
begin
To_C (Text, S, L);
Res := Set_Pattern (Men, S (S'First)'Access);
case Res is
when E_No_Match => return False;
when E_Ok => return True;
when others =>
Eti_Exception (Res);
return False;
end case;
end Set_Pattern;
procedure Pattern (Men : in Menu;
Text : out String)
is
function Get_Pattern (Men : Menu) return chars_ptr;
pragma Import (C, Get_Pattern, "menu_pattern");
begin
Fill_String (Get_Pattern (Men), Text);
end Pattern;
-------------------------------------------------------------------------------
procedure Set_Format (Men : in Menu;
Lines : in Line_Count;
Columns : in Column_Count)
is
function Set_Menu_Fmt (Men : Menu;
Lin : C_Int;
Col : C_Int) return C_Int;
pragma Import (C, Set_Menu_Fmt, "set_menu_format");
Res : constant Eti_Error := Set_Menu_Fmt (Men,
C_Int (Lines),
C_Int (Columns));
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Format;
procedure Format (Men : in Menu;
Lines : out Line_Count;
Columns : out Column_Count)
is
type C_Int_Access is access all C_Int;
function Menu_Fmt (Men : Menu;
Y, X : C_Int_Access) return C_Int;
pragma Import (C, Menu_Fmt, "menu_format");
L, C : aliased C_Int;
Res : constant Eti_Error := Menu_Fmt (Men, L'Access, C'Access);
begin
if Res /= E_Ok then
Eti_Exception (Res);
else
Lines := Line_Count (L);
Columns := Column_Count (C);
end if;
end Format;
-------------------------------------------------------------------------------
procedure Set_Item_Init_Hook (Men : in Menu;
Proc : in Menu_Hook_Function)
is
function Set_Item_Init (Men : Menu;
Proc : Menu_Hook_Function) return C_Int;
pragma Import (C, Set_Item_Init, "set_item_init");
Res : constant Eti_Error := Set_Item_Init (Men, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Item_Init_Hook;
procedure Set_Item_Term_Hook (Men : in Menu;
Proc : in Menu_Hook_Function)
is
function Set_Item_Term (Men : Menu;
Proc : Menu_Hook_Function) return C_Int;
pragma Import (C, Set_Item_Term, "set_item_term");
Res : constant Eti_Error := Set_Item_Term (Men, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Item_Term_Hook;
procedure Set_Menu_Init_Hook (Men : in Menu;
Proc : in Menu_Hook_Function)
is
function Set_Menu_Init (Men : Menu;
Proc : Menu_Hook_Function) return C_Int;
pragma Import (C, Set_Menu_Init, "set_menu_init");
Res : constant Eti_Error := Set_Menu_Init (Men, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Menu_Init_Hook;
procedure Set_Menu_Term_Hook (Men : in Menu;
Proc : in Menu_Hook_Function)
is
function Set_Menu_Term (Men : Menu;
Proc : Menu_Hook_Function) return C_Int;
pragma Import (C, Set_Menu_Term, "set_menu_term");
Res : constant Eti_Error := Set_Menu_Term (Men, Proc);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end Set_Menu_Term_Hook;
function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function
is
function Item_Init (Men : Menu) return Menu_Hook_Function;
pragma Import (C, Item_Init, "item_init");
begin
return Item_Init (Men);
end Get_Item_Init_Hook;
function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function
is
function Item_Term (Men : Menu) return Menu_Hook_Function;
pragma Import (C, Item_Term, "item_term");
begin
return Item_Term (Men);
end Get_Item_Term_Hook;
function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function
is
function Menu_Init (Men : Menu) return Menu_Hook_Function;
pragma Import (C, Menu_Init, "menu_init");
begin
return Menu_Init (Men);
end Get_Menu_Init_Hook;
function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function
is
function Menu_Term (Men : Menu) return Menu_Hook_Function;
pragma Import (C, Menu_Term, "menu_term");
begin
return Menu_Term (Men);
end Get_Menu_Term_Hook;
-------------------------------------------------------------------------------
procedure Redefine (Men : in Menu;
Items : in Item_Array_Access)
is
function Set_Items (Men : Menu;
Items : System.Address) return C_Int;
pragma Import (C, Set_Items, "set_menu_items");
Res : Eti_Error;
begin
pragma Assert (Items (Items'Last) = Null_Item);
if Items (Items'Last) /= Null_Item then
raise Menu_Exception;
else
Res := Set_Items (Men, Items.all'Address);
if Res /= E_Ok then
Eti_Exception (Res);
end if;
end if;
end Redefine;
function Item_Count (Men : Menu) return Natural
is
function Count (Men : Menu) return C_Int;
pragma Import (C, Count, "item_count");
begin
return Natural (Count (Men));
end Item_Count;
function Items (Men : Menu;
Index : Positive) return Item
is
use I_Array;
function C_Mitems (Men : Menu) return Pointer;
pragma Import (C, C_Mitems, "menu_items");
P : Pointer := C_Mitems (Men);
begin
if P = null or else Index not in 1 .. Item_Count (Men) then
raise Menu_Exception;
else
P := P + ptrdiff_t (C_Int (Index) - 1);
return P.all;
end if;
end Items;
-------------------------------------------------------------------------------
function Create (Items : Item_Array_Access) return Menu
is
function Newmenu (Items : System.Address) return Menu;
pragma Import (C, Newmenu, "new_menu");
M : Menu;
begin
pragma Assert (Items (Items'Last) = Null_Item);
if Items (Items'Last) /= Null_Item then
raise Menu_Exception;
else
M := Newmenu (Items.all'Address);
if M = Null_Menu then
raise Menu_Exception;
end if;
return M;
end if;
end Create;
procedure Delete (Men : in out Menu)
is
function Free (Men : Menu) return C_Int;
pragma Import (C, Free, "free_menu");
Res : constant Eti_Error := Free (Men);
begin
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Men := Null_Menu;
end Delete;
------------------------------------------------------------------------------
function Driver (Men : Menu;
Key : Key_Code) return Driver_Result
is
function Driver (Men : Menu;
Key : C_Int) return C_Int;
pragma Import (C, Driver, "menu_driver");
R : Eti_Error := Driver (Men, C_Int (Key));
begin
if R /= E_Ok then
case R is
when E_Unknown_Command => return Unknown_Request;
when E_No_Match => return No_Match;
when E_Request_Denied |
E_Not_Selectable => return Request_Denied;
when others =>
Eti_Exception (R);
end case;
end if;
return Menu_Ok;
end Driver;
procedure Free (IA : in out Item_Array_Access;
Free_Items : in Boolean := False)
is
procedure Release is new Ada.Unchecked_Deallocation
(Item_Array, Item_Array_Access);
begin
if IA /= null and then Free_Items then
for I in IA'First .. (IA'Last - 1) loop
if (IA (I) /= Null_Item) then
Delete (IA (I));
end if;
end loop;
end if;
Release (IA);
end Free;
-------------------------------------------------------------------------------
function Default_Menu_Options return Menu_Option_Set
is
begin
return Get_Options (Null_Menu);
end Default_Menu_Options;
function Default_Item_Options return Item_Option_Set
is
begin
return Get_Options (Null_Item);
end Default_Item_Options;
-------------------------------------------------------------------------------
end Terminal_Interface.Curses.Menus;
|
riccardo-bernardini/eugen | Ada | 6,868 | ads | -----------------------------------------------------------------------------
-- Symbolic Expressions (symexpr)
--
-- Copyright (C) 2012, Riccardo Bernardini
--
-- This file is part of symexpr.
--
-- symexpr is free software: you can redistribute it and/or modify
-- it under the terms of the Lesser GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- symexpr 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 Lesser GNU General Public License
-- along with gclp. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------------
-- -*- Mode: Ada -*-
-- Filename : test_report.ads
-- Description : Handy package to print test results
-- Author : Riccardo Bernardini
-- Created On : Thu Jul 3 07:49:02 2008
-- Last Modified By: .
-- Last Modified On: .
-- Update Count : 0
-- Status : Beta
--
-- This package provides some procedures which can be handy
-- when writing test code. Our reference model is the
-- following: a test program contains several "test suites",
-- where each suite is just a collection of sets. A suite
-- is SUCCESSful if all the tests in the suite passed.
--
-- A variable of type Reporter_Type is an object which can keep
-- track of the passed/not passed test/suites. The way to
-- use a Reporter_Type is quite simple:
--
-- Reporter : Reporter_Type; -- Create the object
--
-- while ... loop -- first test suite
--
-- new_result(Rep => reporter, -- Accumulate test
-- OK => expected = actual); -- results
-- end loop;
--
-- new_suite(reporter); -- start a new suite
--
-- while ... loop -- second test suite
--
-- if (OK) then
-- success(reporter); -- An alternative way
-- else -- of accumulating
-- failure(reporter); -- test results
-- end if;
-- end loop;
--
-- final(reporter); -- Print final report
-- -- and set Exit_Status
--
--
-- Each time New_Suite is called it prints on the stdout
-- a string of type
--
-- Passed ... out of ... tests: (SUCCESS | FAILED)
--
with Ada.Command_Line;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Strings.Unbounded, Text_Io;
use Ada.Strings.Unbounded, Text_Io;
package Test_Report is
package CL renames Ada.Command_Line;
type Reporter_Type is tagged private;
procedure Be_Verbose (This : in out Reporter_Type;
Flag : in Boolean := True);
--
-- By default the reports are printed to the standard error. This
-- procedure allows one to change such a default.
--
procedure Set_Output (This : in out Reporter_Type;
File : in File_Access);
procedure Set_Tab (This : in out Reporter_Type;
Tab : in Positive);
--
-- Start a new suite. It is possible to give to the suite
-- a descriptive name. This function implicitly closes the
-- current suite and prints the corresponding results.
--
procedure New_Suite (This : in out Reporter_Type;
Name : in String := "");
--
-- Register the result of a new test.
--
procedure New_Result (This : in out Reporter_Type;
Ok : in Boolean);
--
-- Equivalent to New_Result(This, True);
--
procedure Success (This : in out Reporter_Type);
--
-- Equivalent to New_Result(This, False);
--
procedure Failure (This : in out Reporter_Type);
--
-- Print a final report and, if required, sets the
-- exit status to Success if and only if all the
-- tests succeded.
--
procedure Final (This : in out Reporter_Type;
Set_Status : in Boolean := True);
--
-- Generic procedure to run an "array of tests". Typically
-- Test_Case will be a record which holds the values necessary
-- for the tests. For example, in order to test a "sum" function
-- one could write
--
-- type Sum_Case is
-- record
-- Left, Right : Integer;
-- Expected : Integer;
-- end record;
--
-- type Sum_Case_Array is
-- array(positive range <>) of Sum_Case;
--
-- Cases : Sum_Case_Array := ((left => 4, right => 3, result => 7),
-- (left => 2, right => 3, result => 5),
-- (left => 3, right => 5, result => 8));
--
-- function Check_Sum(X : Sum_Case)
-- return Boolean is
-- begin
-- return (Sum(X.Left, X.Right) = X.Result);
-- end Check_Sum;
--
-- Finally, the procedure would be instantiated
--
-- procedure Sum_Test is
-- new Do_Suite (Test_Case => Sum_Case,
-- Test_Case_Array => Sum_Case_Array,
-- Check => Check_Sum);
--
-- and run as
--
-- Sum_Test(Reporter, Cases);
--
generic
type Test_Case is private;
type Test_Case_Array is
array(Positive range <>) of Test_Case;
with function Check(This_Case : Test_Case) return Boolean;
procedure Do_Suite (This : in out Reporter_Type;
Cases : in Test_Case_Array;
Name : in String := "");
private
package Boolean_Lists is
new Ada.Containers.Doubly_Linked_Lists (Boolean);
type Reporter_Type is tagged
record
Status : CL.Exit_Status := CL.Success;
N_Suites : Natural := 0;
N_Suite_OK : Natural := 0;
N_Tests : Natural := 0;
N_Test_OK : Natural := 0;
Name : Unbounded_String;
Output_To : File_Access := Standard_Error;
Verbose : Boolean := False;
Tab : Positive := 35;
Suite_Results : Boolean_Lists.List;
end record;
end Test_Report;
-- Maybe Obsolete --
-- procedure Do_Report (This : in out Reporter_Type;
-- Num_Trials : in Positive;
-- Num_Success : in Natural;
-- Name : in String := "";
-- Set_Status : in Boolean := True);
|
charlie5/cBound | Ada | 1,421 | ads | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_list_fonts_with_info_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_list_fonts_with_info_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_list_fonts_with_info_cookie_t.Item,
Element_Array => xcb.xcb_list_fonts_with_info_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb.xcb_list_fonts_with_info_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_list_fonts_with_info_cookie_t.Pointer,
Element_Array => xcb.xcb_list_fonts_with_info_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_list_fonts_with_info_cookie_t;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.