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,688
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.Target_Cell_Address_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_Target_Cell_Address_Attribute_Node is begin return Self : Table_Target_Cell_Address_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_Target_Cell_Address_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Target_Cell_Address_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Table_URI, Matreshka.ODF_String_Constants.Target_Cell_Address_Attribute, Table_Target_Cell_Address_Attribute_Node'Tag); end Matreshka.ODF_Table.Target_Cell_Address_Attributes;
kontena/ruby-packer
Ada
3,998
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.PutWin -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 2000,2003 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.4 $ -- Binding Version 01.00 with Ada.Streams.Stream_IO.C_Streams; with Interfaces.C_Streams; with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; package body Terminal_Interface.Curses.PutWin is package ICS renames Interfaces.C_Streams; package ACS renames Ada.Streams.Stream_IO.C_Streams; use type C_Int; procedure Put_Window (Win : Window; File : Ada.Streams.Stream_IO.File_Type) is function putwin (Win : Window; f : ICS.FILEs) return C_Int; pragma Import (C, putwin, "putwin"); R : constant C_Int := putwin (Win, ACS.C_Stream (File)); begin if R /= Curses_Ok then raise Curses_Exception; end if; end Put_Window; function Get_Window (File : Ada.Streams.Stream_IO.File_Type) return Window is function getwin (f : ICS.FILEs) return Window; pragma Import (C, getwin, "getwin"); W : constant Window := getwin (ACS.C_Stream (File)); begin if W = Null_Window then raise Curses_Exception; else return W; end if; end Get_Window; end Terminal_Interface.Curses.PutWin;
BrickBot/Bound-T-H8-300
Ada
8,017
ads
-- Output.Opt (decl) -- -- Command-line options that control the generation and formatting of -- the "basic" output. -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.11 $ -- $Date: 2015/10/24 19:36:51 $ -- -- $Log: output-opt.ads,v $ -- Revision 1.11 2015/10/24 19:36:51 niklas -- Moved to free licence. -- -- Revision 1.10 2011-08-31 04:23:34 niklas -- BT-CH-0222: Option registry. Option -dump. External help files. -- -- Revision 1.9 2009/05/21 08:08:27 niklas -- BT-CH-0175: Limits on the number of Warnings, Errors, Faults. -- -- Revision 1.8 2006/02/28 08:50:59 niklas -- Extended the option Source_File_Form to apply also to the name -- of the target program executable file. Changed the default -- value to Base_Name for brevity and to help testing. -- -- Revision 1.7 2005/10/26 14:10:14 niklas -- Using Basic_Output. -- -- Revision 1.6 2004/04/25 09:29:45 niklas -- First Tidorum version. -- Multiple source files per location ("See_Also" lines). -- Options for source-file name form (full path or basename). -- Inexact source-line matching (surrounding lines). -- Operations for tracing output ("Trace" lines). -- Additional control over "Result" and "Unknown" output. -- Caching of current default locus computed from locus nest. -- -- Revision 1.5 2003/02/17 16:17:08 holsti -- Added option Show_Code_Addresses (-address) to include the code address -- in all output of code loci. Earlier, this was the default; now the -- default is to suppress the code addresses and show only source-line -- numbers if available. -- -- Revision 1.4 2001/05/27 10:50:59 holsti -- programs-show.adb -- -- Revision 1.3 2001/03/15 20:47:37 holsti -- Show_Notes (option -q, -quiet) added. -- -- Revision 1.2 2000/05/02 10:53:01 holsti -- Field_Separator is provided by Output, too. -- -- Revision 1.1 2000/04/22 12:08:26 holsti -- Output package added. -- with Basic_Output; with Options; with Options.Bool; with Options.Char; with Options.Nat; package Output.Opt is pragma Elaborate_Body; -- -- To register the options. Field_Separator_Opt : aliased Options.Char.Option_T ( Default => Basic_Output.Default_Field_Separator); -- -- The character that separates fields in basic-format output lines. -- Changing this value also changes Basic_Output.Field_Separator. -- Field_Separator : Character renames Field_Separator_Opt.Value; Show_Notes_Opt : aliased Options.Bool.Option_T ( Default => Basic_Output.Default_Show_Notes); -- -- Whether to output "notes". -- Changing this value also changes Basic_Output.Show_Notes. -- Show_Notes : Boolean renames Show_Notes_Opt.Value; package Source_File_Forms is new Options.Discrete_Valued ( Value_Type => Real_Source_File_Form_T, Value_Image => Real_Source_File_Form_T'Image); -- -- Options with values of type Real_Source_File_Form_T. Source_File_Form_Opt : aliased Source_File_Forms.Option_T (Default => Base); -- -- The chosen form in which the names of source files and -- target program executable files are shown. -- Source_File_Form : Real_Source_File_Form_T renames Source_File_Form_Opt.Value; Show_Code_Addresses_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to show the machine-code addresses when indicating the -- place (locus) of some code entity (subprogram, statement, loop, -- call, instruction). -- Show_Code_Addresses : Boolean renames Show_Code_Addresses_Opt.Value; type Source_Line_Precision_T is ( Exact, Around); -- -- The precision required for showing source-line numbers associated -- with the place (locus) of some code entity (subprogram, statement, -- loop, call, instruction). -- -- Exact -- Show only source-line numbers connected to the code address(es) -- of the place. -- Around -- If no source-line numbers are connected to the code address(es) -- of the place, show the source-line number(s) for the closest -- preceding and/or following address that is/are connected to -- source-line numbers. package Source_Precisions is new Options.Discrete_Valued ( Value_Type => Source_Line_Precision_T, Value_Image => Source_Line_Precision_T'Image); Source_Line_Precision : aliased Source_Precisions.Option_T ( Default => Around); -- -- How to choose source-line numbers for a locus. function Show_Surrounding_Lines return Boolean; -- -- Whether Source_Line_Precision is set to show the -- surrounding lines (Around). Trace_Locus_Nesting_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to trace the nesting and unnesting of default output loci. -- Trace_Locus_Nesting : Boolean renames Trace_Locus_Nesting_Opt.Value; Trace_Current_Locus_Opt : aliased Options.Bool.Option_T (Default => False); -- -- Whether to show the default locus nest whenever the current locus -- is computed from this nest. -- Trace_Current_Locus : Boolean renames Trace_Current_Locus_Opt.Value; Max_Warnings_Opt : aliased Options.Nat.Option_T (Default => 3_000); Max_Errors_Opt : aliased Options.Nat.Option_T (Default => 3_000); Max_Faults_Opt : aliased Options.Nat.Option_T (Default => 100); -- -- Limits on the number of Warning, Error, and Fault messages -- that can be emitted, before execution is terminated by raising -- the exception Too_Many_Problems. -- -- The exception is raised if the total number of emitted Warnings -- (Errors, Faults) exceeds the corresponding limit after emitting -- a Warning (Error, Fault). Thus, the actual number of Warnings -- (Errors, Faults) emitted is one more than the limit. For example, -- if the limit is zero, the exception is raised after the first -- Warning (Error, Fault) is emitted. -- -- Furthermore, exceeding the limit is also an error and is -- reported by an Error message (which cannot, however, cause -- Max_Errors to be exceeded). -- Max_Warnings : Natural renames Max_Warnings_Opt.Value; Max_Errors : Natural renames Max_Errors_Opt.Value; Max_Faults : Natural renames Max_Faults_Opt.Value; end Output.Opt;
AdaCore/langkit
Ada
374
adb
with Ada.Text_IO; use Ada.Text_IO; with Libfoolang.Analysis; use Libfoolang.Analysis; procedure Main is U : constant Analysis_Unit := Create_Context.Get_From_Buffer (Filename => "foo.txt", Buffer => "example"); begin if U.Has_Diagnostics then raise Program_Error; end if; U.Populate_Lexical_Env; Put_Line ("main.adb: Done."); end Main;
fmqa/simulatedannealing-ada
Ada
483
adb
package body Bitmaps.RGB is function Max_X (Source : in Image) return Natural is (Source.Width - 1); function Max_Y (Source : in Image) return Natural is (Source.Height - 1); function Get_Pixel (Source : in Image; X, Y : Natural) return Pixel is (Source.Pixels (Y, X)); procedure Set_Pixel (Target : in out Image; X, Y : Natural; Value : in Pixel) is begin Target.Pixels (Y, X) := Value; end Set_Pixel; end Bitmaps.RGB;
charlie5/lace
Ada
2,918
ads
with physics.Shape, c_math_c.Pointers, bullet_c.Pointers, bullet_c; package bullet_Physics.Shape -- -- Provides glue between a physics shape and a Bullet3D shape. -- is type Item is abstract new physics.Shape.item with record C : bullet_c.Pointers.Shape_Pointer; end record; type View is access all Item'Class; use Math; --------- -- Forge -- overriding procedure define (Self : in out Item); overriding procedure destruct (Self : in out Item); function new_box_Shape (half_Extents : in Vector_3) return physics.Shape.view; function new_capsule_Shape (Radii : in Vector_2; Height : in Real) return physics.Shape.view; function new_cone_Shape (Radius, Height : in Real) return physics.Shape.view; function new_convex_hull_Shape (Points : in physics.Vector_3_array) return physics.Shape.view; function new_mesh_Shape (Model : access Geometry.d3.a_Model) return physics.Shape.view; function new_cylinder_Shape (half_Extents : in Vector_3) return physics.Shape.view; function new_heightfield_Shape (Width, Depth : in Positive; Heights : in c_math_c.Pointers.Real_pointer; min_Height, max_Height : in Real; Scale : in Vector_3) return physics.Shape.view; function new_multiSphere_Shape (Positions : in physics.Vector_3_array; Radii : in Vector) return physics.Shape.view; function new_plane_Shape (Normal : in Vector_3; Offset : in Real) return physics.Shape.view; function new_sphere_Shape (Radius : in Real) return physics.Shape.view; procedure free (the_Shape : in out physics.Shape.view); --------------- --- Attributes -- overriding procedure Scale_is (Self : in out Item; Now : Vector_3); private type Box is new Item with null record; type Capsule is new Item with null record; type Cone is new Item with null record; type Cylinder is new Item with null record; type Heightfield is new Item with null record; type multiSphere is new Item with null record; type Plane is new Item with null record; type Sphere is new Item with null record; type convex_Hull is new Item with null record; type Mesh is new Item with null record; end bullet_Physics.Shape;
reznikmm/matreshka
Ada
3,645
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.OCL.Collection_Literal_Parts.Hash is new AMF.Elements.Generic_Hash (OCL_Collection_Literal_Part, OCL_Collection_Literal_Part_Access);
tum-ei-rcs/StratoX
Ada
603
ads
-- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- -- Authors: Martin Becker ([email protected]> with Units; -- @summary -- Target-independent specification for simple HIL of Piezo Buzzer package HIL.Buzzer with SPARK_Mode is procedure Initialize; procedure Enable; procedure Disable; function Valid_Frequency (f : Units.Frequency_Type) return Boolean is (f in 1.0 .. 1_000_000.0); procedure Set_Frequency (Frequency : Units.Frequency_Type) with Pre => Valid_Frequency (Frequency); end HIL.Buzzer;
reznikmm/matreshka
Ada
14,822
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.UML_Named_Elements; with AMF.UML.Associations; with AMF.UML.Behaviors.Collections; with AMF.UML.Classifiers.Collections; with AMF.UML.Connector_Ends.Collections; with AMF.UML.Connectors.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces; with AMF.UML.Packages.Collections; with AMF.UML.Redefinable_Elements.Collections; with AMF.UML.String_Expressions; with AMF.Visitors; package AMF.Internals.UML_Connectors is type UML_Connector_Proxy is limited new AMF.Internals.UML_Named_Elements.UML_Named_Element_Proxy and AMF.UML.Connectors.UML_Connector with null record; overriding function Get_Contract (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior; -- Getter of Connector::contract. -- -- The set of Behaviors that specify the valid interaction patterns across -- the connector. overriding function Get_End (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Connector_Ends.Collections.Ordered_Set_Of_UML_Connector_End; -- Getter of Connector::end. -- -- A connector consists of at least two connector ends, each representing -- the participation of instances of the classifiers typing the -- connectable elements attached to this end. The set of connector ends is -- ordered. overriding function Get_Kind (Self : not null access constant UML_Connector_Proxy) return AMF.UML.UML_Connector_Kind; -- Getter of Connector::kind. -- -- Indicates the kind of connector. This is derived: a connector with one -- or more ends connected to a Port which is not on a Part and which is -- not a behavior port is a delegation; otherwise it is an assembly. overriding function Get_Redefined_Connector (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Connectors.Collections.Set_Of_UML_Connector; -- Getter of Connector::redefinedConnector. -- -- A connector may be redefined when its containing classifier is -- specialized. The redefining connector may have a type that specializes -- the type of the redefined connector. The types of the connector ends of -- the redefining connector may specialize the types of the connector ends -- of the redefined connector. The properties of the connector ends of the -- redefining connector may be replaced. overriding function Get_Type (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Associations.UML_Association_Access; -- Getter of Connector::type. -- -- An optional association that specifies the link corresponding to this -- connector. overriding procedure Set_Type (Self : not null access UML_Connector_Proxy; To : AMF.UML.Associations.UML_Association_Access); -- Setter of Connector::type. -- -- An optional association that specifies the link corresponding to this -- connector. overriding function Get_Featuring_Classifier (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of Feature::featuringClassifier. -- -- The Classifiers that have this Feature as a feature. overriding function Get_Is_Static (Self : not null access constant UML_Connector_Proxy) return Boolean; -- Getter of Feature::isStatic. -- -- Specifies whether this feature characterizes individual instances -- classified by the classifier (false) or the classifier itself (true). overriding procedure Set_Is_Static (Self : not null access UML_Connector_Proxy; To : Boolean); -- Setter of Feature::isStatic. -- -- Specifies whether this feature characterizes individual instances -- classified by the classifier (false) or the classifier itself (true). overriding function Get_Is_Leaf (Self : not null access constant UML_Connector_Proxy) return Boolean; -- Getter of RedefinableElement::isLeaf. -- -- Indicates whether it is possible to further redefine a -- RedefinableElement. If the value is true, then it is not possible to -- further redefine the RedefinableElement. Note that this property is -- preserved through package merge operations; that is, the capability to -- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in -- the resulting RedefinableElement of a package merge operation where a -- RedefinableElement with isLeaf=false is merged with a matching -- RedefinableElement with isLeaf=true: the resulting RedefinableElement -- will have isLeaf=false. Default value is false. overriding procedure Set_Is_Leaf (Self : not null access UML_Connector_Proxy; To : Boolean); -- Setter of RedefinableElement::isLeaf. -- -- Indicates whether it is possible to further redefine a -- RedefinableElement. If the value is true, then it is not possible to -- further redefine the RedefinableElement. Note that this property is -- preserved through package merge operations; that is, the capability to -- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in -- the resulting RedefinableElement of a package merge operation where a -- RedefinableElement with isLeaf=false is merged with a matching -- RedefinableElement with isLeaf=true: the resulting RedefinableElement -- will have isLeaf=false. Default value is false. overriding function Get_Redefined_Element (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element; -- Getter of RedefinableElement::redefinedElement. -- -- The redefinable element that is being redefined by this element. overriding function Get_Redefinition_Context (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of RedefinableElement::redefinitionContext. -- -- References the contexts that this element may be redefined from. overriding function Get_Client_Dependency (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name_Expression (Self : not null access constant UML_Connector_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access UML_Connector_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant UML_Connector_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Kind (Self : not null access constant UML_Connector_Proxy) return AMF.UML.UML_Connector_Kind; -- Operation Connector::kind. -- -- Missing derivation for Connector::/kind : ConnectorKind overriding function Is_Consistent_With (Self : not null access constant UML_Connector_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean; -- Operation RedefinableElement::isConsistentWith. -- -- The query isConsistentWith() specifies, for any two RedefinableElements -- in a context in which redefinition is possible, whether redefinition -- would be logically consistent. By default, this is false; this -- operation must be overridden for subclasses of RedefinableElement to -- define the consistency conditions. overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Connector_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean; -- Operation RedefinableElement::isRedefinitionContextValid. -- -- The query isRedefinitionContextValid() specifies whether the -- redefinition contexts of this RedefinableElement are properly related -- to the redefinition contexts of the specified RedefinableElement to -- allow this element to redefine the other. By default at least one of -- the redefinition contexts of this element must be a specialization of -- at least one of the redefinition contexts of the specified element. overriding function All_Owning_Packages (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant UML_Connector_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant UML_Connector_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding procedure Enter_Element (Self : not null access constant UML_Connector_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant UML_Connector_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant UML_Connector_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.UML_Connectors;
stcarrez/ada-asf
Ada
938
ads
----------------------------------------------------------------------- -- asf-server -- ASF Server -- Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016, 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 Servlet.Server; package ASF.Server renames Servlet.Server;
reznikmm/matreshka
Ada
3,633
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.Elements.Generic_Hash; function AMF.Utp.Set_Timezone_Actions.Hash is new AMF.Elements.Generic_Hash (Utp_Set_Timezone_Action, Utp_Set_Timezone_Action_Access);
Tim-Tom/project-euler
Ada
3,024
adb
with Ada.Text_IO; with Ada.Integer_Text_IO; package body Problem_36 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; function Is_Palindrome(s : String) return Boolean is left : Integer := s'First; right : Integer := s'Last; begin while left <= right loop if s(left) /= s(right) then return False; end if; left := Integer'Succ(left); right := Integer'Pred(right); end loop; return True; end Is_Palindrome; function Decimal(num : Integer) return String is function Dec_Mag(num : Integer) return Integer is begin if num >= 1_000_000 then return 7; elsif num >= 100_000 then return 6; elsif num >= 10_000 then return 5; elsif num >= 1_000 then return 4; elsif num >= 100 then return 3; elsif num >= 10 then return 2; else return 1; end if; end Dec_Mag; s : String (1 .. Dec_Mag(num)); n : Integer := Num; begin for index in reverse s'Range loop s(index) := Character'Val(Character'Pos('0') + (n mod 10)); n := n / 10; end loop; return s; end Decimal; function Binary(num: Integer) return String is function Bin_Mag(num : Integer) return Integer is begin if num >= 2**17 then return 17; elsif num >= 2**16 then return 16; elsif num >= 2**15 then return 15; elsif num >= 2**14 then return 14; elsif num >= 2**13 then return 13; elsif num >= 2**12 then return 12; elsif num >= 2**11 then return 11; elsif num >= 2**10 then return 10; elsif num >= 2**9 then return 9; elsif num >= 2**8 then return 8; elsif num >= 2**7 then return 7; elsif num >= 2**6 then return 6; elsif num >= 2**5 then return 5; elsif num >= 2**4 then return 4; elsif num >= 2**3 then return 3; elsif num >= 2**2 then return 2; elsif num >= 2**1 then return 1; else return 0; end if; end Bin_Mag; s : String(1 .. Bin_Mag(num) + 1); n : Integer := num; begin for index in reverse s'Range loop s(index) := Character'Val(Character'Pos('0') + (n mod 2)); n := n / 2; end loop; return s; end Binary; procedure Solve is num : Integer := 1; sum : Integer := 0; begin while num < 1_000_000 loop if Is_Palindrome(Decimal(num)) and Is_Palindrome(Binary(num)) then sum := sum + num; end if; num := num + 2; end loop; I_IO.Put(sum); IO.New_Line; end Solve; end Problem_36;
mgrojo/bingada
Ada
391
ads
--***************************************************************************** --* --* PROJECT: Bingada --* --* FILE: q_bingo-q_gtk-q_intl.ads --* --* AUTHOR: Javier Fuica Fernandez --* --***************************************************************************** package Q_Bingo.Q_Gtk.Q_Intl is procedure P_Initialise; end Q_Bingo.Q_Gtk.Q_Intl;
RREE/ada-util
Ada
2,564
ads
----------------------------------------------------------------------- -- util-beans -- Interface Definition with Getter and Setters -- Copyright (C) 2009, 2010, 2018, 2019 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. ----------------------------------------------------------------------- -- = Ada Beans = -- A [Java Bean](http://en.wikipedia.org/wiki/JavaBean) is an object that -- allows to access its properties through getters and setters. Java Beans -- rely on the use of Java introspection to discover the Java Bean object properties. -- -- An Ada Bean has some similarities with the Java Bean as it tries to expose -- an object through a set of common interfaces. Since Ada does not have introspection, -- some developer work is necessary. The Ada Bean framework consists of: -- -- * An `Object` concrete type that allows to hold any data type such -- as boolean, integer, floats, strings, dates and Ada bean objects. -- * A `Bean` interface that exposes a `Get_Value` and `Set_Value` -- operation through which the object properties can be obtained and modified. -- * A `Method_Bean` interface that exposes a set of method bindings -- that gives access to the methods provided by the Ada Bean object. -- -- The benefit of Ada beans comes when you need to get a value or invoke -- a method on an object but you don't know at compile time the object or method. -- That step being done later through some external configuration or presentation file. -- -- The Ada Bean framework is the basis for the implementation of -- Ada Server Faces and Ada EL. It allows the presentation layer to -- access information provided by Ada beans. -- -- To use the packages described here, use the following GNAT project: -- -- with "utilada_base"; -- -- @include util-beans-objects.ads -- @include util-beans-objects-datasets.ads -- @include util-beans-basic.ads package Util.Beans is pragma Preelaborate; end Util.Beans;
jhumphry/auto_counters
Ada
1,568
ads
-- kvflyweights_lists_spec.ads -- A specification package that summarises the requirements for list packages -- used in the KVFlyweights hashtables -- Copyright (c) 2016, James Humphry -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. pragma Profile (No_Implementation_Extensions); generic type Key(<>) is private; type Key_Access is access Key; type Value_Access is private; type List is private; Empty_List : List; with procedure Insert (L : in out List; K : in Key; Key_Ptr : out Key_Access; Value_Ptr : out Value_Access); with procedure Increment (L : in out List; Key_Ptr : in Key_Access); with procedure Remove (L : in out List; Key_Ptr : in Key_Access); package KVFlyweights_Lists_Spec is end KVFlyweights_Lists_Spec;
reznikmm/matreshka
Ada
4,743
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_Draw.Handle_Radius_Range_Maximum_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Handle_Radius_Range_Maximum_Attribute_Node is begin return Self : Draw_Handle_Radius_Range_Maximum_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Handle_Radius_Range_Maximum_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Handle_Radius_Range_Maximum_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Handle_Radius_Range_Maximum_Attribute, Draw_Handle_Radius_Range_Maximum_Attribute_Node'Tag); end Matreshka.ODF_Draw.Handle_Radius_Range_Maximum_Attributes;
reznikmm/matreshka
Ada
5,306
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- 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$ ------------------------------------------------------------------------------ pragma Ada_2012; private with Ada.Finalization; with League.Strings; private with Matreshka.Internals.SQL_Drivers.Dummy; with SQL.Options; with SQL.Queries; package SQL.Databases is type SQL_Database is tagged limited private; function Create (Driver : League.Strings.Universal_String; Options : SQL.Options.SQL_Options) return SQL_Database; procedure Open (Self : in out SQL_Database'Class); function Open (Self : in out SQL_Database'Class) return Boolean; procedure Close (Self : in out SQL_Database'Class); -- Closes the database connection, freeing any resources acquired, and -- invalidating any existing QSqlQuery objects that are used with the -- database. procedure Commit (Self : in out SQL_Database'Class); procedure Rollback (Self : in out SQL_Database'Class); procedure Transaction (Self : in out SQL_Database'Class); function Error_Message (Self : SQL_Database'Class) return League.Strings.Universal_String; function Query (Self : in out SQL_Database'Class) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database. function Query (Self : in out SQL_Database'Class; Query : League.Strings.Universal_String) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database and prepare specified statement for execution. private type SQL_Database is new Ada.Finalization.Limited_Controlled with record Data : Matreshka.Internals.SQL_Drivers.Database_Access := Matreshka.Internals.SQL_Drivers.Dummy.Empty_Database'Access; Options : SQL.Options.SQL_Options; end record; -- overriding procedure Adjust (Self : in out SQL_Database); -- Increments reference counter of shared object. overriding procedure Finalize (Self : in out SQL_Database); -- Decrements reference counter of shared object. end SQL.Databases;
stcarrez/ada-security
Ada
994
ads
----------------------------------------------------------------------- -- Security testsuite - Ada Security Test suite -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Security.Testsuite is function Suite return Util.Tests.Access_Test_Suite; end Security.Testsuite;
AaronC98/PlaneSystem
Ada
54,965
adb
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2000-2018, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; with Ada.Characters.Handling; with Ada.Exceptions; with Ada.Strings.Fixed; with Ada.Unchecked_Deallocation; with AWS.Client.XML.Input_Sources; with DOM.Core.Nodes; with Input_Sources.Strings; with Sax.Readers; with Unicode.CES.Utf8; with SOAP.Message.Reader; with SOAP.Message.Response.Error; with SOAP.Name_Space; with SOAP.Types.Untyped; with SOAP.Utils; with SOAP.XML; package body SOAP.Message.XML is use Ada; use DOM.Core.Nodes; use SOAP.Message.Reader; NL : constant String := ASCII.CR & ASCII.LF; XML_Header : constant String := "<?xml version='1.0' encoding='UTF-8'?>"; -- Alternate URLs URL_xsd : constant String := "http://www.w3.org/1999/XMLSchema"; URL_xsi : constant String := "http://www.w3.org/1999/XMLSchema-instance"; type Type_State is (Void, T_Undefined, T_Any_Type, T_Int, T_Float, T_Double, T_Long, T_Short, T_Byte, T_Unsigned_Long, T_Unsigned_Int, T_Unsigned_Short, T_Unsigned_Byte, T_String, T_Boolean, T_Time_Instant, T_Date_Time, T_Base64, T_Base64_Bin, T_Enum); type Namespaces is record xsd : SOAP.Name_Space.Object := SOAP.Name_Space.XSD; xsi : SOAP.Name_Space.Object := SOAP.Name_Space.XSI; enc : SOAP.Name_Space.Object := SOAP.Name_Space.SOAPENC; env : SOAP.Name_Space.Object := SOAP.Name_Space.SOAPENV; User : NS_Set; Index : Natural := 0; end record; type State is record Name_Space : SOAP.Name_Space.Object; Wrapper_Name : Unbounded_String; Parameters : SOAP.Parameters.List; A_State : Type_State := Void; -- array element type NS : Namespaces; Strict : Boolean := True; Style : WSDL.Schema.Binding_Style := WSDL.Schema.RPC; Encoding : WSDL.Schema.Encoding_Style := WSDL.Schema.Encoded; Schema : WSDL.Schema.Definition; end record; function To_Type (Type_Name : String; NS : Namespaces; Schema : WSDL.Schema.Definition) return Type_State; -- Given the Type_Name and the namespaces return the proper type procedure Load_XML (Input : in out Input_Sources.Input_Source'Class; S : in out State); -- Load XML document, set State and ensure the document is freed when an -- exception occurs. The Input source is closed before returning. procedure Parse_Namespaces (N : DOM.Core.Node; NS : in out Namespaces); -- Read namespaces from node and set NS accordingly function Get_Namespace_Value (NS : Namespaces; Name : String) return String; -- Returns the user's namspace value for the given namespace name function Get_Namespace_Object (NS : Namespaces; Name : String) return SOAP.Name_Space.Object; -- Returns the user namespace for the given name procedure Parse_Document (N : DOM.Core.Node; S : in out State); procedure Parse_Envelope (N : DOM.Core.Node; S : in out State); procedure Parse_Header (N : DOM.Core.Node; S : in out State); procedure Parse_Body (N : DOM.Core.Node; S : in out State); procedure Parse_Wrapper (N : DOM.Core.Node; S : in out State); -- Parse routines for specific types function Parse_Any_Type (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Long (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Int (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Short (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Byte (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Float (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Double (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_String (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Boolean (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Base64 (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Unsigned_Long (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Unsigned_Int (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Unsigned_Short (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Unsigned_Byte (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Untyped (Name : String; N : DOM.Core.Node) return Types.Object'Class; -- Parse a node whose type is unknown. This is used to workaround the fact -- that AWS parser is not aware of the WSDL schema. function Parse_Time_Instant (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; function Parse_Param (N : DOM.Core.Node; Q_Name : String; S : in out State) return Types.Object'Class; function Parse_Array (Name : String; N : DOM.Core.Node; Q_Name : String; S : in out State) return Types.Object'Class; function Parse_Record (Name : String; N : DOM.Core.Node; Q_Name : String; S : in out State) return Types.Object'Class; function Parse_Enumeration (Name : String; N : DOM.Core.Node; Type_Name : String := "") return Types.Object'Class; procedure Error (Node : DOM.Core.Node; Message : String) with No_Return; -- Raises SOAP_Error with the Message as exception message Null_String : constant String := (1 => ASCII.NUL); function Get_Schema_Type (Type_Name : String; Schema : WSDL.Schema.Definition; NS : Namespaces; Default : String := Null_String) return String; -- Returns the type definition as found in the schema. Check for a possible -- prefix change, that is n1:type_name can be named n2:type_name if n1 and -- n2 are in fact the same name-space (same URL). If there is no prefix -- or the definition is not found then the default value is returned if -- defined, otherwise Type_Name is returned as-is. type Parse_Type is access function (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class; type Type_Handler is record Name : access constant String; Handler : Parse_Type; Encoded : Boolean; -- True if based on soap-enc namespaces end record; Handlers : constant array (Type_State) of Type_Handler := (Void => (null, null, False), T_Undefined => (Types.XML_Undefined'Access, null, False), T_Any_Type => (Types.XML_Any_Type'Access, Parse_Any_Type'Access, False), T_Long => (Types.XML_Long'Access, Parse_Long'Access, False), T_Int => (Types.XML_Int'Access, Parse_Int'Access, False), T_Short => (Types.XML_Short'Access, Parse_Short'Access, False), T_Byte => (Types.XML_Byte'Access, Parse_Byte'Access, False), T_Float => (Types.XML_Float'Access, Parse_Float'Access, False), T_Double => (Types.XML_Double'Access, Parse_Double'Access, False), T_String => (Types.XML_String'Access, Parse_String'Access, False), T_Enum => (null, null, False), T_Boolean => (Types.XML_Boolean'Access, Parse_Boolean'Access, False), T_Base64 => (Types.XML_Base64'Access, Parse_Base64'Access, True), T_Base64_Bin => (Types.XML_Base64_Binary'Access, Parse_Base64'Access, True), T_Unsigned_Long => (Types.XML_Unsigned_Long'Access, Parse_Unsigned_Long'Access, False), T_Unsigned_Int => (Types.XML_Unsigned_Int'Access, Parse_Unsigned_Int'Access, False), T_Unsigned_Short => (Types.XML_Unsigned_Short'Access, Parse_Unsigned_Short'Access, False), T_Unsigned_Byte => (Types.XML_Unsigned_Byte'Access, Parse_Unsigned_Byte'Access, False), T_Date_Time => (Types.XML_Date_Time'Access, Parse_Time_Instant'Access, False), T_Time_Instant => (Types.XML_Time_Instant'Access, Parse_Time_Instant'Access, False)); type Object_Set_Access is access Types.Object_Set; procedure Unchecked_Free is new Unchecked_Deallocation (Types.Object_Set, Object_Set_Access); procedure Add_Object (Set : in out Object_Set_Access; Position : Positive; Object : Types.Object_Safe_Pointer; Growth : Positive) with Inline, Pre => Set /= null; -- Adds Object into Set, reallocate Set if needed. The reallocated Set -- array will have Growth more item's slot. ---------------- -- Add_Object -- ---------------- procedure Add_Object (Set : in out Object_Set_Access; Position : Positive; Object : Types.Object_Safe_Pointer; Growth : Positive) is Old : Object_Set_Access; begin if Position > Set'Last then Old := Set; Set := new Types.Object_Set (1 .. Positive'Max (Set'Length + Growth, Position)); Set (1 .. Old'Length) := Old.all; Unchecked_Free (Old); end if; Set (Position) := Object; end Add_Object; ----------- -- Error -- ----------- procedure Error (Node : DOM.Core.Node; Message : String) is Name : constant String := Local_Name (Node); begin raise SOAP_Error with Name & " - " & Message; end Error; -------------------------- -- Get_Namespace_Object -- -------------------------- function Get_Namespace_Object (NS : Namespaces; Name : String) return SOAP.Name_Space.Object is begin for K in 1 .. NS.Index loop if SOAP.Name_Space.Name (NS.User (K)) = Name then return NS.User (K); end if; end loop; return SOAP.Name_Space.No_Name_Space; end Get_Namespace_Object; ------------------------- -- Get_Namespace_Value -- ------------------------- function Get_Namespace_Value (NS : Namespaces; Name : String) return String is begin for K in 1 .. NS.Index loop if SOAP.Name_Space.Name (NS.User (K)) = Name then return SOAP.Name_Space.Value (NS.User (K)); end if; end loop; return ""; end Get_Namespace_Value; ---------------- -- Get_Schema -- ---------------- function Get_Schema_Type (Type_Name : String; Schema : WSDL.Schema.Definition; NS : Namespaces; Default : String := Null_String) return String is begin if Schema.Contains (Type_Name) then -- The type_name is found in the schema, returns the corresponding -- type definition. return Schema (Type_Name); end if; declare P : constant String := Utils.NS (Type_Name); I : constant Natural := Strings.Fixed.Index (Type_Name, "."); Prefix : constant String := (if I > 0 then Type_Name (Type_Name'First .. I - 1) else ""); begin if Prefix /= "" and then Schema.Contains (Prefix) and then Schema.Contains (Schema (Prefix) & Type_Name (I .. Type_Name'Last)) then -- We have a type-name Prefix.Name, Prefix is found in the schema, -- so check for : Value (PREFIX).Name. As Name could be a field -- in a procedure parameter which is a record. And we have the -- definition for the record's fields. return Schema (Schema (Prefix) & Type_Name (I .. Type_Name'Last)); elsif Prefix /= "" and then Schema.Contains (Type_Name (I + 1 .. Type_Name'Last)) then return Schema (Type_Name (I + 1 .. Type_Name'Last)); elsif P = "" then -- We have no prefix, just return the type or the default value return (if Default = Null_String then Type_Name else Default); else -- We have a prefix n1:name, we want to check for a possible -- n2:name definition as n1 could have been renamed n2. declare use type SOAP.Name_Space.Object; Result : Unbounded_String := To_Unbounded_String (if Default = Null_String then Type_Name else Default); begin -- Get URL for NS prefix P for K in NS.User'Range loop if NS.User (K) /= SOAP.Name_Space.No_Name_Space then if SOAP.Name_Space.Name (NS.User (K)) = P then -- We have found the definition for n1 if Schema.Contains (SOAP.Name_Space.Value (NS.User (K))) then -- The URL for the name-space is defined if Schema.Contains (Utils.With_NS (Schema (SOAP.Name_Space.Value (NS.User (K))), Type_Name)) then -- And we have n2:name also defined, that is the -- definition we are looking for. Result := To_Unbounded_String (Schema (Utils.With_NS (Schema (SOAP.Name_Space.Value (NS.User (K))), Type_Name))); exit; end if; end if; end if; else exit; end if; end loop; return To_String (Result); end; end if; end; end Get_Schema_Type; ----------- -- Image -- ----------- function Image (O : Object'Class; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return String is begin return To_String (XML.Image (O, Schema)); end Image; ----------- -- Image -- ----------- function Image (O : Object'Class; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return Unbounded_String is Message_Body : Unbounded_String; function Get_NS (URL, Default : String) return String; -- Returns the name-space as defined in the schema for the given URL or -- default if not found. ------------ -- Get_NS -- ------------ function Get_NS (URL, Default : String) return String is begin if Schema.Contains (URL) then return "xmlns:" & Schema (URL) & "=""" & URL & '"'; else return Default; end if; end Get_NS; -- Name spaces NS_Enc : constant SOAP.Name_Space.Object := SOAP.Name_Space.Create ("encodingStyle", SOAP.Name_Space.SOAPENC_URL, Prefix => SOAP.Name_Space.Name (O.env)); SOAPENV : constant String := SOAP.Name_Space.Name (O.env); Start_Env : constant String := "<" & SOAPENV & ":Envelope"; End_Env : constant String := "</" & SOAPENV & ":Envelope>"; Start_Body : constant String := "<" & SOAPENV & ":Body"; End_Body : constant String := "</" & SOAPENV & ":Body>"; begin -- Header Append (Message_Body, XML_Header & NL); -- Add environment Append (Message_Body, Start_Env & ' ' & SOAP.Name_Space.Image (NS_Enc) & ' ' & Get_NS (SOAP.Name_Space.SOAPENC_URL, SOAP.Name_Space.Image (O.enc)) & ' ' & Get_NS (SOAP.Name_Space.SOAPENV_URL, SOAP.Name_Space.Image (O.env)) & ' ' & Get_NS (SOAP.Name_Space.XSD_URL, SOAP.Name_Space.Image (O.xsd)) & ' ' & Get_NS (SOAP.Name_Space.XSI_URL, SOAP.Name_Space.Image (O.xsi)) & '>' & NL); -- Body Append (Message_Body, Start_Body); -- Wrapper Append (Message_Body, Message.XML_Image (O, Schema)); -- End of Body and Envelope Append (Message_Body, End_Body & NL); Append (Message_Body, End_Env & NL); return Message_Body; end Image; ------------------ -- Load_Payload -- ------------------ function Load_Payload (XML : aliased String; Envelope : Boolean := True; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return Message.Payload.Object is use Input_Sources.Strings; Source : String_Input; S : State; begin Open (XML'Unchecked_Access, Unicode.CES.Utf8.Utf8_Encoding, Source); S.Strict := Envelope; S.Schema := Schema; S.Style := WSDL.Schema.Get_Binding_Style (Schema); Load_XML (Source, S); Close (Source); return Message.Payload.Build (To_String (S.Wrapper_Name), S.Parameters, S.Name_Space); end Load_Payload; function Load_Payload (XML : Unbounded_String; Envelope : Boolean := True; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return Message.Payload.Object is XML_Str : String_Access := new String (1 .. Length (XML)); begin for I in 1 .. Length (XML) loop XML_Str (I) := Element (XML, I); end loop; return O : constant Message.Payload.Object := Load_Payload (XML_Str.all, Envelope, Schema) do Free (XML_Str); end return; exception when others => Free (XML_Str); raise; end Load_Payload; ------------------- -- Load_Response -- ------------------- function Load_Response (Connection : AWS.Client.HTTP_Connection; Envelope : Boolean := True; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return Message.Response.Object'Class is use AWS.Client.XML.Input_Sources; Source : HTTP_Input; S : State; begin Create (Connection, Source); S.Strict := Envelope; S.Schema := Schema; S.Style := WSDL.Schema.Get_Binding_Style (Schema); Load_XML (Source, S); Close (Source); if SOAP.Parameters.Exist (S.Parameters, "faultcode") then return Message.Response.Error.Build (Faultcode => Message.Response.Error.Faultcode (String'(SOAP.Parameters.Get (S.Parameters, "faultcode"))), Faultstring => SOAP.Parameters.Get (S.Parameters, "faultstring")); else return Message.Response.Object' (Message.Object'(S.Name_Space, S.Wrapper_Name, S.Parameters, S.NS.xsd, S.NS.xsi, S.NS.enc, S.NS.env, S.NS.User, S.NS.Index) with null record); end if; exception when E : others => return Message.Response.Error.Build (Faultcode => Message.Response.Error.Client, Faultstring => Exceptions.Exception_Message (E)); end Load_Response; function Load_Response (XML : aliased String; Envelope : Boolean := True; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return Message.Response.Object'Class is use Input_Sources.Strings; Source : String_Input; S : State; begin Open (XML'Unchecked_Access, Unicode.CES.Utf8.Utf8_Encoding, Source); S.Strict := Envelope; S.Schema := Schema; S.Style := WSDL.Schema.Get_Binding_Style (Schema); Load_XML (Source, S); Close (Source); if SOAP.Parameters.Exist (S.Parameters, "faultcode") then return Message.Response.Error.Build (Faultcode => Message.Response.Error.Faultcode (String'(SOAP.Parameters.Get (S.Parameters, "faultcode"))), Faultstring => SOAP.Parameters.Get (S.Parameters, "faultstring")); else return Message.Response.Object' (Message.Object'(S.Name_Space, S.Wrapper_Name, S.Parameters, S.NS.xsd, S.NS.xsi, S.NS.enc, S.NS.env, S.NS.User, S.NS.Index) with null record); end if; exception when E : others => return Message.Response.Error.Build (Faultcode => Message.Response.Error.Client, Faultstring => Exceptions.Exception_Message (E)); end Load_Response; function Load_Response (XML : Unbounded_String; Envelope : Boolean := True; Schema : WSDL.Schema.Definition := WSDL.Schema.Empty) return Message.Response.Object'Class is S : String_Access := new String (1 .. Length (XML)); begin -- Copy XML content to local S string for I in 1 .. Length (XML) loop S (I) := Element (XML, I); end loop; declare Result : constant Message.Response.Object'Class := Load_Response (S.all, Envelope, Schema); begin Free (S); return Result; end; end Load_Response; -------------- -- Load_XML -- -------------- procedure Load_XML (Input : in out Input_Sources.Input_Source'Class; S : in out State) is Reader : Tree_Reader; Doc : DOM.Core.Document; begin -- If True, xmlns:* attributes will be reported in Start_Element Set_Feature (Reader, Sax.Readers.Namespace_Prefixes_Feature, True); Set_Feature (Reader, Sax.Readers.Validation_Feature, False); Parse (Reader, Input); Doc := Get_Tree (Reader); Parse_Document (Doc, S); Free (Doc); exception when others => Doc := Get_Tree (Reader); Free (Doc); raise; end Load_XML; -------------------- -- Parse_Any_Type -- -------------------- function Parse_Any_Type (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is begin -- ??? We have no type information, in this implementation we map the -- value into a xsd:string. return Parse_String (Name, Type_Name, N); end Parse_Any_Type; ----------------- -- Parse_Array -- ----------------- function Parse_Array (Name : String; N : DOM.Core.Node; Q_Name : String; S : in out State) return Types.Object'Class is use SOAP.Types; use type DOM.Core.Node; function Get_Type_Name return String; -- Returns the array type name function Get_Item_Name return String; -- Returns the item name in the array ------------------- -- Get_Item_Name -- ------------------- function Get_Item_Name return String is Item : constant DOM.Core.Node := SOAP.XML.First_Child (N); begin if Item = null then return "item"; else return Local_Name (Item); end if; end Get_Item_Name; LQ_Name : constant String := (if Q_Name = "" then Name else Q_Name & '.' & Name); ------------------- -- Get_Type_Name -- ------------------- function Get_Type_Name return String is use type WSDL.Schema.Encoding_Style; begin if S.Encoding = WSDL.Schema.Literal then declare Item_Name : constant String := LQ_Name & '.' & Get_Item_Name; begin if S.Schema.Contains (Item_Name) then return S.Schema.Element (Item_Name); else return ""; end if; end; else declare function Item_Type (Name : String) return String with Inline; -- Returns the array's item type, remove [] if present --------------- -- Item_Type -- --------------- function Item_Type (Name : String) return String is N : constant Positive := Strings.Fixed.Index (Name, "["); begin return Name (Name'First .. N - 1); end Item_Type; Atts : constant DOM.Core.Named_Node_Map := Attributes (N); A_Name : constant String := SOAP.Name_Space.Name (S.NS.enc) & ":arrayType"; begin return Item_Type (Node_Value (Get_Named_Item (Atts, A_Name))); end; end if; end Get_Type_Name; LS : constant State := S; OS : Object_Set_Access := new Object_Set (1 .. 512); K : Natural := 0; A : Types.SOAP_Array; Field : DOM.Core.Node; begin Parse_Namespaces (N, S.NS); declare Type_Name : constant String := Get_Type_Name; A_Type : constant Type_State := To_Type (Type_Name, S.NS, S.Schema); begin Field := SOAP.XML.First_Child (N); -- Set state for the enclosing elements S.A_State := A_Type; while Field /= null loop K := K + 1; Add_Object (OS, K, +Parse_Param (Field, LQ_Name, S), 256); Field := Next_Sibling (Field); end loop; -- Restore state S.A_State := LS.A_State; A := Types.A (OS (1 .. K), Name, Type_Name); Unchecked_Free (OS); return A; end; end Parse_Array; ------------------ -- Parse_Base64 -- ------------------ function Parse_Base64 (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is use type DOM.Core.Node; Value : DOM.Core.Node; begin Normalize (N); Value := First_Child (N); if Value = null then -- No node found, this is an empty Base64 content return Types.B64 ("", Name, Type_Name); else return Types.B64 (Node_Value (Value), Name, Type_Name); end if; end Parse_Base64; ---------------- -- Parse_Body -- ---------------- procedure Parse_Body (N : DOM.Core.Node; S : in out State) is use type WSDL.Schema.Binding_Style; begin Parse_Namespaces (N, S.NS); if S.Style = WSDL.Schema.RPC then Parse_Wrapper (SOAP.XML.First_Child (N), S); else -- When on Document style the actual procedure to call is given -- by the signature of the procedure. That is the set of procedure -- parameter name give the procedure to call. -- -- So two calls cannot have the same signatures, that is why such -- WSDL are using a parameter based on the actual call to be done. -- -- We should compute the signature first as we need to know the -- actual procedure name to be able to get the encoding style -- (literal/encoded). We also need to know the procedure name as -- it is used as a prefix to the parameters to get the type in the -- schema. Compute_Signature : declare use type DOM.Core.Node; P : DOM.Core.Node := SOAP.XML.First_Child (N); Signature : Unbounded_String; begin while P /= null loop if Signature /= Null_Unbounded_String then Append (Signature, ":"); end if; Append (Signature, Utils.No_NS (Node_Name (P))); P := SOAP.XML.Next_Sibling (P); end loop; -- Get SOAP call for this specific signature S.Wrapper_Name := Signature; end Compute_Signature; -- Document style is always literal S.Encoding := WSDL.Schema.Literal; declare use SOAP.Parameters; use type DOM.Core.Node; P : DOM.Core.Node := SOAP.XML.First_Child (N); begin while P /= null loop S.Parameters := S.Parameters & Parse_Param (P, "", S); P := SOAP.XML.Next_Sibling (P); end loop; end; end if; end Parse_Body; ------------------- -- Parse_Boolean -- ------------------- function Parse_Boolean (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin if Node_Value (Value) = "1" or else Node_Value (Value) = "true" or else Node_Value (Value) = "TRUE" then return Types.B (True, Name); else -- ??? we should check for wrong boolean value return Types.B (False, Name, Type_Name); end if; end Parse_Boolean; ---------------- -- Parse_Byte -- ---------------- function Parse_Byte (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.B (Types.Byte'Value (Node_Value (Value)), Name, Type_Name); end Parse_Byte; -------------------- -- Parse_Document -- -------------------- procedure Parse_Document (N : DOM.Core.Node; S : in out State) is NL : constant DOM.Core.Node_List := Child_Nodes (N); begin if Length (NL) = 1 then Parse_Envelope (SOAP.XML.First_Child (N), S); else Error (N, "Document must have a single node, found " & Natural'Image (Length (NL))); end if; end Parse_Document; ------------------ -- Parse_Double -- ------------------ function Parse_Double (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.D (Long_Float'Value (Node_Value (Value)), Name, Type_Name); end Parse_Double; ----------------------- -- Parse_Enumeration -- ----------------------- function Parse_Enumeration (Name : String; N : DOM.Core.Node; Type_Name : String := "") return Types.Object'Class is begin return Types.E (Node_Value (First_Child (N)), (if Type_Name = "" then Utils.No_NS (SOAP.XML.Get_Attr_Value (N, "type")) else Type_Name), Name); end Parse_Enumeration; -------------------- -- Parse_Envelope -- -------------------- procedure Parse_Envelope (N : DOM.Core.Node; S : in out State) is NL : constant DOM.Core.Node_List := Child_Nodes (N); begin Parse_Namespaces (N, S.NS); if Local_Name (N) /= "Envelope" then if S.Strict then Error (N, "Root tag local name have to be 'Envelope', but '" & Local_Name (N) & "' found."); else Parse_Wrapper (N, S); end if; elsif Length (NL) = 1 then -- This must be the body Parse_Body (SOAP.XML.First_Child (N), S); elsif Length (NL) = 2 then -- The first child must the header tag Parse_Header (SOAP.XML.First_Child (N), S); -- The second child must be the body Parse_Body (SOAP.XML.Next_Sibling (First_Child (N)), S); else Error (N, "Envelope must have at most two nodes, found " & Natural'Image (Length (NL))); end if; end Parse_Envelope; ----------------- -- Parse_Float -- ----------------- function Parse_Float (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.F (Float'Value (Node_Value (Value)), Name, Type_Name); end Parse_Float; ------------------ -- Parse_Header -- ------------------ procedure Parse_Header (N : DOM.Core.Node; S : in out State) is pragma Unreferenced (S); Name : constant String := Local_Name (N); begin if Ada.Characters.Handling.To_Lower (Name) /= "header" then Error (N, "Header node expected, found " & Name); end if; end Parse_Header; --------------- -- Parse_Int -- --------------- function Parse_Int (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.I (Integer'Value (Node_Value (Value)), Name, Type_Name); end Parse_Int; ---------------- -- Parse_Long -- ---------------- function Parse_Long (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.L (Types.Long'Value (Node_Value (Value)), Name, Type_Name); end Parse_Long; ---------------------- -- Parse_Namespaces -- ---------------------- procedure Parse_Namespaces (N : DOM.Core.Node; NS : in out Namespaces) is Atts : constant DOM.Core.Named_Node_Map := Attributes (N); begin for K in 0 .. Length (Atts) - 1 loop declare N : constant DOM.Core.Node := Item (Atts, K); Name : constant String := Node_Name (N); Value : constant String := Node_Value (N); begin if Utils.NS (Name) = "xmlns" then if Value = URL_xsd or else Value = SOAP.Name_Space.XSD_URL then NS.xsd := SOAP.Name_Space.Create (Utils.No_NS (Name), Value); elsif Value = URL_xsi or else Value = SOAP.Name_Space.XSI_URL then NS.xsi := SOAP.Name_Space.Create (Utils.No_NS (Name), Value); elsif Value = SOAP.Name_Space.SOAPENC_URL then NS.enc := SOAP.Name_Space.Create (Utils.No_NS (Name), Value); elsif Value = SOAP.Name_Space.SOAPENV_URL then NS.env := SOAP.Name_Space.Create (Utils.No_NS (Name), Value); elsif NS.Index < NS.User'Last then NS.Index := NS.Index + 1; NS.User (NS.Index) := SOAP.Name_Space.Create (Utils.No_NS (Name), Value); end if; end if; end; end loop; end Parse_Namespaces; ----------------- -- Parse_Param -- ----------------- function Parse_Param (N : DOM.Core.Node; Q_Name : String; S : in out State) return Types.Object'Class is use type DOM.Core.Node; use type DOM.Core.Node_Types; use type SOAP.Types.Encoding_Style; function Is_Array return Boolean; -- Returns True if N is an array node function Is_Record return Boolean; -- Returns True if N is a record node function With_NS (O : Types.Object'Class; NS : SOAP.Name_Space.Object) return Types.Object'Class; -- Retruns O with the associated name-space Name : constant String := Local_Name (N); LQ_Name : constant String := (if Q_Name = "" then Name else Q_Name & '.' & Name); Key : constant String := LQ_Name & "@is_a"; Ref : constant DOM.Core.Node := SOAP.XML.Get_Ref (N); Atts : constant DOM.Core.Named_Node_Map := Attributes (Ref); -------------- -- Is_Array -- -------------- function Is_Array return Boolean is XSI_Type : constant DOM.Core.Node := Get_Named_Item (Atts, SOAP.Name_Space.Name (S.NS.xsi) & ":type"); SOAP_Enc : constant DOM.Core.Node := Get_Named_Item (Atts, SOAP.Name_Space.Name (S.NS.enc) & ":arrayType"); begin return (S.Schema.Contains (Key) and then S.Schema.Element (Key) = "@array") or else -- Either we have xsi:type="soapenc:Array" (XSI_Type /= null and then Utils.No_NS (Node_Value (XSI_Type)) = "Array") or else -- or soapenc:arrayType="..." SOAP_Enc /= null; end Is_Array; --------------- -- Is_Record -- --------------- function Is_Record return Boolean is begin return S.Schema.Contains (Key) and then S.Schema.Element (Key) = "@record"; end Is_Record; ------------- -- With_NS -- ------------- function With_NS (O : Types.Object'Class; NS : SOAP.Name_Space.Object) return Types.Object'Class is use type SOAP.Name_Space.Object; L : Types.Object'Class := O; begin if NS /= SOAP.Name_Space.No_Name_Space then Types.Set_Name_Space (L, NS); end if; return L; end With_NS; S_Type : constant DOM.Core.Node := Get_Named_Item (Atts, "type"); XSI_Type : DOM.Core.Node; xsd : Unbounded_String; NS : SOAP.Name_Space.Object := SOAP.Name_Space.No_Name_Space; begin Parse_Namespaces (Ref, S.NS); if S.Encoding = WSDL.Schema.Encoded then XSI_Type := Get_Named_Item (Atts, SOAP.Name_Space.Name (S.NS.xsi) & ":type"); if XSI_Type /= null then xsd := To_Unbounded_String (Node_Value (XSI_Type)); end if; else xsd := To_Unbounded_String (Get_Schema_Type (Key, S.Schema, S.NS, "")); end if; NS := Get_Namespace_Object (S.NS, Utils.NS (To_String (xsd))); if To_String (S.Wrapper_Name) = "Fault" then return Parse_String (Name, Types.XML_String, Ref); elsif Is_Array then return Parse_Array (Name, Ref, Q_Name, S); elsif Is_Record then return Parse_Record (Name, Ref, Q_Name, S); else if XSI_Type = null and then xsd = Null_Unbounded_String and then S.A_State in Void .. T_Undefined then -- No xsi:type attribute found if Get_Named_Item (Atts, SOAP.Name_Space.Name (S.NS.xsi) & ":null") /= null then return Types.N (Name); elsif S_Type /= null and then First_Child (Ref).Node_Type = DOM.Core.Text_Node then -- Not xsi:type but a type information, the child being a text -- node, this is an enumeration. return Parse_Enumeration (Name, Ref); elsif First_Child (Ref) = null then -- We have an emtpy node, return an empty string in this case -- otherwise we will create an empty record in the else section -- below. return Types.Untyped.S ("", Name); elsif First_Child (Ref).Node_Type = DOM.Core.Text_Node then -- No xsi:type and no type information. Children are some kind -- of text data, so this is a data node with no type -- information. Note that this code is to workaround an -- interoperability problem found with gSOAP and Microsoft SOAP -- implementation based on WSDL were the type information is -- not provided into the payload but only on the WSDL file. As -- AWS/SOAP parser is not WSDL compliant at this point we -- record such type as undefined. Later the value will be -- converted to to right type when read by one of the -- Types.Get routine. Note that this code is only there to -- parse data received from a SOAP server. AWS/SOAP always send -- type information into the payload. return Parse_Untyped (Name, Ref); else -- This is a type defined in a schema, either a SOAP record -- or an enumeration, enumerations will be checked into -- Parse record. -- This is a SOAP record, we have no attribute and no -- type defined. We have a single tag "<name>" which can -- only be the start or a record. return Parse_Record (Name, Ref, Q_Name, S); end if; else declare S_xsd : constant String := To_String (xsd); S_Type : constant Type_State := To_Type (S_xsd, S.NS, S.Schema); begin if S_Type = T_Undefined then -- Not a known basic type, let's try to parse a -- record object. This implemtation does not -- support schema so there is no way to check -- for the real type here. return Parse_Record (Name, Ref, Q_Name, S); elsif S_Type = T_Enum then return Parse_Enumeration (Name, Ref, S_xsd); else return With_NS (Handlers (S_Type).Handler (Name, S_xsd, Ref), NS); end if; end; end if; end if; end Parse_Param; ------------------ -- Parse_Record -- ------------------ function Parse_Record (Name : String; N : DOM.Core.Node; Q_Name : String; S : in out State) return Types.Object'Class is use SOAP.Types; use type DOM.Core.Node; use type DOM.Core.Node_Types; use type WSDL.Schema.Binding_Style; LQ_Name : constant String := (if Q_Name = "" then Name else Q_Name & '.' & Name); Key : constant String := LQ_Name & "@is_a"; Field : DOM.Core.Node := SOAP.XML.Get_Ref (N); xsd : constant String := SOAP.XML.Get_Attr_Value (Field, SOAP.Name_Space.Name (S.NS.xsi) & ":type"); -- The record fields temporary store OS : Object_Set_Access := new Object_Set (1 .. 50); K : Natural := 0; T_Name : Unbounded_String; -- record's type name LS : constant State := S; begin if S.Style = WSDL.Schema.Document then -- This should be done only for document style binding where the -- enclosing element is the type-name (aka element in schema). T_Name := To_Unbounded_String (Name); elsif xsd = "" then T_Name := To_Unbounded_String (Get_Schema_Type (Key, S.Schema, S.NS, xsd)); else T_Name := To_Unbounded_String (xsd); end if; if Name /= Local_Name (N) and then First_Child (Field).Node_Type = DOM.Core.Text_Node then -- This is not a record after all, it is an enumeration with an href -- A record can't have a text child node. return Types.E (Node_Value (First_Child (Field)), Utils.No_NS (To_String (T_Name)), Name); else Field := SOAP.XML.First_Child (Field); -- Set state for the enclosing elements S.A_State := Void; while Field /= null loop K := K + 1; Add_Object (OS, K, +Parse_Param (Field, LQ_Name, S), 25); Field := Next_Sibling (Field); end loop; -- Restore state S.A_State := LS.A_State; declare NS : constant SOAP.Name_Space.Object := Get_Namespace_Object (S.NS, Utils.NS (To_String (T_Name))); R : Types.SOAP_Record; begin R := Types.R (OS (1 .. K), Name, Utils.No_NS (To_String (T_Name)), NS); Unchecked_Free (OS); return R; end; end if; end Parse_Record; ----------------- -- Parse_Short -- ----------------- function Parse_Short (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.S (Types.Short'Value (Node_Value (Value)), Name, Type_Name); end Parse_Short; ------------------ -- Parse_String -- ------------------ function Parse_String (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is use type DOM.Core.Node_Types; L : constant DOM.Core.Node_List := Child_Nodes (N); S : Unbounded_String; P : DOM.Core.Node; begin for I in 0 .. Length (L) - 1 loop P := Item (L, I); if P.Node_Type = DOM.Core.Text_Node then Append (S, Node_Value (P)); end if; end loop; return Types.S (S, Name, Type_Name); end Parse_String; ------------------------ -- Parse_Time_Instant -- ------------------------ function Parse_Time_Instant (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); TI : constant String := Node_Value (Value); begin return Utils.Time_Instant (TI, Name, Type_Name); end Parse_Time_Instant; ------------------------- -- Parse_Unsigned_Byte -- ------------------------- function Parse_Unsigned_Byte (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.UB (Types.Unsigned_Byte'Value (Node_Value (Value)), Name, Type_Name); end Parse_Unsigned_Byte; ------------------------ -- Parse_Unsigned_Int -- ------------------------ function Parse_Unsigned_Int (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.UI (Types.Unsigned_Int'Value (Node_Value (Value)), Name, Type_Name); end Parse_Unsigned_Int; ------------------------- -- Parse_Unsigned_Long -- ------------------------- function Parse_Unsigned_Long (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.UL (Types.Unsigned_Long'Value (Node_Value (Value)), Name, Type_Name); end Parse_Unsigned_Long; -------------------------- -- Parse_Unsigned_Short -- -------------------------- function Parse_Unsigned_Short (Name : String; Type_Name : String; N : DOM.Core.Node) return Types.Object'Class is Value : constant DOM.Core.Node := First_Child (N); begin return Types.US (Types.Unsigned_Short'Value (Node_Value (Value)), Name, Type_Name); end Parse_Unsigned_Short; ------------------- -- Parse_Untyped -- ------------------- function Parse_Untyped (Name : String; N : DOM.Core.Node) return Types.Object'Class is use type DOM.Core.Node_Types; L : constant DOM.Core.Node_List := Child_Nodes (N); S : Unbounded_String; P : DOM.Core.Node; begin for I in 0 .. Length (L) - 1 loop P := Item (L, I); if P.Node_Type = DOM.Core.Text_Node then Append (S, Node_Value (P)); end if; end loop; return Types.Untyped.S (S, Name); end Parse_Untyped; ------------------- -- Parse_Wrapper -- ------------------- procedure Parse_Wrapper (N : DOM.Core.Node; S : in out State) is use type DOM.Core.Node_Types; use type SOAP.Parameters.List; NL : constant DOM.Core.Node_List := Child_Nodes (N); Prefix : constant String := DOM.Core.Nodes.Prefix (N); Name : constant String := Local_Name (N); Atts : constant DOM.Core.Named_Node_Map := Attributes (N); begin Parse_Namespaces (N, S.NS); if Prefix /= "" then -- The wrapper has a prefix if Length (Atts) /= 0 then declare use type DOM.Core.Node; xmlns : constant DOM.Core.Node := Get_Named_Item (Atts, "xmlns:" & Prefix); begin if xmlns /= null then S.Name_Space := SOAP.Name_Space.Create (Prefix, Node_Value (xmlns)); end if; end; else -- There is no attribute for this node, yet the wrapper is using -- a name space. S.Name_Space := SOAP.Name_Space.Create (Prefix, Get_Namespace_Value (S.NS, Prefix)); end if; end if; S.Wrapper_Name := To_Unbounded_String (Name); S.Encoding := WSDL.Schema.Get_Encoding_Style (S.Schema, Name); for K in 0 .. Length (NL) - 1 loop if Item (NL, K).Node_Type /= DOM.Core.Text_Node then S.Parameters := S.Parameters & Parse_Param (Item (NL, K), Name, S); end if; end loop; end Parse_Wrapper; ------------- -- To_Type -- ------------- function To_Type (Type_Name : String; NS : Namespaces; Schema : WSDL.Schema.Definition) return Type_State is N_xsd : constant String := SOAP.Name_Space.Name (NS.xsd); N_enc : constant String := SOAP.Name_Space.Name (NS.enc); S_xsd : constant String := (if Schema.Contains (SOAP.Name_Space.XSD_URL) then Schema (SOAP.Name_Space.XSD_URL) else ""); ---------- -- Is_A -- ---------- function Is_A (T1_Name, T2_Name : String; NS : String) return Boolean is (T1_Name = Utils.With_NS (NS, T2_Name)) with Inline; -- Returns True if T1_Name is equal to T2_Name based on namespace T_Name : constant String := Get_Schema_Type (Type_Name, Schema, NS); begin if T_Name = "@enum" then return T_Enum; end if; for K in Handlers'Range loop if Handlers (K).Name /= null and then ((Handlers (K).Encoded and then Is_A (T_Name, Handlers (K).Name.all, N_enc)) -- check name-space in the schema or else Is_A (T_Name, Handlers (K).Name.all, S_xsd) -- then check name-space in the parsed context or else Is_A (T_Name, Handlers (K).Name.all, N_xsd)) then return K; end if; end loop; return T_Undefined; end To_Type; end SOAP.Message.XML;
charlie5/cBound
Ada
1,670
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_delete_lists_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_tag : aliased xcb.xcb_glx_context_tag_t; list : aliased Interfaces.Unsigned_32; the_range : aliased Interfaces.Integer_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_delete_lists_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_delete_lists_request_t.Item, Element_Array => xcb.xcb_glx_delete_lists_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_delete_lists_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_delete_lists_request_t.Pointer, Element_Array => xcb.xcb_glx_delete_lists_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_delete_lists_request_t;
shintakezou/drake
Ada
21,597
adb
with Ada.Exceptions.Finally; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; -- diff (Ada.Streams) with System; package body Ada.Containers.Limited_Ordered_Sets is use type Binary_Trees.Node_Access; -- diff function Upcast is new Unchecked_Conversion (Cursor, Binary_Trees.Node_Access); function Downcast is new Unchecked_Conversion (Binary_Trees.Node_Access, Cursor); -- diff (Upcast) -- -- diff (Downcast) -- procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access); procedure Free is new Unchecked_Deallocation (Node, Cursor); function Compare_Elements (Left, Right : Element_Type) return Integer; function Compare_Elements (Left, Right : Element_Type) return Integer is begin if Left < Right then return -1; elsif Right < Left then return 1; else return 0; end if; end Compare_Elements; type Context_Type is limited record Left : not null access Element_Type; end record; pragma Suppress_Initialization (Context_Type); function Compare_Element ( Position : not null Binary_Trees.Node_Access; Params : System.Address) return Integer; function Compare_Element ( Position : not null Binary_Trees.Node_Access; Params : System.Address) return Integer is Context : Context_Type; for Context'Address use Params; begin return Compare_Elements ( Context.Left.all, Downcast (Position).Element.all); end Compare_Element; function Compare_Node (Left, Right : not null Binary_Trees.Node_Access) return Integer; function Compare_Node (Left, Right : not null Binary_Trees.Node_Access) return Integer is begin return Compare_Elements ( Downcast (Left).Element.all, Downcast (Right).Element.all); end Compare_Node; -- diff (Allocate_Element) -- -- -- -- -- -- -- -- -- diff (Allocate_Node) -- -- -- -- -- -- -- -- -- -- -- diff (Copy_Node) -- -- -- -- -- -- -- -- -- -- -- procedure Free_Node (Object : in out Binary_Trees.Node_Access); procedure Free_Node (Object : in out Binary_Trees.Node_Access) is X : Cursor := Downcast (Object); begin Free (X.Element); Free (X); Object := null; end Free_Node; -- diff (Allocate_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Copy_Data) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Free) procedure Free_Data (Data : in out Set); procedure Free_Data (Data : in out Set) is -- diff begin Binary_Trees.Free (Data.Root, Data.Length, Free => Free_Node'Access); -- diff -- diff end Free_Data; -- diff (Unique) -- -- -- -- -- -- -- -- -- -- -- -- function Equivalent_Sets ( Left, Right : Set; Equivalent : not null access function ( Left, Right : not null Binary_Trees.Node_Access) return Boolean) return Boolean; function Equivalent_Sets ( Left, Right : Set; Equivalent : not null access function ( Left, Right : not null Binary_Trees.Node_Access) return Boolean) return Boolean is Left_Length : constant Count_Type := Length (Left); Right_Length : constant Count_Type := Length (Right); begin if Left_Length /= Right_Length then return False; elsif Left_Length = 0 then return True; else -- diff -- diff return Binary_Trees.Equivalent ( Left.Root, Right.Root, Equivalent => Equivalent); end if; end Equivalent_Sets; -- implementation function Equivalent_Elements (Left, Right : Element_Type) return Boolean is begin return Compare_Elements (Left, Right) = 0; end Equivalent_Elements; function Empty_Set return Set is begin return (Finalization.Limited_Controlled with Root => null, Length => 0); end Empty_Set; function Has_Element (Position : Cursor) return Boolean is begin return Position /= No_Element; end Has_Element; -- diff ("=") -- -- -- -- -- -- -- -- -- -- function Equivalent_Sets (Left, Right : Set) return Boolean is function Equivalent (Left, Right : not null Binary_Trees.Node_Access) return Boolean; function Equivalent (Left, Right : not null Binary_Trees.Node_Access) return Boolean is begin return Equivalent_Elements ( Downcast (Left).Element.all, Downcast (Right).Element.all); end Equivalent; begin return Equivalent_Sets (Left, Right, Equivalent => Equivalent'Access); end Equivalent_Sets; -- diff (To_Set) -- -- -- -- -- -- diff (Generic_Array_To_Set) -- -- -- -- -- -- -- function Length (Container : Set) return Count_Type is -- diff begin -- diff -- diff -- diff return Container.Length; -- diff end Length; function Is_Empty (Container : Set) return Boolean is -- diff begin return Container.Root = null; end Is_Empty; procedure Clear (Container : in out Set) is begin Free_Data (Container); end Clear; -- diff (Element) -- -- -- -- diff (Replace_Element) -- -- -- -- -- -- -- -- procedure Query_Element ( Position : Cursor; Process : not null access procedure (Element : Element_Type)) is begin Process (Position.Element.all); end Query_Element; function Constant_Reference (Container : aliased Set; Position : Cursor) return Constant_Reference_Type is pragma Unreferenced (Container); begin return (Element => Position.Element.all'Access); end Constant_Reference; -- diff (Assign) -- -- -- -- -- -- -- diff (Copy) -- -- -- -- -- -- -- -- -- procedure Move (Target : in out Set; Source : in out Set) is begin if Target.Root /= Source.Root then Clear (Target); Target.Root := Source.Root; Target.Length := Source.Length; Source.Root := null; Source.Length := 0; end if; end Move; procedure Insert ( Container : in out Set'Class; New_Item : not null access function return Element_Type; Position : out Cursor; Inserted : out Boolean) is package Holder is new Exceptions.Finally.Scoped_Holder (Element_Access, Free); New_Element : aliased Element_Access := new Element_Type'(New_Item.all); Before : constant Cursor := Ceiling (Set (Container), New_Element.all); begin Holder.Assign (New_Element); Inserted := Before = null or else New_Element.all < Before.Element.all; if Inserted then Position := new Node'(Super => <>, Element => New_Element); Holder.Clear; -- diff -- diff -- diff Base.Insert ( Container.Root, Container.Length, Upcast (Before), Upcast (Position)); -- diff else Position := Before; end if; end Insert; procedure Insert ( Container : in out Set'Class; New_Item : not null access function return Element_Type) is Position : Cursor; Inserted : Boolean; begin Insert (Container, New_Item, Position, Inserted); if not Inserted then raise Constraint_Error; end if; end Insert; -- diff (Include) -- -- -- -- -- -- -- -- -- diff (Replace) -- -- -- procedure Exclude (Container : in out Set; Item : Element_Type) is Position : Cursor := Find (Container, Item); begin if Position /= null then Delete (Container, Position); end if; end Exclude; procedure Delete (Container : in out Set; Item : Element_Type) is Position : Cursor := Find (Container, Item); begin Delete (Container, Position); end Delete; procedure Delete (Container : in out Set; Position : in out Cursor) is Position_2 : Binary_Trees.Node_Access := Upcast (Position); begin -- diff -- diff -- diff -- diff Base.Remove (Container.Root, Container.Length, Position_2); -- diff Free_Node (Position_2); Position := null; end Delete; procedure Delete_First (Container : in out Set'Class) is Position : Cursor := First (Set (Container)); begin Delete (Set (Container), Position); end Delete_First; procedure Delete_Last (Container : in out Set'Class) is Position : Cursor := Last (Set (Container)); begin Delete (Set (Container), Position); end Delete_Last; -- diff (Union) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Union) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Intersection (Target : in out Set; Source : Set) is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff Base.Merge ( Target.Root, Target.Length, Source.Root, (Binary_Trees.In_Both => True, others => False), Compare => Compare_Node'Access, Copy => null, Free => Free_Node'Access); -- diff -- diff end Intersection; -- diff (Intersection) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- procedure Difference (Target : in out Set; Source : Set) is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff -- diff Base.Merge ( Target.Root, Target.Length, Source.Root, (Binary_Trees.In_Only_Left => True, others => False), Compare => Compare_Node'Access, Copy => null, Free => Free_Node'Access); -- diff -- diff end Difference; -- diff (Difference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Symmetric_Difference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Symmetric_Difference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function Overlap (Left, Right : Set) return Boolean is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff return Binary_Trees.Overlap ( Left.Root, Right.Root, Compare => Compare_Node'Access); -- diff end Overlap; function Is_Subset (Subset : Set; Of_Set : Set) return Boolean is begin -- diff -- diff -- diff -- diff -- diff -- diff -- diff return Binary_Trees.Is_Subset ( Subset.Root, Of_Set.Root, Compare => Compare_Node'Access); -- diff end Is_Subset; function First (Container : Set) return Cursor is begin return Downcast (Binary_Trees.First (Container.Root)); -- diff -- diff -- diff -- diff -- diff -- diff end First; -- diff (First_Element) -- -- -- -- function Last (Container : Set) return Cursor is begin return Downcast (Binary_Trees.Last (Container.Root)); -- diff -- diff -- diff -- diff -- diff -- diff end Last; -- diff (Last_Element) -- -- -- -- function Next (Position : Cursor) return Cursor is begin return Downcast (Binary_Trees.Next (Upcast (Position))); end Next; procedure Next (Position : in out Cursor) is begin Position := Downcast (Binary_Trees.Next (Upcast (Position))); end Next; function Previous (Position : Cursor) return Cursor is begin return Downcast (Binary_Trees.Previous (Upcast (Position))); end Previous; procedure Previous (Position : in out Cursor) is begin Position := Downcast (Binary_Trees.Previous (Upcast (Position))); end Previous; function Find (Container : Set; Item : Element_Type) return Cursor is begin -- diff -- diff -- diff -- diff declare Context : Context_Type := (Left => Item'Unrestricted_Access); begin return Downcast (Binary_Trees.Find ( Container.Root, Binary_Trees.Just, Context'Address, Compare => Compare_Element'Access)); end; -- diff end Find; function Floor (Container : Set; Item : Element_Type) return Cursor is begin -- diff -- diff -- diff -- diff declare Context : Context_Type := (Left => Item'Unrestricted_Access); begin return Downcast (Binary_Trees.Find ( Container.Root, Binary_Trees.Floor, Context'Address, Compare => Compare_Element'Access)); end; -- diff end Floor; function Ceiling (Container : Set; Item : Element_Type) return Cursor is begin -- diff -- diff -- diff -- diff declare Context : Context_Type := (Left => Item'Unrestricted_Access); begin return Downcast (Binary_Trees.Find ( Container.Root, Binary_Trees.Ceiling, Context'Address, Compare => Compare_Element'Access)); end; -- diff end Ceiling; function Contains (Container : Set; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= null; end Contains; function "<" (Left, Right : Cursor) return Boolean is begin return Left /= Right and then Left.Element.all < Right.Element.all; end "<"; function ">" (Left, Right : Cursor) return Boolean is begin return Right < Left; end ">"; function "<" (Left : Cursor; Right : Element_Type) return Boolean is begin return Left.Element.all < Right; end "<"; function ">" (Left : Cursor; Right : Element_Type) return Boolean is begin return Right < Left; end ">"; function "<" (Left : Element_Type; Right : Cursor) return Boolean is begin return Left < Right.Element.all; end "<"; function ">" (Left : Element_Type; Right : Cursor) return Boolean is begin return Right < Left; end ">"; procedure Iterate ( Container : Set'Class; Process : not null access procedure (Position : Cursor)) is type P1 is access procedure (Position : Cursor); type P2 is access procedure (Position : Binary_Trees.Node_Access); function Cast is new Unchecked_Conversion (P1, P2); begin -- diff -- diff Binary_Trees.Iterate ( Container.Root, Cast (Process)); -- diff end Iterate; procedure Reverse_Iterate ( Container : Set'Class; Process : not null access procedure (Position : Cursor)) is type P1 is access procedure (Position : Cursor); type P2 is access procedure (Position : Binary_Trees.Node_Access); function Cast is new Unchecked_Conversion (P1, P2); begin -- diff -- diff Binary_Trees.Reverse_Iterate ( Container.Root, Cast (Process)); -- diff end Reverse_Iterate; function Iterate (Container : Set'Class) return Set_Iterator_Interfaces.Reversible_Iterator'Class is begin return Set_Iterator'( First => First (Set (Container)), Last => Last (Set (Container))); end Iterate; function Iterate (Container : Set'Class; First, Last : Cursor) return Set_Iterator_Interfaces.Reversible_Iterator'Class is pragma Unreferenced (Container); Actual_First : Cursor := First; Actual_Last : Cursor := Last; begin if Actual_First = No_Element or else Actual_Last = No_Element or else Actual_Last < Actual_First then Actual_First := No_Element; Actual_Last := No_Element; end if; return Set_Iterator'(First => Actual_First, Last => Actual_Last); end Iterate; -- diff (Adjust) -- -- -- overriding function First (Object : Set_Iterator) return Cursor is begin return Object.First; end First; overriding function Next (Object : Set_Iterator; Position : Cursor) return Cursor is begin if Position = Object.Last then return No_Element; else return Next (Position); end if; end Next; overriding function Last (Object : Set_Iterator) return Cursor is begin return Object.Last; end Last; overriding function Previous (Object : Set_Iterator; Position : Cursor) return Cursor is begin if Position = Object.First then return No_Element; else return Previous (Position); end if; end Previous; package body Generic_Keys is type Context_Type is limited record Left : not null access Key_Type; end record; pragma Suppress_Initialization (Context_Type); function Compare_Key ( Position : not null Binary_Trees.Node_Access; Params : System.Address) return Integer; function Compare_Key ( Position : not null Binary_Trees.Node_Access; Params : System.Address) return Integer is Context : Context_Type; for Context'Address use Params; Left : Key_Type renames Context.Left.all; Right : Key_Type renames Key (Downcast (Position).Element.all); begin if Left < Right then return -1; elsif Right < Left then return 1; else return 0; end if; end Compare_Key; function Equivalent_Keys (Left, Right : Key_Type) return Boolean is begin return not (Left < Right) and then not (Right < Left); end Equivalent_Keys; function Key (Position : Cursor) return Key_Type is begin return Key (Position.Element.all); end Key; -- diff (Element) -- -- -- -- diff (Replace) -- -- -- -- -- -- procedure Exclude (Container : in out Set; Key : Key_Type) is Position : Cursor := Find (Container, Key); begin if Position /= null then Delete (Container, Position); end if; end Exclude; procedure Delete (Container : in out Set; Key : Key_Type) is Position : Cursor := Find (Container, Key); begin Delete (Container, Position); end Delete; function Find (Container : Set; Key : Key_Type) return Cursor is begin -- diff -- diff -- diff -- diff declare Context : Context_Type := (Left => Key'Unrestricted_Access); begin return Downcast (Binary_Trees.Find ( Container.Root, Binary_Trees.Just, Context'Address, Compare => Compare_Key'Access)); end; -- diff end Find; function Floor (Container : Set; Key : Key_Type) return Cursor is begin -- diff -- diff -- diff -- diff declare Context : Context_Type := (Left => Key'Unrestricted_Access); begin return Downcast (Binary_Trees.Find ( Container.Root, Binary_Trees.Floor, Context'Address, Compare => Compare_Key'Access)); end; -- diff end Floor; function Ceiling (Container : Set; Key : Key_Type) return Cursor is begin -- diff -- diff -- diff -- diff declare Context : Context_Type := (Left => Key'Unrestricted_Access); begin return Downcast (Binary_Trees.Find ( Container.Root, Binary_Trees.Ceiling, Context'Address, Compare => Compare_Key'Access)); end; -- diff end Ceiling; function Contains (Container : Set; Key : Key_Type) return Boolean is begin return Find (Container, Key) /= null; end Contains; procedure Update_Element_Preserving_Key ( Container : in out Set; Position : Cursor; Process : not null access procedure ( Element : in out Element_Type)) is begin Process (Reference_Preserving_Key (Container, Position).Element.all); end Update_Element_Preserving_Key; function Reference_Preserving_Key ( Container : aliased in out Set; Position : Cursor) return Reference_Type is pragma Unreferenced (Container); begin return (Element => Position.Element.all'Access); end Reference_Preserving_Key; function Constant_Reference (Container : aliased Set; Key : Key_Type) return Constant_Reference_Type is begin return Constant_Reference (Container, Find (Container, Key)); end Constant_Reference; function Reference_Preserving_Key ( Container : aliased in out Set; Key : Key_Type) return Reference_Type is begin return Reference_Preserving_Key (Container, Find (Container, Key)); end Reference_Preserving_Key; end Generic_Keys; package body Equivalents is function "=" (Left, Right : Set) return Boolean is function Equivalent (Left, Right : not null Binary_Trees.Node_Access) return Boolean; function Equivalent (Left, Right : not null Binary_Trees.Node_Access) return Boolean is begin return Downcast (Left).Element.all = Downcast (Right).Element.all; end Equivalent; begin return Left.Length = Right.Length and then Binary_Trees.Equivalent ( Left.Root, Right.Root, Equivalent => Equivalent'Access); end "="; end Equivalents; end Ada.Containers.Limited_Ordered_Sets;
kimtg/euler-ada
Ada
1,841
adb
with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure Euler15 is function To_Integer(C : Character) return Integer is (Character'Pos(C) - Character'Pos('0')); function To_String(I : Integer) return String is S : String := Integer'Image(I); begin if I >= 0 then return S(2 .. S'Length); else return S(1 .. S'Length); end if; end; function Digit(A : Unbounded_String; D : Positive) return Natural is begin if D in 1 .. Length(A) then return To_Integer(Element(A, Length(A) - D + 1)); else return 0; end if; end Digit; function "*"(A : Unbounded_String; B : Natural) return Unbounded_String is R : Unbounded_String; Carry : Natural := 0; S : Natural; begin for D in 1 .. Length(A) loop S := Carry + Digit(A, D) * B; R := To_String(S mod 10) & R; Carry := S / 10; end loop; if Carry > 0 then R := To_String(Carry) & R; end if; return R; end "*"; function "/"(A : Unbounded_String; B : Natural) return Unbounded_String is R : Unbounded_String; Carry : Natural := 0; S : Natural; begin for D in 1 .. Length(A) loop S := Digit(A, Length(A) - D + 1) + Carry * 10; Carry := S mod B; S := S / B; if Length(R) > 0 or else S /= 0 then R := R & To_String(S); end if; end loop; return R; end "/"; P : Unbounded_String := To_Unbounded_String("1"); begin -- 40! / 20! / 20! -- = 40(39)..21 / 20! for I in 21 .. 40 loop P := P * I; Put_Line("*" & Integer'Image(I) & " => " & To_String(P)); end loop; for I in reverse 1 .. 20 loop P := P / I; Put_Line("/" & Integer'Image(I) & " => " & To_String(P)); end loop; Put_Line(To_String(P)); end Euler15;
AaronC98/PlaneSystem
Ada
4,246
adb
------------------------------------------------------------------------------ -- Templates Parser -- -- -- -- Copyright (C) 2002-2013, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; -- This is the implementation to be used with AWS, it is using AWS.Resources -- to support embedded resources. with Ada.Unchecked_Deallocation; with AWS.Resources; package body Templates_Parser.Input is type File_Record is new AWS.Resources.File_Type; procedure Check_Open (File : File_Type) with Inline; -- Check if File is opened (File variable is not null) procedure Free is new Ada.Unchecked_Deallocation (File_Record, File_Type); ---------------- -- Check_Open -- ---------------- procedure Check_Open (File : File_Type) is begin if File = null then raise Status_Error; end if; end Check_Open; ----------- -- Close -- ----------- procedure Close (File : in out File_Type) is begin Check_Open (File); Close (File.all); Free (File); end Close; ----------------- -- End_Of_File -- ----------------- function End_Of_File (File : File_Type) return Boolean is begin Check_Open (File); return End_Of_File (File.all); end End_Of_File; -------------- -- Get_Line -- -------------- procedure Get_Line (File : File_Type; Buffer : out String; Last : out Natural) is begin Check_Open (File); Get_Line (File.all, Buffer, Last); end Get_Line; ------------------- -- LF_Terminated -- ------------------- function LF_Terminated (File : File_Type) return Boolean is begin Check_Open (File); return LF_Terminated (File.all); end LF_Terminated; ---------- -- Open -- ---------- procedure Open (File : in out File_Type; Name : String; Form : String := "") is begin if File /= null then Close (File); end if; File := new File_Record; Open (File.all, Name, Form); exception when IO_Exceptions.Name_Error => Free (File); raise Name_Error with "File '" & Name & "' not found."; end Open; end Templates_Parser.Input;
reznikmm/matreshka
Ada
4,578
adb
------------------------------------------------------------------------------ -- -- -- 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$ ------------------------------------------------------------------------------ with AMF.Internals.Factories.CMOF_Factories; with AMF.Internals.Factories.CMOF_Module_Factory; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.CMOF_Metamodel.Objects; with AMF.Internals.Tables.CMOF_Metamodel.Properties; with AMF.Internals.Tables.CMOF_Metamodel.Links; package body AMF.Internals.Modules.CMOF_Module is Module_Factory : aliased AMF.Internals.Factories.CMOF_Module_Factory.CMOF_Module_Factory; Module : AMF_Metamodel; begin -- Register module's factory, it should be registered before initialization -- of metamodel to be able to bootstrap CMOF module. AMF.Internals.Factories.Register (Module_Factory'Access, Module); -- Initialize element table. AMF.Internals.Tables.CMOF_Element_Table.Initialize (Module); -- Initialize metamodel. AMF.Internals.Tables.CMOF_Metamodel.Objects.Initialize; AMF.Internals.Tables.CMOF_Metamodel.Properties.Initialize; AMF.Internals.Tables.CMOF_Metamodel.Links.Initialize; -- Register factory's constructor. AMF.Internals.Factories.Register (AMF.Internals.Factories.CMOF_Factories.Get_Package, AMF.Internals.Factories.CMOF_Factories.Constructor'Access); end AMF.Internals.Modules.CMOF_Module;
zhmu/ananas
Ada
4,029
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . W I D E _ T E X T _ I O . E N U M E R A T I O N _ I O -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Wide_Text_IO.Enumeration_Aux; package body Ada.Wide_Text_IO.Enumeration_IO is package Aux renames Ada.Wide_Text_IO.Enumeration_Aux; --------- -- Get -- --------- procedure Get (File : File_Type; Item : out Enum) is Buf : Wide_String (1 .. Enum'Width); Buflen : Natural; begin Aux.Get_Enum_Lit (File, Buf, Buflen); Item := Enum'Wide_Value (Buf (1 .. Buflen)); exception when Constraint_Error => raise Data_Error; end Get; procedure Get (Item : out Enum) is begin Get (Current_In, Item); end Get; procedure Get (From : Wide_String; Item : out Enum; Last : out Positive) is Start : Natural; begin Aux.Scan_Enum_Lit (From, Start, Last); Item := Enum'Wide_Value (From (Start .. Last)); exception when Constraint_Error => raise Data_Error; end Get; --------- -- Put -- --------- procedure Put (File : File_Type; Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) is Image : constant Wide_String := Enum'Wide_Image (Item); begin Aux.Put (File, Image, Width, Set); end Put; procedure Put (Item : Enum; Width : Field := Default_Width; Set : Type_Set := Default_Setting) is begin Put (Current_Out, Item, Width, Set); end Put; procedure Put (To : out Wide_String; Item : Enum; Set : Type_Set := Default_Setting) is Image : constant Wide_String := Enum'Wide_Image (Item); begin Aux.Puts (To, Image, Set); end Put; end Ada.Wide_Text_IO.Enumeration_IO;
landgraf/nanomsg-ada
Ada
3,984
ads
-- The MIT License (MIT) -- Copyright (c) 2015 Pavel Zhukov <[email protected]> -- 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, 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 -- AUTHORS OR 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. with Nanomsg.Domains; with Nanomsg.Messages; with Nanomsg.Sockopt; package Nanomsg.Socket is Socket_Exception : exception; type Socket_T is tagged private; type Socket_Access_T is access all Socket_T; function Is_Null (Obj : in Socket_T) return Boolean; procedure Init (Obj : out Socket_T; Domain : in Nanomsg.Domains.Domain_T; Protocol : Protocol_T ) with Post => not Obj.Is_Null; procedure Close (Obj : in out Socket_T) with Post => Obj.Is_Null; procedure Bind (Obj : in out Socket_T; Address : in String) with Pre => not Obj.Is_Null; procedure Connect (Obj : in out Socket_T; Address : in String) with Pre => not Obj.Is_Null; function Get_Fd (Obj : in Socket_T) return Integer; procedure Send (Obj : in Socket_T; Message : Nanomsg.Messages.Message_T); procedure Receive (Obj : in out Socket_T; Message : out Nanomsg.Messages.Message_T; Non_Blocking : in Boolean := False); function Receive (Obj : in out Socket_T; Message : out Nanomsg.Messages.Message_T; Non_Blocking : in Boolean := False) return Natural; procedure Delete_Endpoint (Obj : in out Socket_T); function Get_Option (Obj : in Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T) return String; function Get_Option (Obj : in Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T) return Natural; procedure Set_Option (Obj : in out Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T; Value : in Natural); procedure Set_Option (Obj : in out Socket_T; Level : in Nanomsg.Sockopt.Option_Level_T; Name : in Nanomsg.Sockopt.Option_Type_T; Value : in String); function Is_Ready (Obj : in Socket_T; To_Send : Boolean := False; To_Receive : Boolean := True) return Boolean; function "=" (Left, Right : in Socket_T) return Boolean; private type Socket_T is tagged record Fd : Integer := -1; -- File Descriptor Domain : Nanomsg.Domains.Domain_T; Protocol : Protocol_T; Endpoint : Integer := -1; end record; end Nanomsg.Socket;
stcarrez/ada-servlet
Ada
3,999
adb
----------------------------------------------------------------------- -- Sessions Tests - Unit tests for Servlet.Sessions -- 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.Test_Caller; with Servlet.Sessions.Factory; with Util.Measures; with EL.Objects; package body Servlet.Sessions.Tests is use Util.Tests; -- ------------------------------ -- Test session creation. -- ------------------------------ procedure Test_Create_Session (T : in out Test) is F : Servlet.Sessions.Factory.Session_Factory; S : Servlet.Sessions.Session; St : Util.Measures.Stamp; begin for I in 1 .. 10 loop F.Create_Session (S); end loop; Util.Measures.Report (St, "10 Session create"); for I in 1 .. 100 loop F.Create_Session (S); T.Assert (S.Is_Valid, "Session should be valid"); T.Assert (S.Get_Id'Length = 32, "Session id has an invalid length"); -- Ada.Text_IO.Put_Line ("ID=" & S.Get_Id); declare S2 : Servlet.Sessions.Session; begin F.Find_Session (Id => S.Get_Id, Result => S2); T.Assert (S2.Is_Valid, "Session was not found"); Assert_Equals (T, S.Get_Id, S2.Get_Id, "Invalid session id"); end; end loop; end Test_Create_Session; -- ------------------------------ -- Tests on an empty session object. -- ------------------------------ procedure Test_Empty_Session (T : in out Test) is S : Servlet.Sessions.Session; begin T.Assert (not S.Is_Valid, "Session should be invalid"); S.Invalidate; T.Assert (not S.Is_Valid, "Session should be invalid"); end Test_Empty_Session; procedure Test_Session_Attributes (T : in out Test) is F : Servlet.Sessions.Factory.Session_Factory; S : Servlet.Sessions.Session; begin F.Create_Session (S); S.Set_Attribute ("a1", EL.Objects.To_Object (Integer (234))); S.Set_Attribute ("a2", EL.Objects.To_Object (String '("name"))); declare Value : constant EL.Objects.Object := S.Get_Attribute ("a1"); begin Assert_Equals (T, "234", EL.Objects.To_String (Value), "Invalid attribute a1"); end; end Test_Session_Attributes; package Caller is new Util.Test_Caller (Test, "Sessions"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin -- To document what is tested, register the test methods for each -- operation that is tested. Caller.Add_Test (Suite, "Test Servlet.Sessions.Factory.Create_Session", Test_Create_Session'Access); Caller.Add_Test (Suite, "Test Servlet.Sessions.Factory.Find_Session", Test_Create_Session'Access); Caller.Add_Test (Suite, "Test Servlet.Sessions.Get_Id", Test_Create_Session'Access); Caller.Add_Test (Suite, "Test Servlet.Sessions.Is_Valid", Test_Empty_Session'Access); Caller.Add_Test (Suite, "Test Servlet.Sessions.Set_Attribute", Test_Session_Attributes'Access); Caller.Add_Test (Suite, "Test Servlet.Sessions.Get_Attribute", Test_Session_Attributes'Access); end Add_Tests; end Servlet.Sessions.Tests;
darkestkhan/cbap
Ada
3,562
adb
pragma License (GPL); ------------------------------------------------------------------------------ -- EMAIL: <[email protected]> -- -- License: GNU GPLv3 or any later as published by Free Software Foundation -- -- (see COPYING file) -- -- -- -- Copyright © 2015 darkestkhan -- ------------------------------------------------------------------------------ -- This Program is Free Software: You can redistribute it and/or modify -- -- it under the terms of The GNU General Public License as published by -- -- the Free Software Foundation, either version 3 of the license, or -- -- (at Your option) any later version. -- -- -- -- This Program is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the -- -- GNU General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public License -- -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- ------------------------------------------------------------------------------ with Ada.Command_Line; with Ada.Text_IO; with CBAP; procedure CBAP_Inputs_Detection is --------------------------------------------------------------------------- -- Dummy callback. procedure Help (Argument : in String) is null; --------------------------------------------------------------------------- Input_Args : constant array (Positive range <>) of access String := ( new String'("doing"), new String'("----"), new String'("--"), new String'("help"), new String'("done") ); --------------------------------------------------------------------------- Error_Count : Natural := 0; Detected_Inputs : Natural := 0; procedure Check_Args (Position : in CBAP.Argument_Lists.Cursor) is --------------------------------------------------------------------------- function Is_Correct_Input_Arg (Arg : in String) return Boolean is begin for K in Input_Args'Range loop if Input_Args (K).all = Arg then return True; end if; end loop; Ada.Text_IO.Put_Line ("Detected wrong argument: " & Arg); return False; end Is_Correct_Input_Arg; --------------------------------------------------------------------------- begin if not Is_Correct_Input_Arg (CBAP.Argument_Lists.Element (Position)) then Error_Count := Error_Count + 1; else Detected_Inputs := Detected_Inputs + 1; end if; end Check_Args; --------------------------------------------------------------------------- begin CBAP.Register (Help'Unrestricted_Access, "help"); CBAP.Process_Arguments; CBAP.Input_Arguments.Iterate (Check_Args'Unrestricted_Access); if Detected_Inputs /= Input_Args'Length then Error_Count := Error_Count + 1; end if; if Error_Count > 0 then Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure); else Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Success); end if; end CBAP_Inputs_Detection;
persan/protobuf-ada
Ada
107
ads
package Protocol_Buffers with Pure => True, Obsolescent => "use Google.Protobuf" is end Protocol_Buffers;
michalkonecny/polypaver
Ada
182
ads
package PolyPaver.Interval is --# function Hull(Low,High : Float) return Float; --# function Contained_In(Object,Subject : Float) return Boolean; end PolyPaver.Interval;
reznikmm/matreshka
Ada
4,770
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$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A read structural feature action is a structural feature action that -- retrieves the values of a structural feature. ------------------------------------------------------------------------------ limited with AMF.UML.Output_Pins; with AMF.UML.Structural_Feature_Actions; package AMF.UML.Read_Structural_Feature_Actions is pragma Preelaborate; type UML_Read_Structural_Feature_Action is limited interface and AMF.UML.Structural_Feature_Actions.UML_Structural_Feature_Action; type UML_Read_Structural_Feature_Action_Access is access all UML_Read_Structural_Feature_Action'Class; for UML_Read_Structural_Feature_Action_Access'Storage_Size use 0; not overriding function Get_Result (Self : not null access constant UML_Read_Structural_Feature_Action) return AMF.UML.Output_Pins.UML_Output_Pin_Access is abstract; -- Getter of ReadStructuralFeatureAction::result. -- -- Gives the output pin on which the result is put. not overriding procedure Set_Result (Self : not null access UML_Read_Structural_Feature_Action; To : AMF.UML.Output_Pins.UML_Output_Pin_Access) is abstract; -- Setter of ReadStructuralFeatureAction::result. -- -- Gives the output pin on which the result is put. end AMF.UML.Read_Structural_Feature_Actions;
onox/orka
Ada
2,053
ads
-- 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. package AWT.Inputs.Gamepads.Chords is pragma Preelaborate; subtype Chord_Button_Index is Positive range 1 .. 4; type Button_Index_Array is array (Chord_Button_Index range <>) of Gamepad_Button; type Chord (<>) is tagged private; function Create_Chord (Buttons : Button_Index_Array; Max_Time : Duration) return Chord with Pre => Buttons'Length >= 2; -- Return a chord for the given button indices, which must be pressed -- at the same time within small duration -- -- Because humans are not perfect, they may press some buttons of the -- chord a little bit later after the first one. Therefore, Max_Time should -- be a small duration, something between 30 and 80 ms. function Detect_Activation (Object : in out Chord; State : Gamepad_State) return Boolean; -- Return True if all buttons of the chord are currently pressed and -- were pressed within the maximum duration before now, False otherwise private type State_Array is array (Positive range <>) of Changed_Gamepad_Buttons; type State_Type is (Idle, Active, Deactivated); type Chord (Button_Count : Positive) is tagged record Buttons : Button_Index_Array (1 .. Button_Count); Max_Time : Duration; Current_State : State_Type := Idle; Start_Press : Orka.Time; end record; end AWT.Inputs.Gamepads.Chords;
stcarrez/ada-util
Ada
2,701
ads
----------------------------------------------------------------------- -- util-beans -- Interface Definition with Getter and Setters -- Copyright (C) 2009, 2010, 2018, 2019, 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. ----------------------------------------------------------------------- -- = Ada Beans = -- A [Java Bean](http://en.wikipedia.org/wiki/JavaBean) is an object that -- allows to access its properties through getters and setters. Java Beans -- rely on the use of Java introspection to discover the Java Bean object properties. -- -- An Ada Bean has some similarities with the Java Bean as it tries to expose -- an object through a set of common interfaces. Since Ada does not have introspection, -- some developer work is necessary. The Ada Bean framework consists of: -- -- * An `Object` concrete type that allows to hold any data type such -- as boolean, integer, floats, strings, dates and Ada bean objects. -- * A `Bean` interface that exposes a `Get_Value` and `Set_Value` -- operation through which the object properties can be obtained and modified. -- * A `Method_Bean` interface that exposes a set of method bindings -- that gives access to the methods provided by the Ada Bean object. -- -- The benefit of Ada beans comes when you need to get a value or invoke -- a method on an object but you don't know at compile time the object or method. -- That step being done later through some external configuration or presentation file. -- -- The Ada Bean framework is the basis for the implementation of -- Ada Server Faces and Ada EL. It allows the presentation layer to -- access information provided by Ada beans. -- -- To use the packages described here, use the following GNAT project: -- -- with "utilada_base"; -- -- @include util-beans-objects.ads -- @include util-beans-objects-maps.ads -- @include util-beans-objects-vectors.ads -- @include util-beans-objects-datasets.ads -- @include util-beans-objects-iterators.ads -- @include util-beans-basic.ads package Util.Beans is pragma Preelaborate; end Util.Beans;
landgraf/nanomsg-ada
Ada
1,644
ads
-- The MIT License (MIT) -- Copyright (c) 2015 Pavel Zhukov <[email protected]> -- 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, 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 -- AUTHORS OR 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. with Aunit; use Aunit; with Aunit.Simple_Test_Cases; with Nanomsg.Socket; package Nanomsg.Test_Pair is type TC is new Simple_Test_Cases.Test_Case with record Socket1 : Nanomsg.Socket.Socket_T; Socket2 : Nanomsg.Socket.Socket_T; end record; overriding procedure Tear_Down (T : in out Tc); overriding procedure Run_Test (T : in out TC); overriding function Name (T : TC) return Message_String; end Nanomsg.Test_Pair;
reznikmm/matreshka
Ada
4,639
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_Draw.Shadow_Opacity_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Shadow_Opacity_Attribute_Node is begin return Self : Draw_Shadow_Opacity_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Shadow_Opacity_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Shadow_Opacity_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Shadow_Opacity_Attribute, Draw_Shadow_Opacity_Attribute_Node'Tag); end Matreshka.ODF_Draw.Shadow_Opacity_Attributes;
charlie5/aIDE
Ada
3,910
adb
with Glib, glib.Error, gtk.Builder, gtk.Handlers, AdaM.context_Line, aIDE.Editor.of_context_line; package body aIDE.Editor.of_context is use gtk.Builder, Glib, Glib.Error; function on_context_Label_clicked (the_Label : access Gtk_Label_Record'Class; Self : in aIDE.Editor.of_context.view) return Boolean is pragma Unreferenced (the_Label); use AdaM; the_Line : constant AdaM.context_Line .view := AdaM.context_Line.new_context_Line ("anon"); the_Line_Editor : constant aIDE.Editor.of_context_line.view := Editor.of_context_line.Forge.to_context_line_Editor (Self.Context, the_Line); begin the_Line_Editor.top_Widget.reparent (Self.context_lines_Box); Self.Context.add (the_Line); return False; end on_context_Label_clicked; package Label_return_Callbacks is new Gtk.Handlers.User_Return_Callback (Gtk_Label_Record, Boolean, aIDE.Editor.of_context.view); package body Forge is function to_context_Editor (the_Context : in AdaM.Context.view) return View is Self : constant Editor.of_context.view := new Editor.of_context.item; the_Builder : Gtk_Builder; Error : aliased GError; Result : Guint; pragma Unreferenced (Result); begin Gtk_New (the_Builder); Result := the_Builder.Add_From_File ("glade/editor/context_editor.glade", Error'Access); if Error /= null then Error_Free (Error); end if; Self.Top := gtk_Frame (the_Builder.get_Object ("top_Frame")); Self.context_Label := gtk_Label (the_Builder.get_Object ("context_Label")); Self.context_lines_Box := gtk_Box (the_Builder.get_Object ("context_lines_Box")); Label_return_Callbacks.Connect (Self.context_Label, "button-release-event", on_context_Label_clicked'Access, Self); Self.Context := the_Context; Self.freshen; return Self; end to_context_Editor; end Forge; procedure Context_is (Self : in out Item; Now : in AdaM.Context.view) is begin Self.Context := Now; Self.freshen; end Context_is; overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget is begin return gtk.Widget.Gtk_Widget (Self.Top); end top_Widget; overriding procedure freshen (Self : in out Item) is the_Lines : constant AdaM.context_Line.Vector := Self.Context.Lines; begin loop declare the_Child : constant gtk_Widget := Self.context_lines_Box.Get_Child (0); begin exit when the_Child = null; the_Child.destroy; end; end loop; for i in 1 .. Integer (the_Lines.Length) loop declare the_Line : AdaM.context_line .view renames the_Lines.Element (i); the_Line_Editor : constant aIDE.Editor.of_context_line.view := Editor.of_context_line.Forge.to_context_line_Editor (Self.Context, the_Line); begin the_Line_Editor.top_Widget.reparent (Self.context_lines_Box); end; end loop; end freshen; end aIDE.Editor.of_context;
reznikmm/matreshka
Ada
4,027
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.Chart_Error_Margin_Attributes; package Matreshka.ODF_Chart.Error_Margin_Attributes is type Chart_Error_Margin_Attribute_Node is new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node and ODF.DOM.Chart_Error_Margin_Attributes.ODF_Chart_Error_Margin_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Chart_Error_Margin_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Chart_Error_Margin_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Chart.Error_Margin_Attributes;
reznikmm/matreshka
Ada
3,663
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$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.UMLDI.UML_Interaction_Table_Labels.Hash is new AMF.Elements.Generic_Hash (UMLDI_UML_Interaction_Table_Label, UMLDI_UML_Interaction_Table_Label_Access);
fractal-mind/Amass
Ada
469
ads
-- Copyright © by Jeff Foley 2022. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -- SPDX-License-Identifier: Apache-2.0 name = "Synapsint" type = "scrape" function start() set_rate_limit(1) end function vertical(ctx, domain) scrape(ctx, { ['method']="POST", ['data']="search=" .. domain .. "&btnradio=1", ['url']="https://synapsint.com/report.php", }) end
io7m/coreland-vector-ada
Ada
404
ads
generic package vector.normalize is -- normalize, in place procedure f (a : in out vector_f_t); pragma inline (f); procedure d (a : in out vector_d_t); pragma inline (d); -- normalize, external storage procedure f_ext (a : vector_f_t; x : out vector_f_t); pragma inline (f_ext); procedure d_ext (a : vector_d_t; x : out vector_d_t); pragma inline (d_ext); end vector.normalize;
jhumphry/aLua
Ada
1,298
ads
-- Lua.Lib -- Supporting the Lua standard libraries -- Copyright (c) 2015, James Humphry - see LICENSE for terms package Lua.Libs is type Lua_Standard_Library is (Base_Lib, Package_Lib, Coroutine_Lib, String_Lib, UTF8_Lib, Table_Lib, Math_Lib, IO_Lib, OS_Lib, Debug_Lib, Bit32_Lib); -- Ensure that all standard Lua libraries are available procedure OpenLibs (L : in Lua_State); -- Ensure that a particular standard Lua library is available procedure Require_Standard_Library (L : in Lua_State; Library : in Lua_Standard_Library; Set_Global : in Boolean := True); -- This will add a Yield function to a Lua state for occasions where you -- do not wish to add the whole Coroutine library procedure Add_Yield_Function (L : in Lua_State); private function Yield_CFunction (L : System.Address) return Interfaces.C.int with Convention => C; end Lua.Libs;
AdaCore/ada-traits-containers
Ada
351
adb
-- -- Copyright (C) 2016, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- with Vectors; with Lists; with Maps; -- This test should be run with assertions enables (in Debug mode). It should -- exercise the postconditions defined on container subprograms. procedure Main is begin Vectors; Lists; Maps; end Main;
damaki/SPARKNaCl
Ada
6,320
adb
package body SPARKNaCl.MAC with SPARK_Mode => On is pragma Warnings (GNATProve, Off, "pragma * ignored (not yet supported)"); subtype Index_17 is I32 range 0 .. 16; subtype Poly_1305_F is U32_Seq (Index_17); MinusP : constant Poly_1305_F := (5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252); function Construct (K : in Bytes_32) return Poly_1305_Key is begin return Poly_1305_Key'(F => K); end Construct; procedure Construct (K : out Poly_1305_Key; X : in Bytes_32) is begin K.F := X; end Construct; function Serialize (K : in Poly_1305_Key) return Bytes_32 is begin return K.F; end Serialize; procedure Sanitize (K : out Poly_1305_Key) is begin Sanitize (K.F); end Sanitize; procedure Onetimeauth (Output : out Bytes_16; M : in Byte_Seq; K : in Poly_1305_Key) is S, U : U32; J : Index_17; N : I64; -- Because M'Length can be > I32'Last M_Offset : N32; X, R, H, C, G : Poly_1305_F; procedure Add_1305 (H : in out Poly_1305_F; C : in Poly_1305_F) with Global => null; procedure Add_1305 (H : in out Poly_1305_F; C : in Poly_1305_F) is U : U32 := 0; begin for J in Index_17 loop pragma Loop_Optimize (No_Unroll); U := U + H (J) + C (J); H (J) := U and 255; U := Shift_Right (U, 8); end loop; end Add_1305; begin H := (others => 0); X := (others => 0); R := (0 => U32 (K.F (0)), 1 => U32 (K.F (1)), 2 => U32 (K.F (2)), 3 => U32 (K.F (3)) and 15, 4 => U32 (K.F (4)) and 252, 5 => U32 (K.F (5)), 6 => U32 (K.F (6)), 7 => U32 (K.F (7)) and 15, 8 => U32 (K.F (8)) and 252, 9 => U32 (K.F (9)), 10 => U32 (K.F (10)), 11 => U32 (K.F (11)) and 15, 12 => U32 (K.F (12)) and 252, 13 => U32 (K.F (13)), 14 => U32 (K.F (14)), 15 => U32 (K.F (15)) and 15, 16 => 0); N := M'Length; M_Offset := 0; while (N > 0) loop pragma Loop_Optimize (No_Unroll); C := (others => 0); J := 0; pragma Loop_Invariant (N + I64 (M_Offset) = M'Length); while ((J < 16) and (I64 (J) < N)) loop pragma Loop_Optimize (No_Unroll); pragma Loop_Invariant (N + I64 (M_Offset) = M'Length and M_Offset + J in M'Range); C (J) := U32 (M (M_Offset + J)); J := J + 1; end loop; C (J) := 1; N := N - I64 (J); -- If N > 0 now, then there at least one more block to process. -- If N = 0, then this is the final loop iteration, so no need to -- increment M_Offset. This also protects against overflow -- when M'Last is at or near N32'Last if N > 0 then M_Offset := M_Offset + J; -- POV end if; Add_1305 (H, C); for I in Index_17 loop pragma Loop_Optimize (No_Unroll); X (I) := 0; for P in Index_17 loop pragma Loop_Optimize (No_Unroll); X (I) := X (I) + H (P) * (if P <= I then R (I - P) else 320 * R (I + 17 - P)); end loop; end loop; H := X; U := 0; for P in Index_16 loop pragma Loop_Optimize (No_Unroll); U := U + H (P); H (P) := U and 255; U := Shift_Right (U, 8); end loop; U := U + H (16); H (16) := U and 3; U := 5 * Shift_Right (U, 2); for P in Index_16 loop pragma Loop_Optimize (No_Unroll); U := U + H (P); H (P) := U and 255; U := Shift_Right (U, 8); end loop; U := U + H (16); H (16) := U; end loop; G := H; Add_1305 (H, MinusP); S := -Shift_Right (H (16), 7); for P in Index_17 loop pragma Loop_Optimize (No_Unroll); H (P) := H (P) xor (S and (G (P) xor H (P))); end loop; C := (U32 (K.F (16)), U32 (K.F (17)), U32 (K.F (18)), U32 (K.F (19)), U32 (K.F (20)), U32 (K.F (21)), U32 (K.F (22)), U32 (K.F (23)), U32 (K.F (24)), U32 (K.F (25)), U32 (K.F (26)), U32 (K.F (27)), U32 (K.F (28)), U32 (K.F (29)), U32 (K.F (30)), U32 (K.F (31)), 0); Add_1305 (H, C); for P in Index_16 loop pragma Loop_Optimize (No_Unroll); Output (P) := Byte (H (P) mod 256); end loop; end Onetimeauth; function Onetimeauth_Verify (H : in Bytes_16; M : in Byte_Seq; K : in Poly_1305_Key) return Boolean is X : Bytes_16; begin Onetimeauth (X, M, K); return Equal (H, X); end Onetimeauth_Verify; -------------------------------------------------------- -- HMAC -------------------------------------------------------- procedure HMAC_SHA_256 (Output : out Hashing.Digest_256; M : in Byte_Seq; K : in Byte_Seq) is IPad : Bytes_64 := (others => 16#36#); OPad : Bytes_64 := (others => 16#5C#); -- K', pad to the right with zeroes if shorter than Block_Size, or -- Hash down to less than block size first if greater than Block_Size. Key : Bytes_64 := (others => 0); begin if K'Length > 64 then Key (0 .. 31) := Hashing.Hash_256 (K); else pragma Assert (K'Length <= 64); Key (K'Range) := K; end if; for I in Index_64'Range loop IPad (I) := IPad (I) xor Key (I); OPad (I) := OPad (I) xor Key (I); end loop; Output := Hashing.Hash_256 (OPad & Hashing.Hash_256 (IPad & M)); pragma Assert (Output'Initialized); end HMAC_SHA_256; end SPARKNaCl.MAC;
burratoo/Acton
Ada
9,649
ads
------------------------------------------------------------------------------------------ -- -- -- OAK COMPONENTS -- -- -- -- OAK.BROKERS.PROTECTED_OBJECTS -- -- -- -- Copyright (C) 2011-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ -- This package provides Oak's Protected Agents, the agent that represents -- protected objects in Oak. The Agent extends the Oak Agent data structure to -- include protected object specific components including entries. with Ada.Cyclic_Tasks; with Oak.Agent.Storage; with Oak.Indices; use Oak.Indices; with Oak.Message; use Oak.Message; with Oak.States; use Oak.States; with Oak.Agent; with Oak.Agent.Oak_Agent; use Oak.Agent.Oak_Agent; with System; use System; package Oak.Brokers.Protected_Objects with Preelaborate is ----------------- -- Subprograms -- ----------------- function Active_Subprogram_Kind (PO : in Protected_Id) return Protected_Subprogram_Type; -- Identifies the kind of subprogram currently executing inside the -- protected object. procedure Add_Contending_Task (PO : in Protected_Id; T : in Oak.Agent.Task_Id) with Inline; -- Add a task to the contending task list. procedure Add_Task_To_Entry_Queue (PO : in Protected_Id; T : in Oak.Agent.Task_Id; Entry_Id : Entry_Index) with Inline; -- Add a task to the entry queue identified by the entry id. procedure Add_Task_To_Protected_Object (PO : in Protected_Id; T : in Oak.Agent.Task_Id); -- Add a task to the task within list. function Ceiling_Priority (PO : in Protected_Id) return System.Any_Priority; -- Retrieves the priority assigned to the agent. function Entry_Queue_Length (PO : in Protected_Id; Entry_Id : in Entry_Index) return Natural; -- Returns the number of agents currently queued on an entry queue. procedure Find_Open_Entry (Protected_Object : in Protected_Id; Open_Entry : out Entry_Index; Exception_Raised : out Boolean; Preference : in Entry_Index := No_Entry); -- Finds an open entry for the protected object and returns the id of the -- first open entry with task's it finds, otherwise it returns No_Entry is -- no open entry with tasks are found. If a prefered entry is provided, it -- will it will be checked first and the function will return with that -- index as long as the entry is open. procedure Get_And_Remove_Next_Contending_Task (PO : in Protected_Id; Next_Task : out Oak.Agent.Task_Id_With_No) with Inline; -- Remove and return the first task on the contending task list. procedure Get_And_Remove_Next_Task_From_Entry_Queue (PO : in Protected_Id; Entry_Id : in Entry_Index; Next_Task : out Oak.Agent.Task_Id) with Pre => Entry_Queue_Length (PO, Entry_Id) > 0; -- Remove and return a task from the specified entry queue. function Has_Entries (PO : in Protected_Id) return Boolean; -- Does the protected object have entries. function Is_Entry_Id_Valid (PO : in Protected_Id; Entry_Id : in Entry_Index) return Boolean; -- Returns true if the entry id is valid. function Is_Task_Inside_Protect_Object (PO : in Protected_Id; T : in Oak.Agent.Task_Id) return Boolean with Inline; -- Returns whether or not the task is inside the protected object. procedure New_Protected_Broker (Broker : out Protected_Id; Name : in String; Ceiling_Priority : in Integer; Barriers_Function : in Address; Object_Record_Address : in Address); -- Creates a new Protected Broker with the given prameters. Allocates the -- storage for the Protected Broker data structure and any dependents. procedure Set_Next_Broker (PO : Protected_Id; Next : Protected_Id_With_No) with Inline; function Next_Broker (PO : Protected_Id) return Protected_Id_With_No; function Name (PO : in Protected_Id) return Agent_Name; -- Fetches the name of the Agent. function State (PO : in Protected_Id) return Agent_State with Inline; -- Fetches the state of the Agent. procedure Purge_Entry_Queues (PO : in Protected_Id; New_Task_State : in Agent_State); -- Removes all tasks from the protected object's entry queues. procedure Remove_Task_From_Entry_Queue (PO : in Protected_Id; T : in Oak.Agent.Task_Id); -- Remove the specified task from the entry queues. procedure Remove_Task_From_Within_Protected_Object (PO : in Protected_Id; T : in Oak.Agent.Task_Id) with Pre => Is_Task_Inside_Protect_Object (PO, T); -- Remove the specified task from the protected object. procedure Set_State (PO : in Protected_Id; State : in Agent_State) with Inline; -- Set the state of the agent. function Task_Within (PO : in Protected_Id) return Oak.Agent.Task_Id_With_No; -- Returns the first task inside the protected object. ----------------------------------------------- -- Non Spark compliant types and subprogams -- ----------------------------------------------- -- TODO: these may have to be moved somewhere better? type Parameterless_Access is access protected procedure; -- A general parameterless access type for use in the below functions function Protected_Object_From_Access (Handler : Parameterless_Access) return Protected_Id; function Protected_Object_From_Access (Handler : Ada.Cyclic_Tasks.Response_Handler) return Protected_Id; -- Retrieves the protected object associated with a protected access -- pointer. private ------------------- -- Private Types -- ------------------- type Protected_Broker_Record is record Name : Agent_Name; -- The name of the Agent. Allows users and debugger to query the name of -- the task to figure out who it is. Name_Length : Agent_Name_Length; -- Specifies the actual length of the name. Required since Task_Name is -- fixed string which may be (much) longer than the name actually is. -- Allows for a smaller string to be returned without the blank space at -- the end or dealing with the hell that end of string tokens are. Ceiling_Priority : Any_Priority; -- The priority of the agent under normal conditions. Next_Object : Protected_Id_With_No; State : Agent_State; -- The state of the agent. -- Protected Object Properties Object_Record : Address; -- Address of the record that holds the protected object's contents. Entry_Barriers : Address; -- The address of the function that determines the barrier state of a -- given entry. Entry_Queues : Oak.Agent.Task_Id_With_No; -- Denotes the head of the two-demensional entry queue for the protected -- object. Tasks are sorted by first by entry then FIFO. Active_Subprogram_Kind : Protected_Subprogram_Type; -- The type of subprogram currently operating inside the object. Contending_Tasks : Oak.Agent.Agent_List; -- List of tasks that wanting to enter the protected object. Tasks_Within : Oak.Agent.Agent_List; -- List of tasks currently executing inside the the object. end record; ------------------------------ -- Protected Broker Storage -- ------------------------------ -- The agent generic pool is also suitable for brokers package Protected_Pool is new Oak.Agent.Storage (Agent_Record_Type => Protected_Broker_Record, Agent_Id_Type => Protected_Id); use Protected_Pool; -------------------------- -- Function Expressions -- -------------------------- function Active_Subprogram_Kind (PO : in Protected_Id) return Protected_Subprogram_Type is (Agent_Pool (PO).Active_Subprogram_Kind); function Ceiling_Priority (PO : in Protected_Id) return System.Any_Priority is (Agent_Pool (PO).Ceiling_Priority); function Has_Entries (PO : in Protected_Id) return Boolean is (Agent_Pool (PO).Entry_Barriers /= Null_Address); function Is_Entry_Id_Valid (PO : in Protected_Id; Entry_Id : in Entry_Index) return Boolean is (Entry_Id > No_Entry); function Next_Broker (PO : Protected_Id) return Protected_Id_With_No is (Agent_Pool (PO).Next_Object); function Name (PO : in Protected_Id) return Agent_Name is (Agent_Pool (PO).Name (Agent_Name_Length'First .. Agent_Pool (PO).Name_Length)); function State (PO : in Protected_Id) return Agent_State is (Agent_Pool (PO).State); function Task_Within (PO : in Protected_Id) return Oak.Agent.Task_Id_With_No is (Agent_Pool (PO).Tasks_Within.Head); end Oak.Brokers.Protected_Objects;
stcarrez/ada-el
Ada
4,491
adb
----------------------------------------------------------------------- -- EL.Objects.Time.Tests - Testsuite time objects -- Copyright (C) 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. ----------------------------------------------------------------------- with Util.Test_Caller; with Ada.Calendar.Formatting; with Util.Log.Loggers; with Util.Tests; package body EL.Objects.Time.Tests is use Ada.Calendar; use Util.Log; use Util.Tests; LOG : constant Util.Log.Loggers.Logger := Loggers.Create ("Tests"); -- ------------------------------ -- Test evaluation of expression using a bean -- ------------------------------ procedure Test_Time_Object (T : in out Test) is C : constant Ada.Calendar.Time := Ada.Calendar.Clock; V : constant EL.Objects.Object := To_Object (C); begin T.Assert (Is_Null (V) = False, "Object holding a time value must not be null"); T.Assert (Is_Empty (V) = False, "Object holding a time value must not be empty"); T.Assert (Get_Type (V) = TYPE_TIME, "Object holding a time value must be TYPE_TIME"); T.Assert (C = To_Time (V), "Invalid time returned by To_Time"); end Test_Time_Object; -- ------------------------------ -- Test time to string conversion -- ------------------------------ procedure Test_Time_To_String (T : in out Test) is C : constant Ada.Calendar.Time := Ada.Calendar.Clock; V : constant EL.Objects.Object := To_Object (C); S : constant EL.Objects.Object := Cast_String (V); V2 : constant EL.Objects.Object := Cast_Time (S); begin -- Both 3 values should be the same. LOG.Info ("Time S : {0}", To_String (S)); LOG.Info ("Time V : {0}", To_String (V)); LOG.Info ("Time V2: {0}", To_String (V2)); Assert_Equals (T, To_String (S), To_String (V), "Invalid time conversion (V)"); Assert_Equals (T, To_String (S), To_String (V2), "Invalid time conversion (V2)"); -- The Cast_String looses accuracy so V and V2 may not be equal. T.Assert (V >= V2, "Invalid time to string conversion"); -- Check the time value taking into account the 1 sec accuracy that was lost. T.Assert (C >= To_Time (V2), "Invalid time returned by To_Time (T > expected)"); T.Assert (C < To_Time (V2) + 1.0, "Invalid time returned by To_Time (T + 1 < expected)"); end Test_Time_To_String; -- ------------------------------ -- Test time add and subtract -- ------------------------------ procedure Test_Time_Add (T : in out Test) is C : constant Ada.Calendar.Time := Ada.Calendar.Clock; V : constant EL.Objects.Object := To_Object (C); Dt : constant EL.Objects.Object := To_Object (Integer (10)); V2 : constant EL.Objects.Object := V + Dt; V3 : constant EL.Objects.Object := V2 - Dt; begin T.Assert (V3 = V, "Adding and substracting 10 seconds should result in the same time"); T.Assert (V2 > V, "Invalid comparison for time"); T.Assert (V3 < V2, "Invalid comparison for time"); end Test_Time_Add; package Caller is new Util.Test_Caller (Test, "EL.Objects.Time"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin -- Test_Bean verifies several methods. Register several times -- to enumerate what is tested. Caller.Add_Test (Suite, "Test EL.Objects.Time.To_Object - Is_Null, Is_Empty, Get_Type", Test_Time_Object'Access); Caller.Add_Test (Suite, "Test EL.Objects.Time.To_Object - To_Time", Test_Time_Object'Access); Caller.Add_Test (Suite, "Test EL.Objects.Time.To_String - Cast_Time", Test_Time_To_String'Access); Caller.Add_Test (Suite, "Test EL.Objects.Time.To_String - Cast_Time", Test_Time_Add'Access); end Add_Tests; end EL.Objects.Time.Tests;
reznikmm/matreshka
Ada
3,763
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite 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$ ------------------------------------------------------------------------------ -- This test expected to be executed under valgrind to detect errors in -- handling of library level objects. ------------------------------------------------------------------------------ with League.Application; with League.Strings; with Library_Level_Objects; procedure Library_Level_Test is use League.Strings; use Library_Level_Objects; begin SY := To_Universal_String ("TEST"); end Library_Level_Test;
AdaCore/libadalang
Ada
174
adb
with Ada.Text_IO; use Ada.Text_IO; package body Test is overriding procedure Finalize (X : in out A) is begin Put_Line ("Finalize"); end Finalize; end Test;
rohitsaraf17/NYU-ProgrammingLanguages
Ada
194
ads
package MatrixMult is SIZE : constant Integer := 10; type Matrix is array(1..SIZE,1..SIZE) of Integer; procedure MatMult(A, B : Matrix; C : out Matrix); end MatrixMult;
reznikmm/matreshka
Ada
4,091
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.Table_First_Row_End_Column_Attributes; package Matreshka.ODF_Table.First_Row_End_Column_Attributes is type Table_First_Row_End_Column_Attribute_Node is new Matreshka.ODF_Table.Abstract_Table_Attribute_Node and ODF.DOM.Table_First_Row_End_Column_Attributes.ODF_Table_First_Row_End_Column_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Table_First_Row_End_Column_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Table_First_Row_End_Column_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Table.First_Row_End_Column_Attributes;
AaronC98/PlaneSystem
Ada
3,222
ads
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2003-2015, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ pragma Ada_2012; -- Some XML helper functions with DOM.Core; package SOAP.XML is use type DOM.Core.Node; function Get_Attr_Value (N : DOM.Core.Node; Name : String; NS : Boolean := True) return String with Pre => N /= null; -- Returns the value of attribute Name in N, remove namespace if NS is -- False. Returns the empty string if attribute Name does not exist. function Get_Ref (N : DOM.Core.Node) return DOM.Core.Node with Pre => N /= null; -- If there is a ref in N returns the multiRef referenced node otherwise -- just returns N. function First_Child (Parent : DOM.Core.Node) return DOM.Core.Node with Pre => Parent /= null; -- Returns the first child, skip #text nodes. Returns null if there is no -- children. function Next_Sibling (N : DOM.Core.Node) return DOM.Core.Node with Pre => N /= null; -- Returns the next sibling, skip #text nodes. Return null if there is no -- more sibbling. end SOAP.XML;
stcarrez/dynamo
Ada
101,960
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- O P T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package contains global flags set by the initialization routine from -- the command line and referenced throughout the compiler, the binder, or -- other GNAT tools. The comments indicate which options are used by which -- programs (GNAT, GNATBIND, GNATLINK, GNATMAKE, etc). -- Some flags are labelled "PROJECT MANAGER". These are used by tools that -- use the Project Manager. These tools include gnatmake, gnatname, the gnat -- driver, gnatclean, gprbuild and gprclean. with Hostparm; use Hostparm; with Types; use Types; pragma Warnings (Off); -- This package is used also by gnatcoll with System.Strings; use System.Strings; with System.WCh_Con; use System.WCh_Con; pragma Warnings (On); package Opt is ---------------------- -- Checksum Control -- ---------------------- -- Checksums are computed for sources to check for sources being the same -- from a compilation point of view (e.g. spelling of identifiers and -- white space layout do not count in this computation). -- The way the checksum is computed has evolved across the various versions -- of GNAT. When gprbuild is called with -m, the checksums must be computed -- the same way in gprbuild as it was in the GNAT version of the compiler. -- The different ways are -- Version 6.4 and later: -- The Accumulate_Token_Checksum procedure is called after each numeric -- literal and each identifier/keyword. For keywords, Tok_Identifier is -- used in the call to Accumulate_Token_Checksum. -- Versions 5.04 to 6.3: -- For keywords, the token value were used in the call to procedure -- Accumulate_Token_Checksum. Type Token_Type did not include Tok_Some. -- Versions 5.03: -- For keywords, the token value were used in the call to -- Accumulate_Token_Checksum. Type Token_Type did not include -- Tok_Interface, Tok_Overriding, Tok_Synchronized and Tok_Some. -- Versions 5.02 and before: -- No calls to procedure Accumulate_Token_Checksum (the checksum -- mechanism was introduced in version 5.03). -- To signal to the scanner whether Accumulate_Token_Checksum needs to be -- called and what versions to call, the following Boolean flags are used: Checksum_Accumulate_Token_Checksum : Boolean := True; -- GPRBUILD -- Set to False by gprbuild when the version of GNAT is 5.02 or before. If -- this switch is False, then we do not call Accumulate_Token_Checksum, so -- the setting of the following two flags is irrelevant. Checksum_GNAT_6_3 : Boolean := False; -- GPRBUILD -- Set to True by gprbuild when the version of GNAT is 6.3 or before. Checksum_GNAT_5_03 : Boolean := False; -- GPRBUILD -- Set to True by gprbuild when the version of GNAT is 5.03 or before. ---------------------------------------------- -- Settings of Modes for Current Processing -- ---------------------------------------------- -- The following mode values represent the current state of processing. -- The values set here are the default values. Unless otherwise noted, -- the value may be reset in Switch-? with an appropriate switch. In -- some cases, the values can also be modified by pragmas, and in the -- case of some binder variables, Gnatbind.Scan_Bind_Arg may modify -- the default values. type Ada_Version_Type is (Ada_83, Ada_95, Ada_2005, Ada_2012); pragma Ordered (Ada_Version_Type); -- Versions of Ada for Ada_Version below. Note that these are ordered, -- so that tests like Ada_Version >= Ada_95 are legitimate and useful. -- Think twice before using "="; Ada_Version >= Ada_2012 is more likely -- what you want, because it will apply to future versions of the language. Ada_Version_Default : constant Ada_Version_Type := Ada_2012; pragma Warnings (Off, Ada_Version_Default); -- GNAT -- Default Ada version if no switch given. The Warnings off is to kill -- constant condition warnings. Ada_Version : Ada_Version_Type := Ada_Version_Default; -- GNAT -- Current Ada version for compiler, as set by configuration pragmas, -- compiler switches, or implicitly (to Ada_Version_Runtime) when a -- predefined or internal file is compiled. Ada_Version_Pragma : Node_Id := Empty; -- Reflects the Ada_xxx pragma that resulted in setting Ada_Version. Used -- to specialize error messages complaining about the Ada version in use. Ada_Version_Explicit : Ada_Version_Type := Ada_Version_Default; -- GNAT -- Like Ada_Version, but does not get set implicitly for predefined or -- internal units, so it reflects the Ada version explicitly set using -- configuration pragmas or compiler switches (or if neither appears, it -- remains set to Ada_Version_Default). This is used in the rare cases -- (notably pragma Obsolescent) where we want the explicit version set. Ada_Version_Runtime : Ada_Version_Type := Ada_2012; -- GNAT -- Ada version used to compile the runtime. Used to set Ada_Version (but -- not Ada_Version_Explicit) when compiling predefined or internal units. Ada_Final_Suffix : constant String := "final"; Ada_Final_Name : String_Ptr := new String'("ada" & Ada_Final_Suffix); -- GNATBIND -- The name of the procedure that performs the finalization at the end of -- execution. This variable may be modified by Gnatbind.Scan_Bind_Arg. Ada_Init_Suffix : constant String := "init"; Ada_Init_Name : String_Ptr := new String'("ada" & Ada_Init_Suffix); -- GNATBIND -- The name of the procedure that performs initialization at the start -- of execution. This variable may be modified by Gnatbind.Scan_Bind_Arg. Ada_Main_Name_Suffix : constant String := "main"; -- GNATBIND -- The suffix for Ada_Main_Name. Defined as a constant here so that it -- can be referenced in a uniform manner to create either the default -- value of Ada_Main_Name (declared below), or the non-default name -- set by Gnatbind.Scan_Bind_Arg. Ada_Main_Name : String_Ptr := new String'("ada_" & Ada_Main_Name_Suffix); -- GNATBIND -- The name of the Ada package generated by the binder (when in Ada mode). -- This variable may be modified by Gnatbind.Scan_Bind_Arg. Address_Clause_Overlay_Warnings : Boolean := True; -- GNAT -- Set False to disable address clause warnings. Modified by use of -- -gnatwo/O. Address_Is_Private : Boolean := False; -- GNAT, GNATBIND -- Set True if package System has the line "type Address is private;" All_Errors_Mode : Boolean := False; -- GNAT -- Flag set to force display of multiple errors on a single line and -- also repeated error messages for references to undefined identifiers -- and certain other repeated error messages. Set by use of -gnatf. Allow_Integer_Address : Boolean := False; -- GNAT -- Allow use of integer expression in a context requiring System.Address. -- Set by the use of configuration pragma Allow_Integer_Address Also set -- in relaxed semantics mode for use by CodePeer or when -gnatd.M is used. All_Sources : Boolean := False; -- GNATBIND -- Set to True to require all source files to be present. This flag is -- directly modified by gnatmake to affect the shared binder routines. Alternate_Main_Name : String_Ptr := null; -- GNATBIND -- Set to non null when Bind_Alternate_Main_Name is True. This value -- is modified as needed by Gnatbind.Scan_Bind_Arg. ASIS_Mode : Boolean := False; -- GNAT -- Enable semantic checks and tree transformations that are important -- for ASIS but that are usually skipped if Operating_Mode is set to -- Check_Semantics. This flag does not have the corresponding option to set -- it ON. It is set ON when Tree_Output is set ON, it can also be set ON -- from the code of GNSA-based tool (a client may need to set ON the -- Back_Annotate_Rep_Info flag in this case. At the moment this does not -- make very much sense, because GNSA cannot do back annotation). Assertions_Enabled : Boolean := False; -- GNAT -- Indicates default policy (True = Check, False = Ignore) to be applied -- to all assertion aspects and pragmas, and to pragma Debug, if there is -- no overriding Assertion_Policy, Check_Policy, or Debug_Policy pragma. -- Set True by use of -gnata. Assume_No_Invalid_Values : Boolean := False; -- GNAT Normally, in accordance with (RM 13.9.1 (9-11)) the front end -- assumes that values could have invalid representations, unless it can -- clearly prove that the values are valid. If this switch is set (by -- pragma Assume_No_Invalid_Values (On)), then the compiler assumes values -- are valid and in range of their representations. This feature is now -- fully enabled in the compiler. Back_Annotate_Rep_Info : Boolean := False; -- GNAT -- If set True, enables back annotation of representation information -- by gigi, even in -gnatc mode. This is set True by the use of -gnatR -- (list representation information) or -gnatt (generate tree). It is -- also set true if certain Unchecked_Conversion instantiations require -- checking based on annotated values. Back_End_Handles_Limited_Types : Boolean; -- This flag is set true if the back end can properly handle limited or -- other by reference types, and avoid copies. If this flag is False, then -- the front end does special expansion for if/case expressions to make -- sure that no copy occurs. If the flag is True, then the expansion for -- if and case expressions relies on the back end properly handling things. -- Currently the default is False for all cases (set in gnat1drv). The -- default can be modified using -gnatd.L (sets the flag True). This is -- used to test the possibility of having the backend handle this. Back_End_Inlining : Boolean := False; -- GNAT -- Set True to activate inlining by back-end expansion. This is the normal -- default mode for gcc targets, so it is True on such targets unless the -- switches -gnatN or -gnatd.z are used. See circuitry in gnat1drv for the -- exact conditions for setting this switch. Bind_Alternate_Main_Name : Boolean := False; -- GNATBIND -- True if main should be called Alternate_Main_Name.all. -- This variable may be set to True by Gnatbind.Scan_Bind_Arg. Bind_Main_Program : Boolean := True; -- GNATBIND -- Set to False if not binding main Ada program Bind_For_Library : Boolean := False; -- GNATBIND -- Set to True if the binder needs to generate a file designed for building -- a library. May be set to True by Gnatbind.Scan_Bind_Arg. Bind_Only : Boolean := False; -- GNATMAKE, GPRBUILD -- Set to True to skip compile and link steps -- (except when Compile_Only and/or Link_Only are True). Blank_Deleted_Lines : Boolean := False; -- GNAT, GNATPREP -- Output empty lines for each line of preprocessed input that is deleted -- in the output, including preprocessor lines starting with a '#'. Brief_Output : Boolean := False; -- GNAT, GNATBIND -- Force brief error messages to standard error, even if verbose mode is -- set (so that main error messages go to standard output). Build_Bind_And_Link_Full_Project : Boolean := False; -- GNATMAKE -- Set to True to build, bind and link all the sources of a project file -- (switch -B) Check_Aliasing_Of_Parameters : Boolean := False; -- GNAT -- Set to True to detect whether subprogram parameters and function results -- alias the same object(s). Check_Float_Overflow : Boolean := False; -- GNAT -- Set to True to check that operations on predefined unconstrained float -- types (e.g. Float, Long_Float) do not overflow and generate infinities -- or invalid values. Set by the Check_Float_Overflow pragma, or by use -- of the -gnateF switch. Check_Object_Consistency : Boolean := False; -- GNATBIND, GNATMAKE -- Set to True to check whether every object file is consistent with its -- corresponding ada library information (ALI) file. An object file is -- inconsistent with the corresponding ALI file if the object file does -- not exist or if it has an older time stamp than the ALI file. Default -- above is for GNATBIND. GNATMAKE overrides this default to True (see -- Make.Initialize) since we normally do need to check source consistencies -- in gnatmake. Check_Only : Boolean := False; -- GNATBIND -- Set to True to do checks only, no output of binder file Check_Policy_List : Node_Id := Empty; -- GNAT -- This points to the list of N_Pragma nodes for Check_Policy pragmas -- that are linked through the Next_Pragma fields, with the list being -- terminated by Empty. The order is most recently processed first. Note -- that Push_Scope and Pop_Scope in Sem_Ch8 save and restore the value -- of this variable, implementing the required scope control for pragmas -- appearing in a declarative part. Check_Readonly_Files : Boolean := False; -- GNATMAKE -- Set to True to check readonly files during the make process Check_Source_Files : Boolean := True; -- GNATBIND, GNATMAKE -- Set to True to enable consistency checking for any source files that -- are present (i.e. date must match the date in the library info file). -- Set to False for object file consistency check only. This flag is -- directly modified by gnatmake, to affect the shared binder routines. Check_Switches : Boolean := False; -- GNATMAKE, GPBUILD -- Set to True to check compiler options during the make process Check_Unreferenced : Boolean := False; -- GNAT -- Set to True to enable checking for unreferenced entities other -- than formal parameters (for which see Check_Unreferenced_Formals) -- Modified by use of -gnatwu/U. Check_Unreferenced_Formals : Boolean := False; -- GNAT -- Set to True to check for unreferenced formals. This is turned on by -- -gnatwa/wf/wu and turned off by -gnatwA/wF/wU. Check_Validity_Of_Parameters : Boolean := False; -- GNAT -- Set to True to check for proper scalar initialization of subprogram -- parameters on both entry and exit. Turned on by??? turned off by??? Check_Withs : Boolean := False; -- GNAT -- Set to True to enable checking for unused withs, and also the case -- of withing a package and using none of the entities in the package. -- Modified by use of -gnatwu/U. CodePeer_Mode : Boolean := False; -- GNAT, GNATBIND, GPRBUILD -- Enable full CodePeer mode (SCIL generation, disable switches that -- interact badly with it, etc...). This is turned on by -gnatC. Commands_To_Stdout : Boolean := False; -- GNATMAKE -- True if echoed commands to be written to stdout instead of stderr Comment_Deleted_Lines : Boolean := False; -- GNATPREP -- True if source lines removed by the preprocessor should be commented -- in the output file. Compilation_Time : String (1 .. 19); -- GNAT -- Compilation date and time in form YYYY-MM-DD HH:MM:SS Compile_Only : Boolean := False; -- GNATMAKE, GNATCLEAN, GPBUILD, GPRCLEAN -- GNATMAKE, GPRBUILD: -- set True to skip bind and link steps (except when Bind_Only is True) -- GNATCLEAN, GPRCLEAN: -- set True to delete only the files produced by the compiler but not the -- library files or the executable files. Compiler_Unit : Boolean := False; -- GNAT1 -- Set True by an occurrence of pragma Compiler_Unit_Warning (or of the -- obsolete pragma Compiler_Unit) in the main unit. Once set True, stays -- True, since any units that are with'ed directly or indirectly by -- a Compiler_Unit_Warning main unit are subject to the same restrictions. -- Such units really should have their own pragmas, but we do not bother to -- check for that, so this transitivity provides extra checking. Config_File : Boolean := True; -- GNAT -- Set to False to inhibit reading and processing of gnat.adc file Config_File_Names : String_List_Access := null; -- GNAT -- Names of configuration pragmas files (given by switches -gnatec) Configurable_Run_Time_Mode : Boolean := False; -- GNAT, GNATBIND -- Set True if the compiler is operating in configurable run-time mode. -- This happens if the flag Targparm.Configurable_Run_TimeMode_On_Target -- is set True, or if pragma No_Run_Time is used. See the spec of Rtsfind -- for details on the handling of the latter pragma. Constant_Condition_Warnings : Boolean := False; -- GNAT -- Set to True to activate warnings on constant conditions. Modified by -- use of -gnatwc/C. Create_Mapping_File : Boolean := False; -- GNATMAKE -- Set to True (-C switch) to indicate that the compiler will be invoked -- with a mapping file (-gnatem compiler switch). subtype Debug_Level_Value is Nat range 0 .. 3; Debugger_Level : Debug_Level_Value := 0; -- The value given to the -g parameter. The default value for -g with -- no value is 2. This is not currently used but is retained for possible -- future use. Default_Exit_Status : Int := 0; -- GNATBIND -- Set the default exit status value. Set by the -Xnnn switch for the -- binder. Debug_Generated_Code : Boolean := False; -- GNAT -- Set True (-gnatD switch) to debug generated expanded code instead -- of the original source code. Causes debugging information to be -- written with respect to the generated code file that is written. Default_Pool : Node_Id := Empty; -- GNAT -- Used to record the storage pool name (or null literal) that is the -- argument of an applicable pragma Default_Storage_Pool. -- Empty: No pragma Default_Storage_Pool applies. -- N_Null node: "pragma Default_Storage_Pool (null);" applies. -- otherwise: "pragma Default_Storage_Pool (X);" applies, and -- this points to the name X. -- Push_Scope and Pop_Scope in Sem_Ch8 save and restore this value. Default_Stack_Size : Int := -1; -- GNATBIND -- Set to default primary stack size in units of bytes. Set by -- the -dnnn switch for the binder. A value of -1 indicates that no -- default was set by the binder. Default_Sec_Stack_Size : Int := -1; -- GNATBIND -- Set to default secondary stack size in units of bytes. Set by -- the -Dnnn switch for the binder. A value of -1 indicates that no -- default was set by the binder, and that the default should be the -- initial value of System.Secondary_Stack.Default_Secondary_Stack_Size. Default_SSO : Character := ' '; -- GNAT -- Set if a pragma Default_Scalar_Storage_Order has been given. The value -- of ' ' indicates that no default has been set, otherwise the value is -- either 'H' for High_Order_First or 'L' for Lower_Order_First. Detect_Blocking : Boolean := False; -- GNAT -- Set True to force the run time to raise Program_Error if calls to -- potentially blocking operations are detected from protected actions. Directories_Must_Exist_In_Projects : Boolean := True; -- PROJECT MANAGER -- Set to False with switch -f of gnatclean and gprclean Display_Compilation_Progress : Boolean := False; -- GNATMAKE, GPRBUILD -- Set True (-d switch) to display information on progress while compiling -- files. Internal flag to be used in conjunction with an IDE (e.g GPS). type Distribution_Stub_Mode_Type is -- GNAT (No_Stubs, -- Normal mode, no generation/compilation of distribution stubs Generate_Receiver_Stub_Body, -- The unit being compiled is the RCI body, and the compiler will -- generate the body for the receiver stubs and compile it. Generate_Caller_Stub_Body); -- The unit being compiled is the RCI spec, and the compiler will -- generate the body for the caller stubs and compile it. Distribution_Stub_Mode : Distribution_Stub_Mode_Type := No_Stubs; -- GNAT -- This enumeration variable indicates the five states of distribution -- annex stub generation/compilation. Do_Not_Execute : Boolean := False; -- GNATMAKE -- Set to True if no actual compilations should be undertaken Dump_Source_Text : Boolean := False; -- GNAT -- Set to True (by -gnatL) to dump source text intermingled with generated -- code. Effective only if either of Debug/Print_Generated_Code is true. Dynamic_Elaboration_Checks : Boolean := False; -- GNAT -- Set True for dynamic elaboration checking mode, as set by the -gnatE -- switch or by the use of pragma Elaboration_Checks (Dynamic). Dynamic_Stack_Measurement : Boolean := False; -- GNATBIND -- Set True to enable dynamic stack measurement (-u flag for gnatbind) Dynamic_Stack_Measurement_Array_Size : Nat := 100; -- GNATBIND -- Number of measurements we want to store during dynamic stack analysis. -- When the buffer is full, non-storable results will be output on the fly. -- The value is relevant only if Dynamic_Stack_Measurement is set. Set -- by processing of -u flag for gnatbind. Elab_Dependency_Output : Boolean := False; -- GNATBIND -- Set to True to output complete list of elaboration constraints Elab_Order_Output : Boolean := False; -- GNATBIND -- Set to True to output chosen elaboration order Elab_Info_Messages : Boolean := False; -- GNAT -- Set to True to output info messages for static elabmodel (-gnatel) Elab_Warnings : Boolean := False; -- GNAT -- Set to True to generate elaboration warnings (-gnatwl) Error_Msg_Line_Length : Nat := 0; -- GNAT -- Records the error message line length limit. If this is set to zero, -- then we get the old style behavior, in which each call to the error -- message routines generates one line of output as a separate message. -- If it is set to a non-zero value, then continuation lines are folded -- to make a single long message, and then this message is split up into -- multiple lines not exceeding the specified length. Set by -gnatj=nn. Error_To_Warning : Boolean := False; -- GNAT -- If True, then certain error messages (e.g. parameter overlap messages -- for procedure calls in Ada 2012 mode) are treated as warnings instead -- of errors. Set by debug flag -gnatd.E. A search for Error_To_Warning -- will identify affected messages. Exception_Handler_Encountered : Boolean := False; -- GNAT -- This flag is set true if the parser encounters an exception handler. -- It is used to set Warn_On_Exception_Propagation True if the restriction -- No_Exception_Propagation is set. Exception_Extra_Info : Boolean := False; -- GNAT -- True when switch -gnateE is used. When True, generate extra information -- associated with exception messages (in particular range and index -- checks). Exception_Locations_Suppressed : Boolean := False; -- GNAT -- Set to True if a Suppress_Exception_Locations configuration pragma is -- currently active. type Exception_Mechanism_Type is -- Determines the handling of exceptions. See Exp_Ch11 for details -- (Front_End_Setjmp_Longjmp_Exceptions, -- Exceptions use setjmp/longjmp generated explicitly by the front end -- (this includes gigi or other equivalent parts of the code generator). -- AT END handlers are converted into exception handlers by the front -- end in this mode. Back_End_Exceptions); -- Exceptions are handled by the back end. The front end simply -- generates the handlers as they appear in the source, and AT END -- handlers are left untouched (they are not converted into exception -- handlers when operating in this mode. pragma Convention (C, Exception_Mechanism_Type); Exception_Mechanism : Exception_Mechanism_Type := Front_End_Setjmp_Longjmp_Exceptions; -- GNAT -- Set to the appropriate value depending on the default as given in -- system.ads (ZCX_By_Default). The C convention is there to make this -- variable accessible to gigi. Exception_Tracebacks : Boolean := False; -- GNATBIND -- Set to True to store tracebacks in exception occurrences (-E) Extensions_Allowed : Boolean := False; -- GNAT -- Set to True by switch -gnatX if GNAT specific language extensions -- are allowed. Currently there are no such defined extensions. type External_Casing_Type is ( As_Is, -- External names cased as they appear in the Ada source Uppercase, -- External names forced to all uppercase letters Lowercase); -- External names forced to all lowercase letters External_Name_Imp_Casing : External_Casing_Type := Lowercase; -- GNAT -- The setting of this flag determines the casing of external names -- when the name is implicitly derived from an entity name (i.e. either -- no explicit External_Name or Link_Name argument is used, or, in the -- case of extended DEC pragmas, the external name is given using an -- identifier. The As_Is setting is not permitted here (since this would -- create Ada source programs that were case sensitive). External_Name_Exp_Casing : External_Casing_Type := As_Is; -- GNAT -- The setting of this flag determines the casing of an external name -- specified explicitly with a string literal. As_Is means the string -- literal is used as given with no modification to the casing. If -- Lowercase or Uppercase is set, then the string is forced to all -- lowercase or all uppercase letters as appropriate. Note that this -- setting has no effect if the external name is given using an identifier -- in the case of extended DEC import/export pragmas (in this case the -- casing is controlled by External_Name_Imp_Casing), and also has no -- effect if an explicit Link_Name is supplied (a link name is always -- used exactly as given). External_Unit_Compilation_Allowed : Boolean := False; -- GNATMAKE -- When True (set by gnatmake switch -x), allow compilation of sources -- that are not part of any project file. Fast_Math : Boolean := False; -- GNAT -- Indicates the current setting of Fast_Math mode, as set by the use -- of a Fast_Math pragma (set True by Fast_Math (On)). Force_ALI_Tree_File : Boolean := False; -- GNAT -- Force generation of ALI file even if errors are encountered. Also forces -- generation of tree file if -gnatt is also set. Set on by use of -gnatQ. Disable_ALI_File : Boolean := False; -- GNAT -- Disable generation of ALI file Follow_Links_For_Files : Boolean := False; -- PROJECT MANAGER -- Set to True (-eL) to process the project files in trusted mode. If -- Follow_Links is False, it is assumed that the project doesn't contain -- any file duplicated through symbolic links (although the latter are -- still valid if they point to a file which is outside of the project), -- and that no directory has a name which is a valid source name. Follow_Links_For_Dirs : Boolean := False; -- PROJECT MANAGER -- Set to True if directories can be links in this project, and therefore -- additional system calls must be performed to ensure that we always see -- the same full name for each directory. Force_Checking_Of_Elaboration_Flags : Boolean := False; -- GNATBIND -- True if binding with forced checking of the elaboration flags -- (-F switch set). Force_Compilations : Boolean := False; -- GNATMAKE, GPRBUILD -- Set to force recompilations even when the objects are up-to-date. Front_End_Inlining : Boolean := False; -- GNAT -- Set True to activate inlining by front-end expansion (even on GCC -- targets, where inlining is normally handled by the back end). Set by -- the flag -gnatN (which is now considered obsolescent, since the GCC -- back end can do a better job of inlining than the front end these days. Full_Path_Name_For_Brief_Errors : Boolean := False; -- PROJECT MANAGER -- When True, in Brief_Output mode, each error message line will start with -- the full path name of the source. When False, only the file name without -- directory information is used. Full_List : Boolean := False; -- GNAT -- Set True to generate full source listing with embedded errors Full_List_File_Name : String_Ptr := null; -- GNAT -- Set to file name to generate full source listing to named file (or if -- the name is of the form .xxx, then to name.xxx where name is the source -- file name with extension stripped. Generate_CodePeer_Messages : Boolean := False; -- GNAT -- Generate CodePeer messages. Ignored if CodePeer_Mode is false. This is -- turned on by -gnateC. Generate_Processed_File : Boolean := False; -- GNAT -- True when switch -gnateG is used. When True, create in a file -- <source>.prep, if the source is preprocessed. Generate_SCIL : Boolean := False; -- GNAT -- Set True to activate SCIL code generation. Generate_SCO : Boolean := False; -- GNAT -- True when switch -fdump-scos (or -gnateS) is used. When True, Source -- Coverage Obligation (SCO) information is generated and output in the ALI -- file. See unit Par_SCO for full details. Generate_SCO_Instance_Table : Boolean := False; -- GNAT -- True when switch -fdump-scos is used. When True, a table of instances is -- included in SCOs. Generating_Code : Boolean := False; -- GNAT -- True if the frontend finished its work and has called the backend to -- process the tree and generate the object file. type Ghost_Mode_Type is (None, Check, Ignore); -- Possible legal modes that can be set by aspect/pragma Ghost as well as -- value None, which indicates that no such aspect/pragma applies. Ghost_Mode : Ghost_Mode_Type := None; -- GNAT -- Current Ghost mode setting Global_Discard_Names : Boolean := False; -- GNAT, GNATBIND -- True if a pragma Discard_Names appeared as a configuration pragma for -- the current compilation unit. GNAT_Encodings : Int; pragma Import (C, GNAT_Encodings, "gnat_encodings"); -- Constant controlling the balance between GNAT encodings and standard -- DWARF to emit in the debug information. See jmissing.c and aamissing.c -- for definitions for dotnet/jgnat and GNAAMP back ends. It accepts the -- following values. DWARF_GNAT_Encodings_All : constant Int := 0; DWARF_GNAT_Encodings_GDB : constant Int := 1; DWARF_GNAT_Encodings_Minimal : constant Int := 2; Identifier_Character_Set : Character; -- GNAT -- This variable indicates the character set to be used for identifiers. -- The possible settings are: -- '1' Latin-1 (ISO-8859-1) -- '2' Latin-2 (ISO-8859-2) -- '3' Latin-3 (ISO-8859-3) -- '4' Latin-4 (ISO-8859-4) -- '5' Latin-Cyrillic (ISO-8859-5) -- '9' Latin-9 (ISO-8859-15) -- 'p' PC (US, IBM page 437) -- '8' PC (European, IBM page 850) -- 'f' Full upper set (all distinct) -- 'n' No upper characters (Ada 83 rules) -- 'w' Latin-1 plus wide characters allowed in identifiers -- -- The setting affects the set of letters allowed in identifiers and the -- upper/lower case equivalences. It does not affect the interpretation of -- character and string literals, which are always stored using the actual -- coding in the source program. This variable is initialized to the -- default value appropriate to the system (in Osint.Initialize), and then -- reset if a command line switch is used to change the setting. Ignore_Pragma_SPARK_Mode : Boolean := False; -- GNAT -- Set True to ignore the semantics and effects of pragma SPARK_Mode when -- the pragma appears inside an instance whose enclosing context is subject -- to SPARK_Mode "off". Ignore_Rep_Clauses : Boolean := False; -- GNAT -- Set True to ignore all representation clauses. Useful when compiling -- code from foreign compilers for checking or ASIS purposes. Can be -- set True by use of -gnatI. Ignore_Style_Checks_Pragmas : Boolean := False; -- GNAT -- Set True to ignore all Style_Checks pragmas. Can be set True by use -- of -gnateY. Ignore_Unrecognized_VWY_Switches : Boolean := False; -- GNAT -- Set True to ignore unrecognized y, V, w switches. Can be set True -- by use of -gnateu, causing subsequent unrecognized switches to result -- in a warning rather than an error. Implementation_Unit_Warnings : Boolean := True; -- GNAT -- Set True to active warnings for use of implementation internal units. -- Modified by use of -gnatwi/-gnatwI. Implicit_Packing : Boolean := False; -- GNAT -- If set True, then a Size attribute clause on an array is allowed to -- cause implicit packing instead of generating an error message. Set by -- use of pragma Implicit_Packing. Ineffective_Inline_Warnings : Boolean := False; -- GNAT -- Set True to activate warnings if front-end inlining (-gnatN) is not able -- to actually inline a particular call (or all calls). Can be controlled -- by use of -gnatwp/-gnatwP. Also set True to activate warnings if -- frontend inlining is not able to inline a subprogram expected to -- be inlined in GNATprove mode. Init_Or_Norm_Scalars : Boolean := False; -- GNAT, GANTBIND -- Set True if a pragma Initialize_Scalars applies to the current unit. -- Also set True if a pragma Restriction (Normalize_Scalars) applies. Initialize_Scalars : Boolean := False; -- GNAT -- Set True if a pragma Initialize_Scalars applies to the current unit. -- Note that Init_Or_Norm_Scalars is also set to True if this is True. Initialize_Scalars_Mode1 : Character := 'I'; Initialize_Scalars_Mode2 : Character := 'N'; -- GNATBIND -- Set to two characters from -S switch (IN/LO/HI/EV/xx). The default -- is IN (invalid values), used if no -S switch is used. Inline_Active : Boolean := False; -- GNAT -- Set True to activate pragma Inline processing across modules. Default -- for now is not to inline across module boundaries. Inline_Level : Nat := 0; -- GNAT -- Set to indicate the inlining level: 0 means that an appropriate value is -- to be computed by the compiler based on the optimization level (-gnatn), -- 1 is for moderate inlining across modules (-gnatn1) and 2 for full -- inlining across modules (-gnatn2). Interface_Library_Unit : Boolean := False; -- GNATBIND -- Set to True to indicate that at least one ALI file is an interface ALI: -- then elaboration flag checks are to be generated in the binder -- generated file. Invalid_Value_Used : Boolean := False; -- GNAT -- Set True if a valid Invalid_Value attribute is encountered Inline_Processing_Required : Boolean := False; -- GNAT -- Set True if inline processing is required. Inline processing is required -- if an active Inline pragma is processed. The flag is set for a pragma -- Inline or Inline_Always that is actually active. In_Place_Mode : Boolean := False; -- GNATMAKE -- Set True to store ALI and object files in place i.e. in the object -- directory if these files already exist or in the source directory -- if not. Keep_Going : Boolean := False; -- GNATMAKE, GPRBUILD -- When True signals to ignore compilation errors and keep processing -- sources until there is no more work. Keep_Temporary_Files : Boolean := False; -- GNATCMD, GNATMAKE, GPRBUILD -- When True the temporary files are not deleted. Set by switches -dn or -- --keep-temp-files. Leap_Seconds_Support : Boolean := False; -- GNATBIND -- Set to True to enable leap seconds support in Ada.Calendar and its -- children. Link_Only : Boolean := False; -- GNATMAKE, GPRBUILD -- Set to True to skip compile and bind steps (except when Bind_Only is -- set to True). List_Body_Required_Info : Boolean := False; -- GNATMAKE -- List info messages about why a package requires a body. Modified by use -- of -gnatw.y/.Y. List_Inherited_Aspects : Boolean := False; -- GNAT -- List inherited invariants, preconditions, and postconditions from -- Invariant'Class, Pre'Class, and Post'Class aspects. Also list inherited -- subtype predicates. Modified by use of -gnatw.l/.L. List_Restrictions : Boolean := False; -- GNATBIND -- Set to True to list restrictions pragmas that could apply to partition List_Units : Boolean := False; -- GNAT -- List units in the active library for a compilation (-gnatu switch) List_Closure : Boolean := False; -- GNATBIND -- List all sources in the closure of a main (-R or -Ra gnatbind switch) List_Closure_All : Boolean := False; -- GNATBIND -- List all sources in closure of main including run-time units (-Ra -- gnatbind switch). List_Dependencies : Boolean := False; -- GNATMAKE -- When True gnatmake verifies that the objects are up to date and outputs -- the list of object dependencies (-M switch). Output depends if -a switch -- is used or not. This list can be used directly in a Makefile. List_Representation_Info : Int range 0 .. 3 := 0; -- GNAT -- Set non-zero by -gnatR switch to list representation information. -- The settings are as follows: -- -- 0 = no listing of representation information (default as above) -- 1 = list rep info for user defined record and array types -- 2 = list rep info for all user defined types and objects -- 3 = like 2, but variable fields are decoded symbolically List_Representation_Info_To_File : Boolean := False; -- GNAT -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3/m to be -- written to file.rep (where file is the name of the source file) instead -- of stdout. For example, if file x.adb is compiled using -gnatR2s then -- representation info is written to x.adb.ref. List_Representation_Info_Mechanisms : Boolean := False; -- GNAT -- Set true by -gnatRm switch. Causes information on mechanisms to be -- included in the representation output information. List_Preprocessing_Symbols : Boolean := False; -- GNAT, GNATPREP -- Set to True if symbols for preprocessing a source are to be listed -- before preprocessing occurs. Set to True by switch -s of gnatprep or -- -s in preprocessing data file for the compiler. type Create_Repinfo_File_Proc is access procedure (Src : String); type Write_Repinfo_Line_Proc is access procedure (Info : String); type Close_Repinfo_File_Proc is access procedure; -- Types used for procedure addresses below Create_Repinfo_File_Access : Create_Repinfo_File_Proc := null; Write_Repinfo_Line_Access : Write_Repinfo_Line_Proc := null; Close_Repinfo_File_Access : Close_Repinfo_File_Proc := null; -- GNAT -- These three locations are left null when operating in non-compiler (e.g. -- ASIS mode), but when operating in compiler mode, they are set to point -- to the three corresponding procedures in Osint-C. The reason for this -- slightly strange interface is to stop Repinfo from dragging in Osint in -- ASIS mode, which would include lots of unwanted units in the ASIS build. type Create_List_File_Proc is access procedure (S : String); type Write_List_Info_Proc is access procedure (S : String); type Close_List_File_Proc is access procedure; -- Types used for procedure addresses below Create_List_File_Access : Create_List_File_Proc := null; Write_List_Info_Access : Write_List_Info_Proc := null; Close_List_File_Access : Close_List_File_Proc := null; -- GNAT -- These three locations are left null when operating in non-compiler -- (e.g. from the binder), but when operating in compiler mode, they are -- set to point to the three corresponding procedures in Osint-C. The -- reason for this slightly strange interface is to prevent Repinfo -- from dragging in Osint-C in the binder, which would include unwanted -- units in the binder. Locking_Policy : Character := ' '; -- GNAT, GNATBIND -- Set to ' ' for the default case (no locking policy specified). Reset to -- first character (uppercase) of locking policy name if a valid pragma -- Locking_Policy is encountered. Locking_Policy_Sloc : Source_Ptr := No_Location; -- GNAT, GNATBIND -- Remember location of previous Locking_Policy pragma. This is used for -- inconsistency error messages. A value of System_Location is used if the -- policy is set in package System. Look_In_Primary_Dir : Boolean := True; -- GNAT, GNATBIND, GNATMAKE, GNATCLEAN -- Set to False if a -I- was present on the command line. When True we are -- allowed to look in the primary directory to locate other source or -- library files. Make_Steps : Boolean := False; -- GNATMAKE -- Set to True when either Compile_Only, Bind_Only or Link_Only is -- set to True. Main_Index : Int := 0; -- GNATMAKE -- This is set to non-zero by gnatmake switch -eInnn to indicate that -- the main program is the nnn unit in a multi-unit source file. Mapping_File_Name : String_Ptr := null; -- GNAT -- File name of mapping between unit names, file names and path names. -- (given by switch -gnatem) Maximum_Messages : Int := 9999; -- GNAT, GNATBIND -- Maximum default number of errors before compilation is terminated, or in -- the case of GNAT, maximum number of warnings before further warnings are -- suppressed. Can be overridden by -gnatm (GNAT) or -m (GNATBIND) switch. Maximum_File_Name_Length : Int; -- GNAT, GNATBIND -- Maximum number of characters allowed in a file name, not counting the -- extension, as set by the appropriate switch. If no switch is given, -- then this value is initialized by Osint to the appropriate value. Maximum_Instantiations : Int := 8000; -- GNAT -- Maximum number of instantiations permitted (to stop runaway cases -- of nested instantiations). These situations probably only occur in -- specially concocted test cases. Can be modified by -gnateinn switch. Maximum_Processes : Positive := 1; -- GNATMAKE, GPRBUILD -- Maximum number of processes that should be spawned to carry out -- compilations. Minimal_Recompilation : Boolean := False; -- GNATMAKE -- Set to True if minimal recompilation mode requested Modify_Tree_For_C : Boolean := False; -- GNAT -- If this switch is set True (currently it is set only by -gnatd.V), then -- certain meaning-preserving transformations are applied to the tree to -- make it easier to interface with back ends that implement C semantics. -- There is a section in Sinfo which describes the transformations made. Multiple_Unit_Index : Int := 0; -- GNAT -- This is set non-zero if the current unit is being compiled in multiple -- unit per file mode, meaning that the current unit is selected from the -- sequence of units in the current source file, using the value stored -- in this variable (e.g. 2 = select second unit in file). A value of -- zero indicates that we are in normal (one unit per file) mode. No_Backup : Boolean := False; -- GNATNAME -- Do not create backup copies of project files. Set by switch --no-backup. No_Deletion : Boolean := False; -- GNATPREP -- Set by preprocessor switch -a. Do not eliminate any source text. Implies -- Undefined_Symbols_Are_False. Useful to perform a syntax check on all -- branches of #if constructs. No_Elab_Code_All_Pragma : Node_Id := Empty; -- Set to point to a No_Elaboration_Code_All pragma or aspect encountered -- in the spec of the extended main unit. Used to determine if we need to -- do special tests for violation of this aspect. No_Main_Subprogram : Boolean := False; -- GNATMAKE, GNATBIND -- Set to True if compilation/binding of a program without main -- subprogram requested. No_Run_Time_Mode : Boolean := False; -- GNAT, GNATBIND -- This flag is set True if a No_Run_Time pragma is encountered. See spec -- of Rtsfind for a full description of handling of this pragma. No_Split_Units : Boolean := False; -- GPRBUILD -- Set to True with switch --no-split-units. When True, unit sources, spec, -- body and subunits, must all be in the same project. This is checked -- after each compilation. No_Stdinc : Boolean := False; -- GNAT, GNATBIND, GNATMAKE, GNATFIND, GNATXREF -- Set to True if no default source search dirs added to search list. No_Stdlib : Boolean := False; -- GNATMAKE, GNATBIND, GNATFIND, GNATXREF -- Set to True if no default library search dirs added to search list. No_Strict_Aliasing : Boolean := False; -- GNAT -- Set True if pragma No_Strict_Aliasing with no parameters encountered. No_Tagged_Streams : Node_Id := Empty; -- GNAT -- If a pragma No_Tagged_Streams is active for the current scope, this -- points to the corresponding pragma. Normalize_Scalars : Boolean := False; -- GNAT, GNATBIND -- Set True if a pragma Normalize_Scalars applies to the current unit. -- Note that Init_Or_Norm_Scalars is also set to True if this is True. Object_Directory_Present : Boolean := False; -- GNATMAKE -- Set to True when an object directory is specified with option -D Object_Path_File_Name : String_Ptr := null; -- GNAT2WHY -- Path of the temporary file that contains a list of object directories -- passed by -gnateO=<obj_path_file>. One_Compilation_Per_Obj_Dir : Boolean := False; -- GNATMAKE, GPRBUILD -- Set to True with switch --single-compile-per-obj-dir. When True, there -- cannot be simultaneous compilations with the object files in the same -- object directory, if project files are used. type Operating_Mode_Type is (Check_Syntax, Check_Semantics, Generate_Code); pragma Ordered (Operating_Mode_Type); Operating_Mode : Operating_Mode_Type := Generate_Code; -- GNAT -- Indicates the operating mode of the compiler. The default is generate -- code, which runs the parser, semantics and backend. Switches can be -- used to set syntax checking only mode, or syntax and semantics checking -- only mode. Operating_Mode can also be modified as a result of detecting -- errors during the compilation process. In particular if any serious -- error is detected then this flag is reset from Generate_Code to -- Check_Semantics after generating an error message. This is an ordered -- type with the semantics that each value does more than the previous one. Optimize_Alignment : Character := 'O'; -- Setting of Optimize_Alignment, set to T/S/O for time/space/off. Can -- be modified by use of pragma Optimize_Alignment. Optimize_Alignment_Local : Boolean := False; -- Set True if Optimize_Alignment mode is set by a local configuration -- pragma that overrides the gnat.adc (or other configuration file) default -- so that the unit is not dependent on the default setting. Also always -- set True for internal units, since these always have a default setting -- of Optimize_Alignment (Off) that is enforced (essentially equivalent to -- them all having such an explicit pragma in each unit). Original_Operating_Mode : Operating_Mode_Type := Generate_Code; -- GNAT -- Indicates the original operating mode of the compiler as set by compiler -- options. This is identical to Operating_Mode except that this is not -- affected by errors. Optimization_Level : Int; pragma Import (C, Optimization_Level, "optimize"); -- Constant reflecting the optimization level (0,1,2,3 for -O0,-O1,-O2,-O3) -- See jmissing.c and aamissing.c for definitions for dotnet/jgnat and -- GNAAMP back ends. Optimize_Size : Int; pragma Import (C, Optimize_Size, "optimize_size"); -- Constant reflecting setting of -Os (optimize for size). Set to nonzero -- in -Os mode and set to zero otherwise. See jmissing.c and aamissing.c -- for definitions of "optimize_size" for dotnet/jgnat and GNAAMP backends Output_File_Name_Present : Boolean := False; -- GNATBIND, GNAT, GNATMAKE -- Set to True when the output C file name is given with option -o for -- GNATBIND, when the object file name is given with option -gnatO for GNAT -- or when the executable is given with option -o for GNATMAKE. Output_Linker_Option_List : Boolean := False; -- GNATBIND -- True if output of list of linker options is requested (-K switch set) Output_ALI_List : Boolean := False; ALI_List_Filename : String_Ptr; -- GNATBIND -- True if output of list of ALIs is requested (-A switch set). List is -- output under the given filename, or standard output if not specified. Output_Object_List : Boolean := False; Object_List_Filename : String_Ptr; -- GNATBIND -- True if output of list of objects is requested (-O switch set). List is -- output under the given filename, or standard output if not specified. Partition_Elaboration_Policy : Character := ' '; -- GNAT, GNATBIND -- Set to ' ' for the default case (no elaboration policy specified). Reset -- to first character (uppercase) of locking policy name if a valid pragma -- Partition_Elaboration_Policy is encountered. Partition_Elaboration_Policy_Sloc : Source_Ptr := No_Location; -- GNAT, GNATBIND -- Remember location of previous Partition_Elaboration_Policy pragma. This -- is used for inconsistency error messages. A value of System_Location is -- used if the policy is set in package System. Persistent_BSS_Mode : Boolean := False; -- GNAT -- True if a Persistent_BSS configuration pragma is in effect, causing -- potentially persistent data to be placed in the persistent_bss section. Pessimistic_Elab_Order : Boolean := False; -- GNATBIND -- True if pessimistic elaboration order is to be chosen (-p switch set) Polling_Required : Boolean := False; -- GNAT -- Set to True if polling for asynchronous abort is enabled by using -- the -gnatP option for GNAT. Prefix_Exception_Messages : Boolean := False; -- GNAT -- Set True to prefix exception messages with entity-name: Preprocessing_Data_File : String_Ptr := null; -- GNAT -- Set by switch -gnatep=. The file name of the preprocessing data file. Preprocessing_Symbol_Defs : String_List_Access := new String_List (1 .. 4); -- An extensible array to temporarily stores symbol definitions specified -- on the command line with -gnateD switches. The value 4 is an arbitrary -- starting point, if more space is needed it is allocated as required. Preprocessing_Symbol_Last : Natural := 0; -- Index of last symbol definition in array Symbol_Definitions Print_Generated_Code : Boolean := False; -- GNAT -- Set to True to enable output of generated code in source form. This -- flag is set by the -gnatG switch. Print_Standard : Boolean := False; -- GNAT -- Set to true to enable printing of package standard in source form. -- This flag is set by the -gnatS switch type Usage is (Unknown, Not_In_Use, In_Use); Project_File_In_Use : Usage := Unknown; -- GNAT -- Indicates if a project file is used or not. Set to In_Use by the first -- SFNP pragma. Queuing_Policy : Character := ' '; -- GNAT, GNATBIND -- Set to ' ' for the default case (no queuing policy specified). Reset to -- first character (uppercase) of locking policy name if a valid -- Queuing_Policy pragma is encountered. Queuing_Policy_Sloc : Source_Ptr := No_Location; -- GNAT, GNATBIND -- Remember location of previous Queuing_Policy pragma. This is used for -- inconsistency error messages. A value of System_Location is used if the -- policy is set in package System. Quiet_Output : Boolean := False; -- GNATMAKE, GNATCLEAN, GPRBUILD, GPRCLEAN -- Set to True if the tool should not have any output if there are no -- errors or warnings. Overriding_Renamings : Boolean := False; -- GNAT -- Set to True to enable compatibility mode with Rational compiler, and -- to accept renamings of implicit operations in their own scope. Relaxed_RM_Semantics : Boolean := False; -- GNAT -- Set to True to ignore some Ada semantic error to help parse legacy Ada -- code for use in e.g. static analysis (such as CodePeer). This deals -- with cases where other compilers allow illegal constructs. Tools such as -- CodePeer are interested in analyzing code rather than enforcing legality -- rules, so as long as these illegal constructs end up with code that can -- be handled by the tool in question, there is no reason to reject the -- code that is considered correct by the other compiler. Replace_In_Comments : Boolean := False; -- GNATPREP -- Set to True if -C switch used. RTS_Lib_Path_Name : String_Ptr := null; RTS_Src_Path_Name : String_Ptr := null; -- GNAT -- Set to the "adalib" and "adainclude" directories of the run time -- specified by --RTS=. RTS_Switch : Boolean := False; -- GNAT, GNATMAKE, GNATBIND, GNATLS, GNATFIND, GNATXREF -- Set to True when the --RTS switch is set Run_Path_Option : Boolean := True; -- GNATMAKE, GNATLINK -- Set to False when no run_path_option should be issued to the linker Search_Directory_Present : Boolean := False; -- GNAT -- Set to True when argument is -I. Reset to False when next argument, a -- search directory path is taken into account. Note that this is quite -- different from other switches in this section in that it is only set in -- a transitory manner as a result of scanning a -I switch with no file -- name, and if set, is an indication that the next argument is to be -- treated as a file name. Sec_Stack_Used : Boolean := False; -- GNAT, GBATBIND -- Set True if generated code uses the System.Secondary_Stack package. For -- the binder, set if any unit uses the secondary stack package. Setup_Projects : Boolean := False; -- GNAT DRIVER -- Set to True for GNAT SETUP: the Project Manager creates non existing -- object, library and exec directories. Shared_Libgnat : Boolean; -- GNATBIND -- Set to True if a shared libgnat is requested by using the -shared option -- for GNATBIND and to False when using the -static option. The value of -- this flag is set by Gnatbind.Scan_Bind_Arg. Short_Circuit_And_Or : Boolean := False; -- GNAT -- Set True if a pragma Short_Circuit_And_Or applies to the current unit. type SPARK_Mode_Type is (None, Off, On); -- Possible legal modes that can be set by aspect/pragma SPARK_Mode, as -- well as the value None, which indicates no such pragma/aspect applies. SPARK_Mode : SPARK_Mode_Type := None; -- GNAT -- Current SPARK mode setting. SPARK_Mode_Pragma : Node_Id := Empty; -- GNAT -- If the current SPARK_Mode (above) was set by a pragma, this records -- the pragma that set this mode. SPARK_Switches_File_Name : String_Ptr := null; -- GNAT -- Set to non-null file name by use of the -gnates switch to specify -- SPARK (gnat2why) specific switches in the given file name. Special_Exception_Package_Used : Boolean := False; -- GNAT -- Set to True if either of the unit GNAT.Most_Recent_Exception or -- GNAT.Exception_Traces is with'ed. Used to inhibit transformation of -- local raise statements into gotos in the presence of either package. Sprint_Line_Limit : Nat := 72; -- GNAT -- Limit values for chopping long lines in Cprint/Sprint output, can be -- reset by use of NNN parameter with -gnatG or -gnatD switches. Stack_Checking_Enabled : Boolean := False; -- GNAT -- Set to indicate if stack checking is enabled for the compilation. This -- is set directly from the value in the gcc back end in the body of the -- gcc version of back_end.adb. Style_Check : Boolean := False; -- GNAT -- Set True to perform style checks. Activates checks carried out in -- package Style (see body of this package for details of checks). This -- flag is set True by use of either the -gnatg or -gnaty switches, or -- by the Style_Check pragma. Style_Check_Main : Boolean := False; -- GNAT -- Set True if Style_Check was set for the main unit. This is used to -- renable style checks for units in the mail extended source that get -- with'ed indirectly. It is set True by use of either the -gnatg or -- -gnaty switches, but not by use of the Style_Checks pragma. Disable_FE_Inline : Boolean := False; Disable_FE_Inline_Always : Boolean := False; -- GNAT -- Request to disable front end inlining from pragma Inline or pragma -- Inline_Always out of the presence of the -fno-inline back end flag -- on the command line, regardless of any other switches that are set. -- It remains the back end's reponsibility to honor -fno-inline at the -- back end level. Suppress_Control_Flow_Optimizations : Boolean := False; -- GNAT -- Set by -fpreserve-control-flow. Suppresses control flow optimizations -- that interfere with coverage analysis based on the object code. System_Extend_Pragma_Arg : Node_Id := Empty; -- GNAT -- Set non-empty if and only if a correct Extend_System pragma was present -- in which case it points to the argument of the pragma, and the name can -- be located as Chars (Expression (System_Extend_Pragma_Arg)). System_Extend_Unit : Node_Id := Empty; -- GNAT -- This is set to Empty if GNAT_Mode is set, since pragma Extend_System -- is never appropriate in GNAT_Mode (and causes troubles, including -- bogus circularities, if we try to compile the run-time library with -- a System extension). If GNAT_Mode is not set, then System_Extend_Unit -- is a copy of the value set in System_Extend_Pragma_Arg. Subunits_Missing : Boolean := False; -- GNAT -- This flag is set true if missing subunits are detected with code -- generation active. This causes code generation to be skipped. Suppress_Checks : Boolean := False; -- GNAT -- Set to True if -gnatp (suppress all checks) switch present. Suppress_Options : Suppress_Record; -- GNAT -- Indicates outer level setting of check suppression. This initializes -- the settings of the outer scope level in any unit compiled. This is -- initialized by Osint.Initialize, and further initialized by the -- Adjust_Global_Switches flag in Gnat1drv. Table_Factor : Int := 1; -- GNAT -- Factor by which all initial table sizes set in Alloc are multiplied. -- Used in Table to calculate initial table sizes (the initial table size -- is the value in Alloc, used as the Table_Initial parameter value, -- multiplied by the factor given here. The default value is used if no -- -gnatT switch appears. Tagged_Type_Expansion : Boolean := True; -- GNAT -- Set True if tagged types and interfaces should be expanded by the -- front-end. If False, the original tree is left unexpanded for tagged -- types and dispatching calls, assuming the underlying target supports -- it (e.g. in the JVM case). Target_Dependent_Info_Read_Name : String_Ptr := null; -- GNAT -- Set non-null to override the normal processing in Get_Targ and set the -- necessary information by reading the target dependent information file -- whose name is given here (see packages Get_Targ and Set_Targ for full -- details). Set to non-null file name by use of the -gnateT switch. Target_Dependent_Info_Write_Name : String_Ptr := null; -- GNAT -- Set non-null to enable a call to Set_Targ.Write_Target_Dependent_Info -- which writes a target independent information file (see packages -- Get_Targ and Set_Targ for full details) using the name given by -- this switch. Set to non-null file name by use of the -gnatet switch. type Origin_Of_Target is (Unknown, Default, Specified); Target_Origin : Origin_Of_Target := Unknown; -- GPRBUILD -- Indicates the origin of attribute Target in project files Target_Value : String_Access := null; -- GPRBUILD -- Indicates the value of attribute Target in project files Task_Dispatching_Policy : Character := ' '; -- GNAT, GNATBIND -- Set to ' ' for the default case (no task dispatching policy specified). -- Reset to first character (uppercase) of task dispatching policy name -- if a valid Task_Dispatching_Policy pragma is encountered. Task_Dispatching_Policy_Sloc : Source_Ptr := No_Location; -- GNAT, GNATBIND -- Remember location of previous Task_Dispatching_Policy pragma. This is -- used for inconsistency error messages. A value of System_Location is -- used if the policy is set in package System. Tasking_Used : Boolean := False; -- Set True if any tasking construct is encountered. Used to activate the -- output of the Q, L and T lines in ALI files. Time_Slice_Set : Boolean := False; -- GNATBIND -- Set True if a pragma Time_Slice is processed in the main unit, or -- if the -gnatTnn switch is present to set a time slice value. Time_Slice_Value : Nat; -- GNATBIND -- Time slice value. Valid only if Time_Slice_Set is True, i.e. if -- Time_Slice pragma has been processed. Set to the time slice value in -- microseconds. Negative values are stored as zero, and the value is not -- larger than 1_000_000_000 (1000 seconds). Values larger than this are -- reset to this maximum. This can also be set with the -gnatTnn switch. Tolerate_Consistency_Errors : Boolean := False; -- GNATBIND -- Tolerate time stamp and other consistency errors. If this flag is set to -- True (-t), then inconsistencies result in warnings rather than errors. Treat_Categorization_Errors_As_Warnings : Boolean := False; -- Normally categorization errors are true illegalities. If this switch -- is set, then such errors result in warning messages rather than error -- messages. Set True by -gnateP (P for Pure/Preelaborate). Also set in -- Relaxed_RM_Semantics mode since some old Ada 83 compilers treated -- pragma Preelaborate differently. Treat_Restrictions_As_Warnings : Boolean := False; -- GNAT -- Set True to treat pragma Restrictions as Restriction_Warnings. Set by -- -gnatr switch. Tree_Output : Boolean := False; -- GNAT -- Set to True (-gnatt) to generate output tree file Try_Semantics : Boolean := False; -- GNAT -- Flag set to force attempt at semantic analysis, even if parser errors -- occur. This will probably cause blowups at this stage in the game. On -- the other hand, most such blowups will be caught cleanly and simply -- say compilation abandoned. This flag is set True by -gnatq or -gnatQ. Unchecked_Shared_Lib_Imports : Boolean := False; -- GPRBUILD -- Set to True when shared library projects are allowed to import projects -- that are not shared library projects. Set on by use of the switch -- --unchecked-shared-lib-imports. Undefined_Symbols_Are_False : Boolean := False; -- GNAT, GNATPREP -- Set to True by switch -u of gnatprep or -u in the preprocessing data -- file for the compiler. Indicates that while preprocessing sources, -- symbols that are not defined have the value FALSE. Uneval_Old : Character := 'E'; -- GNAT -- Set to 'E'/'W'/'A' for use of Error/Warn/Allow in a valid pragma -- Unevaluated_Use_Of_Old. Default in the absence of the pragma is 'E' -- for the RM default behavior of giving an error. Unique_Error_Tag : Boolean := Tag_Errors; -- GNAT -- Indicates if error messages are to be prefixed by the string error: -- Initialized from Tag_Errors, can be forced on with the -gnatU switch. Unnest_Subprogram_Mode : Boolean := False; -- If true, activates the circuitry for unnesting subprograms (see the spec -- of Exp_Unst for full details). Currently set only by use of -gnatd.1. Universal_Addressing_On_AAMP : Boolean := False; -- GNAAMP -- Indicates if library-level objects should be accessed and updated using -- universal addressing instructions on the AAMP architecture. This flag is -- set to True when pragma Universal_Data is given as a configuration -- pragma. Unreserve_All_Interrupts : Boolean := False; -- GNAT, GNATBIND -- Normally set False, set True if a valid Unreserve_All_Interrupts pragma -- appears anywhere in the main unit for GNAT, or if any ALI file has the -- corresponding attribute set in GNATBIND. Upper_Half_Encoding : Boolean := False; -- GNAT, GNATBIND -- Normally set False, indicating that upper half ISO 8859-1 characters are -- used in the normal way to represent themselves. If the wide character -- encoding method uses the upper bit for this encoding, then this flag is -- set True, and upper half characters in the source indicate the start of -- a wide character sequence. Set by -gnatW or -W switches. Use_Include_Path_File : Boolean := False; -- GNATMAKE, GPRBUILD -- When True, create a source search path file, even when a mapping file -- is used. Usage_Requested : Boolean := False; -- GNAT, GNATBIND, GNATMAKE -- Set to True if -h (-gnath for the compiler) switch encountered -- requesting usage information Use_Pragma_Linker_Constructor : Boolean := False; -- GNATBIND -- True if pragma Linker_Constructor applies to adainit Use_VADS_Size : Boolean := False; -- GNAT -- Set to True if a valid pragma Use_VADS_Size is processed Validity_Checks_On : Boolean := True; -- GNAT -- This flag determines if validity checking is on or off. The initial -- state is on, and the required default validity checks are active. The -- actual set of checks that is performed if Validity_Checks_On is set is -- defined by the switches in package Validsw. The Validity_Checks_On flag -- is controlled by pragma Validity_Checks (On | Off), and also some -- generated compiler code (typically code that has to do with validity -- check generation) is compiled with this flag set to False. This flag is -- set to False by the -gnatp switch. Verbose_Mode : Boolean := False; -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN, -- GPRBUILD, GPRCLEAN -- Set to True to get verbose mode (full error message text and location -- information sent to standard output, also header, copyright and summary) type Verbosity_Level_Type is (None, Low, Medium, High); pragma Ordered (Verbosity_Level_Type); Verbosity_Level : Verbosity_Level_Type := High; -- GNATMAKE -- Modified by gnatmake switches -v, -vl, -vm, -vh. Indicates -- the level of verbosity of informational messages: -- -- In Low Verbosity, the reasons why a source is recompiled, the name -- of the executable and the reason it must be rebuilt is output. -- -- In Medium Verbosity, additional lines are output for each ALI file -- that is checked. -- -- In High Verbosity, additional lines are output when the ALI file -- is part of an Ada library, is read-only or is part of the runtime. Warn_On_Ada_2005_Compatibility : Boolean := True; -- GNAT -- Set to True to generate all warnings on Ada 2005 compatibility issues, -- including warnings on Ada 2005 obsolescent features used in Ada 2005 -- mode. Set by default, modified by use of -gnatwy/Y. Warn_On_Ada_2012_Compatibility : Boolean := True; -- GNAT -- Set to True to generate all warnings on Ada 2012 compatibility issues, -- including warnings on Ada 2012 obsolescent features used in Ada 2012 -- mode. Modified by use of -gnatwy/Y. Warn_On_All_Unread_Out_Parameters : Boolean := False; -- GNAT -- Set to True to generate warnings in all cases where a variable is -- modified by being passed as to an OUT formal, but the resulting value is -- never read. The default is that this warning is suppressed. Modified -- by use of gnatw.o/.O. Warn_On_Assertion_Failure : Boolean := True; -- GNAT -- Set to True to activate warnings on assertions that can be determined -- at compile time will always fail. Modified by use of -gnatw.a/.A. Warn_On_Assumed_Low_Bound : Boolean := True; -- GNAT -- Set to True to activate warnings for string parameters that are indexed -- with literals or S'Length, presumably assuming a lower bound of one. -- Modified by use of -gnatww/W. Warn_On_Atomic_Synchronization : Boolean := False; -- GNAT -- Set to True to generate information messages for atomic synchronization. -- Modified by use of -gnatw.n/.N. Warn_On_Bad_Fixed_Value : Boolean := False; -- GNAT -- Set to True to generate warnings for static fixed-point expression -- values that are not an exact multiple of the small value of the type. -- Odd by default, modified by use of -gnatwb/B. Warn_On_Biased_Representation : Boolean := True; -- GNAT -- Set to True to generate warnings for size clauses, component clauses -- and component_size clauses that force biased representation. Modified -- by use of -gnatw.b/.B. Warn_On_Constant : Boolean := False; -- GNAT -- Set to True to generate warnings for variables that could be declared -- as constants. Modified by use of -gnatwk/K. Warn_On_Deleted_Code : Boolean := False; -- GNAT -- Set to True to generate warnings for code deleted by the front end -- for conditional statements whose outcome is known at compile time. -- Modified by use of -gnatwt/T. Warn_On_Dereference : Boolean := False; -- GNAT -- Set to True to generate warnings for implicit dereferences for array -- indexing and record component access. Modified by use of -gnatwd/D. Warn_On_Export_Import : Boolean := True; -- GNAT -- Set to True to generate warnings for suspicious use of export or -- import pragmas. Modified by use of -gnatwx/X. Warn_On_Elab_Access : Boolean := False; -- GNAT -- Set to True to generate warnings for P'Access in the case where -- subprogram P is in the same package as the P'Access, and the P'Access is -- evaluated at package elaboration time, and occurs before the body of P -- has been elaborated. Warn_On_Hiding : Boolean := False; -- GNAT -- Set to True to generate warnings if a declared entity hides another -- entity. The default is that this warning is suppressed. Modified by -- use of -gnatwh/H. Warn_On_Modified_Unread : Boolean := False; -- GNAT -- Set to True to generate warnings if a variable is assigned but is never -- read. Also controls warnings for similar cases involving out parameters, -- but only if there is only one out parameter for the procedure involved. -- The default is that this warning is suppressed, modified by use of -- -gnatwm/M. Warn_On_No_Value_Assigned : Boolean := True; -- GNAT -- Set to True to generate warnings if no value is ever assigned to a -- variable that is at least partially uninitialized. Set to false to -- suppress such warnings. The default is that such warnings are enabled. -- Modified by use of -gnatwv/V. Warn_On_Non_Local_Exception : Boolean := False; -- GNAT -- Set to True to generate warnings for non-local exception raises and also -- handlers that can never handle a local raise. This warning is only ever -- generated if pragma Restrictions (No_Exception_Propagation) is set. The -- default is not to generate the warnings except that if the source has -- at least one exception handler, and this restriction is set, and the -- warning was not explicitly turned off, then it is turned on by default. -- Modified by use of -gnatw.x/.X. No_Warn_On_Non_Local_Exception : Boolean := False; -- GNAT -- This is set to True if the above warning is explicitly suppressed. We -- use this to avoid turning it on by default when No_Exception_Propagation -- restriction is set and an exception handler is present. Warn_On_Object_Renames_Function : Boolean := False; -- GNAT -- Set to True to generate warnings when a function result is renamed as -- an object. The default is that this warning is disabled. Modified by -- use of -gnatw.r/.R. Warn_On_Obsolescent_Feature : Boolean := False; -- GNAT -- Set to True to generate warnings on use of any feature in Annex or if a -- subprogram is called for which a pragma Obsolescent applies. Modified -- by use of -gnatwj/J. Warn_On_Overlap : Boolean := False; -- GNAT -- Set to True to generate warnings when a writable actual overlaps with -- another actual in a subprogram call. This applies only in modes before -- Ada 2012. Starting with Ada 2012, such overlaps are illegal. -- Modified by use of -gnatw.i/.I. Warn_On_Questionable_Missing_Parens : Boolean := True; -- GNAT -- Set to True to generate warnings for cases where parentheses are missing -- and the usage is questionable, because the intent is unclear. On by -- default, modified by use of -gnatwq/Q. Warn_On_Parameter_Order : Boolean := False; -- GNAT -- Set to True to generate warnings for cases where the argument list for -- a call is a sequence of identifiers that match the formal identifiers, -- but are in the wrong order. Warn_On_Redundant_Constructs : Boolean := False; -- GNAT -- Set to True to generate warnings for redundant constructs (e.g. useless -- assignments/conversions). The default is that this warning is disabled. -- Modified by use of -gnatwr/R. Warn_On_Reverse_Bit_Order : Boolean := True; -- GNAT -- Set to True to generate warning (informational) messages for component -- clauses that are affected by non-standard bit-order. The default is -- that this warning is enabled. Modified by -gnatw.v/.V. Warn_On_Suspicious_Contract : Boolean := True; -- GNAT -- Set to True to generate warnings for suspicious contracts expressed as -- pragmas or aspects precondition and postcondition, as well as other -- suspicious cases of expressions typically found in contracts like -- quantified expressions and uses of Update attribute. The default is that -- this warning is enabled. Modified by use of -gnatw.t/.T. Warn_On_Suspicious_Modulus_Value : Boolean := True; -- GNAT -- Set to True to generate warnings for suspicious modulus values. The -- default is that this warning is enabled. Modified by -gnatw.m/.M. Warn_On_Unchecked_Conversion : Boolean := True; -- GNAT -- Set to True to generate warnings for unchecked conversions that may have -- non-portable semantics (e.g. because sizes of types differ). Modified -- by use of -gnatwz/Z. Warn_On_Unordered_Enumeration_Type : Boolean := False; -- GNAT -- Set to True to generate warnings for inappropriate uses (comparisons -- and explicit ranges) on unordered enumeration types (which includes -- all enumeration types for which pragma Ordered is not given). The -- default is that this warning is disabled. Modified by -gnat.u/.U. Warn_On_Unrecognized_Pragma : Boolean := True; -- GNAT -- Set to True to generate warnings for unrecognized pragmas. The default -- is that this warning is enabled. Modified by use of -gnatwg/G. Warn_On_Unrepped_Components : Boolean := False; -- GNAT -- Set to True to generate warnings for the case of components of record -- which have a record representation clause but this component does not -- have a component clause. Modified by use of -gnatw.c/.C. Warn_On_Warnings_Off : Boolean := False; -- GNAT -- Set to True to generate warnings for use of Pragma Warnings (Off, ent), -- where either the pragma is never used, or it could be replaced by a -- pragma Unmodified or Unreferenced. Also generates warnings for pragma -- Warning (Off, string) which either has no matching pragma Warning On, -- or where no warning has been suppressed by the use of the pragma. -- Modified by use of -gnatw.w/.W. type Warning_Mode_Type is (Suppress, Normal, Treat_As_Error); Warning_Mode : Warning_Mode_Type := Normal; -- GNAT, GNATBIND -- Controls treatment of warning messages. If set to Suppress, warning -- messages are not generated at all. In Normal mode, they are generated -- but do not count as errors. In Treat_As_Error mode, warning messages are -- generated and are treated as errors. Note that Warning_Mode = Suppress -- causes pragma Warnings to be ignored (except for legality checks), -- unless we are in GNATprove_Mode, which requires pragma Warnings to -- be stored for the formal verification backend. Warnings_As_Errors_Count : Natural; -- GNAT -- Number of entries stored in Warnings_As_Errors table Wide_Character_Encoding_Method : WC_Encoding_Method := WCEM_Brackets; -- GNAT, GNATBIND -- Method used for encoding wide characters in the source program. See -- description of type in unit System.WCh_Con for a list of the methods -- that are currently supported. Note that brackets notation is always -- recognized in source programs regardless of the setting of this -- variable. The default setting causes only the brackets notation to be -- recognized. If this is the main unit, this setting also controls the -- output of the W=? parameter in the ALI file, which is used to provide -- the default for encoding [Wide_[Wide_]]Text_IO files. For the binder, -- the value set here overrides this main unit default. Wide_Character_Encoding_Method_Specified : Boolean := False; -- GNAT, GNATBIND -- Set True if the value in Wide_Character_Encoding_Method was set as -- a result of an explicit -gnatW? or -W? switch. False otherwise. Xref_Active : Boolean := True; -- GNAT -- Set if cross-referencing is enabled (i.e. xref info in ALI files) Zero_Formatting : Boolean := False; -- GNATBIND -- Do no formatting (no title, no leading spaces, no empty lines) in -- auxiliary outputs (-e, -K, -l, -R). ---------------------------- -- Configuration Settings -- ---------------------------- -- These are settings that are used to establish the mode at the start of -- each unit. The values defined below can be affected either by command -- line switches, or by the use of appropriate configuration pragmas in a -- configuration pragma file (but NOT by a local use of a configuration -- pragma in a single file). Ada_Version_Config : Ada_Version_Type; -- GNAT -- This is the value of the configuration switch for the Ada 83 mode, as -- set by the command line switches -gnat83/95/2005/2012, and possibly -- modified by the use of configuration pragmas Ada_*. This switch is used -- to set the initial value for Ada_Version mode at the start of analysis -- of a unit. Note however that the setting of this flag is ignored for -- internal and predefined units (which are always compiled in the most up -- to date version of Ada). Ada_Version_Pragma_Config : Node_Id; -- This will be set non empty if it is set by a configuration pragma Ada_Version_Explicit_Config : Ada_Version_Type; -- GNAT -- This is set in the same manner as Ada_Version_Config. The difference is -- that the setting of this flag is not ignored for internal and predefined -- units, which for some purposes do indeed access this value, regardless -- of the fact that they are compiled the most up to date ada version). Assertions_Enabled_Config : Boolean; -- GNAT -- This is the value of the configuration switch for assertions enabled -- mode, as possibly set by the command line switch -gnata, and possibly -- modified by the use of the configuration pragma Assertion_Policy. Assume_No_Invalid_Values_Config : Boolean; -- GNAT -- This is the value of the configuration switch for assuming "no invalid -- values enabled" mode, as possibly set by the command line switch -- -gnatB, and possibly modified by the use of the configuration pragma -- Assume_No_Invalid_Values. Check_Float_Overflow_Config : Boolean; -- GNAT -- Set to True to check that operations on predefined unconstrained float -- types (e.g. Float, Long_Float) do not overflow and generate infinities -- or invalid values. Set by the Check_Float_Overflow pragma, or by use -- of the -gnateF switch. Check_Policy_List_Config : Node_Id; -- GNAT -- This points to the list of N_Pragma nodes for Check_Policy pragmas -- that are linked through the Next_Pragma fields, with the list being -- terminated by Empty. The order is most recently processed first. This -- list includes only those pragmas in configuration pragma files. Default_Pool_Config : Node_Id := Empty; -- GNAT -- Same as Default_Pool above, except this is only for Default_Storage_Pool -- pragmas that are configuration pragmas. Default_SSO_Config : Character := ' '; -- GNAT -- Set if a pragma Default_Scalar_Storage_Order appears as a configuration -- pragma. A value of ' ' means that no pragma was given, otherwise the -- value is 'H' for High_Order_First or 'L' for Low_Order_First. Dynamic_Elaboration_Checks_Config : Boolean := False; -- GNAT -- Set True for dynamic elaboration checking mode, as set by the -gnatE -- switch or by the use of pragma Elaboration_Checking (Dynamic). Exception_Locations_Suppressed_Config : Boolean := False; -- GNAT -- Set True by use of the configuration pragma Suppress_Exception_Messages Extensions_Allowed_Config : Boolean; -- GNAT -- This is the flag that indicates whether extensions are allowed. It can -- be set True either by use of the -gnatX switch, or by use of the -- configuration pragma Extensions_Allowed (On). It is always set to True -- for internal GNAT units, since extensions are always permitted in such -- units. External_Name_Exp_Casing_Config : External_Casing_Type; -- GNAT -- This is the value of the configuration switch that controls casing of -- external symbols for which an explicit external name is given. It can be -- set to Uppercase by the command line switch -gnatF, and further modified -- by the use of the configuration pragma External_Name_Casing in the -- gnat.adc file. This flag is used to set the initial value for -- External_Name_Exp_Casing at the start of analyzing each unit. Note -- however that the setting of this flag is ignored for internal and -- predefined units (which are always compiled with As_Is mode). External_Name_Imp_Casing_Config : External_Casing_Type; -- GNAT -- This is the value of the configuration switch that controls casing of -- external symbols where the external name is implicitly given. It can be -- set to Uppercase by the command line switch -gnatF, and further modified -- by the use of the configuration pragma External_Name_Casing in the -- gnat.adc file. This flag is used to set the initial value for -- External_Name_Imp_Casing at the start of analyzing each unit. Note -- however that the setting of this flag is ignored for internal and -- predefined units (which are always compiled with Lowercase mode). Fast_Math_Config : Boolean; -- GNAT -- This is the value of the configuration switch that controls Fast_Math -- mode, as set by a Fast_Math pragma in configuration pragmas. It is -- used to set the initial value of Fast_Math at the start of each new -- compilation unit. Initialize_Scalars_Config : Boolean; -- GNAT -- This is the value of the configuration switch that is set by the -- pragma Initialize_Scalars when it appears in the gnat.adc file. -- This switch is not set when the pragma appears ahead of a given -- unit, so it does not affect the compilation of other units. No_Exit_Message : Boolean := False; -- GNATMAKE, GPRBUILD -- Set with switch --no-exit-message. When True, if there are compilation -- failures, the builder does not issue an exit error message. Optimize_Alignment_Config : Character; -- GNAT -- This is the value of the configuration switch that controls the -- alignment optimization mode, as set by an Optimize_Alignment pragma. -- It is used to set the initial value of Optimize_Alignment at the start -- of each new compilation unit, except that it is always set to 'O' (off) -- for internal units. Persistent_BSS_Mode_Config : Boolean; -- GNAT -- This is the value of the configuration switch that controls whether -- potentially persistent data is to be placed in the persistent_bss -- section. It can be set True by use of the pragma Persistent_BSS. -- This flag is used to set the initial value of Persistent_BSS_Mode -- at the start of each compilation unit, except that it is always -- set False for predefined units. Polling_Required_Config : Boolean; -- GNAT -- This is the value of the configuration switch that controls polling -- mode. It can be set True by the command line switch -gnatP, and then -- further modified by the use of pragma Polling in the gnat.adc file. This -- flag is used to set the initial value for Polling_Required at the start -- of analyzing each unit. Prefix_Exception_Messages_Config : Boolean; -- The setting of Prefix_Exception_Messages from configuration pragmas SPARK_Mode_Config : SPARK_Mode_Type := None; -- GNAT -- The setting of SPARK_Mode from configuration pragmas SPARK_Mode_Pragma_Config : Node_Id := Empty; -- If a SPARK_Mode pragma appeared in the configuration pragmas (setting -- SPARK_Mode_Config appropriately), then this points to the N_Pragma node. Uneval_Old_Config : Character; -- GNAT -- The setting of Uneval_Old from configuration pragmas Use_VADS_Size_Config : Boolean; -- GNAT -- This is the value of the configuration switch that controls the use of -- VADS_Size instead of Size wherever the attribute Size is used. It can -- be set True by the use of the pragma Use_VADS_Size in the gnat.adc file. -- This flag is used to set the initial value for Use_VADS_Size at the -- start of analyzing each unit. Note however that the setting of this flag -- is ignored for internal and predefined units (which are always compiled -- with the standard Size semantics). Warnings_As_Errors_Count_Config : Natural; -- GNAT -- Count of pattern strings stored from Warning_As_Error pragmas type Config_Switches_Type is private; -- Type used to save values of the switches set from Config values procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type); -- This procedure saves the current values of the switches which are -- initialized from the above Config values, and then resets these switches -- according to the Config value settings. procedure Set_Opt_Config_Switches (Internal_Unit : Boolean; Main_Unit : Boolean); -- This procedure sets the switches to the appropriate initial values. The -- parameter Internal_Unit is True for an internal or predefined unit, and -- affects the way the switches are set (see above). Main_Unit is true if -- switches are being set for the main unit or for the spec of the main -- unit. This affects setting of the assert/debug pragma switches, which -- are normally set false by default for an internal unit, except when the -- internal unit is the main unit, in which case we use the command line -- settings). procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type); -- This procedure restores a set of switch values previously saved by a -- call to Save_Opt_Config_Switches (Save). procedure Register_Opt_Config_Switches; -- This procedure is called after processing the gnat.adc file and other -- configuration pragma files to record the values of the Config switches, -- as possibly modified by the use of command line switches and pragmas -- appearing in these files. ------------------------ -- Other Global Flags -- ------------------------ Expander_Active : Boolean := False; -- A flag that indicates if expansion is active (True) or deactivated -- (False). When expansion is deactivated all calls to expander routines -- have no effect. Note that the initial setting of False is merely to -- prevent saving of an undefined value for an initial call to the -- Expander_Mode_Save_And_Set procedure. For more information on the use of -- this flag, see package Expander. Indeed this flag might more logically -- be in the spec of Expander, but it is referenced by Errout, and it -- really seems wrong for Errout to depend on Expander. Static_Dispatch_Tables : Boolean := True; -- This flag indicates if the backend supports generation of statically -- allocated dispatch tables. If it is True, then the front end will -- generate static aggregates for dispatch tables that contain forward -- references to addresses of subprograms not seen yet, and the back end -- must be prepared to handle this case. If it is False, then the front -- end generates assignments to initialize the dispatch table, and there -- are no such forward references. By default we build statically allocated -- dispatch tables for all library level tagged types in all platforms.This -- behavior can be disabled using switch -gnatd.t which will set this flag -- to False and revert to the previous dynamic behavior. ----------------------- -- Tree I/O Routines -- ----------------------- procedure Tree_Read; -- Reads switch settings from current tree file using Tree_Read procedure Tree_Write; -- Writes out switch settings to current tree file using Tree_Write -------------------------- -- ASIS Version Control -- -------------------------- -- These two variables (Tree_Version_String and Tree_ASIS_Version_Number) -- are supposed to be used in the GNAT/ASIS version check performed in -- the ASIS code (this package is also a part of the ASIS implementation). -- They are set by Tree_Read procedure, so they represent the version -- number (and the version string) of the compiler which has created the -- tree, and they are supposed to be compared with the corresponding values -- from the Tree_IO and Gnatvsn packages which also are a part of ASIS -- implementation. Tree_Version_String : String_Access; -- Used to store the compiler version string read from a tree file to check -- if it is from the same date as stored in the version string in Gnatvsn. -- We require that ASIS Pro can be used only with GNAT Pro, but we allow -- non-Pro ASIS and ASIS-based tools to be used with any version of the -- GNAT compiler. Therefore, we need the possibility to compare the dates -- of the corresponding source sets, using version strings that may be -- of different lengths. Tree_ASIS_Version_Number : Int; -- Used to store the ASIS version number read from a tree file to check if -- it is the same as stored in the ASIS version number in Tree_IO. ----------------------------------- -- Modes for Formal Verification -- ----------------------------------- GNATprove_Mode : Boolean := False; -- Specific compiling mode targeting formal verification for those parts -- of the input code that belong to the SPARK 2014 subset of Ada. Set True -- by the gnat2why executable or by use of the -gnatd.F debug switch. Note -- that this is completely separate from the SPARK restriction defined in -- GNAT to detect violations of a subset of SPARK 2005 rules. --------------------------- -- Error/Warning Control -- --------------------------- -- The following array would more reasonably be located in Err_Vars or -- Errour, but but we put them here to deal with licensing issues (we need -- this to have the GPL exception licensing, since these variables and -- subprograms are accessed from units with this licensing). Warnings_As_Errors : array (1 .. 10_000) of String_Ptr; -- Table for recording Warning_As_Error pragmas as they are processed. -- It would be nicer to use Table, but there are circular elaboration -- problems if we try to do this, and an attempt to find some other -- appropriately licensed unit to declare this as a Table failed with -- various elaboration circularities. Memory is getting cheap these days! --------------- -- GNAT_Mode -- --------------- GNAT_Mode : Boolean := False; -- GNAT -- True if compiling in GNAT system mode (-gnatg switch) GNAT_Mode_Config : Boolean := False; -- GNAT -- True if -gnatg switch is present. GNAT_Mode may be temporary set to -- True during the analysis of a system unit, but GNAT_Mode_Config must -- not change once scanned and set. -- Setting GNAT mode has the following effects on the language that is -- accepted. Note that several of the following have the effect of changing -- an error to a warning. But warnings are usually treated as fatal errors -- in -gnatg mode, so to actually take advantage of such a change, it is -- necessary to add an explicit pragma Warnings (Off) in the source and -- this requires clear documentation of why this is necessary. -- The identifier character set is set to 'n' (7-bit ASCII) -- Pragma Extend_System is ignored -- Warning_Mode is set to Treat_As_Error (-gnatwe) -- Standard style checks are set (See Set_GNAT_Style_Check_Options) -- Standard warnings are turned on (see Set_GNAT_Mode_Warnings) -- The Ada version is set to Ada 2012 -- Task priorities are always allowed to be in the range Any_Priority -- Overflow checks are suppressed, overflow checking set to strict mode -- ALI files are always generated for predefined generic packages -- Obsolescent feature warnings are suppressed -- Recompilation of children of GNAT, System, Ada, Interfaces is allowed -- The Scalar_Storage_Order attribute applies to generic types -- Categorization errors are treated as warnings rather than errors -- Statements in preelaborated units give warnings rather than errors -- Private objects are allowed in preelaborated units -- Non-static constants in preelaborated units give warnings not errors -- The warning about component size being ignored is suppressed -- The warning about size clauses being ignored is suppressed -- Initializing limited types gives a warning rather than an error -- Copying of limited objects is allowed -- Returning objects of limited types is allowed -- Non-static call in preelaborated unit give a warning, not an error -- Warnings on possible elaboration errors are suppressed -- Warnings about packing being ignored are suppressed -- Warnings in internal units are not suppressed (they normally are) -- The only special comment sequence allowed is --! -------------------------- -- Private Declarations -- -------------------------- private -- The following type is used to save and restore settings of switches in -- Opt that represent the configuration (i.e. result of config pragmas). -- Note that Ada_Version_Explicit is not included, since this is a sticky -- flag that once set does not get reset, since the whole idea of this flag -- is to record the setting for the main unit. type Config_Switches_Type is record Ada_Version : Ada_Version_Type; Ada_Version_Explicit : Ada_Version_Type; Ada_Version_Pragma : Node_Id; Assertions_Enabled : Boolean; Assume_No_Invalid_Values : Boolean; Check_Float_Overflow : Boolean; Check_Policy_List : Node_Id; Default_Pool : Node_Id; Default_SSO : Character; Dynamic_Elaboration_Checks : Boolean; Exception_Locations_Suppressed : Boolean; Extensions_Allowed : Boolean; External_Name_Exp_Casing : External_Casing_Type; External_Name_Imp_Casing : External_Casing_Type; Fast_Math : Boolean; Initialize_Scalars : Boolean; Normalize_Scalars : Boolean; Optimize_Alignment : Character; Optimize_Alignment_Local : Boolean; Persistent_BSS_Mode : Boolean; Polling_Required : Boolean; Prefix_Exception_Messages : Boolean; SPARK_Mode : SPARK_Mode_Type; SPARK_Mode_Pragma : Node_Id; Uneval_Old : Character; Use_VADS_Size : Boolean; Warnings_As_Errors_Count : Natural; end record; -- The following declarations are for GCC version dependent flags. We do -- not let client code in the compiler test GCC_Version directly, but -- instead use deferred constants for relevant feature tags. -- Note: there currently are no such constants defined in this section, -- since the compiler front end is currently entirely independent of the -- GCC version, which is a desirable state of affairs. function get_gcc_version return Int; pragma Import (C, get_gcc_version, "get_gcc_version"); GCC_Version : constant Nat := get_gcc_version; -- GNATMAKE -- Indicates which version of gcc is in use (3 = 3.x, 4 = 4.x). Note that -- gcc 2.8.1 (which used to be a value of 2) is no longer supported. end Opt;
stcarrez/stm32-ui
Ada
4,850
adb
----------------------------------------------------------------------- -- ui-displays -- Utilities to draw text strings -- Copyright (C) 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 STM32.Board; package body UI.Displays is use type Ada.Real_Time.Time; -- ------------------------------ -- Initialize the display. -- ------------------------------ procedure Initialize is begin STM32.Board.Display.Initialize; STM32.Board.Display.Initialize_Layer (1, HAL.Bitmap.ARGB_1555); -- Initialize touch panel STM32.Board.Touch_Panel.Initialize; end Initialize; -- Get the index of current buffer visible on screen. function Current_Buffer_Index (Display : in Display_Type) return Display_Buffer_Index is (Display.Current_Buffer); -- ------------------------------ -- Returns True if a refresh is needed. -- ------------------------------ function Need_Refresh (Display : in Display_Type; Now : in Ada.Real_Time.Time) return Boolean is begin return Display.Deadline < Now or Display.Refresh_Flag; end Need_Refresh; -- ------------------------------ -- Process touch panel event if there is one. -- ------------------------------ procedure Process_Event (Display : in out Display_Type; Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class; Now : in Ada.Real_Time.Time) is State : constant HAL.Touch_Panel.TP_State := STM32.Board.Touch_Panel.Get_All_Touch_Points; begin Display.Refresh_Flag := False; if State'Length > 0 then Display_Type'Class (Display).On_Touch (Buffer, State); end if; if Display.Deadline < Now then Display_Type'Class (Display).On_Timeout (Buffer, Display.Deadline); end if; end Process_Event; Top_Display : access Display_Type'Class; procedure Refresh (Display : in out Display_Type; Buffer : in out HAL.Bitmap.Bitmap_Buffer'Class; Mode : in Refresh_Mode := REFRESH_CURRENT) is begin Display_Type'Class (Display).On_Refresh (Buffer, Display.Deadline); Display.Refresh_Flag := False; STM32.Board.Display.Update_Layer (1); Display.Current_Buffer := (if Display.Current_Buffer = 1 then 0 else 1); if Mode = REFRESH_BOTH then Display.Refresh (STM32.Board.Display.Hidden_Buffer (1).all, REFRESH_CURRENT); end if; end Refresh; -- ------------------------------ -- Restore and refresh the two buffers. -- ------------------------------ procedure Restore (Display : in Display_Access) is Buffer : HAL.Bitmap.Any_Bitmap_Buffer; begin for I in 1 .. 2 loop Buffer := STM32.Board.Display.Hidden_Buffer (1); Display.On_Restore (Buffer.all); Display.Refresh (Buffer.all); end loop; end Restore; -- ------------------------------ -- Push a new display. -- ------------------------------ procedure Push_Display (Display : in Display_Access) is Buffer : constant HAL.Bitmap.Any_Bitmap_Buffer := STM32.Board.Display.Hidden_Buffer (1); begin if Top_Display /= null then Top_Display.On_Pause (Buffer.all); end if; Display.Previous := Top_Display; Top_Display := Display; Restore (Display); end Push_Display; -- ------------------------------ -- Pop the display to go back to the previous one. -- ------------------------------ procedure Pop_Display is Buffer : constant HAL.Bitmap.Any_Bitmap_Buffer := STM32.Board.Display.Hidden_Buffer (1); begin if Top_Display /= null then Top_Display.On_Pause (Buffer.all); end if; if Top_Display.Previous /= null then Top_Display := Top_Display.Previous; end if; Restore (Top_Display.all'Access); end Pop_Display; -- ------------------------------ -- Get the current display. -- ------------------------------ function Current_Display return Display_Access is begin return Top_Display.all'Access; end Current_Display; end UI.Displays;
stcarrez/ada-awa
Ada
4,092
ads
----------------------------------------------------------------------- -- awa-users-filters -- Specific filters for authentication -- Copyright (C) 2011, 2012, 2015, 2019, 2022 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Servlet.Requests; with Servlet.Responses; with Servlet.Sessions; with ASF.Principals; with Servlet.Core; with Servlet.Security.Filters; with AWA.Applications; package AWA.Users.Filters is -- Get the redirection URL from the redirect cookie. function Get_Redirect_Cookie (Request : in Servlet.Requests.Request'Class) return String; -- Clear the redirect cookie in the response. procedure Clear_Redirect_Cookie (Request : in Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class); -- ------------------------------ -- Authentication verification filter -- ------------------------------ -- The <b>Auth_Filter</b> verifies that the user has the permission to access -- a given page. If the user is not logged, it tries to login automatically -- by using some persistent cookie. When this fails, it redirects the -- user to a login page (configured by AUTH_FILTER_REDIRECT_PARAM property). type Auth_Filter is new Servlet.Security.Filters.Auth_Filter with private; -- The configuration parameter which controls the redirection page -- when the user is not logged (this should be the login page). AUTH_FILTER_REDIRECT_PARAM : constant String := "redirect"; -- A temporary cookie used to store the URL for redirection after the login is successful. REDIRECT_COOKIE : constant String := "RURL"; -- Initialize the filter and configure the redirection URIs. overriding procedure Initialize (Filter : in out Auth_Filter; Config : in Servlet.Core.Filter_Config); -- Authenticate a user by using the auto-login cookie. This procedure is called if the -- current session does not have any principal. Based on the request and the optional -- auto-login cookie passed in <b>Auth_Id</b>, it should identify the user and return -- a principal object. The principal object will be freed when the session is closed. -- If the user cannot be authenticated, the returned principal should be null. -- -- The default implementation returns a null principal. overriding procedure Authenticate (F : in Auth_Filter; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class; Session : in Servlet.Sessions.Session; Auth_Id : in String; Principal : out ASF.Principals.Principal_Access); -- Display or redirects the user to the login page. This procedure is called when -- the user is not authenticated. overriding procedure Do_Login (Filter : in Auth_Filter; Request : in out Servlet.Requests.Request'Class; Response : in out Servlet.Responses.Response'Class); private use Ada.Strings.Unbounded; type Auth_Filter is new Servlet.Security.Filters.Auth_Filter with record Login_URI : Unbounded_String; Application : AWA.Applications.Application_Access; end record; end AWA.Users.Filters;
leomlr/sudoku_ada-jewl
Ada
1,836
adb
-- Add a John English's Window Library (JEWL). with JEWL.IO; with JEWL.Windows; with Ada.Text_IO; -- Add personal libraries. with sudoku_9; with sudoku_16; Procedure sudoku Is use JEWL.IO; Type Command_Code is (Quit_Menu, Sudoku_9, Sudoku_16); package My_Game_Windows is new JEWL.Windows (Command_Code); use My_Game_Windows; -- Frame parameters FRAME_TITLE: String := "Sudoku"; FRAME_WIDTH: Integer := 300; FRAME_HEIGTH: Integer := 300; -- Buttons parameters BUTTONS_POSITION_X: Integer := 90; My_Menu_Frame: Constant Frame_Type := Frame (FRAME_WIDTH, FRAME_HEIGTH, FRAME_TITLE, Quit_Menu); My_Button_Sudoku_9x9: Constant Button_Type := Button (My_Menu_Frame, (BUTTONS_POSITION_X, 50), 100, 50, "Sudoku_9", Sudoku_9); My_Button_Sudoku_16x16: Constant Button_Type := Button (My_Menu_Frame, (BUTTONS_POSITION_X, 120), 100, 50, "Sudoku_16", Sudoku_16); Procedure Command_Sudoku9 Is Begin sudoku_9; Exception when others => Ada.Text_IO.Put_Line("Close of grid 9x9"); End Command_Sudoku9; Procedure Command_Sudoku16 Is Begin sudoku_16; Exception when others => Ada.Text_IO.Put_Line("Close of grid 16x16"); End Command_Sudoku16; Begin if Valid(My_Menu_Frame) then loop case Next_Command is when Quit_Menu => null; when Sudoku_9 => Command_Sudoku9; when Sudoku_16 => Command_Sudoku16; when others => null; end case; end loop; end if; End sudoku;
reznikmm/matreshka
Ada
4,913
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.XML_Schema.Visitors; package body Matreshka.XML_Schema.AST.Type_Alternatives is ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Type_Alternative_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control) is begin Visitor.Enter_Type_Alternative (Matreshka.XML_Schema.AST.Type_Alternative_Access (Self), Control); end Enter_Node; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Type_Alternative_Node; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control) is begin Visitor.Leave_Type_Alternative (Matreshka.XML_Schema.AST.Type_Alternative_Access (Self), Control); end Leave_Node; ---------------- -- Visit_Node -- ---------------- overriding procedure Visit_Node (Self : not null access Type_Alternative_Node; Iterator : in out Matreshka.XML_Schema.Visitors.Abstract_Iterator'Class; Visitor : in out Matreshka.XML_Schema.Visitors.Abstract_Visitor'Class; Control : in out Matreshka.XML_Schema.Visitors.Traverse_Control) is begin Iterator.Visit_Type_Alternative (Visitor, Matreshka.XML_Schema.AST.Type_Alternative_Access (Self), Control); end Visit_Node; end Matreshka.XML_Schema.AST.Type_Alternatives;
reznikmm/matreshka
Ada
7,040
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_Meta.Hyperlink_Behaviour_Elements is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Meta_Hyperlink_Behaviour_Element_Node is begin return Self : Meta_Hyperlink_Behaviour_Element_Node do Matreshka.ODF_Meta.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Meta_Prefix); end return; end Create; ---------------- -- Enter_Node -- ---------------- overriding procedure Enter_Node (Self : not null access Meta_Hyperlink_Behaviour_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_Meta_Hyperlink_Behaviour (ODF.DOM.Meta_Hyperlink_Behaviour_Elements.ODF_Meta_Hyperlink_Behaviour_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 Meta_Hyperlink_Behaviour_Element_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Hyperlink_Behaviour_Element; end Get_Local_Name; ---------------- -- Leave_Node -- ---------------- overriding procedure Leave_Node (Self : not null access Meta_Hyperlink_Behaviour_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_Meta_Hyperlink_Behaviour (ODF.DOM.Meta_Hyperlink_Behaviour_Elements.ODF_Meta_Hyperlink_Behaviour_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 Meta_Hyperlink_Behaviour_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_Meta_Hyperlink_Behaviour (Visitor, ODF.DOM.Meta_Hyperlink_Behaviour_Elements.ODF_Meta_Hyperlink_Behaviour_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.Meta_URI, Matreshka.ODF_String_Constants.Hyperlink_Behaviour_Element, Meta_Hyperlink_Behaviour_Element_Node'Tag); end Matreshka.ODF_Meta.Hyperlink_Behaviour_Elements;
AdaCore/libadalang
Ada
215
adb
with Ada.Exceptions; use Ada.Exceptions; procedure Test is X : Exception_Id := Standard'Abort_Signal'Identity; pragma Test_Statement; begin raise Standard'Abort_Signal; pragma Test_Statement; end Test;
charlie5/cBound
Ada
1,386
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_properties_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_properties_cookie_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_properties_cookie_t.Item, Element_Array => xcb.xcb_list_properties_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_properties_cookie_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_list_properties_cookie_t.Pointer, Element_Array => xcb.xcb_list_properties_cookie_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_list_properties_cookie_t;
persan/A-gst
Ada
35,837
ads
pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_gobject_gobject_h; with System; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gslist_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstinfo_h is -- unsupported macro: GST_LEVEL_DEFAULT GST_LEVEL_NONE GST_DEBUG_FG_MASK : constant := (16#000F#); -- gst/gstinfo.h:162 GST_DEBUG_BG_MASK : constant := (16#00F0#); -- gst/gstinfo.h:163 GST_DEBUG_FORMAT_MASK : constant := (16#FF00#); -- gst/gstinfo.h:164 -- arg-macro: function GST_STR_NULL (str) -- return (str) ? (str) : "(NULL)"; -- arg-macro: procedure GST_DEBUG_PAD_NAME (pad) -- (pad /= NULL) ? ((GST_OBJECT_PARENT(pad) /= NULL) ? GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : "''" ) : "''", (pad /= NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''" -- unsupported macro: GST_FUNCTION ((const char*) (__FUNCTION__)) -- arg-macro: procedure gst_debug_add_log_function (func, data) -- G_STMT_START{ if (func = gst_debug_log_default) { gst_debug_add_log_function(NULL,data); } else { gst_debug_add_log_function(func,data); } }G_STMT_END -- arg-macro: function gst_debug_remove_log_function (func) -- return func = gst_debug_log_default) ? gst_debug_remove_log_function(NULL) : gst_debug_remove_log_function(func; -- arg-macro: procedure GST_DEBUG_CATEGORY (cat) -- GstDebugCategory *cat := NULL -- arg-macro: procedure GST_DEBUG_CATEGORY_EXTERN (cat) -- extern GstDebugCategory *cat -- arg-macro: procedure GST_DEBUG_CATEGORY_STATIC (cat) -- static GstDebugCategory *cat := NULL -- arg-macro: procedure GST_DEBUG_CATEGORY_INIT (cat, name, color, description) -- G_STMT_START{ if (cat = NULL) cat := _gst_debug_category_new (name,color,description); }G_STMT_END -- arg-macro: procedure GST_DEBUG_CATEGORY_GET (cat, name) -- G_STMT_START{ cat := _gst_debug_get_category (name); }G_STMT_END -- unsupported macro: GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ if (G_UNLIKELY (level <= __gst_debug_min)) { gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, (GObject *) (object), __VA_ARGS__); } }G_STMT_END -- arg-macro: procedure GST_CAT_MEMDUMP_OBJECT (cat, obj, msg, data, length) -- __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length) -- arg-macro: procedure GST_CAT_MEMDUMP (cat, msg, data, length) -- __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length) -- arg-macro: procedure GST_MEMDUMP_OBJECT (obj, msg, data, length) -- __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length) -- arg-macro: procedure GST_MEMDUMP (msg, data, length) -- __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length) -- unsupported macro: GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_FIXME_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_TRACE_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, __VA_ARGS__) -- unsupported macro: GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__) -- unsupported macro: GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__) -- unsupported macro: GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__) -- unsupported macro: GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__) -- unsupported macro: GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__) -- unsupported macro: GST_CAT_FIXME(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, __VA_ARGS__) -- unsupported macro: GST_CAT_TRACE(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, __VA_ARGS__) -- unsupported macro: GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__) -- unsupported macro: GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__) -- unsupported macro: GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__) -- unsupported macro: GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__) -- unsupported macro: GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__) -- unsupported macro: GST_FIXME_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, __VA_ARGS__) -- unsupported macro: GST_TRACE_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, __VA_ARGS__) -- unsupported macro: GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__) -- unsupported macro: GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__) -- unsupported macro: GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__) -- unsupported macro: GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__) -- unsupported macro: GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__) -- unsupported macro: GST_FIXME(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, __VA_ARGS__) -- unsupported macro: GST_TRACE(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, __VA_ARGS__) -- unsupported macro: GST_DEBUG_REGISTER_FUNCPTR(ptr) _gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) -- unsupported macro: GST_DEBUG_FUNCPTR(ptr) (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr) -- arg-macro: procedure GST_DEBUG_FUNCPTR_NAME (ptr) -- _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr) -- GStreamer -- * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]> -- * 2000 Wim Taymans <[email protected]> -- * 2003 Benjamin Otte <[email protected]> -- * -- * gstinfo.h: debugging functions -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- --* -- * GstDebugLevel: -- * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate -- * debugging output. -- * @GST_LEVEL_ERROR: Error messages are to be used only when an error occured -- * that stops the application from keeping working correctly. -- * An examples is gst_element_error, which outputs a message with this priority. -- * It does not mean that the application is terminating as with g_errror. -- * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour -- * that could lead to problems or weird behaviour later on. An example of this -- * would be clocking issues ("your computer is pretty slow") or broken input -- * data ("Can't synchronize to stream.") -- * @GST_LEVEL_INFO: Informational messages should be used to keep the developer -- * updated about what is happening. -- * Examples where this should be used are when a typefind function has -- * successfully determined the type of the stream or when an mp3 plugin detects -- * the format to be used. ("This file has mono sound.") -- * @GST_LEVEL_DEBUG: Debugging messages should be used when something common -- * happens that is not the expected default behavior, or something that's -- * useful to know but doesn't happen all the time (ie. per loop iteration or -- * buffer processed or event handled). -- * An example would be notifications about state changes or receiving/sending -- * of events. -- * @GST_LEVEL_LOG: Log messages are messages that are very common but might be -- * useful to know. As a rule of thumb a pipeline that is iterating as expected -- * should never output anything else but LOG messages. Use this log level to -- * log recurring information in chain functions and loop functions, for -- * example. -- * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something -- * in the executed code path is not fully implemented or handled yet. Note -- * that this does not replace proper error handling in any way, the purpose -- * of this message is to make it easier to spot incomplete/unfinished pieces -- * of code when reading the debug log. (Since: 0.10.23) -- * @GST_LEVEL_TRACE: Tracing-related messages (Since: 0.10.30) -- * Examples for this are referencing/dereferencing of objects. -- * @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of -- * data as memory dumps in the log. They will be displayed as hexdump with -- * ASCII characters. (Since: 0.10.23) -- * @GST_LEVEL_COUNT: The number of defined debugging levels. -- * -- * The level defines the importance of a debugging message. The more important a -- * message is, the greater the probability that the debugging system outputs it. -- -- add more -- add more subtype GstDebugLevel is unsigned; GST_LEVEL_NONE : constant GstDebugLevel := 0; GST_LEVEL_ERROR : constant GstDebugLevel := 1; GST_LEVEL_WARNING : constant GstDebugLevel := 2; GST_LEVEL_INFO : constant GstDebugLevel := 3; GST_LEVEL_DEBUG : constant GstDebugLevel := 4; GST_LEVEL_LOG : constant GstDebugLevel := 5; GST_LEVEL_FIXME : constant GstDebugLevel := 6; GST_LEVEL_TRACE : constant GstDebugLevel := 7; GST_LEVEL_MEMDUMP : constant GstDebugLevel := 9; GST_LEVEL_COUNT : constant GstDebugLevel := 10; -- gst/gstinfo.h:89 --* -- * GST_LEVEL_DEFAULT: -- * -- * Defines the default debugging level to be used with GStreamer. It is normally -- * set to #GST_LEVEL_NONE so nothing get printed. -- * As it can be configured at compile time, developer builds may chose to -- * override that though. -- * You can use this as an argument to gst_debug_set_default_threshold() to -- * reset the debugging output to default behaviour. -- -- defines for format (colors etc) -- * don't change them around, it uses terminal layout -- * Terminal color strings: -- * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed -- * Text color codes: -- * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white -- * Background color codes: -- * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white -- --* -- * GstDebugColorFlags: -- * @GST_DEBUG_FG_BLACK: Use black as foreground color. -- * @GST_DEBUG_FG_RED: Use red as foreground color. -- * @GST_DEBUG_FG_GREEN: Use green as foreground color. -- * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color. -- * @GST_DEBUG_FG_BLUE: Use blue as foreground color. -- * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color. -- * @GST_DEBUG_FG_CYAN: Use cyan as foreground color. -- * @GST_DEBUG_FG_WHITE: Use white as foreground color. -- * @GST_DEBUG_BG_BLACK: Use black as background color. -- * @GST_DEBUG_BG_RED: Use red as background color. -- * @GST_DEBUG_BG_GREEN: Use green as background color. -- * @GST_DEBUG_BG_YELLOW: Use yellow as background color. -- * @GST_DEBUG_BG_BLUE: Use blue as background color. -- * @GST_DEBUG_BG_MAGENTA: Use magenta as background color. -- * @GST_DEBUG_BG_CYAN: Use cyan as background color. -- * @GST_DEBUG_BG_WHITE: Use white as background color. -- * @GST_DEBUG_BOLD: Make the output bold. -- * @GST_DEBUG_UNDERLINE: Underline the output. -- * -- * These are some terminal style flags you can use when creating your -- * debugging categories to make them stand out in debugging output. -- -- colors -- background colors -- other formats subtype GstDebugColorFlags is unsigned; GST_DEBUG_FG_BLACK : constant GstDebugColorFlags := 0; GST_DEBUG_FG_RED : constant GstDebugColorFlags := 1; GST_DEBUG_FG_GREEN : constant GstDebugColorFlags := 2; GST_DEBUG_FG_YELLOW : constant GstDebugColorFlags := 3; GST_DEBUG_FG_BLUE : constant GstDebugColorFlags := 4; GST_DEBUG_FG_MAGENTA : constant GstDebugColorFlags := 5; GST_DEBUG_FG_CYAN : constant GstDebugColorFlags := 6; GST_DEBUG_FG_WHITE : constant GstDebugColorFlags := 7; GST_DEBUG_BG_BLACK : constant GstDebugColorFlags := 0; GST_DEBUG_BG_RED : constant GstDebugColorFlags := 16; GST_DEBUG_BG_GREEN : constant GstDebugColorFlags := 32; GST_DEBUG_BG_YELLOW : constant GstDebugColorFlags := 48; GST_DEBUG_BG_BLUE : constant GstDebugColorFlags := 64; GST_DEBUG_BG_MAGENTA : constant GstDebugColorFlags := 80; GST_DEBUG_BG_CYAN : constant GstDebugColorFlags := 96; GST_DEBUG_BG_WHITE : constant GstDebugColorFlags := 112; GST_DEBUG_BOLD : constant GstDebugColorFlags := 256; GST_DEBUG_UNDERLINE : constant GstDebugColorFlags := 512; -- gst/gstinfo.h:160 type GstDebugCategory; --subtype GstDebugCategory is u_GstDebugCategory; -- gst/gstinfo.h:166 --* -- * GstDebugCategory: -- * -- * This is the struct that describes the categories. Once initialized with -- * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore. -- --< private > type GstDebugCategory is record threshold : aliased GLIB.gint; -- gst/gstinfo.h:175 color : aliased GLIB.guint; -- gst/gstinfo.h:176 name : access GLIB.gchar; -- gst/gstinfo.h:178 description : access GLIB.gchar; -- gst/gstinfo.h:179 end record; pragma Convention (C_Pass_By_Copy, GstDebugCategory); -- gst/gstinfo.h:173 -- see defines above --********* some convenience macros for debugging ********* --* -- * GST_STR_NULL: -- * @str: The string to check. -- * -- * Macro to use when a string must not be NULL, but may be NULL. If the string -- * is NULL, "(NULL)" is printed instead. -- * In GStreamer printf string arguments may not be NULL, because on some -- * platforms (ie Solaris) the libc crashes in that case. This includes debugging -- * strings. -- -- FIXME, not MT safe --* -- * GST_DEBUG_PAD_NAME: -- * @pad: The pad to debug. -- * -- * Evaluates to 2 strings, that describe the pad. Often used in debugging -- * statements. -- --* -- * GST_FUNCTION: -- * -- * This macro should evaluate to the name of the current function and be should -- * be defined when configuring your project, as it is compiler dependant. If it -- * is not defined, some default value is used. It is used to provide debugging -- * output with the function name of the message. -- * -- * Note that this is different from G_STRFUNC as we do not want the full -- * function signature in C++ code. -- -- skipped empty struct u_GstDebugMessage -- skipped empty struct GstDebugMessage --* -- * GstLogFunction: -- * @category: a #GstDebugCategory -- * @level: a #GstDebugLevel -- * @file: file name -- * @function: function name -- * @line: line number -- * @object: a #GObject -- * @message: the message -- * @data: user data for the log function -- * -- * Function prototype for a logging function that can be registered with -- * gst_debug_add_log_function(). -- * Use G_GNUC_NO_INSTRUMENT on that function. -- type GstLogFunction is access procedure (arg1 : access GstDebugCategory; arg2 : GstDebugLevel; arg3 : access GLIB.gchar; arg4 : access GLIB.gchar; arg5 : GLIB.gint; arg6 : access GLIB.Object.GObject; arg7 : System.Address; arg8 : System.Address); pragma Convention (C, GstLogFunction); -- gst/gstinfo.h:250 -- FIXME 0.11: move this into private headers -- skipped func _gst_debug_init -- not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P procedure gst_debug_log (category : access GstDebugCategory; level : GstDebugLevel; file : access GLIB.gchar; c_function : access GLIB.gchar; line : GLIB.gint; object : access GLIB.Object.GObject; format : access GLIB.gchar -- , ... ); -- gst/gstinfo.h:267 pragma Import (C, gst_debug_log, "gst_debug_log"); procedure gst_debug_log_valist (category : access GstDebugCategory; level : GstDebugLevel; file : access GLIB.gchar; c_function : access GLIB.gchar; line : GLIB.gint; object : access GLIB.Object.GObject; format : access GLIB.gchar; args : access System.Address); -- gst/gstinfo.h:289 pragma Import (C, gst_debug_log_valist, "gst_debug_log_valist"); -- do not use this function, use the GST_DEBUG_CATEGORY_INIT macro -- skipped func _gst_debug_category_new -- do not use this function, use the GST_DEBUG_CATEGORY_GET macro -- skipped func _gst_debug_get_category -- do not use this function, use the GST_CAT_MEMDUMP_* macros -- skipped func _gst_debug_dump_mem -- we define this to avoid a compiler warning regarding a cast from a function -- * pointer to a void pointer -- * (see https://bugzilla.gnome.org/show_bug.cgi?id=309253) -- type GstDebugFuncPtr is access procedure ; pragma Convention (C, GstDebugFuncPtr); -- gst/gstinfo.h:315 -- do no use these functions, use the GST_DEBUG*_FUNCPTR macros -- skipped func _gst_debug_register_funcptr -- skipped func _gst_debug_nameof_funcptr function gst_debug_message_get (message : System.Address) return access GLIB.gchar; -- gst/gstinfo.h:324 pragma Import (C, gst_debug_message_get, "gst_debug_message_get"); procedure gst_debug_log_default (category : access GstDebugCategory; level : GstDebugLevel; file : access GLIB.gchar; c_function : access GLIB.gchar; line : GLIB.gint; object : access GLIB.Object.GObject; message : System.Address; unused : System.Address); -- gst/gstinfo.h:326 pragma Import (C, gst_debug_log_default, "gst_debug_log_default"); function gst_debug_level_get_name (level : GstDebugLevel) return access GLIB.gchar; -- gst/gstinfo.h:335 pragma Import (C, gst_debug_level_get_name, "gst_debug_level_get_name"); procedure gst_debug_add_log_function (func : GstLogFunction; data : System.Address); -- gst/gstinfo.h:337 pragma Import (C, gst_debug_add_log_function, "gst_debug_add_log_function"); function gst_debug_remove_log_function (func : GstLogFunction) return GLIB.guint; -- gst/gstinfo.h:340 pragma Import (C, gst_debug_remove_log_function, "gst_debug_remove_log_function"); function gst_debug_remove_log_function_by_data (data : System.Address) return GLIB.guint; -- gst/gstinfo.h:341 pragma Import (C, gst_debug_remove_log_function_by_data, "gst_debug_remove_log_function_by_data"); procedure gst_debug_set_active (active : GLIB.gboolean); -- gst/gstinfo.h:343 pragma Import (C, gst_debug_set_active, "gst_debug_set_active"); function gst_debug_is_active return GLIB.gboolean; -- gst/gstinfo.h:344 pragma Import (C, gst_debug_is_active, "gst_debug_is_active"); procedure gst_debug_set_colored (colored : GLIB.gboolean); -- gst/gstinfo.h:346 pragma Import (C, gst_debug_set_colored, "gst_debug_set_colored"); function gst_debug_is_colored return GLIB.gboolean; -- gst/gstinfo.h:347 pragma Import (C, gst_debug_is_colored, "gst_debug_is_colored"); procedure gst_debug_set_default_threshold (level : GstDebugLevel); -- gst/gstinfo.h:349 pragma Import (C, gst_debug_set_default_threshold, "gst_debug_set_default_threshold"); function gst_debug_get_default_threshold return GstDebugLevel; -- gst/gstinfo.h:350 pragma Import (C, gst_debug_get_default_threshold, "gst_debug_get_default_threshold"); procedure gst_debug_set_threshold_for_name (name : access GLIB.gchar; level : GstDebugLevel); -- gst/gstinfo.h:351 pragma Import (C, gst_debug_set_threshold_for_name, "gst_debug_set_threshold_for_name"); procedure gst_debug_unset_threshold_for_name (name : access GLIB.gchar); -- gst/gstinfo.h:353 pragma Import (C, gst_debug_unset_threshold_for_name, "gst_debug_unset_threshold_for_name"); procedure gst_debug_category_free (category : access GstDebugCategory); -- gst/gstinfo.h:356 pragma Import (C, gst_debug_category_free, "gst_debug_category_free"); procedure gst_debug_category_set_threshold (category : access GstDebugCategory; level : GstDebugLevel); -- gst/gstinfo.h:357 pragma Import (C, gst_debug_category_set_threshold, "gst_debug_category_set_threshold"); procedure gst_debug_category_reset_threshold (category : access GstDebugCategory); -- gst/gstinfo.h:359 pragma Import (C, gst_debug_category_reset_threshold, "gst_debug_category_reset_threshold"); function gst_debug_category_get_threshold (category : access GstDebugCategory) return GstDebugLevel; -- gst/gstinfo.h:360 pragma Import (C, gst_debug_category_get_threshold, "gst_debug_category_get_threshold"); function gst_debug_category_get_name (category : access GstDebugCategory) return access GLIB.gchar; -- gst/gstinfo.h:361 pragma Import (C, gst_debug_category_get_name, "gst_debug_category_get_name"); function gst_debug_category_get_color (category : access GstDebugCategory) return GLIB.guint; -- gst/gstinfo.h:362 pragma Import (C, gst_debug_category_get_color, "gst_debug_category_get_color"); function gst_debug_category_get_description (category : access GstDebugCategory) return access GLIB.gchar; -- gst/gstinfo.h:363 pragma Import (C, gst_debug_category_get_description, "gst_debug_category_get_description"); function gst_debug_get_all_categories return access GStreamer.GST_Low_Level.glib_2_0_glib_gslist_h.GSList; -- gst/gstinfo.h:364 pragma Import (C, gst_debug_get_all_categories, "gst_debug_get_all_categories"); function gst_debug_construct_term_color (colorinfo : GLIB.guint) return access GLIB.gchar; -- gst/gstinfo.h:367 pragma Import (C, gst_debug_construct_term_color, "gst_debug_construct_term_color"); function gst_debug_construct_win_color (colorinfo : GLIB.guint) return GLIB.gint; -- gst/gstinfo.h:368 pragma Import (C, gst_debug_construct_win_color, "gst_debug_construct_win_color"); --* -- * GST_DEBUG_CATEGORY: -- * @cat: the category -- * -- * Defines a GstDebugCategory variable. -- * This macro expands to nothing if debugging is disabled. -- --* -- * GST_DEBUG_CATEGORY_EXTERN: -- * @cat: the category -- * -- * Declares a GstDebugCategory variable as extern. Use in header files. -- * This macro expands to nothing if debugging is disabled. -- --* -- * GST_DEBUG_CATEGORY_STATIC: -- * @cat: the category -- * -- * Defines a static GstDebugCategory variable. -- * This macro expands to nothing if debugging is disabled. -- --* -- * GST_DEBUG_CATEGORY_INIT: -- * @cat: the category to initialize. -- * @name: the name of the category. -- * @color: the colors to use for a color representation or 0 for no color. -- * @description: optional description of the category. -- * -- * Initializes a new #GstDebugCategory with the given properties and set to -- * the default threshold. -- * -- * <note> -- * <para> -- * This macro expands to nothing if debugging is disabled. -- * </para> -- * <para> -- * When naming your category, please follow the following conventions to ensure -- * that the pattern matching for categories works as expected. It is not -- * earth-shattering if you don't follow these conventions, but it would be nice -- * for everyone. -- * </para> -- * <para> -- * If you define a category for a plugin or a feature of it, name the category -- * like the feature. So if you wanted to write a "filesrc" element, you would -- * name the category "filesrc". Use lowercase letters only. -- * If you define more than one category for the same element, append an -- * underscore and an identifier to your categories, like this: "filesrc_cache" -- * </para> -- * <para> -- * If you create a library or an application using debugging categories, use a -- * common prefix followed by an underscore for all your categories. GStreamer -- * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure -- * to include uppercase letters. -- * </para> -- * </note> -- --* -- * GST_DEBUG_CATEGORY_GET: -- * @cat: the category to initialize. -- * @name: log category name -- * -- * Looks up an existing #GstDebugCategory by its @name and sets @cat. If the -- * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to -- * @cat. Otherwise @cat will be NULL. -- * -- * |[ -- * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug); -- * #define GST_CAT_DEFAULT gst_myplugin_debug -- * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); -- * ... -- * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element"); -- * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); -- * ]| -- * -- * Since: 0.10.24 -- --* -- * GST_CAT_DEFAULT: -- * -- * Default gstreamer core debug log category. Please define your own. -- GST_CAT_DEFAULT : access GstDebugCategory; -- gst/gstinfo.h:491 pragma Import (C, GST_CAT_DEFAULT, "GST_CAT_DEFAULT"); -- this symbol may not be used -- since 0.10.7, the min debug level, used for quickly discarding debug -- * messages that fall under the threshold. --* -- * GST_CAT_LEVEL_LOG: -- * @cat: category to use -- * @level: the severity of the message -- * @object: the #GObject the message belongs to or NULL if none -- * @...: A printf-style message to output -- * -- * Outputs a debugging message. This is the most general macro for outputting -- * debugging messages. You will probably want to use one of the ones described -- * below. -- -- This one doesn't have varargs in the macro, so it's different than all the -- * other macros and hence in a separate block right here. Docs chunks are -- * with the other doc chunks below though. --* -- * GST_CAT_ERROR_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output an error message belonging to the given object in the given category. -- --* -- * GST_CAT_WARNING_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a warning message belonging to the given object in the given category. -- --* -- * GST_CAT_INFO_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output an informational message belonging to the given object in the given -- * category. -- --* -- * GST_CAT_DEBUG_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output an debugging message belonging to the given object in the given category. -- --* -- * GST_CAT_LOG_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output an logging message belonging to the given object in the given category. -- --* -- * GST_CAT_FIXME_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a fixme message belonging to the given object in the given category. -- * -- * Since: 0.10.23 -- --* -- * GST_CAT_TRACE_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a tracing message belonging to the given object in the given -- * category. -- * -- * Since: 0.10.30 -- --* -- * GST_CAT_MEMDUMP_OBJECT: -- * @cat: category to use -- * @obj: the #GObject the message belongs to -- * @msg: message string to log with the data -- * @data: pointer to the data to output -- * @length: length of the data to output -- * -- * Output a hexdump of @data relating to the given object in the given -- * category. -- * -- * Since: 0.10.23 -- --* -- * GST_CAT_ERROR: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output an error message in the given category. -- --* -- * GST_CAT_WARNING: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output an warning message in the given category. -- --* -- * GST_CAT_INFO: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output an informational message in the given category. -- --* -- * GST_CAT_DEBUG: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output an debugging message in the given category. -- --* -- * GST_CAT_LOG: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output an logging message in the given category. -- --* -- * GST_CAT_FIXME: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output an fixme message in the given category. -- * -- * Since: 0.10.23 -- --* -- * GST_CAT_TRACE: -- * @cat: category to use -- * @...: printf-style message to output -- * -- * Output a tracing message in the given category. -- * -- * Since: 0.10.30 -- --* -- * GST_CAT_MEMDUMP: -- * @cat: category to use -- * @msg: message string to log with the data -- * @data: pointer to the data to output -- * @length: length of the data to output -- * -- * Output a hexdump of @data in the given category. -- * -- * Since: 0.10.23 -- --* -- * GST_ERROR_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output an error message belonging to the given object in the default category. -- --* -- * GST_WARNING_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a warning message belonging to the given object in the default category. -- --* -- * GST_INFO_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output an informational message belonging to the given object in the default -- * category. -- --* -- * GST_DEBUG_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a debugging message belonging to the given object in the default -- * category. -- --* -- * GST_LOG_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a logging message belonging to the given object in the default category. -- --* -- * GST_FIXME_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a fixme message belonging to the given object in the default category. -- * -- * Since: 0.10.23 -- --* -- * GST_TRACE_OBJECT: -- * @obj: the #GObject the message belongs to -- * @...: printf-style message to output -- * -- * Output a tracing message belonging to the given object in the default category. -- * -- * Since: 0.10.30 -- --* -- * GST_MEMDUMP_OBJECT: -- * @obj: the #GObject the message belongs to -- * @msg: message string to log with the data -- * @data: pointer to the data to output -- * @length: length of the data to output -- * -- * Output a logging message belonging to the given object in the default category. -- * -- * Since: 0.10.23 -- --* -- * GST_ERROR: -- * @...: printf-style message to output -- * -- * Output an error message in the default category. -- --* -- * GST_WARNING: -- * @...: printf-style message to output -- * -- * Output a warning message in the default category. -- --* -- * GST_INFO: -- * @...: printf-style message to output -- * -- * Output an informational message in the default category. -- --* -- * GST_DEBUG: -- * @...: printf-style message to output -- * -- * Output a debugging message in the default category. -- --* -- * GST_LOG: -- * @...: printf-style message to output -- * -- * Output a logging message in the default category. -- --* -- * GST_FIXME: -- * @...: printf-style message to output -- * -- * Output a fixme message in the default category. -- * -- * Since: 0.10.23 -- --* -- * GST_TRACE: -- * @...: printf-style message to output -- * -- * Output a tracing message in the default category. -- * -- * Since: 0.10.30 -- --* -- * GST_MEMDUMP: -- * @msg: message string to log with the data -- * @data: pointer to the data to output -- * @length: length of the data to output -- * -- * Output a hexdump of @data. -- * -- * Since: 0.10.23 -- -- no variadic macros, use inline --********* function pointer stuff ********* --* -- * GST_DEBUG_REGISTER_FUNCPTR: -- * @ptr: pointer to the function to register -- * -- * Register a pointer to a function with its name, so it can later be used by -- * GST_DEBUG_FUNCPTR_NAME(). -- * -- * Use this variant of #GST_DEBUG_FUNCPTR if you do not need to use @ptr. -- * -- * Since: 0.10.26 -- --* -- * GST_DEBUG_FUNCPTR: -- * @ptr: pointer to the function to register -- * -- * Register a pointer to a function with its name, so it can later be used by -- * GST_DEBUG_FUNCPTR_NAME(). -- * -- * Returns: the value passed to @ptr. -- --* -- * GST_DEBUG_FUNCPTR_NAME: -- * @ptr: address of the function of which to look up the name -- * -- * Retrieves the name of the function, if it was previously registered with -- * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer. -- * -- * This macro returns a constant string which must not be modified or -- * freed by the caller. -- -- we are using dummy function prototypes here to eat ';' as these macros are -- * used outside of functions procedure gst_debug_print_stack_trace; -- gst/gstinfo.h:1545 pragma Import (C, gst_debug_print_stack_trace, "gst_debug_print_stack_trace"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstinfo_h;
burratoo/Acton
Ada
1,104
ads
------------------------------------------------------------------------------------------ -- -- -- OAK CORE SUPPORT PACKAGE -- -- ARM CORTEX M4F -- -- -- -- OAK.CORE_SUPPORT_PACKAGE.PROCESSOR -- -- -- -- Copyright (C) 2014-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with Oak.Agent; use Oak.Agent; package Oak.Core_Support_Package.Processor with Pure is function Proccessor_Id return Kernel_Id with Inline_Always; end Oak.Core_Support_Package.Processor;
PhillipDyer/sdlada
Ada
2,264
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Windows.Makers -- -- Constructor subprograms which don't dispatch for Window types. -------------------------------------------------------------------------------------------------------------------- package SDL.Video.Windows.Makers is procedure Create (Win : in out Window; Title : in Ada.Strings.UTF_Encoding.UTF_8_String; Position : in SDL.Natural_Coordinates; Size : in SDL.Positive_Sizes; Flags : in Window_Flags := OpenGL); -- A small wrapper around the above procedure. procedure Create (Win : in out Window; Title : in Ada.Strings.UTF_Encoding.UTF_8_String; X : in SDL.Natural_Coordinate; Y : in SDL.Natural_Coordinate; Width : in SDL.Positive_Dimension; Height : in SDL.Positive_Dimension; Flags : in Window_Flags := OpenGL) with Inline => True; -- Create a window from an existing window created in some other way. procedure Create (Win : in out Window; Native : in Native_Window) with Inline => True; end SDL.Video.Windows.Makers;
persan/AdaYaml
Ada
4,077
adb
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; with Yaml.Tags; package body Yaml is function Version_Major return Natural is (1); function Version_Minor return Natural is (3); function Version_Patch return Natural is (0); use type Text.Reference; function Default_Properties return Properties is ((Anchor => Text.Empty, Tag => Tags.Question_Mark)); function Is_Empty (Props : Properties) return Boolean is ((Props.Anchor = Text.Empty and then Props.Tag = Tags.Question_Mark)); function To_String (E : Event) return String is function Prop_String (A : Properties) return String is ((if A.Anchor = Text.Empty then "" else " &" & A.Anchor.Value) & (if A.Tag = Tags.Question_Mark then "" else " <" & A.Tag.Value & '>')); function Scalar_Indicator (S : Scalar_Style_Type) return String is ((case S is when Plain | Any => " :", when Single_Quoted => " '", when Double_Quoted => " """, when Literal => " |", when Folded => " >")); function Escaped (C : Text.Reference) return String is Ret : String (1 .. C.Length * 2); Pos : Positive := 1; begin for I in C.Value.Data'Range loop case C.Value.Data (I) is when Character'Val (7) => Ret (Pos .. Pos + 1) := "\a"; Pos := Pos + 2; when Character'Val (8) => Ret (Pos .. Pos + 1) := "\b"; Pos := Pos + 2; when Character'Val (9) => Ret (Pos .. Pos + 1) := "\t"; Pos := Pos + 2; when Character'Val (10) => Ret (Pos .. Pos + 1) := "\n"; Pos := Pos + 2; when Character'Val (13) => Ret (Pos .. Pos + 1) := "\r"; Pos := Pos + 2; when '\' => Ret (Pos .. Pos + 1) := "\\"; Pos := Pos + 2; when others => Ret (Pos) := C.Value.Data (I); Pos := Pos + 1; end case; end loop; return Ret (1 .. Pos - 1); end Escaped; begin case E.Kind is when Stream_Start => return "+STR"; when Stream_End => return "-STR"; when Document_Start => return "+DOC" & (if E.Implicit_Start then "" else " ---"); when Document_End => return "-DOC" & (if E.Implicit_End then "" else " ..."); when Mapping_Start => return "+MAP" & Prop_String (E.Collection_Properties); when Mapping_End => return "-MAP"; when Sequence_Start => return "+SEQ" & Prop_String (E.Collection_Properties); when Sequence_End => return "-SEQ"; when Scalar => return "=VAL" & Prop_String (E.Scalar_Properties) & Scalar_Indicator (E.Scalar_Style) & Escaped (E.Content); when Alias => return "=ALI *" & E.Target.Value; when Annotation_Start => return "+ANN" & Prop_String (E.Annotation_Properties) & ' ' & E.Namespace & E.Name; when Annotation_End => return "-ANN"; end case; end To_String; procedure Increase_Refcount (Object : not null access Refcount_Base'Class) is begin Object.Refcount := Object.Refcount + 1; end Increase_Refcount; procedure Decrease_Refcount (Object : not null access Refcount_Base'Class) is type Base_Access is access all Refcount_Base'Class; Ptr : Base_Access := Base_Access (Object); procedure Free is new Ada.Unchecked_Deallocation (Refcount_Base'Class, Base_Access); begin Ptr.Refcount := Ptr.Refcount - 1; if Ptr.Refcount = 0 then Free (Ptr); end if; end Decrease_Refcount; end Yaml;
persan/AdaYaml
Ada
441
adb
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Yaml.Dumping_Tests.Suite; with AUnit.Run; with AUnit.Reporter.Text; procedure Yaml.Dumping_Tests.Harness is procedure Run is new AUnit.Run.Test_Runner (Suite.Suite); Reporter : AUnit.Reporter.Text.Text_Reporter; begin Reporter.Set_Use_ANSI_Colors (True); Run (Reporter); end Yaml.Dumping_Tests.Harness;
Rodeo-McCabe/orka
Ada
3,994
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2016 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 Ahven.Framework; use Ahven.Framework; with Ahven.Text_Runner; with Test_SIMD_AVX_Arithmetic; with Test_SIMD_AVX_Compare; with Test_SIMD_AVX_Math; with Test_SIMD_AVX_Swizzle; with Test_SIMD_AVX2_Swizzle; with Test_SIMD_FMA_Doubles_Arithmetic; with Test_SIMD_FMA_Singles_Arithmetic; with Test_SIMD_SSE_Arithmetic; with Test_SIMD_SSE_Compare; with Test_SIMD_SSE_Logical; with Test_SIMD_SSE_Math; with Test_SIMD_SSE_Swizzle; with Test_SIMD_SSE4_1_Math; with Test_Transforms_Singles_Matrices; with Test_Transforms_Doubles_Matrices; with Test_Transforms_Singles_Vectors; with Test_Transforms_Doubles_Vectors; with Test_Transforms_Singles_Quaternions; with Test_Scene_Trees; procedure Run_Unit_Tests is Suite_All : Test_Suite := Create_Suite ("all"); Suite_SIMD : constant Test_Suite_Access := Create_Suite ("SIMD"); Suite_Transforms : constant Test_Suite_Access := Create_Suite ("Transforms"); Suite_SSE : constant Test_Suite_Access := Create_Suite ("SSE (Singles)"); Suite_SSE4_1 : constant Test_Suite_Access := Create_Suite ("SSE4.1 (Singles)"); Suite_AVX : constant Test_Suite_Access := Create_Suite ("AVX (Doubles)"); Suite_AVX2 : constant Test_Suite_Access := Create_Suite ("AVX2 (Doubles)"); Suite_FMA_S : constant Test_Suite_Access := Create_Suite ("FMA (Singles)"); Suite_FMA_D : constant Test_Suite_Access := Create_Suite ("FMA (Doubles)"); Suite_Transforms_Singles : constant Test_Suite_Access := Create_Suite ("Singles"); Suite_Transforms_Doubles : constant Test_Suite_Access := Create_Suite ("Doubles"); begin -- SIMD Suite_SSE.Add_Test (new Test_SIMD_SSE_Arithmetic.Test); Suite_SSE.Add_Test (new Test_SIMD_SSE_Compare.Test); Suite_SSE.Add_Test (new Test_SIMD_SSE_Logical.Test); Suite_SSE.Add_Test (new Test_SIMD_SSE_Math.Test); Suite_SSE.Add_Test (new Test_SIMD_SSE_Swizzle.Test); Suite_SIMD.Add_Test (Suite_SSE); Suite_SSE4_1.Add_Test (new Test_SIMD_SSE4_1_Math.Test); Suite_SIMD.Add_Test (Suite_SSE4_1); Suite_AVX.Add_Test (new Test_SIMD_AVX_Arithmetic.Test); Suite_AVX.Add_Test (new Test_SIMD_AVX_Compare.Test); Suite_AVX.Add_Test (new Test_SIMD_AVX_Math.Test); Suite_AVX.Add_Test (new Test_SIMD_AVX_Swizzle.Test); Suite_SIMD.Add_Test (Suite_AVX); Suite_AVX2.Add_Test (new Test_SIMD_AVX2_Swizzle.Test); Suite_SIMD.Add_Test (Suite_AVX2); Suite_FMA_S.Add_Test (new Test_SIMD_FMA_Singles_Arithmetic.Test); Suite_FMA_D.Add_Test (new Test_SIMD_FMA_Doubles_Arithmetic.Test); Suite_SIMD.Add_Test (Suite_FMA_S); Suite_SIMD.Add_Test (Suite_FMA_D); Suite_All.Add_Test (Suite_SIMD); -- Transforms Suite_Transforms_Singles.Add_Test (new Test_Transforms_Singles_Matrices.Test); Suite_Transforms_Singles.Add_Test (new Test_Transforms_Singles_Vectors.Test); Suite_Transforms_Singles.Add_Test (new Test_Transforms_Singles_Quaternions.Test); Suite_Transforms.Add_Test (Suite_Transforms_Singles); Suite_Transforms_Doubles.Add_Test (new Test_Transforms_Doubles_Matrices.Test); Suite_Transforms_Doubles.Add_Test (new Test_Transforms_Doubles_Vectors.Test); Suite_Transforms.Add_Test (Suite_Transforms_Doubles); Suite_All.Add_Test (Suite_Transforms); -- Scene tree Suite_All.Add_Test (new Test_Scene_Trees.Test); Ahven.Text_Runner.Run (Suite_All); end Run_Unit_Tests;
godunko/adawebui
Ada
4,837
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2021, 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: 5682 $ $Date: 2017-01-11 00:55:53 +0300 (Wed, 11 Jan 2017) $ ------------------------------------------------------------------------------ package body Web.UI.Events.Mouse is ------------------ -- Constructors -- ------------------ package body Constructors is ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Mouse_Event'Class; Event : in out Web.UI_Events.Mouse_Events.Mouse_Event'Class) is begin Web.UI.Events.Constructors.Initialize (Self, Event); end Initialize; end Constructors; ------------- -- Buttons -- ------------- function Buttons (Self : Mouse_Event'Class) return Mouse_Buttons is Buttons : constant Web.DOM_Unsigned_Short := Self.Event.As_Mouse_Event.Buttons; Result : Mouse_Buttons := (others => False); begin if (Buttons and 2#0001#) /= 0 then Result (Button_1) := True; end if; if (Buttons and 2#0010#) /= 0 then Result (Button_2) := True; end if; if (Buttons and 2#0100#) /= 0 then Result (Button_3) := True; end if; return Result; end Buttons; ------- -- X -- ------- function X (Self : Mouse_Event'Class) return Long_Float is begin return Long_Float (Self.Event.As_Mouse_Event.Offset_X); end X; ------- -- Y -- ------- function Y (Self : Mouse_Event'Class) return Long_Float is begin return Long_Float (Self.Event.As_Mouse_Event.Offset_Y); end Y; end Web.UI.Events.Mouse;
AdaCore/libadalang
Ada
21,602
adb
-- -- Copyright (C) 2014-2022, AdaCore -- SPDX-License-Identifier: Apache-2.0 -- with Ada.Characters.Handling; use Ada.Characters.Handling; with GNAT.Strings; use GNAT.Strings; with GNATCOLL.Utils; with GNATCOLL.VFS; use GNATCOLL.VFS; with GPR2.Containers; with GPR2.Path_Name; with GPR2.Project.Attribute; with GPR2.Project.Attribute.Set; with GPR2.Project.Attribute_Index; with GPR2.Project.Source; with GPR2.Project.View.Set; with GPR2.Unit; package body Libadalang.GPR_Utils is ------------- -- No_View -- ------------- function No_View (Tree : Any_Tree) return Any_View is begin case Tree.Kind is when GPR1_Kind => return (Kind => GPR1_Kind, GPR1_Value => GPR1.No_Project); when GPR2_Kind => return (Kind => GPR2_Kind, GPR2_Value => GPR2.Project.View.Undefined); end case; end No_View; ---------- -- Root -- ---------- function Root (Self : Any_Tree) return Any_View is begin case Self.Kind is when GPR1_Kind => return (Kind => GPR1_Kind, GPR1_Value => Self.GPR1_Value.Root_Project); when GPR2_Kind => return (Kind => GPR2_Kind, GPR2_Value => Self.GPR2_Value.Root_Project); end case; end Root; ---------- -- Name -- ---------- function Name (Self : Any_View) return String is begin case Self.Kind is when GPR1_Kind => return Self.GPR1_Value.Name; when GPR2_Kind => return String (Self.GPR2_Value.Name); end case; end Name; -------------- -- Dir_Name -- -------------- function Dir_Name (Self : Any_View) return String is begin case Self.Kind is when GPR1_Kind => return +Self.GPR1_Value.Project_Path.Dir_Name; when GPR2_Kind => return String (Self.GPR2_Value.Dir_Name.Value); end case; end Dir_Name; ------------- -- Iterate -- ------------- procedure Iterate (Self : Any_View; Process : access procedure (Self : Any_View)) is begin case Self.Kind is when GPR1_Kind => declare use type GPR1.Project_Type; It : GPR1.Project_Iterator := Self.GPR1_Value.Start; P : GPR1.Project_Type; begin loop P := GPR1.Current (It); exit when P = GPR1.No_Project; Process.all ((Kind => GPR1_Kind, GPR1_Value => P)); GPR1.Next (It); end loop; end; when GPR2_Kind => -- ``View`` is not in its own closure, so process it first Process.all (Self); -- If ``View`` is an aggregate project, also go through the -- aggregated projects. if Self.GPR2_Value.Kind in GPR2.Aggregate_Kind then for P of Self.GPR2_Value.Aggregated loop Iterate ((Kind => GPR2_Kind, GPR2_Value => P), Process); end loop; end if; -- If ``View`` extends another project, also go through that other -- project. -- -- TODO (VB04-038)??? This may cause ``Iterate`` to process the same -- project multiple times: it is inefficient, but should not be a -- problem. Hopefully at some point GPR2 will provide an exhaustive -- iteration scheme which we will be able to use here as well. if Self.GPR2_Value.Is_Extending then Iterate ((Kind => GPR2_Kind, GPR2_Value => Self.GPR2_Value.Extended_Root), Process); end if; for View of Self.GPR2_Value.Closure loop Process.all ((Kind => GPR2_Kind, GPR2_Value => View)); end loop; end case; end Iterate; -------------------------- -- Is_Aggregate_Project -- -------------------------- function Is_Aggregate_Project (Self : Any_View) return Boolean is use type GPR2.Project_Kind; begin case Self.Kind is when GPR1_Kind => return Self.GPR1_Value.Is_Aggregate_Project; when GPR2_Kind => return Self.GPR2_Value.Kind = GPR2.K_Aggregate; end case; end Is_Aggregate_Project; ------------------------- -- Aggregated_Projects -- ------------------------- function Aggregated_Projects (Self : Any_View) return View_Vectors.Vector is Result : View_Vectors.Vector; procedure Process (Self : Any_View); -- If ``Self`` is an aggregate proejct, add it to ``Result`` and recurse -- on its aggregated projects. ------------- -- Process -- ------------- procedure Process (Self : Any_View) is begin if Is_Aggregate_Project (Self) then case Self.Kind is when GPR1_Kind => declare Subprojects : GPR1.Project_Array_Access := Self.GPR1_Value.Aggregated_Projects; begin for P of Subprojects.all loop Process ((Kind => GPR1_Kind, GPR1_Value => P)); end loop; GPR1.Unchecked_Free (Subprojects); end; when GPR2_Kind => for P of Self.GPR2_Value.Aggregated loop Process ((Kind => GPR2_Kind, GPR2_Value => P)); end loop; end case; else Result.Append (Self); end if; end Process; begin Process (Self); return Result; end Aggregated_Projects; ----------------- -- Is_Extended -- ----------------- function Is_Extended (Self : Any_View) return Boolean is use type GPR1.Project_Type; begin case Self.Kind is when GPR1_Kind => return Self.GPR1_Value.Extending_Project /= GPR1.No_Project; when GPR2_Kind => return Self.GPR2_Value.Is_Extended; end case; end Is_Extended; ---------------------- -- Source_Dirs_Path -- ---------------------- function Source_Dirs_Path (Tree : Any_Tree; View : Any_View) return Any_Path is Root_View : constant Any_View := (if View = No_View (Tree) then Root (Tree) else View); -- Subproject from which to start looking for source directories Result : Any_Path; procedure Process (Self : Any_View); -- Add ``Self``'s source directories to ``Result`` ------------- -- Process -- ------------- procedure Process (Self : Any_View) is begin case Self.Kind is when GPR1_Kind => -- Aggregate projects do not have source dirs/files of their -- own: just skip them. if not Is_Aggregate_Project (Self) then for D of Self.GPR1_Value.Source_Dirs loop Add_Directory (Result, +D.Full_Name); end loop; end if; when GPR2_Kind => if Self.GPR2_Value.Kind in GPR2.With_Source_Dirs_Kind then for D of Self.GPR2_Value.Source_Directories loop Add_Directory (Result, String (D.Value)); end loop; end if; end case; end Process; begin Iterate (Root_View, Process'Access); return Result; end Source_Dirs_Path; ---------------- -- Object_Dir -- ---------------- function Object_Dir (Self : Any_View) return String is begin case Self.Kind is when GPR1_Kind => return +Self.GPR1_Value.Object_Dir.Full_Name; when GPR2_Kind => return String (Self.GPR2_Value.Object_Directory.Value); end case; end Object_Dir; ----------- -- Value -- ----------- function Value (Self : Any_View; Attribute : Any_Attribute) return String is begin case Self.Kind is when GPR1_Kind => return Self.GPR1_Value.Attribute_Value (Attribute.GPR1_String_Value.all); when GPR2_Kind => declare Attr : constant GPR2.Project.Attribute.Object := Self.GPR2_Value.Attribute (Attribute.GPR2_Value); begin return (if Attr.Is_Defined then Attr.Value.Text else ""); end; end case; end Value; ------------- -- Indexes -- ------------- function Indexes (Self : Any_View; Attribute : Any_Attribute) return XString_Array is begin case Self.Kind is when GPR1_Kind => declare Indexes : String_List := Self.GPR1_Value.Attribute_Indexes (Attribute.GPR1_List_Value.all); begin return Result : XString_Array (Indexes'Range) do for I in Result'Range loop Result (I) := To_XString (Indexes (I).all); end loop; GNATCOLL.Utils.Free (Indexes); end return; end; when GPR2_Kind => declare Attrs : constant GPR2.Project.Attribute.Set.Object := Self.GPR2_Value.Attributes (Attribute.GPR2_Value); I : Positive := 1; begin return Result : XString_Array (1 .. Natural (Attrs.Length)) do for A of Attrs loop Result (I) := To_XString (A.Index.Text); I := I + 1; end loop; end return; end; end case; end Indexes; ------------ -- Values -- ------------ function Values (Self : Any_View; Attribute : Any_Attribute; Index : String) return XString_Array is begin case Self.Kind is when GPR1_Kind => declare Values : String_List_Access := Self.GPR1_Value.Attribute_Value (Attribute.GPR1_List_Value.all, Index); begin if Values = null then return (1 .. 0 => <>); else return Result : XString_Array (Values.all'Range) do for I in Result'Range loop Result (I) := To_XString (Values.all (I).all); end loop; Free (Values); end return; end if; end; when GPR2_Kind => declare Attr : constant GPR2.Project.Attribute.Object := Self.GPR2_Value.Attribute (Name => Attribute.GPR2_Value, Index => GPR2.Project.Attribute_Index.Create (Index)); Values : constant GPR2.Containers.Source_Value_List := (if Attr.Is_Defined then Attr.Values else GPR2.Containers.Source_Value_Type_List.Empty_Vector); begin return Result : XString_Array (1 .. Natural (Values.Length)) do for I in Result'Range loop Result (I) := To_XString (Values (I).Text); end loop; end return; end; end case; end Values; ------------------- -- Is_Ada_Source -- ------------------- function Is_Ada_Source (Tree : Any_Tree; View : Any_View; Filename : String) return Boolean is begin case Tree.Kind is when GPR1_Kind => declare use type GPR1.Project_Type; Path : constant GNATCOLL.VFS.Virtual_File := Create (+Filename); Infos : constant GPR1.File_Info_Set := Tree.GPR1_Value.Info_Set (Path); begin return (for some Info of Infos => GPR1.File_Info (Info).Project (Root_If_Not_Found => False) = View.GPR1_Value and then To_Lower (GPR1.File_Info (Info).Language) = "ada"); end; when GPR2_Kind => declare Path : constant GPR2.Path_Name.Object := GPR2.Path_Name.Create_File (GPR2.Filename_Type (Filename), GPR2.Path_Name.No_Resolution); File : constant GPR2.Project.Source.Object := View.GPR2_Value.Source (Path); begin return File.Is_Defined and then File.Is_Ada; end; end case; end Is_Ada_Source; ----------------------- -- Iterate_Ada_Units -- ----------------------- procedure Iterate_Ada_Units (Tree : Any_Tree; View : Any_View; Process : access procedure (Unit_Name : String; Unit_Part : Any_Unit_Part; Filename : String); Recursive : Boolean := True) is begin case Tree.Kind is when GPR1_Kind => declare use type GPR1.Project_Type; Sources : File_Array_Access := (if Recursive then View.GPR1_Value.Source_Files (Recursive => True) else View.GPR1_Value.Extended_Projects_Source_Files); Set : GPR1.File_Info_Set; FI : GPR1.File_Info; begin for File of Sources.all loop -- Look for the file info that corresponds to File. -- -- TODO??? Due to how GNATCOLL.Projects exposes aggregate -- projects, we have no way to get the unit name and unit part -- from ``File`` without performing a project tree wide search: -- we would like instead to search on ``View`` only, but this -- is not possible. For now, just do the global search and -- hope that ``File`` always corresponds to the same unit file -- and unit part in the aggregate project. While this sounds a -- reasonable assumption, we know it's possible to build a -- project with unlikely Name package attribute that break this -- assumption. Set := Tree.GPR1_Value.Info_Set (File); -- For some reason, File_Info_Set contains -- File_Info_Astract'Class objects, while the only instance of -- this type is File_Info. So the above conversion should -- always succeed. FI := GPR1.File_Info (Set.First_Element); -- Info_Set returns a project-less file info when called on -- files that are not part of the project tree. Here, all our -- source files belong to Tree, so the following assertion -- should hold. pragma Assert (FI.Project /= GPR1.No_Project); if Ada.Characters.Handling.To_Lower (FI.Language) = "ada" then Process.all (Unit_Name => FI.Unit_Name, Unit_Part => (case FI.Unit_Part is when GPR1.Unit_Spec => Unit_Spec, when others => Unit_Body), Filename => +File.Full_Name); end if; end loop; Unchecked_Free (Sources); end; when GPR2_Kind => -- Go through all Ada sources in all projects in ``View``'s closure. -- -- TODO??? (VC07-012) Use the upcoming GPR2.Build high level API -- instead of using this internal API. declare procedure Process_Wrapper (Source : GPR2.Project.Source.Object); -- Call ``Process`` on all units in ``Source`` --------------------- -- Process_Wrapper -- --------------------- procedure Process_Wrapper (Source : GPR2.Project.Source.Object) is Filename : constant String := String (Source.Path_Name.Value); begin for U of Source.Units loop Process.all (Unit_Name => String (U.Name), Unit_Part => (if U.Kind in GPR2.Unit.Spec_Kind then Unit_Spec else Unit_Body), Filename => Filename); end loop; end Process_Wrapper; begin if Recursive then Tree.GPR2_Value.For_Each_Source (View => View.GPR2_Value, Action => Process_Wrapper'Access, Language => GPR2.Ada_Language, Externally_Built => True); else for S of View.GPR2_Value.Sources loop Process_Wrapper (S); end loop; end if; end; end case; end Iterate_Ada_Units; ----------------------------------- -- Iterate_Ada_Compiler_Switches -- ----------------------------------- procedure Iterate_Ada_Compiler_Switches (Tree : Any_Tree; View : Any_View; Process : access procedure (View : Any_View; Switch : XString)) is Root_View : constant Any_View := (if View = No_View (Tree) then Root (Tree) else View); -- Subproject from which to start probing compilation options procedure Process_View (Self : Any_View); -- Call ``Process`` on all Ada compiler switches found in ``Self`` procedure Process_Switches (View : Any_View; Attribute : GPR_Utils.Any_Attribute; Index : String); -- Call ``Process`` on all switches found in the ``Attribute (Index)`` -- GPR attribute found in ``P``. ------------------ -- Process_View -- ------------------ procedure Process_View (Self : Any_View) is Kind : Project_Kind renames Self.Kind; Default_Switches : GPR_Utils.Any_Attribute renames Attributes.Default_Switches (Kind); Switches : GPR_Utils.Any_Attribute renames Attributes.Switches (Kind); begin -- Process default compiler switches for the Ada language Process_Switches (Self, Default_Switches, "Ada"); -- Same for Switches attribute Process_Switches (Self, Switches, "Ada"); -- Also process compiler switches for all Ada sources for Source of Indexes (Self, Switches) loop declare Filename : constant String := Source.To_String; begin if Is_Ada_Source (Tree, Self, Filename) then Process_Switches (Self, Switches, Filename); end if; end; end loop; end Process_View; ---------------------- -- Process_Switches -- ---------------------- procedure Process_Switches (View : Any_View; Attribute : GPR_Utils.Any_Attribute; Index : String) is begin for Arg of Values (View, Attribute, Index) loop Process.all (View, Arg); end loop; end Process_Switches; begin -- Go through all requested subprojects Iterate (Root_View, Process_View'Access); end Iterate_Ada_Compiler_Switches; ------------ -- Lookup -- ------------ function Lookup (Self : GPR2.Project.Tree.Object; Project_Name : String) return GPR2.Project.View.Object is use type GPR2.Path_Name.Object; Normalized_Name : constant String := To_Lower (Project_Name); File_Name : constant GPR2.Path_Name.Object := GPR2.Path_Name.Create_File (GPR2.Filename_Type (Project_Name)); begin return Result : GPR2.Project.View.Object do for View of Self loop if To_Lower (String (View.Name)) = Normalized_Name or else View.Path_Name = File_Name then -- If here are more than one project matching the requested -- name, abort with an error. if Result.Is_Defined then raise GPR2.Project_Error with "ambiguous project: " & Project_Name; end if; Result := View; end if; end loop; -- If we found no project matching the requested name, abort with -- an error. if not Result.Is_Defined then raise GPR2.Project_Error with "no such project: " & Project_Name; end if; end return; end Lookup; ------------- -- Closure -- ------------- function Closure (Self : GPR2.Project.View.Object) return GPR2.Project.View.Vector.Object is Result : GPR2.Project.View.Vector.Object; Visited : GPR2.Project.View.Set.Object; procedure Visit (Self : GPR2.Project.View.Object); -- If ``Self`` was already visited, do nothing. Otherwise add it to -- ``Visited`` and ``Result`` and visit its dependencies. ----------- -- Visit -- ----------- procedure Visit (Self : GPR2.Project.View.Object) is use type GPR2.Project_Kind; begin if Visited.Contains (Self) then return; end if; Visited.Include (Self); Result.Append (Self); if Self.Kind in GPR2.Aggregate_Kind then for P of Self.Aggregated loop Visit (P); end loop; end if; for P of Self.Imports loop Visit (P); end loop; for P of Self.Limited_Imports loop Visit (P); end loop; -- TODO??? (VC07-012) What about extended projects? We should -- probably use a robust implementation provided by GPR2. end Visit; begin Visit (Self); return Result; end Closure; end Libadalang.GPR_Utils;
burratoo/Acton
Ada
1,822
ads
------------------------------------------------------------------------------------------ -- -- -- OAK PROCESSOR SUPPORT PACKAGE -- -- FREESCALE MPC5544 -- -- -- -- MPC5554.ETPU.PWM.AUTO -- -- -- -- Copyright (C) 2010-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with MPC5554; use MPC5554; with MPC5554.eTPU; use MPC5554.eTPU; with MPC5554.eTPU.Util; use MPC5554.eTPU.Util; package MPC5554.eTPU.PWM.AUTO with Preelaborate is -- Function Configuration Information PWM_Function_Number : constant Function_Number := 1; PWM_Table_Select : constant ETCS_Type := Alternative; PWM_Num_Parms : constant Byte_Quanity_Type := 16#0018#; -- Host Service Request Definitions PWM_Init : constant HSR_Type := 7; PWM_IMM_Update : constant HSR_Type := 3; PWM_CO_Update : constant HSR_Type := 5; -- Parameter Definitions PWM_Period_Offset : constant Shared_Data_Offset := 16#0001#; PWM_Active_Offset : constant Shared_Data_Offset := 16#0005#; PWM_Co_Period_Offset : constant Shared_Data_Offset := 16#0009#; PWM_Co_Active_Offset : constant Shared_Data_Offset := 16#000D#; end MPC5554.eTPU.PWM.AUTO;
reznikmm/matreshka
Ada
3,919
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web 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 package provides registry of SOAP Body children elements decoders. -- Decoders are identified by namespace URI of child element. ------------------------------------------------------------------------------ with Ada.Tags; package Web_Services.SOAP.Payloads.Decoders.Registry is procedure Register (URI : League.Strings.Universal_String; Tag : Ada.Tags.Tag); function Resolve (URI : League.Strings.Universal_String) return Web_Services.SOAP.Payloads.Decoders.SOAP_Payload_Decoder_Access; end Web_Services.SOAP.Payloads.Decoders.Registry;
Fabien-Chouteau/samd51-hal
Ada
65,062
ads
pragma Style_Checks (Off); -- This spec has been automatically generated from ATSAMD51G19A.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package SAM_SVD.USB is pragma Preelaborate; --------------- -- Registers -- --------------- ----------------------------------- -- UsbDevice cluster's Registers -- ----------------------------------- -- Operating Mode type CTRLA_MODESelect is (-- Device Mode DEVICE, -- Host Mode HOST) with Size => 1; for CTRLA_MODESelect use (DEVICE => 0, HOST => 1); -- Control A type USB_CTRLA_USB_DEVICE_Register is record -- Software Reset SWRST : Boolean := False; -- Enable ENABLE : Boolean := False; -- Run in Standby Mode RUNSTDBY : Boolean := False; -- unspecified Reserved_3_6 : HAL.UInt4 := 16#0#; -- Operating Mode MODE : CTRLA_MODESelect := SAM_SVD.USB.DEVICE; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_CTRLA_USB_DEVICE_Register use record SWRST at 0 range 0 .. 0; ENABLE at 0 range 1 .. 1; RUNSTDBY at 0 range 2 .. 2; Reserved_3_6 at 0 range 3 .. 6; MODE at 0 range 7 .. 7; end record; -- Synchronization Busy type USB_SYNCBUSY_USB_DEVICE_Register is record -- Read-only. Software Reset Synchronization Busy SWRST : Boolean; -- Read-only. Enable Synchronization Busy ENABLE : Boolean; -- unspecified Reserved_2_7 : HAL.UInt6; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_SYNCBUSY_USB_DEVICE_Register use record SWRST at 0 range 0 .. 0; ENABLE at 0 range 1 .. 1; Reserved_2_7 at 0 range 2 .. 7; end record; subtype USB_QOSCTRL_USB_DEVICE_CQOS_Field is HAL.UInt2; subtype USB_QOSCTRL_USB_DEVICE_DQOS_Field is HAL.UInt2; -- USB Quality Of Service type USB_QOSCTRL_USB_DEVICE_Register is record -- Configuration Quality of Service CQOS : USB_QOSCTRL_USB_DEVICE_CQOS_Field := 16#3#; -- Data Quality of Service DQOS : USB_QOSCTRL_USB_DEVICE_DQOS_Field := 16#3#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_QOSCTRL_USB_DEVICE_Register use record CQOS at 0 range 0 .. 1; DQOS at 0 range 2 .. 3; Reserved_4_7 at 0 range 4 .. 7; end record; -- Speed Configuration type CTRLB_SPDCONFSelect is (-- FS : Full Speed FS, -- LS : Low Speed LS, -- HS : High Speed capable HS, -- HSTM: High Speed Test Mode (force high-speed mode for test mode) HSTM) with Size => 2; for CTRLB_SPDCONFSelect use (FS => 0, LS => 1, HS => 2, HSTM => 3); -- Link Power Management Handshake type CTRLB_LPMHDSKSelect is (-- No handshake. LPM is not supported NO, -- ACK ACK, -- NYET NYET, -- STALL STALL) with Size => 2; for CTRLB_LPMHDSKSelect use (NO => 0, ACK => 1, NYET => 2, STALL => 3); -- DEVICE Control B type USB_CTRLB_USB_DEVICE_Register is record -- Detach DETACH : Boolean := True; -- Upstream Resume UPRSM : Boolean := False; -- Speed Configuration SPDCONF : CTRLB_SPDCONFSelect := SAM_SVD.USB.FS; -- No Reply NREPLY : Boolean := False; -- Test mode J TSTJ : Boolean := False; -- Test mode K TSTK : Boolean := False; -- Test packet mode TSTPCKT : Boolean := False; -- Specific Operational Mode OPMODE2 : Boolean := False; -- Global NAK GNAK : Boolean := False; -- Link Power Management Handshake LPMHDSK : CTRLB_LPMHDSKSelect := SAM_SVD.USB.NO; -- unspecified Reserved_12_15 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_CTRLB_USB_DEVICE_Register use record DETACH at 0 range 0 .. 0; UPRSM at 0 range 1 .. 1; SPDCONF at 0 range 2 .. 3; NREPLY at 0 range 4 .. 4; TSTJ at 0 range 5 .. 5; TSTK at 0 range 6 .. 6; TSTPCKT at 0 range 7 .. 7; OPMODE2 at 0 range 8 .. 8; GNAK at 0 range 9 .. 9; LPMHDSK at 0 range 10 .. 11; Reserved_12_15 at 0 range 12 .. 15; end record; subtype USB_DADD_USB_DEVICE_DADD_Field is HAL.UInt7; -- DEVICE Device Address type USB_DADD_USB_DEVICE_Register is record -- Device Address DADD : USB_DADD_USB_DEVICE_DADD_Field := 16#0#; -- Device Address Enable ADDEN : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_DADD_USB_DEVICE_Register use record DADD at 0 range 0 .. 6; ADDEN at 0 range 7 .. 7; end record; -- Speed Status type STATUS_SPEEDSelect is (-- Full-speed mode FS, -- Low-speed mode LS, -- High-speed mode HS) with Size => 2; for STATUS_SPEEDSelect use (FS => 0, LS => 1, HS => 2); -- USB Line State Status type STATUS_LINESTATESelect is (-- SE0/RESET Val_0, -- FS-J or LS-K State Val_1, -- FS-K or LS-J State Val_2) with Size => 2; for STATUS_LINESTATESelect use (Val_0 => 0, Val_1 => 1, Val_2 => 2); -- DEVICE Status type USB_STATUS_USB_DEVICE_Register is record -- unspecified Reserved_0_1 : HAL.UInt2; -- Read-only. Speed Status SPEED : STATUS_SPEEDSelect; -- unspecified Reserved_4_5 : HAL.UInt2; -- Read-only. USB Line State Status LINESTATE : STATUS_LINESTATESelect; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_STATUS_USB_DEVICE_Register use record Reserved_0_1 at 0 range 0 .. 1; SPEED at 0 range 2 .. 3; Reserved_4_5 at 0 range 4 .. 5; LINESTATE at 0 range 6 .. 7; end record; -- Fine State Machine Status type FSMSTATUS_FSMSTATESelect is (-- OFF (L3). It corresponds to the powered-off, disconnected, and disabled -- state OFF, -- ON (L0). It corresponds to the Idle and Active states ON, -- SUSPEND (L2) SUSPEND, -- SLEEP (L1) SLEEP, -- DNRESUME. Down Stream Resume. DNRESUME, -- UPRESUME. Up Stream Resume. UPRESUME, -- RESET. USB lines Reset. RESET) with Size => 7; for FSMSTATUS_FSMSTATESelect use (OFF => 1, ON => 2, SUSPEND => 4, SLEEP => 8, DNRESUME => 16, UPRESUME => 32, RESET => 64); -- Finite State Machine Status type USB_FSMSTATUS_USB_DEVICE_Register is record -- Read-only. Fine State Machine Status FSMSTATE : FSMSTATUS_FSMSTATESelect; -- unspecified Reserved_7_7 : HAL.Bit; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_FSMSTATUS_USB_DEVICE_Register use record FSMSTATE at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; end record; subtype USB_FNUM_USB_DEVICE_MFNUM_Field is HAL.UInt3; subtype USB_FNUM_USB_DEVICE_FNUM_Field is HAL.UInt11; -- DEVICE Device Frame Number type USB_FNUM_USB_DEVICE_Register is record -- Read-only. Micro Frame Number MFNUM : USB_FNUM_USB_DEVICE_MFNUM_Field; -- Read-only. Frame Number FNUM : USB_FNUM_USB_DEVICE_FNUM_Field; -- unspecified Reserved_14_14 : HAL.Bit; -- Read-only. Frame Number CRC Error FNCERR : Boolean; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_FNUM_USB_DEVICE_Register use record MFNUM at 0 range 0 .. 2; FNUM at 0 range 3 .. 13; Reserved_14_14 at 0 range 14 .. 14; FNCERR at 0 range 15 .. 15; end record; -- DEVICE Device Interrupt Enable Clear type USB_INTENCLR_USB_DEVICE_Register is record -- Suspend Interrupt Enable SUSPEND : Boolean := False; -- Micro Start of Frame Interrupt Enable in High Speed Mode MSOF : Boolean := False; -- Start Of Frame Interrupt Enable SOF : Boolean := False; -- End of Reset Interrupt Enable EORST : Boolean := False; -- Wake Up Interrupt Enable WAKEUP : Boolean := False; -- End Of Resume Interrupt Enable EORSM : Boolean := False; -- Upstream Resume Interrupt Enable UPRSM : Boolean := False; -- Ram Access Interrupt Enable RAMACER : Boolean := False; -- Link Power Management Not Yet Interrupt Enable LPMNYET : Boolean := False; -- Link Power Management Suspend Interrupt Enable LPMSUSP : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_INTENCLR_USB_DEVICE_Register use record SUSPEND at 0 range 0 .. 0; MSOF at 0 range 1 .. 1; SOF at 0 range 2 .. 2; EORST at 0 range 3 .. 3; WAKEUP at 0 range 4 .. 4; EORSM at 0 range 5 .. 5; UPRSM at 0 range 6 .. 6; RAMACER at 0 range 7 .. 7; LPMNYET at 0 range 8 .. 8; LPMSUSP at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- DEVICE Device Interrupt Enable Set type USB_INTENSET_USB_DEVICE_Register is record -- Suspend Interrupt Enable SUSPEND : Boolean := False; -- Micro Start of Frame Interrupt Enable in High Speed Mode MSOF : Boolean := False; -- Start Of Frame Interrupt Enable SOF : Boolean := False; -- End of Reset Interrupt Enable EORST : Boolean := False; -- Wake Up Interrupt Enable WAKEUP : Boolean := False; -- End Of Resume Interrupt Enable EORSM : Boolean := False; -- Upstream Resume Interrupt Enable UPRSM : Boolean := False; -- Ram Access Interrupt Enable RAMACER : Boolean := False; -- Link Power Management Not Yet Interrupt Enable LPMNYET : Boolean := False; -- Link Power Management Suspend Interrupt Enable LPMSUSP : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_INTENSET_USB_DEVICE_Register use record SUSPEND at 0 range 0 .. 0; MSOF at 0 range 1 .. 1; SOF at 0 range 2 .. 2; EORST at 0 range 3 .. 3; WAKEUP at 0 range 4 .. 4; EORSM at 0 range 5 .. 5; UPRSM at 0 range 6 .. 6; RAMACER at 0 range 7 .. 7; LPMNYET at 0 range 8 .. 8; LPMSUSP at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- DEVICE Device Interrupt Flag type USB_INTFLAG_USB_DEVICE_Register is record -- Suspend SUSPEND : Boolean := False; -- Micro Start of Frame in High Speed Mode MSOF : Boolean := False; -- Start Of Frame SOF : Boolean := False; -- End of Reset EORST : Boolean := False; -- Wake Up WAKEUP : Boolean := False; -- End Of Resume EORSM : Boolean := False; -- Upstream Resume UPRSM : Boolean := False; -- Ram Access RAMACER : Boolean := False; -- Link Power Management Not Yet LPMNYET : Boolean := False; -- Link Power Management Suspend LPMSUSP : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_INTFLAG_USB_DEVICE_Register use record SUSPEND at 0 range 0 .. 0; MSOF at 0 range 1 .. 1; SOF at 0 range 2 .. 2; EORST at 0 range 3 .. 3; WAKEUP at 0 range 4 .. 4; EORSM at 0 range 5 .. 5; UPRSM at 0 range 6 .. 6; RAMACER at 0 range 7 .. 7; LPMNYET at 0 range 8 .. 8; LPMSUSP at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- USB_EPINTSMRY_USB_DEVICE_EPINT array type USB_EPINTSMRY_USB_DEVICE_EPINT_Field_Array is array (0 .. 7) of Boolean with Component_Size => 1, Size => 8; -- Type definition for USB_EPINTSMRY_USB_DEVICE_EPINT type USB_EPINTSMRY_USB_DEVICE_EPINT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- EPINT as a value Val : HAL.UInt8; when True => -- EPINT as an array Arr : USB_EPINTSMRY_USB_DEVICE_EPINT_Field_Array; end case; end record with Unchecked_Union, Size => 8; for USB_EPINTSMRY_USB_DEVICE_EPINT_Field use record Val at 0 range 0 .. 7; Arr at 0 range 0 .. 7; end record; -- DEVICE End Point Interrupt Summary type USB_EPINTSMRY_USB_DEVICE_Register is record -- Read-only. End Point 0 Interrupt EPINT : USB_EPINTSMRY_USB_DEVICE_EPINT_Field; -- unspecified Reserved_8_15 : HAL.UInt8; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_EPINTSMRY_USB_DEVICE_Register use record EPINT at 0 range 0 .. 7; Reserved_8_15 at 0 range 8 .. 15; end record; subtype USB_PADCAL_USB_DEVICE_TRANSP_Field is HAL.UInt5; subtype USB_PADCAL_USB_DEVICE_TRANSN_Field is HAL.UInt5; subtype USB_PADCAL_USB_DEVICE_TRIM_Field is HAL.UInt3; -- USB PAD Calibration type USB_PADCAL_USB_DEVICE_Register is record -- USB Pad Transp calibration TRANSP : USB_PADCAL_USB_DEVICE_TRANSP_Field := 16#0#; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- USB Pad Transn calibration TRANSN : USB_PADCAL_USB_DEVICE_TRANSN_Field := 16#0#; -- unspecified Reserved_11_11 : HAL.Bit := 16#0#; -- USB Pad Trim calibration TRIM : USB_PADCAL_USB_DEVICE_TRIM_Field := 16#0#; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_PADCAL_USB_DEVICE_Register use record TRANSP at 0 range 0 .. 4; Reserved_5_5 at 0 range 5 .. 5; TRANSN at 0 range 6 .. 10; Reserved_11_11 at 0 range 11 .. 11; TRIM at 0 range 12 .. 14; Reserved_15_15 at 0 range 15 .. 15; end record; --------------------------------------------- -- USB_DEVICE_ENDPOINT cluster's Registers -- --------------------------------------------- subtype USB_EPCFG_USB_DEVICE_ENDPOINT_EPTYPE0_Field is HAL.UInt3; subtype USB_EPCFG_USB_DEVICE_ENDPOINT_EPTYPE1_Field is HAL.UInt3; -- DEVICE_ENDPOINT End Point Configuration type USB_EPCFG_USB_DEVICE_ENDPOINT_Register is record -- End Point Type0 EPTYPE0 : USB_EPCFG_USB_DEVICE_ENDPOINT_EPTYPE0_Field := 16#0#; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- End Point Type1 EPTYPE1 : USB_EPCFG_USB_DEVICE_ENDPOINT_EPTYPE1_Field := 16#0#; -- NYET Token Disable NYETDIS : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPCFG_USB_DEVICE_ENDPOINT_Register use record EPTYPE0 at 0 range 0 .. 2; Reserved_3_3 at 0 range 3 .. 3; EPTYPE1 at 0 range 4 .. 6; NYETDIS at 0 range 7 .. 7; end record; -- USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ array type USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ type USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ_Field (As_Array : Boolean := False) is record case As_Array is when False => -- STALLRQ as a value Val : HAL.UInt2; when True => -- STALLRQ as an array Arr : USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- DEVICE_ENDPOINT End Point Pipe Status Clear type USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_Register is record -- Write-only. Data Toggle OUT Clear DTGLOUT : Boolean := False; -- Write-only. Data Toggle IN Clear DTGLIN : Boolean := False; -- Write-only. Current Bank Clear CURBK : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- Write-only. Stall 0 Request Clear STALLRQ : USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_STALLRQ_Field := (As_Array => False, Val => 16#0#); -- Write-only. Bank 0 Ready Clear BK0RDY : Boolean := False; -- Write-only. Bank 1 Ready Clear BK1RDY : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_Register use record DTGLOUT at 0 range 0 .. 0; DTGLIN at 0 range 1 .. 1; CURBK at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; STALLRQ at 0 range 4 .. 5; BK0RDY at 0 range 6 .. 6; BK1RDY at 0 range 7 .. 7; end record; -- USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ array type USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ type USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ_Field (As_Array : Boolean := False) is record case As_Array is when False => -- STALLRQ as a value Val : HAL.UInt2; when True => -- STALLRQ as an array Arr : USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- DEVICE_ENDPOINT End Point Pipe Status Set type USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_Register is record -- Write-only. Data Toggle OUT Set DTGLOUT : Boolean := False; -- Write-only. Data Toggle IN Set DTGLIN : Boolean := False; -- Write-only. Current Bank Set CURBK : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- Write-only. Stall 0 Request Set STALLRQ : USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_STALLRQ_Field := (As_Array => False, Val => 16#0#); -- Write-only. Bank 0 Ready Set BK0RDY : Boolean := False; -- Write-only. Bank 1 Ready Set BK1RDY : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_Register use record DTGLOUT at 0 range 0 .. 0; DTGLIN at 0 range 1 .. 1; CURBK at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; STALLRQ at 0 range 4 .. 5; BK0RDY at 0 range 6 .. 6; BK1RDY at 0 range 7 .. 7; end record; -- USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ array type USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ type USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ_Field (As_Array : Boolean := False) is record case As_Array is when False => -- STALLRQ as a value Val : HAL.UInt2; when True => -- STALLRQ as an array Arr : USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- DEVICE_ENDPOINT End Point Pipe Status type USB_EPSTATUS_USB_DEVICE_ENDPOINT_Register is record -- Read-only. Data Toggle Out DTGLOUT : Boolean; -- Read-only. Data Toggle In DTGLIN : Boolean; -- Read-only. Current Bank CURBK : Boolean; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. Stall 0 Request STALLRQ : USB_EPSTATUS_USB_DEVICE_ENDPOINT_STALLRQ_Field; -- Read-only. Bank 0 ready BK0RDY : Boolean; -- Read-only. Bank 1 ready BK1RDY : Boolean; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPSTATUS_USB_DEVICE_ENDPOINT_Register use record DTGLOUT at 0 range 0 .. 0; DTGLIN at 0 range 1 .. 1; CURBK at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; STALLRQ at 0 range 4 .. 5; BK0RDY at 0 range 6 .. 6; BK1RDY at 0 range 7 .. 7; end record; -- USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT array type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRCPT as a value Val : HAL.UInt2; when True => -- TRCPT as an array Arr : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL array type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRFAIL as a value Val : HAL.UInt2; when True => -- TRFAIL as an array Arr : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL array type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- STALL as a value Val : HAL.UInt2; when True => -- STALL as an array Arr : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- DEVICE_ENDPOINT End Point Interrupt Flag type USB_EPINTFLAG_USB_DEVICE_ENDPOINT_Register is record -- Transfer Complete 0 TRCPT : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRCPT_Field := (As_Array => False, Val => 16#0#); -- Error Flow 0 TRFAIL : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_TRFAIL_Field := (As_Array => False, Val => 16#0#); -- Received Setup RXSTP : Boolean := False; -- Stall 0 In/out STALL : USB_EPINTFLAG_USB_DEVICE_ENDPOINT_STALL_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPINTFLAG_USB_DEVICE_ENDPOINT_Register use record TRCPT at 0 range 0 .. 1; TRFAIL at 0 range 2 .. 3; RXSTP at 0 range 4 .. 4; STALL at 0 range 5 .. 6; Reserved_7_7 at 0 range 7 .. 7; end record; -- USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT array type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRCPT as a value Val : HAL.UInt2; when True => -- TRCPT as an array Arr : USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL array type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRFAIL as a value Val : HAL.UInt2; when True => -- TRFAIL as an array Arr : USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL array type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- STALL as a value Val : HAL.UInt2; when True => -- STALL as an array Arr : USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- DEVICE_ENDPOINT End Point Interrupt Clear Flag type USB_EPINTENCLR_USB_DEVICE_ENDPOINT_Register is record -- Transfer Complete 0 Interrupt Disable TRCPT : USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRCPT_Field := (As_Array => False, Val => 16#0#); -- Error Flow 0 Interrupt Disable TRFAIL : USB_EPINTENCLR_USB_DEVICE_ENDPOINT_TRFAIL_Field := (As_Array => False, Val => 16#0#); -- Received Setup Interrupt Disable RXSTP : Boolean := False; -- Stall 0 In/Out Interrupt Disable STALL : USB_EPINTENCLR_USB_DEVICE_ENDPOINT_STALL_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPINTENCLR_USB_DEVICE_ENDPOINT_Register use record TRCPT at 0 range 0 .. 1; TRFAIL at 0 range 2 .. 3; RXSTP at 0 range 4 .. 4; STALL at 0 range 5 .. 6; Reserved_7_7 at 0 range 7 .. 7; end record; -- USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT array type USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT type USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRCPT as a value Val : HAL.UInt2; when True => -- TRCPT as an array Arr : USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL array type USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL type USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRFAIL as a value Val : HAL.UInt2; when True => -- TRFAIL as an array Arr : USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL array type USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL type USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL_Field (As_Array : Boolean := False) is record case As_Array is when False => -- STALL as a value Val : HAL.UInt2; when True => -- STALL as an array Arr : USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- DEVICE_ENDPOINT End Point Interrupt Set Flag type USB_EPINTENSET_USB_DEVICE_ENDPOINT_Register is record -- Transfer Complete 0 Interrupt Enable TRCPT : USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRCPT_Field := (As_Array => False, Val => 16#0#); -- Error Flow 0 Interrupt Enable TRFAIL : USB_EPINTENSET_USB_DEVICE_ENDPOINT_TRFAIL_Field := (As_Array => False, Val => 16#0#); -- Received Setup Interrupt Enable RXSTP : Boolean := False; -- Stall 0 In/out Interrupt enable STALL : USB_EPINTENSET_USB_DEVICE_ENDPOINT_STALL_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_EPINTENSET_USB_DEVICE_ENDPOINT_Register use record TRCPT at 0 range 0 .. 1; TRFAIL at 0 range 2 .. 3; RXSTP at 0 range 4 .. 4; STALL at 0 range 5 .. 6; Reserved_7_7 at 0 range 7 .. 7; end record; type USB_DEVICE_ENDPOINT_Cluster is record -- DEVICE_ENDPOINT End Point Configuration EPCFG : aliased USB_EPCFG_USB_DEVICE_ENDPOINT_Register; -- DEVICE_ENDPOINT End Point Pipe Status Clear EPSTATUSCLR : aliased USB_EPSTATUSCLR_USB_DEVICE_ENDPOINT_Register; -- DEVICE_ENDPOINT End Point Pipe Status Set EPSTATUSSET : aliased USB_EPSTATUSSET_USB_DEVICE_ENDPOINT_Register; -- DEVICE_ENDPOINT End Point Pipe Status EPSTATUS : aliased USB_EPSTATUS_USB_DEVICE_ENDPOINT_Register; -- DEVICE_ENDPOINT End Point Interrupt Flag EPINTFLAG : aliased USB_EPINTFLAG_USB_DEVICE_ENDPOINT_Register; -- DEVICE_ENDPOINT End Point Interrupt Clear Flag EPINTENCLR : aliased USB_EPINTENCLR_USB_DEVICE_ENDPOINT_Register; -- DEVICE_ENDPOINT End Point Interrupt Set Flag EPINTENSET : aliased USB_EPINTENSET_USB_DEVICE_ENDPOINT_Register; end record with Size => 256; for USB_DEVICE_ENDPOINT_Cluster use record EPCFG at 16#0# range 0 .. 7; EPSTATUSCLR at 16#4# range 0 .. 7; EPSTATUSSET at 16#5# range 0 .. 7; EPSTATUS at 16#6# range 0 .. 7; EPINTFLAG at 16#7# range 0 .. 7; EPINTENCLR at 16#8# range 0 .. 7; EPINTENSET at 16#9# range 0 .. 7; end record; type USB_DEVICE_ENDPOINT_Clusters is array (0 .. 7) of USB_DEVICE_ENDPOINT_Cluster; -- USB is Device type UsbDevice_Cluster is record -- Control A CTRLA : aliased USB_CTRLA_USB_DEVICE_Register; -- Synchronization Busy SYNCBUSY : aliased USB_SYNCBUSY_USB_DEVICE_Register; -- USB Quality Of Service QOSCTRL : aliased USB_QOSCTRL_USB_DEVICE_Register; -- DEVICE Control B CTRLB : aliased USB_CTRLB_USB_DEVICE_Register; -- DEVICE Device Address DADD : aliased USB_DADD_USB_DEVICE_Register; -- DEVICE Status STATUS : aliased USB_STATUS_USB_DEVICE_Register; -- Finite State Machine Status FSMSTATUS : aliased USB_FSMSTATUS_USB_DEVICE_Register; -- DEVICE Device Frame Number FNUM : aliased USB_FNUM_USB_DEVICE_Register; -- DEVICE Device Interrupt Enable Clear INTENCLR : aliased USB_INTENCLR_USB_DEVICE_Register; -- DEVICE Device Interrupt Enable Set INTENSET : aliased USB_INTENSET_USB_DEVICE_Register; -- DEVICE Device Interrupt Flag INTFLAG : aliased USB_INTFLAG_USB_DEVICE_Register; -- DEVICE End Point Interrupt Summary EPINTSMRY : aliased USB_EPINTSMRY_USB_DEVICE_Register; -- Descriptor Address DESCADD : aliased HAL.UInt32; -- USB PAD Calibration PADCAL : aliased USB_PADCAL_USB_DEVICE_Register; USB_DEVICE_ENDPOINT : aliased USB_DEVICE_ENDPOINT_Clusters; end record with Size => 2304; for UsbDevice_Cluster use record CTRLA at 16#0# range 0 .. 7; SYNCBUSY at 16#2# range 0 .. 7; QOSCTRL at 16#3# range 0 .. 7; CTRLB at 16#8# range 0 .. 15; DADD at 16#A# range 0 .. 7; STATUS at 16#C# range 0 .. 7; FSMSTATUS at 16#D# range 0 .. 7; FNUM at 16#10# range 0 .. 15; INTENCLR at 16#14# range 0 .. 15; INTENSET at 16#18# range 0 .. 15; INTFLAG at 16#1C# range 0 .. 15; EPINTSMRY at 16#20# range 0 .. 15; DESCADD at 16#24# range 0 .. 31; PADCAL at 16#28# range 0 .. 15; USB_DEVICE_ENDPOINT at 16#100# range 0 .. 2047; end record; --------------------------------- -- UsbHost cluster's Registers -- --------------------------------- -- Control A type USB_CTRLA_USB_HOST_Register is record -- Software Reset SWRST : Boolean := False; -- Enable ENABLE : Boolean := False; -- Run in Standby Mode RUNSTDBY : Boolean := False; -- unspecified Reserved_3_6 : HAL.UInt4 := 16#0#; -- Operating Mode MODE : CTRLA_MODESelect := SAM_SVD.USB.DEVICE; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_CTRLA_USB_HOST_Register use record SWRST at 0 range 0 .. 0; ENABLE at 0 range 1 .. 1; RUNSTDBY at 0 range 2 .. 2; Reserved_3_6 at 0 range 3 .. 6; MODE at 0 range 7 .. 7; end record; -- Synchronization Busy type USB_SYNCBUSY_USB_HOST_Register is record -- Read-only. Software Reset Synchronization Busy SWRST : Boolean; -- Read-only. Enable Synchronization Busy ENABLE : Boolean; -- unspecified Reserved_2_7 : HAL.UInt6; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_SYNCBUSY_USB_HOST_Register use record SWRST at 0 range 0 .. 0; ENABLE at 0 range 1 .. 1; Reserved_2_7 at 0 range 2 .. 7; end record; subtype USB_QOSCTRL_USB_HOST_CQOS_Field is HAL.UInt2; subtype USB_QOSCTRL_USB_HOST_DQOS_Field is HAL.UInt2; -- USB Quality Of Service type USB_QOSCTRL_USB_HOST_Register is record -- Configuration Quality of Service CQOS : USB_QOSCTRL_USB_HOST_CQOS_Field := 16#3#; -- Data Quality of Service DQOS : USB_QOSCTRL_USB_HOST_DQOS_Field := 16#3#; -- unspecified Reserved_4_7 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_QOSCTRL_USB_HOST_Register use record CQOS at 0 range 0 .. 1; DQOS at 0 range 2 .. 3; Reserved_4_7 at 0 range 4 .. 7; end record; -- Speed Configuration for Host type CTRLB_SPDCONFSelect_1 is (-- Normal mode: the host starts in full-speed mode and performs a high-speed -- reset to switch to the high speed mode if the downstream peripheral is -- high-speed capable. NORMAL, -- Full-speed: the host remains in full-speed mode whatever is the peripheral -- speed capability. Relevant in UTMI mode only. FS) with Size => 2; for CTRLB_SPDCONFSelect_1 use (NORMAL => 0, FS => 3); -- HOST Control B type USB_CTRLB_USB_HOST_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Send USB Resume RESUME : Boolean := False; -- Speed Configuration for Host SPDCONF : CTRLB_SPDCONFSelect_1 := SAM_SVD.USB.NORMAL; -- Auto Resume Enable AUTORESUME : Boolean := False; -- Test mode J TSTJ : Boolean := False; -- Test mode K TSTK : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; -- Start of Frame Generation Enable SOFE : Boolean := False; -- Send USB Reset BUSRESET : Boolean := False; -- VBUS is OK VBUSOK : Boolean := False; -- Send L1 Resume L1RESUME : Boolean := False; -- unspecified Reserved_12_15 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_CTRLB_USB_HOST_Register use record Reserved_0_0 at 0 range 0 .. 0; RESUME at 0 range 1 .. 1; SPDCONF at 0 range 2 .. 3; AUTORESUME at 0 range 4 .. 4; TSTJ at 0 range 5 .. 5; TSTK at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; SOFE at 0 range 8 .. 8; BUSRESET at 0 range 9 .. 9; VBUSOK at 0 range 10 .. 10; L1RESUME at 0 range 11 .. 11; Reserved_12_15 at 0 range 12 .. 15; end record; subtype USB_HSOFC_USB_HOST_FLENC_Field is HAL.UInt4; -- HOST Host Start Of Frame Control type USB_HSOFC_USB_HOST_Register is record -- Frame Length Control FLENC : USB_HSOFC_USB_HOST_FLENC_Field := 16#0#; -- unspecified Reserved_4_6 : HAL.UInt3 := 16#0#; -- Frame Length Control Enable FLENCE : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_HSOFC_USB_HOST_Register use record FLENC at 0 range 0 .. 3; Reserved_4_6 at 0 range 4 .. 6; FLENCE at 0 range 7 .. 7; end record; subtype USB_STATUS_USB_HOST_SPEED_Field is HAL.UInt2; subtype USB_STATUS_USB_HOST_LINESTATE_Field is HAL.UInt2; -- HOST Status type USB_STATUS_USB_HOST_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Speed Status SPEED : USB_STATUS_USB_HOST_SPEED_Field := 16#0#; -- unspecified Reserved_4_5 : HAL.UInt2 := 16#0#; -- USB Line State Status LINESTATE : USB_STATUS_USB_HOST_LINESTATE_Field := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_STATUS_USB_HOST_Register use record Reserved_0_1 at 0 range 0 .. 1; SPEED at 0 range 2 .. 3; Reserved_4_5 at 0 range 4 .. 5; LINESTATE at 0 range 6 .. 7; end record; -- Finite State Machine Status type USB_FSMSTATUS_USB_HOST_Register is record -- Read-only. Fine State Machine Status FSMSTATE : FSMSTATUS_FSMSTATESelect; -- unspecified Reserved_7_7 : HAL.Bit; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_FSMSTATUS_USB_HOST_Register use record FSMSTATE at 0 range 0 .. 6; Reserved_7_7 at 0 range 7 .. 7; end record; subtype USB_FNUM_USB_HOST_MFNUM_Field is HAL.UInt3; subtype USB_FNUM_USB_HOST_FNUM_Field is HAL.UInt11; -- HOST Host Frame Number type USB_FNUM_USB_HOST_Register is record -- Micro Frame Number MFNUM : USB_FNUM_USB_HOST_MFNUM_Field := 16#0#; -- Frame Number FNUM : USB_FNUM_USB_HOST_FNUM_Field := 16#0#; -- unspecified Reserved_14_15 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_FNUM_USB_HOST_Register use record MFNUM at 0 range 0 .. 2; FNUM at 0 range 3 .. 13; Reserved_14_15 at 0 range 14 .. 15; end record; -- HOST Host Interrupt Enable Clear type USB_INTENCLR_USB_HOST_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Host Start Of Frame Interrupt Disable HSOF : Boolean := False; -- BUS Reset Interrupt Disable RST : Boolean := False; -- Wake Up Interrupt Disable WAKEUP : Boolean := False; -- DownStream to Device Interrupt Disable DNRSM : Boolean := False; -- Upstream Resume from Device Interrupt Disable UPRSM : Boolean := False; -- Ram Access Interrupt Disable RAMACER : Boolean := False; -- Device Connection Interrupt Disable DCONN : Boolean := False; -- Device Disconnection Interrupt Disable DDISC : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_INTENCLR_USB_HOST_Register use record Reserved_0_1 at 0 range 0 .. 1; HSOF at 0 range 2 .. 2; RST at 0 range 3 .. 3; WAKEUP at 0 range 4 .. 4; DNRSM at 0 range 5 .. 5; UPRSM at 0 range 6 .. 6; RAMACER at 0 range 7 .. 7; DCONN at 0 range 8 .. 8; DDISC at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- HOST Host Interrupt Enable Set type USB_INTENSET_USB_HOST_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Host Start Of Frame Interrupt Enable HSOF : Boolean := False; -- Bus Reset Interrupt Enable RST : Boolean := False; -- Wake Up Interrupt Enable WAKEUP : Boolean := False; -- DownStream to the Device Interrupt Enable DNRSM : Boolean := False; -- Upstream Resume fromthe device Interrupt Enable UPRSM : Boolean := False; -- Ram Access Interrupt Enable RAMACER : Boolean := False; -- Link Power Management Interrupt Enable DCONN : Boolean := False; -- Device Disconnection Interrupt Enable DDISC : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_INTENSET_USB_HOST_Register use record Reserved_0_1 at 0 range 0 .. 1; HSOF at 0 range 2 .. 2; RST at 0 range 3 .. 3; WAKEUP at 0 range 4 .. 4; DNRSM at 0 range 5 .. 5; UPRSM at 0 range 6 .. 6; RAMACER at 0 range 7 .. 7; DCONN at 0 range 8 .. 8; DDISC at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- HOST Host Interrupt Flag type USB_INTFLAG_USB_HOST_Register is record -- unspecified Reserved_0_1 : HAL.UInt2 := 16#0#; -- Host Start Of Frame HSOF : Boolean := False; -- Bus Reset RST : Boolean := False; -- Wake Up WAKEUP : Boolean := False; -- Downstream DNRSM : Boolean := False; -- Upstream Resume from the Device UPRSM : Boolean := False; -- Ram Access RAMACER : Boolean := False; -- Device Connection DCONN : Boolean := False; -- Device Disconnection DDISC : Boolean := False; -- unspecified Reserved_10_15 : HAL.UInt6 := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_INTFLAG_USB_HOST_Register use record Reserved_0_1 at 0 range 0 .. 1; HSOF at 0 range 2 .. 2; RST at 0 range 3 .. 3; WAKEUP at 0 range 4 .. 4; DNRSM at 0 range 5 .. 5; UPRSM at 0 range 6 .. 6; RAMACER at 0 range 7 .. 7; DCONN at 0 range 8 .. 8; DDISC at 0 range 9 .. 9; Reserved_10_15 at 0 range 10 .. 15; end record; -- USB_PINTSMRY_USB_HOST_EPINT array type USB_PINTSMRY_USB_HOST_EPINT_Field_Array is array (0 .. 7) of Boolean with Component_Size => 1, Size => 8; -- Type definition for USB_PINTSMRY_USB_HOST_EPINT type USB_PINTSMRY_USB_HOST_EPINT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- EPINT as a value Val : HAL.UInt8; when True => -- EPINT as an array Arr : USB_PINTSMRY_USB_HOST_EPINT_Field_Array; end case; end record with Unchecked_Union, Size => 8; for USB_PINTSMRY_USB_HOST_EPINT_Field use record Val at 0 range 0 .. 7; Arr at 0 range 0 .. 7; end record; -- HOST Pipe Interrupt Summary type USB_PINTSMRY_USB_HOST_Register is record -- Read-only. Pipe 0 Interrupt EPINT : USB_PINTSMRY_USB_HOST_EPINT_Field; -- unspecified Reserved_8_15 : HAL.UInt8; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_PINTSMRY_USB_HOST_Register use record EPINT at 0 range 0 .. 7; Reserved_8_15 at 0 range 8 .. 15; end record; subtype USB_PADCAL_USB_HOST_TRANSP_Field is HAL.UInt5; subtype USB_PADCAL_USB_HOST_TRANSN_Field is HAL.UInt5; subtype USB_PADCAL_USB_HOST_TRIM_Field is HAL.UInt3; -- USB PAD Calibration type USB_PADCAL_USB_HOST_Register is record -- USB Pad Transp calibration TRANSP : USB_PADCAL_USB_HOST_TRANSP_Field := 16#0#; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- USB Pad Transn calibration TRANSN : USB_PADCAL_USB_HOST_TRANSN_Field := 16#0#; -- unspecified Reserved_11_11 : HAL.Bit := 16#0#; -- USB Pad Trim calibration TRIM : USB_PADCAL_USB_HOST_TRIM_Field := 16#0#; -- unspecified Reserved_15_15 : HAL.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 16, Bit_Order => System.Low_Order_First; for USB_PADCAL_USB_HOST_Register use record TRANSP at 0 range 0 .. 4; Reserved_5_5 at 0 range 5 .. 5; TRANSN at 0 range 6 .. 10; Reserved_11_11 at 0 range 11 .. 11; TRIM at 0 range 12 .. 14; Reserved_15_15 at 0 range 15 .. 15; end record; --------------------------------------- -- USB_HOST_PIPE cluster's Registers -- --------------------------------------- subtype USB_PCFG_USB_HOST_PIPE_PTOKEN_Field is HAL.UInt2; subtype USB_PCFG_USB_HOST_PIPE_PTYPE_Field is HAL.UInt3; -- HOST_PIPE End Point Configuration type USB_PCFG_USB_HOST_PIPE_Register is record -- Pipe Token PTOKEN : USB_PCFG_USB_HOST_PIPE_PTOKEN_Field := 16#0#; -- Pipe Bank BK : Boolean := False; -- Pipe Type PTYPE : USB_PCFG_USB_HOST_PIPE_PTYPE_Field := 16#0#; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PCFG_USB_HOST_PIPE_Register use record PTOKEN at 0 range 0 .. 1; BK at 0 range 2 .. 2; PTYPE at 0 range 3 .. 5; Reserved_6_7 at 0 range 6 .. 7; end record; -- HOST_PIPE End Point Pipe Status Clear type USB_PSTATUSCLR_USB_HOST_PIPE_Register is record -- Write-only. Data Toggle clear DTGL : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- Write-only. Curren Bank clear CURBK : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- Write-only. Pipe Freeze Clear PFREEZE : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Write-only. Bank 0 Ready Clear BK0RDY : Boolean := False; -- Write-only. Bank 1 Ready Clear BK1RDY : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PSTATUSCLR_USB_HOST_PIPE_Register use record DTGL at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; CURBK at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; PFREEZE at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; BK0RDY at 0 range 6 .. 6; BK1RDY at 0 range 7 .. 7; end record; -- HOST_PIPE End Point Pipe Status Set type USB_PSTATUSSET_USB_HOST_PIPE_Register is record -- Write-only. Data Toggle Set DTGL : Boolean := False; -- unspecified Reserved_1_1 : HAL.Bit := 16#0#; -- Write-only. Current Bank Set CURBK : Boolean := False; -- unspecified Reserved_3_3 : HAL.Bit := 16#0#; -- Write-only. Pipe Freeze Set PFREEZE : Boolean := False; -- unspecified Reserved_5_5 : HAL.Bit := 16#0#; -- Write-only. Bank 0 Ready Set BK0RDY : Boolean := False; -- Write-only. Bank 1 Ready Set BK1RDY : Boolean := False; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PSTATUSSET_USB_HOST_PIPE_Register use record DTGL at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; CURBK at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; PFREEZE at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; BK0RDY at 0 range 6 .. 6; BK1RDY at 0 range 7 .. 7; end record; -- HOST_PIPE End Point Pipe Status type USB_PSTATUS_USB_HOST_PIPE_Register is record -- Read-only. Data Toggle DTGL : Boolean; -- unspecified Reserved_1_1 : HAL.Bit; -- Read-only. Current Bank CURBK : Boolean; -- unspecified Reserved_3_3 : HAL.Bit; -- Read-only. Pipe Freeze PFREEZE : Boolean; -- unspecified Reserved_5_5 : HAL.Bit; -- Read-only. Bank 0 ready BK0RDY : Boolean; -- Read-only. Bank 1 ready BK1RDY : Boolean; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PSTATUS_USB_HOST_PIPE_Register use record DTGL at 0 range 0 .. 0; Reserved_1_1 at 0 range 1 .. 1; CURBK at 0 range 2 .. 2; Reserved_3_3 at 0 range 3 .. 3; PFREEZE at 0 range 4 .. 4; Reserved_5_5 at 0 range 5 .. 5; BK0RDY at 0 range 6 .. 6; BK1RDY at 0 range 7 .. 7; end record; -- USB_PINTFLAG_USB_HOST_PIPE_TRCPT array type USB_PINTFLAG_USB_HOST_PIPE_TRCPT_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_PINTFLAG_USB_HOST_PIPE_TRCPT type USB_PINTFLAG_USB_HOST_PIPE_TRCPT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRCPT as a value Val : HAL.UInt2; when True => -- TRCPT as an array Arr : USB_PINTFLAG_USB_HOST_PIPE_TRCPT_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_PINTFLAG_USB_HOST_PIPE_TRCPT_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- HOST_PIPE Pipe Interrupt Flag type USB_PINTFLAG_USB_HOST_PIPE_Register is record -- Transfer Complete 0 Interrupt Flag TRCPT : USB_PINTFLAG_USB_HOST_PIPE_TRCPT_Field := (As_Array => False, Val => 16#0#); -- Error Flow Interrupt Flag TRFAIL : Boolean := False; -- Pipe Error Interrupt Flag PERR : Boolean := False; -- Transmit Setup Interrupt Flag TXSTP : Boolean := False; -- Stall Interrupt Flag STALL : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PINTFLAG_USB_HOST_PIPE_Register use record TRCPT at 0 range 0 .. 1; TRFAIL at 0 range 2 .. 2; PERR at 0 range 3 .. 3; TXSTP at 0 range 4 .. 4; STALL at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; end record; -- USB_PINTENCLR_USB_HOST_PIPE_TRCPT array type USB_PINTENCLR_USB_HOST_PIPE_TRCPT_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_PINTENCLR_USB_HOST_PIPE_TRCPT type USB_PINTENCLR_USB_HOST_PIPE_TRCPT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRCPT as a value Val : HAL.UInt2; when True => -- TRCPT as an array Arr : USB_PINTENCLR_USB_HOST_PIPE_TRCPT_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_PINTENCLR_USB_HOST_PIPE_TRCPT_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- HOST_PIPE Pipe Interrupt Flag Clear type USB_PINTENCLR_USB_HOST_PIPE_Register is record -- Transfer Complete 0 Disable TRCPT : USB_PINTENCLR_USB_HOST_PIPE_TRCPT_Field := (As_Array => False, Val => 16#0#); -- Error Flow Interrupt Disable TRFAIL : Boolean := False; -- Pipe Error Interrupt Disable PERR : Boolean := False; -- Transmit Setup Interrupt Disable TXSTP : Boolean := False; -- Stall Inetrrupt Disable STALL : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PINTENCLR_USB_HOST_PIPE_Register use record TRCPT at 0 range 0 .. 1; TRFAIL at 0 range 2 .. 2; PERR at 0 range 3 .. 3; TXSTP at 0 range 4 .. 4; STALL at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; end record; -- USB_PINTENSET_USB_HOST_PIPE_TRCPT array type USB_PINTENSET_USB_HOST_PIPE_TRCPT_Field_Array is array (0 .. 1) of Boolean with Component_Size => 1, Size => 2; -- Type definition for USB_PINTENSET_USB_HOST_PIPE_TRCPT type USB_PINTENSET_USB_HOST_PIPE_TRCPT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- TRCPT as a value Val : HAL.UInt2; when True => -- TRCPT as an array Arr : USB_PINTENSET_USB_HOST_PIPE_TRCPT_Field_Array; end case; end record with Unchecked_Union, Size => 2; for USB_PINTENSET_USB_HOST_PIPE_TRCPT_Field use record Val at 0 range 0 .. 1; Arr at 0 range 0 .. 1; end record; -- HOST_PIPE Pipe Interrupt Flag Set type USB_PINTENSET_USB_HOST_PIPE_Register is record -- Transfer Complete 0 Interrupt Enable TRCPT : USB_PINTENSET_USB_HOST_PIPE_TRCPT_Field := (As_Array => False, Val => 16#0#); -- Error Flow Interrupt Enable TRFAIL : Boolean := False; -- Pipe Error Interrupt Enable PERR : Boolean := False; -- Transmit Setup Interrupt Enable TXSTP : Boolean := False; -- Stall Interrupt Enable STALL : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USB_PINTENSET_USB_HOST_PIPE_Register use record TRCPT at 0 range 0 .. 1; TRFAIL at 0 range 2 .. 2; PERR at 0 range 3 .. 3; TXSTP at 0 range 4 .. 4; STALL at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; end record; type USB_HOST_PIPE_Cluster is record -- HOST_PIPE End Point Configuration PCFG : aliased USB_PCFG_USB_HOST_PIPE_Register; -- HOST_PIPE Bus Access Period of Pipe BINTERVAL : aliased HAL.UInt8; -- HOST_PIPE End Point Pipe Status Clear PSTATUSCLR : aliased USB_PSTATUSCLR_USB_HOST_PIPE_Register; -- HOST_PIPE End Point Pipe Status Set PSTATUSSET : aliased USB_PSTATUSSET_USB_HOST_PIPE_Register; -- HOST_PIPE End Point Pipe Status PSTATUS : aliased USB_PSTATUS_USB_HOST_PIPE_Register; -- HOST_PIPE Pipe Interrupt Flag PINTFLAG : aliased USB_PINTFLAG_USB_HOST_PIPE_Register; -- HOST_PIPE Pipe Interrupt Flag Clear PINTENCLR : aliased USB_PINTENCLR_USB_HOST_PIPE_Register; -- HOST_PIPE Pipe Interrupt Flag Set PINTENSET : aliased USB_PINTENSET_USB_HOST_PIPE_Register; end record with Size => 256; for USB_HOST_PIPE_Cluster use record PCFG at 16#0# range 0 .. 7; BINTERVAL at 16#3# range 0 .. 7; PSTATUSCLR at 16#4# range 0 .. 7; PSTATUSSET at 16#5# range 0 .. 7; PSTATUS at 16#6# range 0 .. 7; PINTFLAG at 16#7# range 0 .. 7; PINTENCLR at 16#8# range 0 .. 7; PINTENSET at 16#9# range 0 .. 7; end record; type USB_HOST_PIPE_Clusters is array (0 .. 7) of USB_HOST_PIPE_Cluster; -- USB is Host type UsbHost_Cluster is record -- Control A CTRLA : aliased USB_CTRLA_USB_HOST_Register; -- Synchronization Busy SYNCBUSY : aliased USB_SYNCBUSY_USB_HOST_Register; -- USB Quality Of Service QOSCTRL : aliased USB_QOSCTRL_USB_HOST_Register; -- HOST Control B CTRLB : aliased USB_CTRLB_USB_HOST_Register; -- HOST Host Start Of Frame Control HSOFC : aliased USB_HSOFC_USB_HOST_Register; -- HOST Status STATUS : aliased USB_STATUS_USB_HOST_Register; -- Finite State Machine Status FSMSTATUS : aliased USB_FSMSTATUS_USB_HOST_Register; -- HOST Host Frame Number FNUM : aliased USB_FNUM_USB_HOST_Register; -- HOST Host Frame Length FLENHIGH : aliased HAL.UInt8; -- HOST Host Interrupt Enable Clear INTENCLR : aliased USB_INTENCLR_USB_HOST_Register; -- HOST Host Interrupt Enable Set INTENSET : aliased USB_INTENSET_USB_HOST_Register; -- HOST Host Interrupt Flag INTFLAG : aliased USB_INTFLAG_USB_HOST_Register; -- HOST Pipe Interrupt Summary PINTSMRY : aliased USB_PINTSMRY_USB_HOST_Register; -- Descriptor Address DESCADD : aliased HAL.UInt32; -- USB PAD Calibration PADCAL : aliased USB_PADCAL_USB_HOST_Register; USB_HOST_PIPE : aliased USB_HOST_PIPE_Clusters; end record with Size => 2304; for UsbHost_Cluster use record CTRLA at 16#0# range 0 .. 7; SYNCBUSY at 16#2# range 0 .. 7; QOSCTRL at 16#3# range 0 .. 7; CTRLB at 16#8# range 0 .. 15; HSOFC at 16#A# range 0 .. 7; STATUS at 16#C# range 0 .. 7; FSMSTATUS at 16#D# range 0 .. 7; FNUM at 16#10# range 0 .. 15; FLENHIGH at 16#12# range 0 .. 7; INTENCLR at 16#14# range 0 .. 15; INTENSET at 16#18# range 0 .. 15; INTFLAG at 16#1C# range 0 .. 15; PINTSMRY at 16#20# range 0 .. 15; DESCADD at 16#24# range 0 .. 31; PADCAL at 16#28# range 0 .. 15; USB_HOST_PIPE at 16#100# range 0 .. 2047; end record; ----------------- -- Peripherals -- ----------------- type USB_Disc is (DEVICE, HOST); -- Universal Serial Bus type USB_Peripheral (Discriminent : USB_Disc := DEVICE) is record case Discriminent is when DEVICE => -- USB is Device USB_DEVICE : aliased UsbDevice_Cluster; when HOST => -- USB is Host USB_HOST : aliased UsbHost_Cluster; end case; end record with Unchecked_Union, Volatile; for USB_Peripheral use record USB_DEVICE at 0 range 0 .. 2303; USB_HOST at 0 range 0 .. 2303; end record; -- Universal Serial Bus USB_Periph : aliased USB_Peripheral with Import, Address => USB_Base; end SAM_SVD.USB;
persan/a-cups
Ada
3,094
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with Interfaces.C.Strings; limited with CUPS.stdio_h; with Interfaces.C_Streams; with System; with CUPS.cups_cups_h; private package CUPS.cups_adminutil_h is CUPS_SERVER_DEBUG_LOGGING : aliased constant String := "_debug_logging" & ASCII.NUL; -- cups/adminutil.h:42 CUPS_SERVER_REMOTE_ADMIN : aliased constant String := "_remote_admin" & ASCII.NUL; -- cups/adminutil.h:43 CUPS_SERVER_REMOTE_ANY : aliased constant String := "_remote_any" & ASCII.NUL; -- cups/adminutil.h:44 CUPS_SERVER_SHARE_PRINTERS : aliased constant String := "_share_printers" & ASCII.NUL; -- cups/adminutil.h:46 CUPS_SERVER_USER_CANCEL_ANY : aliased constant String := "_user_cancel_any" & ASCII.NUL; -- cups/adminutil.h:47 -- * "$Id: adminutil.h 10996 2013-05-29 11:51:34Z msweet $" -- * -- * Administration utility API definitions for CUPS. -- * -- * Copyright 2007-2012 by Apple Inc. -- * Copyright 2001-2007 by Easy Software Products. -- * -- * These coded instructions, statements, and computer programs are the -- * property of Apple Inc. and are protected by Federal copyright -- * law. Distribution and use rights are outlined in the file "LICENSE.txt" -- * which should have been included with this file. If this file is -- * file is missing or damaged, see the license at "http://www.cups.org/". -- * -- * This file is subject to the Apple OS-Developed Software exception. -- -- * Include necessary headers... -- -- * C++ magic... -- -- * Constants... -- --# define CUPS_SERVER_REMOTE_PRINTERS "_remote_printers" -- * Functions... -- function cupsAdminExportSamba (dest : Interfaces.C.Strings.chars_ptr; ppd : Interfaces.C.Strings.chars_ptr; samba_server : Interfaces.C.Strings.chars_ptr; samba_user : Interfaces.C.Strings.chars_ptr; samba_password : Interfaces.C.Strings.chars_ptr; logfile : access Interfaces.C_Streams.FILEs) return int; -- cups/adminutil.h:54 pragma Import (C, cupsAdminExportSamba, "cupsAdminExportSamba"); function cupsAdminCreateWindowsPPD (http : System.Address; dest : Interfaces.C.Strings.chars_ptr; buffer : Interfaces.C.Strings.chars_ptr; bufsize : int) return Interfaces.C.Strings.chars_ptr; -- cups/adminutil.h:59 pragma Import (C, cupsAdminCreateWindowsPPD, "cupsAdminCreateWindowsPPD"); function cupsAdminGetServerSettings (http : System.Address; num_settings : access int; settings : System.Address) return int; -- cups/adminutil.h:63 pragma Import (C, cupsAdminGetServerSettings, "cupsAdminGetServerSettings"); function cupsAdminSetServerSettings (http : System.Address; num_settings : int; settings : access CUPS.cups_cups_h.cups_option_t) return int; -- cups/adminutil.h:67 pragma Import (C, cupsAdminSetServerSettings, "cupsAdminSetServerSettings"); -- * End of "$Id: adminutil.h 10996 2013-05-29 11:51:34Z msweet $". -- end CUPS.cups_adminutil_h;
faelys/natools
Ada
13,931
ads
------------------------------------------------------------------------------ -- Copyright (c) 2016, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Smaz.Tools helps building and generating dictionary for use -- -- with its parent package. Note that the dictionary is intended to be -- -- generated and hard-coded, so the final client shouldn't need this -- -- package. -- ------------------------------------------------------------------------------ with Ada.Containers.Indefinite_Doubly_Linked_Lists; with Natools.S_Expressions; private with Ada.Containers.Indefinite_Ordered_Maps; private with Ada.Containers.Indefinite_Ordered_Sets; private with Ada.Finalization; package Natools.Smaz.Tools is pragma Preelaborate; package String_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists (String); procedure Read_List (List : out String_Lists.List; Descriptor : in out S_Expressions.Descriptor'Class); -- Read atoms from Descriptor to fill List function To_Dictionary (List : in String_Lists.List; Variable_Length_Verbatim : in Boolean) return Dictionary with Pre => String_Lists.Length (List) in 1 .. Ada.Containers.Count_Type (Ada.Streams.Stream_Element'Last); -- Build a Dictionary object from a string list -- Note that Hash is set to a placeholder which uncinditionnally -- raises Program_Error when called. generic with procedure Put_Line (Line : String); procedure Print_Dictionary_In_Ada (Dict : in Dictionary; Hash_Image : in String := "TODO"; Max_Width : in Positive := 70; First_Prefix : in String := " := ("; Prefix : in String := " "; Half_Indent : in String := " "); -- Output Ada code corresponding to the value of the dictionary. -- Note that Prefix is the actual base indentation, while Half_Indent -- is added beyond Prefix before values continued on another line. -- Frist_Prefix is used instead of Prefix on the first line. -- All the defaults value are what was used to generate the constant -- in Natools.Smaz.Original. function Remove_Element (Dict : in Dictionary; Index : in Ada.Streams.Stream_Element) return Dictionary with Pre => Index <= Dict.Dict_Last, Post => Dict.Dict_Last = Remove_Element'Result.Dict_Last + 1 and then (Index = 0 or else (for all I in 0 .. Index - 1 => Dict_Entry (Dict, I) = Dict_Entry (Remove_Element'Result, I))) and then (Index = Dict.Dict_Last or else (for all I in Index .. Dict.Dict_Last - 1 => Dict_Entry (Dict, I + 1) = Dict_Entry (Remove_Element'Result, I))); -- Return a new dictionary equal to Dict without element for Index function Append_String (Dict : in Dictionary; Value : in String) return Dictionary with Pre => Dict.Dict_Last < Ada.Streams.Stream_Element'Last and then Value'Length > 0, Post => Dict.Dict_Last = Append_String'Result.Dict_Last - 1 and then (for all I in 0 .. Dict.Dict_Last => Dict_Entry (Dict, I) = Dict_Entry (Append_String'Result, I)) and then Dict_Entry (Append_String'Result, Append_String'Result.Dict_Last) = Value; -- Return a new dictionary with Value appended function Replace_Element (Dict : in Dictionary; Index : in Ada.Streams.Stream_Element; Value : in String) return Dictionary with Pre => Index <= Dict.Dict_Last and then Value'Length > 0, Post => Dict.Dict_Last = Replace_Element'Result.Dict_Last and then (for all I in 0 .. Dict.Dict_Last => (I = Index or else Dict_Entry (Dict, I) = Dict_Entry (Replace_Element'Result, I))) and then Dict_Entry (Replace_Element'Result, Index) = Value; -- Return a new dictionary with entry at Index replaced by Value List_For_Linear_Search : String_Lists.List; function Linear_Search (Value : String) return Natural; -- Function and data source for inefficient but dynamic function -- that can be used with Dictionary.Hash. procedure Set_Dictionary_For_Map_Search (Dict : in Dictionary); function Map_Search (Value : String) return Natural; -- Function and data source for logarithmic search using standard -- ordered map, that can be used with Dictionary.Hash. type Search_Trie is private; procedure Initialize (Trie : out Search_Trie; Dict : in Dictionary); function Search (Trie : in Search_Trie; Value : in String) return Natural; -- Trie-based search in a dynamic dictionary, for lookup whose -- speed-vs-memory is even more skewed towards speed. procedure Set_Dictionary_For_Trie_Search (Dict : in Dictionary); function Trie_Search (Value : String) return Natural; -- Function and data source for trie-based search that can be -- used with Dictionary.Hash. type String_Count is range 0 .. 2 ** 31 - 1; -- Type for a number of substring occurrences package Methods is type Enum is (Encoded, Frequency, Gain); end Methods; -- Evaluation methods to select words to remove or include type Word_Counter is private; -- Accumulate frequency/occurrence counts for a set of strings procedure Add_Word (Counter : in out Word_Counter; Word : in String; Count : in String_Count := 1); -- Include Count number of occurrences of Word in Counter procedure Add_Substrings (Counter : in out Word_Counter; Phrase : in String; Min_Size : in Positive; Max_Size : in Positive); -- Include all the substrings of Phrase whose lengths are -- between Min_Size and Max_Size. procedure Add_Words (Counter : in out Word_Counter; Phrase : in String; Min_Size : in Positive; Max_Size : in Positive); -- Add the "words" from Phrase into Counter, with a word being currently -- defined as anything between ASCII blanks or punctuation, -- or in other words [0-9A-Za-z\x80-\xFF]+ procedure Filter_By_Count (Counter : in out Word_Counter; Threshold_Count : in String_Count); -- Remove from Counter all entries whose count is below the threshold function Simple_Dictionary (Counter : in Word_Counter; Word_Count : in Natural; Method : in Methods.Enum := Methods.Encoded) return String_Lists.List; -- Return the Word_Count words in Counter that have the highest score, -- the score being count * length. procedure Simple_Dictionary_And_Pending (Counter : in Word_Counter; Word_Count : in Natural; Selected : out String_Lists.List; Pending : out String_Lists.List; Method : in Methods.Enum := Methods.Encoded; Max_Pending_Count : in Ada.Containers.Count_Type := Ada.Containers.Count_Type'Last); -- Return in Selected the Word_Count words in Counter that have the -- highest score, and in Pending the remaining words, -- the score being count * length. type Dictionary_Counts is array (Ada.Streams.Stream_Element) of String_Count; procedure Evaluate_Dictionary (Dict : in Dictionary; Corpus : in String_Lists.List; Compressed_Size : out Ada.Streams.Stream_Element_Count; Counts : out Dictionary_Counts); procedure Evaluate_Dictionary_Partial (Dict : in Dictionary; Corpus_Entry : in String; Compressed_Size : in out Ada.Streams.Stream_Element_Count; Counts : in out Dictionary_Counts); -- Compress all strings of Corpus, returning the total number of -- compressed bytes and the number of uses for each dictionary -- element. function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods.Enum; First, Last : in Ada.Streams.Stream_Element) return Ada.Streams.Stream_Element with Pre => Last in First .. Dict.Dict_Last; -- Return the element with worst score in the whole directionary function Worst_Index (Dict : in Dictionary; Counts : in Dictionary_Counts; Method : in Methods.Enum) return Ada.Streams.Stream_Element is (Worst_Index (Dict, Counts, Method, 0, Dict.Dict_Last)); -- Return the element with worst score in the whole directionary type Score_Value is range 0 .. 2 ** 31 - 1; function Score_Encoded (Count : in String_Count; Length : in Positive) return Score_Value is (Score_Value (Count) * Score_Value (Length)); -- Score value using the amount of encoded data by the element function Score_Frequency (Count : in String_Count; Length : in Positive) return Score_Value is (Score_Value (Count)); -- Score value using the number of times the element was used function Score_Gain (Count : in String_Count; Length : in Positive) return Score_Value is (Score_Value (Count) * (Score_Value (Length) - 1)); -- Score value using the number of bytes saved using the element function Score (Count : in String_Count; Length : in Positive; Method : in Methods.Enum) return Score_Value is (case Method is when Methods.Encoded => Score_Encoded (Count, Length), when Methods.Frequency => Score_Frequency (Count, Length), when Methods.Gain => Score_Gain (Count, Length)); -- Scare value with dynamically chosen method function Length (Dict : in Dictionary; E : in Ada.Streams.Stream_Element) return Positive is (Natools.Smaz.Dict_Entry (Dict, E)'Length); -- Length of a dictionary entry function Score_Encoded (Dict : in Dictionary; Counts : in Natools.Smaz.Tools.Dictionary_Counts; E : Ada.Streams.Stream_Element) return Score_Value is (Score_Encoded (Counts (E), Length (Dict, E))); -- Score value using the amount of encoded data using E function Score_Frequency (Dict : in Dictionary; Counts : in Natools.Smaz.Tools.Dictionary_Counts; E : Ada.Streams.Stream_Element) return Score_Value is (Score_Frequency (Counts (E), Length (Dict, E))); -- Score value using the number of times E was used function Score_Gain (Dict : in Dictionary; Counts : in Natools.Smaz.Tools.Dictionary_Counts; E : Ada.Streams.Stream_Element) return Score_Value is (Score_Gain (Counts (E), Length (Dict, E))); -- Score value using the number of bytes saved using E function Score (Dict : in Dictionary; Counts : in Natools.Smaz.Tools.Dictionary_Counts; E : in Ada.Streams.Stream_Element; Method : in Methods.Enum) return Score_Value is (Score (Counts (E), Length (Dict, E), Method)); -- Scare value with dynamically chosen method private package Word_Maps is new Ada.Containers.Indefinite_Ordered_Maps (String, String_Count); type Word_Counter is record Map : Word_Maps.Map; end record; type Scored_Word (Size : Natural) is record Word : String (1 .. Size); Score : Score_Value; end record; function "<" (Left, Right : Scored_Word) return Boolean is (Left.Score > Right.Score or else (Left.Score = Right.Score and then Left.Word < Right.Word)); function To_Scored_Word (Cursor : in Word_Maps.Cursor; Method : in Methods.Enum) return Scored_Word; package Scored_Word_Sets is new Ada.Containers.Indefinite_Ordered_Sets (Scored_Word); package Dictionary_Maps is new Ada.Containers.Indefinite_Ordered_Maps (String, Ada.Streams.Stream_Element); Search_Map : Dictionary_Maps.Map; type Trie_Node; type Trie_Node_Access is access Trie_Node; type Trie_Node_Array is array (Character) of Trie_Node_Access; type Trie_Node (Is_Leaf : Boolean) is new Ada.Finalization.Controlled with record Index : Natural; case Is_Leaf is when True => null; when False => Children : Trie_Node_Array; end case; end record; overriding procedure Adjust (Node : in out Trie_Node); overriding procedure Finalize (Node : in out Trie_Node); type Search_Trie is record Not_Found : Natural; Root : Trie_Node (False); end record; Trie_For_Search : Search_Trie; end Natools.Smaz.Tools;
tum-ei-rcs/StratoX
Ada
91
ads
package STM32 is pragma Preelaborate; --procedure configure_Hardware; end STM32;
zhmu/ananas
Ada
3,780
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . M M A P . U N I X -- -- -- -- S p e c -- -- -- -- Copyright (C) 2007-2022, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 3, or (at your option) any later -- -- version. This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY 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. -- -- -- ------------------------------------------------------------------------------ -- Declaration of off_t/mmap/munmap. This particular implementation -- supposes off_t is long. with System.OS_Lib; with Interfaces.C; package System.Mmap.Unix is type Mmap_Prot is new Interfaces.C.int; -- PROT_NONE : constant Mmap_Prot := 16#00#; -- PROT_EXEC : constant Mmap_Prot := 16#04#; PROT_READ : constant Mmap_Prot := 16#01#; PROT_WRITE : constant Mmap_Prot := 16#02#; type Mmap_Flags is new Interfaces.C.int; -- MAP_NONE : constant Mmap_Flags := 16#00#; -- MAP_FIXED : constant Mmap_Flags := 16#10#; MAP_SHARED : constant Mmap_Flags := 16#01#; MAP_PRIVATE : constant Mmap_Flags := 16#02#; type off_t is new Long_Integer; function Mmap (Start : Address := Null_Address; Length : Interfaces.C.size_t; Prot : Mmap_Prot := PROT_READ; Flags : Mmap_Flags := MAP_PRIVATE; Fd : System.OS_Lib.File_Descriptor; Offset : off_t) return Address; pragma Import (C, Mmap, "mmap"); function Munmap (Start : Address; Length : Interfaces.C.size_t) return Integer; pragma Import (C, Munmap, "munmap"); function Is_Mapping_Available return Boolean is (True); -- Wheter memory mapping is actually available on this system. It is an -- error to use Create_Mapping and Dispose_Mapping if this is False. end System.Mmap.Unix;
sungyeon/drake
Ada
4,214
adb
with Ada.Containers.Generic_Array_Access_Types; with Ada.Containers.Generic_Array_Types; with Ada.Unchecked_Deallocation; procedure cntnr_Array is begin declare -- String package Arrays is new Ada.Containers.Generic_Array_Types (Positive, Character, String); begin declare -- Swap Data : String := "AB"; begin Arrays.Swap (Data, 1, 2); pragma Assert (Data = "BA"); end; end; declare -- String_Access type String_Access is access String; procedure Free is new Ada.Unchecked_Deallocation (String, String_Access); package Arrays is new Ada.Containers.Generic_Array_Access_Types ( Positive, Character, String, String_Access); package Arrays_Operators is new Arrays.Operators; use Arrays_Operators; begin declare -- Swap Data : String_Access := new String'("AB"); begin Arrays.Swap (Data, 1, 2); pragma Assert (Data.all = "BA"); Free (Data); end; declare -- Generic_Sorting package Sorting is new Arrays.Generic_Sorting; Data : String_Access := new String'("asdfghjkl"); Data_2 : String_Access := new String'("zxcvbnm"); begin Sorting.Sort (Data); pragma Assert (Sorting.Is_Sorted (Data)); Sorting.Sort (Data_2); Sorting.Merge (Data, Data_2); pragma Assert (Data_2 = null); pragma Assert (Data.all = "abcdfghjklmnsvxz"); Free (Data); end; declare -- Concatenation operators use type Ada.Containers.Count_Type; X : String_Access := new String'("ABC"); Y : String_Access; begin pragma Assert (Arrays.Length (X) = 3); Arrays.Assign (Y, X & 'D'); pragma Assert (Arrays.Length (Y) = 4); pragma Assert (Y.all = "ABCD"); Arrays.Assign (Y, X & 'D' & 'E'); pragma Assert (Y.all = "ABCDE"); Arrays.Assign (Y, X & 'D' & 'E' & 'F'); pragma Assert (Y.all = "ABCDEF"); Free (X); Free (Y); end; declare -- Insert/Append/Prepend/Delete/Delete_First/Delete_Last use type Ada.Containers.Count_Type; X : aliased String_Access := new String'("ABCD"); begin Arrays.Delete (X, 2, 2); pragma Assert (X.all = "AD"); Arrays.Insert (X, 2, 'Z'); pragma Assert (X.all = "AZD"); Arrays.Append (X, 'a'); pragma Assert (X.all = "AZDa"); Arrays.Prepend (X, 'p'); pragma Assert (X.all = "pAZDa"); Arrays.Delete_First (X); Arrays.Delete_Last (X); pragma Assert (X.all = "AZD"); Arrays.Insert (X, X'First, "aa"); pragma Assert (X.all = "aaAZD"); Arrays.Insert (X, X'Last + 1, "zz"); pragma Assert (X.all = "aaAZDzz"); Free (X); X := new String'(10 .. 9 => <>); pragma Assert (X'Length = 0); Arrays.Append (X, 'A'); pragma Assert (X.all = "A"); pragma Assert (X'First = 10); Arrays.Append (X, 'C'); pragma Assert (X.all = "AC"); pragma Assert (X'First = 10); Arrays.Insert (X, 11, 'B'); pragma Assert (X.all = "ABC"); pragma Assert (X'First = 10); Arrays.Prepend (X, 'q'); pragma Assert (X.all = "qABC"); pragma Assert (X'First = 10); Arrays.Delete (X, 10, 1); pragma Assert (X.all = "ABC"); pragma Assert (X'First = 10); Free (X); end; declare -- Set_Length X : aliased String_Access; begin X := new String'(10 .. 9 => <>); Arrays.Set_Length (X, 1); pragma Assert (X'First = 10 and then X'Last = 10); X (10) := 'I'; Arrays.Set_Length (X, 2); pragma Assert (X'First = 10 and then X'Last = 11); X (11) := 'J'; pragma Assert (X.all = "IJ"); Free (X); end; declare -- Generic_Reversing package Reversing is new Arrays.Generic_Reversing; Data : String_Access := new String'("12345"); begin Reversing.Reverse_Elements (Data); pragma Assert (Data.all = "54321"); Reversing.Reverse_Rotate_Elements (Data, 3); pragma Assert (Data.all = "32154"); Reversing.Juggling_Rotate_Elements (Data, 3); pragma Assert (Data.all = "15432"); Reversing.Reverse_Rotate_Elements (Data, Arrays.First_Index (Data)); Reversing.Reverse_Rotate_Elements (Data, Arrays.Last_Index (Data) + 1); Reversing.Juggling_Rotate_Elements (Data, Arrays.First_Index (Data)); Reversing.Juggling_Rotate_Elements (Data, Arrays.Last_Index (Data) + 1); pragma Assert (Data.all = "15432"); end; end ; pragma Debug (Ada.Debug.Put ("OK")); end cntnr_Array;
glencornell/ada-object-framework
Ada
779
ads
-- Copyright (C) 2020 Glen Cornell <[email protected]> -- -- This program is free software: you can redistribute it and/or -- modify it under the terms of the GNU General Public License as -- published by the Free Software Foundation, either version 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 Aof.Core is pragma Pure; end Aof.Core;
reznikmm/matreshka
Ada
3,779
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Text_Use_Spreadsheet_Objects_Attributes is pragma Preelaborate; type ODF_Text_Use_Spreadsheet_Objects_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Text_Use_Spreadsheet_Objects_Attribute_Access is access all ODF_Text_Use_Spreadsheet_Objects_Attribute'Class with Storage_Size => 0; end ODF.DOM.Text_Use_Spreadsheet_Objects_Attributes;
zhmu/ananas
Ada
3,040
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T E X T _ I O . C _ S T R E A M S -- -- -- -- 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. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides an interface between Ada.Text_IO and the -- C streams. This allows sharing of a stream between Ada and C or C++, -- as well as allowing the Ada program to operate directly on the stream. with Interfaces.C_Streams; package Ada.Text_IO.C_Streams is package ICS renames Interfaces.C_Streams; function C_Stream (F : File_Type) return ICS.FILEs; -- Obtain stream from existing open file procedure Open (File : in out File_Type; Mode : File_Mode; C_Stream : ICS.FILEs; Form : String := ""; Name : String := ""); -- Create new file from existing stream end Ada.Text_IO.C_Streams;
AdaCore/libadalang
Ada
57
ads
pragma Cfg_1; package Pkg is procedure Foo; end Pkg;
burratoo/Acton
Ada
2,738
ads
------------------------------------------------------------------------------------------ -- -- -- OAK COMPONENTS -- -- -- -- OAK.STATES -- -- -- -- Copyright (C) 2013-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ package Oak.States with Pure is type Agent_State is (Bad_State, -- 0 Activation_Pending, -- 1 Activation_Failed, -- 2 Activation_Successful, -- 3 Activation_Complete, -- 4 Running, -- 5 Runnable, -- 6 Sleeping, -- 7 Waiting_For_Event, -- 8 Waiting_For_Protected_Object, -- 9 Inactive, -- 10 Setup_Cycles, -- 11 New_Cycle, -- 12 Release_Task, -- 13 Update_Task_Property, -- 14 Terminated, -- 15 Entering_PO, -- 16 Enter_PO_Refused, -- 17 Exiting_PO, -- 18 Exit_PO_Error, -- 19 Attach_Interrupt_Handler, -- 20 Handling_Interrupt, -- 21 Interrupt_Done, -- 22 No_State, -- 23 Agent_State_Change, -- 24 Selecting_Next_Agent, -- 25 Adding_Agent, -- 26 Adding_Agents, -- 27 Removing_Agent, -- 28 Scheduler_Agent_Done, -- 29 Allowance_Exhausted, -- 30 No_Agent_To_Run, -- 31 Initialising_Agents, -- 32 Not_Initialised, -- 33 Wake_Agent, -- 34 No_Message, -- 35 Invalid_Message); -- 36 subtype Waiting is Agent_State range Waiting_For_Event .. Waiting_For_Protected_Object; subtype Interrupt_States is Agent_State range Handling_Interrupt .. Interrupt_Done; subtype Deletable_State is Agent_State with Static_Predicate => Deletable_State in Allowance_Exhausted; end Oak.States;
charlie5/cBound
Ada
1,818
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_get_pixel_mapusv_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; pad1 : aliased swig.int8_t_Array (0 .. 3); n : aliased Interfaces.Unsigned_32; datum : aliased Interfaces.Unsigned_16; pad2 : aliased swig.int8_t_Array (0 .. 15); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_get_pixel_mapusv_reply_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_pixel_mapusv_reply_t.Item, Element_Array => xcb.xcb_glx_get_pixel_mapusv_reply_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_get_pixel_mapusv_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_get_pixel_mapusv_reply_t.Pointer, Element_Array => xcb.xcb_glx_get_pixel_mapusv_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_get_pixel_mapusv_reply_t;
AdaCore/training_material
Ada
34,864
adb
------------------------------------------------------------------------------ -- -- -- Hardware Abstraction Layer for STM32 Targets -- -- -- -- Copyright (C) 2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body STM32F4.RCC is HSE_VALUE : constant := 8_000_000; -- External oscillator in Hz HSI_VALUE : constant := 16_000_000; -- Internal oscillator in Hz HPRE_Presc_Table : constant array (Bits_4) of Word := (1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 64, 128, 256, 512); PPRE_Presc_Table : constant array (Bits_3) of Word := (1, 1, 1, 1, 2, 4, 8, 16); ------------------------- -- Get_Clock_Frequency -- ------------------------- function System_Clock_Frequencies return RCC_System_Clocks is RCC_CFGR_SWS : constant := 16#C#; Source : constant Word := Register.CFGR and RCC_CFGR_SWS; Result : RCC_System_Clocks; begin case Source is when 16#00# => -- HSI as source Result.SYSCLK := HSI_VALUE; when 16#04# => -- HSE as source Result.SYSCLK := HSE_VALUE; when 16#08# => -- PLL as source declare Pllsource : constant Word := (Register.PLLCFGR and 16#00400000#) / (2**22); Pllm : constant Word := Register.PLLCFGR and 16#0000003F#; Plln : constant Word := (Register.PLLCFGR and 16#00007FC0#) / (2**6); Pllp : constant Word := (((Register.PLLCFGR and 16#00030000#) / (2**16)) + 1) * 2; Pllvco : Word; begin if Pllsource /= 0 then Pllvco := (HSE_VALUE / Pllm) * Plln; else Pllvco := (HSI_VALUE / Pllm) * Plln; end if; Result.SYSCLK := Pllvco / Pllp; end; when others => Result.SYSCLK := HSI_VALUE; end case; declare HPRE : constant Bits_4 := Bits_4 ((Register.CFGR and 16#00F0#) / (2**4)); PPRE1 : constant Bits_3 := Bits_3 ((Register.CFGR and 16#1C00#) / (2**10)); PPRE2 : constant Bits_3 := Bits_3 ((Register.CFGR and 16#E000#) / (2**13)); TIMPR : constant Word := (Register.DCKCFGR / (2**24)) and 1; begin Result.HCLK := Result.SYSCLK / HPRE_Presc_Table (HPRE); Result.PCLK1 := Result.HCLK / PPRE_Presc_Table (PPRE1); Result.PCLK2 := Result.HCLK / PPRE_Presc_Table (PPRE2); -- Timer clocks -- See Dedicated clock cfg register documentation. if TIMPR = 0 then if PPRE_Presc_Table (PPRE1) = 1 then Result.TIMCLK1 := Result.PCLK1; else Result.TIMCLK1 := Result.PCLK1 * 2; end if; if PPRE_Presc_Table (PPRE2) = 1 then Result.TIMCLK2 := Result.PCLK2; else Result.TIMCLK2 := Result.PCLK2 * 2; end if; else if PPRE_Presc_Table (PPRE1) in 1 .. 4 then Result.TIMCLK1 := Result.HCLK; else Result.TIMCLK1 := Result.PCLK1 * 4; end if; if PPRE_Presc_Table (PPRE2) in 1 .. 4 then Result.TIMCLK2 := Result.HCLK; else Result.TIMCLK2 := Result.PCLK1 * 4; end if; end if; end; return Result; end System_Clock_Frequencies; ------------------------ -- Set_PLLSAI_Factors -- ------------------------ procedure Set_PLLSAI_Factors (LCD : Bits_3; SAI1 : Bits_4; VCO : Bits_9; DivR : Bits_2) is begin Register.PLLSAICFGR := (Word (VCO) * (2**6)) or (Word (SAI1) * (2**24)) or (Word (LCD) * (2**28)); Register.DCKCFGR := Register.DCKCFGR and (not (16#30000#)); Register.DCKCFGR := Register.DCKCFGR or (Word(DivR) * (2**16)); end Set_PLLSAI_Factors; ------------------- -- Enable_PLLSAI -- ------------------- procedure Enable_PLLSAI is begin Register.CR := Register.CR or (2**28); -- Wait for PLLSAI activation loop exit when (Register.CR and (2**29)) /= 0; end loop; end Enable_PLLSAI; --------------------------------------------------------------------------- ------- Enable/Disable/Reset Routines ----------------------------------- --------------------------------------------------------------------------- procedure GPIOA_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOAEN; end GPIOA_Clock_Enable; procedure GPIOB_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOBEN; end GPIOB_Clock_Enable; procedure GPIOC_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOCEN; end GPIOC_Clock_Enable; procedure GPIOD_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIODEN; end GPIOD_Clock_Enable; procedure GPIOE_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOEEN; end GPIOE_Clock_Enable; procedure GPIOF_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOFEN; end GPIOF_Clock_Enable; procedure GPIOG_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOGEN; end GPIOG_Clock_Enable; procedure GPIOH_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOHEN; end GPIOH_Clock_Enable; procedure GPIOI_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOIEN; end GPIOI_Clock_Enable; procedure GPIOJ_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOJEN; end GPIOJ_Clock_Enable; procedure GPIOK_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_GPIOKEN; end GPIOK_Clock_Enable; procedure CRC_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_CRCEN; end CRC_Clock_Enable; procedure BKPSRAM_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_BKPSRAMEN; end BKPSRAM_Clock_Enable; procedure CCMDATARAMEN_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_CCMDATARAMEN; end CCMDATARAMEN_Clock_Enable; procedure DMA1_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_DMA1EN; end DMA1_Clock_Enable; procedure DMA2_Clock_Enable is begin Register.AHB1ENR := Register.AHB1ENR or AHB1ENR_DMA2EN; end DMA2_Clock_Enable; procedure GPIOA_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOAEN; end GPIOA_Clock_Disable; procedure GPIOB_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOBEN; end GPIOB_Clock_Disable; procedure GPIOC_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOCEN; end GPIOC_Clock_Disable; procedure GPIOD_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIODEN; end GPIOD_Clock_Disable; procedure GPIOE_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOEEN; end GPIOE_Clock_Disable; procedure GPIOF_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOFEN; end GPIOF_Clock_Disable; procedure GPIOG_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOGEN; end GPIOG_Clock_Disable; procedure GPIOH_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOHEN; end GPIOH_Clock_Disable; procedure GPIOI_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOIEN; end GPIOI_Clock_Disable; procedure GPIOJ_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOJEN; end GPIOJ_Clock_Disable; procedure GPIOK_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_GPIOKEN; end GPIOK_Clock_Disable; procedure CRC_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_CRCEN; end CRC_Clock_Disable; procedure BKPSRAM_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_BKPSRAMEN; end BKPSRAM_Clock_Disable; procedure CCMDATARAMEN_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_CCMDATARAMEN; end CCMDATARAMEN_Clock_Disable; procedure DMA1_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_DMA1EN; end DMA1_Clock_Disable; procedure DMA2_Clock_Disable is begin Register.AHB1ENR := Register.AHB1ENR and not AHB1ENR_DMA2EN; end DMA2_Clock_Disable; procedure RNG_Clock_Enable is begin Register.AHB2ENR := Register.AHB2ENR or AHB2ENR_RNGEN; end RNG_Clock_Enable; procedure RNG_Clock_Disable is begin Register.AHB2ENR := Register.AHB2ENR and not AHB2ENR_RNGEN; end RNG_Clock_Disable; procedure TIM2_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM2EN; end TIM2_Clock_Enable; procedure TIM3_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM3EN; end TIM3_Clock_Enable; procedure TIM4_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM4EN; end TIM4_Clock_Enable; procedure TIM5_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM5EN; end TIM5_Clock_Enable; procedure TIM6_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM6EN; end TIM6_Clock_Enable; procedure TIM7_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM7EN; end TIM7_Clock_Enable; procedure TIM12_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM12EN; end TIM12_Clock_Enable; procedure TIM13_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM13EN; end TIM13_Clock_Enable; procedure TIM14_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_TIM14EN; end TIM14_Clock_Enable; procedure WWDG_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_WWDGEN; end WWDG_Clock_Enable; procedure SPI2_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_SPI2EN; end SPI2_Clock_Enable; procedure SPI3_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_SPI3EN; end SPI3_Clock_Enable; procedure USART2_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_USART2EN; end USART2_Clock_Enable; procedure USART3_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_USART3EN; end USART3_Clock_Enable; procedure UART4_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_UART4EN; end UART4_Clock_Enable; procedure UART5_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_UART5EN; end UART5_Clock_Enable; procedure UART7_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_UART7EN; end UART7_Clock_Enable; procedure UART8_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_UART8EN; end UART8_Clock_Enable; procedure I2C1_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_I2C1EN; end I2C1_Clock_Enable; procedure I2C2_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_I2C2EN; end I2C2_Clock_Enable; procedure I2C3_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_I2C3EN; end I2C3_Clock_Enable; procedure PWR_Clock_Enable is begin Register.APB1ENR := Register.APB1ENR or APB1ENR_PWREN; end PWR_Clock_Enable; procedure TIM2_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM2EN; end TIM2_Clock_Disable; procedure TIM3_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM3EN; end TIM3_Clock_Disable; procedure TIM4_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM4EN; end TIM4_Clock_Disable; procedure TIM5_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM5EN; end TIM5_Clock_Disable; procedure TIM6_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM6EN; end TIM6_Clock_Disable; procedure TIM7_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM7EN; end TIM7_Clock_Disable; procedure TIM12_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM12EN; end TIM12_Clock_Disable; procedure TIM13_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM13EN; end TIM13_Clock_Disable; procedure TIM14_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_TIM14EN; end TIM14_Clock_Disable; procedure WWDG_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_WWDGEN; end WWDG_Clock_Disable; procedure SPI2_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_SPI2EN; end SPI2_Clock_Disable; procedure SPI3_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_SPI3EN; end SPI3_Clock_Disable; procedure USART2_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_USART2EN; end USART2_Clock_Disable; procedure USART3_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_USART3EN; end USART3_Clock_Disable; procedure UART4_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_UART4EN; end UART4_Clock_Disable; procedure UART5_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_UART5EN; end UART5_Clock_Disable; procedure UART7_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_UART7EN; end UART7_Clock_Disable; procedure UART8_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_UART8EN; end UART8_Clock_Disable; procedure I2C1_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_I2C1EN; end I2C1_Clock_Disable; procedure I2C2_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_I2C2EN; end I2C2_Clock_Disable; procedure I2C3_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_I2C3EN; end I2C3_Clock_Disable; procedure PWR_Clock_Disable is begin Register.APB1ENR := Register.APB1ENR and not APB1ENR_PWREN; end PWR_Clock_Disable; procedure TIM1_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_TIM1EN; end TIM1_Clock_Enable; procedure TIM8_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_TIM8EN; end TIM8_Clock_Enable; procedure USART1_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_USART1EN; end USART1_Clock_Enable; procedure USART6_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_USART6EN; end USART6_Clock_Enable; procedure ADC1_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_ADC1EN; end ADC1_Clock_Enable; procedure SDIO_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_SDIOEN; end SDIO_Clock_Enable; procedure SPI1_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_SPI1EN; end SPI1_Clock_Enable; procedure SPI4_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_SPI4EN; end SPI4_Clock_Enable; procedure SYSCFG_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_SYSCFGEN; end SYSCFG_Clock_Enable; procedure TIM9_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_TIM9EN; end TIM9_Clock_Enable; procedure TIM10_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_TIM10EN; end TIM10_Clock_Enable; procedure TIM11_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_TIM11EN; end TIM11_Clock_Enable; procedure SPI5_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_SPI5EN; end SPI5_Clock_Enable; procedure SPI6_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_SPI6EN; end SPI6_Clock_Enable; procedure LTDC_Clock_Enable is begin Register.APB2ENR := Register.APB2ENR or APB2ENR_LTDCEN; end LTDC_Clock_Enable; procedure TIM1_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_TIM1EN; end TIM1_Clock_Disable; procedure TIM8_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_TIM8EN; end TIM8_Clock_Disable; procedure USART1_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_USART1EN; end USART1_Clock_Disable; procedure USART6_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_USART6EN; end USART6_Clock_Disable; procedure ADC1_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_ADC1EN; end ADC1_Clock_Disable; procedure SDIO_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_SDIOEN; end SDIO_Clock_Disable; procedure SPI1_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_SPI1EN; end SPI1_Clock_Disable; procedure SPI4_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_SPI4EN; end SPI4_Clock_Disable; procedure SYSCFG_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_SYSCFGEN; end SYSCFG_Clock_Disable; procedure TIM9_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_TIM9EN; end TIM9_Clock_Disable; procedure TIM10_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_TIM10EN; end TIM10_Clock_Disable; procedure TIM11_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_TIM11EN; end TIM11_Clock_Disable; procedure SPI5_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_SPI5EN; end SPI5_Clock_Disable; procedure SPI6_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_SPI6EN; end SPI6_Clock_Disable; procedure LTDC_Clock_Disable is begin Register.APB2ENR := Register.APB2ENR and not APB2ENR_LTDCEN; end LTDC_Clock_Disable; procedure AHB1_Force_Reset is begin Register.AHB1RSTR := 16#FFFF_FFFF#; end AHB1_Force_Reset; procedure GPIOA_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_GPIOARST; end GPIOA_Force_Reset; procedure GPIOB_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_GPIOBRST; end GPIOB_Force_Reset; procedure GPIOC_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_GPIOCRST; end GPIOC_Force_Reset; procedure GPIOD_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_GPIODRST; end GPIOD_Force_Reset; procedure GPIOE_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_GPIOERST; end GPIOE_Force_Reset; procedure GPIOH_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_GPIOHRST; end GPIOH_Force_Reset; procedure CRC_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_CRCRST; end CRC_Force_Reset; procedure DMA1_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_DMA1RST; end DMA1_Force_Reset; procedure DMA2_Force_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR or AHB1RSTR_DMA2RST; end DMA2_Force_Reset; procedure AHB1_Release_Reset is begin Register.AHB1RSTR := 0; end AHB1_Release_Reset; procedure GPIOA_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOARST; end GPIOA_Release_Reset; procedure GPIOB_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOBRST; end GPIOB_Release_Reset; procedure GPIOC_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOCRST; end GPIOC_Release_Reset; procedure GPIOD_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIODRST; end GPIOD_Release_Reset; procedure GPIOE_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOERST; end GPIOE_Release_Reset; procedure GPIOF_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOFRST; end GPIOF_Release_Reset; procedure GPIOG_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOGRST; end GPIOG_Release_Reset; procedure GPIOH_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOHRST; end GPIOH_Release_Reset; procedure GPIOI_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_GPIOIRST; end GPIOI_Release_Reset; procedure CRC_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_CRCRST; end CRC_Release_Reset; procedure DMA1_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_DMA1RST; end DMA1_Release_Reset; procedure DMA2_Release_Reset is begin Register.AHB1RSTR := Register.AHB1RSTR and not AHB1RSTR_DMA2RST; end DMA2_Release_Reset; procedure AHB2_Force_Reset is begin Register.AHB2RSTR := 16#FFFF_FFFF#; end AHB2_Force_Reset; procedure OTGFS_Force_Reset is begin Register.AHB2RSTR := Register.AHB2RSTR or AHB2RSTR_OTGFSRST; end OTGFS_Force_Reset; procedure AHB2_Release_Reset is begin Register.AHB2RSTR := 0; end AHB2_Release_Reset; procedure OTGFS_Release_Reset is begin Register.AHB2RSTR := Register.AHB2RSTR and not AHB2RSTR_OTGFSRST; end OTGFS_Release_Reset; procedure RNG_Force_Reset is begin Register.AHB2RSTR := Register.AHB2RSTR or AHB2RSTR_RNGRST; end RNG_Force_Reset; procedure RNG_Release_Reset is begin Register.AHB2RSTR := Register.AHB2RSTR and not AHB2RSTR_RNGRST; end RNG_Release_Reset; procedure APB1_Force_Reset is begin Register.APB1RSTR := 16#FFFF_FFFF#; end APB1_Force_Reset; procedure TIM2_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM2RST; end TIM2_Force_Reset; procedure TIM3_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM3RST; end TIM3_Force_Reset; procedure TIM4_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM4RST; end TIM4_Force_Reset; procedure TIM5_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM5RST; end TIM5_Force_Reset; procedure TIM6_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM6RST; end TIM6_Force_Reset; procedure TIM7_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM7RST; end TIM7_Force_Reset; procedure TIM12_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM12RST; end TIM12_Force_Reset; procedure TIM13_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM13RST; end TIM13_Force_Reset; procedure TIM14_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_TIM14RST; end TIM14_Force_Reset; procedure WWDG_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_WWDGRST; end WWDG_Force_Reset; procedure SPI2_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_SPI2RST; end SPI2_Force_Reset; procedure SPI3_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_SPI3RST; end SPI3_Force_Reset; procedure USART2_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_USART2RST; end USART2_Force_Reset; procedure I2C1_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_I2C1RST; end I2C1_Force_Reset; procedure I2C2_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_I2C2RST; end I2C2_Force_Reset; procedure I2C3_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_I2C3RST; end I2C3_Force_Reset; procedure PWR_Force_Reset is begin Register.APB1RSTR := Register.APB1RSTR or APB1RSTR_PWRRST; end PWR_Force_Reset; procedure APB1_Release_Reset is begin Register.APB1RSTR := 0; end APB1_Release_Reset; procedure TIM2_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM2RST; end TIM2_Release_Reset; procedure TIM3_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM3RST; end TIM3_Release_Reset; procedure TIM4_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM4RST; end TIM4_Release_Reset; procedure TIM5_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM5RST; end TIM5_Release_Reset; procedure TIM6_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM6RST; end TIM6_Release_Reset; procedure TIM7_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM7RST; end TIM7_Release_Reset; procedure TIM12_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM12RST; end TIM12_Release_Reset; procedure TIM13_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM13RST; end TIM13_Release_Reset; procedure TIM14_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_TIM14RST; end TIM14_Release_Reset; procedure WWDG_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_WWDGRST; end WWDG_Release_Reset; procedure SPI2_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_SPI2RST; end SPI2_Release_Reset; procedure SPI3_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_SPI3RST; end SPI3_Release_Reset; procedure USART2_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_USART2RST; end USART2_Release_Reset; procedure I2C1_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_I2C1RST; end I2C1_Release_Reset; procedure I2C2_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_I2C2RST; end I2C2_Release_Reset; procedure I2C3_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_I2C3RST; end I2C3_Release_Reset; procedure PWR_Release_Reset is begin Register.APB1RSTR := Register.APB1RSTR and not APB1RSTR_PWRRST; end PWR_Release_Reset; procedure APB2_Force_Reset is begin Register.APB2RSTR := 16#FFFF_FFFF#; end APB2_Force_Reset; procedure TIM1_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_TIM1RST; end TIM1_Force_Reset; procedure TIM8_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_TIM8RST; end TIM8_Force_Reset; procedure USART1_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_USART1RST; end USART1_Force_Reset; procedure USART6_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_USART6RST; end USART6_Force_Reset; procedure ADC_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_ADCRST; end ADC_Force_Reset; procedure SDIO_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_SDIORST; end SDIO_Force_Reset; procedure SPI1_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_SPI1RST; end SPI1_Force_Reset; procedure SPI4_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_SPI4RST; end SPI4_Force_Reset; procedure SYSCFG_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_SYSCFGRST; end SYSCFG_Force_Reset; procedure TIM9_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_TIM9RST; end TIM9_Force_Reset; procedure TIM10_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_TIM10RST; end TIM10_Force_Reset; procedure TIM11_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_TIM11RST; end TIM11_Force_Reset; procedure SPI5_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_SPI5RST; end SPI5_Force_Reset; procedure SPI6_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_SPI6RST; end SPI6_Force_Reset; procedure LTDC_Force_Reset is begin Register.APB2RSTR := Register.APB2RSTR or APB2RSTR_LTDCRST; end LTDC_Force_Reset; procedure APB2_Release_Reset is begin Register.APB2RSTR := 0; end APB2_Release_Reset; procedure TIM1_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_TIM1RST; end TIM1_Release_Reset; procedure TIM8_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_TIM8RST; end TIM8_Release_Reset; procedure USART1_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_USART1RST; end USART1_Release_Reset; procedure USART6_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_USART6RST; end USART6_Release_Reset; procedure ADC_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_ADCRST; end ADC_Release_Reset; procedure SDIO_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_SDIORST; end SDIO_Release_Reset; procedure SPI1_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_SPI1RST; end SPI1_Release_Reset; procedure SPI4_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_SPI4RST; end SPI4_Release_Reset; procedure SYSCFG_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_SYSCFGRST; end SYSCFG_Release_Reset; procedure TIM9_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_TIM9RST; end TIM9_Release_Reset; procedure TIM10_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_TIM10RST; end TIM10_Release_Reset; procedure TIM11_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_TIM11RST; end TIM11_Release_Reset; procedure SPI5_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_SPI5RST; end SPI5_Release_Reset; procedure SPI6_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_SPI6RST; end SPI6_Release_Reset; procedure LTDC_Release_Reset is begin Register.APB2RSTR := Register.APB2RSTR and not APB2RSTR_LTDCRST; end LTDC_Release_Reset; procedure FSMC_Clock_Enable is begin Register.AHB3ENR := Register.AHB3ENR or AHB3ENR_FSMCEN; end FSMC_Clock_Enable; procedure FSMC_Clock_Disable is begin Register.AHB3ENR := Register.AHB3ENR and not AHB3ENR_FSMCEN; end FSMC_Clock_Disable; end STM32F4.RCC;
reznikmm/matreshka
Ada
3,905
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 Matreshka.ODF_Attributes.Style.Language_Complex; package ODF.DOM.Attributes.Style.Language_Complex.Internals is function Create (Node : Matreshka.ODF_Attributes.Style.Language_Complex.Style_Language_Complex_Access) return ODF.DOM.Attributes.Style.Language_Complex.ODF_Style_Language_Complex; function Wrap (Node : Matreshka.ODF_Attributes.Style.Language_Complex.Style_Language_Complex_Access) return ODF.DOM.Attributes.Style.Language_Complex.ODF_Style_Language_Complex; end ODF.DOM.Attributes.Style.Language_Complex.Internals;
persan/AUnit-addons
Ada
386
adb
pragma Ada_2012; with Tc; with Tc2; package body Suits is T : aliased Tc.Test_Case; T2 : aliased Tc2.Test_Case; ---------- -- Suit -- ---------- S : aliased AUnit.Test_Suites.Test_Suite; function Suit return AUnit.Test_Suites.Access_Test_Suite is begin S.Add_Test (T'Access); S.Add_Test (T2'Access); return S'Access; end Suit; end Suits;
reznikmm/matreshka
Ada
38,529
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.Internals.OCL_Elements; with AMF.OCL.Any_Types; with AMF.String_Collections; with AMF.UML.Classifier_Template_Parameters; with AMF.UML.Classifiers.Collections; with AMF.UML.Collaboration_Uses.Collections; with AMF.UML.Comments.Collections; with AMF.UML.Constraints.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Element_Imports.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Features.Collections; with AMF.UML.Generalization_Sets.Collections; with AMF.UML.Generalizations.Collections; with AMF.UML.Named_Elements.Collections; with AMF.UML.Namespaces.Collections; with AMF.UML.Package_Imports.Collections; with AMF.UML.Packageable_Elements.Collections; with AMF.UML.Packages.Collections; with AMF.UML.Parameterable_Elements.Collections; with AMF.UML.Properties.Collections; with AMF.UML.Redefinable_Elements.Collections; with AMF.UML.Redefinable_Template_Signatures; with AMF.UML.String_Expressions; with AMF.UML.Substitutions.Collections; with AMF.UML.Template_Bindings.Collections; with AMF.UML.Template_Parameters; with AMF.UML.Template_Signatures; with AMF.UML.Types; with AMF.UML.Use_Cases.Collections; with AMF.Visitors; package AMF.Internals.OCL_Any_Types is type OCL_Any_Type_Proxy is limited new AMF.Internals.OCL_Elements.OCL_Element_Proxy and AMF.OCL.Any_Types.OCL_Any_Type with null record; overriding function Get_Attribute (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Properties.Collections.Set_Of_UML_Property; -- Getter of Classifier::attribute. -- -- Refers to all of the Properties that are direct (i.e. not inherited or -- imported) attributes of the classifier. overriding function Get_Collaboration_Use (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use; -- Getter of Classifier::collaborationUse. -- -- References the collaboration uses owned by the classifier. overriding function Get_Feature (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature; -- Getter of Classifier::feature. -- -- Specifies each feature defined in the classifier. -- Note that there may be members of the Classifier that are of the type -- Feature but are not included in this association, e.g. inherited -- features. overriding function Get_General (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of Classifier::general. -- -- Specifies the general Classifiers for this Classifier. -- References the general classifier in the Generalization relationship. overriding function Get_Generalization (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization; -- Getter of Classifier::generalization. -- -- Specifies the Generalization relationships for this Classifier. These -- Generalizations navigaten to more general classifiers in the -- generalization hierarchy. overriding function Get_Inherited_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Classifier::inheritedMember. -- -- Specifies all elements inherited by this classifier from the general -- classifiers. overriding function Get_Is_Abstract (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Getter of Classifier::isAbstract. -- -- If true, the Classifier does not provide a complete declaration and can -- typically not be instantiated. An abstract classifier is intended to be -- used by other classifiers e.g. as the target of general -- metarelationships or generalization relationships. overriding procedure Set_Is_Abstract (Self : not null access OCL_Any_Type_Proxy; To : Boolean); -- Setter of Classifier::isAbstract. -- -- If true, the Classifier does not provide a complete declaration and can -- typically not be instantiated. An abstract classifier is intended to be -- used by other classifiers e.g. as the target of general -- metarelationships or generalization relationships. overriding function Get_Is_Final_Specialization (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Getter of Classifier::isFinalSpecialization. -- -- If true, the Classifier cannot be specialized by generalization. Note -- that this property is preserved through package merge operations; that -- is, the capability to specialize a Classifier (i.e., -- isFinalSpecialization =false) must be preserved in the resulting -- Classifier of a package merge operation where a Classifier with -- isFinalSpecialization =false is merged with a matching Classifier with -- isFinalSpecialization =true: the resulting Classifier will have -- isFinalSpecialization =false. overriding procedure Set_Is_Final_Specialization (Self : not null access OCL_Any_Type_Proxy; To : Boolean); -- Setter of Classifier::isFinalSpecialization. -- -- If true, the Classifier cannot be specialized by generalization. Note -- that this property is preserved through package merge operations; that -- is, the capability to specialize a Classifier (i.e., -- isFinalSpecialization =false) must be preserved in the resulting -- Classifier of a package merge operation where a Classifier with -- isFinalSpecialization =false is merged with a matching Classifier with -- isFinalSpecialization =true: the resulting Classifier will have -- isFinalSpecialization =false. overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access; -- Getter of Classifier::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access); -- Setter of Classifier::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding function Get_Owned_Use_Case (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case; -- Getter of Classifier::ownedUseCase. -- -- References the use cases owned by this classifier. overriding function Get_Powertype_Extent (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set; -- Getter of Classifier::powertypeExtent. -- -- Designates the GeneralizationSet of which the associated Classifier is -- a power type. overriding function Get_Redefined_Classifier (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of Classifier::redefinedClassifier. -- -- References the Classifiers that are redefined by this Classifier. overriding function Get_Representation (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access; -- Getter of Classifier::representation. -- -- References a collaboration use which indicates the collaboration that -- represents this classifier. overriding procedure Set_Representation (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access); -- Setter of Classifier::representation. -- -- References a collaboration use which indicates the collaboration that -- represents this classifier. overriding function Get_Substitution (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution; -- Getter of Classifier::substitution. -- -- References the substitutions that are owned by this Classifier. overriding function Get_Template_Parameter (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access; -- Getter of Classifier::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access); -- Setter of Classifier::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function Get_Use_Case (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case; -- Getter of Classifier::useCase. -- -- The set of use cases for which this Classifier is the subject. overriding function Get_Element_Import (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import; -- Getter of Namespace::elementImport. -- -- References the ElementImports owned by the Namespace. overriding function Get_Imported_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Getter of Namespace::importedMember. -- -- References the PackageableElements that are members of this Namespace -- as a result of either PackageImports or ElementImports. overriding function Get_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Namespace::member. -- -- A collection of NamedElements identifiable within the Namespace, either -- by being owned or by being introduced by importing or inheritance. overriding function Get_Owned_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Getter of Namespace::ownedMember. -- -- A collection of NamedElements owned by the Namespace. overriding function Get_Owned_Rule (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint; -- Getter of Namespace::ownedRule. -- -- Specifies a set of Constraints owned by this Namespace. overriding function Get_Package_Import (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import; -- Getter of Namespace::packageImport. -- -- References the PackageImports owned by the Namespace. overriding function Get_Client_Dependency (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name (Self : not null access constant OCL_Any_Type_Proxy) return AMF.Optional_String; -- Getter of NamedElement::name. -- -- The name of the NamedElement. overriding procedure Set_Name (Self : not null access OCL_Any_Type_Proxy; To : AMF.Optional_String); -- Setter of NamedElement::name. -- -- The name of the NamedElement. overriding function Get_Name_Expression (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant OCL_Any_Type_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Visibility (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Optional_UML_Visibility_Kind; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding procedure Set_Visibility (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind); -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding function Get_Owned_Comment (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function Get_Package (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Packages.UML_Package_Access; -- Getter of Type::package. -- -- Specifies the owning package of this classifier, if any. overriding procedure Set_Package (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Packages.UML_Package_Access); -- Setter of Type::package. -- -- Specifies the owning package of this classifier, if any. overriding function Get_Visibility (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.UML_Visibility_Kind; -- Getter of PackageableElement::visibility. -- -- Indicates that packageable elements must always have a visibility, -- i.e., visibility is not optional. overriding procedure Set_Visibility (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.UML_Visibility_Kind); -- Setter of PackageableElement::visibility. -- -- Indicates that packageable elements must always have a visibility, -- i.e., visibility is not optional. overriding function Get_Owning_Template_Parameter (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding procedure Set_Owning_Template_Parameter (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::owningTemplateParameter. -- -- The formal template parameter that owns this element. overriding function Get_Template_Parameter (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Template_Parameters.UML_Template_Parameter_Access; -- Getter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding procedure Set_Template_Parameter (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access); -- Setter of ParameterableElement::templateParameter. -- -- The template parameter that exposes this element as a formal parameter. overriding function Get_Owned_Template_Signature (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Template_Signatures.UML_Template_Signature_Access; -- Getter of TemplateableElement::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding procedure Set_Owned_Template_Signature (Self : not null access OCL_Any_Type_Proxy; To : AMF.UML.Template_Signatures.UML_Template_Signature_Access); -- Setter of TemplateableElement::ownedTemplateSignature. -- -- The optional template signature specifying the formal template -- parameters. overriding function Get_Template_Binding (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding; -- Getter of TemplateableElement::templateBinding. -- -- The optional bindings from this element to templates. overriding function Get_Is_Leaf (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Getter of RedefinableElement::isLeaf. -- -- Indicates whether it is possible to further redefine a -- RedefinableElement. If the value is true, then it is not possible to -- further redefine the RedefinableElement. Note that this property is -- preserved through package merge operations; that is, the capability to -- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in -- the resulting RedefinableElement of a package merge operation where a -- RedefinableElement with isLeaf=false is merged with a matching -- RedefinableElement with isLeaf=true: the resulting RedefinableElement -- will have isLeaf=false. Default value is false. overriding procedure Set_Is_Leaf (Self : not null access OCL_Any_Type_Proxy; To : Boolean); -- Setter of RedefinableElement::isLeaf. -- -- Indicates whether it is possible to further redefine a -- RedefinableElement. If the value is true, then it is not possible to -- further redefine the RedefinableElement. Note that this property is -- preserved through package merge operations; that is, the capability to -- redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in -- the resulting RedefinableElement of a package merge operation where a -- RedefinableElement with isLeaf=false is merged with a matching -- RedefinableElement with isLeaf=true: the resulting RedefinableElement -- will have isLeaf=false. Default value is false. overriding function Get_Redefined_Element (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element; -- Getter of RedefinableElement::redefinedElement. -- -- The redefinable element that is being redefined by this element. overriding function Get_Redefinition_Context (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Getter of RedefinableElement::redefinitionContext. -- -- References the contexts that this element may be redefined from. overriding function All_Features (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Features.Collections.Set_Of_UML_Feature; -- Operation Classifier::allFeatures. -- -- The query allFeatures() gives all of the features in the namespace of -- the classifier. In general, through mechanisms such as inheritance, -- this will be a larger set than feature. overriding function All_Parents (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Operation Classifier::allParents. -- -- The query allParents() gives all of the direct and indirect ancestors -- of a generalized Classifier. overriding function Conforms_To (Self : not null access constant OCL_Any_Type_Proxy; Other : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean; -- Operation Classifier::conformsTo. -- -- The query conformsTo() gives true for a classifier that defines a type -- that conforms to another. This is used, for example, in the -- specification of signature conformance for operations. overriding function General (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Operation Classifier::general. -- -- The general classifiers are the classifiers referenced by the -- generalization relationships. overriding function Has_Visibility_Of (Self : not null access constant OCL_Any_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access) return Boolean; -- Operation Classifier::hasVisibilityOf. -- -- The query hasVisibilityOf() determines whether a named element is -- visible in the classifier. By default all are visible. It is only -- called when the argument is something owned by a parent. overriding function Inherit (Self : not null access constant OCL_Any_Type_Proxy; Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Classifier::inherit. -- -- The query inherit() defines how to inherit a set of elements. Here the -- operation is defined to inherit them all. It is intended to be -- redefined in circumstances where inheritance is affected by -- redefinition. -- The inherit operation is overridden to exclude redefined properties. overriding function Inheritable_Members (Self : not null access constant OCL_Any_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Classifier::inheritableMembers. -- -- The query inheritableMembers() gives all of the members of a classifier -- that may be inherited in one of its descendants, subject to whatever -- visibility restrictions apply. overriding function Inherited_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Classifier::inheritedMember. -- -- The inheritedMember association is derived by inheriting the -- inheritable members of the parents. -- The inheritedMember association is derived by inheriting the -- inheritable members of the parents. overriding function Is_Template (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Operation Classifier::isTemplate. -- -- The query isTemplate() returns whether this templateable element is -- actually a template. overriding function May_Specialize_Type (Self : not null access constant OCL_Any_Type_Proxy; C : AMF.UML.Classifiers.UML_Classifier_Access) return Boolean; -- Operation Classifier::maySpecializeType. -- -- The query maySpecializeType() determines whether this classifier may -- have a generalization relationship to classifiers of the specified -- type. By default a classifier may specialize classifiers of the same or -- a more general type. It is intended to be redefined by classifiers that -- have different specialization constraints. overriding function Parents (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier; -- Operation Classifier::parents. -- -- The query parents() gives all of the immediate ancestors of a -- generalized Classifier. overriding function Exclude_Collisions (Self : not null access constant OCL_Any_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation Namespace::excludeCollisions. -- -- The query excludeCollisions() excludes from a set of -- PackageableElements any that would not be distinguishable from each -- other in this namespace. overriding function Get_Names_Of_Member (Self : not null access constant OCL_Any_Type_Proxy; Element : AMF.UML.Named_Elements.UML_Named_Element_Access) return AMF.String_Collections.Set_Of_String; -- Operation Namespace::getNamesOfMember. -- -- The query getNamesOfMember() takes importing into account. It gives -- back the set of names that an element would have in an importing -- namespace, either because it is owned, or if not owned then imported -- individually, or if not individually then from a package. -- The query getNamesOfMember() gives a set of all of the names that a -- member would have in a Namespace. In general a member can have multiple -- names in a Namespace if it is imported more than once with different -- aliases. The query takes account of importing. It gives back the set of -- names that an element would have in an importing namespace, either -- because it is owned, or if not owned then imported individually, or if -- not individually then from a package. overriding function Import_Members (Self : not null access constant OCL_Any_Type_Proxy; Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation Namespace::importMembers. -- -- The query importMembers() defines which of a set of PackageableElements -- are actually imported into the namespace. This excludes hidden ones, -- i.e., those which have names that conflict with names of owned members, -- and also excludes elements which would have the same name when imported. overriding function Imported_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element; -- Operation Namespace::importedMember. -- -- The importedMember property is derived from the ElementImports and the -- PackageImports. References the PackageableElements that are members of -- this Namespace as a result of either PackageImports or ElementImports. overriding function Members_Are_Distinguishable (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Operation Namespace::membersAreDistinguishable. -- -- The Boolean query membersAreDistinguishable() determines whether all of -- the namespace's members are distinguishable within it. overriding function Owned_Member (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element; -- Operation Namespace::ownedMember. -- -- Missing derivation for Namespace::/ownedMember : NamedElement overriding function All_Namespaces (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. overriding function All_Owning_Packages (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant OCL_Any_Type_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Qualified_Name (Self : not null access constant OCL_Any_Type_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. overriding function Separator (Self : not null access constant OCL_Any_Type_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. overriding function All_Owned_Elements (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding function Conforms_To (Self : not null access constant OCL_Any_Type_Proxy; Other : AMF.UML.Types.UML_Type_Access) return Boolean; -- Operation Type::conformsTo. -- -- The query conformsTo() gives true for a type that conforms to another. -- By default, two types do not conform to each other. This query is -- intended to be redefined for specific conformance situations. overriding function Is_Compatible_With (Self : not null access constant OCL_Any_Type_Proxy; P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access) return Boolean; -- Operation ParameterableElement::isCompatibleWith. -- -- The query isCompatibleWith() determines if this parameterable element -- is compatible with the specified parameterable element. By default -- parameterable element P is compatible with parameterable element Q if -- the kind of P is the same or a subtype as the kind of Q. Subclasses -- should override this operation to specify different compatibility -- constraints. overriding function Is_Template_Parameter (Self : not null access constant OCL_Any_Type_Proxy) return Boolean; -- Operation ParameterableElement::isTemplateParameter. -- -- The query isTemplateParameter() determines if this parameterable -- element is exposed as a formal template parameter. overriding function Parameterable_Elements (Self : not null access constant OCL_Any_Type_Proxy) return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element; -- Operation TemplateableElement::parameterableElements. -- -- The query parameterableElements() returns the set of elements that may -- be used as the parametered elements for a template parameter of this -- templateable element. By default, this set includes all the owned -- elements. Subclasses may override this operation if they choose to -- restrict the set of parameterable elements. overriding function Is_Consistent_With (Self : not null access constant OCL_Any_Type_Proxy; Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean; -- Operation RedefinableElement::isConsistentWith. -- -- The query isConsistentWith() specifies, for any two RedefinableElements -- in a context in which redefinition is possible, whether redefinition -- would be logically consistent. By default, this is false; this -- operation must be overridden for subclasses of RedefinableElement to -- define the consistency conditions. overriding function Is_Redefinition_Context_Valid (Self : not null access constant OCL_Any_Type_Proxy; Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access) return Boolean; -- Operation RedefinableElement::isRedefinitionContextValid. -- -- The query isRedefinitionContextValid() specifies whether the -- redefinition contexts of this RedefinableElement are properly related -- to the redefinition contexts of the specified RedefinableElement to -- allow this element to redefine the other. By default at least one of -- the redefinition contexts of this element must be a specialization of -- at least one of the redefinition contexts of the specified element. overriding procedure Enter_Element (Self : not null access constant OCL_Any_Type_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 OCL_Any_Type_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 OCL_Any_Type_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.OCL_Any_Types;
reznikmm/matreshka
Ada
4,840
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Visitors; with ODF.DOM.Table_Target_Range_Address_Elements; package Matreshka.ODF_Table.Target_Range_Address_Elements is type Table_Target_Range_Address_Element_Node is new Matreshka.ODF_Table.Abstract_Table_Element_Node and ODF.DOM.Table_Target_Range_Address_Elements.ODF_Table_Target_Range_Address with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters) return Table_Target_Range_Address_Element_Node; overriding function Get_Local_Name (Self : not null access constant Table_Target_Range_Address_Element_Node) return League.Strings.Universal_String; overriding procedure Enter_Node (Self : not null access Table_Target_Range_Address_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Leave_Node (Self : not null access Table_Target_Range_Address_Element_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); overriding procedure Visit_Node (Self : not null access Table_Target_Range_Address_Element_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control); end Matreshka.ODF_Table.Target_Range_Address_Elements;
zhmu/ananas
Ada
108,657
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . A R I T H _ D O U B L E -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; package body System.Arith_Double with SPARK_Mode is -- Contracts, ghost code, loop invariants and assertions in this unit are -- meant for analysis only, not for run-time checking, as it would be too -- costly otherwise. This is enforced by setting the assertion policy to -- Ignore. pragma Assertion_Policy (Pre => Ignore, Post => Ignore, Contract_Cases => Ignore, Ghost => Ignore, Loop_Invariant => Ignore, Assert => Ignore); pragma Suppress (Overflow_Check); pragma Suppress (Range_Check); function To_Uns is new Ada.Unchecked_Conversion (Double_Int, Double_Uns); function To_Int is new Ada.Unchecked_Conversion (Double_Uns, Double_Int); Double_Size : constant Natural := Double_Int'Size; Single_Size : constant Natural := Double_Int'Size / 2; -- Log of Single_Size in base 2, so that Single_Size = 2 ** Log_Single_Size Log_Single_Size : constant Natural := (case Single_Size is when 32 => 5, when 64 => 6, when 128 => 7, when others => raise Program_Error) with Ghost; -- Power-of-two constants pragma Warnings (Off, "non-preelaborable call not allowed in preelaborated unit", Reason => "Ghost code is not compiled"); pragma Warnings (Off, "non-static constant in preelaborated unit", Reason => "Ghost code is not compiled"); Big_0 : constant Big_Integer := Big (Double_Uns'(0)) with Ghost; Big_2xxSingle : constant Big_Integer := Big (Double_Int'(2 ** Single_Size)) with Ghost; Big_2xxDouble_Minus_1 : constant Big_Integer := Big (Double_Uns'(2 ** (Double_Size - 1))) with Ghost; Big_2xxDouble : constant Big_Integer := Big (Double_Uns'(2 ** Double_Size - 1)) + 1 with Ghost; pragma Warnings (On, "non-preelaborable call not allowed in preelaborated unit"); pragma Warnings (On, "non-static constant in preelaborated unit"); ----------------------- -- Local Subprograms -- ----------------------- function "+" (A, B : Single_Uns) return Double_Uns is (Double_Uns (A) + Double_Uns (B)); function "+" (A : Double_Uns; B : Single_Uns) return Double_Uns is (A + Double_Uns (B)); -- Length doubling additions function "*" (A, B : Single_Uns) return Double_Uns is (Double_Uns (A) * Double_Uns (B)); -- Length doubling multiplication function "/" (A : Double_Uns; B : Single_Uns) return Double_Uns is (A / Double_Uns (B)) with Pre => B /= 0; -- Length doubling division function "&" (Hi, Lo : Single_Uns) return Double_Uns is (Shift_Left (Double_Uns (Hi), Single_Size) or Double_Uns (Lo)); -- Concatenate hi, lo values to form double result function "abs" (X : Double_Int) return Double_Uns is (if X = Double_Int'First then Double_Uns'(2 ** (Double_Size - 1)) else Double_Uns (Double_Int'(abs X))); -- Convert absolute value of X to unsigned. Note that we can't just use -- the expression of the Else since it overflows for X = Double_Int'First. function "rem" (A : Double_Uns; B : Single_Uns) return Double_Uns is (A rem Double_Uns (B)) with Pre => B /= 0; -- Length doubling remainder function Big_2xx (N : Natural) return Big_Integer is (Big (Double_Uns'(2 ** N))) with Ghost, Pre => N < Double_Size, Post => Big_2xx'Result > 0; -- 2**N as a big integer function Big3 (X1, X2, X3 : Single_Uns) return Big_Integer is (Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (X1)) + Big_2xxSingle * Big (Double_Uns (X2)) + Big (Double_Uns (X3))) with Ghost; -- X1&X2&X3 as a big integer function Le3 (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) return Boolean with Post => Le3'Result = (Big3 (X1, X2, X3) <= Big3 (Y1, Y2, Y3)); -- Determines if (3 * Single_Size)-bit value X1&X2&X3 <= Y1&Y2&Y3 function Lo (A : Double_Uns) return Single_Uns is (Single_Uns (A and (2 ** Single_Size - 1))); -- Low order half of double value function Hi (A : Double_Uns) return Single_Uns is (Single_Uns (Shift_Right (A, Single_Size))); -- High order half of double value procedure Sub3 (X1, X2, X3 : in out Single_Uns; Y1, Y2, Y3 : Single_Uns) with Pre => Big3 (X1, X2, X3) >= Big3 (Y1, Y2, Y3), Post => Big3 (X1, X2, X3) = Big3 (X1, X2, X3)'Old - Big3 (Y1, Y2, Y3); -- Computes X1&X2&X3 := X1&X2&X3 - Y1&Y1&Y3 mod 2 ** (3 * Single_Size) function To_Neg_Int (A : Double_Uns) return Double_Int with Annotate => (GNATprove, Terminating), Pre => In_Double_Int_Range (-Big (A)), Post => Big (To_Neg_Int'Result) = -Big (A); -- Convert to negative integer equivalent. If the input is in the range -- 0 .. 2 ** (Double_Size - 1), then the corresponding nonpositive signed -- integer (obtained by negating the given value) is returned, otherwise -- constraint error is raised. function To_Pos_Int (A : Double_Uns) return Double_Int with Annotate => (GNATprove, Terminating), Pre => In_Double_Int_Range (Big (A)), Post => Big (To_Pos_Int'Result) = Big (A); -- Convert to positive integer equivalent. If the input is in the range -- 0 .. 2 ** (Double_Size - 1) - 1, then the corresponding non-negative -- signed integer is returned, otherwise constraint error is raised. procedure Raise_Error; pragma No_Return (Raise_Error); -- Raise constraint error with appropriate message ------------------ -- Local Lemmas -- ------------------ procedure Inline_Le3 (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) with Ghost, Pre => Le3 (X1, X2, X3, Y1, Y2, Y3), Post => Big3 (X1, X2, X3) <= Big3 (Y1, Y2, Y3); procedure Lemma_Abs_Commutation (X : Double_Int) with Ghost, Post => abs (Big (X)) = Big (Double_Uns'(abs X)); procedure Lemma_Abs_Div_Commutation (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => abs (X / Y) = abs X / abs Y; procedure Lemma_Abs_Mult_Commutation (X, Y : Big_Integer) with Ghost, Post => abs (X * Y) = abs X * abs Y; procedure Lemma_Mult_Non_Negative (X, Y : Big_Integer) with Ghost, Pre => (X >= Big_0 and then Y >= Big_0) or else (X <= Big_0 and then Y <= Big_0), Post => X * Y >= Big_0; procedure Lemma_Mult_Non_Positive (X, Y : Big_Integer) with Ghost, Pre => (X <= Big_0 and then Y >= Big_0) or else (X >= Big_0 and then Y <= Big_0), Post => X * Y <= Big_0; procedure Lemma_Abs_Rem_Commutation (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => abs (X rem Y) = (abs X) rem (abs Y); procedure Lemma_Add_Commutation (X : Double_Uns; Y : Single_Uns) with Ghost, Pre => X <= 2 ** Double_Size - 2 ** Single_Size, Post => Big (X) + Big (Double_Uns (Y)) = Big (X + Double_Uns (Y)); procedure Lemma_Add_One (X : Double_Uns) with Ghost, Pre => X /= Double_Uns'Last, Post => Big (X + Double_Uns'(1)) = Big (X) + 1; procedure Lemma_Bounded_Powers_Of_2_Increasing (M, N : Natural) with Ghost, Pre => M < N and then N < Double_Size, Post => Double_Uns'(2)**M < Double_Uns'(2)**N; procedure Lemma_Deep_Mult_Commutation (Factor : Big_Integer; X, Y : Single_Uns) with Ghost, Post => Factor * Big (Double_Uns (X)) * Big (Double_Uns (Y)) = Factor * Big (Double_Uns (X) * Double_Uns (Y)); procedure Lemma_Div_Commutation (X, Y : Double_Uns) with Ghost, Pre => Y /= 0, Post => Big (X) / Big (Y) = Big (X / Y); procedure Lemma_Div_Definition (A : Double_Uns; B : Single_Uns; Q : Double_Uns; R : Double_Uns) with Ghost, Pre => B /= 0 and then Q = A / B and then R = A rem B, Post => Big (A) = Big (Double_Uns (B)) * Big (Q) + Big (R); procedure Lemma_Div_Ge (X, Y, Z : Big_Integer) with Ghost, Pre => Z > 0 and then X >= Y * Z, Post => X / Z >= Y; procedure Lemma_Div_Lt (X, Y, Z : Big_Natural) with Ghost, Pre => Z > 0 and then X < Y * Z, Post => X / Z < Y; procedure Lemma_Div_Eq (A, B, S, R : Big_Integer) with Ghost, Pre => A * S = B * S + R and then S /= 0, Post => A = B + R / S; procedure Lemma_Double_Shift (X : Double_Uns; S, S1 : Double_Uns) with Ghost, Pre => S <= Double_Uns (Double_Size) and then S1 <= Double_Uns (Double_Size), Post => Shift_Left (Shift_Left (X, Natural (S)), Natural (S1)) = Shift_Left (X, Natural (S + S1)); procedure Lemma_Double_Shift (X : Single_Uns; S, S1 : Natural) with Ghost, Pre => S <= Single_Size - S1, Post => Shift_Left (Shift_Left (X, S), S1) = Shift_Left (X, S + S1); procedure Lemma_Double_Shift (X : Double_Uns; S, S1 : Natural) with Ghost, Pre => S <= Double_Size - S1, Post => Shift_Left (Shift_Left (X, S), S1) = Shift_Left (X, S + S1); procedure Lemma_Double_Shift_Right (X : Double_Uns; S, S1 : Double_Uns) with Ghost, Pre => S <= Double_Uns (Double_Size) and then S1 <= Double_Uns (Double_Size), Post => Shift_Right (Shift_Right (X, Natural (S)), Natural (S1)) = Shift_Right (X, Natural (S + S1)); procedure Lemma_Double_Shift_Right (X : Double_Uns; S, S1 : Natural) with Ghost, Pre => S <= Double_Size - S1, Post => Shift_Right (Shift_Right (X, S), S1) = Shift_Right (X, S + S1); procedure Lemma_Ge_Commutation (A, B : Double_Uns) with Ghost, Pre => A >= B, Post => Big (A) >= Big (B); procedure Lemma_Ge_Mult (A, B, C, D : Big_Integer) with Ghost, Pre => A >= B and then B * C >= D and then C > 0, Post => A * C >= D; procedure Lemma_Gt_Commutation (A, B : Double_Uns) with Ghost, Pre => A > B, Post => Big (A) > Big (B); procedure Lemma_Gt_Mult (A, B, C, D : Big_Integer) with Ghost, Pre => A >= B and then B * C > D and then C > 0, Post => A * C > D; procedure Lemma_Hi_Lo (Xu : Double_Uns; Xhi, Xlo : Single_Uns) with Ghost, Pre => Xhi = Hi (Xu) and Xlo = Lo (Xu), Post => Big (Xu) = Big_2xxSingle * Big (Double_Uns (Xhi)) + Big (Double_Uns (Xlo)); procedure Lemma_Hi_Lo_3 (Xu : Double_Uns; Xhi, Xlo : Single_Uns) with Ghost, Pre => Xhi = Hi (Xu) and then Xlo = Lo (Xu), Post => Big (Xu) = Big3 (0, Xhi, Xlo); procedure Lemma_Lo_Is_Ident (X : Double_Uns) with Ghost, Pre => Big (X) < Big_2xxSingle, Post => Double_Uns (Lo (X)) = X; procedure Lemma_Lt_Commutation (A, B : Double_Uns) with Ghost, Pre => A < B, Post => Big (A) < Big (B); procedure Lemma_Lt_Mult (A, B, C, D : Big_Integer) with Ghost, Pre => A < B and then B * C <= D and then C > 0, Post => A * C < D; procedure Lemma_Mult_Commutation (X, Y : Single_Uns) with Ghost, Post => Big (Double_Uns (X)) * Big (Double_Uns (Y)) = Big (Double_Uns (X) * Double_Uns (Y)); procedure Lemma_Mult_Commutation (X, Y : Double_Int) with Ghost, Pre => In_Double_Int_Range (Big (X) * Big (Y)), Post => Big (X) * Big (Y) = Big (X * Y); procedure Lemma_Mult_Commutation (X, Y, Z : Double_Uns) with Ghost, Pre => Big (X) * Big (Y) < Big_2xxDouble and then Z = X * Y, Post => Big (X) * Big (Y) = Big (Z); procedure Lemma_Mult_Decomposition (Mult : Big_Integer; Xu, Yu : Double_Uns; Xhi, Xlo, Yhi, Ylo : Single_Uns) with Ghost, Pre => Mult = Big (Xu) * Big (Yu) and then Xhi = Hi (Xu) and then Xlo = Lo (Xu) and then Yhi = Hi (Yu) and then Ylo = Lo (Yu), Post => Mult = Big_2xxSingle * Big_2xxSingle * (Big (Double_Uns'(Xhi * Yhi))) + Big_2xxSingle * (Big (Double_Uns'(Xhi * Ylo))) + Big_2xxSingle * (Big (Double_Uns'(Xlo * Yhi))) + (Big (Double_Uns'(Xlo * Ylo))); procedure Lemma_Mult_Distribution (X, Y, Z : Big_Integer) with Ghost, Post => X * (Y + Z) = X * Y + X * Z; procedure Lemma_Neg_Div (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => X / Y = (-X) / (-Y); procedure Lemma_Neg_Rem (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => X rem Y = X rem (-Y); procedure Lemma_Not_In_Range_Big2xx64 with Post => not In_Double_Int_Range (Big_2xxDouble) and then not In_Double_Int_Range (-Big_2xxDouble); procedure Lemma_Powers_Of_2 (M, N : Natural) with Ghost, Pre => M < Double_Size and then N < Double_Size and then M + N <= Double_Size, Post => Big_2xx (M) * Big_2xx (N) = (if M + N = Double_Size then Big_2xxDouble else Big_2xx (M + N)); procedure Lemma_Powers_Of_2_Commutation (M : Natural) with Ghost, Subprogram_Variant => (Decreases => M), Pre => M <= Double_Size, Post => Big (Double_Uns'(2))**M = (if M < Double_Size then Big_2xx (M) else Big_2xxDouble); procedure Lemma_Powers_Of_2_Increasing (M, N : Natural) with Ghost, Subprogram_Variant => (Increases => M), Pre => M < N, Post => Big (Double_Uns'(2))**M < Big (Double_Uns'(2))**N; procedure Lemma_Rem_Abs (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => X rem Y = X rem (abs Y); pragma Unreferenced (Lemma_Rem_Abs); procedure Lemma_Rem_Commutation (X, Y : Double_Uns) with Ghost, Pre => Y /= 0, Post => Big (X) rem Big (Y) = Big (X rem Y); procedure Lemma_Rem_Is_Ident (X, Y : Big_Integer) with Ghost, Pre => abs X < abs Y, Post => X rem Y = X; pragma Unreferenced (Lemma_Rem_Is_Ident); procedure Lemma_Rem_Sign (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => Same_Sign (X rem Y, X); pragma Unreferenced (Lemma_Rem_Sign); procedure Lemma_Rev_Div_Definition (A, B, Q, R : Big_Natural) with Ghost, Pre => A = B * Q + R and then R < B, Post => Q = A / B and then R = A rem B; procedure Lemma_Shift_Right (X : Double_Uns; Shift : Natural) with Ghost, Pre => Shift < Double_Size, Post => Big (Shift_Right (X, Shift)) = Big (X) / Big_2xx (Shift); procedure Lemma_Shift_Without_Drop (X, Y : Double_Uns; Mask : Single_Uns; Shift : Natural) with Ghost, Pre => (Hi (X) and Mask) = 0 -- X has the first Shift bits off and then Shift <= Single_Size and then Mask = Shift_Left (Single_Uns'Last, Single_Size - Shift) and then Y = Shift_Left (X, Shift), Post => Big (Y) = Big_2xx (Shift) * Big (X); procedure Lemma_Simplify (X, Y : Big_Integer) with Ghost, Pre => Y /= 0, Post => X * Y / Y = X; procedure Lemma_Substitution (A, B, C, C1, D : Big_Integer) with Ghost, Pre => C = C1 and then A = B * C + D, Post => A = B * C1 + D; procedure Lemma_Subtract_Commutation (X, Y : Double_Uns) with Ghost, Pre => X >= Y, Post => Big (X) - Big (Y) = Big (X - Y); procedure Lemma_Subtract_Double_Uns (X, Y : Double_Int) with Ghost, Pre => X >= 0 and then X <= Y, Post => Double_Uns (Y - X) = Double_Uns (Y) - Double_Uns (X); procedure Lemma_Word_Commutation (X : Single_Uns) with Ghost, Post => Big_2xxSingle * Big (Double_Uns (X)) = Big (2**Single_Size * Double_Uns (X)); ----------------------------- -- Local lemma null bodies -- ----------------------------- procedure Inline_Le3 (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) is null; procedure Lemma_Abs_Commutation (X : Double_Int) is null; procedure Lemma_Abs_Mult_Commutation (X, Y : Big_Integer) is null; procedure Lemma_Add_Commutation (X : Double_Uns; Y : Single_Uns) is null; procedure Lemma_Add_One (X : Double_Uns) is null; procedure Lemma_Bounded_Powers_Of_2_Increasing (M, N : Natural) is null; procedure Lemma_Deep_Mult_Commutation (Factor : Big_Integer; X, Y : Single_Uns) is null; procedure Lemma_Div_Commutation (X, Y : Double_Uns) is null; procedure Lemma_Div_Definition (A : Double_Uns; B : Single_Uns; Q : Double_Uns; R : Double_Uns) is null; procedure Lemma_Div_Ge (X, Y, Z : Big_Integer) is null; procedure Lemma_Div_Lt (X, Y, Z : Big_Natural) is null; procedure Lemma_Div_Eq (A, B, S, R : Big_Integer) is null; procedure Lemma_Double_Shift (X : Double_Uns; S, S1 : Double_Uns) is null; procedure Lemma_Double_Shift (X : Single_Uns; S, S1 : Natural) is null; procedure Lemma_Double_Shift_Right (X : Double_Uns; S, S1 : Double_Uns) is null; procedure Lemma_Ge_Commutation (A, B : Double_Uns) is null; procedure Lemma_Ge_Mult (A, B, C, D : Big_Integer) is null; procedure Lemma_Gt_Commutation (A, B : Double_Uns) is null; procedure Lemma_Gt_Mult (A, B, C, D : Big_Integer) is null; procedure Lemma_Lo_Is_Ident (X : Double_Uns) is null; procedure Lemma_Lt_Commutation (A, B : Double_Uns) is null; procedure Lemma_Lt_Mult (A, B, C, D : Big_Integer) is null; procedure Lemma_Mult_Commutation (X, Y : Single_Uns) is null; procedure Lemma_Mult_Commutation (X, Y : Double_Int) is null; procedure Lemma_Mult_Commutation (X, Y, Z : Double_Uns) is null; procedure Lemma_Mult_Distribution (X, Y, Z : Big_Integer) is null; procedure Lemma_Mult_Non_Negative (X, Y : Big_Integer) is null; procedure Lemma_Mult_Non_Positive (X, Y : Big_Integer) is null; procedure Lemma_Neg_Rem (X, Y : Big_Integer) is null; procedure Lemma_Not_In_Range_Big2xx64 is null; procedure Lemma_Rem_Commutation (X, Y : Double_Uns) is null; procedure Lemma_Rem_Is_Ident (X, Y : Big_Integer) is null; procedure Lemma_Rem_Sign (X, Y : Big_Integer) is null; procedure Lemma_Rev_Div_Definition (A, B, Q, R : Big_Natural) is null; procedure Lemma_Simplify (X, Y : Big_Integer) is null; procedure Lemma_Substitution (A, B, C, C1, D : Big_Integer) is null; procedure Lemma_Subtract_Commutation (X, Y : Double_Uns) is null; procedure Lemma_Subtract_Double_Uns (X, Y : Double_Int) is null; procedure Lemma_Word_Commutation (X : Single_Uns) is null; -------------------------- -- Add_With_Ovflo_Check -- -------------------------- function Add_With_Ovflo_Check (X, Y : Double_Int) return Double_Int is R : constant Double_Int := To_Int (To_Uns (X) + To_Uns (Y)); -- Local lemmas procedure Prove_Negative_X with Ghost, Pre => X < 0 and then (Y > 0 or else R < 0), Post => R = X + Y; procedure Prove_Non_Negative_X with Ghost, Pre => X >= 0 and then (Y < 0 or else R >= 0), Post => R = X + Y; procedure Prove_Overflow_Case with Ghost, Pre => (if X >= 0 then Y >= 0 and then R < 0 else Y <= 0 and then R >= 0), Post => not In_Double_Int_Range (Big (X) + Big (Y)); ---------------------- -- Prove_Negative_X -- ---------------------- procedure Prove_Negative_X is begin if X = Double_Int'First then if Y > 0 then null; else pragma Assert (To_Uns (X) + To_Uns (Y) = 2 ** (Double_Size - 1) - Double_Uns (-Y)); pragma Assert -- as R < 0 (To_Uns (X) + To_Uns (Y) >= 2 ** (Double_Size - 1)); pragma Assert (Y = 0); end if; elsif Y = Double_Int'First then pragma Assert (To_Uns (X) + To_Uns (Y) = 2 ** (Double_Size - 1) - Double_Uns (-X)); pragma Assert (False); elsif Y <= 0 then pragma Assert (To_Uns (X) + To_Uns (Y) = -Double_Uns (-X) - Double_Uns (-Y)); else -- Y > 0, 0 > X > Double_Int'First declare Ru : constant Double_Uns := To_Uns (X) + To_Uns (Y); begin pragma Assert (Ru = -Double_Uns (-X) + Double_Uns (Y)); if Ru < 2 ** (Double_Size - 1) then -- R >= 0 Lemma_Subtract_Double_Uns (-X, Y); pragma Assert (Ru = Double_Uns (X + Y)); elsif Ru = 2 ** (Double_Size - 1) then pragma Assert (Double_Uns (Y) < 2 ** (Double_Size - 1)); pragma Assert (Double_Uns (-X) < 2 ** (Double_Size - 1)); pragma Assert (False); else pragma Assert (R = -Double_Int (-(-Double_Uns (-X) + Double_Uns (Y)))); pragma Assert (R = -Double_Int (-Double_Uns (Y) + Double_Uns (-X))); end if; end; end if; end Prove_Negative_X; -------------------------- -- Prove_Non_Negative_X -- -------------------------- procedure Prove_Non_Negative_X is begin if Y >= 0 or else Y = Double_Int'First then null; else pragma Assert (To_Uns (X) + To_Uns (Y) = Double_Uns (X) - Double_Uns (-Y)); end if; end Prove_Non_Negative_X; ------------------------- -- Prove_Overflow_Case -- ------------------------- procedure Prove_Overflow_Case is begin if X < 0 and then X /= Double_Int'First and then Y /= Double_Int'First then pragma Assert (To_Uns (X) + To_Uns (Y) = -Double_Uns (-X) - Double_Uns (-Y)); end if; end Prove_Overflow_Case; -- Start of processing for Add_With_Ovflo_Check begin if X >= 0 then if Y < 0 or else R >= 0 then Prove_Non_Negative_X; return R; end if; else -- X < 0 if Y > 0 or else R < 0 then Prove_Negative_X; return R; end if; end if; Prove_Overflow_Case; Raise_Error; end Add_With_Ovflo_Check; ------------------- -- Double_Divide -- ------------------- procedure Double_Divide (X, Y, Z : Double_Int; Q, R : out Double_Int; Round : Boolean) is Xu : constant Double_Uns := abs X; Yu : constant Double_Uns := abs Y; Yhi : constant Single_Uns := Hi (Yu); Ylo : constant Single_Uns := Lo (Yu); Zu : constant Double_Uns := abs Z; Zhi : constant Single_Uns := Hi (Zu); Zlo : constant Single_Uns := Lo (Zu); T1, T2 : Double_Uns; Du, Qu, Ru : Double_Uns; Den_Pos : constant Boolean := (Y < 0) = (Z < 0); -- Local ghost variables Mult : constant Big_Integer := abs (Big (Y) * Big (Z)) with Ghost; Quot : Big_Integer with Ghost; Big_R : Big_Integer with Ghost; Big_Q : Big_Integer with Ghost; -- Local lemmas procedure Prove_Overflow_Case with Ghost, Pre => X = Double_Int'First and then Big (Y) * Big (Z) = -1, Post => not In_Double_Int_Range (Big (X) / (Big (Y) * Big (Z))) and then not In_Double_Int_Range (Round_Quotient (Big (X), Big (Y) * Big (Z), Big (X) / (Big (Y) * Big (Z)), Big (X) rem (Big (Y) * Big (Z)))); -- Proves the special case where -2**(Double_Size - 1) is divided by -1, -- generating an overflow. procedure Prove_Quotient_Zero with Ghost, Pre => Mult >= Big_2xxDouble and then not (Mult = Big_2xxDouble and then X = Double_Int'First and then Round) and then Q = 0 and then R = X, Post => Big (R) = Big (X) rem (Big (Y) * Big (Z)) and then (if Round then Big (Q) = Round_Quotient (Big (X), Big (Y) * Big (Z), Big (X) / (Big (Y) * Big (Z)), Big (R)) else Big (Q) = Big (X) / (Big (Y) * Big (Z))); -- Proves the general case where divisor doesn't fit in Double_Uns and -- quotient is 0. procedure Prove_Round_To_One with Ghost, Pre => Mult = Big_2xxDouble and then X = Double_Int'First and then Q = (if Den_Pos then -1 else 1) and then R = X and then Round, Post => Big (R) = Big (X) rem (Big (Y) * Big (Z)) and then Big (Q) = Round_Quotient (Big (X), Big (Y) * Big (Z), Big (X) / (Big (Y) * Big (Z)), Big (R)); -- Proves the special case where the divisor doesn't fit in Double_Uns -- but quotient is still 1 or -1 due to rounding -- (abs (Y*Z) = 2**Double_Size and X = -2**(Double_Size - 1) and Round). procedure Prove_Rounding_Case with Ghost, Pre => Mult /= 0 and then Quot = Big (X) / (Big (Y) * Big (Z)) and then Big_R = Big (X) rem (Big (Y) * Big (Z)) and then Big_Q = Round_Quotient (Big (X), Big (Y) * Big (Z), Quot, Big_R) and then Big (Ru) = abs Big_R and then Big (Du) = Mult and then Big (Qu) = (if Ru > (Du - Double_Uns'(1)) / Double_Uns'(2) then abs Quot + 1 else abs Quot), Post => abs Big_Q = Big (Qu); -- Proves correctness of the rounding of the unsigned quotient procedure Prove_Signs with Ghost, Pre => Mult /= 0 and then Quot = Big (X) / (Big (Y) * Big (Z)) and then Big_R = Big (X) rem (Big (Y) * Big (Z)) and then Big_Q = (if Round then Round_Quotient (Big (X), Big (Y) * Big (Z), Quot, Big_R) else Quot) and then Big (Ru) = abs Big_R and then Big (Qu) = abs Big_Q and then R = (if X >= 0 then To_Int (Ru) else To_Int (-Ru)) and then Q = (if (X >= 0) = Den_Pos then To_Int (Qu) else To_Int (-Qu)) and then not (X = Double_Int'First and then Big (Y) * Big (Z) = -1), Post => Big (R) = Big_R and then Big (Q) = Big_Q; -- Proves final signs match the intended result after the unsigned -- division is done. ----------------------------- -- Local lemma null bodies -- ----------------------------- procedure Prove_Overflow_Case is null; procedure Prove_Quotient_Zero is null; procedure Prove_Round_To_One is null; ------------------------- -- Prove_Rounding_Case -- ------------------------- procedure Prove_Rounding_Case is begin if Same_Sign (Big (X), Big (Y) * Big (Z)) then null; end if; end Prove_Rounding_Case; ----------------- -- Prove_Signs -- ----------------- procedure Prove_Signs is begin if (X >= 0) = Den_Pos then pragma Assert (Quot >= 0); pragma Assert (Big_Q >= 0); pragma Assert (Q >= 0); pragma Assert (Big (Q) = Big_Q); else pragma Assert ((X >= 0) /= (Big (Y) * Big (Z) >= 0)); pragma Assert (Quot <= 0); pragma Assert (Big_Q <= 0); pragma Assert (if X >= 0 then R >= 0); pragma Assert (if X < 0 then R <= 0); pragma Assert (Big (R) = Big_R); end if; end Prove_Signs; -- Start of processing for Double_Divide begin if Yu = 0 or else Zu = 0 then Raise_Error; end if; pragma Assert (Mult /= 0); pragma Assert (Den_Pos = (Big (Y) * Big (Z) > 0)); Quot := Big (X) / (Big (Y) * Big (Z)); Big_R := Big (X) rem (Big (Y) * Big (Z)); if Round then Big_Q := Round_Quotient (Big (X), Big (Y) * Big (Z), Quot, Big_R); else Big_Q := Quot; end if; Lemma_Abs_Mult_Commutation (Big (Y), Big (Z)); Lemma_Mult_Decomposition (Mult, Yu, Zu, Yhi, Ylo, Zhi, Zlo); -- Compute Y * Z. Note that if the result overflows Double_Uns, then -- the rounded result is zero, except for the very special case where -- X = -2 ** (Double_Size - 1) and abs (Y * Z) = 2 ** Double_Size, when -- Round is True. if Yhi /= 0 then if Zhi /= 0 then R := X; -- Handle the special case when Round is True if Yhi = 1 and then Zhi = 1 and then Ylo = 0 and then Zlo = 0 and then X = Double_Int'First and then Round then Q := (if Den_Pos then -1 else 1); Prove_Round_To_One; else Q := 0; pragma Assert (Big (Double_Uns'(Yhi * Zhi)) >= 1); if Yhi > 1 or else Zhi > 1 then pragma Assert (Big (Double_Uns'(Yhi * Zhi)) > 1); elsif Zlo > 0 then pragma Assert (Big (Double_Uns'(Yhi * Zlo)) > 0); elsif Ylo > 0 then pragma Assert (Big (Double_Uns'(Ylo * Zhi)) > 0); end if; Prove_Quotient_Zero; end if; return; else T2 := Yhi * Zlo; end if; else T2 := Ylo * Zhi; end if; T1 := Ylo * Zlo; pragma Assert (Big (T2) = Big (Double_Uns'(Yhi * Zlo)) + Big (Double_Uns'(Ylo * Zhi))); Lemma_Mult_Distribution (Big_2xxSingle, Big (Double_Uns'(Yhi * Zlo)), Big (Double_Uns'(Ylo * Zhi))); pragma Assert (Mult = Big_2xxSingle * Big (T2) + Big (T1)); Lemma_Hi_Lo (T1, Hi (T1), Lo (T1)); pragma Assert (Mult = Big_2xxSingle * Big (T2) + Big_2xxSingle * Big (Double_Uns (Hi (T1))) + Big (Double_Uns (Lo (T1)))); Lemma_Mult_Distribution (Big_2xxSingle, Big (T2), Big (Double_Uns (Hi (T1)))); Lemma_Add_Commutation (T2, Hi (T1)); T2 := T2 + Hi (T1); pragma Assert (Mult = Big_2xxSingle * Big (T2) + Big (Double_Uns (Lo (T1)))); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); Lemma_Mult_Distribution (Big_2xxSingle, Big (Double_Uns (Hi (T2))), Big (Double_Uns (Lo (T2)))); pragma Assert (Mult = Big_2xxDouble * Big (Double_Uns (Hi (T2))) + Big_2xxSingle * Big (Double_Uns (Lo (T2))) + Big (Double_Uns (Lo (T1)))); if Hi (T2) /= 0 then R := X; -- Handle the special case when Round is True if Hi (T2) = 1 and then Lo (T2) = 0 and then Lo (T1) = 0 and then X = Double_Int'First and then Round then Q := (if Den_Pos then -1 else 1); Prove_Round_To_One; else Q := 0; pragma Assert (Big (Double_Uns (Hi (T2))) >= 1); pragma Assert (Big (Double_Uns (Lo (T2))) >= 0); pragma Assert (Big (Double_Uns (Lo (T1))) >= 0); pragma Assert (Mult >= Big_2xxDouble); if Hi (T2) > 1 then pragma Assert (Big (Double_Uns (Hi (T2))) > 1); elsif Lo (T2) > 0 then pragma Assert (Big (Double_Uns (Lo (T2))) > 0); elsif Lo (T1) > 0 then pragma Assert (Double_Uns (Lo (T1)) > 0); Lemma_Gt_Commutation (Double_Uns (Lo (T1)), 0); pragma Assert (Big (Double_Uns (Lo (T1))) > 0); end if; Prove_Quotient_Zero; end if; return; end if; Du := Lo (T2) & Lo (T1); Lemma_Hi_Lo (Du, Lo (T2), Lo (T1)); pragma Assert (Mult = Big (Du)); pragma Assert (Du /= 0); -- Multiplication of 2-limb arguments Yu and Zu leads to 4-limb result -- (where each limb is a single value). Cases where 4 limbs are needed -- require Yhi /= 0 and Zhi /= 0 and lead to early exit. Remaining cases -- where 3 limbs are needed correspond to Hi(T2) /= 0 and lead to early -- exit. Thus, at this point, the result fits in 2 limbs which are -- exactly Lo (T2) and Lo (T1), which corresponds to the value of Du. -- As the case where one of Yu or Zu is null also led to early exit, -- we have Du /= 0 here. -- Check overflow case of largest negative number divided by -1 if X = Double_Int'First and then Du = 1 and then not Den_Pos then Prove_Overflow_Case; Raise_Error; end if; -- Perform the actual division pragma Assert (Du /= 0); -- Multiplication of 2-limb arguments Yu and Zu leads to 4-limb result -- (where each limb is a single value). Cases where 4 limbs are needed -- require Yhi/=0 and Zhi/=0 and lead to early exit. Remaining cases -- where 3 limbs are needed correspond to Hi(T2)/=0 and lead to early -- exit. Thus, at this point, the result fits in 2 limbs which are -- exactly Lo(T2) and Lo(T1), which corresponds to the value of Du. -- As the case where one of Yu or Zu is null also led to early exit, -- we have Du/=0 here. Qu := Xu / Du; Ru := Xu rem Du; Lemma_Div_Commutation (Xu, Du); Lemma_Abs_Div_Commutation (Big (X), Big (Y) * Big (Z)); Lemma_Abs_Commutation (X); pragma Assert (abs Quot = Big (Qu)); Lemma_Rem_Commutation (Xu, Du); Lemma_Abs_Rem_Commutation (Big (X), Big (Y) * Big (Z)); pragma Assert (abs Big_R = Big (Ru)); -- Deal with rounding case if Round then if Ru > (Du - Double_Uns'(1)) / Double_Uns'(2) then Lemma_Add_Commutation (Qu, 1); Qu := Qu + Double_Uns'(1); end if; Prove_Rounding_Case; end if; pragma Assert (abs Big_Q = Big (Qu)); -- Set final signs (RM 4.5.5(27-30)) -- Case of dividend (X) sign positive if X >= 0 then R := To_Int (Ru); Q := (if Den_Pos then To_Int (Qu) else To_Int (-Qu)); -- We perform the unary minus operation on the unsigned value -- before conversion to signed, to avoid a possible overflow -- for value -2 ** (Double_Size - 1), both for computing R and Q. -- Case of dividend (X) sign negative else R := To_Int (-Ru); Q := (if Den_Pos then To_Int (-Qu) else To_Int (Qu)); end if; Prove_Signs; end Double_Divide; --------- -- Le3 -- --------- function Le3 (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) return Boolean is begin if X1 < Y1 then return True; elsif X1 > Y1 then return False; elsif X2 < Y2 then return True; elsif X2 > Y2 then return False; else return X3 <= Y3; end if; end Le3; ------------------------------- -- Lemma_Abs_Div_Commutation -- ------------------------------- procedure Lemma_Abs_Div_Commutation (X, Y : Big_Integer) is begin if Y < 0 then if X < 0 then pragma Assert (abs (X / Y) = abs (X / (-Y))); else Lemma_Neg_Div (X, Y); pragma Assert (abs (X / Y) = abs ((-X) / (-Y))); end if; end if; end Lemma_Abs_Div_Commutation; ------------------------------- -- Lemma_Abs_Rem_Commutation -- ------------------------------- procedure Lemma_Abs_Rem_Commutation (X, Y : Big_Integer) is begin if Y < 0 then Lemma_Neg_Rem (X, Y); if X < 0 then pragma Assert (X rem Y = -((-X) rem (-Y))); pragma Assert (abs (X rem Y) = (abs X) rem (abs Y)); else pragma Assert (abs (X rem Y) = (abs X) rem (abs Y)); end if; end if; end Lemma_Abs_Rem_Commutation; ------------------------ -- Lemma_Double_Shift -- ------------------------ procedure Lemma_Double_Shift (X : Double_Uns; S, S1 : Natural) is begin Lemma_Double_Shift (X, Double_Uns (S), Double_Uns (S1)); pragma Assert (Shift_Left (Shift_Left (X, S), S1) = Shift_Left (Shift_Left (X, S), Natural (Double_Uns (S1)))); pragma Assert (Shift_Left (X, S + S1) = Shift_Left (X, Natural (Double_Uns (S + S1)))); end Lemma_Double_Shift; ------------------------------ -- Lemma_Double_Shift_Right -- ------------------------------ procedure Lemma_Double_Shift_Right (X : Double_Uns; S, S1 : Natural) is begin Lemma_Double_Shift_Right (X, Double_Uns (S), Double_Uns (S1)); pragma Assert (Shift_Right (Shift_Right (X, S), S1) = Shift_Right (Shift_Right (X, S), Natural (Double_Uns (S1)))); pragma Assert (Shift_Right (X, S + S1) = Shift_Right (X, Natural (Double_Uns (S + S1)))); end Lemma_Double_Shift_Right; ----------------- -- Lemma_Hi_Lo -- ----------------- procedure Lemma_Hi_Lo (Xu : Double_Uns; Xhi, Xlo : Single_Uns) is begin pragma Assert (Double_Uns (Xhi) = Xu / Double_Uns'(2 ** Single_Size)); pragma Assert (Double_Uns (Xlo) = Xu mod 2 ** Single_Size); end Lemma_Hi_Lo; ------------------- -- Lemma_Hi_Lo_3 -- ------------------- procedure Lemma_Hi_Lo_3 (Xu : Double_Uns; Xhi, Xlo : Single_Uns) is begin Lemma_Hi_Lo (Xu, Xhi, Xlo); end Lemma_Hi_Lo_3; ------------------------------ -- Lemma_Mult_Decomposition -- ------------------------------ procedure Lemma_Mult_Decomposition (Mult : Big_Integer; Xu, Yu : Double_Uns; Xhi, Xlo, Yhi, Ylo : Single_Uns) is begin Lemma_Hi_Lo (Xu, Xhi, Xlo); Lemma_Hi_Lo (Yu, Yhi, Ylo); pragma Assert (Mult = (Big_2xxSingle * Big (Double_Uns (Xhi)) + Big (Double_Uns (Xlo))) * (Big_2xxSingle * Big (Double_Uns (Yhi)) + Big (Double_Uns (Ylo)))); pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (Xhi)) * Big (Double_Uns (Yhi)) + Big_2xxSingle * Big (Double_Uns (Xhi)) * Big (Double_Uns (Ylo)) + Big_2xxSingle * Big (Double_Uns (Xlo)) * Big (Double_Uns (Yhi)) + Big (Double_Uns (Xlo)) * Big (Double_Uns (Ylo))); Lemma_Deep_Mult_Commutation (Big_2xxSingle * Big_2xxSingle, Xhi, Yhi); Lemma_Deep_Mult_Commutation (Big_2xxSingle, Xhi, Ylo); Lemma_Deep_Mult_Commutation (Big_2xxSingle, Xlo, Yhi); Lemma_Mult_Commutation (Xlo, Ylo); pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns'(Xhi * Yhi)) + Big_2xxSingle * Big (Double_Uns'(Xhi * Ylo)) + Big_2xxSingle * Big (Double_Uns'(Xlo * Yhi)) + Big (Double_Uns'(Xlo * Ylo))); end Lemma_Mult_Decomposition; ------------------- -- Lemma_Neg_Div -- ------------------- procedure Lemma_Neg_Div (X, Y : Big_Integer) is begin pragma Assert ((-X) / (-Y) = -(X / (-Y))); pragma Assert (X / (-Y) = -(X / Y)); end Lemma_Neg_Div; ----------------------- -- Lemma_Powers_Of_2 -- ----------------------- procedure Lemma_Powers_Of_2 (M, N : Natural) is begin if M + N < Double_Size then pragma Assert (Double_Uns'(2**M) * Double_Uns'(2**N) = Double_Uns'(2**(M + N))); end if; Lemma_Powers_Of_2_Commutation (M); Lemma_Powers_Of_2_Commutation (N); Lemma_Powers_Of_2_Commutation (M + N); if M + N < Double_Size then pragma Assert (Big (Double_Uns'(2))**M * Big (Double_Uns'(2))**N = Big (Double_Uns'(2))**(M + N)); Lemma_Powers_Of_2_Increasing (M + N, Double_Size); Lemma_Mult_Commutation (2 ** M, 2 ** N, 2 ** (M + N)); else pragma Assert (Big (Double_Uns'(2))**M * Big (Double_Uns'(2))**N = Big (Double_Uns'(2))**(M + N)); end if; end Lemma_Powers_Of_2; ----------------------------------- -- Lemma_Powers_Of_2_Commutation -- ----------------------------------- procedure Lemma_Powers_Of_2_Commutation (M : Natural) is begin if M > 0 then Lemma_Powers_Of_2_Commutation (M - 1); pragma Assert (Big (Double_Uns'(2))**(M - 1) = Big_2xx (M - 1)); pragma Assert (Big (Double_Uns'(2))**M = Big_2xx (M - 1) * 2); if M < Double_Size then Lemma_Powers_Of_2_Increasing (M - 1, Double_Size - 1); Lemma_Bounded_Powers_Of_2_Increasing (M - 1, Double_Size - 1); pragma Assert (Double_Uns'(2 ** (M - 1)) * 2 = Double_Uns'(2**M)); Lemma_Mult_Commutation (Double_Uns'(2 ** (M - 1)), 2, Double_Uns'(2**M)); pragma Assert (Big (Double_Uns'(2))**M = Big_2xx (M)); end if; end if; end Lemma_Powers_Of_2_Commutation; ---------------------------------- -- Lemma_Powers_Of_2_Increasing -- ---------------------------------- procedure Lemma_Powers_Of_2_Increasing (M, N : Natural) is begin if M + 1 < N then Lemma_Powers_Of_2_Increasing (M + 1, N); end if; end Lemma_Powers_Of_2_Increasing; ------------------- -- Lemma_Rem_Abs -- ------------------- procedure Lemma_Rem_Abs (X, Y : Big_Integer) is begin Lemma_Neg_Rem (X, Y); end Lemma_Rem_Abs; ----------------------- -- Lemma_Shift_Right -- ----------------------- procedure Lemma_Shift_Right (X : Double_Uns; Shift : Natural) is XX : Double_Uns := X; begin for J in 1 .. Shift loop XX := Shift_Right (XX, 1); Lemma_Double_Shift_Right (X, J - 1, 1); pragma Loop_Invariant (XX = Shift_Right (X, J)); pragma Loop_Invariant (XX = X / Double_Uns'(2) ** J); end loop; end Lemma_Shift_Right; ------------------------------ -- Lemma_Shift_Without_Drop -- ------------------------------ procedure Lemma_Shift_Without_Drop (X, Y : Double_Uns; Mask : Single_Uns; Shift : Natural) is pragma Unreferenced (Mask); procedure Lemma_Bound with Pre => Shift <= Single_Size and then X <= 2**Single_Size * Double_Uns'(2**(Single_Size - Shift) - 1) + Single_Uns'(2**Single_Size - 1), Post => X <= 2**(Double_Size - Shift) - 1; procedure Lemma_Exp_Pos (N : Integer) with Pre => N in 0 .. Double_Size - 1, Post => Double_Uns'(2**N) > 0; ----------------------------- -- Local lemma null bodies -- ----------------------------- procedure Lemma_Bound is null; procedure Lemma_Exp_Pos (N : Integer) is null; -- Start of processing for Lemma_Shift_Without_Drop begin if Shift = 0 then pragma Assert (Big (Y) = Big_2xx (Shift) * Big (X)); return; end if; Lemma_Bound; Lemma_Exp_Pos (Double_Size - Shift); pragma Assert (X < 2**(Double_Size - Shift)); pragma Assert (Big (X) < Big_2xx (Double_Size - Shift)); pragma Assert (Y = 2**Shift * X); pragma Assert (Big_2xx (Shift) * Big (X) < Big_2xx (Shift) * Big_2xx (Double_Size - Shift)); Lemma_Powers_Of_2 (Shift, Double_Size - Shift); Lemma_Mult_Commutation (2**Shift, X, Y); pragma Assert (Big (Y) = Big_2xx (Shift) * Big (X)); end Lemma_Shift_Without_Drop; ------------------------------- -- Multiply_With_Ovflo_Check -- ------------------------------- function Multiply_With_Ovflo_Check (X, Y : Double_Int) return Double_Int is Xu : constant Double_Uns := abs X; Xhi : constant Single_Uns := Hi (Xu); Xlo : constant Single_Uns := Lo (Xu); Yu : constant Double_Uns := abs Y; Yhi : constant Single_Uns := Hi (Yu); Ylo : constant Single_Uns := Lo (Yu); T1, T2 : Double_Uns; -- Local ghost variables Mult : constant Big_Integer := abs (Big (X) * Big (Y)) with Ghost; -- Local lemmas procedure Prove_Both_Too_Large with Ghost, Pre => Xhi /= 0 and then Yhi /= 0 and then Mult = Big_2xxSingle * Big_2xxSingle * (Big (Double_Uns'(Xhi * Yhi))) + Big_2xxSingle * (Big (Double_Uns'(Xhi * Ylo))) + Big_2xxSingle * (Big (Double_Uns'(Xlo * Yhi))) + (Big (Double_Uns'(Xlo * Ylo))), Post => not In_Double_Int_Range (Big (X) * Big (Y)); procedure Prove_Final_Decomposition with Ghost, Pre => In_Double_Int_Range (Big (X) * Big (Y)) and then Mult = Big_2xxSingle * Big (T2) + Big (Double_Uns (Lo (T1))) and then Hi (T2) = 0, Post => Mult = Big (Lo (T2) & Lo (T1)); procedure Prove_Neg_Int with Ghost, Pre => In_Double_Int_Range (Big (X) * Big (Y)) and then Mult = Big (T2) and then ((X >= 0 and then Y < 0) or else (X < 0 and then Y >= 0)), Post => To_Neg_Int (T2) = X * Y; procedure Prove_Pos_Int with Ghost, Pre => In_Double_Int_Range (Big (X) * Big (Y)) and then Mult = Big (T2) and then ((X >= 0 and then Y >= 0) or else (X < 0 and then Y < 0)), Post => In_Double_Int_Range (Big (T2)) and then To_Pos_Int (T2) = X * Y; procedure Prove_Result_Too_Large with Ghost, Pre => Mult = Big_2xxSingle * Big (T2) + Big (Double_Uns (Lo (T1))) and then Hi (T2) /= 0, Post => not In_Double_Int_Range (Big (X) * Big (Y)); procedure Prove_Too_Large with Ghost, Pre => abs (Big (X) * Big (Y)) >= Big_2xxDouble, Post => not In_Double_Int_Range (Big (X) * Big (Y)); -------------------------- -- Prove_Both_Too_Large -- -------------------------- procedure Prove_Both_Too_Large is begin pragma Assert (Mult >= Big_2xxSingle * Big_2xxSingle * Big (Double_Uns'(Xhi * Yhi))); pragma Assert (Double_Uns (Xhi) * Double_Uns (Yhi) >= 1); pragma Assert (Mult >= Big_2xxSingle * Big_2xxSingle); Prove_Too_Large; end Prove_Both_Too_Large; ------------------------------- -- Prove_Final_Decomposition -- ------------------------------- procedure Prove_Final_Decomposition is begin Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); pragma Assert (Mult = Big_2xxSingle * Big (Double_Uns (Lo (T2))) + Big (Double_Uns (Lo (T1)))); pragma Assert (Mult <= Big_2xxDouble_Minus_1); Lemma_Mult_Commutation (X, Y); pragma Assert (Mult = abs (Big (X * Y))); Lemma_Word_Commutation (Lo (T2)); pragma Assert (Mult = Big (Double_Uns'(2 ** Single_Size) * Double_Uns (Lo (T2))) + Big (Double_Uns (Lo (T1)))); Lemma_Add_Commutation (Double_Uns'(2 ** Single_Size) * Double_Uns (Lo (T2)), Lo (T1)); pragma Assert (Mult = Big (Double_Uns'(2 ** Single_Size) * Double_Uns (Lo (T2)) + Lo (T1))); pragma Assert (Lo (T2) & Lo (T1) = Double_Uns'(2 ** Single_Size) * Double_Uns (Lo (T2)) + Lo (T1)); end Prove_Final_Decomposition; ------------------- -- Prove_Neg_Int -- ------------------- procedure Prove_Neg_Int is begin pragma Assert (X * Y <= 0); pragma Assert (Mult = -Big (X * Y)); end Prove_Neg_Int; ------------------- -- Prove_Pos_Int -- ------------------- procedure Prove_Pos_Int is begin pragma Assert (X * Y >= 0); pragma Assert (Mult = Big (X * Y)); end Prove_Pos_Int; ---------------------------- -- Prove_Result_Too_Large -- ---------------------------- procedure Prove_Result_Too_Large is begin pragma Assert (Mult >= Big_2xxSingle * Big (T2)); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); pragma Assert (Mult >= Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (Hi (T2)))); pragma Assert (Double_Uns (Hi (T2)) >= 1); pragma Assert (Mult >= Big_2xxSingle * Big_2xxSingle); Prove_Too_Large; end Prove_Result_Too_Large; --------------------- -- Prove_Too_Large -- --------------------- procedure Prove_Too_Large is null; -- Start of processing for Multiply_With_Ovflo_Check begin Lemma_Mult_Decomposition (Mult, Xu, Yu, Xhi, Xlo, Yhi, Ylo); if Xhi /= 0 then if Yhi /= 0 then Prove_Both_Too_Large; Raise_Error; else T2 := Xhi * Ylo; end if; elsif Yhi /= 0 then T2 := Xlo * Yhi; else -- Yhi = Xhi = 0 T2 := 0; end if; -- Here we have T2 set to the contribution to the upper half of the -- result from the upper halves of the input values. T1 := Xlo * Ylo; pragma Assert (Big (T2) = Big (Double_Uns'(Xhi * Ylo)) + Big (Double_Uns'(Xlo * Yhi))); Lemma_Mult_Distribution (Big_2xxSingle, Big (Double_Uns'(Xhi * Ylo)), Big (Double_Uns'(Xlo * Yhi))); pragma Assert (Mult = Big_2xxSingle * Big (T2) + Big (T1)); Lemma_Add_Commutation (T2, Hi (T1)); pragma Assert (Big (T2 + Hi (T1)) = Big (T2) + Big (Double_Uns (Hi (T1)))); T2 := T2 + Hi (T1); Lemma_Hi_Lo (T1, Hi (T1), Lo (T1)); pragma Assert (Mult = Big_2xxSingle * Big (T2) + Big (Double_Uns (Lo (T1)))); if Hi (T2) /= 0 then Prove_Result_Too_Large; Raise_Error; end if; Prove_Final_Decomposition; T2 := Lo (T2) & Lo (T1); pragma Assert (Mult = Big (T2)); if X >= 0 then if Y >= 0 then Prove_Pos_Int; return To_Pos_Int (T2); pragma Annotate (CodePeer, Intentional, "precondition", "Intentional Unsigned->Signed conversion"); else Prove_Neg_Int; return To_Neg_Int (T2); end if; else -- X < 0 if Y < 0 then Prove_Pos_Int; return To_Pos_Int (T2); pragma Annotate (CodePeer, Intentional, "precondition", "Intentional Unsigned->Signed conversion"); else Prove_Neg_Int; return To_Neg_Int (T2); end if; end if; end Multiply_With_Ovflo_Check; ----------------- -- Raise_Error -- ----------------- procedure Raise_Error is begin raise Constraint_Error with "Double arithmetic overflow"; pragma Annotate (GNATprove, Intentional, "exception might be raised", "Procedure Raise_Error is called to signal input errors"); end Raise_Error; ------------------- -- Scaled_Divide -- ------------------- procedure Scaled_Divide (X, Y, Z : Double_Int; Q, R : out Double_Int; Round : Boolean) is Xu : constant Double_Uns := abs X; Xhi : constant Single_Uns := Hi (Xu); Xlo : constant Single_Uns := Lo (Xu); Yu : constant Double_Uns := abs Y; Yhi : constant Single_Uns := Hi (Yu); Ylo : constant Single_Uns := Lo (Yu); Zu : Double_Uns := abs Z; Zhi : Single_Uns := Hi (Zu); Zlo : Single_Uns := Lo (Zu); D : array (1 .. 4) of Single_Uns with Relaxed_Initialization; -- The dividend, four digits (D(1) is high order) Qd : array (1 .. 2) of Single_Uns with Relaxed_Initialization; -- The quotient digits, two digits (Qd(1) is high order) S1, S2, S3 : Single_Uns; -- Value to subtract, three digits (S1 is high order) Qu : Double_Uns; Ru : Double_Uns; -- Unsigned quotient and remainder Mask : Single_Uns; -- Mask of bits used to compute the scaling factor below Scale : Natural; -- Scaling factor used for multiple-precision divide. Dividend and -- Divisor are multiplied by 2 ** Scale, and the final remainder is -- divided by the scaling factor. The reason for this scaling is to -- allow more accurate estimation of quotient digits. Shift : Natural; -- Shift factor used to compute the scaling factor above T1, T2, T3 : Double_Uns; -- Temporary values -- Local ghost variables Mult : constant Big_Integer := abs (Big (X) * Big (Y)) with Ghost; Quot : Big_Integer with Ghost; Big_R : Big_Integer with Ghost; Big_Q : Big_Integer with Ghost; Inter : Natural with Ghost; -- Local lemmas procedure Prove_Dividend_Scaling with Ghost, Pre => D'Initialized and then Scale <= Single_Size and then Mult = Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4))) and then Big (D (1) & D (2)) * Big_2xx (Scale) < Big_2xxDouble and then T1 = Shift_Left (D (1) & D (2), Scale) and then T2 = Shift_Left (Double_Uns (D (3)), Scale) and then T3 = Shift_Left (Double_Uns (D (4)), Scale), Post => Mult * Big_2xx (Scale) = Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (Hi (T1))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (Lo (T1) or Hi (T2))) + Big_2xxSingle * Big (Double_Uns (Lo (T2) or Hi (T3))) + Big (Double_Uns (Lo (T3))); -- Proves the scaling of the 4-digit dividend actually multiplies it by -- 2**Scale. procedure Prove_Multiplication (Q : Single_Uns) with Ghost, Pre => T1 = Q * Lo (Zu) and then T2 = Q * Hi (Zu) and then S3 = Lo (T1) and then T3 = Hi (T1) + Lo (T2) and then S2 = Lo (T3) and then S1 = Hi (T3) + Hi (T2), Post => Big3 (S1, S2, S3) = Big (Double_Uns (Q)) * Big (Zu); -- Proves correctness of the multiplication of divisor by quotient to -- compute amount to subtract. procedure Prove_Negative_Dividend with Ghost, Pre => Z /= 0 and then Big (Qu) = abs Big_Q and then In_Double_Int_Range (Big_Q) and then Big (Ru) = abs Big_R and then ((X >= 0 and Y < 0) or (X < 0 and Y >= 0)) and then Big_Q = (if Round then Round_Quotient (Big (X) * Big (Y), Big (Z), Big (X) * Big (Y) / Big (Z), Big (X) * Big (Y) rem Big (Z)) else Big (X) * Big (Y) / Big (Z)) and then Big_R = Big (X) * Big (Y) rem Big (Z), Post => (if Z > 0 then Big_Q <= Big_0 and then In_Double_Int_Range (-Big (Qu)) else Big_Q >= Big_0 and then In_Double_Int_Range (Big (Qu))) and then In_Double_Int_Range (-Big (Ru)); -- Proves the sign of rounded quotient when dividend is non-positive procedure Prove_Overflow with Ghost, Pre => Z /= 0 and then Mult >= Big_2xxDouble * Big (Double_Uns'(abs Z)), Post => not In_Double_Int_Range (Big (X) * Big (Y) / Big (Z)) and then not In_Double_Int_Range (Round_Quotient (Big (X) * Big (Y), Big (Z), Big (X) * Big (Y) / Big (Z), Big (X) * Big (Y) rem Big (Z))); -- Proves overflow case when the quotient has at least 3 digits procedure Prove_Positive_Dividend with Ghost, Pre => Z /= 0 and then Big (Qu) = abs Big_Q and then In_Double_Int_Range (Big_Q) and then Big (Ru) = abs Big_R and then ((X >= 0 and Y >= 0) or (X < 0 and Y < 0)) and then Big_Q = (if Round then Round_Quotient (Big (X) * Big (Y), Big (Z), Big (X) * Big (Y) / Big (Z), Big (X) * Big (Y) rem Big (Z)) else Big (X) * Big (Y) / Big (Z)) and then Big_R = Big (X) * Big (Y) rem Big (Z), Post => (if Z > 0 then Big_Q >= Big_0 and then In_Double_Int_Range (Big (Qu)) else Big_Q <= Big_0 and then In_Double_Int_Range (-Big (Qu))) and then In_Double_Int_Range (Big (Ru)); -- Proves the sign of rounded quotient when dividend is non-negative procedure Prove_Qd_Calculation_Part_1 (J : Integer) with Ghost, Pre => J in 1 .. 2 and then D'Initialized and then D (J) < Zhi and then Hi (Zu) = Zhi and then Qd (J)'Initialized and then Qd (J) = Lo ((D (J) & D (J + 1)) / Zhi), Post => Big (Double_Uns (Qd (J))) >= Big3 (D (J), D (J + 1), D (J + 2)) / Big (Zu); -- When dividing 3 digits by 2 digits, proves the initial calculation -- of the quotient given by dividing the first 2 digits of the dividend -- by the first digit of the divisor is not an underestimate (so -- readjusting down works). procedure Prove_Q_Too_Big with Ghost, Pre => In_Double_Int_Range (Big_Q) and then abs Big_Q = Big_2xxDouble, Post => False; -- Proves the inconsistency when Q is equal to Big_2xx64 procedure Prove_Rescaling with Ghost, Pre => Scale <= Single_Size and then Z /= 0 and then Mult * Big_2xx (Scale) = Big (Zu) * Big (Qu) + Big (Ru) and then Big (Ru) < Big (Zu) and then Big (Zu) = Big (Double_Uns'(abs Z)) * Big_2xx (Scale) and then Quot = Big (X) * Big (Y) / Big (Z) and then Big_R = Big (X) * Big (Y) rem Big (Z), Post => abs Quot = Big (Qu) and then abs Big_R = Big (Shift_Right (Ru, Scale)); -- Proves scaling back only the remainder is the right thing to do after -- computing the scaled division. procedure Prove_Rounding_Case with Ghost, Pre => Z /= 0 and then Quot = Big (X) * Big (Y) / Big (Z) and then Big_R = Big (X) * Big (Y) rem Big (Z) and then Big_Q = Round_Quotient (Big (X) * Big (Y), Big (Z), Quot, Big_R) and then Big (Ru) = abs Big_R and then Big (Zu) = Big (Double_Uns'(abs Z)), Post => abs Big_Q = (if Ru > (Zu - Double_Uns'(1)) / Double_Uns'(2) then abs Quot + 1 else abs Quot); -- Proves correctness of the rounding of the unsigned quotient procedure Prove_Sign_R with Ghost, Pre => Z /= 0 and then Big_R = Big (X) * Big (Y) rem Big (Z), Post => In_Double_Int_Range (Big_R); procedure Prove_Signs with Ghost, Pre => Z /= 0 and then Quot = Big (X) * Big (Y) / Big (Z) and then Big_R = Big (X) * Big (Y) rem Big (Z) and then Big_Q = (if Round then Round_Quotient (Big (X) * Big (Y), Big (Z), Quot, Big_R) else Quot) and then Big (Ru) = abs Big_R and then Big (Qu) = abs Big_Q and then In_Double_Int_Range (Big_Q) and then In_Double_Int_Range (Big_R) and then R = (if (X >= 0) = (Y >= 0) then To_Pos_Int (Ru) else To_Neg_Int (Ru)) and then Q = (if ((X >= 0) = (Y >= 0)) = (Z >= 0) then To_Pos_Int (Qu) else To_Neg_Int (Qu)), -- need to ensure To_Pos_Int precondition Post => Big (R) = Big_R and then Big (Q) = Big_Q; -- Proves final signs match the intended result after the unsigned -- division is done. procedure Prove_Z_Low with Ghost, Pre => Z /= 0 and then D'Initialized and then Hi (abs Z) = 0 and then Lo (abs Z) = Zlo and then Mult = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4))) and then D (2) < Zlo and then Quot = (Big (X) * Big (Y)) / Big (Z) and then Big_R = (Big (X) * Big (Y)) rem Big (Z) and then T1 = D (2) & D (3) and then T2 = Lo (T1 rem Zlo) & D (4) and then Qu = Lo (T1 / Zlo) & Lo (T2 / Zlo) and then Ru = T2 rem Zlo, Post => Big (Qu) = abs Quot and then Big (Ru) = abs Big_R; -- Proves the case where the divisor is only one digit ---------------------------- -- Prove_Dividend_Scaling -- ---------------------------- procedure Prove_Dividend_Scaling is begin Lemma_Hi_Lo (D (1) & D (2), D (1), D (2)); pragma Assert (Mult * Big_2xx (Scale) = Big_2xxSingle * Big_2xxSingle * Big_2xx (Scale) * Big (D (1) & D (2)) + Big_2xxSingle * Big_2xx (Scale) * Big (Double_Uns (D (3))) + Big_2xx (Scale) * Big (Double_Uns (D (4)))); pragma Assert (Big_2xx (Scale) > 0); Lemma_Lt_Mult (Big (Double_Uns (D (3))), Big_2xxSingle, Big_2xx (Scale), Big_2xxDouble); Lemma_Lt_Mult (Big (Double_Uns (D (4))), Big_2xxSingle, Big_2xx (Scale), Big_2xxDouble); Lemma_Mult_Commutation (2 ** Scale, D (1) & D (2), T1); declare Big_D12 : constant Big_Integer := Big_2xx (Scale) * Big (D (1) & D (2)); Big_T1 : constant Big_Integer := Big (T1); begin pragma Assert (Big_D12 = Big_T1); pragma Assert (Big_2xxSingle * Big_2xxSingle * Big_D12 = Big_2xxSingle * Big_2xxSingle * Big_T1); end; Lemma_Mult_Commutation (2 ** Scale, Double_Uns (D (3)), T2); declare Big_D3 : constant Big_Integer := Big_2xx (Scale) * Big (Double_Uns (D (3))); Big_T2 : constant Big_Integer := Big (T2); begin pragma Assert (Big_D3 = Big_T2); pragma Assert (Big_2xxSingle * Big_D3 = Big_2xxSingle * Big_T2); end; Lemma_Mult_Commutation (2 ** Scale, Double_Uns (D (4)), T3); declare Big_D4 : constant Big_Integer := Big_2xx (Scale) * Big (Double_Uns (D (4))); Big_T3 : constant Big_Integer := Big (T3); begin pragma Assert (Big_D4 = Big_T3); end; pragma Assert (Mult * Big_2xx (Scale) = Big_2xxSingle * Big_2xxSingle * Big (T1) + Big_2xxSingle * Big (T2) + Big (T3)); Lemma_Hi_Lo (T1, Hi (T1), Lo (T1)); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); Lemma_Hi_Lo (T3, Hi (T3), Lo (T3)); pragma Assert (Double_Uns (Lo (T1) or Hi (T2)) = Double_Uns (Lo (T1)) + Double_Uns (Hi (T2))); pragma Assert (Double_Uns (Lo (T2) or Hi (T3)) = Double_Uns (Lo (T2)) + Double_Uns (Hi (T3))); end Prove_Dividend_Scaling; -------------------------- -- Prove_Multiplication -- -------------------------- procedure Prove_Multiplication (Q : Single_Uns) is begin Lemma_Hi_Lo (Zu, Hi (Zu), Lo (Zu)); Lemma_Hi_Lo (T1, Hi (T1), S3); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); Lemma_Hi_Lo (T3, Hi (T3), S2); Lemma_Mult_Commutation (Double_Uns (Q), Double_Uns (Lo (Zu)), T1); Lemma_Mult_Commutation (Double_Uns (Q), Double_Uns (Hi (Zu)), T2); pragma Assert (Big (Double_Uns (Q)) * Big (Zu) = Big_2xxSingle * Big (T2) + Big (T1)); pragma Assert (Big (Double_Uns (Q)) * Big (Zu) = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (Hi (T2))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (Hi (T3))) + Big_2xxSingle * Big (Double_Uns (S2)) + Big (Double_Uns (S3))); pragma Assert (Double_Uns (Hi (T3)) + Hi (T2) = Double_Uns (S1)); Lemma_Add_Commutation (Double_Uns (Hi (T3)), Hi (T2)); pragma Assert (Big (Double_Uns (Hi (T3))) + Big (Double_Uns (Hi (T2))) = Big (Double_Uns (S1))); end Prove_Multiplication; ----------------------------- -- Prove_Negative_Dividend -- ----------------------------- procedure Prove_Negative_Dividend is begin Lemma_Mult_Non_Positive (Big (X), Big (Y)); end Prove_Negative_Dividend; -------------------- -- Prove_Overflow -- -------------------- procedure Prove_Overflow is begin Lemma_Div_Ge (Mult, Big_2xxDouble, Big (Double_Uns'(abs Z))); Lemma_Abs_Commutation (Z); Lemma_Abs_Div_Commutation (Big (X) * Big (Y), Big (Z)); end Prove_Overflow; ----------------------------- -- Prove_Positive_Dividend -- ----------------------------- procedure Prove_Positive_Dividend is begin Lemma_Mult_Non_Negative (Big (X), Big (Y)); end Prove_Positive_Dividend; --------------------------------- -- Prove_Qd_Calculation_Part_1 -- --------------------------------- procedure Prove_Qd_Calculation_Part_1 (J : Integer) is begin Lemma_Hi_Lo (D (J) & D (J + 1), D (J), D (J + 1)); Lemma_Lt_Commutation (Double_Uns (D (J)), Double_Uns (Zhi)); Lemma_Gt_Mult (Big (Double_Uns (Zhi)), Big (Double_Uns (D (J))) + 1, Big_2xxSingle, Big (D (J) & D (J + 1))); Lemma_Div_Lt (Big (D (J) & D (J + 1)), Big_2xxSingle, Big (Double_Uns (Zhi))); Lemma_Div_Commutation (D (J) & D (J + 1), Double_Uns (Zhi)); Lemma_Lo_Is_Ident ((D (J) & D (J + 1)) / Zhi); Lemma_Div_Definition (D (J) & D (J + 1), Zhi, Double_Uns (Qd (J)), (D (J) & D (J + 1)) rem Zhi); Lemma_Lt_Commutation ((D (J) & D (J + 1)) rem Zhi, Double_Uns (Zhi)); Lemma_Gt_Mult ((Big (Double_Uns (Qd (J))) + 1) * Big (Double_Uns (Zhi)), Big (D (J) & D (J + 1)) + 1, Big_2xxSingle, Big3 (D (J), D (J + 1), D (J + 2))); Lemma_Hi_Lo (Zu, Zhi, Lo (Zu)); Lemma_Gt_Mult (Big (Zu), Big_2xxSingle * Big (Double_Uns (Zhi)), Big (Double_Uns (Qd (J))) + 1, Big3 (D (J), D (J + 1), D (J + 2))); Lemma_Div_Lt (Big3 (D (J), D (J + 1), D (J + 2)), Big (Double_Uns (Qd (J))) + 1, Big (Zu)); end Prove_Qd_Calculation_Part_1; --------------------- -- Prove_Q_Too_Big -- --------------------- procedure Prove_Q_Too_Big is begin pragma Assert (Big_Q = Big_2xxDouble or Big_Q = -Big_2xxDouble); Lemma_Not_In_Range_Big2xx64; end Prove_Q_Too_Big; --------------------- -- Prove_Rescaling -- --------------------- procedure Prove_Rescaling is begin Lemma_Div_Lt (Big (Ru), Big (Double_Uns'(abs Z)), Big_2xx (Scale)); Lemma_Div_Eq (Mult, Big (Double_Uns'(abs Z)) * Big (Qu), Big_2xx (Scale), Big (Ru)); Lemma_Rev_Div_Definition (Mult, Big (Double_Uns'(abs Z)), Big (Qu), Big (Ru) / Big_2xx (Scale)); Lemma_Abs_Div_Commutation (Big (X) * Big (Y), Big (Z)); Lemma_Abs_Rem_Commutation (Big (X) * Big (Y), Big (Z)); Lemma_Abs_Commutation (Z); Lemma_Shift_Right (Ru, Scale); end Prove_Rescaling; ------------------------- -- Prove_Rounding_Case -- ------------------------- procedure Prove_Rounding_Case is begin if Same_Sign (Big (X) * Big (Y), Big (Z)) then null; end if; end Prove_Rounding_Case; ------------------ -- Prove_Sign_R -- ------------------ procedure Prove_Sign_R is begin pragma Assert (In_Double_Int_Range (Big (Z))); end Prove_Sign_R; ----------------- -- Prove_Signs -- ----------------- procedure Prove_Signs is null; ----------------- -- Prove_Z_Low -- ----------------- procedure Prove_Z_Low is begin Lemma_Hi_Lo (T1, D (2), D (3)); Lemma_Add_Commutation (Double_Uns (D (2)), 1); pragma Assert (Big (Double_Uns (D (2))) + 1 <= Big (Double_Uns (Zlo))); Lemma_Div_Definition (T1, Zlo, T1 / Zlo, T1 rem Zlo); pragma Assert (Double_Uns (Lo (T1 rem Zlo)) = T1 rem Zlo); Lemma_Hi_Lo (T2, Lo (T1 rem Zlo), D (4)); pragma Assert (T1 rem Zlo + Double_Uns'(1) <= Double_Uns (Zlo)); Lemma_Add_Commutation (T1 rem Zlo, 1); pragma Assert (Big (T1 rem Zlo) + 1 <= Big (Double_Uns (Zlo))); Lemma_Div_Definition (T2, Zlo, T2 / Zlo, Ru); pragma Assert (Mult = Big (Double_Uns (Zlo)) * (Big_2xxSingle * Big (T1 / Zlo) + Big (T2 / Zlo)) + Big (Ru)); Lemma_Div_Lt (Big (T1), Big_2xxSingle, Big (Double_Uns (Zlo))); Lemma_Div_Commutation (T1, Double_Uns (Zlo)); Lemma_Lo_Is_Ident (T1 / Zlo); Lemma_Div_Lt (Big (T2), Big_2xxSingle, Big (Double_Uns (Zlo))); Lemma_Div_Commutation (T2, Double_Uns (Zlo)); Lemma_Lo_Is_Ident (T2 / Zlo); Lemma_Hi_Lo (Qu, Lo (T1 / Zlo), Lo (T2 / Zlo)); Lemma_Substitution (Mult, Big (Double_Uns (Zlo)), Big_2xxSingle * Big (T1 / Zlo) + Big (T2 / Zlo), Big (Qu), Big (Ru)); Lemma_Lt_Commutation (Ru, Double_Uns (Zlo)); Lemma_Rev_Div_Definition (Mult, Big (Double_Uns (Zlo)), Big (Qu), Big (Ru)); pragma Assert (Double_Uns (Zlo) = abs Z); Lemma_Abs_Commutation (Z); Lemma_Abs_Div_Commutation (Big (X) * Big (Y), Big (Z)); Lemma_Abs_Rem_Commutation (Big (X) * Big (Y), Big (Z)); end Prove_Z_Low; -- Start of processing for Scaled_Divide begin if Z = 0 then Raise_Error; end if; Quot := Big (X) * Big (Y) / Big (Z); Big_R := Big (X) * Big (Y) rem Big (Z); if Round then Big_Q := Round_Quotient (Big (X) * Big (Y), Big (Z), Quot, Big_R); else Big_Q := Quot; end if; -- First do the multiplication, giving the four digit dividend Lemma_Abs_Mult_Commutation (Big (X), Big (Y)); Lemma_Abs_Commutation (X); Lemma_Abs_Commutation (Y); Lemma_Mult_Decomposition (Mult, Xu, Yu, Xhi, Xlo, Yhi, Ylo); T1 := Xlo * Ylo; D (4) := Lo (T1); D (3) := Hi (T1); Lemma_Hi_Lo (T1, D (3), D (4)); if Yhi /= 0 then T1 := Xlo * Yhi; Lemma_Hi_Lo (T1, Hi (T1), Lo (T1)); T2 := D (3) + Lo (T1); Lemma_Mult_Distribution (Big_2xxSingle, Big (Double_Uns (D (3))), Big (Double_Uns (Lo (T1)))); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); D (3) := Lo (T2); D (2) := Hi (T1) + Hi (T2); pragma Assert (Double_Uns (Hi (T1)) + Hi (T2) = Double_Uns (D (2))); Lemma_Add_Commutation (Double_Uns (Hi (T1)), Hi (T2)); pragma Assert (Big (Double_Uns (Hi (T1))) + Big (Double_Uns (Hi (T2))) = Big (Double_Uns (D (2)))); if Xhi /= 0 then T1 := Xhi * Ylo; Lemma_Hi_Lo (T1, Hi (T1), Lo (T1)); T2 := D (3) + Lo (T1); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); D (3) := Lo (T2); T3 := D (2) + Hi (T1); Lemma_Add_Commutation (T3, Hi (T2)); T3 := T3 + Hi (T2); T2 := Double_Uns'(Xhi * Yhi); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); Lemma_Add_Commutation (T3, Lo (T2)); T1 := T3 + Lo (T2); D (2) := Lo (T1); Lemma_Hi_Lo (T1, Hi (T1), D (2)); D (1) := Hi (T2) + Hi (T1); pragma Assert (Double_Uns (Hi (T2)) + Hi (T1) = Double_Uns (D (1))); Lemma_Add_Commutation (Double_Uns (Hi (T2)), Hi (T1)); pragma Assert (Big (Double_Uns (Hi (T2))) + Big (Double_Uns (Hi (T1))) = Big (Double_Uns (D (1)))); pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); else D (1) := 0; end if; pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); else if Xhi /= 0 then T1 := Xhi * Ylo; Lemma_Hi_Lo (T1, Hi (T1), Lo (T1)); T2 := D (3) + Lo (T1); Lemma_Mult_Distribution (Big_2xxSingle, Big (Double_Uns (D (3))), Big (Double_Uns (Lo (T1)))); Lemma_Hi_Lo (T2, Hi (T2), Lo (T2)); D (3) := Lo (T2); D (2) := Hi (T1) + Hi (T2); pragma Assert (Double_Uns (Hi (T1)) + Hi (T2) = Double_Uns (D (2))); Lemma_Add_Commutation (Double_Uns (Hi (T1)), Hi (T2)); pragma Assert (Big (Double_Uns (Hi (T1))) + Big (Double_Uns (Hi (T2))) = Big (Double_Uns (D (2)))); pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); else D (2) := 0; pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); end if; D (1) := 0; end if; pragma Assert (Mult = Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); -- Now it is time for the dreaded multiple precision division. First an -- easy case, check for the simple case of a one digit divisor. if Zhi = 0 then if D (1) /= 0 or else D (2) >= Zlo then if D (1) > 0 then pragma Assert (Mult >= Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1)))); pragma Assert (Mult >= Big_2xxDouble * Big_2xxSingle); Lemma_Ge_Commutation (2 ** Single_Size, Zu); pragma Assert (Mult >= Big_2xxDouble * Big (Zu)); else Lemma_Ge_Commutation (Double_Uns (D (2)), Zu); pragma Assert (Mult >= Big_2xxDouble * Big (Zu)); end if; Prove_Overflow; Raise_Error; -- Here we are dividing at most three digits by one digit else T1 := D (2) & D (3); T2 := Lo (T1 rem Zlo) & D (4); Qu := Lo (T1 / Zlo) & Lo (T2 / Zlo); Ru := T2 rem Zlo; Prove_Z_Low; end if; -- If divisor is double digit and dividend is too large, raise error elsif (D (1) & D (2)) >= Zu then Lemma_Hi_Lo (D (1) & D (2), D (1), D (2)); Lemma_Ge_Commutation (D (1) & D (2), Zu); Prove_Overflow; Raise_Error; -- This is the complex case where we definitely have a double digit -- divisor and a dividend of at least three digits. We use the classical -- multiple-precision division algorithm (see section (4.3.1) of Knuth's -- "The Art of Computer Programming", Vol. 2 for a description -- (algorithm D). else -- First normalize the divisor so that it has the leading bit on. -- We do this by finding the appropriate left shift amount. Shift := Single_Size; Mask := Single_Uns'Last; Scale := 0; Inter := 0; pragma Assert (Big_2xx (Scale) = 1); while Shift > 1 loop pragma Loop_Invariant (Scale <= Single_Size - Shift); pragma Loop_Invariant ((Hi (Zu) and Mask) /= 0); pragma Loop_Invariant (Mask = Shift_Left (Single_Uns'Last, Single_Size - Shift)); pragma Loop_Invariant (Zu = Shift_Left (abs Z, Scale)); pragma Loop_Invariant (Big (Zu) = Big (Double_Uns'(abs Z)) * Big_2xx (Scale)); pragma Loop_Invariant (Inter in 0 .. Log_Single_Size - 1); pragma Loop_Invariant (Shift = 2 ** (Log_Single_Size - Inter)); pragma Loop_Invariant (Shift mod 2 = 0); declare -- Local ghost variables Shift_Prev : constant Natural := Shift with Ghost; Mask_Prev : constant Single_Uns := Mask with Ghost; Zu_Prev : constant Double_Uns := Zu with Ghost; -- Local lemmas procedure Prove_Power with Ghost, Pre => Inter in 0 .. Log_Single_Size - 1 and then Shift = 2 ** (Log_Single_Size - Inter), Post => Shift / 2 = 2 ** (Log_Single_Size - (Inter + 1)) and then (Shift = 2 or (Shift / 2) mod 2 = 0); procedure Prove_Shift_Progress with Ghost, Pre => Shift <= Single_Size / 2 and then Shift_Prev = 2 * Shift and then Mask_Prev = Shift_Left (Single_Uns'Last, Single_Size - Shift_Prev) and then Mask = Shift_Left (Single_Uns'Last, Single_Size - Shift_Prev + Shift), Post => Mask_Prev = Shift_Left (Single_Uns'Last, Single_Size - 2 * Shift) and then Mask = Shift_Left (Single_Uns'Last, Single_Size - Shift); procedure Prove_Shifting with Ghost, Pre => Shift <= Single_Size / 2 and then Zu = Shift_Left (Zu_Prev, Shift) and then Mask_Prev = Shift_Left (Single_Uns'Last, Single_Size - 2 * Shift) and then Mask = Shift_Left (Single_Uns'Last, Single_Size - Shift) and then (Hi (Zu_Prev) and Mask_Prev and not Mask) /= 0, Post => (Hi (Zu) and Mask) /= 0; ----------------------------- -- Local lemma null bodies -- ----------------------------- procedure Prove_Power is null; procedure Prove_Shifting is null; procedure Prove_Shift_Progress is null; begin Prove_Power; Shift := Shift / 2; Inter := Inter + 1; pragma Assert (Shift_Prev = 2 * Shift); Mask := Shift_Left (Mask, Shift); Lemma_Double_Shift (Single_Uns'Last, Single_Size - Shift_Prev, Shift); Prove_Shift_Progress; if (Hi (Zu) and Mask) = 0 then Zu := Shift_Left (Zu, Shift); Prove_Shifting; pragma Assert (Big (Zu_Prev) = Big (Double_Uns'(abs Z)) * Big_2xx (Scale)); Lemma_Shift_Without_Drop (Zu_Prev, Zu, Mask, Shift); Lemma_Substitution (Big (Zu), Big_2xx (Shift), Big (Zu_Prev), Big (Double_Uns'(abs Z)) * Big_2xx (Scale), 0); Lemma_Powers_Of_2 (Shift, Scale); Lemma_Substitution (Big (Zu), Big (Double_Uns'(abs Z)), Big_2xx (Shift) * Big_2xx (Scale), Big_2xx (Shift + Scale), 0); Lemma_Double_Shift (abs Z, Scale, Shift); Scale := Scale + Shift; pragma Assert (Zu = Shift_Left (abs Z, Scale)); pragma Assert (Big (Zu) = Big (Double_Uns'(abs Z)) * Big_2xx (Scale)); end if; pragma Assert (Big (Zu) = Big (Double_Uns'(abs Z)) * Big_2xx (Scale)); end; end loop; Zhi := Hi (Zu); Zlo := Lo (Zu); pragma Assert (Shift = 1); pragma Assert (Mask = Shift_Left (Single_Uns'Last, Single_Size - 1)); pragma Assert ((Zhi and Mask) /= 0); pragma Assert (Zhi >= 2 ** (Single_Size - 1)); pragma Assert (Big (Zu) = Big (Double_Uns'(abs Z)) * Big_2xx (Scale)); -- We have Hi (Zu) /= 0 before normalization. The sequence of -- Shift_Left operations results in the leading bit of Zu being 1 by -- moving the leftmost 1-bit in Zu to leading position, thus -- Zhi = Hi (Zu) >= 2 ** (Single_Size - 1) here. -- Note that when we scale up the dividend, it still fits in four -- digits, since we already tested for overflow, and scaling does -- not change the invariant that (D (1) & D (2)) < Zu. Lemma_Lt_Commutation (D (1) & D (2), abs Z); Lemma_Lt_Mult (Big (D (1) & D (2)), Big (Double_Uns'(abs Z)), Big_2xx (Scale), Big_2xxDouble); T1 := Shift_Left (D (1) & D (2), Scale); T2 := Shift_Left (Double_Uns (D (3)), Scale); T3 := Shift_Left (Double_Uns (D (4)), Scale); Prove_Dividend_Scaling; D (1) := Hi (T1); D (2) := Lo (T1) or Hi (T2); D (3) := Lo (T2) or Hi (T3); D (4) := Lo (T3); pragma Assert (Mult * Big_2xx (Scale) = Big_2xxSingle * Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1))) + Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); Lemma_Substitution (Big_2xxDouble * Big (Zu), Big_2xxDouble, Big (Zu), Big (Double_Uns'(abs Z)) * Big_2xx (Scale), 0); Lemma_Lt_Mult (Mult, Big_2xxDouble * Big (Double_Uns'(abs Z)), Big_2xx (Scale), Big_2xxDouble * Big (Zu)); Lemma_Div_Lt (Mult * Big_2xx (Scale), Big (Zu), Big_2xxDouble); Lemma_Substitution (Mult * Big_2xx (Scale), Big_2xxSingle, Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (1))) + Big_2xxSingle * Big (Double_Uns (D (2))) + Big (Double_Uns (D (3))), Big3 (D (1), D (2), D (3)), Big (Double_Uns (D (4)))); -- Loop to compute quotient digits, runs twice for Qd (1) and Qd (2) declare -- Local lemmas procedure Prove_First_Iteration (X1, X2, X3, X4 : Single_Uns) with Ghost, Pre => X1 = 0, Post => Big_2xxSingle * Big3 (X1, X2, X3) + Big (Double_Uns (X4)) = Big3 (X2, X3, X4); --------------------------- -- Prove_First_Iteration -- --------------------------- procedure Prove_First_Iteration (X1, X2, X3, X4 : Single_Uns) is null; -- Local ghost variables Qd1 : Single_Uns := 0 with Ghost; D123 : constant Big_Integer := Big3 (D (1), D (2), D (3)) with Ghost; begin for J in 1 .. 2 loop Lemma_Hi_Lo (D (J) & D (J + 1), D (J), D (J + 1)); pragma Assert (Big (D (J) & D (J + 1)) < Big (Zu)); -- Compute next quotient digit. We have to divide three digits -- by two digits. We estimate the quotient by dividing the -- leading two digits by the leading digit. Given the scaling -- we did above which ensured the first bit of the divisor is -- set, this gives an estimate of the quotient that is at most -- two too high. if D (J) > Zhi then Lemma_Lt_Commutation (Zu, D (J) & D (J + 1)); pragma Assert (False); elsif D (J) = Zhi then Qd (J) := Single_Uns'Last; Lemma_Gt_Mult (Big (Zu), Big (D (J) & D (J + 1)) + 1, Big_2xxSingle, Big3 (D (J), D (J + 1), D (J + 2))); Lemma_Div_Lt (Big3 (D (J), D (J + 1), D (J + 2)), Big_2xxSingle, Big (Zu)); else Qd (J) := Lo ((D (J) & D (J + 1)) / Zhi); Prove_Qd_Calculation_Part_1 (J); end if; Lemma_Gt_Mult (Big (Double_Uns (Qd (J))), Big3 (D (J), D (J + 1), D (J + 2)) / Big (Zu), Big (Zu), Big3 (D (J), D (J + 1), D (J + 2)) - Big (Zu)); -- Compute amount to subtract T1 := Qd (J) * Zlo; T2 := Qd (J) * Zhi; S3 := Lo (T1); T3 := Hi (T1) + Lo (T2); S2 := Lo (T3); S1 := Hi (T3) + Hi (T2); Prove_Multiplication (Qd (J)); -- Adjust quotient digit if it was too high -- We use the version of the algorithm in the 2nd Edition -- of "The Art of Computer Programming". This had a bug not -- discovered till 1995, see Vol 2 errata: -- http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz. -- Under rare circumstances the expression in the test could -- overflow. This version was further corrected in 2005, see -- Vol 2 errata: -- http://www-cs-faculty.stanford.edu/~uno/all2-pre.ps.gz. -- This implementation is not impacted by these bugs, due -- to the use of a word-size comparison done in function Le3 -- instead of a comparison on two-word integer quantities in -- the original algorithm. Lemma_Hi_Lo_3 (Zu, Zhi, Zlo); while not Le3 (S1, S2, S3, D (J), D (J + 1), D (J + 2)) loop pragma Loop_Invariant (Qd (J)'Initialized); pragma Loop_Invariant (Big3 (S1, S2, S3) = Big (Double_Uns (Qd (J))) * Big (Zu)); pragma Assert (Big3 (S1, S2, S3) > 0); if Qd (J) = 0 then pragma Assert (Big3 (S1, S2, S3) = 0); pragma Assert (False); end if; Lemma_Ge_Commutation (Double_Uns (Qd (J)), 1); Lemma_Ge_Mult (Big (Double_Uns (Qd (J))), 1, Big (Zu), Big (Zu)); Sub3 (S1, S2, S3, 0, Zhi, Zlo); pragma Assert (Big3 (S1, S2, S3) > Big3 (D (J), D (J + 1), D (J + 2)) - Big (Zu)); Lemma_Subtract_Commutation (Double_Uns (Qd (J)), 1); Lemma_Substitution (Big3 (S1, S2, S3), Big (Zu), Big (Double_Uns (Qd (J))) - 1, Big (Double_Uns (Qd (J) - 1)), 0); Qd (J) := Qd (J) - 1; pragma Assert (Big3 (S1, S2, S3) = Big (Double_Uns (Qd (J))) * Big (Zu)); end loop; -- Now subtract S1&S2&S3 from D1&D2&D3 ready for next step pragma Assert (Big3 (S1, S2, S3) = Big (Double_Uns (Qd (J))) * Big (Zu)); pragma Assert (Big3 (S1, S2, S3) > Big3 (D (J), D (J + 1), D (J + 2)) - Big (Zu)); Inline_Le3 (S1, S2, S3, D (J), D (J + 1), D (J + 2)); Sub3 (D (J), D (J + 1), D (J + 2), S1, S2, S3); pragma Assert (Big3 (D (J), D (J + 1), D (J + 2)) < Big (Zu)); if D (J) > 0 then pragma Assert (Big_2xxSingle * Big_2xxSingle = Big_2xxDouble); pragma Assert (Big3 (D (J), D (J + 1), D (J + 2)) = Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (J))) + Big_2xxSingle * Big (Double_Uns (D (J + 1))) + Big (Double_Uns (D (J + 2)))); pragma Assert (Big3 (D (J), D (J + 1), D (J + 2)) = Big_2xxDouble * Big (Double_Uns (D (J))) + Big_2xxSingle * Big (Double_Uns (D (J + 1))) + Big (Double_Uns (D (J + 2)))); pragma Assert (Big3 (D (J), D (J + 1), D (J + 2)) >= Big_2xxDouble * Big (Double_Uns (D (J)))); Lemma_Ge_Commutation (Double_Uns (D (J)), Double_Uns'(1)); pragma Assert (Big3 (D (J), D (J + 1), D (J + 2)) >= Big_2xxDouble); pragma Assert (False); end if; if J = 1 then Qd1 := Qd (1); Lemma_Substitution (Mult * Big_2xx (Scale), Big_2xxSingle, D123, Big3 (D (1), D (2), D (3)) + Big3 (S1, S2, S3), Big (Double_Uns (D (4)))); Prove_First_Iteration (D (1), D (2), D (3), D (4)); Lemma_Substitution (Mult * Big_2xx (Scale), Big_2xxSingle, Big3 (S1, S2, S3), Big (Double_Uns (Qd1)) * Big (Zu), Big3 (D (2), D (3), D (4))); else pragma Assert (Qd1 = Qd (1)); pragma Assert (Big_2xxSingle * Big_2xxSingle * Big (Double_Uns (D (2))) = 0); pragma Assert (Mult * Big_2xx (Scale) = Big_2xxSingle * Big (Double_Uns (Qd (1))) * Big (Zu) + Big3 (S1, S2, S3) + Big3 (D (2), D (3), D (4))); pragma Assert (Mult * Big_2xx (Scale) = Big_2xxSingle * Big (Double_Uns (Qd (1))) * Big (Zu) + Big (Double_Uns (Qd (2))) * Big (Zu) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); end if; end loop; end; -- The two quotient digits are now set, and the remainder of the -- scaled division is in D3&D4. To get the remainder for the -- original unscaled division, we rescale this dividend. -- We rescale the divisor as well, to make the proper comparison -- for rounding below. Qu := Qd (1) & Qd (2); Ru := D (3) & D (4); pragma Assert (Mult * Big_2xx (Scale) = Big_2xxSingle * Big (Double_Uns (Qd (1))) * Big (Zu) + Big (Double_Uns (Qd (2))) * Big (Zu) + Big_2xxSingle * Big (Double_Uns (D (3))) + Big (Double_Uns (D (4)))); Lemma_Hi_Lo (Qu, Qd (1), Qd (2)); Lemma_Hi_Lo (Ru, D (3), D (4)); Lemma_Substitution (Mult * Big_2xx (Scale), Big (Zu), Big_2xxSingle * Big (Double_Uns (Qd (1))) + Big (Double_Uns (Qd (2))), Big (Qu), Big (Ru)); Prove_Rescaling; Ru := Shift_Right (Ru, Scale); Lemma_Shift_Right (Zu, Scale); Zu := Shift_Right (Zu, Scale); Lemma_Simplify (Big (Double_Uns'(abs Z)), Big_2xx (Scale)); end if; pragma Assert (Big (Ru) = abs Big_R); pragma Assert (Big (Qu) = abs Quot); pragma Assert (Big (Zu) = Big (Double_Uns'(abs Z))); -- Deal with rounding case if Round then Prove_Rounding_Case; if Ru > (Zu - Double_Uns'(1)) / Double_Uns'(2) then pragma Assert (abs Big_Q = Big (Qu) + 1); -- Protect against wrapping around when rounding, by signaling -- an overflow when the quotient is too large. if Qu = Double_Uns'Last then Prove_Q_Too_Big; Raise_Error; end if; Lemma_Add_One (Qu); Qu := Qu + Double_Uns'(1); end if; end if; pragma Assert (Big (Qu) = abs Big_Q); -- Set final signs (RM 4.5.5(27-30)) -- Case of dividend (X * Y) sign positive if (X >= 0 and then Y >= 0) or else (X < 0 and then Y < 0) then Prove_Positive_Dividend; R := To_Pos_Int (Ru); Q := (if Z > 0 then To_Pos_Int (Qu) else To_Neg_Int (Qu)); -- Case of dividend (X * Y) sign negative else Prove_Negative_Dividend; R := To_Neg_Int (Ru); Q := (if Z > 0 then To_Neg_Int (Qu) else To_Pos_Int (Qu)); end if; Prove_Sign_R; Prove_Signs; end Scaled_Divide; ---------- -- Sub3 -- ---------- procedure Sub3 (X1, X2, X3 : in out Single_Uns; Y1, Y2, Y3 : Single_Uns) is -- Local ghost variables XX1 : constant Single_Uns := X1 with Ghost; XX2 : constant Single_Uns := X2 with Ghost; XX3 : constant Single_Uns := X3 with Ghost; -- Local lemmas procedure Lemma_Add3_No_Carry (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) with Ghost, Pre => X1 <= Single_Uns'Last - Y1 and then X2 <= Single_Uns'Last - Y2 and then X3 <= Single_Uns'Last - Y3, Post => Big3 (X1 + Y1, X2 + Y2, X3 + Y3) = Big3 (X1, X2, X3) + Big3 (Y1, Y2, Y3); procedure Lemma_Ge_Expand (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) with Ghost, Pre => Big3 (X1, X2, X3) >= Big3 (Y1, Y2, Y3), Post => X1 > Y1 or else (X1 = Y1 and then X2 > Y2) or else (X1 = Y1 and then X2 = Y2 and then X3 >= Y3); procedure Lemma_Sub3_No_Carry (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) with Ghost, Pre => X1 >= Y1 and then X2 >= Y2 and then X3 >= Y3, Post => Big3 (X1 - Y1, X2 - Y2, X3 - Y3) = Big3 (X1, X2, X3) - Big3 (Y1, Y2, Y3); procedure Lemma_Sub3_With_Carry2 (X1, X2, X3, Y2 : Single_Uns) with Ghost, Pre => X2 < Y2, Post => Big3 (X1, X2 - Y2, X3) = Big3 (X1, X2, X3) + Big3 (1, 0, 0) - Big3 (0, Y2, 0); procedure Lemma_Sub3_With_Carry3 (X1, X2, X3, Y3 : Single_Uns) with Ghost, Pre => X3 < Y3, Post => Big3 (X1, X2, X3 - Y3) = Big3 (X1, X2, X3) + Big3 (0, 1, 0) - Big3 (0, 0, Y3); ------------------------- -- Lemma_Add3_No_Carry -- ------------------------- procedure Lemma_Add3_No_Carry (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) is begin Lemma_Add_Commutation (Double_Uns (X1), Y1); Lemma_Add_Commutation (Double_Uns (X2), Y2); Lemma_Add_Commutation (Double_Uns (X3), Y3); pragma Assert (Double_Uns (Single_Uns'(X1 + Y1)) = Double_Uns (X1) + Double_Uns (Y1)); pragma Assert (Double_Uns (Single_Uns'(X2 + Y2)) = Double_Uns (X2) + Double_Uns (Y2)); pragma Assert (Double_Uns (Single_Uns'(X3 + Y3)) = Double_Uns (X3) + Double_Uns (Y3)); end Lemma_Add3_No_Carry; --------------------- -- Lemma_Ge_Expand -- --------------------- procedure Lemma_Ge_Expand (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) is null; ------------------------- -- Lemma_Sub3_No_Carry -- ------------------------- procedure Lemma_Sub3_No_Carry (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) is begin Lemma_Subtract_Commutation (Double_Uns (X1), Double_Uns (Y1)); Lemma_Subtract_Commutation (Double_Uns (X2), Double_Uns (Y2)); Lemma_Subtract_Commutation (Double_Uns (X3), Double_Uns (Y3)); end Lemma_Sub3_No_Carry; ---------------------------- -- Lemma_Sub3_With_Carry2 -- ---------------------------- procedure Lemma_Sub3_With_Carry2 (X1, X2, X3, Y2 : Single_Uns) is pragma Unreferenced (X1, X3); begin Lemma_Add_Commutation (Double_Uns'(2 ** Single_Size) - Double_Uns (Y2), X2); Lemma_Subtract_Commutation (Double_Uns'(2 ** Single_Size), Double_Uns (Y2)); end Lemma_Sub3_With_Carry2; ---------------------------- -- Lemma_Sub3_With_Carry3 -- ---------------------------- procedure Lemma_Sub3_With_Carry3 (X1, X2, X3, Y3 : Single_Uns) is pragma Unreferenced (X1, X2); begin Lemma_Add_Commutation (Double_Uns'(2 ** Single_Size) - Double_Uns (Y3), X3); Lemma_Subtract_Commutation (Double_Uns'(2 ** Single_Size), Double_Uns (Y3)); end Lemma_Sub3_With_Carry3; -- Start of processing for Sub3 begin Lemma_Ge_Expand (X1, X2, X3, Y1, Y2, Y3); if Y3 > X3 then if X2 = 0 then pragma Assert (X1 >= 1); Lemma_Sub3_No_Carry (X1, X2, X3, 1, 0, 0); X1 := X1 - 1; pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (1, 0, 0)); pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (0, Single_Uns'Last, 0) - Big3 (0, 1, 0)); Lemma_Add3_No_Carry (X1, X2, X3, 0, Single_Uns'Last, 0); else Lemma_Sub3_No_Carry (X1, X2, X3, 0, 1, 0); end if; X2 := X2 - 1; pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (0, 1, 0)); Lemma_Sub3_With_Carry3 (X1, X2, X3, Y3); else Lemma_Sub3_No_Carry (X1, X2, X3, 0, 0, Y3); end if; X3 := X3 - Y3; pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (0, 0, Y3)); if Y2 > X2 then pragma Assert (X1 >= 1); Lemma_Sub3_No_Carry (X1, X2, X3, 1, 0, 0); X1 := X1 - 1; pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (0, 0, Y3) - Big3 (1, 0, 0)); Lemma_Sub3_With_Carry2 (X1, X2, X3, Y2); else Lemma_Sub3_No_Carry (X1, X2, X3, 0, Y2, 0); end if; X2 := X2 - Y2; pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (0, Y2, Y3)); pragma Assert (X1 >= Y1); Lemma_Sub3_No_Carry (X1, Y2, X3, Y1, 0, 0); X1 := X1 - Y1; pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (0, Y2, Y3) - Big3 (Y1, 0, 0)); Lemma_Add3_No_Carry (0, Y2, Y3, Y1, 0, 0); pragma Assert (Big3 (X1, X2, X3) = Big3 (XX1, XX2, XX3) - Big3 (Y1, Y2, Y3)); end Sub3; ------------------------------- -- Subtract_With_Ovflo_Check -- ------------------------------- function Subtract_With_Ovflo_Check (X, Y : Double_Int) return Double_Int is R : constant Double_Int := To_Int (To_Uns (X) - To_Uns (Y)); -- Local lemmas procedure Prove_Negative_X with Ghost, Pre => X < 0 and then (Y <= 0 or else R < 0), Post => R = X - Y; procedure Prove_Non_Negative_X with Ghost, Pre => X >= 0 and then (Y > 0 or else R >= 0), Post => R = X - Y; procedure Prove_Overflow_Case with Ghost, Pre => (if X >= 0 then Y <= 0 and then R < 0 else Y > 0 and then R >= 0), Post => not In_Double_Int_Range (Big (X) - Big (Y)); ---------------------- -- Prove_Negative_X -- ---------------------- procedure Prove_Negative_X is begin if X = Double_Int'First then if Y = Double_Int'First or else Y > 0 then null; else pragma Assert (To_Uns (X) - To_Uns (Y) = 2 ** (Double_Size - 1) + Double_Uns (-Y)); end if; elsif Y >= 0 or else Y = Double_Int'First then null; else pragma Assert (To_Uns (X) - To_Uns (Y) = -Double_Uns (-X) + Double_Uns (-Y)); end if; end Prove_Negative_X; -------------------------- -- Prove_Non_Negative_X -- -------------------------- procedure Prove_Non_Negative_X is begin if Y > 0 then declare Ru : constant Double_Uns := To_Uns (X) - To_Uns (Y); begin pragma Assert (Ru = Double_Uns (X) - Double_Uns (Y)); if Ru < 2 ** (Double_Size - 1) then -- R >= 0 Lemma_Subtract_Double_Uns (X => Y, Y => X); pragma Assert (Ru = Double_Uns (X - Y)); elsif Ru = 2 ** (Double_Size - 1) then pragma Assert (Double_Uns (Y) < 2 ** (Double_Size - 1)); pragma Assert (False); else pragma Assert (R = -Double_Int (-(Double_Uns (X) - Double_Uns (Y)))); pragma Assert (R = -Double_Int (-Double_Uns (X) + Double_Uns (Y))); pragma Assert (R = -Double_Int (Double_Uns (Y) - Double_Uns (X))); end if; end; elsif Y = Double_Int'First then pragma Assert (To_Uns (X) - To_Uns (Y) = Double_Uns (X) - 2 ** (Double_Size - 1)); pragma Assert (False); else pragma Assert (To_Uns (X) - To_Uns (Y) = Double_Uns (X) + Double_Uns (-Y)); end if; end Prove_Non_Negative_X; ------------------------- -- Prove_Overflow_Case -- ------------------------- procedure Prove_Overflow_Case is begin if X >= 0 and then Y /= Double_Int'First then pragma Assert (To_Uns (X) - To_Uns (Y) = Double_Uns (X) + Double_Uns (-Y)); elsif X < 0 and then X /= Double_Int'First then pragma Assert (To_Uns (X) - To_Uns (Y) = -Double_Uns (-X) - Double_Uns (Y)); end if; end Prove_Overflow_Case; -- Start of processing for Subtract_With_Ovflo_Check begin if X >= 0 then if Y > 0 or else R >= 0 then Prove_Non_Negative_X; return R; end if; else -- X < 0 if Y <= 0 or else R < 0 then Prove_Negative_X; return R; end if; end if; Prove_Overflow_Case; Raise_Error; end Subtract_With_Ovflo_Check; ---------------- -- To_Neg_Int -- ---------------- function To_Neg_Int (A : Double_Uns) return Double_Int is R : constant Double_Int := (if A = 2 ** (Double_Size - 1) then Double_Int'First else -To_Int (A)); -- Note that we can't just use the expression of the Else, because it -- overflows for A = 2 ** (Double_Size - 1). begin if R <= 0 then return R; else Raise_Error; end if; end To_Neg_Int; ---------------- -- To_Pos_Int -- ---------------- function To_Pos_Int (A : Double_Uns) return Double_Int is R : constant Double_Int := To_Int (A); begin if R >= 0 then return R; else Raise_Error; end if; end To_Pos_Int; end System.Arith_Double;
persan/AdaYaml
Ada
782
ads
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" generic type Instance is limited new Refcount_Base with private; type Reference is tagged private; type Accessor (Data : not null access Instance) is limited private; with function Value (Object : Reference) return Accessor; with function Next (Object : in out Instance) return Event; package Yaml.Stream_Concept is pragma Warnings (Off, Next); pragma Warnings (Off, Value); -- to not burden ourselves with too much dynamic dispatching, we define a -- Stream as anything that is able to instantiate this package. any consumer -- of a stream shall take as generic parameter an instance of this package. end Yaml.Stream_Concept;
stcarrez/dynamo
Ada
1,242
ads
-- part of ParserTools, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" package Text.Pool is type Reference is tagged private; Default_Size : constant Pool_Offset; -- must be called once before the string pool can be used. if called again, -- the string pool re-initializes itself with new memory, and the old memory -- lives on only in References that have already been generated. the -- old memory is reclaimed once all string references to it vanish. procedure Create (P : in out Reference'Class; Initial_Size : Pool_Offset := Default_Size); -- constructor that calls Create with the given Size parameter function With_Capacity (Size : Pool_Offset) return Reference; -- create a new string from the given data. the string will be allocated -- within the pool. function From_String (P : Reference'Class; Data : String) return Text.Reference; private type Reference is tagged record Data : Pool_Data_Access; end record with Type_Invariant => (Reference.Data = null or else Reference.Data.Pos mod Header_Size = 1); Default_Size : constant Pool_Offset := 8192; end Text.Pool;
AdaCore/training_material
Ada
2,957
ads
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; package stdarg_h is -- arg-macro: procedure va_start (v, l) -- __builtin_va_start(v,l) -- arg-macro: procedure va_end (v) -- __builtin_va_end(v) -- arg-macro: procedure va_arg (v, l) -- __builtin_va_arg(v,l) -- arg-macro: procedure va_copy (d, s) -- __builtin_va_copy(d,s) -- Copyright (C) 1989-2017 Free Software Foundation, Inc. --This file is part of GCC. --GCC 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, or (at your option) --any later version. --GCC 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. --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/>. -- * ISO C Standard: 7.15 Variable arguments <stdarg.h> -- -- Define __gnuc_va_list. subtype uu_gnuc_va_list is System.Address; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\stdarg.h:40 -- Define the standard macros for the user, -- if this invocation was from the user program. -- Define va_list, if desired, from __gnuc_va_list. -- We deliberately do not define va_list when called from -- stdio.h, because ANSI C says that stdio.h is not supposed to define -- va_list. stdio.h needs to have access to that data type, -- but must not use that name. It should use the name __gnuc_va_list, -- which is safe because it is reserved for the implementation. -- SVR4.2 uses _VA_LIST for an internal alias for va_list, -- so we must avoid testing it and setting it here. -- SVR4 uses _VA_LIST as a flag in stdarg.h, but we should -- have no conflict with that. -- The macro _VA_LIST_ is the same thing used by this file in Ultrix. -- But on BSD NET2 we must not test or define or undef it. -- (Note that the comments in NET 2's ansi.h -- are incorrect for _VA_LIST_--see stdio.h!) -- The macro _VA_LIST_DEFINED is used in Windows NT 3.5 -- The macro _VA_LIST is used in SCO Unix 3.2. -- The macro _VA_LIST_T_H is used in the Bull dpx2 -- The macro __va_list__ is used by BeOS. subtype va_list is uu_gnuc_va_list; -- d:\install\gpl2018\lib\gcc\x86_64-pc-mingw32\7.3.1\include\stdarg.h:99 end stdarg_h;
zhmu/ananas
Ada
282
ads
with Array5_Pkg2; use Array5_Pkg2; with Array5_Pkg2.G; package Array5_Pkg1 is type Derived is new Root with record N : Integer; end record; package My_G is new Array5_Pkg2.G (Derived); type Arr is array (1 .. My_G.Data.N) of Integer; end Array5_Pkg1;
stcarrez/ada-awa
Ada
14,795
adb
----------------------------------------------------------------------- -- akt-commands-info -- Info command to describe the current configuration -- Copyright (C) 2020, 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. ----------------------------------------------------------------------- package body AWA.Commands.Info is use type AWA.Modules.Module_Access; -- ------------------------------ -- Print the configuration identified by the given name. -- ------------------------------ procedure Print (Command : in out Command_Type; Name : in String; Value : in String; Default : in String; Context : in out Context_Type) is pragma Unreferenced (Default); Pos : Natural; begin Context.Console.Start_Row; Context.Console.Print_Field (1, Name); Pos := Value'First; while Pos <= Value'Last loop if Value'Last - Pos > Command.Value_Length then Context.Console.Print_Field (2, Value (Pos .. Pos + Command.Value_Length - 1)); Pos := Pos + Command.Value_Length; Context.Console.End_Row; Context.Console.Start_Row; Context.Console.Print_Field (1, ""); else Context.Console.Print_Field (2, Value (Pos .. Value'Last)); Pos := Pos + Value'Length; end if; end loop; Context.Console.End_Row; end Print; procedure Print (Command : in out Command_Type; Application : in out AWA.Applications.Application'Class; Name : in String; Default : in String; Context : in out Context_Type) is Value : constant String := Application.Get_Init_Parameter (Name, Default); begin Command.Print (Name, Value, Default, Context); end Print; procedure Print (Command : in out Command_Type; Module : in AWA.Modules.Module'Class; Name : in String; Default : in String; Context : in out Context_Type) is Value : constant String := Module.Get_Config (Name, Default); begin Command.Print (Module.Get_Name & "." & Name, Value, Default, Context); end Print; -- ------------------------------ -- Print the configuration about the application. -- ------------------------------ overriding procedure Execute (Command : in out Command_Type; Application : in out AWA.Applications.Application'Class; Args : in Argument_List'Class; Context : in out Context_Type) is pragma Unreferenced (Args); Module : AWA.Modules.Module_Access; begin if Command.Long_List then Command.Value_Length := Natural'Last; end if; Application.Load_Bundle (Name => "commands", Locale => "en", Bundle => Command.Bundle); Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Database configuration"); Context.Console.Notice (N_INFO, "----------------------"); Command.Print (Application, "database", "", Context); Command.Print (Application, "ado.queries.paths", "", Context); Command.Print (Application, "ado.queries.load", "", Context); Command.Print (Application, "ado.drivers.load", "", Context); Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Server faces configuration"); Context.Console.Notice (N_INFO, "--------------------------"); Command.Print (Application, "view.dir", ASF.Applications.DEF_VIEW_DIR, Context); Command.Print (Application, "view.escape_unknown_tags", ASF.Applications.DEF_ESCAPE_UNKNOWN_TAGS, Context); Command.Print (Application, "view.ext", ASF.Applications.DEF_VIEW_EXT, Context); Command.Print (Application, "view.file_ext", ASF.Applications.DEF_VIEW_FILE_EXT, Context); Command.Print (Application, "view.ignore_spaces", ASF.Applications.DEF_IGNORE_WHITE_SPACES, Context); Command.Print (Application, "view.ignore_empty_lines", ASF.Applications.DEF_IGNORE_EMPTY_LINES, Context); Command.Print (Application, "view.static.dir", ASF.Applications.DEF_STATIC_DIR, Context); Command.Print (Application, "bundle.dir", "bundles", Context); Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "AWA Application"); Context.Console.Notice (N_INFO, "--------------------------"); Command.Print (Application, "app_name", "", Context); Command.Print (Application, "app_search_dirs", ".", Context); Command.Print (Application, "app.modules.dir", "", Context); Command.Print (Application, "app_url_base", "", Context); Command.Print (Application, "awa_url_host", "", Context); Command.Print (Application, "awa_url_port", "", Context); Command.Print (Application, "awa_url_scheme", "", Context); Command.Print (Application, "app.config", "awa.xml", Context); Command.Print (Application, "app.config.plugins", "", Context); Command.Print (Application, "contextPath", "", Context); Command.Print (Application, "awa_dispatcher_count", "", Context); Command.Print (Application, "awa_dispatcher_priority", "", Context); Module := Application.Find_Module ("users"); if Module /= null then Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Users Module"); Context.Console.Notice (N_INFO, "------------"); Command.Print (Application, "app_login_register", "", Context); Command.Print (Application, "app_login_email", "", Context); Command.Print (Application, "app_login_openid", "", Context); Command.Print (Application, "app_login_methods", "", Context); Command.Print (Application, "openid.realm", "", Context); Command.Print (Application, "openid.callback_url", "", Context); Command.Print (Application, "openid.success_url", "", Context); Command.Print (Application, "auth.url.orange", "", Context); Command.Print (Application, "auth.provider.orange", "", Context); Command.Print (Application, "auth.url.yahoo", "", Context); Command.Print (Application, "auth.provider.yahoo", "", Context); Command.Print (Application, "auth.url.google", "", Context); Command.Print (Application, "auth.provider.google", "", Context); Command.Print (Application, "auth.url.facebook", "", Context); Command.Print (Application, "auth.provider.facebook", "", Context); Command.Print (Application, "auth.url.google-plus", "", Context); Command.Print (Application, "auth.provider.google-plus", "", Context); Command.Print (Application, "facebook.callback_url", "", Context); Command.Print (Application, "facebook.request_url", "", Context); Command.Print (Application, "facebook.scope", "", Context); Command.Print (Application, "facebook.client_id", "", Context); Command.Print (Application, "facebook.secret", "", Context); Command.Print (Application, "google-plus.issuer", "", Context); Command.Print (Application, "google-plus.callback_url", "", Context); Command.Print (Application, "google-plus.request_url", "", Context); Command.Print (Application, "google-plus.scope", "", Context); Command.Print (Application, "google-plus.client_id", "", Context); Command.Print (Application, "google-plus.secret", "", Context); Command.Print (Application, "auth-filter.redirect", "", Context); Command.Print (Application, "verify-filter.redirect", "", Context); Command.Print (Application, "users.auth_key", "", Context); Command.Print (Application, "users.server_id", "", Context); end if; Module := Application.Find_Module ("mail"); if Module /= null then Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Mail Module"); Context.Console.Notice (N_INFO, "-----------"); Command.Print (Application, "mail.smtp.host", "", Context); Command.Print (Application, "mail.smtp.port", "", Context); Command.Print (Application, "mail.smtp.enable", "true", Context); Command.Print (Application, "mail.mailer", "smtp", Context); Command.Print (Application, "mail.file.maildir", "mail", Context); Command.Print (Application, "app_mail_name", "", Context); Command.Print (Application, "app_mail_from", "", Context); end if; Module := Application.Find_Module ("workspaces"); if Module /= null then Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Workspace Module"); Context.Console.Notice (N_INFO, "----------------"); Command.Print (Module.all, "permissions_list", "", Context); Command.Print (Module.all, "allow_workspace_create", "", Context); end if; Module := Application.Find_Module ("storages"); if Module /= null then Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Storage Module"); Context.Console.Notice (N_INFO, "--------------------------"); Command.Print (Module.all, "database_max_size", "100000", Context); Command.Print (Module.all, "storage_root", "storage", Context); Command.Print (Module.all, "tmp_storage_root", "tmp", Context); Module := Application.Find_Module ("images"); if Module /= null then Command.Print (Module.all, "thumbnail_command", "", Context); end if; end if; Module := Application.Find_Module ("wikis"); if Module /= null then Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Wiki Module"); Context.Console.Notice (N_INFO, "-----------"); Command.Print (Module.all, "image_prefix", "", Context); Command.Print (Module.all, "page_prefix", "", Context); Command.Print (Module.all, "wiki_copy_list", "", Context); Module := Application.Find_Module ("wiki_previews"); if Module /= null then Command.Print (Module.all, "wiki_preview_tmp", "tmp", Context); Command.Print (Module.all, "wiki_preview_dir", "web/preview", Context); Command.Print (Module.all, "wiki_preview_template", "", Context); Command.Print (Module.all, "wiki_preview_html", "", Context); Command.Print (Module.all, "wiki_preview_command", "", Context); end if; end if; Module := Application.Find_Module ("counters"); if Module /= null then Context.Console.Start_Title; Context.Console.Print_Title (1, "", 30); Context.Console.Print_Title (2, "", Command.Value_Length); Context.Console.End_Title; Context.Console.Notice (N_INFO, "Counter Module"); Context.Console.Notice (N_INFO, "--------------"); Command.Print (Module.all, "counter_age_limit", "300", Context); Command.Print (Module.all, "counter_limit", "1000", Context); end if; end Execute; -- ------------------------------ -- Setup the command before parsing the arguments and executing it. -- ------------------------------ overriding procedure Setup (Command : in out Command_Type; Config : in out GNAT.Command_Line.Command_Line_Configuration; Context : in out Context_Type) is begin GC.Set_Usage (Config => Config, Usage => Command.Get_Name & " [arguments]", Help => Command.Get_Description); Command_Drivers.Application_Command_Type (Command).Setup (Config, Context); GC.Define_Switch (Config => Config, Output => Command.Long_List'Access, Switch => "-l", Long_Switch => "--long-lines", Help => -("Use long lines to print configuration values")); end Setup; -- ------------------------------ -- Write the help associated with the command. -- ------------------------------ overriding procedure Help (Command : in out Command_Type; Name : in String; Context : in out Context_Type) is pragma Unreferenced (Command, Context); begin null; end Help; begin Command_Drivers.Driver.Add_Command ("info", -("report configuration information"), Command'Access); end AWA.Commands.Info;
fnarenji/BezierToSTL
Ada
4,155
adb
with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; with STL; use STL; with Parser_Svg; use Parser_Svg; with Normalisation; use Normalisation; with Courbes; use Courbes; with Interpolations_Lineaires; use Interpolations_Lineaires; with Vecteurs; use Vecteurs; with Helper; use Helper; procedure BezierToSTL is Courbes : Liste_Courbes.Liste; Segments : Liste_Points.Liste; Facettes : Liste_Facettes.Liste; -- Active l'affichage de la sortie Debug Activer_Debug : constant Boolean := True; -- Nombre de points à utiliser pour la discretisation Nombre_Points_Interpolation : constant Positive := 50; -- Faut il interpoler les droites -- ou laisser cette tâche à l'affichage ? -- WARNING: Ne pas activer avec De Casteljau -- Sinon risque de trop grand nombre de points -- rendant stlviewer inutilisable Interpoler_Droites : constant Boolean := false; -- Utiliser l'algorithme de De Casteljau -- pour interpoler les courbes de Bezier cubiques -- => Courbes plus jolies/lisses -- => Le nombre de point est ignoré pour les courbes concernées -- => car il est déterminé automatiquement -- WARNING: Ne pas activer avec Interpoler_Droites -- Sinon risque de trop grand nombre de points -- rendant stlviewer inutilisable Utiliser_DeCasteljau : constant Boolean := true; -- Tolérance utilisée si Utiliser_DeCasteljau -- Définit une tolérance pour -- savoir quand une courbe peut être -- considérée "droite" -- Plus petit = tolérance plus strict -- => Approximation plus précise -- et inversement. -- A valeur entre 0.01 et 1.0. Tolerance_DeCasteljau : constant Tolerance := 0.1; -- Permet de libérer la mémoire allouée pour -- toutes les courbes d'une liste procedure Liberer_Liste_Courbes is new Liste_Courbes.Parcourir(Liberer_Courbe); -- Nombre de facette à générer pendant la rotation Nombre_Facettes : constant Positive := 200; begin if Argument_Count /= 2 then Put_Line(Standard_Error, "usage : " & Command_Name & " fichier_entree.svg fichier_sortie.stl"); Set_Exit_Status(Failure); return; end if; Afficher_Debug (Activer_Debug); Put_Line("Chargement de la figure..."); -- On charge la figure contenue dans le SVG Charger_SVG(Argument(1), Courbes); Put_Line("Interpolation linéaire..."); -- Approximation des courbes par des segments Interpolation_Lineaire ( Courbes => Courbes, Segments => Segments, Nombre_Points => Nombre_Points_Interpolation, Interpoler_Droites => Interpoler_Droites, Utiliser_DeCasteljau => Utiliser_DeCasteljau, Tolerance_DeCasteljau => Tolerance_DeCasteljau); Put_Line("Normalisation..."); -- On normalise la figure -- (centrage en x, raccordage extremités) Normaliser(Segments); Put_Line("Projection en 3D..."); -- On convertit en facettes par rotation Creation(Segments, Facettes, Nombre_Facettes); Put_Line("Export..."); -- On sauvegarde le modele obtenu Sauvegarder(Argument(2), Facettes); -- Libère la mémoire allouée pour chaque courbe Liberer_Liste_Courbes (Courbes); -- Libère la mémoire allouée pour les listes Liste_Courbes.Vider(Courbes); Liste_Points.Vider(Segments); Liste_Facettes.Vider(Facettes); exception when Courbe_Abs => Put_Line (Standard_Error, "Le fichier source ne contenait pas de courbe."); Set_Exit_Status (Failure); when e: Courbe_Illisible => Put_Line (Standard_Error, "Le fichier source est mal formé: " & exception_message (e)); Set_Exit_Status (Failure); when e: Erreur_Lecture => Put_Line (Standard_Error, "Le fichier source est mal formé: " & exception_message (e)); Set_Exit_Status (Failure); when e: Name_Error => Put_Line (Standard_Error, "Le fichier n'a pas pu être ouvert: " & exception_message(e)); Set_Exit_Status (Failure); end;
Intelligente-sanntidssystemer/Ada-prosjekt
Ada
95
ads
package sensor_behind is function HCSR04_Behind_Distance return float; end sensor_behind;
stcarrez/ada-keystore
Ada
10,781
adb
----------------------------------------------------------------------- -- keystore-passwords-files -- File based password provider -- Copyright (C) 2019, 2020, 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.Strings; with Ada.Directories; with Ada.Streams.Stream_IO; with Util.Systems.Types; with Util.Systems.Os; with Util.Log.Loggers; with Keystore.Random; package body Keystore.Passwords.Files is subtype Key_Length is Util.Encoders.Key_Length; use type Ada.Streams.Stream_Element_Offset; -- GNAT 2019 complains about unused use type but gcc 7.4 fails if it not defined (st_mode). pragma Warnings (Off); use type Interfaces.C.int; use type Interfaces.C.unsigned; use type Interfaces.C.unsigned_short; pragma Warnings (On); function Verify_And_Get_Size (Path : in String) return Ada.Streams.Stream_Element_Count; type Provider (Len : Key_Length) is limited new Keystore.Passwords.Provider with record Password : Ada.Streams.Stream_Element_Array (1 .. Len); end record; type File_Provider_Access is access all Provider; -- Get the password through the Getter operation. overriding procedure Get_Password (From : in Provider; Getter : not null access procedure (Password : in Secret_Key)); type Key_Provider (Len : Key_Length) is new Provider (Len) and Keys.Key_Provider and Internal_Key_Provider with null record; type Key_Provider_Access is access all Key_Provider'Class; -- Get the Key, IV and signature. overriding procedure Get_Keys (From : in Key_Provider; Key : out Secret_Key; IV : out Secret_Key; Sign : out Secret_Key); Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.Passwords.Files"); overriding procedure Save_Key (Provider : in Key_Provider; Data : out Ada.Streams.Stream_Element_Array); function Verify_And_Get_Size (Path : in String) return Ada.Streams.Stream_Element_Count is P : Interfaces.C.Strings.chars_ptr; Stat : aliased Util.Systems.Types.Stat_Type; Res : Integer; Result : Ada.Streams.Stream_Element_Count; Dir : constant String := Ada.Directories.Containing_Directory (Path); begin -- Verify that the file is readable only by the current user. P := Interfaces.C.Strings.New_String (Path); Res := Util.Systems.Os.Sys_Stat (Path => P, Stat => Stat'Access); Interfaces.C.Strings.Free (P); if Res /= 0 then Log.Info ("Password file {0} does not exist", Path); raise Keystore.Bad_Password with "Password file does not exist"; end if; pragma Warnings (Off, "*condition is always*"); if (Stat.st_mode and 8#0077#) /= 0 and then Util.Systems.Os.Directory_Separator = '/' then Log.Info ("Password file {0} is not safe", Path); raise Keystore.Bad_Password with "Password file is not safe"; end if; pragma Warnings (On, "*condition is always*"); if Stat.st_size = 0 then Log.Info ("Password file {0} is empty", Path); raise Keystore.Bad_Password with "Password file is empty"; end if; if Stat.st_size > MAX_FILE_SIZE then Log.Info ("Password file {0} is too big", Path); raise Keystore.Bad_Password with "Password file is too big"; end if; Result := Ada.Streams.Stream_Element_Offset (Stat.st_size); -- Verify that the parent directory is readable only by the current user. P := Interfaces.C.Strings.New_String (Dir); Res := Util.Systems.Os.Sys_Stat (Path => P, Stat => Stat'Access); Interfaces.C.Strings.Free (P); if Res /= 0 then Log.Info ("Directory {0} is not safe for password file", Dir); raise Keystore.Bad_Password with "Directory that contains password file cannot be checked"; end if; pragma Warnings (Off, "*condition is always*"); if (Stat.st_mode and 8#0077#) /= 0 and then Util.Systems.Os.Directory_Separator = '/' then Log.Info ("Directory {0} is not safe for password file", Dir); raise Keystore.Bad_Password with "Directory that contains password file is not safe"; end if; pragma Warnings (On, "*condition is always*"); Log.Info ("Password file {0} passes the security checks", Path); return Result; end Verify_And_Get_Size; -- ------------------------------ -- Create a password provider that reads the file to build the password. -- The file must have the mode rw------- (600) and its owning directory -- the mode rwx------ (700). The Bad_Password exception is raised if -- these rules are not verified. -- ------------------------------ function Create (Path : in String) return Provider_Access is Size : Ada.Streams.Stream_Element_Offset; File : Ada.Streams.Stream_IO.File_Type; Result : File_Provider_Access; Last : Ada.Streams.Stream_Element_Offset; begin Size := Verify_And_Get_Size (Path); Ada.Streams.Stream_IO.Open (File => File, Mode => Ada.Streams.Stream_IO.In_File, Name => Path); Result := new Provider '(Len => Size, others => <>); Ada.Streams.Stream_IO.Read (File, Result.Password, Last); Ada.Streams.Stream_IO.Close (File); return Result.all'Access; end Create; -- ------------------------------ -- Get the password through the Getter operation. -- ------------------------------ overriding procedure Get_Password (From : in Provider; Getter : not null access procedure (Password : in Secret_Key)) is Password : Keystore.Secret_Key (Length => From.Len); begin Util.Encoders.Create (From.Password, Password); Getter (Password); end Get_Password; -- ------------------------------ -- Create a key provider that reads the file. The file is split in three parts -- the key, the IV, the signature which are extracted by using `Get_Keys`. -- ------------------------------ function Create (Path : in String) return Keys.Key_Provider_Access is Size : Ada.Streams.Stream_Element_Offset; File : Ada.Streams.Stream_IO.File_Type; Result : Key_Provider_Access; Last : Ada.Streams.Stream_Element_Offset; begin Size := Verify_And_Get_Size (Path); Ada.Streams.Stream_IO.Open (File => File, Mode => Ada.Streams.Stream_IO.In_File, Name => Path); Result := new Key_Provider '(Len => Size, others => <>); Ada.Streams.Stream_IO.Read (File, Result.Password, Last); Ada.Streams.Stream_IO.Close (File); return Result.all'Access; end Create; -- ------------------------------ -- Get the Key, IV and signature. -- ------------------------------ overriding procedure Get_Keys (From : in Key_Provider; Key : out Secret_Key; IV : out Secret_Key; Sign : out Secret_Key) is First : Ada.Streams.Stream_Element_Offset := 1; Last : Ada.Streams.Stream_Element_Offset := First + Key.Length - 1; begin if From.Len /= Key.Length + IV.Length + Sign.Length then raise Keystore.Bad_Password with "Invalid length for the key file"; end if; Util.Encoders.Create (From.Password (First .. Last), Key); First := Last + 1; Last := First + IV.Length - 1; Util.Encoders.Create (From.Password (First .. Last), IV); First := Last + 1; Last := First + Sign.Length - 1; Util.Encoders.Create (From.Password (First .. Last), Sign); end Get_Keys; overriding procedure Save_Key (Provider : in Key_Provider; Data : out Ada.Streams.Stream_Element_Array) is begin Data := Provider.Password; end Save_Key; -- ------------------------------ -- Generate a file that contains the keys. Keys are generated using a random generator. -- The file is created with the mode rw------- (600) and the owning directory is forced -- to the mode rwx------ (700). -- ------------------------------ function Generate (Path : in String; Length : in Key_Length := DEFAULT_KEY_FILE_LENGTH) return Keys.Key_Provider_Access is Result : Key_Provider_Access; Random : Keystore.Random.Generator; Dir : constant String := Ada.Directories.Containing_Directory (Path); File : Ada.Streams.Stream_IO.File_Type; P : Interfaces.C.Strings.chars_ptr; Res : Integer with Unreferenced; begin if not Ada.Directories.Exists (Dir) then Log.Info ("Creating directory {0}", Dir); Ada.Directories.Create_Path (Dir); end if; Log.Info ("Creating password file {0}", Path); Ada.Streams.Stream_IO.Create (File => File, Mode => Ada.Streams.Stream_IO.Out_File, Name => Path); Result := new Key_Provider '(Len => Length, others => <>); Random.Generate (Result.Password); Ada.Streams.Stream_IO.Write (File, Result.Password); Ada.Streams.Stream_IO.Close (File); P := Interfaces.C.Strings.New_String (Path); Res := Util.Systems.Os.Sys_Chmod (Path => P, Mode => 8#0600#); Interfaces.C.Strings.Free (P); P := Interfaces.C.Strings.New_String (Dir); Res := Util.Systems.Os.Sys_Chmod (Path => P, Mode => 8#0700#); Interfaces.C.Strings.Free (P); return Result.all'Access; end Generate; end Keystore.Passwords.Files;
Letractively/ada-el
Ada
3,760
ads
----------------------------------------------------------------------- -- EL.Methods.Proc_2 -- Procedure Binding with 2 arguments -- Copyright (C) 2010, 2011, 2012, 2013 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 EL.Expressions; with EL.Contexts; with Util.Beans.Methods; with Util.Beans.Basic; generic type Param1_Type (<>) is limited private; type Param2_Type (<>) is limited private; package EL.Methods.Proc_2 is use Util.Beans.Methods; -- Returns True if the method is a valid method which accepts the arguments -- defined by the package instantiation. function Is_Valid (Method : in EL.Expressions.Method_Info) return Boolean; -- Execute the method describe by the method expression -- and with the given context. The method signature is: -- -- procedure F (Obj : in out <Bean>; -- Param1 : in Param1_Type; -- Param2 : in Param2_Type); -- -- where <Bean> inherits from <b>Readonly_Bean</b> -- (See <b>Bind</b> package) -- -- Raises <b>Invalid_Method</b> if the method referenced by -- the method expression does not exist or does not match -- the signature. procedure Execute (Method : in EL.Expressions.Method_Expression'Class; Param1 : in Param1_Type; Param2 : in Param2_Type; Context : in EL.Contexts.ELContext'Class); -- Function access to the proxy. type Proxy_Access is access procedure (O : access Util.Beans.Basic.Readonly_Bean'Class; P1 : in Param1_Type; P2 : in Param2_Type); -- The binding record which links the method name -- to the proxy function. type Binding is new Method_Binding with record Method : Proxy_Access; end record; type Binding_Access is access constant Binding; -- Proxy for the binding. -- The proxy declares the binding definition that links -- the name to the function and it implements the necessary -- object conversion to translate the <b>Readonly_Bean</b> -- object to the target object type. generic -- Name of the method (as exposed in the EL expression) Name : String; -- The bean type type Bean is abstract new Util.Beans.Basic.Readonly_Bean with private; -- The bean method to invoke with procedure Method (O : in out Bean; P1 : in Param1_Type; P2 : in Param2_Type); package Bind is -- Method that <b>Execute</b> will invoke. procedure Method_Access (O : access Util.Beans.Basic.Readonly_Bean'Class; P1 : in Param1_Type; P2 : in Param2_Type); F_NAME : aliased constant String := Name; -- The proxy binding that can be exposed through -- the <b>Method_Bean</b> interface. Proxy : aliased constant Binding := Binding '(Name => F_NAME'Access, Method => Method_Access'Access); end Bind; end EL.Methods.Proc_2;
charlie5/cBound
Ada
1,448
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_generic_reply_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; length : aliased Interfaces.Unsigned_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased xcb.xcb_generic_reply_t.Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_generic_reply_t.Item, Element_Array => xcb.xcb_generic_reply_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_generic_reply_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_generic_reply_t.Pointer, Element_Array => xcb.xcb_generic_reply_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_generic_reply_t;
charlie5/cBound
Ada
1,755
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_property_notify_event_t is -- Item -- type Item is record response_type : aliased Interfaces.Unsigned_8; pad0 : aliased Interfaces.Unsigned_8; sequence : aliased Interfaces.Unsigned_16; window : aliased xcb.xcb_window_t; atom : aliased xcb.xcb_atom_t; time : aliased xcb.xcb_timestamp_t; state : aliased Interfaces.Unsigned_8; pad1 : aliased swig.int8_t_Array (0 .. 2); end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_property_notify_event_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_property_notify_event_t.Item, Element_Array => xcb.xcb_property_notify_event_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_property_notify_event_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_property_notify_event_t.Pointer, Element_Array => xcb.xcb_property_notify_event_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_property_notify_event_t;
wookey-project/ewok-legacy
Ada
7,976
adb
-- -- 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 system.machine_code; with m4.scb; with m4.systick; with soc.interrupts; use soc.interrupts; with ewok.debug; with ewok.tasks; use ewok.tasks; with ewok.tasks.debug; with ewok.sched; with ewok.tasks_shared; use ewok.tasks_shared; with ewok.devices_shared; use type ewok.devices_shared.t_device_id; with ewok.isr; package body ewok.interrupts.handler with spark_mode => off is function usagefault_handler (frame_a : ewok.t_stack_frame_access) return ewok.t_stack_frame_access is begin debug.log (debug.ERROR, "UsageFault"); return hardfault_handler (frame_a); end usagefault_handler; function hardfault_handler (frame_a : ewok.t_stack_frame_access) return ewok.t_stack_frame_access is cfsr : constant m4.scb.t_SCB_CFSR := m4.scb.SCB.CFSR; begin if cfsr.MMFSR.IACCVIOL then debug.log (debug.ERROR, "+cfsr.MMFSR.IACCVIOL"); end if; if cfsr.MMFSR.DACCVIOL then debug.log (debug.ERROR, "+cfsr.MMFSR.DACCVIOL"); end if; if cfsr.MMFSR.MUNSTKERR then debug.log (debug.ERROR, "+cfsr.MMFSR.MUNSTKERR"); end if; if cfsr.MMFSR.MSTKERR then debug.log (debug.ERROR, "+cfsr.MMFSR.MSTKERR"); end if; if cfsr.MMFSR.MLSPERR then debug.log (debug.ERROR, "+cfsr.MMFSR.MLSPERR"); end if; if cfsr.MMFSR.MMARVALID then debug.log (debug.ERROR, "+cfsr.MMFSR.MMARVALID"); end if; if cfsr.BFSR.IBUSERR then debug.log (debug.ERROR, "+cfsr.BFSR.IBUSERR"); end if; if cfsr.BFSR.PRECISERR then debug.log (debug.ERROR, "+cfsr.BFSR.PRECISERR"); end if; if cfsr.BFSR.IMPRECISERR then debug.log (debug.ERROR, "+cfsr.BFSR.IMPRECISERR"); end if; if cfsr.BFSR.UNSTKERR then debug.log (debug.ERROR, "+cfsr.BFSR.UNSTKERR"); end if; if cfsr.BFSR.STKERR then debug.log (debug.ERROR, "+cfsr.BFSR.STKERR"); end if; if cfsr.BFSR.LSPERR then debug.log (debug.ERROR, "+cfsr.BFSR.LSPERR"); end if; if cfsr.BFSR.BFARVALID then debug.log (debug.ERROR, "+cfsr.BFSR.BFARVALID"); end if; if cfsr.UFSR.UNDEFINSTR then debug.log (debug.ERROR, "+cfsr.UFSR.UNDEFINSTR"); end if; if cfsr.UFSR.INVSTATE then debug.log (debug.ERROR, "+cfsr.UFSR.INVSTATE"); end if; if cfsr.UFSR.INVPC then debug.log (debug.ERROR, "+cfsr.UFSR.INVPC"); end if; if cfsr.UFSR.NOCP then debug.log (debug.ERROR, "+cfsr.UFSR.NOCP"); end if; if cfsr.UFSR.UNALIGNED then debug.log (debug.ERROR, "+cfsr.UFSR.UNALIGNED"); end if; if cfsr.UFSR.DIVBYZERO then debug.log (debug.ERROR, "+cfsr.UFSR.DIVBYZERO"); end if; ewok.tasks.debug.crashdump (frame_a); debug.panic ("panic!"); return frame_a; end hardfault_handler; function systick_default_handler (frame_a : ewok.t_stack_frame_access) return ewok.t_stack_frame_access is begin m4.systick.increment; return frame_a; end systick_default_handler; function default_sub_handler (frame_a : t_stack_frame_access) return t_stack_frame_access is it : t_interrupt; current_id : ewok.tasks_shared.t_task_id; new_frame_a : t_stack_frame_access; ttype : t_task_type; begin it := soc.interrupts.get_interrupt; -- -- Exceptions (not nested) -- if frame_a.all.exc_return = 16#FFFF_FFFD# then -- System exceptions if it < INT_WWDG then if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then new_frame_a := interrupt_table(it).task_switch_handler (frame_a); else debug.panic ("Unhandled exception " & t_interrupt'image (it)); end if; else -- External interrupts -- Execute kernel ISR if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then interrupt_table(it).handler (frame_a); new_frame_a := frame_a; -- User ISR are postponed (asynchronous execution) elsif interrupt_table(it).task_id /= ewok.tasks_shared.ID_UNUSED then ewok.isr.postpone_isr (it, interrupt_table(it).handler, interrupt_table(it).task_id); new_frame_a := ewok.sched.do_schedule (frame_a); else debug.panic ("Unhandled interrupt " & t_interrupt'image (it)); end if; end if; -- Task's execution mode must be transmitted to the Default_Handler -- to run it with the proper privilege (set in the CONTROL register). -- The current function uses R0 and R1 registers to return the -- following values: -- R0 - address of the task frame -- R1 - execution mode current_id := ewok.sched.get_current; if current_id /= ID_UNUSED then ttype := ewok.tasks.tasks_list(current_id).ttype; else ttype := TASK_TYPE_KERNEL; end if; system.machine_code.asm ("mov r1, %0", inputs => t_task_type'asm_input ("r", ttype), clobber => "r1", volatile => true); return new_frame_a; -- -- Nested exceptions -- elsif frame_a.all.exc_return = 16#FFFF_FFF1# then --debug.log (debug.DEBUG, "Nested interrupt: " & t_interrupt'image (it)); -- System exceptions if it < INT_WWDG then case it is when INT_PENDSV => debug.panic ("Nested PendSV not handled."); when INT_SYSTICK => null; when others => if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then new_frame_a := interrupt_table(it).task_switch_handler (frame_a); else debug.panic ("Unhandled exception " & t_interrupt'image (it)); end if; end case; else -- External interrupts -- Execute kernel ISR if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then interrupt_table(it).handler (frame_a); -- User ISR are postponed (asynchronous execution) elsif interrupt_table(it).task_id /= ewok.tasks_shared.ID_UNUSED then ewok.isr.postpone_isr (it, interrupt_table(it).handler, interrupt_table(it).task_id); else debug.panic ("Unhandled interrupt " & t_interrupt'image (it)); end if; end if; return frame_a; -- -- Privileged exceptions -- elsif frame_a.all.exc_return = 16#FFFF_FFF9# then if interrupt_table(it).task_id = ewok.tasks_shared.ID_KERNEL then new_frame_a := interrupt_table(it).task_switch_handler (frame_a); end if; debug.panic ("Privileged exception " & t_interrupt'image (it)); return new_frame_a; -- -- Unsupported EXC_RETURN -- else debug.panic ("EXC_RETURN not supported"); return frame_a; end if; end default_sub_handler; end ewok.interrupts.handler;
charlie5/cBound
Ada
1,602
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_glx_is_enabled_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_tag : aliased xcb.xcb_glx_context_tag_t; capability : aliased Interfaces.Unsigned_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb.xcb_glx_is_enabled_request_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_is_enabled_request_t.Item, Element_Array => xcb.xcb_glx_is_enabled_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_is_enabled_request_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_glx_is_enabled_request_t.Pointer, Element_Array => xcb.xcb_glx_is_enabled_request_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_glx_is_enabled_request_t;
reznikmm/matreshka
Ada
3,734
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Style_Text_Blinking_Attributes is pragma Preelaborate; type ODF_Style_Text_Blinking_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Style_Text_Blinking_Attribute_Access is access all ODF_Style_Text_Blinking_Attribute'Class with Storage_Size => 0; end ODF.DOM.Style_Text_Blinking_Attributes;