repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
zhmu/ananas | Ada | 274 | adb | -- { dg-do run }
procedure Access9 is
type A_Type is access procedure;
type B_Type is new A_Type;
procedure Invoke (B : B_Type) is
begin
B.all;
end;
procedure Nested is begin null; end;
A : A_Type := Nested'Access;
begin
Invoke (B_Type (A));
end; |
fractal-mind/Amass | Ada | 1,023 | ads | -- Copyright 2020-2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local url = require("url")
local json = require("json")
name = "CertSpotter"
type = "cert"
function start()
set_rate_limit(2)
end
function vertical(ctx, domain)
local page, err = request(ctx, {['url']=api_url(domain)})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local resp = json.decode(page)
if (resp == nil or #resp == 0) then
return
end
for _, r in pairs(resp) do
for _, name in pairs(r['dns_names']) do
new_name(ctx, name)
end
end
end
function api_url(domain)
local params = {
['domain']=domain,
['include_subdomains']="true",
['match_wildcards']="true",
expand="dns_names",
}
return "https://api.certspotter.com/v1/issuances?" .. url.build_query_string(params)
end
|
reznikmm/matreshka | Ada | 3,654 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Elements;
package ODF.DOM.Office_Text_Elements is
pragma Preelaborate;
type ODF_Office_Text is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Office_Text_Access is
access all ODF_Office_Text'Class
with Storage_Size => 0;
end ODF.DOM.Office_Text_Elements;
|
reznikmm/matreshka | Ada | 4,562 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, 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 several constants to avoid duplication of 32-bit
-- and 64-bit optimized implementations of string management subprograms for
-- little-endian and big-endian platforms.
--
-- This package is for big-endian platforms.
------------------------------------------------------------------------------
with Interfaces;
with Matreshka.Internals.Utf16;
private package Matreshka.Internals.Strings.Constants is
pragma Preelaborate;
Terminator_Mask_32 : constant
array (Matreshka.Internals.Utf16.Utf16_String_Index range 0 .. 1)
of Interfaces.Unsigned_32
:= (0 => 16#0000_0000#,
1 => 16#FFFF_0000#);
-- This mask is used to set unused components of the element to zero on
-- 32-bits platforms.
Terminator_Mask_64 : constant
array (Matreshka.Internals.Utf16.Utf16_String_Index range 0 .. 3)
of Interfaces.Unsigned_64
:= (0 => 16#0000_0000_0000_0000#,
1 => 16#FFFF_0000_0000_0000#,
2 => 16#FFFF_FFFF_0000_0000#,
3 => 16#FFFF_FFFF_FFFF_0000#);
-- This mask is used to set unused components of the element to zero on
-- 64-bits platforms.
end Matreshka.Internals.Strings.Constants;
|
reznikmm/matreshka | Ada | 22,984 | 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_Packageable_Elements;
with AMF.String_Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Element_Imports.Collections;
with AMF.UML.Named_Elements.Collections;
with AMF.UML.Namespaces;
with AMF.UML.Package_Imports.Collections;
with AMF.UML.Package_Merges.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements.Collections;
with AMF.UML.Profile_Applications.Collections;
with AMF.UML.Profiles;
with AMF.UML.Stereotypes.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Template_Bindings.Collections;
with AMF.UML.Template_Parameters;
with AMF.UML.Template_Signatures;
with AMF.UML.Types.Collections;
with AMF.Visitors;
package AMF.Internals.UML_Packages is
type UML_Package_Proxy is
limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy
and AMF.UML.Packages.UML_Package with null record;
overriding function Get_URI
(Self : not null access constant UML_Package_Proxy)
return AMF.Optional_String;
-- Getter of Package::URI.
--
-- Provides an identifier for the package that can be used for many
-- purposes. A URI is the universally unique identification of the package
-- following the IETF URI specification, RFC 2396
-- http://www.ietf.org/rfc/rfc2396.txt and it must comply with those
-- syntax rules.
overriding procedure Set_URI
(Self : not null access UML_Package_Proxy;
To : AMF.Optional_String);
-- Setter of Package::URI.
--
-- Provides an identifier for the package that can be used for many
-- purposes. A URI is the universally unique identification of the package
-- following the IETF URI specification, RFC 2396
-- http://www.ietf.org/rfc/rfc2396.txt and it must comply with those
-- syntax rules.
overriding function Get_Nested_Package
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Getter of Package::nestedPackage.
--
-- References the packaged elements that are Packages.
overriding function Get_Nesting_Package
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Packages.UML_Package_Access;
-- Getter of Package::nestingPackage.
--
-- References the Package that owns this Package.
overriding procedure Set_Nesting_Package
(Self : not null access UML_Package_Proxy;
To : AMF.UML.Packages.UML_Package_Access);
-- Setter of Package::nestingPackage.
--
-- References the Package that owns this Package.
overriding function Get_Owned_Stereotype
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
-- Getter of Package::ownedStereotype.
--
-- References the Stereotypes that are owned by the Package
overriding function Get_Owned_Type
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Types.Collections.Set_Of_UML_Type;
-- Getter of Package::ownedType.
--
-- References the packaged elements that are Types.
overriding function Get_Package_Merge
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Package_Merges.Collections.Set_Of_UML_Package_Merge;
-- Getter of Package::packageMerge.
--
-- References the PackageMerges that are owned by this Package.
overriding function Get_Packaged_Element
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Getter of Package::packagedElement.
--
-- Specifies the packageable elements that are owned by this Package.
overriding function Get_Profile_Application
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Profile_Applications.Collections.Set_Of_UML_Profile_Application;
-- Getter of Package::profileApplication.
--
-- References the ProfileApplications that indicate which profiles have
-- been applied to the Package.
overriding function Get_Element_Import
(Self : not null access constant UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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_Package_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_Package_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_Package_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_Package_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_Owning_Template_Parameter
(Self : not null access constant UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 All_Applicable_Stereotypes
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
-- Operation Package::allApplicableStereotypes.
--
-- The query allApplicableStereotypes() returns all the directly or
-- indirectly owned stereotypes, including stereotypes contained in
-- sub-profiles.
overriding function Containing_Profile
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Profiles.UML_Profile_Access;
-- Operation Package::containingProfile.
--
-- The query containingProfile() returns the closest profile directly or
-- indirectly containing this package (or this package itself, if it is a
-- profile).
overriding function Makes_Visible
(Self : not null access constant UML_Package_Proxy;
El : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean;
-- Operation Package::makesVisible.
--
-- The query makesVisible() defines whether a Package makes an element
-- visible outside itself. Elements with no visibility and elements with
-- public visibility are made visible.
overriding function Must_Be_Owned
(Self : not null access constant UML_Package_Proxy)
return Boolean;
-- Operation Package::mustBeOwned.
--
-- The query mustBeOwned() indicates whether elements of this type must
-- have an owner.
overriding function Nested_Package
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation Package::nestedPackage.
--
-- Missing derivation for Package::/nestedPackage : Package
overriding function Owned_Stereotype
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Stereotypes.Collections.Set_Of_UML_Stereotype;
-- Operation Package::ownedStereotype.
--
-- Missing derivation for Package::/ownedStereotype : Stereotype
overriding function Owned_Type
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Types.Collections.Set_Of_UML_Type;
-- Operation Package::ownedType.
--
-- Missing derivation for Package::/ownedType : Type
overriding function Visible_Members
(Self : not null access constant UML_Package_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element;
-- Operation Package::visibleMembers.
--
-- The query visibleMembers() defines which members of a Package can be
-- accessed outside it.
overriding function Exclude_Collisions
(Self : not null access constant UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_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 UML_Package_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element;
-- Operation Namespace::ownedMember.
--
-- Missing derivation for Namespace::/ownedMember : NamedElement
overriding function All_Owning_Packages
(Self : not null access constant UML_Package_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_Package_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_Package_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Is_Compatible_With
(Self : not null access constant UML_Package_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 UML_Package_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding function Is_Template
(Self : not null access constant UML_Package_Proxy)
return Boolean;
-- Operation TemplateableElement::isTemplate.
--
-- The query isTemplate() returns whether this templateable element is
-- actually a template.
overriding function Parameterable_Elements
(Self : not null access constant UML_Package_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 procedure Enter_Element
(Self : not null access constant UML_Package_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_Package_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_Package_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_Packages;
|
BrickBot/Bound-T-H8-300 | Ada | 10,846 | ads | -- Assertions.Source_Marks (decl)
--
-- Marks in source-code files are used to identify source-code lines
-- which in turn identify target-program contexts (subprograms, loops,
-- calls, ...) to which assertions can be applied.
--
-- This package provides operations that load mark definitions from
-- text files ("mark-definition files") into an internal "mark set",
-- and operations that query the mark set for marks with desired
-- properties. The query operations are used by the process that
-- matches assertions to target-program contexts (not implemented here).
--
-- The mark-definition files have a simple and well-defined tabular
-- format. Mark-definition files are normally created by separate tools,
-- not embedded in this program, that scan the source-code files of the
-- target program under analysis and detect and extract the mark
-- definitions. Mark definitions in source-code files are usually
-- written as comment lines, according to the comment syntax of the
-- relevant programming language, with some specific keyword or symbol
-- that identifies the comment as a marker definition.
--
-- 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.2 $
-- $Date: 2015/10/24 19:36:46 $
--
-- $Log: assertions-source_marks.ads,v $
-- Revision 1.2 2015/10/24 19:36:46 niklas
-- Moved to free licence.
--
-- Revision 1.1 2009-03-27 13:57:12 niklas
-- BT-CH-0167: Assertion context identified by source-code markers.
--
package Assertions.Source_Marks is
--
--- Marks in source files
--
type Marked_Part_T is (Any, Subprogram, Luup, Call);
--
-- A mark definition can specify the kind of program part
-- that it marks. "Any" means "unspecified".
type Marker_Relation_T is (Any, Here, Above, Below, Contain, Span);
--
-- A mark definition can specify the positional relation between
-- the marked source-code line and the program part that will be
-- identified by the mark.
--
-- Any
-- Positional relation not specified (in the mark definition; it
-- can still be specified in an assertion that uses the marker).
-- Here
-- The mark line itself, or a line very close to it.
-- Above
-- The program part before the mark line.
-- Below
-- The program part after the mark line.
-- Contain
-- The program part that contains instruction(s) (flow-graph
-- steps) marked by this marker. At present, the containing part
-- can only be a loop.
-- Span
-- The program part that spans the mark line, in the sense that
-- the number of the mark line is in the range of line numbers
-- connected to the instructions in this program part. At present,
-- the spanning part can only be a loop.
--
type Mark_T is record
Marker : Marker_Name_T;
File : Source_File_Name_T;
Line : Line_Number_T;
Part : Marked_Part_T;
Relation : Marker_Relation_T;
end record;
--
-- A marked point or part in a source file.
--
-- Marker
-- The marker name: an identifying string. Note that there can
-- be several marker definitions with the same marker name, in
-- the same or several source-code files. The marker name is a
-- string of no particular form.
-- File
-- The name of the source file that contains the marked point.
-- The source-file name is basically a string of no particular
-- form, although for approximate matching the source-file name
-- can be divided into two parts, the directory path (folder path)
-- and the base name (file name). If approximate file-name
-- matching is in use, the File component is "canonized" as
-- required (by omitting the directory path and/or translating
-- to lower-case letters).
-- Line
-- The number of the Line, in the source-code File, that is
-- marked with this Marker. The precise meaning depends on the
-- Relation, see below. The number is positive (>= 1).
-- Part
-- Optional specification of the kind of program part that
-- is marked. "Any" means unspecified.
-- Relation
-- The positional relationship of the program-part that is the
-- real target of the mark, to the marked source-code Line.
--
-- When an assertion defines its context by a Marker name, this name
-- connects the assertion to some mark definitions (Mark_T), and thus
-- to some pairs of (source File name, source Line number). These
-- pairs then connect the assertion to the source-line-to-code-addres
-- mapping in the target program's symbol-table, and thus to some
-- elements of the control-flow and call graphs of the target program.
--
-- The Marker names have no relation to any entities in the target
-- program's symbol-table. The names are just a link between assertions
-- that mention this name and source-code lines marked with this name.
--
-- The "line" is the smallest grain of marking. We do not resolve
-- marked points to column positions within the line.
--
-- The Line is not always the number of the mark line, but can
-- be the number of some line before or after the mark line.
-- If the mark definition specifies "above", the Line is the
-- number of the closest preceding "markable" source-code line
-- in the same file. If the definition specifies "below", the
-- closest following "markable" line is used. If the definition
-- specifies "here", the marker line itself is used.
--
-- What is a "markable" line depends on the source language and
-- the tool that extracts mark definitions from the source file.
-- The intent is that "markable" lines should be likely to cause
-- some instructions to be generated such that the target compiler
-- connects the addresses of those instructions to the line-number
-- of the "markable" line. Therefore all blank lines and all
-- comment lines are normally considered "not markable", and this
-- usually includes mark lines themselves.
--
-- Consider the following example, where the lines are numbered on
-- the left:
--
-- 32 foo (3, x, a);
-- 33
-- 34 --Mark below "bar-call"
-- 35 --Mark above "foo-call"
-- 36
-- 37 -- Now to lower the bar:
-- 38 bar (x+y);
-- 39 --Mark "after-bar"
--
-- The marker "bar-call" marks line 37; "foo-call" marks line 32;
-- and "after-bar" marks line 39.
--
-- The positional relation specified in a mark definition thus
-- has a double influence on the resulting Mark_T: firstly, it
-- defines which Line is picked as the "mark line"; secondly, it
-- may TBA influence the assertion-matching process by defining the
-- expected positional relation between this Line and the marked
-- program part.
--
-- A mark definition might specify both "contain" (or "span") and
-- "above" or "below". In this case, the above/below choice defines
-- the Line, while the Relation becomes Contain (or Span) to show
-- that the marked part is expected to contain (or span) the Line.
function Image (Item : Mark_T) return String;
--
-- A description of the mark, for human understanding.
--
--- The mark set
--
--
-- This package maintains an internal set of marks, built up by
-- loading mark definition files. The marks in the mark set are
-- keyed (accessed) by the pair (source-file name, marker-name).
-- The mark set may contain zero, one, or several marks with a
-- given File name and a given Marker name. Moreover, the same
-- Line may be marked by different Marker names, with the same
-- or different Part and Relation properties.
--
-- Depending on command-line options, the top-level key, the
-- source-file name, may be abbreviated to the base file name
-- (dropping the directory paths) and/or translated to lower-case
-- letters.
--
--- Loading mark definition files
--
procedure Load_File (
File_Name : in String;
Valid : out Boolean);
--
-- Reads the mark definition file identified File_Name and
-- loads its mark definitions into the marker set.
--
-- Serious errors make Valid False; some marks may nevertheless
-- be loaded before the error is detected.
--
--- Picking marks from the mark set
--
type Mark_List_T is array (Positive range <>) of Mark_T;
--
-- A set or list of marks. Order is usually irrelevant.
function Marks (
Marker : Marker_Name_T;
From : Source_File_Name_T;
Min : Line_Number_T;
Max : Line_Number_T)
return Mark_List_T;
--
-- All the known (loaded) markings with this Marker name, From
-- this source-code file, and marking lines in the line-number
-- range Min .. Max.
--
-- Marker-name matching is exact and case-sensitive.
--
-- Source-file-name matching can be flexible with respect
-- to full path vs base-name matching and case-sensitivity.
end Assertions.Source_Marks;
|
SayCV/rtems-addon-packages | Ada | 5,177 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 2000-2008,2009 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: Eugene V. Melaragno <[email protected]> 2000
-- Version Control
-- $Revision$
-- $Date$
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body ncurses2.genericPuts is
procedure myGet (Win : Window := Standard_Window;
Str : out BS.Bounded_String;
Len : Integer := -1)
is
function Wgetnstr (Win : Window;
Str : char_array;
Len : int) return int;
pragma Import (C, Wgetnstr, "wgetnstr");
N : Integer := Len;
Txt : char_array (0 .. size_t (Max_Length));
xStr : String (1 .. Max_Length);
Cnt : Natural;
begin
if N < 0 then
N := Max_Length;
end if;
if N > Max_Length then
raise Constraint_Error;
end if;
Txt (0) := Interfaces.C.char'First;
if Wgetnstr (Win, Txt, C_Int (N)) = Curses_Err then
raise Curses_Exception;
end if;
To_Ada (Txt, xStr, Cnt, True);
Str := To_Bounded_String (xStr (1 .. Cnt));
end myGet;
procedure myPut (Str : out BS.Bounded_String;
i : Integer;
Base : Number_Base := 10) is
package Int_IO is new Integer_IO (Integer); use Int_IO;
tmp : String (1 .. BS.Max_Length);
begin
Put (tmp, i, Base);
Str := To_Bounded_String (tmp);
Trim (Str, Ada.Strings.Trim_End'(Ada.Strings.Left));
end myPut;
procedure myAdd (Str : BS.Bounded_String) is
begin
Add (Str => To_String (Str));
end myAdd;
-- from ncurses-aux
procedure Fill_String (Cp : chars_ptr;
Str : out BS.Bounded_String)
is
-- Fill the string with the characters referenced by the
-- chars_ptr.
--
Len : Natural;
begin
if Cp /= Null_Ptr then
Len := Natural (Strlen (Cp));
if Max_Length < Len then
raise Constraint_Error;
end if;
declare
S : String (1 .. Len);
begin
S := Value (Cp);
Str := To_Bounded_String (S);
end;
else
Str := Null_Bounded_String;
end if;
end Fill_String;
end ncurses2.genericPuts;
|
zhmu/ananas | Ada | 492 | adb | -- { dg-do compile }
-- { dg-options "-Wall" }
with Ada.Iterator_Interfaces;
procedure Warn17 is
type Cursor is null record;
function Has_Element (Position : Cursor) return Boolean;
function Has_Element (Position : Cursor) return Boolean is (True);
package My_Iterator is
new Ada.Iterator_Interfaces (Cursor, Has_Element);
type Iterator is abstract new My_Iterator.Forward_Iterator with null record;
pragma Unreferenced (Iterator);
begin
null;
end Warn17;
|
zhmu/ananas | Ada | 3,875 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . N U M E R I C S . D I S C R E T E _ R A N D O M --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Note: the implementation used in this package is a version of the
-- Mersenne Twister. See s-rannum.adb for details and references.
with System.Random_Numbers;
generic
type Result_Subtype is (<>);
package Ada.Numerics.Discrete_Random with
SPARK_Mode => Off
is
-- Basic facilities
type Generator is limited private;
function Random (Gen : Generator) return Result_Subtype;
function Random
(Gen : Generator;
First : Result_Subtype;
Last : Result_Subtype) return Result_Subtype
with Post => Random'Result in First .. Last;
procedure Reset (Gen : Generator; Initiator : Integer);
procedure Reset (Gen : Generator);
-- Advanced facilities
type State is private;
procedure Save (Gen : Generator; To_State : out State);
procedure Reset (Gen : Generator; From_State : State);
Max_Image_Width : constant := System.Random_Numbers.Max_Image_Width;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
private
type Generator is new System.Random_Numbers.Generator;
type State is new System.Random_Numbers.State;
end Ada.Numerics.Discrete_Random;
|
zhmu/ananas | Ada | 455 | ads | package Tag2_Pkg is
type Monitor_Interface is interface;
type Root is abstract tagged null record;
type Monitor_Type is abstract new Root
and Monitor_Interface with null record;
type Synchronous_Monitor (Size : Positive) is new Monitor_Type with
record
Queue : String (1 .. Size);
end record;
type Virtual_Integer_Register_Refresher (Size : Positive) is
new Synchronous_Monitor (Size) with null record;
end;
|
stcarrez/etherscope | Ada | 3,388 | adb | -----------------------------------------------------------------------
-- etherscope-analyzer -- Packet analyzer
-- Copyright (C) 2016 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 EtherScope.Analyzer.Ethernet is
use type EtherScope.Stats.Device_Count;
-- ------------------------------
-- Analyze the packet and update the analysis.
-- ------------------------------
procedure Analyze (Ether : in Net.Headers.Ether_Header_Access;
Length : in Net.Uint16;
Result : in out Analysis;
Samples : in out EtherScope.Stats.Graph_Samples;
Device : out Device_Index) is
use type Net.Uint16;
use type Net.Uint32;
use type Net.Ether_Addr;
Found : Boolean := False;
begin
EtherScope.Stats.Add (Result.Global, Net.Uint32 (Length));
-- Collect information by device/Ethernet address.
for I in 1 .. Result.Dev_Count loop
if Result.Devices (I).Mac = Ether.Ether_Shost then
Device := I;
Found := True;
exit;
end if;
end loop;
if not Found then
if Result.Dev_Count < Device_Index'Last then
Result.Dev_Count := Result.Dev_Count + 1;
Result.Devices (Result.Dev_Count).Mac := Ether.Ether_Shost;
end if;
Device := Result.Dev_Count;
end if;
EtherScope.Stats.Add (Samples, EtherScope.Stats.G_ETHERNET,
Result.Devices (Device).Stats, Net.Uint32 (Length));
-- Collect information by Ethernet protocol.
for I in Result.Protocols'Range loop
if Result.Protocols (I).Stats.Packets = 0 then
Result.Protocols (I).Proto := Ether.Ether_Type;
end if;
if Result.Protocols (I).Proto = Ether.Ether_Type or else I = Result.Protocols'Last then
EtherScope.Stats.Add (Result.Protocols (I).Stats, Net.Uint32 (Length));
exit;
end if;
end loop;
end Analyze;
-- ------------------------------
-- Compute the bandwidth utilization for different devices and protocols.
-- ------------------------------
procedure Update_Rates (Current : in out Analysis;
Previous : in out Analysis;
Dt : in Positive) is
begin
for I in 1 .. Current.Dev_Count loop
if I <= Previous.Dev_Count then
EtherScope.Stats.Update_Rate (Current.Devices (I).Stats, Previous.Devices (I).Stats, Dt);
else
Previous.Devices (I) := Current.Devices (I);
end if;
end loop;
end Update_Rates;
end EtherScope.Analyzer.Ethernet;
|
zertovitch/excel-writer | Ada | 723 | ads | -- Freeware, author: G. de Montmollin
package Spreadsheet_References is
-- References in spreadsheets are usually
-- encoded in one of the following ways:
--
-- "A1" : column is A, B, C, ...; row is 1, 2, 3, 4, ...
--
-- "R1C1": 'R', the row number, 'C', the column number.
type Reference_Style is (A1, R1C1);
function Encode_Reference
(row, column : Positive;
style : Reference_Style := A1)
return String;
Invalid_spreadsheet_reference : exception;
function Decode_Row (reference : String) return Positive;
function Decode_Column (reference : String) return Positive;
procedure Split (reference : String; row, column : out Positive);
end Spreadsheet_References;
|
stcarrez/dynamo | Ada | 26,084 | adb | -- part of AdaYaml, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Strings.UTF_Encoding.Strings;
with Ada.Strings.UTF_Encoding.Wide_Strings;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Text.Builder;
package body Yaml.Lexer.Evaluation is
-----------------------------------------------------------------------------
-- constant UTF-8 strings that may be generated from escape sequences
-----------------------------------------------------------------------------
function Next_Line return Ada.Strings.UTF_Encoding.UTF_8_String is
(Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#85#)));
function Non_Breaking_Space return Ada.Strings.UTF_Encoding.UTF_8_String is
(Ada.Strings.UTF_Encoding.Strings.Encode ("" & Character'Val (16#A0#)));
function Line_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is
(Ada.Strings.UTF_Encoding.Wide_Strings.Encode
("" & Wide_Character'Val (16#2028#)));
function Paragraph_Separator return Ada.Strings.UTF_Encoding.UTF_8_String is
(Ada.Strings.UTF_Encoding.Wide_Strings.Encode
("" & Wide_Character'Val (16#2029#)));
-----------------------------------------------------------------------------
-- implementation
-----------------------------------------------------------------------------
procedure Read_Plain_Scalar (L : in out Instance; T : out Token) is
Target : Text.Builder.Reference := Text.Builder.Create (L.Pool);
After_Newline_State : constant State_Type :=
(if L.Flow_Depth + L.Annotation_Depth = 0 then Line_Indentation'Access
else Flow_Line_Indentation'Access);
Line_Start_Pos : Positive;
begin
L.Seen_Multiline := False;
Start_Token (L);
if L.Proposed_Indentation /= -1 then
L.Indentation := L.Proposed_Indentation;
L.Proposed_Indentation := -1;
end if;
T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>,
Kind => Plain_Scalar);
Multiline_Loop : loop
Line_Start_Pos := L.Pos - 1;
Inline_Loop : loop
L.Cur := Next (L);
case L.Cur is
when ' ' =>
T.End_Pos := Cur_Mark (L);
declare
Space_Start : constant Positive := L.Pos - 1;
begin
Space_Loop : loop
L.Cur := Next (L);
case L.Cur is
when Line_Feed | Carriage_Return =>
Target.Append
(L.Buffer (Line_Start_Pos .. Space_Start - 1));
exit Inline_Loop;
when End_Of_Input =>
Target.Append
(L.Buffer (Line_Start_Pos .. Space_Start - 1));
L.State := Stream_End'Access;
exit Multiline_Loop;
when '#' =>
Target.Append
(L.Buffer (Line_Start_Pos .. Space_Start - 1));
L.State := Expect_Line_End'Access;
exit Multiline_Loop;
when ':' =>
if not Next_Is_Plain_Safe (L) then
Target.Append
(L.Buffer (Line_Start_Pos .. Space_Start - 1));
L.State := Inside_Line'Access;
exit Multiline_Loop;
end if;
exit Space_Loop;
when Flow_Indicator =>
if L.Flow_Depth + L.Annotation_Depth > 0 then
Target.Append
(L.Buffer (Line_Start_Pos .. Space_Start - 1));
L.State := Inside_Line'Access;
exit Multiline_Loop;
end if;
exit Space_Loop;
when ')' =>
if L.Annotation_Depth > 0 then
Target.Append
(L.Buffer (Line_Start_Pos .. Space_Start - 1));
L.State := Inside_Line'Access;
exit Multiline_Loop;
end if;
exit Space_Loop;
when ' ' => null;
when others => exit Space_Loop;
end case;
end loop Space_Loop;
end;
when ':' =>
if not Next_Is_Plain_Safe (L) then
Target.Append
(L.Buffer (Line_Start_Pos .. L.Pos - 2));
T.End_Pos := Cur_Mark (L);
L.State := Inside_Line'Access;
exit Multiline_Loop;
end if;
when Flow_Indicator =>
if L.Flow_Depth + L.Annotation_Depth > 0 then
Target.Append
(L.Buffer (Line_Start_Pos .. L.Pos - 2));
T.End_Pos := Cur_Mark (L);
L.State := Inside_Line'Access;
exit Multiline_Loop;
end if;
when ')' =>
if L.Annotation_Depth > 0 then
Target.Append
(L.Buffer (Line_Start_Pos .. L.Pos - 2));
T.End_Pos := Cur_Mark (L);
L.State := Inside_Line'Access;
exit Multiline_Loop;
end if;
when Line_Feed | Carriage_Return =>
Target.Append
(L.Buffer (Line_Start_Pos .. L.Pos - 2));
T.End_Pos := Cur_Mark (L);
exit Inline_Loop;
when End_Of_Input =>
Target.Append
(L.Buffer (Line_Start_Pos .. L.Pos - 2));
if L.Pos /= L.Line_Start then
T.End_Pos := Cur_Mark (L);
end if;
L.State := Stream_End'Access;
exit Multiline_Loop;
when others => null;
end case;
end loop Inline_Loop;
End_Line (L);
declare
Newlines : Positive := 1;
begin
Newline_Loop : loop
case Start_Line (L) is
when Content =>
if L.Pos - L.Line_Start - 1 <= L.Indentation then
L.State := After_Newline_State;
exit Multiline_Loop;
end if;
exit Newline_Loop;
when Directives_End_Marker =>
L.State := Line_Dir_End'Access;
exit Multiline_Loop;
when Document_End_Marker =>
L.State := Line_Doc_End'Access;
exit Multiline_Loop;
when Stream_End =>
exit Multiline_Loop;
when Comment =>
End_Line (L);
L.State := Line_Start'Access;
exit Multiline_Loop;
when Newline =>
End_Line (L);
end case;
Newlines := Newlines + 1;
end loop Newline_Loop;
if
(L.Cur = ':' and then not Next_Is_Plain_Safe (L)) or else
L.Cur = '#' or else (L.Cur in Flow_Indicator and then
L.Flow_Depth + L.Annotation_Depth > 0)
or else (L.Cur = ')' and then L.Annotation_Depth > 0)
then
L.State := After_Newline_State;
exit Multiline_Loop;
end if;
L.Seen_Multiline := True;
if Newlines = 1 then
Target.Append (' ');
else
Target.Append ((1 .. Newlines - 1 => Line_Feed));
end if;
end;
end loop Multiline_Loop;
L.Value := Target.Lock;
end Read_Plain_Scalar;
procedure Process_Quoted_Whitespace (L : in out Instance; Init : Natural;
Target : in out Text.Builder.Reference);
procedure Process_Quoted_Whitespace (L : in out Instance; Init : Natural;
Target : in out Text.Builder.Reference) is
Newlines : Natural := Init;
First_Space : constant Positive := L.Pos - 1;
begin
loop
case L.Cur is
when ' ' => null;
when Line_Feed =>
Handle_LF (L);
L.Cur := L.Next;
exit;
when Carriage_Return =>
Handle_CR (L);
L.Cur := L.Next;
exit;
when others =>
Target.Append (L.Buffer (First_Space .. L.Pos - 2));
return;
end case;
L.Cur := Next (L);
end loop;
L.Seen_Multiline := True;
loop
case Start_Line (L) is
when Content | Comment => exit;
when Directives_End_Marker =>
raise Lexer_Error with "Illegal '---' within quoted scalar";
when Document_End_Marker =>
raise Lexer_Error with "Illegal '...' within quoted scalar";
when Newline => End_Line (L);
when Stream_End =>
raise Lexer_Error with
"Unexpected end of input (quoted string not closed)";
end case;
Newlines := Newlines + 1;
end loop;
if Newlines = 0 then
null;
elsif Newlines = 1 then
Target.Append (' ');
else
Target.Append ((1 .. Newlines - 1 => Line_Feed));
end if;
end Process_Quoted_Whitespace;
procedure Read_Single_Quoted_Scalar (L : in out Instance; T : out Token) is
Target : Text.Builder.Reference := Text.Builder.Create (L.Pool);
Literal_Start : Positive;
begin
L.Seen_Multiline := False;
Start_Token (L);
if L.Proposed_Indentation /= -1 then
L.Indentation := L.Proposed_Indentation;
L.Proposed_Indentation := -1;
end if;
Literal_Start := L.Pos;
L.Cur := Next (L);
loop
case L.Cur is
when End_Of_Input =>
raise Lexer_Error with
"Unexpected end of input (quoted string not closed)";
when ''' =>
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
L.Cur := Next (L);
if L.Cur = ''' then
Target.Append (''');
Literal_Start := L.Pos;
L.Cur := Next (L);
else
exit;
end if;
when ' ' | Line_Feed | Carriage_Return =>
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
Process_Quoted_Whitespace (L, 1, Target);
Literal_Start := L.Pos - 1;
when others =>
L.Cur := Next (L);
end case;
end loop;
T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L),
Kind => Single_Quoted_Scalar);
L.Value := Target.Lock;
end Read_Single_Quoted_Scalar;
subtype Hex_Code_Point is Natural range 0 .. 16#1FFFFF#;
procedure Read_Hex_Sequence (L : in out Instance; Length : Positive;
Target : in out Text.Builder.Reference);
procedure Read_Hex_Sequence (L : in out Instance; Length : Positive;
Target : in out Text.Builder.Reference) is
Char_Pos : Hex_Code_Point := 0;
Start_Pos : constant Positive := L.Pos;
begin
-- first, we make sure that this is a valid escape sequence. it is
-- important to not calculate its value directly because that may lead
-- to an overflow before we checked that the escape sequence is
-- syntactically correct. We only want to report that the value is out of
-- range if it is a valid escape sequence.
for I in 0 .. Length - 1 loop
if not (L.Buffer (Start_Pos + I) in Digit | 'a' .. 'f' | 'A' .. 'F')
then
raise Lexer_Error with
"Invalid character in hex escape sequence: " &
Escaped (L.Buffer (Start_Pos + I));
end if;
end loop;
for Exponent in reverse 0 .. Length - 1 loop
L.Cur := Next (L);
case L.Cur is
when Digit =>
Char_Pos := Char_Pos + (16 ** Exponent) *
(Character'Pos (L.Cur) - Character'Pos ('0'));
when 'a' .. 'f' =>
Char_Pos := Char_Pos + (16 ** Exponent) *
(Character'Pos (L.Cur) - Character'Pos ('a') + 10);
when 'A' .. 'F' =>
Char_Pos := Char_Pos + (16 ** Exponent) *
(Character'Pos (L.Cur) - Character'Pos ('A') + 10);
when others =>
null; -- cannot happen because of the check above
end case;
end loop;
Target.Append (Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode (
"" & Wide_Wide_Character'Val (Char_Pos)));
exception
when Constraint_Error =>
raise Lexer_Error with
"Invalid hex escape sequence (value too large): " &
L.Buffer (Start_Pos .. Start_Pos + Length - 1);
end Read_Hex_Sequence;
procedure Read_Double_Quoted_Scalar (L : in out Instance; T : out Token) is
Target : Text.Builder.Reference := Text.Builder.Create (L.Pool);
Literal_Start : Positive;
begin
L.Seen_Multiline := False;
Start_Token (L);
if L.Proposed_Indentation /= -1 then
L.Indentation := L.Proposed_Indentation;
L.Proposed_Indentation := -1;
end if;
Literal_Start := L.Pos;
L.Cur := Next (L);
loop
<<Handle_Char>>
case L.Cur is
when End_Of_Input =>
raise Lexer_Error with
"Unexpected end of input (quoted string not closed)";
when '\' =>
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
L.Cur := Next (L);
Literal_Start := L.Pos;
case L.Cur is
when '0' => Target.Append (Character'Val (0));
when 'a' => Target.Append (Character'Val (7));
when 'b' => Target.Append (Character'Val (8));
when 't' | Character'Val (9) =>
Target.Append (Character'Val (9));
when 'n' => Target.Append (Line_Feed);
when 'v' => Target.Append (Character'Val (11));
when 'f' => Target.Append (Character'Val (12));
when 'r' => Target.Append (Carriage_Return);
when 'e' => Target.Append (Character'Val (27));
when ' ' | '"' | '/' | '\' => Target.Append (L.Cur);
when 'N' => Target.Append (Next_Line);
when '_' => Target.Append (Non_Breaking_Space);
when 'L' => Target.Append (Line_Separator);
when 'P' => Target.Append (Paragraph_Separator);
when 'x' =>
Read_Hex_Sequence (L, 2, Target);
Literal_Start := L.Pos;
when 'u' =>
Read_Hex_Sequence (L, 4, Target);
Literal_Start := L.Pos;
when 'U' =>
Read_Hex_Sequence (L, 8, Target);
Literal_Start := L.Pos;
when Line_Feed | Carriage_Return =>
Process_Quoted_Whitespace (L, 0, Target);
Literal_Start := L.Pos - 1;
goto Handle_Char;
when others =>
raise Lexer_Error with
"Illegal character in escape sequence: " &
Escaped (L.Cur);
end case;
when '"' =>
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
exit;
when ' ' | Line_Feed | Carriage_Return =>
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
Process_Quoted_Whitespace (L, 1, Target);
Literal_Start := L.Pos - 1;
goto Handle_Char;
when others => null;
end case;
L.Cur := Next (L);
end loop;
L.Cur := Next (L);
T := (Start_Pos => L.Token_Start_Mark, End_Pos => Cur_Mark (L),
Kind => Double_Quoted_Scalar);
L.Value := Target.Lock;
end Read_Double_Quoted_Scalar;
procedure Read_Block_Scalar (L : in out Instance; T : out Token) is
type Chomp_Style is (Clip, Strip, Keep);
Chomp : Chomp_Style := Clip;
Indent : Natural := 0;
Separation_Lines : Natural := 0;
Content_Start : Positive;
Target : Text.Builder.Reference := Text.Builder.Create (L.Pool);
begin
Start_Token (L);
T := (Start_Pos => L.Token_Start_Mark, End_Pos => <>,
Kind => (if L.Cur = '>' then Folded_Scalar else Literal_Scalar));
-- header
loop
L.Cur := Next (L);
case L.Cur is
when '+' =>
if Chomp /= Clip then
raise Lexer_Error with "Multiple chomping indicators!";
end if;
Chomp := Keep;
when '-' =>
if Chomp /= Clip then
raise Lexer_Error with "Multiple chomping indicators!";
end if;
Chomp := Strip;
when '1' .. '9' =>
if Indent /= 0 then
raise Lexer_Error with "Multiple indentation indicators!";
end if;
Indent := Natural'Max (0, L.Indentation) +
Character'Pos (L.Cur) - Character'Pos ('0');
when ' ' =>
while L.Cur = ' ' loop
L.Cur := Next (L);
end loop;
if not (L.Cur in Comment_Or_Line_End) then
raise Lexer_Error with
"Illegal character after block scalar header: " &
Escaped (L.Cur);
end if;
exit;
when Line_End => exit;
when others =>
raise Lexer_Error with
"Illegal character in block scalar header: " & Escaped (L.Cur);
end case;
end loop;
End_Line (L);
-- determining indentation and leading empty lines
declare
Max_Leading_Spaces : Natural := 0;
begin
loop
if Indent = 0 then
while L.Cur = ' ' loop
L.Cur := Next (L);
end loop;
else
Max_Leading_Spaces := L.Line_Start + Indent;
while L.Cur = ' ' and then L.Pos <= Max_Leading_Spaces loop
L.Cur := Next (L);
end loop;
end if;
case L.Cur is
when Line_Feed | Carriage_Return =>
T.End_Pos := Cur_Mark (L);
Max_Leading_Spaces :=
Natural'Max (Max_Leading_Spaces, L.Pos - 1 - L.Line_Start);
End_Line (L);
Separation_Lines := Separation_Lines + 1;
when End_Of_Input =>
L.State := Stream_End'Access;
goto End_Of_Input_Target;
when others =>
if Indent = 0 then
Indent := L.Pos - L.Line_Start - 1;
if Indent <= Indentation_Type'Max (0, L.Indentation) then
L.State := Line_Indentation'Access;
goto Finalize;
elsif Indent < Max_Leading_Spaces then
raise Lexer_Error with
"Leading all-spaces line contains too many spaces.";
end if;
elsif L.Pos - L.Line_Start - 1 < Indent then
goto Finalize;
end if;
exit;
end case;
end loop;
if Separation_Lines > 0 then
Target.Append ((1 .. Separation_Lines => Line_Feed));
end if;
end;
-- read block scalar content
Block_Content : loop
-- content of line
Content_Start := L.Pos - 1;
while not (L.Cur in Line_End) loop
L.Cur := Next (L);
end loop;
Target.Append (L.Buffer (Content_Start .. L.Pos - 2));
Separation_Lines := 0;
if L.Cur = End_Of_Input then
L.State := Stream_End'Access;
goto End_Of_Input_Target;
end if;
Separation_Lines := Separation_Lines + 1;
T.End_Pos := Cur_Mark (L);
End_Line (L);
-- empty lines and indentation of next line
loop
declare
Indent_Pos : constant Natural := L.Line_Start + Indent;
begin
while L.Cur = ' ' and then L.Pos - 1 < Indent_Pos loop
L.Cur := Next (L);
end loop;
case L.Cur is
when Carriage_Return | Line_Feed =>
T.End_Pos := Cur_Mark (L);
Separation_Lines := Separation_Lines + 1;
End_Line (L);
when End_Of_Input =>
L.State := Stream_End'Access;
goto End_Of_Input_Target;
when others =>
if L.Pos - 1 < Indent_Pos then
exit Block_Content;
else
exit;
end if;
end case;
end;
end loop;
-- line folding
if T.Kind = Literal_Scalar then
Target.Append ((1 .. Separation_Lines => Line_Feed));
elsif Separation_Lines = 1 then
Target.Append (' ');
else
Target.Append ((1 .. Separation_Lines - 1 => Line_Feed));
end if;
end loop Block_Content;
if L.Pos - L.Line_Start - 1 > Indentation_Type'Max (0, L.Indentation) then
if L.Cur = '#' then
L.State := Expect_Line_End'Access;
else
raise Lexer_Error with
"This line at " & Escaped (L.Cur) & " is less indented than necessary."
& L.Cur_Line'Img;
end if;
elsif L.Pos = L.Line_Start + 1 then
L.State := Line_Start'Access;
else
L.State := Line_Indentation'Access;
end if;
<<Finalize>>
T.End_Pos := Cur_Mark (L);
goto Finish;
<<End_Of_Input_Target>>
-- if we encounter the stream end directly after a newline character,
-- we must have stored the T.End_Pos beforehand because we cannot
-- calculate it back (we do not know how long the recent line was).
if L.Pos /= L.Line_Start + 1 then
T.End_Pos := Cur_Mark (L);
-- the generated End_Pos is *after* the stream end char, which is one
-- too far; compensate here.
T.End_Pos.Index := T.End_Pos.Index - 1;
T.End_Pos.Column := T.End_Pos.Column - 1;
end if;
<<Finish>>
T.End_Pos := Cur_Mark (L);
-- handling trailing empty lines
case Chomp is
when Strip => null;
when Clip =>
if Target.Length > 0 then
Target.Append (Line_Feed);
end if;
when Keep => Target.Append ((1 .. Separation_Lines => Line_Feed));
end case;
L.Value := Target.Lock;
end Read_Block_Scalar;
procedure Read_URI (L : in out Instance; Restricted : Boolean) is
Target : Text.Builder.Reference := Text.Builder.Create (L.Pool);
End_With_Space : constant Boolean := L.Cur /= '<';
Literal_Start : Positive;
begin
if End_With_Space then
if (not Restricted) and then L.Cur in '[' | ']' | ',' then
raise Lexer_Error with "Flow indicator cannot start tag prefix";
end if;
Literal_Start := L.Pos - 1;
else
Literal_Start := L.Pos;
L.Cur := Next (L);
end if;
loop
case L.Cur is
when Space_Or_Line_End =>
if End_With_Space then
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
exit;
else
raise Lexer_Error with "Unclosed verbatim tag";
end if;
when '%' =>
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
Read_Hex_Sequence (L, 2, Target);
Literal_Start := L.Pos;
when Tag_Char => null;
when '[' | ']' | ',' =>
if Restricted then
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
exit;
end if;
when '!' =>
if Restricted then
raise Lexer_Error with "Illegal '!' in tag suffix!";
end if;
when '>' =>
if End_With_Space then
raise Lexer_Error with "Illegal character in URI: "">""";
else
Target.Append (L.Buffer (Literal_Start .. L.Pos - 2));
L.Cur := Next (L);
exit;
end if;
when others =>
raise Lexer_Error with "Illegal character in URI: " &
Escaped (L.Cur);
end case;
L.Cur := Next (L);
end loop;
L.Value := Target.Lock;
end Read_URI;
end Yaml.Lexer.Evaluation;
|
zhmu/ananas | Ada | 5,904 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- G N A T . C U R R E N T _ E X C E P T I O N --
-- --
-- S p e c --
-- --
-- Copyright (C) 1996-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides routines for obtaining the current exception
-- information in Ada 83 style. In Ada 83, there was no official method
-- for obtaining exception information, but a number of vendors supplied
-- routines for this purpose, and this package closely approximates the
-- interfaces supplied by DEC Ada 83 and VADS Ada.
-- The routines in this package are associated with a particular exception
-- handler, and can only be called from within an exception handler. See
-- also the package GNAT.Most_Recent_Exception, which provides access to
-- the most recently raised exception, and is not limited to static calls
-- from an exception handler.
package GNAT.Current_Exception is
pragma Pure;
-----------------
-- Subprograms --
-----------------
-- Note: the lower bound of returned String values is always one
function Exception_Information return String;
-- Returns the result of calling Ada.Exceptions.Exception_Information
-- with an argument that is the Exception_Occurrence corresponding to
-- the current exception. Returns the null string if called from outside
-- an exception handler.
function Exception_Message return String;
-- Returns the result of calling Ada.Exceptions.Exception_Message with
-- an argument that is the Exception_Occurrence corresponding to the
-- current exception. Returns the null string if called from outside an
-- exception handler.
function Exception_Name return String;
-- Returns the result of calling Ada.Exceptions.Exception_Name with
-- an argument that is the Exception_Occurrence corresponding to the
-- current exception. Returns the null string if called from outside
-- an exception handler.
-- Note: all these functions return useful information only if
-- called statically from within an exception handler, and they
-- return information about the exception corresponding to the
-- handler in which they appear. This is NOT the same as the most
-- recently raised exception. Consider the example:
-- exception
-- when Constraint_Error =>
-- begin
-- ...
-- exception
-- when Tasking_Error => ...
-- end;
--
-- -- Exception_xxx at this point returns the information about
-- -- the constraint error, not about any exception raised within
-- -- the nested block since it is the static nesting that counts.
-----------------------------------
-- Use of Library Level Renaming --
-----------------------------------
-- For greater compatibility with existing legacy software, library
-- level renaming may be used to create a function with a name matching
-- one that is in use. For example, some versions of VADS Ada provided
-- a function called Current_Exception whose semantics was identical to
-- that of GNAT. The following library level renaming declaration:
-- with GNAT.Current_Exception;
-- function Current_Exception
-- renames GNAT.Current_Exception.Exception_Name;
-- placed in a file called current_exception.ads and compiled into the
-- application compilation environment, will make the function available
-- in a manner exactly compatible with that in VADS Ada 83.
private
pragma Import (Intrinsic, Exception_Information);
pragma Import (intrinsic, Exception_Message);
pragma Import (Intrinsic, Exception_Name);
end GNAT.Current_Exception;
|
AdaCore/gpr | Ada | 19,034 | ads | --
-- Copyright (C) 2014-2022, AdaCore
-- SPDX-License-Identifier: Apache-2.0
--
with Ada.Unchecked_Deallocation;
with GNATCOLL.GMP.Integers; use GNATCOLL.GMP.Integers;
with Gpr_Parser_Support.Generic_API.Analysis;
use Gpr_Parser_Support.Generic_API.Analysis;
with Gpr_Parser_Support.Generic_API.Introspection;
use Gpr_Parser_Support.Generic_API.Introspection;
with Gpr_Parser_Support.Slocs; use Gpr_Parser_Support.Slocs;
-- This package provides common implementation details for Langkit-generated
-- libraries. Even though it is not private (to allow Langkit-generated
-- libraries to use it), it is not meant to be used beyond this. As such, this
-- API is considered unsafe and unstable.
package Gpr_Parser_Support.Internal.Introspection is
type Type_Index_Array is array (Positive range <>) of Type_Index;
type Struct_Member_Index_Array is
array (Positive range <>) of Struct_Member_Index;
------------------------------
-- Grammar rule descriptors --
------------------------------
type Grammar_Rule_Descriptor is record
Name : Text_Access;
-- Name of this grammar rule
Is_Public : Boolean;
-- Whether this grammar rule is public
Doc : Text_Access;
-- Documentation for this grammar rule
Return_Type : Type_Index;
-- Type for the nodes that this grammar rule creates
end record;
type Grammar_Rule_Descriptor_Access is
not null access constant Grammar_Rule_Descriptor;
type Grammar_Rule_Descriptor_Array is
array (Grammar_Rule_Index range <>) of Grammar_Rule_Descriptor_Access;
type Grammar_Rule_Descriptor_Array_Access is
not null access constant Grammar_Rule_Descriptor_Array;
----------------------
-- Type descriptors --
----------------------
type Type_Descriptor is record
Category : Type_Category;
-- Category for this type
Debug_Name : Debug_String_Access;
-- Free-form name of this type for debug purposes
end record;
type Type_Descriptor_Access is not null access constant Type_Descriptor;
type Type_Descriptor_Array is
array (Type_Index range <>) of Type_Descriptor_Access;
type Type_Descriptor_Array_Access is
not null access constant Type_Descriptor_Array;
---------------------------
-- Enum type descriptors --
---------------------------
type Enum_Value_Names is array (Enum_Value_Index range <>) of Text_Access;
-- Mapping from indexes of enum values to the names
-- (camel-with-underscores) of each enum value.
type Enum_Type_Descriptor (Last_Value : Enum_Value_Index) is record
Name : Text_Access;
-- Name for this enumeration type in camel-with-underscores convention
Default_Value : Any_Enum_Value_Index;
-- If this enum type has a default value, this contains its index. Zero
-- otherwise.
Value_Names : Enum_Value_Names (1 .. Last_Value);
-- Names for each available value for this enum type
end record;
type Enum_Type_Descriptor_Access is
not null access constant Enum_Type_Descriptor;
type Enum_Type_Descriptor_Array is
array (Type_Index range <>) of Enum_Type_Descriptor_Access;
type Enum_Type_Descriptor_Array_Access is
not null access constant Enum_Type_Descriptor_Array;
----------------------------
-- Array type descriptors --
----------------------------
type Array_Type_Descriptor is record
Element_Type : Type_Index;
-- Type of elements in this array type
end record;
type Array_Type_Descriptor_Array is
array (Type_Index range <>) of Array_Type_Descriptor;
type Array_Type_Descriptor_Array_Access is
not null access constant Array_Type_Descriptor_Array;
-------------------------------
-- Iterator type descriptors --
-------------------------------
-- For now, iterator types have the same characteristics as array types
subtype Iterator_Type_Descriptor is Array_Type_Descriptor;
subtype Iterator_Type_Descriptor_Array is Array_Type_Descriptor_Array;
subtype Iterator_Type_Descriptor_Array_Access is
Array_Type_Descriptor_Array_Access;
-------------------------------
-- Struct member descriptors --
-------------------------------
type Type_Flags is array (Type_Index range <>) of Boolean;
type Type_Flags_Access is access constant Type_Flags;
type Syntax_Field_Indexes is array (Type_Index range <>) of Natural;
type Syntax_Field_Indexes_Access is access constant Syntax_Field_Indexes;
type Default_Value_Kind is
(None,
Boolean_Value,
Integer_Value,
Character_Value,
Enum_Value,
Null_Node_Value);
type Default_Value_Descriptor (Kind : Default_Value_Kind := None) is record
case Kind is
when None =>
null;
when Boolean_Value =>
Boolean_Value : Boolean;
when Integer_Value =>
Integer_Value : Integer;
when Character_Value =>
Character_Value : Character_Type;
when Enum_Value =>
Enum_Type : Type_Index;
Enum_Value : Enum_Value_Index;
when Null_Node_Value =>
null;
end case;
end record;
type Argument_Descriptor is record
Name : Text_Access;
-- Name for this property argument in camel-with-underscores convention
Argument_Type : Type_Index;
-- Expected type for this property argument
Default_Value : Default_Value_Descriptor;
-- Default value for this argument
end record;
type Argument_Descriptor_Array is
array (Argument_Index range <>) of Argument_Descriptor;
type Struct_Member_Descriptor (Last_Argument : Any_Argument_Index) is record
Name : Text_Access;
-- Name for this struct member in camel-with-underscores convention
Owner : Type_Index;
-- Type that owns this member
Member_Type : Type_Index;
-- Field type (for struct fields or node syntax fields) or return type
-- (for properties).
Null_For : Type_Flags_Access;
-- This component is null for all members that are not syntax fields or
-- for syntax fields that are never defined as "null" for a node.
--
-- For others, this component points to an array that maps all node
-- types that have this member to whether this member is defined as
-- "null" for that node type.
Indexes : Syntax_Field_Indexes_Access;
-- This compoment is null for all members that are not syntax fields.
--
-- For others, this component points to an array that maps all node
-- types that have this member to the 1-based index of this member in
-- that node, or 0 if the syntax field is null or abstract for this
-- node.
Arguments : Argument_Descriptor_Array (1 .. Last_Argument);
-- Descriptors for each argument of this property. Empty array for
-- fields.
end record;
type Struct_Member_Descriptor_Access is
not null access constant Struct_Member_Descriptor;
type Struct_Member_Descriptor_Array is
array (Struct_Member_Index range <>) of Struct_Member_Descriptor_Access;
type Struct_Member_Descriptor_Array_Access is
not null access constant Struct_Member_Descriptor_Array;
-----------------------------
-- Struct type descriptors --
-----------------------------
-- Note that this descriptor is common to both actual structs and nodes
-- (i.e. it is for all base structs). In the case of structs, we consider
-- that there is no base type, only concrete structs and zero derivation.
type Struct_Type_Descriptor
(Derivations_Count : Natural; Member_Count : Natural)
is record
Base_Type : Any_Type_Index;
-- Reference to the struct type from which this derives
Is_Abstract : Boolean;
-- Whether this struct type is abstract
Is_Token_Node : Boolean;
-- Whether this is a token node
Is_List_Node : Boolean;
-- Whether this is a list node
Name : Text_Access;
-- Name for this type in camel-with-underscores convention
Repr_Name : Text_Access_Or_Null;
-- "Representation" name (i.e. name used in text dumps) for this type.
-- Null for all but node types.
Inherited_Members : Natural;
-- Number of inherited members for this struct (``Members`` included)
Derivations : Type_Index_Array (1 .. Derivations_Count);
-- Sorted list (by index) of all struct types that directly derives from
-- this struct.
Members : Struct_Member_Index_Array (1 .. Member_Count);
-- List of members for this struct ,excluding inherited members
end record;
type Struct_Type_Descriptor_Access is
not null access constant Struct_Type_Descriptor;
type Struct_Type_Descriptor_Array is
array (Type_Index range <>) of Struct_Type_Descriptor_Access;
type Struct_Type_Descriptor_Array_Access is
not null access constant Struct_Type_Descriptor_Array;
-----------------------------------------------
-- Interface to represent polymorphic values --
-----------------------------------------------
type Internal_Value is abstract tagged limited record
Ref_Count : Natural;
-- Reference count for this record. When it drops to zero, the
-- ``Destroy`` primitive must be called.
Id : Language_Id;
-- Language for this value
end record;
function "=" (Left, Right : Internal_Value) return Boolean is abstract;
procedure Destroy (Value : in out Internal_Value) is null;
-- Free resources allocated for this value. Derivations can omit the
-- overriding if there is nothing to free manually.
function Type_Of (Value : Internal_Value) return Type_Index is abstract;
-- Return the type of the ``Value`` polymorphic value
function Type_Matches
(Value : Internal_Value; T : Type_Index) return Boolean;
-- Return whether ``Value`` is a valid value to be passed as a ``T``
-- argument.
--
-- By default, we check that ``Type_Of (Value) = T``, but derivations can
-- override this behavior, which use useful for instance for nodes
-- subtyping.
function Image (Value : Internal_Value) return String is abstract;
-- Return a string that represents ``Value``, for logging/debugging
-- purposes.
type Internal_Value_Access is access all Internal_Value'Class;
procedure Free is new Ada.Unchecked_Deallocation
(Internal_Value'Class, Internal_Value_Access);
type Internal_Value_Array is
array (Positive range <>) of Internal_Value_Access;
--------------------------------------------
-- Implementations for some builtin types --
--------------------------------------------
-- Note: we provide here implementations for some builtin types only
-- (boolean, integer, string, ...) so that we can provide converters
-- between native Ada types and ``Value_Ref`` directly in Gpr_Parser_Support.
-- We intentionally do not map all builtin types, for instance some enums
-- (AnalysisUnitKind) as they exist at the Ada level only in generated
-- libraries.
type Builtin_Types_Record is record
Analysis_Unit : Type_Index;
Big_Int : Type_Index;
Bool : Type_Index;
Char : Type_Index;
Int : Type_Index;
Source_Location_Range : Type_Index;
String : Type_Index;
Token : Type_Index;
Symbol : Type_Index;
end record;
-- Type indexes of builtin types, for which ``Gpr_Parser_Support`` provides
-- common polymorphic values implementation code (see
-- ``Gpr_Parser_Support.Internal.Introspection.Internal_Value``).
type Builtin_Types_Access is not null access constant Builtin_Types_Record;
-------------------
-- Analysis unit --
-------------------
type Internal_Rec_Analysis_Unit is new Internal_Value with record
Value : Lk_Unit;
end record;
type Internal_Acc_Analysis_Unit is access all Internal_Rec_Analysis_Unit;
overriding function "="
(Left, Right : Internal_Rec_Analysis_Unit) return Boolean;
overriding function Type_Of
(Value : Internal_Rec_Analysis_Unit) return Type_Index;
overriding function Image
(Value : Internal_Rec_Analysis_Unit) return String;
-----------------
-- Big integer --
-----------------
type Internal_Rec_Big_Int is new Internal_Value with record
Value : Big_Integer;
end record;
type Internal_Acc_Big_Int is access all Internal_Rec_Big_Int;
overriding function "=" (Left, Right : Internal_Rec_Big_Int) return Boolean;
overriding function Type_Of
(Value : Internal_Rec_Big_Int) return Type_Index;
overriding function Image (Value : Internal_Rec_Big_Int) return String;
-------------
-- Boolean --
-------------
type Internal_Rec_Bool is new Internal_Value with record
Value : Boolean;
end record;
type Internal_Acc_Bool is access all Internal_Rec_Bool;
overriding function "=" (Left, Right : Internal_Rec_Bool) return Boolean;
overriding function Type_Of (Value : Internal_Rec_Bool) return Type_Index;
overriding function Image (Value : Internal_Rec_Bool) return String;
----------
-- Char --
----------
type Internal_Rec_Character is new Internal_Value with record
Value : Character_Type;
end record;
type Internal_Acc_Character is access all Internal_Rec_Character;
overriding function "="
(Left, Right : Internal_Rec_Character) return Boolean;
overriding function Type_Of
(Value : Internal_Rec_Character) return Type_Index;
overriding function Image (Value : Internal_Rec_Character) return String;
---------
-- Int --
---------
type Internal_Rec_Int is new Internal_Value with record
Value : Integer;
end record;
type Internal_Acc_Int is access all Internal_Rec_Int;
overriding function "=" (Left, Right : Internal_Rec_Int) return Boolean;
overriding function Type_Of (Value : Internal_Rec_Int) return Type_Index;
overriding function Image (Value : Internal_Rec_Int) return String;
---------------------------
-- Source_Location_Range --
---------------------------
type Internal_Rec_Source_Location_Range is new Internal_Value with record
Value : Source_Location_Range;
end record;
type Internal_Acc_Source_Location_Range is
access all Internal_Rec_Source_Location_Range;
overriding function "="
(Left, Right : Internal_Rec_Source_Location_Range) return Boolean;
overriding function Type_Of
(Value : Internal_Rec_Source_Location_Range) return Type_Index;
overriding function Image
(Value : Internal_Rec_Source_Location_Range) return String;
------------
-- String --
------------
type Internal_Rec_String is new Internal_Value with record
Value : Unbounded_Text_Type;
end record;
type Internal_Acc_String is access all Internal_Rec_String;
overriding function "=" (Left, Right : Internal_Rec_String) return Boolean;
overriding function Type_Of (Value : Internal_Rec_String) return Type_Index;
overriding function Image (Value : Internal_Rec_String) return String;
-----------
-- Token --
-----------
type Internal_Rec_Token is new Internal_Value with record
Value : Lk_Token;
end record;
type Internal_Acc_Token is access all Internal_Rec_Token;
overriding function "=" (Left, Right : Internal_Rec_Token) return Boolean;
overriding function Type_Of (Value : Internal_Rec_Token) return Type_Index;
overriding function Image (Value : Internal_Rec_Token) return String;
------------
-- Symbol --
------------
type Internal_Rec_Symbol is new Internal_Value with record
Value : Unbounded_Text_Type;
end record;
type Internal_Acc_Symbol is access all Internal_Rec_Symbol;
overriding function "=" (Left, Right : Internal_Rec_Symbol) return Boolean;
overriding function Type_Of (Value : Internal_Rec_Symbol) return Type_Index;
overriding function Image (Value : Internal_Rec_Symbol) return String;
-----------
-- Nodes --
-----------
type Internal_Rec_Node is new Internal_Value with record
Value : Lk_Node;
end record;
type Internal_Acc_Node is access all Internal_Rec_Node;
overriding function "=" (Left, Right : Internal_Rec_Node) return Boolean;
overriding function Type_Of (Value : Internal_Rec_Node) return Type_Index;
overriding function Type_Matches
(Value : Internal_Rec_Node; T : Type_Index) return Boolean;
overriding function Image (Value : Internal_Rec_Node) return String;
------------------------------------------------------
-- Abstract derivations for language-specific types --
------------------------------------------------------
type Base_Internal_Enum_Value is abstract new Internal_Value
with null record;
type Base_Internal_Enum_Value_Access is
access all Base_Internal_Enum_Value'Class;
function Value_Index
(Value : Base_Internal_Enum_Value) return Enum_Value_Index is abstract;
-- Return the index of the given enum value
type Base_Internal_Array_Value is abstract new Internal_Value
with null record;
type Base_Internal_Array_Value_Access is
access all Base_Internal_Array_Value'Class;
overriding function Image (Value : Base_Internal_Array_Value) return String;
function Array_Length (Value : Base_Internal_Array_Value) return Natural
is abstract;
-- Return the number of items in the ``Value`` array
function Array_Item
(Value : Base_Internal_Array_Value;
Index : Positive) return Internal_Value_Access is abstract;
-- Return the array item in ``Value`` at the given ``Index``. The index is
-- assumed to be in-bounds.
type Base_Internal_Iterator_Value is abstract new Internal_Value
with null record;
type Base_Internal_Iterator_Value_Access is
access all Base_Internal_Iterator_Value'Class;
overriding function Image
(Value : Base_Internal_Iterator_Value) return String;
function Next
(Value : Base_Internal_Iterator_Value) return Internal_Value_Access
is abstract;
-- Consume and return the next item in the ``Value`` iterator, if there is
-- one, otherwise return null.
type Base_Internal_Struct_Value is abstract new Internal_Value
with null record;
type Base_Internal_Struct_Value_Access is
access all Base_Internal_Struct_Value'Class;
overriding function Image
(Value : Base_Internal_Struct_Value) return String;
function Eval_Member
(Value : Base_Internal_Struct_Value;
Member : Struct_Member_Index) return Internal_Value_Access is abstract;
-- Return the struct member in ``Value`` corresponding to the given
-- ``Member`` index. The index is assumed to be valid for this struct.
end Gpr_Parser_Support.Internal.Introspection;
|
sungyeon/drake | Ada | 8,297 | adb | with Ada.Unchecked_Conversion;
with System.Formatting.Address;
with System.Long_Long_Integer_Types;
with System.Termination;
package body Ada.Containers.Binary_Trees.Arne_Andersson.Debug is
subtype Word_Unsigned is System.Long_Long_Integer_Types.Word_Unsigned;
function To_Address (Value : Node_Access) return System.Address
with Import, Convention => Intrinsic;
-- Address_To_Named_Access_Conversions could not be used because
-- Node_Access is not access "all" type.
type AA_Node_Access is access Node;
function Downcast is new Unchecked_Conversion (Node_Access, AA_Node_Access);
function Height (Container : Node_Access) return Natural;
function Height (Container : Node_Access) return Natural is
procedure Nonnull_First (
Item : in out Node_Access;
Height : in out Natural);
procedure Nonnull_First (
Item : in out Node_Access;
Height : in out Natural) is
begin
while Item.Left /= null loop
Item := Item.Left;
Height := Height + 1;
end loop;
end Nonnull_First;
procedure Next (Item : in out Node_Access; Height : in out Natural);
procedure Next (Item : in out Node_Access; Height : in out Natural) is
begin
if Item.Right /= null then
Item := Item.Right;
Height := Height + 1;
Nonnull_First (Item, Height);
else
loop
declare
P : constant Node_Access := Item;
begin
Item := Item.Parent;
Height := Height - 1;
exit when Item = null or else Item.Right /= P;
end;
end loop;
end if;
end Next;
Result : Integer := 0;
begin
if Container /= null then
declare
I : Node_Access := Container;
H : Natural := 1;
begin
Nonnull_First (I, H);
while I /= null loop
Result := Integer'Max (Result, H);
Next (I, H);
end loop;
end;
end if;
return Result;
end Height;
-- implementation
function Root (Node : not null Node_Access) return not null Node_Access is
Result : not null Node_Access := Node;
begin
while Result.Parent /= null loop
Result := Result.Parent;
end loop;
return Result;
end Root;
function Dump (
Container : Node_Access;
Marker : Node_Access;
Message : String := "")
return Boolean
is
subtype Buffer_Type is String (1 .. 256);
procedure Put (
Buffer : in out Buffer_Type;
Last : in out Natural;
S : String);
procedure Put (
Buffer : in out Buffer_Type;
Last : in out Natural;
S : String)
is
First : constant Natural := Last + 1;
begin
Last := Last + S'Length;
Buffer (First .. Last) := S;
end Put;
Buffer : Buffer_Type;
Last : Natural;
Indent_S : String (1 .. 2 * Height (Container)) := (others => ' ');
Mark : constant array (Boolean) of Character := "-*";
begin
Last := 0;
Put (Buffer, Last, "Tree:");
if Message'Length > 0 then
Put (Buffer, Last, " ");
Put (Buffer, Last, Message);
end if;
System.Termination.Error_Put_Line (Buffer (1 .. Last));
declare
Position : Node_Access := First (Container);
begin
while Position /= null loop
declare
Indent : Natural := 2;
B : Character;
C : Character;
begin
declare
P : Node_Access := Position.Parent;
begin
while P /= null loop
Indent := Indent + 2;
P := P.Parent;
end loop;
end;
if Position.Left = null then
Indent_S (Indent) := '|';
end if;
if Indent > 2 then
if Indent_S (Indent - 2) = ' ' then
C := '|';
else
C := ' ';
end if;
Indent_S (Indent - 2) := '+';
end if;
Indent_S (Indent - 1) := Mark (Position = Marker);
B := Indent_S (Indent);
if Position.Left = null and then Position.Right = null then
Indent_S (Indent) := '-';
else
Indent_S (Indent) := '+';
end if;
Last := 0;
Put (Buffer, Last, Indent_S);
Put (Buffer, Last, " 0x");
System.Formatting.Address.Image (
To_Address (Position),
Buffer (
Last + 1 ..
Last + System.Formatting.Address.Address_String'Length),
Set => System.Formatting.Lower_Case);
Last := Last + System.Formatting.Address.Address_String'Length;
Put (Buffer, Last, " (level = ");
declare
Error : Boolean;
begin
System.Formatting.Image (
Word_Unsigned (Downcast (Position).Level),
Buffer (Last + 1 .. Buffer'Last),
Last,
Error => Error);
end;
Put (Buffer, Last, ")");
System.Termination.Error_Put_Line (Buffer (1 .. Last));
Indent_S (Indent) := B;
Indent_S (Indent - 1) := ' ';
if Indent > 2 then
Indent_S (Indent - 2) := C;
end if;
if Position.Right = null then
Indent_S (Indent) := ' ';
end if;
end;
Position := Next (Position);
end loop;
end;
return True;
end Dump;
function Valid (
Container : Node_Access;
Length : Count_Type;
Level_Check : Boolean := True)
return Boolean
is
Position : Node_Access := First (Container);
Count : Count_Type := 0;
begin
while Position /= null loop
Count := Count + 1;
if Level_Check then
if Downcast (Position).Level > 0 then
if Position.Left = null or else Position.Right = null then
return False;
end if;
else
if Position.Left /= null then
return False;
end if;
end if;
if Position.Left /= null then
if Downcast (Position).Level /=
Downcast (Position.Left).Level + 1
then
return False;
end if;
end if;
if Position.Right /= null then
if Downcast (Position).Level not in
Downcast (Position.Right).Level ..
Downcast (Position.Right).Level + 1
then
return False;
end if;
if Position.Right.Right /= null then
if Downcast (Position).Level <=
Downcast (Position.Right.Right).Level
then
return False;
end if;
end if;
end if;
end if;
if Position.Left /= null then
if Position.Left.Parent /= Position then
return False;
end if;
end if;
if Position.Right /= null then
if Position.Right.Parent /= Position then
return False;
end if;
end if;
if Position.Parent = null then
if Container /= Position then
return False;
end if;
else
if Position.Parent.Left /= Position
and then Position.Parent.Right /= Position
then
return False;
end if;
end if;
Position := Next (Position);
end loop;
return Count = Length;
end Valid;
end Ada.Containers.Binary_Trees.Arne_Andersson.Debug;
|
AdaCore/libadalang | Ada | 381 | adb | procedure Test is
procedure Foo (X : out Natural) is
begin
X := 0;
end Foo;
procedure Bar (X : out Integer) is
begin
Foo (Integer (X));
--% foo_arg = node.f_call.f_suffix[0].f_r_expr
--% foo_arg.p_is_write_reference()
--% x_arg = foo_arg.f_suffix[0].f_r_expr
--% x_arg.p_is_write_reference()
end Bar;
begin
null;
end Test;
|
reznikmm/matreshka | Ada | 4,019 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Chart_Symbol_Type_Attributes;
package Matreshka.ODF_Chart.Symbol_Type_Attributes is
type Chart_Symbol_Type_Attribute_Node is
new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node
and ODF.DOM.Chart_Symbol_Type_Attributes.ODF_Chart_Symbol_Type_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Symbol_Type_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Chart_Symbol_Type_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Chart.Symbol_Type_Attributes;
|
onox/sdlada | Ada | 1,695 | adb | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2018 Luke A. Guest
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
with Interfaces.C;
with Interfaces.C.Strings;
with System;
package body SDL.Images.Versions is
package C renames Interfaces.C;
procedure Linked_With (Info : in out SDL.Versions.Version) is
function IMG_Linked_Version return access SDL.Versions.Version with
Import => True,
Convention => C,
External_Name => "IMG_Linked_Version";
Data : access SDL.Versions.Version := IMG_Linked_Version;
begin
Info := Data.all;
end Linked_With;
end SDL.Images.Versions;
|
fractal-mind/Amass | Ada | 1,271 | ads | -- Copyright 2021 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "IPdata"
type = "api"
function start()
set_rate_limit(1)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function asn(ctx, addr, asn)
if addr == "" then
return
end
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local resp, err = request(ctx, {['url']=build_url(addr, c.key)})
if (err ~= nil and err ~= "") then
log(ctx, "asn request to service failed: " .. err)
return
end
local j = json.decode(resp)
if (j == nil or j.asn == nil) then
return
end
new_asn(ctx, {
['addr']=addr,
['asn']=tonumber(d.asn:gsub(3)),
desc=d.name,
prefix=d.route,
})
end
function build_url(addr, key)
return "https://api.ipdata.co/" .. addr .. "/asn?api-key=" .. key
end
|
stcarrez/ada-el | Ada | 886 | ads | -----------------------------------------------------------------------
-- el -- Expression Language
-- Copyright (C) 2009, 2010 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package EL is
pragma Pure;
end EL;
|
stcarrez/dynamo | Ada | 2,929 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- T R E E _ I N --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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 procedure is used to read in a tree if the option is set. Note that
-- it is not part of the compiler proper, but rather the interface from
-- tools that need to read the tree to the tree reading routines, and is
-- thus bound as part of such tools.
with System.OS_Lib; use System.OS_Lib;
procedure Tree_In (Desc : File_Descriptor);
-- Desc is the file descriptor for the file containing the tree, as written
-- by the compiler in a previous compilation using Tree_Gen. On return the
-- global data structures are appropriately initialized.
|
johnperry-math/hac | Ada | 487 | ads | -------------------------------------------------------------------------------------
--
-- HAC - HAC Ada Compiler
--
-- A compiler in Ada for an Ada subset
--
-- Copyright, license, etc. : see top package.
--
-------------------------------------------------------------------------------------
--
with HAC_Sys.Co_Defs;
package HAC_Sys.Scanner is
use Co_Defs;
-- Source code scanning for the compiler
procedure InSymbol (CD : in out Compiler_Data);
end HAC_Sys.Scanner;
|
reznikmm/matreshka | Ada | 4,656 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Style.Data_Style_Name_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Style_Data_Style_Name_Attribute_Node is
begin
return Self : Style_Data_Style_Name_Attribute_Node do
Matreshka.ODF_Style.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Style_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Style_Data_Style_Name_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Data_Style_Name_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Style_URI,
Matreshka.ODF_String_Constants.Data_Style_Name_Attribute,
Style_Data_Style_Name_Attribute_Node'Tag);
end Matreshka.ODF_Style.Data_Style_Name_Attributes;
|
persan/advent-of-code-2020 | Ada | 1,218 | adb | pragma Ada_2012;
with Adventofcode.File_Line_Readers;
package body Adventofcode.Day_3 is
Tree : constant Character := '#';
----------
-- Race --
----------
function Race (Slope : Slope_Type; Right : Natural := 3; Down : Natural := 1) return Long_Long_Integer is
Count : Long_Long_Integer := 0;
Cursor : Natural := 0;
L : Natural := 0;
begin
while L < Natural (Slope.Length) loop
declare
Line : constant String := Slope (L);
begin
if Line (Line'First + (Cursor mod Line'Length)) = Tree then
Count := Count + 1;
end if;
for C in 1 .. Right loop
Cursor := Cursor + 1;
end loop;
end;
L := L + Down;
end loop;
return Count;
end Race;
----------
-- Read --
----------
procedure Read (Into_Slope : in out Slope_Type; Path : String) is
begin
Into_Slope.Clear;
for Line of Adventofcode.File_Line_Readers.Read_Lines (Path) loop
if Line'Length > 0 and then Line (Line'First) in '.' | '#' then
Into_Slope.Append (Line);
end if;
end loop;
end Read;
end Adventofcode.Day_3;
|
hbarrientosg/cs-mp | Ada | 1,915 | ads | generic
type Telemento is private;
package Arbol_Bin is
type Arbol is private;
--¡la asignación(:=) genera un alias!
function Vacío return Arbol;
--La función vacío devuelve un árbol vacío. En combinación con
--Crear permite construir árboles con subárboles vacíos.
procedure Vaciar(T: in out Arbol);
--Modifica T para representar un árbol vacío. El valor anterior de T
--es destruido de forma controlada.
function Crear(E:Telemento;T1,T2:Arbol) return Arbol;
--Crea un nuevo árbol, usando E como raíz y T1 y T2 como subárboles
--izquierdo y derecho, respectivamente. No realiza copia de T1 y T2,
--sino que los usa directamente.
function Crear(T,T1,T2:Arbol) return Arbol;
--Modifica el árbol T cambiando sus subárboles izquierdo y derecho
--por T1 y T2, respectivamente. No realiza copia de T1 ni de T2,
--sino que los usa directamente. Tampoco destruye los anteriores
--subárboles izquierdo y derecho de T, para permitir su reutilización.
--T no puede ser un árbol vacío.
function Es_Vacío(T:Arbol) return Boolean;
--Devuelve true si T es un árbol vacío y false en otro caso.
function Raíz(T:Arbol) return Telemento;
--Devuelve la raíz de T.
--T no puede ser un árbol vacío.
function Izquierdo(T:Arbol) return Arbol;
--Devuelve el subárbol izquierdo de T.
--T no puede ser un árbol vacío.
function Derecho(T:Arbol) return Arbol;
--Devuelve el subárbol derecho de T.
--T no puede ser un árbol vacío.
function Copia(T:Arbol) return Arbol;
--Devuelve una copia de T.
Arbol_Lleno, Arbol_Vacío: exception;
private
--Estructura de datos del tipo Arbol.
type Nodo;
type Arbol is access Nodo;
type Nodo is record
Info:Telemento;
Hizq,Hder: Arbol;
end record;
end Arbol_Bin;
|
aherd2985/Amass | Ada | 390 | ads | -- Copyright 2017 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
name = "BufferOver"
type = "api"
function start()
setratelimit(1)
end
function vertical(ctx, domain)
scrape(ctx, {url=buildurl(domain)})
end
function buildurl(domain)
return "https://dns.bufferover.run/dns?q=." .. domain
end
|
AdaCore/ada-traits-containers | Ada | 1,550 | adb | --
-- Copyright (C) 2016, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--
pragma Ada_2012;
with System.Assertions; use System.Assertions;
with Ada.Finalization;
with Conts.Maps.Indef_Def_Unbounded;
with Ada.Strings.Hash;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
package Maps is new Conts.Maps.Indef_Def_Unbounded
(Key_Type => String,
Element_Type => Integer,
Container_Base_Type => Ada.Finalization.Controlled,
Hash => Ada.Strings.Hash);
M : Maps.Map;
begin
-- Check looking for an element in an empty table
begin
Put_Line ("Getting element from empty table " & M.Get ("one")'Img);
exception
when Constraint_Error | Assert_Failure =>
null;
end;
M.Set ("one", 1);
M.Set ("two", 2);
M.Set ("three", 3);
M.Set ("four", 4);
M.Set ("five", 5);
M.Set ("six", 6);
M.Set ("seven", 7);
M.Set ("height", 8);
M.Set ("nine", 9);
M.Set ("ten", 10);
Put_Line ("Value for one is " & M.Get ("one")'Img);
Put_Line ("Value for four is " & M ("four")'Img);
M.Delete ("one");
M.Delete ("two");
M.Delete ("three");
M.Delete ("four");
M.Delete ("five");
M.Delete ("six");
Put_Line ("Value for seven is " & M ("seven")'Img);
begin
Put_Line ("Value for three is " & M ("three")'Img);
Put_Line ("Error, three should have been removed");
exception
when Constraint_Error | Assert_Failure =>
null; -- expected
end;
end Main;
|
vpodzime/ada-util | Ada | 7,473 | ads | -----------------------------------------------------------------------
-- Appenders -- Log appenders
-- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2015 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.Text_IO;
with Ada.Strings.Unbounded;
with Ada.Calendar;
with Ada.Finalization;
with Util.Properties;
limited with Util.Log.Loggers;
-- The log <b>Appender</b> will handle the low level operations to write
-- the log content to a file, the console, a database.
package Util.Log.Appenders is
use Ada.Strings.Unbounded;
-- ------------------------------
-- Log event
-- ------------------------------
-- The <b>Log_Event</b> represent a log message reported by one of the
-- <b>log</b> operation (Debug, Info, Warn, Error).
type Log_Event is record
-- The log message (formatted)
Message : Unbounded_String;
-- The timestamp when the message was produced.
Time : Ada.Calendar.Time;
-- The log level
Level : Level_Type;
-- The logger
Logger : access Util.Log.Loggers.Logger_Info;
end record;
-- The layout type to indicate how to format the message.
-- Unlike Logj4, there is no customizable layout.
type Layout_Type
is (
-- The <b>message</b> layout with only the log message.
-- Ex: "Cannot open file"
MESSAGE,
-- The <b>level-message</b> layout with level and message.
-- Ex: "ERROR: Cannot open file"
LEVEL_MESSAGE,
-- The <b>date-level-message</b> layout with date
-- Ex: "2011-03-04 12:13:34 ERROR: Cannot open file"
DATE_LEVEL_MESSAGE,
-- The <b>full</b> layout with everything (the default).
-- Ex: "2011-03-04 12:13:34 ERROR - my.application - Cannot open file"
FULL);
-- ------------------------------
-- Log appender
-- ------------------------------
type Appender is abstract new Ada.Finalization.Limited_Controlled with private;
type Appender_Access is access all Appender'Class;
-- Get the log level that triggers display of the log events
function Get_Level (Self : in Appender) return Level_Type;
-- Set the log level.
procedure Set_Level (Self : in out Appender;
Name : in String;
Properties : in Util.Properties.Manager;
Level : in Level_Type);
-- Set the log layout format.
procedure Set_Layout (Self : in out Appender;
Name : in String;
Properties : in Util.Properties.Manager;
Layout : in Layout_Type);
-- Format the event into a string
function Format (Self : in Appender;
Event : in Log_Event) return String;
-- Append a log event to the appender. Depending on the log level
-- defined on the appender, the event can be taken into account or
-- ignored.
procedure Append (Self : in out Appender;
Event : in Log_Event) is abstract;
-- Flush the log events.
procedure Flush (Self : in out Appender) is abstract;
-- ------------------------------
-- File appender
-- ------------------------------
-- Write log events to a file
type File_Appender is new Appender with private;
type File_Appender_Access is access all File_Appender'Class;
overriding
procedure Append (Self : in out File_Appender;
Event : in Log_Event);
-- Set the file where the appender will write the logs.
-- When <tt>Append</tt> is true, the log message are appended to the existing file.
-- When set to false, the file is cleared before writing new messages.
procedure Set_File (Self : in out File_Appender;
Path : in String;
Append : in Boolean := True);
-- Flush the log events.
overriding
procedure Flush (Self : in out File_Appender);
-- Flush and close the file.
overriding
procedure Finalize (Self : in out File_Appender);
-- Create a file appender and configure it according to the properties
function Create_File_Appender (Name : in String;
Properties : in Util.Properties.Manager;
Default : in Level_Type)
return Appender_Access;
-- ------------------------------
-- Console appender
-- ------------------------------
-- Write log events to the console
type Console_Appender is new Appender with private;
type Console_Appender_Access is access all Console_Appender'Class;
overriding
procedure Append (Self : in out Console_Appender;
Event : in Log_Event);
-- Flush the log events.
overriding
procedure Flush (Self : in out Console_Appender);
-- Create a console appender and configure it according to the properties
function Create_Console_Appender (Name : in String;
Properties : in Util.Properties.Manager;
Default : in Level_Type)
return Appender_Access;
-- ------------------------------
-- List appender
-- ------------------------------
-- Write log events to a list of appenders
type List_Appender is new Appender with private;
type List_Appender_Access is access all List_Appender'Class;
-- Max number of appenders that can be added to the list.
-- In most cases, 2 or 3 appenders will be used.
MAX_APPENDERS : constant Natural := 10;
overriding
procedure Append (Self : in out List_Appender;
Event : in Log_Event);
-- Flush the log events.
overriding
procedure Flush (Self : in out List_Appender);
-- Add the appender to the list.
procedure Add_Appender (Self : in out List_Appender;
Object : in Appender_Access);
-- Create a list appender and configure it according to the properties
function Create_List_Appender return List_Appender_Access;
private
type Appender is abstract new Ada.Finalization.Limited_Controlled with record
Level : Level_Type := INFO_LEVEL;
Layout : Layout_Type := FULL;
end record;
type File_Appender is new Appender with record
Output : Ada.Text_IO.File_Type;
Immediate_Flush : Boolean := False;
end record;
type Appender_Array_Access is array (1 .. MAX_APPENDERS) of Appender_Access;
type List_Appender is new Appender with record
Appenders : Appender_Array_Access;
Count : Natural := 0;
end record;
type Console_Appender is new Appender with null record;
end Util.Log.Appenders;
|
stcarrez/ada-awa | Ada | 27,936 | ads | -----------------------------------------------------------------------
-- AWA.OAuth.Models -- AWA.OAuth.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-spec.xhtml
-- Ada Generator: https://github.com/stcarrez/dynamo Version 1.4.0
-----------------------------------------------------------------------
-- Copyright (C) 2023 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.
-----------------------------------------------------------------------
pragma Warnings (Off);
with ADO.Sessions;
with ADO.Objects;
with ADO.Statements;
with ADO.SQL;
with ADO.Schemas;
with Ada.Calendar;
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded;
with Util.Beans.Objects;
with Util.Beans.Basic.Lists;
with AWA.Users.Models;
pragma Warnings (On);
package AWA.OAuth.Models is
pragma Style_Checks ("-mrIu");
type Application_Ref is new ADO.Objects.Object_Ref with null record;
type Callback_Ref is new ADO.Objects.Object_Ref with null record;
type Session_Ref is new ADO.Objects.Object_Ref with null record;
-- --------------------
-- The application that is granted access to the database.
-- --------------------
-- Create an object key for Application.
function Application_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Application from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Application_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Application : constant Application_Ref;
function "=" (Left, Right : Application_Ref'Class) return Boolean;
-- Set the application identifier.
procedure Set_Id (Object : in out Application_Ref;
Value : in ADO.Identifier);
-- Get the application identifier.
function Get_Id (Object : in Application_Ref)
return ADO.Identifier;
-- Set the application name.
procedure Set_Name (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Name (Object : in out Application_Ref;
Value : in String);
-- Get the application name.
function Get_Name (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Name (Object : in Application_Ref)
return String;
-- Set the application secret key.
procedure Set_Secret_Key (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Secret_Key (Object : in out Application_Ref;
Value : in String);
-- Get the application secret key.
function Get_Secret_Key (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Secret_Key (Object : in Application_Ref)
return String;
-- Set the application public identifier.
procedure Set_Client_Id (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Client_Id (Object : in out Application_Ref;
Value : in String);
-- Get the application public identifier.
function Get_Client_Id (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Client_Id (Object : in Application_Ref)
return String;
-- Get the optimistic lock version.
function Get_Version (Object : in Application_Ref)
return Integer;
-- Set the application create date.
procedure Set_Create_Date (Object : in out Application_Ref;
Value : in Ada.Calendar.Time);
-- Get the application create date.
function Get_Create_Date (Object : in Application_Ref)
return Ada.Calendar.Time;
-- Set the application update date.
procedure Set_Update_Date (Object : in out Application_Ref;
Value : in Ada.Calendar.Time);
-- Get the application update date.
function Get_Update_Date (Object : in Application_Ref)
return Ada.Calendar.Time;
-- Set the application title displayed in the OAuth login form.
procedure Set_Title (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Title (Object : in out Application_Ref;
Value : in String);
-- Get the application title displayed in the OAuth login form.
function Get_Title (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Title (Object : in Application_Ref)
return String;
-- Set the application description.
procedure Set_Description (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Description (Object : in out Application_Ref;
Value : in String);
-- Get the application description.
function Get_Description (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Description (Object : in Application_Ref)
return String;
-- Set the optional login URL.
procedure Set_App_Login_Url (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_App_Login_Url (Object : in out Application_Ref;
Value : in String);
-- Get the optional login URL.
function Get_App_Login_Url (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_App_Login_Url (Object : in Application_Ref)
return String;
-- Set the application logo URL.
procedure Set_App_Logo_Url (Object : in out Application_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_App_Logo_Url (Object : in out Application_Ref;
Value : in String);
-- Get the application logo URL.
function Get_App_Logo_Url (Object : in Application_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_App_Logo_Url (Object : in Application_Ref)
return String;
--
procedure Set_User (Object : in out Application_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_User (Object : in Application_Ref)
return AWA.Users.Models.User_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Application_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Application_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Application_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Application_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
APPLICATION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Application_Ref);
-- Copy of the object.
procedure Copy (Object : in Application_Ref;
Into : in out Application_Ref);
package Application_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Application_Ref,
"=" => "=");
subtype Application_Vector is Application_Vectors.Vector;
procedure List (Object : in out Application_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- Create an object key for Callback.
function Callback_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Callback from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Callback_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Callback : constant Callback_Ref;
function "=" (Left, Right : Callback_Ref'Class) return Boolean;
--
procedure Set_Id (Object : in out Callback_Ref;
Value : in ADO.Identifier);
--
function Get_Id (Object : in Callback_Ref)
return ADO.Identifier;
--
procedure Set_Url (Object : in out Callback_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Url (Object : in out Callback_Ref;
Value : in String);
--
function Get_Url (Object : in Callback_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Url (Object : in Callback_Ref)
return String;
-- Get the optimistic lock version.
function Get_Version (Object : in Callback_Ref)
return Integer;
--
procedure Set_Application (Object : in out Callback_Ref;
Value : in Application_Ref'Class);
--
function Get_Application (Object : in Callback_Ref)
return Application_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Reload from the database the same object if it was modified.
-- Returns True in `Updated` if the object was reloaded.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Reload (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Updated : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Callback_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Callback_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
CALLBACK_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Callback_Ref);
-- Copy of the object.
procedure Copy (Object : in Callback_Ref;
Into : in out Callback_Ref);
package Callback_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Callback_Ref,
"=" => "=");
subtype Callback_Vector is Callback_Vectors.Vector;
procedure List (Object : in out Callback_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
-- --------------------
-- The session is created when the user has granted an access to an application
-- or when the application has refreshed its access token.
-- --------------------
-- Create an object key for Session.
function Session_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key;
-- Create an object key for Session from a string.
-- Raises Constraint_Error if the string cannot be converted into the object key.
function Session_Key (Id : in String) return ADO.Objects.Object_Key;
Null_Session : constant Session_Ref;
function "=" (Left, Right : Session_Ref'Class) return Boolean;
-- Set the session identifier.
procedure Set_Id (Object : in out Session_Ref;
Value : in ADO.Identifier);
-- Get the session identifier.
function Get_Id (Object : in Session_Ref)
return ADO.Identifier;
-- Set the session creation date.
procedure Set_Create_Date (Object : in out Session_Ref;
Value : in Ada.Calendar.Time);
-- Get the session creation date.
function Get_Create_Date (Object : in Session_Ref)
return Ada.Calendar.Time;
-- Set a random salt string to access/request token generation.
procedure Set_Salt (Object : in out Session_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String);
procedure Set_Salt (Object : in out Session_Ref;
Value : in String);
-- Get a random salt string to access/request token generation.
function Get_Salt (Object : in Session_Ref)
return Ada.Strings.Unbounded.Unbounded_String;
function Get_Salt (Object : in Session_Ref)
return String;
-- Set the expiration date.
procedure Set_Expire_Date (Object : in out Session_Ref;
Value : in Ada.Calendar.Time);
-- Get the expiration date.
function Get_Expire_Date (Object : in Session_Ref)
return Ada.Calendar.Time;
-- Set the application that is granted access.
procedure Set_Application (Object : in out Session_Ref;
Value : in Application_Ref'Class);
-- Get the application that is granted access.
function Get_Application (Object : in Session_Ref)
return Application_Ref'Class;
--
procedure Set_User (Object : in out Session_Ref;
Value : in AWA.Users.Models.User_Ref'Class);
--
function Get_User (Object : in Session_Ref)
return AWA.Users.Models.User_Ref'Class;
--
procedure Set_Session (Object : in out Session_Ref;
Value : in AWA.Users.Models.Session_Ref'Class);
--
function Get_Session (Object : in Session_Ref)
return AWA.Users.Models.Session_Ref'Class;
-- Load the entity identified by 'Id'.
-- Raises the NOT_FOUND exception if it does not exist.
procedure Load (Object : in out Session_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier);
-- Load the entity identified by 'Id'.
-- Returns True in <b>Found</b> if the object was found and False if it does not exist.
procedure Load (Object : in out Session_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean);
-- Find and load the entity.
overriding
procedure Find (Object : in out Session_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
-- Save the entity. If the entity does not have an identifier, an identifier is allocated
-- and it is inserted in the table. Otherwise, only data fields which have been changed
-- are updated.
overriding
procedure Save (Object : in out Session_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
-- Delete the entity.
overriding
procedure Delete (Object : in out Session_Ref;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
function Get_Value (From : in Session_Ref;
Name : in String) return Util.Beans.Objects.Object;
-- Table definition
SESSION_TABLE : constant ADO.Schemas.Class_Mapping_Access;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Session_Ref);
-- Copy of the object.
procedure Copy (Object : in Session_Ref;
Into : in out Session_Ref);
package Session_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Session_Ref,
"=" => "=");
subtype Session_Vector is Session_Vectors.Vector;
procedure List (Object : in out Session_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class);
private
APPLICATION_NAME : aliased constant String := "awa_application";
COL_0_1_NAME : aliased constant String := "id";
COL_1_1_NAME : aliased constant String := "name";
COL_2_1_NAME : aliased constant String := "secret_key";
COL_3_1_NAME : aliased constant String := "client_id";
COL_4_1_NAME : aliased constant String := "version";
COL_5_1_NAME : aliased constant String := "create_date";
COL_6_1_NAME : aliased constant String := "update_date";
COL_7_1_NAME : aliased constant String := "title";
COL_8_1_NAME : aliased constant String := "description";
COL_9_1_NAME : aliased constant String := "app_login_url";
COL_10_1_NAME : aliased constant String := "app_logo_url";
COL_11_1_NAME : aliased constant String := "user_id";
APPLICATION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 12,
Table => APPLICATION_NAME'Access,
Members => (
1 => COL_0_1_NAME'Access,
2 => COL_1_1_NAME'Access,
3 => COL_2_1_NAME'Access,
4 => COL_3_1_NAME'Access,
5 => COL_4_1_NAME'Access,
6 => COL_5_1_NAME'Access,
7 => COL_6_1_NAME'Access,
8 => COL_7_1_NAME'Access,
9 => COL_8_1_NAME'Access,
10 => COL_9_1_NAME'Access,
11 => COL_10_1_NAME'Access,
12 => COL_11_1_NAME'Access)
);
APPLICATION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= APPLICATION_DEF'Access;
Null_Application : constant Application_Ref
:= Application_Ref'(ADO.Objects.Object_Ref with null record);
type Application_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => APPLICATION_DEF'Access)
with record
Name : Ada.Strings.Unbounded.Unbounded_String;
Secret_Key : Ada.Strings.Unbounded.Unbounded_String;
Client_Id : Ada.Strings.Unbounded.Unbounded_String;
Version : Integer;
Create_Date : Ada.Calendar.Time;
Update_Date : Ada.Calendar.Time;
Title : Ada.Strings.Unbounded.Unbounded_String;
Description : Ada.Strings.Unbounded.Unbounded_String;
App_Login_Url : Ada.Strings.Unbounded.Unbounded_String;
App_Logo_Url : Ada.Strings.Unbounded.Unbounded_String;
User : AWA.Users.Models.User_Ref;
end record;
type Application_Access is access all Application_Impl;
overriding
procedure Destroy (Object : access Application_Impl);
overriding
procedure Find (Object : in out Application_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Application_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Application_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Application_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Application_Ref'Class;
Impl : out Application_Access);
CALLBACK_NAME : aliased constant String := "awa_callback";
COL_0_2_NAME : aliased constant String := "id";
COL_1_2_NAME : aliased constant String := "url";
COL_2_2_NAME : aliased constant String := "version";
COL_3_2_NAME : aliased constant String := "application_id";
CALLBACK_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 4,
Table => CALLBACK_NAME'Access,
Members => (
1 => COL_0_2_NAME'Access,
2 => COL_1_2_NAME'Access,
3 => COL_2_2_NAME'Access,
4 => COL_3_2_NAME'Access)
);
CALLBACK_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= CALLBACK_DEF'Access;
Null_Callback : constant Callback_Ref
:= Callback_Ref'(ADO.Objects.Object_Ref with null record);
type Callback_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => CALLBACK_DEF'Access)
with record
Url : Ada.Strings.Unbounded.Unbounded_String;
Version : Integer;
Application : Application_Ref;
end record;
type Callback_Access is access all Callback_Impl;
overriding
procedure Destroy (Object : access Callback_Impl);
overriding
procedure Find (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Callback_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Callback_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Callback_Ref'Class;
Impl : out Callback_Access);
SESSION_NAME : aliased constant String := "awa_oauth_session";
COL_0_3_NAME : aliased constant String := "id";
COL_1_3_NAME : aliased constant String := "create_date";
COL_2_3_NAME : aliased constant String := "salt";
COL_3_3_NAME : aliased constant String := "expire_date";
COL_4_3_NAME : aliased constant String := "application_id";
COL_5_3_NAME : aliased constant String := "user_id";
COL_6_3_NAME : aliased constant String := "session_id";
SESSION_DEF : aliased constant ADO.Schemas.Class_Mapping :=
(Count => 7,
Table => SESSION_NAME'Access,
Members => (
1 => COL_0_3_NAME'Access,
2 => COL_1_3_NAME'Access,
3 => COL_2_3_NAME'Access,
4 => COL_3_3_NAME'Access,
5 => COL_4_3_NAME'Access,
6 => COL_5_3_NAME'Access,
7 => COL_6_3_NAME'Access)
);
SESSION_TABLE : constant ADO.Schemas.Class_Mapping_Access
:= SESSION_DEF'Access;
Null_Session : constant Session_Ref
:= Session_Ref'(ADO.Objects.Object_Ref with null record);
type Session_Impl is
new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER,
Of_Class => SESSION_DEF'Access)
with record
Create_Date : Ada.Calendar.Time;
Salt : Ada.Strings.Unbounded.Unbounded_String;
Expire_Date : Ada.Calendar.Time;
Application : Application_Ref;
User : AWA.Users.Models.User_Ref;
Session : AWA.Users.Models.Session_Ref;
end record;
type Session_Access is access all Session_Impl;
overriding
procedure Destroy (Object : access Session_Impl);
overriding
procedure Find (Object : in out Session_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean);
overriding
procedure Load (Object : in out Session_Impl;
Session : in out ADO.Sessions.Session'Class);
procedure Load (Object : in out Session_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class);
overriding
procedure Save (Object : in out Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Create (Object : in out Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
overriding
procedure Delete (Object : in out Session_Impl;
Session : in out ADO.Sessions.Master_Session'Class);
procedure Set_Field (Object : in out Session_Ref'Class;
Impl : out Session_Access);
end AWA.OAuth.Models;
|
zhmu/ananas | Ada | 4,730 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . C _ S T R E A M S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-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 Interfaces.C_Streams is
use type System.CRTL.size_t;
----------------------------
-- Interfaced C functions --
----------------------------
function C_fread
(buffer : voids;
size : size_t;
count : size_t;
stream : FILEs) return size_t;
pragma Import (C, C_fread, "fread");
function C_fwrite
(buffer : voids;
size : size_t;
count : size_t;
stream : FILEs) return size_t;
pragma Import (C, C_fwrite, "fwrite");
function C_setvbuf
(stream : FILEs;
buffer : chars;
mode : int;
size : size_t) return int;
pragma Import (C, C_setvbuf, "setvbuf");
------------
-- fread --
------------
function fread
(buffer : voids;
size : size_t;
count : size_t;
stream : FILEs) return size_t
is
begin
return C_fread (buffer, size, count, stream);
end fread;
------------
-- fread --
------------
-- The following declarations should really be nested within fread, but
-- limitations in front end inlining make this undesirable right now ???
type Byte_Buffer is array (0 .. size_t'Last / 2 - 1) of Unsigned_8;
-- This should really be 0 .. size_t'last, but there is a problem
-- in gigi in handling such types (introduced in GCC 3 Sep 2001)
-- since the size in bytes of this array overflows ???
type Acc_Bytes is access all Byte_Buffer;
function To_Acc_Bytes is new Ada.Unchecked_Conversion (voids, Acc_Bytes);
function fread
(buffer : voids;
index : size_t;
size : size_t;
count : size_t;
stream : FILEs) return size_t
is
begin
return C_fread
(To_Acc_Bytes (buffer) (index * size)'Address, size, count, stream);
end fread;
------------
-- fwrite --
------------
function fwrite
(buffer : voids;
size : size_t;
count : size_t;
stream : FILEs) return size_t
is
begin
return C_fwrite (buffer, size, count, stream);
end fwrite;
-------------
-- setvbuf --
-------------
function setvbuf
(stream : FILEs;
buffer : chars;
mode : int;
size : size_t) return int
is
begin
return C_setvbuf (stream, buffer, mode, size);
end setvbuf;
end Interfaces.C_Streams;
|
stcarrez/ada-keystore | Ada | 3,610 | adb | -----------------------------------------------------------------------
-- akt-commands-info -- Info command of keystore
-- Copyright (C) 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 Keystore.Verifier;
package body AKT.Commands.Info is
use type Keystore.Header_Slot_Count_Type;
use type Keystore.Passwords.Keys.Key_Provider_Access;
-- ------------------------------
-- List the value entries of the keystore.
-- ------------------------------
overriding
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type) is
pragma Unreferenced (Command, Name);
function Get_Stat_Info (Stats : in Keystore.Wallet_Stats) return String;
function Get_Stat_Info (Stats : in Keystore.Wallet_Stats) return String is
Slots : String (1 .. Stats.Keys'Length) := (others => ' ');
C : Character := '1';
begin
for Slot in Stats.Keys'Range loop
if Stats.Keys (Slot) then
Slots (Positive (Slot) * 2) := C;
end if;
C := Character'Succ (C);
end loop;
return Slots;
end Get_Stat_Info;
Path : constant String := Context.Get_Keystore_Path (Args);
Stats : Keystore.Wallet_Stats;
Is_Keystore : Boolean;
begin
Keystore.Verifier.Print_Information (Path, Is_Keystore);
-- No need to proceed if this is not a keystore file.
if not Is_Keystore then
return;
end if;
Setup_Password_Provider (Context);
Setup_Key_Provider (Context);
Context.Wallet.Open (Path => Path,
Data_Path => Context.Data_Path.all,
Info => Context.Info);
if Context.No_Password_Opt and then Context.Info.Header_Count = 0 then
return;
end if;
if not Context.No_Password_Opt then
if Context.Key_Provider /= null then
Context.Wallet.Set_Master_Key (Context.Key_Provider.all);
end if;
Context.Wallet.Unlock (Context.Provider.all, Context.Slot);
else
Context.GPG.Load_Secrets (Context.Wallet);
Context.Wallet.Set_Master_Key (Context.GPG);
Context.Wallet.Unlock (Context.GPG, Context.Slot);
end if;
Context.Wallet.Get_Stats (Stats);
Context.Console.Clear_Fields;
Context.Console.Set_Field_Length (1, 30);
Context.Console.Set_Field_Length (2, 70);
Context.Console.Start_Row;
Context.Console.Print_Field (1, -("Key slots used: "));
Context.Console.Print_Field (2, Get_Stat_Info (Stats));
Context.Console.End_Row;
Context.Console.Print_Field (1, -("Entry count: "));
Context.Console.Print_Field (2, Stats.Entry_Count);
Context.Console.End_Row;
end Execute;
end AKT.Commands.Info;
|
MinimSecure/unum-sdk | Ada | 804 | ads | -- Copyright 2013-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Callee is
procedure Increment (Val : in out Float; Msg : String);
end Callee;
|
zhmu/ananas | Ada | 320 | adb | -- { dg-do run }
procedure range_check is
function ident (x : integer) return integer is
begin
return x;
end ident;
guard1 : Integer;
r : array (1 .. ident (10)) of integer;
pragma Suppress (Index_Check, r);
guard2 : Integer;
begin
guard1 := 0;
guard2 := 0;
r (11) := 3;
end;
|
msrLi/portingSources | Ada | 1,030 | ads | -- Copyright 2007-2014 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pck is
Procedure_Result : Character := ' ';
procedure Same (C : Character);
-- Set Procedure_Result to C.
procedure Next (C : in out Character);
-- Increment C (if C is the last character, then set C to the first
-- character). Set Procedure_Result to the new value of C.
end Pck;
|
Rodeo-McCabe/orka | Ada | 9,671 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 Felix Krause <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Interfaces.C.Pointers;
private with GL.Enums;
private with GL.Low_Level;
package GL.Objects.Buffers is
pragma Preelaborate;
function Minimum_Alignment return Types.Size
with Post => Minimum_Alignment'Result >= 64;
-- Minimum byte alignment of pointers returned by Map_Range
-- (at least 64 bytes to support SIMD CPU instructions)
type Access_Bits is record
Read : Boolean := False;
Write : Boolean := False;
Invalidate_Range : Boolean := False;
Invalidate_Buffer : Boolean := False;
Flush_Explicit : Boolean := False;
Unsynchronized : Boolean := False;
Persistent : Boolean := False;
Coherent : Boolean := False;
end record
with Dynamic_Predicate => (Access_Bits.Read or Access_Bits.Write)
and (if Access_Bits.Flush_Explicit then Access_Bits.Write)
and (if Access_Bits.Invalidate_Range or Access_Bits.Invalidate_Buffer then
not Access_Bits.Read);
type Storage_Bits is record
Read : Boolean := False;
Write : Boolean := False;
Persistent : Boolean := False;
Coherent : Boolean := False;
Dynamic_Storage : Boolean := False;
Client_Storage : Boolean := False;
end record
with Dynamic_Predicate => (if Storage_Bits.Coherent then Storage_Bits.Persistent)
and (if Storage_Bits.Persistent then Storage_Bits.Read or Storage_Bits.Write);
type Buffer_Target (<>) is tagged limited private;
type Indexed_Buffer_Target is (Atomic_Counter, Shader_Storage, Uniform);
function Kind (Target : Buffer_Target) return Indexed_Buffer_Target;
type Buffer is new GL_Object with private;
function Allocated (Object : Buffer) return Boolean;
function Mapped (Object : Buffer) return Boolean;
procedure Bind (Target : Buffer_Target; Object : Buffer'Class);
-- Bind the buffer object to the target
--
-- The target must not be one of the targets that should be used with
-- Bind_Base or Bind_Range.
procedure Bind_Base (Target : Buffer_Target; Object : Buffer'Class; Index : Natural);
-- Bind the buffer object to the index of the target as well as to
-- the target itself.
--
-- Target must be one of the following:
--
-- * Atomic_Counter_Buffer
-- * Uniform_Buffer
-- * Shader_Storage_Buffer
procedure Allocate_Storage
(Object : in out Buffer;
Length : Long;
Kind : Numeric_Type;
Flags : Storage_Bits)
with Pre => not Object.Allocated,
Post => Object.Allocated;
-- Use this instead of Allocate_And_Load_From_Data if you don't want
-- to copy any data
overriding
procedure Initialize_Id (Object : in out Buffer);
overriding
procedure Delete_Id (Object : in out Buffer);
overriding
function Identifier (Object : Buffer) return Types.Debug.Identifier is
(Types.Debug.Buffer);
procedure Unmap (Object : in out Buffer);
procedure Invalidate_Data (Object : in out Buffer);
generic
with package Pointers is new Interfaces.C.Pointers (<>);
package Buffer_Pointers is
subtype Pointer is Pointers.Pointer;
procedure Bind_Range
(Target : Buffer_Target;
Object : Buffer'Class;
Index : Natural;
Offset, Length : Types.Size);
-- Bind a part of the buffer object to the index of the target as
-- well as to the target itself
--
-- Target must be one of the following:
--
-- * Atomic_Counter_Buffer
-- * Uniform_Buffer
-- * Shader_Storage_Buffer
procedure Allocate_And_Load_From_Data
(Object : in out Buffer;
Data : Pointers.Element_Array;
Flags : Storage_Bits)
with Pre => not Object.Allocated,
Post => Object.Allocated;
procedure Map_Range
(Object : in out Buffer;
Flags : Access_Bits;
Offset, Length : Types.Size;
Pointer : out Pointers.Pointer)
with Pre => Object.Allocated and not Object.Mapped and Length > 0;
function Get_Mapped_Data
(Pointer : not null Pointers.Pointer;
Offset, Length : Types.Size) return Pointers.Element_Array
with Pre => Length > 0,
Post => Get_Mapped_Data'Result'Length = Length;
procedure Set_Mapped_Data
(Pointer : not null Pointers.Pointer;
Offset : Types.Size;
Data : Pointers.Element_Array)
with Pre => Data'Length > 0;
procedure Set_Mapped_Data
(Pointer : not null Pointers.Pointer;
Offset : Types.Size;
Value : Pointers.Element);
procedure Flush_Buffer_Range (Object : in out Buffer;
Offset, Length : Types.Size);
procedure Clear_Sub_Data
(Object : Buffer;
Kind : Numeric_Type;
Offset, Length : Types.Size;
Data : in out Pointers.Element_Array)
with Pre => Data'Length <= 4
and then Kind /= Double_Type
and then (if Data'Length = 3 then
Kind not in Byte_Type | UByte_Type | Short_Type | UShort_Type | Half_Type);
procedure Copy_Sub_Data (Object, Target_Object : Buffer;
Read_Offset, Write_Offset, Length : Types.Size);
procedure Set_Sub_Data (Object : Buffer;
Offset : Types.Size;
Data : Pointers.Element_Array);
procedure Get_Sub_Data (Object : Buffer;
Offset : Types.Size;
Data : out Pointers.Element_Array);
procedure Invalidate_Sub_Data (Object : Buffer;
Offset, Length : Types.Size);
end Buffer_Pointers;
-- Array_Buffer, Texture_Buffer,
-- Copy_Read_Buffer, and Copy_Write_Buffer are no longer needed
-- since the GL.Objects.* packages use DSA
-- Transform_Feedback_Buffer replaced by Shader_Storage_Buffer
Element_Array_Buffer : aliased constant Buffer_Target;
Pixel_Pack_Buffer : aliased constant Buffer_Target;
Pixel_Unpack_Buffer : aliased constant Buffer_Target;
Draw_Indirect_Buffer : aliased constant Buffer_Target;
Parameter_Buffer : aliased constant Buffer_Target;
Dispatch_Indirect_Buffer : aliased constant Buffer_Target;
Query_Buffer : aliased constant Buffer_Target;
-- Buffer targets that must be binded to a specific index
-- (specified in shaders)
Uniform_Buffer : aliased constant Buffer_Target;
Shader_Storage_Buffer : aliased constant Buffer_Target;
Atomic_Counter_Buffer : aliased constant Buffer_Target;
private
for Access_Bits use record
Read at 0 range 0 .. 0;
Write at 0 range 1 .. 1;
Invalidate_Range at 0 range 2 .. 2;
Invalidate_Buffer at 0 range 3 .. 3;
Flush_Explicit at 0 range 4 .. 4;
Unsynchronized at 0 range 5 .. 5;
Persistent at 0 range 6 .. 6;
Coherent at 0 range 7 .. 7;
end record;
for Access_Bits'Size use Low_Level.Bitfield'Size;
for Storage_Bits use record
Read at 0 range 0 .. 0;
Write at 0 range 1 .. 1;
Persistent at 0 range 6 .. 6;
Coherent at 0 range 7 .. 7;
Dynamic_Storage at 0 range 8 .. 8;
Client_Storage at 0 range 9 .. 9;
end record;
for Storage_Bits'Size use Low_Level.Bitfield'Size;
type Buffer_Target (Kind : Enums.Buffer_Kind) is
tagged limited null record;
type Buffer is new GL_Object with record
Allocated, Mapped : Boolean := False;
end record;
Element_Array_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Element_Array_Buffer);
Pixel_Pack_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Pixel_Pack_Buffer);
Pixel_Unpack_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Pixel_Unpack_Buffer);
Uniform_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Uniform_Buffer);
Draw_Indirect_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Draw_Indirect_Buffer);
Parameter_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Parameter_Buffer);
Shader_Storage_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Shader_Storage_Buffer);
Dispatch_Indirect_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Dispatch_Indirect_Buffer);
Query_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Query_Buffer);
Atomic_Counter_Buffer : aliased constant Buffer_Target
:= Buffer_Target'(Kind => Enums.Atomic_Counter_Buffer);
end GL.Objects.Buffers;
|
stcarrez/mat | Ada | 22,043 | adb | -----------------------------------------------------------------------
-- mat-memory-targets - Definition and Analysis of memory events
-- Copyright (C) 2014, 2015, 2022, 2023 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.Log.Loggers;
with Util.Strings;
with MAT.Memory.Probes;
package body MAT.Memory.Targets is
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("MAT.Memory.Targets");
-- ------------------------------
-- Initialize the target memory object to manage the memory slots, the stack frames
-- and setup the reader to analyze the memory events.
-- ------------------------------
procedure Initialize (Memory : in out Target_Memory;
Manager : in out MAT.Events.Probes.Probe_Manager_Type'Class) is
Memory_Probe : constant MAT.Memory.Probes.Memory_Probe_Type_Access
:= new MAT.Memory.Probes.Memory_Probe_Type;
begin
Memory_Probe.Data := Memory'Unrestricted_Access;
MAT.Memory.Probes.Register (Manager, Memory_Probe);
end Initialize;
-- ------------------------------
-- Add the memory region from the list of memory region managed by the program.
-- ------------------------------
procedure Add_Region (Memory : in out Target_Memory;
Region : in Region_Info) is
begin
Log.Info ("Add region [" & MAT.Types.Hex_Image (Region.Start_Addr) & "-"
& MAT.Types.Hex_Image (Region.End_Addr) & "] - {0}", Region.Path);
Memory.Memory.Add_Region (Region);
end Add_Region;
-- ------------------------------
-- Find the memory region that intersect the given section described by <tt>From</tt>
-- and <tt>To</tt>. Each memory region that intersects is added to the <tt>Into</tt>
-- map.
-- ------------------------------
procedure Find (Memory : in out Target_Memory;
From : in MAT.Types.Target_Addr;
To : in MAT.Types.Target_Addr;
Into : in out MAT.Memory.Region_Info_Map) is
begin
Memory.Memory.Find (From, To, Into);
end Find;
-- ------------------------------
-- Find the region that matches the given name.
-- ------------------------------
function Find_Region (Memory : in Target_Memory;
Name : in String) return Region_Info is
begin
return Memory.Memory.Find_Region (Name);
end Find_Region;
-- ------------------------------
-- Take into account a malloc probe. The memory slot [Addr .. Slot.Size] is inserted
-- in the used slots map. The freed slots that intersect the malloc'ed region are
-- removed from the freed map.
-- ------------------------------
procedure Probe_Malloc (Memory : in out Target_Memory;
Addr : in MAT.Types.Target_Addr;
Slot : in Allocation) is
begin
Memory.Memory.Probe_Malloc (Addr, Slot);
end Probe_Malloc;
-- ------------------------------
-- Take into account a free probe. Add the memory slot in the freed map and remove
-- the slot from the used slots map.
-- ------------------------------
procedure Probe_Free (Memory : in out Target_Memory;
Addr : in MAT.Types.Target_Addr;
Slot : in Allocation;
Size : out MAT.Types.Target_Size;
By : out MAT.Events.Event_Id_Type) is
begin
Memory.Memory.Probe_Free (Addr, Slot, Size, By);
end Probe_Free;
-- ------------------------------
-- Take into account a realloc probe. The old memory slot represented by Old_Addr is
-- removed from the used slots maps and the new memory slot [Addr .. Slot.Size] is
-- inserted in the used slots map.
-- ------------------------------
procedure Probe_Realloc (Memory : in out Target_Memory;
Addr : in MAT.Types.Target_Addr;
Old_Addr : in MAT.Types.Target_Addr;
Slot : in Allocation;
Old_Size : out MAT.Types.Target_Size;
By : out MAT.Events.Event_Id_Type) is
begin
Memory.Memory.Probe_Realloc (Addr, Old_Addr, Slot, Old_Size, By);
end Probe_Realloc;
-- ------------------------------
-- Take into account a secondary_stack mark. The address corresponds to
-- the `Mark_Id` structure that is recorded on the stack for the release.
-- ------------------------------
procedure Probe_Secondary_Mark (Memory : in out Target_Memory;
Addr : in MAT.Types.Target_Addr;
Slot : in Allocation) is
begin
Memory.Memory.Probe_Secondary_Mark (Addr, Slot);
end Probe_Secondary_Mark;
-- ------------------------------
-- Take into account a secondary_stack allocate. The address corresponds to
-- the allocated block returned by secondary stack allocate.
-- ------------------------------
procedure Probe_Secondary_Allocate (Memory : in out Target_Memory;
Addr : in MAT.Types.Target_Addr;
Slot : in Allocation) is
begin
Memory.Memory.Probe_Secondary_Allocate (Addr, Slot);
end Probe_Secondary_Allocate;
-- ------------------------------
-- Take into account a secondary_stack release. The address corresponds to
-- the `Mark_Id` structure that is recorded on the stack for the release.
-- It must match the first previous mark event with the same address and
-- the mark event is reported in `By`.
-- ------------------------------
procedure Probe_Secondary_Release (Memory : in out Target_Memory;
Addr : in MAT.Types.Target_Addr;
Slot : in Allocation;
By : out MAT.Events.Event_Id_Type) is
begin
Memory.Memory.Probe_Secondary_Release (Addr, Slot, By);
end Probe_Secondary_Release;
-- ------------------------------
-- Collect the information about memory slot sizes allocated by the application.
-- ------------------------------
procedure Size_Information (Memory : in out Target_Memory;
Sizes : in out MAT.Memory.Tools.Size_Info_Map) is
begin
Memory.Memory.Size_Information (Sizes);
end Size_Information;
-- ------------------------------
-- Collect the information about threads and the memory allocations they've made.
-- ------------------------------
procedure Thread_Information (Memory : in out Target_Memory;
Threads : in out Memory_Info_Map) is
begin
Memory.Memory.Thread_Information (Threads);
end Thread_Information;
-- ------------------------------
-- Collect the information about frames and the memory allocations they've made.
-- ------------------------------
procedure Frame_Information (Memory : in out Target_Memory;
Level : in Natural;
Frames : in out Frame_Info_Map) is
begin
Memory.Memory.Frame_Information (Level, Frames);
end Frame_Information;
-- ------------------------------
-- Get the global memory and allocation statistics.
-- ------------------------------
procedure Stat_Information (Memory : in out Target_Memory;
Result : out Memory_Stat) is
begin
Memory.Memory.Stat_Information (Result);
end Stat_Information;
-- ------------------------------
-- Find from the <tt>Memory</tt> map the memory slots whose address intersects
-- the region [From .. To] and which is selected by the given filter expression.
-- Add the memory slot in the <tt>Into</tt> list if it does not already contains
-- the memory slot.
-- ------------------------------
procedure Find (Memory : in out Target_Memory;
From : in MAT.Types.Target_Addr;
To : in MAT.Types.Target_Addr;
Filter : in MAT.Expressions.Expression_Type;
Into : in out MAT.Memory.Allocation_Map) is
begin
Memory.Memory.Find (From, To, Filter, Into);
end Find;
protected body Memory_Allocator is
-- ------------------------------
-- Add the memory region from the list of memory region managed by the program.
-- ------------------------------
procedure Add_Region (Region : in Region_Info) is
begin
Regions.Insert (Region.Start_Addr, Region);
end Add_Region;
-- ------------------------------
-- Find the region that matches the given name.
-- ------------------------------
function Find_Region (Name : in String) return Region_Info is
Iter : Region_Info_Cursor := Regions.First;
begin
while Region_Info_Maps.Has_Element (Iter) loop
declare
Region : constant Region_Info := Region_Info_Maps.Element (Iter);
Path : constant String := Ada.Strings.Unbounded.To_String (Region.Path);
Pos : constant Natural := Util.Strings.Rindex (Path, '/');
begin
if Path = Name then
return Region;
end if;
if Pos > 0 and then Path (Pos + 1 .. Path'Last) = Name then
return Region;
end if;
end;
Region_Info_Maps.Next (Iter);
end loop;
raise Not_Found with "Region '" & Name & "' was not found";
end Find_Region;
-- ------------------------------
-- Find the memory region that intersect the given section described by <tt>From</tt>
-- and <tt>To</tt>. Each memory region that intersects is added to the <tt>Into</tt>
-- map.
-- ------------------------------
procedure Find (From : in MAT.Types.Target_Addr;
To : in MAT.Types.Target_Addr;
Into : in out MAT.Memory.Region_Info_Map) is
Iter : Region_Info_Cursor;
begin
Iter := Regions.Floor (From);
if not Region_Info_Maps.Has_Element (Iter) then
Iter := Regions.First;
end if;
while Region_Info_Maps.Has_Element (Iter) loop
declare
Start : constant MAT.Types.Target_Addr := Region_Info_Maps.Key (Iter);
Region : Region_Info;
begin
exit when Start > To;
Region := Region_Info_Maps.Element (Iter);
if Region.End_Addr >= From then
if not Into.Contains (Start) then
Into.Insert (Start, Region);
end if;
end if;
Region_Info_Maps.Next (Iter);
end;
end loop;
end Find;
-- ------------------------------
-- Remove the memory region [Addr .. Addr + Size] from the free list.
-- ------------------------------
procedure Remove_Free (Addr : in MAT.Types.Target_Addr;
Size : in MAT.Types.Target_Size) is
Iter : Allocation_Cursor;
Last : constant MAT.Types.Target_Addr := Addr + MAT.Types.Target_Addr (Size);
Slot : Allocation;
begin
-- Walk the list of free blocks and remove all the blocks which intersect the region
-- [Addr .. Addr + Slot.Size]. We start walking at the first block below and near
-- the address. Slots are then removed when they intersect the malloc'ed region.
Iter := Freed_Slots.Floor (Addr);
while Allocation_Maps.Has_Element (Iter) loop
declare
Freed_Addr : constant MAT.Types.Target_Addr := Allocation_Maps.Key (Iter);
begin
exit when Freed_Addr > Last;
Slot := Allocation_Maps.Element (Iter);
if Freed_Addr + MAT.Types.Target_Addr (Slot.Size) > Addr then
if Stats.Total_Free > Slot.Size then
Stats.Total_Free := Stats.Total_Free - Slot.Size;
else
Stats.Total_Free := 0;
end if;
Freed_Slots.Delete (Iter);
Iter := Freed_Slots.Floor (Addr);
else
Allocation_Maps.Next (Iter);
end if;
end;
end loop;
end Remove_Free;
-- ------------------------------
-- Take into account a malloc probe. The memory slot [Addr .. Slot.Size] is inserted
-- in the used slots map. The freed slots that intersect the malloc'ed region are
-- removed from the freed map.
-- ------------------------------
procedure Probe_Malloc (Addr : in MAT.Types.Target_Addr;
Slot : in Allocation) is
begin
if Log.Get_Level = Util.Log.DEBUG_LEVEL then
Log.Debug ("Malloc at 0x{0} size{1}", MAT.Types.Hex_Image (Addr),
MAT.Types.Target_Size'Image (Slot.Size));
end if;
Stats.Malloc_Count := Stats.Malloc_Count + 1;
if Addr /= 0 then
Stats.Total_Alloc := Stats.Total_Alloc + Slot.Size;
Remove_Free (Addr, Slot.Size);
Used_Slots.Insert (Addr, Slot);
end if;
end Probe_Malloc;
-- ------------------------------
-- Take into account a free probe. Add the memory slot in the freed map and remove
-- the slot from the used slots map.
-- ------------------------------
procedure Probe_Free (Addr : in MAT.Types.Target_Addr;
Slot : in Allocation;
Size : out MAT.Types.Target_Size;
By : out MAT.Events.Event_Id_Type) is
Item : Allocation;
Iter : Allocation_Cursor;
begin
if Log.Get_Level = Util.Log.DEBUG_LEVEL then
Log.Debug ("Free 0x{0}", MAT.Types.Hex_Image (Addr));
end if;
Stats.Free_Count := Stats.Free_Count + 1;
Iter := Used_Slots.Find (Addr);
if Allocation_Maps.Has_Element (Iter) then
Item := Allocation_Maps.Element (Iter);
Size := Item.Size;
By := Item.Event;
if Stats.Total_Alloc >= Item.Size then
Stats.Total_Alloc := Stats.Total_Alloc - Item.Size;
else
Stats.Total_Alloc := 0;
end if;
Stats.Total_Free := Stats.Total_Free + Item.Size;
Used_Slots.Delete (Iter);
Item.Frame := Slot.Frame;
Iter := Freed_Slots.Find (Addr);
if not Allocation_Maps.Has_Element (Iter) then
Freed_Slots.Insert (Addr, Item);
end if;
else
Size := 0;
By := 0;
end if;
exception
when others =>
Log.Error ("Free 0x{0} raised some exception", MAT.Types.Hex_Image (Addr));
raise;
end Probe_Free;
-- ------------------------------
-- Take into account a realloc probe. The old memory slot represented by Old_Addr is
-- removed from the used slots maps and the new memory slot [Addr .. Slot.Size] is
-- inserted in the used slots map.
-- ------------------------------
procedure Probe_Realloc (Addr : in MAT.Types.Target_Addr;
Old_Addr : in MAT.Types.Target_Addr;
Slot : in Allocation;
Old_Size : out MAT.Types.Target_Size;
By : out MAT.Events.Event_Id_Type) is
procedure Update_Size (Key : in MAT.Types.Target_Addr;
Element : in out Allocation);
procedure Update_Size (Key : in MAT.Types.Target_Addr;
Element : in out Allocation) is
pragma Unreferenced (Key);
begin
if Stats.Total_Alloc >= Element.Size then
Stats.Total_Alloc := Stats.Total_Alloc - Element.Size;
else
Stats.Total_Alloc := 0;
end if;
Old_Size := Element.Size;
By := Element.Event;
Element.Size := Slot.Size;
Element.Frame := Slot.Frame;
Element.Event := Slot.Event;
end Update_Size;
Pos : Allocation_Cursor;
begin
if Log.Get_Level = Util.Log.DEBUG_LEVEL then
Log.Debug ("Realloc 0x{0} to 0x{1} size{2}", MAT.Types.Hex_Image (Old_Addr),
MAT.Types.Hex_Image (Addr), MAT.Types.Target_Size'Image (Slot.Size));
end if;
Old_Size := 0;
By := 0;
Stats.Realloc_Count := Stats.Realloc_Count + 1;
if Addr /= 0 then
Stats.Total_Alloc := Stats.Total_Alloc + Slot.Size;
Pos := Used_Slots.Find (Old_Addr);
if Allocation_Maps.Has_Element (Pos) then
if Addr = Old_Addr then
Used_Slots.Update_Element (Pos, Update_Size'Access);
else
Old_Size := Allocation_Maps.Element (Pos).Size;
By := Allocation_Maps.Element (Pos).Event;
Stats.Total_Alloc := Stats.Total_Alloc - Old_Size;
Used_Slots.Delete (Pos);
Used_Slots.Insert (Addr, Slot);
end if;
else
Used_Slots.Insert (Addr, Slot);
end if;
Remove_Free (Addr, Slot.Size);
end if;
end Probe_Realloc;
-- Take into account a secondary_stack mark. The address corresponds to
-- the `Mark_Id` structure that is recorded on the stack for the release.
procedure Probe_Secondary_Mark (Addr : in MAT.Types.Target_Addr;
Slot : in Allocation) is
begin
null;
end Probe_Secondary_Mark;
-- Take into account a secondary_stack allocate. The address corresponds to
-- the allocated block returned by secondary stack allocate.
procedure Probe_Secondary_Allocate (Addr : in MAT.Types.Target_Addr;
Slot : in Allocation) is
begin
null;
end Probe_Secondary_Allocate;
-- Take into account a secondary_stack release. The address corresponds to
-- the `Mark_Id` structure that is recorded on the stack for the release.
-- It must match the first previous mark event with the same address and
-- the mark event is reported in `By`.
procedure Probe_Secondary_Release (Addr : in MAT.Types.Target_Addr;
Slot : in Allocation;
By : out MAT.Events.Event_Id_Type) is
begin
By := 0;
end Probe_Secondary_Release;
-- ------------------------------
-- Collect the information about memory slot sizes allocated by the application.
-- ------------------------------
procedure Size_Information (Sizes : in out MAT.Memory.Tools.Size_Info_Map) is
begin
MAT.Memory.Tools.Size_Information (Used_Slots, Sizes);
end Size_Information;
-- ------------------------------
-- Collect the information about threads and the memory allocations they've made.
-- ------------------------------
procedure Thread_Information (Threads : in out Memory_Info_Map) is
begin
MAT.Memory.Tools.Thread_Information (Used_Slots, Threads);
end Thread_Information;
-- ------------------------------
-- Collect the information about frames and the memory allocations they've made.
-- ------------------------------
procedure Frame_Information (Level : in Natural;
Frames : in out Frame_Info_Map) is
begin
MAT.Memory.Tools.Frame_Information (Used_Slots, Level, Frames);
end Frame_Information;
-- ------------------------------
-- Find from the <tt>Memory</tt> map the memory slots whose address intersects
-- the region [From .. To] and which is selected by the given filter expression.
-- Add the memory slot in the <tt>Into</tt> list if it does not already contains
-- the memory slot.
-- ------------------------------
procedure Find (From : in MAT.Types.Target_Addr;
To : in MAT.Types.Target_Addr;
Filter : in MAT.Expressions.Expression_Type;
Into : in out MAT.Memory.Allocation_Map) is
begin
MAT.Memory.Tools.Find (Used_Slots, From, To, Filter, Into);
end Find;
-- ------------------------------
-- Get the global memory and allocation statistics.
-- ------------------------------
procedure Stat_Information (Result : out Memory_Stat) is
begin
Result := Stats;
Result.Used_Count := Natural (Used_Slots.Length);
end Stat_Information;
end Memory_Allocator;
end MAT.Memory.Targets;
|
reznikmm/matreshka | Ada | 3,555 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2017, 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$
------------------------------------------------------------------------------
package body WebDriver.Elements is
---------------
-- Send_Keys --
---------------
procedure Send_Keys
(Self : access Element'Class;
Text : League.Strings.Universal_String)
is
List : League.String_Vectors.Universal_String_Vector;
begin
List.Append (Text);
Self.Send_Keys (List);
end Send_Keys;
end WebDriver.Elements;
|
AdaCore/Ada_Drivers_Library | Ada | 8,036 | ads | -- This spec has been automatically generated from STM32F7x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.CEC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- control register
type CR_Register is record
-- CEC Enable
CECEN : Boolean := False;
-- Tx start of message
TXSOM : Boolean := False;
-- Tx End Of Message
TXEOM : Boolean := False;
-- unspecified
Reserved_3_31 : HAL.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
CECEN at 0 range 0 .. 0;
TXSOM at 0 range 1 .. 1;
TXEOM at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
subtype CFGR_SFT_Field is HAL.UInt3;
subtype CFGR_OAR_Field is HAL.UInt15;
-- configuration register
type CFGR_Register is record
-- Signal Free Time
SFT : CFGR_SFT_Field := 16#0#;
-- Rx-Tolerance
RXTOL : Boolean := False;
-- Rx-stop on bit rising error
BRESTP : Boolean := False;
-- Generate error-bit on bit rising error
BREGEN : Boolean := False;
-- Generate Error-Bit on Long Bit Period Error
LBPEGEN : Boolean := False;
-- Avoid Error-Bit Generation in Broadcast
BRDNOGEN : Boolean := False;
-- SFT Option Bit
SFTOP : Boolean := False;
-- unspecified
Reserved_9_15 : HAL.UInt7 := 16#0#;
-- Own addresses configuration
OAR : CFGR_OAR_Field := 16#0#;
-- Listen mode
LSTN : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFGR_Register use record
SFT at 0 range 0 .. 2;
RXTOL at 0 range 3 .. 3;
BRESTP at 0 range 4 .. 4;
BREGEN at 0 range 5 .. 5;
LBPEGEN at 0 range 6 .. 6;
BRDNOGEN at 0 range 7 .. 7;
SFTOP at 0 range 8 .. 8;
Reserved_9_15 at 0 range 9 .. 15;
OAR at 0 range 16 .. 30;
LSTN at 0 range 31 .. 31;
end record;
subtype TXDR_TXD_Field is HAL.UInt8;
-- Tx data register
type TXDR_Register is record
-- Write-only. Tx Data register
TXD : TXDR_TXD_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TXDR_Register use record
TXD at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype RXDR_RXDR_Field is HAL.UInt8;
-- Rx Data Register
type RXDR_Register is record
-- Read-only. CEC Rx Data Register
RXDR : RXDR_RXDR_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RXDR_Register use record
RXDR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- Interrupt and Status Register
type ISR_Register is record
-- Rx-Byte Received
RXBR : Boolean := False;
-- End Of Reception
RXEND : Boolean := False;
-- Rx-Overrun
RXOVR : Boolean := False;
-- Rx-Bit rising error
BRE : Boolean := False;
-- Rx-Short Bit period error
SBPE : Boolean := False;
-- Rx-Long Bit Period Error
LBPE : Boolean := False;
-- Rx-Missing Acknowledge
RXACKE : Boolean := False;
-- Arbitration Lost
ARBLST : Boolean := False;
-- Tx-Byte Request
TXBR : Boolean := False;
-- End of Transmission
TXEND : Boolean := False;
-- Tx-Buffer Underrun
TXUDR : Boolean := False;
-- Tx-Error
TXERR : Boolean := False;
-- Tx-Missing acknowledge error
TXACKE : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
RXBR at 0 range 0 .. 0;
RXEND at 0 range 1 .. 1;
RXOVR at 0 range 2 .. 2;
BRE at 0 range 3 .. 3;
SBPE at 0 range 4 .. 4;
LBPE at 0 range 5 .. 5;
RXACKE at 0 range 6 .. 6;
ARBLST at 0 range 7 .. 7;
TXBR at 0 range 8 .. 8;
TXEND at 0 range 9 .. 9;
TXUDR at 0 range 10 .. 10;
TXERR at 0 range 11 .. 11;
TXACKE at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-- interrupt enable register
type IER_Register is record
-- Rx-Byte Received Interrupt Enable
RXBRIE : Boolean := False;
-- End Of Reception Interrupt Enable
RXENDIE : Boolean := False;
-- Rx-Buffer Overrun Interrupt Enable
RXOVRIE : Boolean := False;
-- Bit Rising Error Interrupt Enable
BREIE : Boolean := False;
-- Short Bit Period Error Interrupt Enable
SBPEIE : Boolean := False;
-- Long Bit Period Error Interrupt Enable
LBPEIE : Boolean := False;
-- Rx-Missing Acknowledge Error Interrupt Enable
RXACKIE : Boolean := False;
-- Arbitration Lost Interrupt Enable
ARBLSTIE : Boolean := False;
-- Tx-Byte Request Interrupt Enable
TXBRIE : Boolean := False;
-- Tx-End of message interrupt enable
TXENDIE : Boolean := False;
-- Tx-Underrun interrupt enable
TXUDRIE : Boolean := False;
-- Tx-Error Interrupt Enable
TXERRIE : Boolean := False;
-- Tx-Missing Acknowledge Error Interrupt Enable
TXACKIE : Boolean := False;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
RXBRIE at 0 range 0 .. 0;
RXENDIE at 0 range 1 .. 1;
RXOVRIE at 0 range 2 .. 2;
BREIE at 0 range 3 .. 3;
SBPEIE at 0 range 4 .. 4;
LBPEIE at 0 range 5 .. 5;
RXACKIE at 0 range 6 .. 6;
ARBLSTIE at 0 range 7 .. 7;
TXBRIE at 0 range 8 .. 8;
TXENDIE at 0 range 9 .. 9;
TXUDRIE at 0 range 10 .. 10;
TXERRIE at 0 range 11 .. 11;
TXACKIE at 0 range 12 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- HDMI-CEC controller
type CEC_Peripheral is record
-- control register
CR : aliased CR_Register;
-- configuration register
CFGR : aliased CFGR_Register;
-- Tx data register
TXDR : aliased TXDR_Register;
-- Rx Data Register
RXDR : aliased RXDR_Register;
-- Interrupt and Status Register
ISR : aliased ISR_Register;
-- interrupt enable register
IER : aliased IER_Register;
end record
with Volatile;
for CEC_Peripheral use record
CR at 16#0# range 0 .. 31;
CFGR at 16#4# range 0 .. 31;
TXDR at 16#8# range 0 .. 31;
RXDR at 16#C# range 0 .. 31;
ISR at 16#10# range 0 .. 31;
IER at 16#14# range 0 .. 31;
end record;
-- HDMI-CEC controller
CEC_Periph : aliased CEC_Peripheral
with Import, Address => System'To_Address (16#40006C00#);
end STM32_SVD.CEC;
|
melwyncarlo/ProjectEuler | Ada | 993 | adb | with Ada.Integer_Text_IO;
-- Copyright 2021 Melwyn Francis Carlo
procedure A019 is
use Ada.Integer_Text_IO;
-- The first element is a dummy element.
Month_Constant : constant array (Integer range 1 .. 13) of Integer :=
(0, 1, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4, 5);
N : Integer := 0;
Day_Val : Integer;
begin
for I in 1901 .. 2000 loop
for J in 1 .. 12 loop
Day_Val := (((I - 1) * 365)
+ Integer (Float'Floor (Float (I - 1) / 400.0))
+ Integer (Float'Floor (Float (I - 1) / 4.0))
- Integer (Float'Floor (Float (I - 1) / 100.0))
+ ((J - 1) * 30)
+ Month_Constant (J)
+ 1);
if (I mod 4) = 0 and J > 2 then
Day_Val := Day_Val + 1;
end if;
Day_Val := Day_Val mod 7;
if Day_Val = 0 then
N := N + 1;
end if;
end loop;
end loop;
Put (N, Width => 0);
end A019;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 233 | adb | with STM32GD.Board; use STM32GD.Board;
procedure Main is
begin
Init;
USART.Transmit (79);
USART.Transmit (75);
USART.Transmit (32);
loop
USART.Transmit (USART.Receive);
LED.Toggle;
end loop;
end Main;
|
AdaCore/Ada_Drivers_Library | Ada | 3,519 | ads | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL.Touch_Panel;
with HAL.Framebuffer;
private with FT5336;
private with STM32.Device;
private with STM32.I2C;
private with STM32.GPIO;
package Touch_Panel_FT5336 is
type Touch_Panel is limited new HAL.Touch_Panel.Touch_Panel_Device
with private;
function Initialize
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation :=
HAL.Framebuffer.Default) return Boolean;
procedure Initialize
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation :=
HAL.Framebuffer.Default);
procedure Set_Orientation
(This : in out Touch_Panel;
Orientation : HAL.Framebuffer.Display_Orientation);
private
TP_I2C : STM32.I2C.I2C_Port renames STM32.Device.I2C_3;
TP_I2C_SDA : STM32.GPIO.GPIO_Point renames STM32.Device.PH7;
TP_I2C_SCL : STM32.GPIO.GPIO_Point renames STM32.Device.PH8;
TP_I2C_AF : STM32.GPIO_Alternate_Function renames STM32.Device.GPIO_AF_I2C3_4;
type Touch_Panel is limited new FT5336.FT5336_Device
(Port => TP_I2C'Access,
I2C_Addr => 16#70#) with null record;
end Touch_Panel_FT5336;
|
stcarrez/ada-asf | Ada | 2,020 | adb | -----------------------------------------------------------------------
-- asf-lifecycles-update -- Update model phase
-- Copyright (C) 2010, 2011, 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.
-----------------------------------------------------------------------
with Ada.Exceptions;
with ASF.Components.Root;
with ASF.Components.Base;
with Util.Log.Loggers;
-- The <b>ASF.Lifecycles.Update</b> package defines the behavior
-- of the update model phase.
package body ASF.Lifecycles.Update is
use Ada.Exceptions;
use Util.Log;
-- The logger
Log : constant Loggers.Logger := Loggers.Create ("ASF.Lifecycles.Update");
-- ------------------------------
-- Execute the update model phase.
-- ------------------------------
overriding
procedure Execute (Controller : in Update_Controller;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
pragma Unreferenced (Controller);
View : constant Components.Root.UIViewRoot := Context.Get_View_Root;
Root : constant access Components.Base.UIComponent'Class := Components.Root.Get_Root (View);
begin
Root.Process_Updates (Context);
exception
when E : others =>
Log.Error ("Error when running the update model phase {0}: {1}: {2}", "?",
Exception_Name (E), Exception_Message (E));
raise;
end Execute;
end ASF.Lifecycles.Update;
|
reznikmm/matreshka | Ada | 3,588 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- SQL Database Access --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2016, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This is hash function compatible with standard containers.
------------------------------------------------------------------------------
with Ada.Containers;
function SQL.Options.Hash
(Self : SQL_Options) return Ada.Containers.Hash_Type;
|
reznikmm/matreshka | Ada | 4,761 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Visitors;
with ODF.DOM.Draw_Area_Rectangle_Elements;
package Matreshka.ODF_Draw.Area_Rectangle_Elements is
type Draw_Area_Rectangle_Element_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Element_Node
and ODF.DOM.Draw_Area_Rectangle_Elements.ODF_Draw_Area_Rectangle
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Draw_Area_Rectangle_Element_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Area_Rectangle_Element_Node)
return League.Strings.Universal_String;
overriding procedure Enter_Node
(Self : not null access Draw_Area_Rectangle_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Leave_Node
(Self : not null access Draw_Area_Rectangle_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
overriding procedure Visit_Node
(Self : not null access Draw_Area_Rectangle_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
end Matreshka.ODF_Draw.Area_Rectangle_Elements;
|
jutayo23/Microprocessor_Systems | Ada | 12,389 | adb | M:part4a
F:G$putchar$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$getchar$0$0({2}DF,SC:S),Z,0,0,0,0,0
F:G$main$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$SYSCLK_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$PORT_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$UART0_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$ADC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$DAC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$INTERRUPT_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$TIMER_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
F:G$MAC_INIT$0$0({2}DF,SV:S),Z,0,0,0,0,0
S:G$start_conversion$0$0({1}SC:S),E,0,0
S:G$dig_val$0$0({2}SI:U),E,0,0
S:Lpart4a.main$adcValH$1$29({5}DA5d,SC:U),E,0,0
S:Lpart4a.main$adcValL$1$29({5}DA5d,SC:U),E,0,0
S:Lpart4a.main$result$1$29({2}SI:U),R,0,0,[r6,r7]
S:Lpart4a.main$results$1$29({4}DA2d,SI:U),E,0,0
S:Lpart4a.main$analogval$1$29({2}SI:U),R,0,0,[]
S:Lpart4a.main$analoghi$1$29({1}SC:U),R,0,0,[r4]
S:Lpart4a.main$analoglow$1$29({1}SC:U),R,0,0,[r5]
S:Lpart4a.main$VREF$1$29({4}SF:S),R,0,0,[]
S:G$P0$0$0({1}SC:U),I,0,0
S:G$SP$0$0({1}SC:U),I,0,0
S:G$DPL$0$0({1}SC:U),I,0,0
S:G$DPH$0$0({1}SC:U),I,0,0
S:G$SFRPAGE$0$0({1}SC:U),I,0,0
S:G$SFRNEXT$0$0({1}SC:U),I,0,0
S:G$SFRLAST$0$0({1}SC:U),I,0,0
S:G$PCON$0$0({1}SC:U),I,0,0
S:G$P1$0$0({1}SC:U),I,0,0
S:G$P2$0$0({1}SC:U),I,0,0
S:G$IE$0$0({1}SC:U),I,0,0
S:G$P3$0$0({1}SC:U),I,0,0
S:G$PSBANK$0$0({1}SC:U),I,0,0
S:G$IP$0$0({1}SC:U),I,0,0
S:G$PSW$0$0({1}SC:U),I,0,0
S:G$ACC$0$0({1}SC:U),I,0,0
S:G$EIE1$0$0({1}SC:U),I,0,0
S:G$EIE2$0$0({1}SC:U),I,0,0
S:G$B$0$0({1}SC:U),I,0,0
S:G$EIP1$0$0({1}SC:U),I,0,0
S:G$EIP2$0$0({1}SC:U),I,0,0
S:G$WDTCN$0$0({1}SC:U),I,0,0
S:G$TCON$0$0({1}SC:U),I,0,0
S:G$TMOD$0$0({1}SC:U),I,0,0
S:G$TL0$0$0({1}SC:U),I,0,0
S:G$TL1$0$0({1}SC:U),I,0,0
S:G$TH0$0$0({1}SC:U),I,0,0
S:G$TH1$0$0({1}SC:U),I,0,0
S:G$CKCON$0$0({1}SC:U),I,0,0
S:G$PSCTL$0$0({1}SC:U),I,0,0
S:G$SSTA0$0$0({1}SC:U),I,0,0
S:G$SCON0$0$0({1}SC:U),I,0,0
S:G$SCON$0$0({1}SC:U),I,0,0
S:G$SBUF0$0$0({1}SC:U),I,0,0
S:G$SBUF$0$0({1}SC:U),I,0,0
S:G$SPI0CFG$0$0({1}SC:U),I,0,0
S:G$SPI0DAT$0$0({1}SC:U),I,0,0
S:G$SPI0CKR$0$0({1}SC:U),I,0,0
S:G$EMI0TC$0$0({1}SC:U),I,0,0
S:G$EMI0CN$0$0({1}SC:U),I,0,0
S:G$_XPAGE$0$0({1}SC:U),I,0,0
S:G$EMI0CF$0$0({1}SC:U),I,0,0
S:G$SADDR0$0$0({1}SC:U),I,0,0
S:G$FLSCL$0$0({1}SC:U),I,0,0
S:G$SADEN0$0$0({1}SC:U),I,0,0
S:G$AMX0CF$0$0({1}SC:U),I,0,0
S:G$AMX0SL$0$0({1}SC:U),I,0,0
S:G$ADC0CF$0$0({1}SC:U),I,0,0
S:G$ADC0L$0$0({1}SC:U),I,0,0
S:G$ADC0H$0$0({1}SC:U),I,0,0
S:G$SMB0CN$0$0({1}SC:U),I,0,0
S:G$SMB0STA$0$0({1}SC:U),I,0,0
S:G$SMB0DAT$0$0({1}SC:U),I,0,0
S:G$SMB0ADR$0$0({1}SC:U),I,0,0
S:G$ADC0GTL$0$0({1}SC:U),I,0,0
S:G$ADC0GTH$0$0({1}SC:U),I,0,0
S:G$ADC0LTL$0$0({1}SC:U),I,0,0
S:G$ADC0LTH$0$0({1}SC:U),I,0,0
S:G$TMR2CN$0$0({1}SC:U),I,0,0
S:G$TMR2CF$0$0({1}SC:U),I,0,0
S:G$RCAP2L$0$0({1}SC:U),I,0,0
S:G$RCAP2H$0$0({1}SC:U),I,0,0
S:G$TMR2L$0$0({1}SC:U),I,0,0
S:G$TL2$0$0({1}SC:U),I,0,0
S:G$TMR2H$0$0({1}SC:U),I,0,0
S:G$TH2$0$0({1}SC:U),I,0,0
S:G$SMB0CR$0$0({1}SC:U),I,0,0
S:G$REF0CN$0$0({1}SC:U),I,0,0
S:G$DAC0L$0$0({1}SC:U),I,0,0
S:G$DAC0H$0$0({1}SC:U),I,0,0
S:G$DAC0CN$0$0({1}SC:U),I,0,0
S:G$PCA0CN$0$0({1}SC:U),I,0,0
S:G$PCA0MD$0$0({1}SC:U),I,0,0
S:G$PCA0CPM0$0$0({1}SC:U),I,0,0
S:G$PCA0CPM1$0$0({1}SC:U),I,0,0
S:G$PCA0CPM2$0$0({1}SC:U),I,0,0
S:G$PCA0CPM3$0$0({1}SC:U),I,0,0
S:G$PCA0CPM4$0$0({1}SC:U),I,0,0
S:G$PCA0CPM5$0$0({1}SC:U),I,0,0
S:G$PCA0CPL5$0$0({1}SC:U),I,0,0
S:G$PCA0CPH5$0$0({1}SC:U),I,0,0
S:G$ADC0CN$0$0({1}SC:U),I,0,0
S:G$PCA0CPL2$0$0({1}SC:U),I,0,0
S:G$PCA0CPH2$0$0({1}SC:U),I,0,0
S:G$PCA0CPL3$0$0({1}SC:U),I,0,0
S:G$PCA0CPH3$0$0({1}SC:U),I,0,0
S:G$PCA0CPL4$0$0({1}SC:U),I,0,0
S:G$PCA0CPH4$0$0({1}SC:U),I,0,0
S:G$RSTSRC$0$0({1}SC:U),I,0,0
S:G$SPI0CN$0$0({1}SC:U),I,0,0
S:G$PCA0L$0$0({1}SC:U),I,0,0
S:G$PCA0H$0$0({1}SC:U),I,0,0
S:G$PCA0CPL0$0$0({1}SC:U),I,0,0
S:G$PCA0CPH0$0$0({1}SC:U),I,0,0
S:G$PCA0CPL1$0$0({1}SC:U),I,0,0
S:G$PCA0CPH1$0$0({1}SC:U),I,0,0
S:G$CPT0CN$0$0({1}SC:U),I,0,0
S:G$CPT0MD$0$0({1}SC:U),I,0,0
S:G$SCON1$0$0({1}SC:U),I,0,0
S:G$SBUF1$0$0({1}SC:U),I,0,0
S:G$TMR3CN$0$0({1}SC:U),I,0,0
S:G$TMR3CF$0$0({1}SC:U),I,0,0
S:G$RCAP3L$0$0({1}SC:U),I,0,0
S:G$RCAP3H$0$0({1}SC:U),I,0,0
S:G$TMR3L$0$0({1}SC:U),I,0,0
S:G$TMR3H$0$0({1}SC:U),I,0,0
S:G$DAC1L$0$0({1}SC:U),I,0,0
S:G$DAC1H$0$0({1}SC:U),I,0,0
S:G$DAC1CN$0$0({1}SC:U),I,0,0
S:G$CPT1CN$0$0({1}SC:U),I,0,0
S:G$CPT1MD$0$0({1}SC:U),I,0,0
S:G$AMX2CF$0$0({1}SC:U),I,0,0
S:G$AMX2SL$0$0({1}SC:U),I,0,0
S:G$ADC2CF$0$0({1}SC:U),I,0,0
S:G$ADC2$0$0({1}SC:U),I,0,0
S:G$ADC2GT$0$0({1}SC:U),I,0,0
S:G$ADC2LT$0$0({1}SC:U),I,0,0
S:G$TMR4CN$0$0({1}SC:U),I,0,0
S:G$TMR4CF$0$0({1}SC:U),I,0,0
S:G$RCAP4L$0$0({1}SC:U),I,0,0
S:G$RCAP4H$0$0({1}SC:U),I,0,0
S:G$TMR4L$0$0({1}SC:U),I,0,0
S:G$TMR4H$0$0({1}SC:U),I,0,0
S:G$ADC2CN$0$0({1}SC:U),I,0,0
S:G$MAC0BL$0$0({1}SC:U),I,0,0
S:G$MAC0BH$0$0({1}SC:U),I,0,0
S:G$MAC0ACC0$0$0({1}SC:U),I,0,0
S:G$MAC0ACC1$0$0({1}SC:U),I,0,0
S:G$MAC0ACC2$0$0({1}SC:U),I,0,0
S:G$MAC0ACC3$0$0({1}SC:U),I,0,0
S:G$MAC0OVR$0$0({1}SC:U),I,0,0
S:G$MAC0STA$0$0({1}SC:U),I,0,0
S:G$MAC0AL$0$0({1}SC:U),I,0,0
S:G$MAC0AH$0$0({1}SC:U),I,0,0
S:G$MAC0CF$0$0({1}SC:U),I,0,0
S:G$MAC0RNDL$0$0({1}SC:U),I,0,0
S:G$MAC0RNDH$0$0({1}SC:U),I,0,0
S:G$FLSTAT$0$0({1}SC:U),I,0,0
S:G$PLL0CN$0$0({1}SC:U),I,0,0
S:G$OSCICN$0$0({1}SC:U),I,0,0
S:G$OSCICL$0$0({1}SC:U),I,0,0
S:G$OSCXCN$0$0({1}SC:U),I,0,0
S:G$PLL0DIV$0$0({1}SC:U),I,0,0
S:G$PLL0MUL$0$0({1}SC:U),I,0,0
S:G$PLL0FLT$0$0({1}SC:U),I,0,0
S:G$SFRPGCN$0$0({1}SC:U),I,0,0
S:G$CLKSEL$0$0({1}SC:U),I,0,0
S:G$CCH0MA$0$0({1}SC:U),I,0,0
S:G$P4MDOUT$0$0({1}SC:U),I,0,0
S:G$P5MDOUT$0$0({1}SC:U),I,0,0
S:G$P6MDOUT$0$0({1}SC:U),I,0,0
S:G$P7MDOUT$0$0({1}SC:U),I,0,0
S:G$CCH0CN$0$0({1}SC:U),I,0,0
S:G$CCH0TN$0$0({1}SC:U),I,0,0
S:G$CCH0LC$0$0({1}SC:U),I,0,0
S:G$P0MDOUT$0$0({1}SC:U),I,0,0
S:G$P1MDOUT$0$0({1}SC:U),I,0,0
S:G$P2MDOUT$0$0({1}SC:U),I,0,0
S:G$P3MDOUT$0$0({1}SC:U),I,0,0
S:G$P1MDIN$0$0({1}SC:U),I,0,0
S:G$FLACL$0$0({1}SC:U),I,0,0
S:G$P4$0$0({1}SC:U),I,0,0
S:G$P5$0$0({1}SC:U),I,0,0
S:G$XBR0$0$0({1}SC:U),I,0,0
S:G$XBR1$0$0({1}SC:U),I,0,0
S:G$XBR2$0$0({1}SC:U),I,0,0
S:G$P6$0$0({1}SC:U),I,0,0
S:G$P7$0$0({1}SC:U),I,0,0
S:G$TMR0$0$0({2}SI:U),I,0,0
S:G$TMR1$0$0({2}SI:U),I,0,0
S:G$TMR2$0$0({2}SI:U),I,0,0
S:G$RCAP2$0$0({2}SI:U),I,0,0
S:G$ADC0$0$0({2}SI:U),I,0,0
S:G$ADC0GT$0$0({2}SI:U),I,0,0
S:G$ADC0LT$0$0({2}SI:U),I,0,0
S:G$DAC0$0$0({2}SI:U),I,0,0
S:G$PCA0$0$0({2}SI:U),I,0,0
S:G$PCA0CP0$0$0({2}SI:U),I,0,0
S:G$PCA0CP1$0$0({2}SI:U),I,0,0
S:G$PCA0CP2$0$0({2}SI:U),I,0,0
S:G$PCA0CP3$0$0({2}SI:U),I,0,0
S:G$PCA0CP4$0$0({2}SI:U),I,0,0
S:G$PCA0CP5$0$0({2}SI:U),I,0,0
S:G$TMR3$0$0({2}SI:U),I,0,0
S:G$RCAP3$0$0({2}SI:U),I,0,0
S:G$DAC1$0$0({2}SI:U),I,0,0
S:G$TMR4$0$0({2}SI:U),I,0,0
S:G$RCAP4$0$0({2}SI:U),I,0,0
S:G$MAC0A$0$0({2}SI:U),I,0,0
S:G$MAC0ACC$0$0({4}SL:U),I,0,0
S:G$MAC0RND$0$0({2}SI:U),I,0,0
S:G$P0_0$0$0({1}SX:U),J,0,0
S:G$P0_1$0$0({1}SX:U),J,0,0
S:G$P0_2$0$0({1}SX:U),J,0,0
S:G$P0_3$0$0({1}SX:U),J,0,0
S:G$P0_4$0$0({1}SX:U),J,0,0
S:G$P0_5$0$0({1}SX:U),J,0,0
S:G$P0_6$0$0({1}SX:U),J,0,0
S:G$P0_7$0$0({1}SX:U),J,0,0
S:G$IT0$0$0({1}SX:U),J,0,0
S:G$IE0$0$0({1}SX:U),J,0,0
S:G$IT1$0$0({1}SX:U),J,0,0
S:G$IE1$0$0({1}SX:U),J,0,0
S:G$TR0$0$0({1}SX:U),J,0,0
S:G$TF0$0$0({1}SX:U),J,0,0
S:G$TR1$0$0({1}SX:U),J,0,0
S:G$TF1$0$0({1}SX:U),J,0,0
S:G$CP0HYN0$0$0({1}SX:U),J,0,0
S:G$CP0HYN1$0$0({1}SX:U),J,0,0
S:G$CP0HYP0$0$0({1}SX:U),J,0,0
S:G$CP0HYP1$0$0({1}SX:U),J,0,0
S:G$CP0FIF$0$0({1}SX:U),J,0,0
S:G$CP0RIF$0$0({1}SX:U),J,0,0
S:G$CP0OUT$0$0({1}SX:U),J,0,0
S:G$CP0EN$0$0({1}SX:U),J,0,0
S:G$CP1HYN0$0$0({1}SX:U),J,0,0
S:G$CP1HYN1$0$0({1}SX:U),J,0,0
S:G$CP1HYP0$0$0({1}SX:U),J,0,0
S:G$CP1HYP1$0$0({1}SX:U),J,0,0
S:G$CP1FIF$0$0({1}SX:U),J,0,0
S:G$CP1RIF$0$0({1}SX:U),J,0,0
S:G$CP1OUT$0$0({1}SX:U),J,0,0
S:G$CP1EN$0$0({1}SX:U),J,0,0
S:G$FLHBUSY$0$0({1}SX:U),J,0,0
S:G$P1_0$0$0({1}SX:U),J,0,0
S:G$P1_1$0$0({1}SX:U),J,0,0
S:G$P1_2$0$0({1}SX:U),J,0,0
S:G$P1_3$0$0({1}SX:U),J,0,0
S:G$P1_4$0$0({1}SX:U),J,0,0
S:G$P1_5$0$0({1}SX:U),J,0,0
S:G$P1_6$0$0({1}SX:U),J,0,0
S:G$P1_7$0$0({1}SX:U),J,0,0
S:G$RI0$0$0({1}SX:U),J,0,0
S:G$RI$0$0({1}SX:U),J,0,0
S:G$TI0$0$0({1}SX:U),J,0,0
S:G$TI$0$0({1}SX:U),J,0,0
S:G$RB80$0$0({1}SX:U),J,0,0
S:G$TB80$0$0({1}SX:U),J,0,0
S:G$REN0$0$0({1}SX:U),J,0,0
S:G$REN$0$0({1}SX:U),J,0,0
S:G$SM20$0$0({1}SX:U),J,0,0
S:G$SM10$0$0({1}SX:U),J,0,0
S:G$SM00$0$0({1}SX:U),J,0,0
S:G$RI1$0$0({1}SX:U),J,0,0
S:G$TI1$0$0({1}SX:U),J,0,0
S:G$RB81$0$0({1}SX:U),J,0,0
S:G$TB81$0$0({1}SX:U),J,0,0
S:G$REN1$0$0({1}SX:U),J,0,0
S:G$MCE1$0$0({1}SX:U),J,0,0
S:G$S1MODE$0$0({1}SX:U),J,0,0
S:G$P2_0$0$0({1}SX:U),J,0,0
S:G$P2_1$0$0({1}SX:U),J,0,0
S:G$P2_2$0$0({1}SX:U),J,0,0
S:G$P2_3$0$0({1}SX:U),J,0,0
S:G$P2_4$0$0({1}SX:U),J,0,0
S:G$P2_5$0$0({1}SX:U),J,0,0
S:G$P2_6$0$0({1}SX:U),J,0,0
S:G$P2_7$0$0({1}SX:U),J,0,0
S:G$EX0$0$0({1}SX:U),J,0,0
S:G$ET0$0$0({1}SX:U),J,0,0
S:G$EX1$0$0({1}SX:U),J,0,0
S:G$ET1$0$0({1}SX:U),J,0,0
S:G$ES0$0$0({1}SX:U),J,0,0
S:G$ES$0$0({1}SX:U),J,0,0
S:G$ET2$0$0({1}SX:U),J,0,0
S:G$EA$0$0({1}SX:U),J,0,0
S:G$P3_0$0$0({1}SX:U),J,0,0
S:G$P3_1$0$0({1}SX:U),J,0,0
S:G$P3_2$0$0({1}SX:U),J,0,0
S:G$P3_3$0$0({1}SX:U),J,0,0
S:G$P3_4$0$0({1}SX:U),J,0,0
S:G$P3_5$0$0({1}SX:U),J,0,0
S:G$P3_6$0$0({1}SX:U),J,0,0
S:G$P3_7$0$0({1}SX:U),J,0,0
S:G$PX0$0$0({1}SX:U),J,0,0
S:G$PT0$0$0({1}SX:U),J,0,0
S:G$PX1$0$0({1}SX:U),J,0,0
S:G$PT1$0$0({1}SX:U),J,0,0
S:G$PS0$0$0({1}SX:U),J,0,0
S:G$PS$0$0({1}SX:U),J,0,0
S:G$PT2$0$0({1}SX:U),J,0,0
S:G$SMBTOE$0$0({1}SX:U),J,0,0
S:G$SMBFTE$0$0({1}SX:U),J,0,0
S:G$AA$0$0({1}SX:U),J,0,0
S:G$SI$0$0({1}SX:U),J,0,0
S:G$STO$0$0({1}SX:U),J,0,0
S:G$STA$0$0({1}SX:U),J,0,0
S:G$ENSMB$0$0({1}SX:U),J,0,0
S:G$BUSY$0$0({1}SX:U),J,0,0
S:G$MAC0N$0$0({1}SX:U),J,0,0
S:G$MAC0SO$0$0({1}SX:U),J,0,0
S:G$MAC0Z$0$0({1}SX:U),J,0,0
S:G$MAC0HO$0$0({1}SX:U),J,0,0
S:G$CPRL2$0$0({1}SX:U),J,0,0
S:G$CT2$0$0({1}SX:U),J,0,0
S:G$TR2$0$0({1}SX:U),J,0,0
S:G$EXEN2$0$0({1}SX:U),J,0,0
S:G$EXF2$0$0({1}SX:U),J,0,0
S:G$TF2$0$0({1}SX:U),J,0,0
S:G$CPRL3$0$0({1}SX:U),J,0,0
S:G$CT3$0$0({1}SX:U),J,0,0
S:G$TR3$0$0({1}SX:U),J,0,0
S:G$EXEN3$0$0({1}SX:U),J,0,0
S:G$EXF3$0$0({1}SX:U),J,0,0
S:G$TF3$0$0({1}SX:U),J,0,0
S:G$CPRL4$0$0({1}SX:U),J,0,0
S:G$CT4$0$0({1}SX:U),J,0,0
S:G$TR4$0$0({1}SX:U),J,0,0
S:G$EXEN4$0$0({1}SX:U),J,0,0
S:G$EXF4$0$0({1}SX:U),J,0,0
S:G$TF4$0$0({1}SX:U),J,0,0
S:G$P4_0$0$0({1}SX:U),J,0,0
S:G$P4_1$0$0({1}SX:U),J,0,0
S:G$P4_2$0$0({1}SX:U),J,0,0
S:G$P4_3$0$0({1}SX:U),J,0,0
S:G$P4_4$0$0({1}SX:U),J,0,0
S:G$P4_5$0$0({1}SX:U),J,0,0
S:G$P4_6$0$0({1}SX:U),J,0,0
S:G$P4_7$0$0({1}SX:U),J,0,0
S:G$P$0$0({1}SX:U),J,0,0
S:G$F1$0$0({1}SX:U),J,0,0
S:G$OV$0$0({1}SX:U),J,0,0
S:G$RS0$0$0({1}SX:U),J,0,0
S:G$RS1$0$0({1}SX:U),J,0,0
S:G$F0$0$0({1}SX:U),J,0,0
S:G$AC$0$0({1}SX:U),J,0,0
S:G$CY$0$0({1}SX:U),J,0,0
S:G$CCF0$0$0({1}SX:U),J,0,0
S:G$CCF1$0$0({1}SX:U),J,0,0
S:G$CCF2$0$0({1}SX:U),J,0,0
S:G$CCF3$0$0({1}SX:U),J,0,0
S:G$CCF4$0$0({1}SX:U),J,0,0
S:G$CCF5$0$0({1}SX:U),J,0,0
S:G$CR$0$0({1}SX:U),J,0,0
S:G$CF$0$0({1}SX:U),J,0,0
S:G$P5_0$0$0({1}SX:U),J,0,0
S:G$P5_1$0$0({1}SX:U),J,0,0
S:G$P5_2$0$0({1}SX:U),J,0,0
S:G$P5_3$0$0({1}SX:U),J,0,0
S:G$P5_4$0$0({1}SX:U),J,0,0
S:G$P5_5$0$0({1}SX:U),J,0,0
S:G$P5_6$0$0({1}SX:U),J,0,0
S:G$P5_7$0$0({1}SX:U),J,0,0
S:G$AD0LJST$0$0({1}SX:U),J,0,0
S:G$AD0WINT$0$0({1}SX:U),J,0,0
S:G$AD0CM0$0$0({1}SX:U),J,0,0
S:G$AD0CM1$0$0({1}SX:U),J,0,0
S:G$AD0BUSY$0$0({1}SX:U),J,0,0
S:G$AD0INT$0$0({1}SX:U),J,0,0
S:G$AD0TM$0$0({1}SX:U),J,0,0
S:G$AD0EN$0$0({1}SX:U),J,0,0
S:G$AD2WINT$0$0({1}SX:U),J,0,0
S:G$AD2CM0$0$0({1}SX:U),J,0,0
S:G$AD2CM1$0$0({1}SX:U),J,0,0
S:G$AD2CM2$0$0({1}SX:U),J,0,0
S:G$AD2BUSY$0$0({1}SX:U),J,0,0
S:G$AD2INT$0$0({1}SX:U),J,0,0
S:G$AD2TM$0$0({1}SX:U),J,0,0
S:G$AD2EN$0$0({1}SX:U),J,0,0
S:G$P6_0$0$0({1}SX:U),J,0,0
S:G$P6_1$0$0({1}SX:U),J,0,0
S:G$P6_2$0$0({1}SX:U),J,0,0
S:G$P6_3$0$0({1}SX:U),J,0,0
S:G$P6_4$0$0({1}SX:U),J,0,0
S:G$P6_5$0$0({1}SX:U),J,0,0
S:G$P6_6$0$0({1}SX:U),J,0,0
S:G$P6_7$0$0({1}SX:U),J,0,0
S:G$SPIEN$0$0({1}SX:U),J,0,0
S:G$TXBMT$0$0({1}SX:U),J,0,0
S:G$NSSMD0$0$0({1}SX:U),J,0,0
S:G$NSSMD1$0$0({1}SX:U),J,0,0
S:G$RXOVRN$0$0({1}SX:U),J,0,0
S:G$MODF$0$0({1}SX:U),J,0,0
S:G$WCOL$0$0({1}SX:U),J,0,0
S:G$SPIF$0$0({1}SX:U),J,0,0
S:G$P7_0$0$0({1}SX:U),J,0,0
S:G$P7_1$0$0({1}SX:U),J,0,0
S:G$P7_2$0$0({1}SX:U),J,0,0
S:G$P7_3$0$0({1}SX:U),J,0,0
S:G$P7_4$0$0({1}SX:U),J,0,0
S:G$P7_5$0$0({1}SX:U),J,0,0
S:G$P7_6$0$0({1}SX:U),J,0,0
S:G$P7_7$0$0({1}SX:U),J,0,0
S:G$_print_format$0$0({2}DF,SI:S),C,0,0
S:G$printf_small$0$0({2}DF,SV:S),C,0,0
S:G$printf$0$0({2}DF,SI:S),C,0,0
S:G$vprintf$0$0({2}DF,SI:S),C,0,0
S:G$sprintf$0$0({2}DF,SI:S),C,0,0
S:G$vsprintf$0$0({2}DF,SI:S),C,0,0
S:G$puts$0$0({2}DF,SI:S),C,0,0
S:G$gets$0$0({2}DF,DG,SC:S),C,0,0
S:G$printf_fast$0$0({2}DF,SV:S),C,0,0
S:G$printf_fast_f$0$0({2}DF,SV:S),C,0,0
S:G$printf_tiny$0$0({2}DF,SV:S),C,0,0
|
jorge-real/TTS-Runtime-Ravenscar | Ada | 14,512 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . B B . T H R E A D S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2018, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
with System.Parameters;
with System.BB.Interrupts;
with System.BB.Protection;
with System.BB.Threads.Queues;
package body System.BB.Threads is
use System.Multiprocessors;
use System.BB.CPU_Primitives;
use System.BB.Board_Support.Multiprocessors;
use System.BB.Time;
use Board_Support;
use type System.Storage_Elements.Storage_Offset;
procedure Initialize_Thread
(Id : Thread_Id;
Code : System.Address;
Arg : System.Address;
Priority : Integer;
This_CPU : System.Multiprocessors.CPU_Range;
Stack_Top : System.Address;
Stack_Bottom : System.Address);
-----------------------
-- Stack information --
-----------------------
-- Boundaries of the stack for the environment task, defined by the linker
-- script file.
Top_Of_Environment_Stack : constant System.Address;
pragma Import (Asm, Top_Of_Environment_Stack, "__stack_end");
-- Top of the stack to be used by the environment task
Bottom_Of_Environment_Stack : constant System.Address;
pragma Import (Asm, Bottom_Of_Environment_Stack, "__stack_start");
-- Bottom of the stack to be used by the environment task
------------------
-- Get_Affinity --
------------------
function Get_Affinity (Thread : Thread_Id) return CPU_Range is
begin
return Thread.Base_CPU;
end Get_Affinity;
-------------
-- Get_CPU --
-------------
function Get_CPU (Thread : Thread_Id) return CPU is
begin
if Thread.Base_CPU = Not_A_Specific_CPU then
-- Return the implementation specific default CPU
return CPU'First;
else
return CPU (Thread.Base_CPU);
end if;
end Get_CPU;
--------------
-- Get_ATCB --
--------------
function Get_ATCB return System.Address is
begin
-- This is not a light operation as there is a function call
return Queues.Running_Thread.ATCB;
end Get_ATCB;
------------------
-- Get_Priority --
------------------
function Get_Priority (Id : Thread_Id) return Integer is
begin
-- This function does not need to be protected by Enter_Kernel and
-- Leave_Kernel, because the Active_Priority value is only updated by
-- Set_Priority (atomically). Moreover, Active_Priority is marked as
-- Volatile.
return Id.Active_Priority;
end Get_Priority;
-----------------------------
-- Initialize_Thread --
-----------------------------
procedure Initialize_Thread
(Id : Thread_Id;
Code : System.Address;
Arg : System.Address;
Priority : Integer;
This_CPU : System.Multiprocessors.CPU_Range;
Stack_Top : System.Address;
Stack_Bottom : System.Address) is
begin
-- The environment thread executes the main procedure of the program
-- CPU of the environment thread is current one (initialization CPU)
Id.Base_CPU := This_CPU;
-- The active priority is initially equal to the base priority
Id.Base_Priority := Priority;
Id.Active_Priority := Priority;
-- Insert in the global list
-- ??? Not thread safe.
Id.Global_List := Queues.Global_List;
Queues.Global_List := Id;
-- Insert task inside the ready list (as last within its priority)
Queues.Insert (Id);
-- Store stack information
Id.Top_Of_Stack := Stack_Top;
Id.Bottom_Of_Stack := Stack_Bottom;
-- The initial state is Runnable
Id.State := Runnable;
-- Not currently in an interrupt handler
Id.In_Interrupt := False;
-- No wakeup has been yet signaled
Id.Wakeup_Signaled := False;
-- No hold has been yet signaled
Id.Hold_Signaled := False;
-- Initialize alarm status
Id.Alarm_Time := System.BB.Time.Time'Last;
Id.Next_Alarm := Null_Thread_Id;
-- Reset execution time
Id.Execution_Time :=
System.BB.Time.Initial_Composite_Execution_Time;
-- Initialize the saved registers. We can ignore the stack and code to
-- execute because the environment task is already executing. We are
-- interested in the initialization of the rest of the state, such as
-- the interrupt nesting level and the cache state.
Initialize_Context
(Buffer => Id.Context'Access,
Program_Counter => Code,
Argument => Arg,
Stack_Pointer => (if System.Parameters.Stack_Grows_Down
then Id.Top_Of_Stack
else Id.Bottom_Of_Stack));
end Initialize_Thread;
----------------
-- Initialize --
----------------
procedure Initialize
(Environment_Thread : Thread_Id;
Main_Priority : System.Any_Priority)
is
Main_CPU : constant System.Multiprocessors.CPU := Current_CPU;
begin
-- Perform some basic hardware initialization (clock, timer, and
-- interrupt handlers).
-- First initialize interrupt stacks
Interrupts.Initialize_Interrupts;
-- Then the CPU (which set interrupt stack pointer)
Initialize_CPU;
-- Then the devices
Board_Support.Initialize_Board;
Time.Initialize_Timers;
-- Initialize internal queues and the environment task
Protection.Enter_Kernel;
-- The environment thread executes the main procedure of the program
Initialize_Thread
(Environment_Thread, Null_Address, Null_Address,
Main_Priority, Main_CPU,
Top_Of_Environment_Stack'Address,
Bottom_Of_Environment_Stack'Address);
Queues.Running_Thread_Table (Main_CPU) := Environment_Thread;
-- The tasking executive is initialized
Initialized := True;
Protection.Leave_Kernel;
end Initialize;
----------------------
-- Initialize_Slave --
----------------------
procedure Initialize_Slave
(Idle_Thread : Thread_Id;
Idle_Priority : Integer;
Stack_Address : System.Address;
Stack_Size : System.Storage_Elements.Storage_Offset)
is
CPU_Id : constant System.Multiprocessors.CPU := Current_CPU;
begin
Initialize_Thread
(Idle_Thread, Null_Address, Null_Address,
Idle_Priority, CPU_Id,
Stack_Address + Stack_Size, Stack_Address);
Queues.Running_Thread_Table (CPU_Id) := Idle_Thread;
end Initialize_Slave;
--------------
-- Set_ATCB --
--------------
procedure Set_ATCB (Id : Thread_Id; ATCB : System.Address) is
begin
-- Set_ATCB is only called in the initialization of the task
Id.ATCB := ATCB;
end Set_ATCB;
------------------
-- Set_Priority --
------------------
procedure Set_Priority (Priority : Integer) is
begin
Protection.Enter_Kernel;
-- The Ravenscar profile does not allow dynamic priority changes. Tasks
-- change their priority only when they inherit the ceiling priority of
-- a PO (Ceiling Locking policy). Hence, the task must be running when
-- changing the priority. It is not possible to change the priority of
-- another thread within the Ravenscar profile, so that is why
-- Running_Thread is used.
-- Priority changes are only possible as a result of inheriting the
-- ceiling priority of a protected object. Hence, it can never be set
-- a priority which is lower than the base priority of the thread.
pragma Assert
(Queues.Running_Thread /= Null_Thread_Id
and then Priority >= Queues.Running_Thread.Base_Priority);
Queues.Change_Priority (Queues.Running_Thread, Priority);
Protection.Leave_Kernel;
end Set_Priority;
-----------
-- Sleep --
-----------
procedure Sleep is
Self_Id : constant Thread_Id := Queues.Running_Thread;
begin
Protection.Enter_Kernel;
-- It can only suspend if it is executing
pragma Assert
(Self_Id /= Null_Thread_Id and then Self_Id.State = Runnable);
if Self_Id.Wakeup_Signaled then
-- Another thread has already executed a Wakeup on this thread so
-- that we just consume the token and continue execution. It means
-- that just before this call to Sleep the task has been preempted
-- by the task that is awaking it. Hence the Sleep/Wakeup calls do
-- not happen in the expected order, and we use the Wakeup_Signaled
-- to flag this event so it is not lost.
-- The situation is the following:
-- 1) a task A is going to wait in an entry for a barrier
-- 2) task A releases the lock associated to the protected object
-- 3) task A calls Sleep to suspend itself
-- 4) a task B opens the barrier and awakes task A (calls Wakeup)
-- This is the expected sequence of events, but 4) may happen
-- before 3) because task A decreases its priority in step 2) as a
-- consequence of releasing the lock (Ceiling_Locking). Hence, task
-- A may be preempted by task B in the window between releasing the
-- protected object and actually suspending itself, and the Wakeup
-- call by task B in 4) can happen before the Sleep call in 3).
Self_Id.Wakeup_Signaled := False;
else
-- Update status
Self_Id.State := Suspended;
-- Extract from the list of ready threads
Queues.Extract (Self_Id);
-- The currently executing thread is now blocked, and it will leave
-- the CPU when executing the Leave_Kernel procedure.
end if;
Protection.Leave_Kernel;
-- Now the thread has been awaken again and it is executing
end Sleep;
-------------------
-- Thread_Create --
-------------------
procedure Thread_Create
(Id : Thread_Id;
Code : System.Address;
Arg : System.Address;
Priority : Integer;
Base_CPU : System.Multiprocessors.CPU_Range;
Stack_Address : System.Address;
Stack_Size : System.Storage_Elements.Storage_Offset)
is
begin
Protection.Enter_Kernel;
Initialize_Thread
(Id, Code, Arg, Priority, Base_CPU,
((Stack_Address + Stack_Size) /
Standard'Maximum_Alignment) * Standard'Maximum_Alignment,
Stack_Address);
Protection.Leave_Kernel;
end Thread_Create;
-----------------
-- Thread_Self --
-----------------
function Thread_Self return Thread_Id is
begin
-- Return the thread that is currently executing
return Queues.Running_Thread;
end Thread_Self;
------------
-- Wakeup --
------------
procedure Wakeup (Id : Thread_Id) is
begin
Protection.Enter_Kernel;
if Id.State = Suspended then
-- The thread is already waiting so that we awake it
-- Update status
Id.State := Runnable;
-- Insert the thread at the tail of its active priority so that the
-- thread will resume execution.
Queues.Insert (Id);
else
-- The thread is not yet waiting so that we just signal that the
-- Wakeup command has been executed. We are waking up a task that
-- is going to wait in an entry for a barrier, but before calling
-- Sleep it has been preempted by the task awaking it.
Id.Wakeup_Signaled := True;
end if;
pragma Assert (Id.State = Runnable);
Protection.Leave_Kernel;
end Wakeup;
end System.BB.Threads;
|
reznikmm/matreshka | Ada | 4,935 | 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_Elements;
with AMF.Standard_Profile_L2.Refines;
with AMF.UML.Abstractions;
with AMF.Visitors;
package AMF.Internals.Standard_Profile_L2_Refines is
type Standard_Profile_L2_Refine_Proxy is
limited new AMF.Internals.UML_Elements.UML_Element_Base
and AMF.Standard_Profile_L2.Refines.Standard_Profile_L2_Refine with null record;
overriding function Get_Base_Abstraction
(Self : not null access constant Standard_Profile_L2_Refine_Proxy)
return AMF.UML.Abstractions.UML_Abstraction_Access;
-- Getter of Refine::base_Abstraction.
--
overriding procedure Set_Base_Abstraction
(Self : not null access Standard_Profile_L2_Refine_Proxy;
To : AMF.UML.Abstractions.UML_Abstraction_Access);
-- Setter of Refine::base_Abstraction.
--
overriding procedure Enter_Element
(Self : not null access constant Standard_Profile_L2_Refine_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 Standard_Profile_L2_Refine_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 Standard_Profile_L2_Refine_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.Standard_Profile_L2_Refines;
|
ohenley/ada-util | Ada | 8,283 | adb | -----------------------------------------------------------------------
-- util-encoders-hmac-sha1 -- Compute HMAC-SHA1 authentication code
-- Copyright (C) 2011, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Encoders.Base16;
with Util.Encoders.Base64;
-- The <b>Util.Encodes.HMAC.SHA1</b> package generates HMAC-SHA1 authentication
-- (See RFC 2104 - HMAC: Keyed-Hashing for Message Authentication).
package body Util.Encoders.HMAC.SHA1 is
-- ------------------------------
-- Sign the data string with the key and return the HMAC-SHA1 code in binary.
-- ------------------------------
function Sign (Key : in String;
Data : in String) return Util.Encoders.SHA1.Hash_Array is
Ctx : Context;
Result : Util.Encoders.SHA1.Hash_Array;
begin
Set_Key (Ctx, Key);
Update (Ctx, Data);
Finish (Ctx, Result);
return Result;
end Sign;
-- ------------------------------
-- Sign the data string with the key and return the HMAC-SHA1 code as hexadecimal string.
-- ------------------------------
function Sign (Key : in String;
Data : in String) return Util.Encoders.SHA1.Digest is
Ctx : Context;
Result : Util.Encoders.SHA1.Digest;
begin
Set_Key (Ctx, Key);
Update (Ctx, Data);
Finish (Ctx, Result);
return Result;
end Sign;
-- ------------------------------
-- Sign the data string with the key and return the HMAC-SHA1 code as base64 string.
-- When <b>URL</b> is True, use the base64 URL alphabet to encode in base64.
-- ------------------------------
function Sign_Base64 (Key : in String;
Data : in String;
URL : in Boolean := False) return Util.Encoders.SHA1.Base64_Digest is
Ctx : Context;
Result : Util.Encoders.SHA1.Base64_Digest;
begin
Set_Key (Ctx, Key);
Update (Ctx, Data);
Finish_Base64 (Ctx, Result, URL);
return Result;
end Sign_Base64;
-- ------------------------------
-- Set the hmac private key. The key must be set before calling any <b>Update</b>
-- procedure.
-- ------------------------------
procedure Set_Key (E : in out Context;
Key : in String) is
Buf : Ada.Streams.Stream_Element_Array (1 .. Key'Length);
for Buf'Address use Key'Address;
pragma Import (Ada, Buf);
begin
Set_Key (E, Buf);
end Set_Key;
IPAD : constant Ada.Streams.Stream_Element := 16#36#;
OPAD : constant Ada.Streams.Stream_Element := 16#5c#;
-- ------------------------------
-- Set the hmac private key. The key must be set before calling any <b>Update</b>
-- procedure.
-- ------------------------------
procedure Set_Key (E : in out Context;
Key : in Ada.Streams.Stream_Element_Array) is
use type Ada.Streams.Stream_Element_Offset;
use type Ada.Streams.Stream_Element;
begin
-- Reduce the key
if Key'Length > 64 then
Util.Encoders.SHA1.Update (E.SHA, Key);
Util.Encoders.SHA1.Finish (E.SHA, E.Key (0 .. 19));
E.Key_Len := 19;
else
E.Key_Len := Key'Length - 1;
E.Key (0 .. E.Key_Len) := Key;
end if;
-- Hash the key in the SHA1 context.
declare
Block : Ada.Streams.Stream_Element_Array (0 .. 63);
begin
for I in 0 .. E.Key_Len loop
Block (I) := IPAD xor E.Key (I);
end loop;
for I in E.Key_Len + 1 .. 63 loop
Block (I) := IPAD;
end loop;
Util.Encoders.SHA1.Update (E.SHA, Block);
end;
end Set_Key;
-- ------------------------------
-- Update the hash with the string.
-- ------------------------------
procedure Update (E : in out Context;
S : in String) is
begin
Util.Encoders.SHA1.Update (E.SHA, S);
end Update;
-- ------------------------------
-- Update the hash with the string.
-- ------------------------------
procedure Update (E : in out Context;
S : in Ada.Streams.Stream_Element_Array) is
begin
Util.Encoders.SHA1.Update (E.SHA, S);
end Update;
-- ------------------------------
-- Computes the HMAC-SHA1 with the private key and the data collected by
-- the <b>Update</b> procedures. Returns the raw binary hash in <b>Hash</b>.
-- ------------------------------
procedure Finish (E : in out Context;
Hash : out Util.Encoders.SHA1.Hash_Array) is
use type Ada.Streams.Stream_Element;
use type Ada.Streams.Stream_Element_Offset;
begin
Util.Encoders.SHA1.Finish (E.SHA, Hash);
-- Hash the key in the SHA1 context.
declare
Block : Ada.Streams.Stream_Element_Array (0 .. 63);
begin
for I in 0 .. E.Key_Len loop
Block (I) := OPAD xor E.Key (I);
end loop;
if E.Key_Len < 63 then
for I in E.Key_Len + 1 .. 63 loop
Block (I) := OPAD;
end loop;
end if;
Util.Encoders.SHA1.Update (E.SHA, Block);
end;
Util.Encoders.SHA1.Update (E.SHA, Hash);
Util.Encoders.SHA1.Finish (E.SHA, Hash);
end Finish;
-- ------------------------------
-- Computes the HMAC-SHA1 with the private key and the data collected by
-- the <b>Update</b> procedures. Returns the hexadecimal hash in <b>Hash</b>.
-- ------------------------------
procedure Finish (E : in out Context;
Hash : out Util.Encoders.SHA1.Digest) is
H : Util.Encoders.SHA1.Hash_Array;
B : Util.Encoders.Base16.Encoder;
begin
Finish (E, H);
B.Convert (H, Hash);
end Finish;
-- ------------------------------
-- Computes the HMAC-SHA1 with the private key and the data collected by
-- the <b>Update</b> procedures. Returns the base64 hash in <b>Hash</b>.
-- When <b>URL</b> is True, use the base64 URL alphabet to encode in base64.
-- ------------------------------
procedure Finish_Base64 (E : in out Context;
Hash : out Util.Encoders.SHA1.Base64_Digest;
URL : in Boolean := False) is
H : Util.Encoders.SHA1.Hash_Array;
B : Util.Encoders.Base64.Encoder;
begin
Finish (E, H);
B.Set_URL_Mode (URL);
B.Convert (H, Hash);
end Finish_Base64;
-- Encodes the binary input stream represented by <b>Data</b> into
-- an SHA-1 hash output stream <b>Into</b>.
--
-- If the transformer does not have enough room to write the result,
-- it must return in <b>Encoded</b> the index of the last encoded
-- position in the <b>Data</b> stream.
--
-- The transformer returns in <b>Last</b> the last valid position
-- in the output stream <b>Into</b>.
--
-- The <b>Encoding_Error</b> exception is raised if the input
-- stream cannot be transformed.
overriding
procedure Transform (E : in out Encoder;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Encoded : out Ada.Streams.Stream_Element_Offset) is
begin
null;
end Transform;
-- Initialize the SHA-1 context.
overriding
procedure Initialize (E : in out Context) is
begin
null;
end Initialize;
end Util.Encoders.HMAC.SHA1;
|
MinimSecure/unum-sdk | Ada | 819 | adb | -- Copyright 2008-2016 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
begin
String_Var (String_Var'First) := 'h'; -- START
end Foo;
|
charlesdaniels/libagar | Ada | 5,981 | adb | ------------------------------------------------------------------------------
-- AGAR CORE LIBRARY --
-- A G A R . D A T A _ S O U R C E --
-- B o d y --
-- --
-- Copyright (c) 2018-2019, Julien Nadeau Carriere ([email protected]) --
-- Copyright (c) 2010, coreland ([email protected]) --
-- --
-- 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. --
------------------------------------------------------------------------------
package body Agar.Data_Source is
procedure Open_File
(Path : in String;
Mode : in String;
Source : out Data_Source_Access)
is
Ch_Path : aliased C.char_array := C.To_C (Path);
Ch_Mode : aliased C.char_array := C.To_C (Mode);
begin
Source := AG_OpenFile
(Path => To_Chars_Ptr(Ch_Path'Unchecked_Access),
Mode => To_Chars_Ptr(Ch_Mode'Unchecked_Access));
end;
package body IO is
Element_Bytes : constant AG_Size := Element_Type'Size / System.Storage_Unit;
procedure Read
(Source : in Data_Source_Not_Null_Access;
Buffer : out Element_Array_Type;
Read : out Element_Count_Type;
Status : out IO_Status) is
begin
Status := AG_Read
(Source => Source,
Buffer => Buffer (Buffer'First)'Address,
Size => Element_Bytes,
Members => Buffer'Length);
if Status = Success then
Read := Buffer'Length;
end if;
end Read;
procedure Read_At_Offset
(Source : in Data_Source_Not_Null_Access;
Offset : in AG_Offset;
Buffer : out Element_Array_Type;
Read : out Element_Count_Type;
Status : out IO_Status) is
begin
Status := AG_ReadAt
(Source => Source,
Buffer => Buffer (Buffer'First)'Address,
Size => Element_Bytes,
Members => Buffer'Length,
Offset => Offset);
if Status = Success then
Read := Buffer'Length;
end if;
end Read_At_Offset;
procedure Write
(Source : in Data_Source_Not_Null_Access;
Buffer : in Element_Array_Type;
Wrote : out Element_Count_Type;
Status : out IO_Status) is
begin
Status := AG_Write
(Source => Source,
Buffer => Buffer (Buffer'First)'Address,
Size => Element_Bytes,
Members => Buffer'Length);
if Status = Success then
Wrote := Buffer'Length;
end if;
end;
procedure Write_At_Offset
(Source : in Data_Source_Not_Null_Access;
Offset : in AG_Offset;
Buffer : in Element_Array_Type;
Wrote : out Element_Count_Type;
Status : out IO_Status) is
begin
Status := AG_WriteAt
(Source => Source,
Buffer => Buffer (Buffer'First)'Address,
Size => Element_Bytes,
Offset => Offset,
Members => Buffer'Length);
if Status = Success then
Wrote := Buffer'Length;
else
Wrote := 0;
end if;
end;
end IO;
function Read_String (Source : in Data_Source_Access) return String
is
Result : chars_ptr;
begin
Result := AG_ReadStringLen(Source, AG_Size(LOAD_STRING_MAX));
if Result = Null_Ptr then
raise Program_Error with ERR.Get_Error;
end if;
-- XXX FIXME leak
return C.To_Ada(Value(Result));
end;
function Read_String
(Source : in Data_Source_Access;
Max_Length : in Natural) return String
is
Result : chars_ptr;
begin
Result := AG_ReadStringLen(Source, AG_Size(Max_Length));
if Result = Null_Ptr then
raise Program_Error with ERR.Get_Error;
end if;
-- XXX FIXME leak
return C.To_Ada(Value(Result));
end;
function Read_Padded_String
(Source : in Data_Source_Access;
Length : in Natural) return String
is
Ch_Name : aliased C.char_array := (1 .. C.size_t(Length) => C.nul);
Result : AG_Size;
begin
Result := AG_CopyStringPadded
(Buffer => To_Chars_Ptr(Ch_Name'Unchecked_Access),
Source => Source,
Size => Ch_Name'Length);
if Integer(Result) = 0 then
raise Program_Error with ERR.Get_Error;
end if;
return C.To_Ada(Ch_Name);
end;
procedure Write_String
(Source : in Data_Source_Access;
Data : in String)
is
Ch_Data : aliased C.char_array := C.To_C(Data);
begin
AG_WriteString
(Source => Source,
Data => To_Chars_Ptr(Ch_Data'Unchecked_Access));
end;
procedure Write_Padded_String
(Source : in Data_Source_Access;
Data : in String;
Length : in Natural)
is
Ch_Data : aliased C.char_array := C.To_C(Data);
begin
AG_WriteStringPadded
(Source => Source,
Data => To_Chars_Ptr(Ch_Data'Unchecked_Access),
Length => AG_Size(Length));
end;
end Agar.Data_Source;
|
stcarrez/ada-awa | Ada | 5,535 | ads | -----------------------------------------------------------------------
-- awa-storages -- Storage module
-- Copyright (C) 2012, 2015, 2016, 2018, 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Finalization;
with ADO;
-- = Storages Module =
-- The `storages` module provides a set of storage services allowing
-- an application to store data files, documents, images in a persistent area.
-- The persistent store can be on a file system, in the database or provided
-- by a remote service such as Amazon Simple Storage Service.
--
-- @include awa-storages-modules.ads
--
-- == Creating a storage ==
-- A data in the storage is represented by a `Storage_Ref` instance.
-- The data itself can be physically stored in a file system (`FILE` mode),
-- in the database (`DATABASE` mode) or on a remote server (`URL` mode).
-- To put a file in the storage space, first create the storage object
-- instance:
--
-- Data : AWA.Storages.Models.Storage_Ref;
--
-- Then setup the storage mode that you want. The storage service uses
-- this information to save the data in a file, in the database or in
-- a remote service (in the future).
-- To save a file in the store, we can use the `Save` operation of the
-- storage service.
-- It will read the file and put in in the corresponding persistent store
-- (the database in this example).
--
-- Service.Save (Into => Data, Path => Path_To_The_File,
-- Storage => AWA.Storages.Models.DATABASE);
--
-- Upon successful completion, the storage instance `Data` will be allocated
-- a unique identifier that can be retrieved by `Get_Id` or `Get_Key`.
--
-- == Getting the data ==
-- Several operations are defined to retrieve the data. Each of them has been
-- designed to optimize the retrieval and
--
-- * The data can be retrieved in a local file.
-- This mode is useful if an external program must be launched and be able
-- to read the file. If the storage mode of the data is `FILE`, the path
-- of the file on the storage file system is used. For other storage modes,
-- the file is saved in a temporary file. In that case the `Store_Local`
-- database table is used to track such locally saved data.
--
-- * The data can be returned as a stream.
-- When the application has to read the data, opening a read stream
-- connection is the most efficient mechanism.
--
-- == Local file ==
-- To access the data by using a local file, we must define a local storage
-- reference:
--
-- Data : AWA.Storages.Models.Store_Local_Ref;
--
-- and use the `Load` operation with the storage identifier. When loading
-- locally we also indicate whether the file will be read or written. A file
-- that is in `READ` mode can be shared by several tasks or processes.
-- A file that is in `WRITE` mode will have a specific copy for the caller.
-- An optional expiration parameter indicate when the local file representation
-- can expire.
--
-- Service.Load (From => Id, Into => Data, Mode => READ, Expire => ONE_DAY);
--
-- Once the load operation succeeded, the data is stored on the file system and
-- the local path is obtained by using the `Get_Path` operation:
--
-- Path : constant String := Data.Get_Path;
--
-- @include awa-storages-services.ads
--
-- == Ada Beans ==
-- @include-bean storages.xml
-- @include-bean storage-list.xml
-- @include-bean folder-queries.xml
-- @include-bean storage-queries.xml
--
-- @include awa-storages-servlets.ads
--
-- == Queries ==
-- @include-query storage-list.xml
-- @include-query folder-queries.xml
-- @include-query storage-queries.xml
-- @include-query storage-info.xml
--
-- == Data model ==
-- [images/awa_storages_model.png]
--
package AWA.Storages is
type Storage_Type is (DATABASE, FILE, URL, CACHE, TMP);
type Storage_File (Storage : Storage_Type) is tagged limited private;
-- Get the path to get access to the file.
function Get_Path (File : in Storage_File) return String;
-- Set the file path for the FILE, URL, CACHE or TMP storage.
procedure Set (File : in out Storage_File;
Path : in String);
-- Set the file database storage identifier.
procedure Set (File : in out Storage_File;
Workspace : in ADO.Identifier;
Store : in ADO.Identifier);
private
type Storage_File (Storage : Storage_Type) is limited
new Ada.Finalization.Limited_Controlled with record
case Storage is
when DATABASE =>
Workspace : ADO.Identifier;
Store : ADO.Identifier;
when FILE | URL | CACHE | TMP =>
Path : Ada.Strings.Unbounded.Unbounded_String;
end case;
end record;
overriding
procedure Finalize (File : in out Storage_File);
end AWA.Storages;
|
reznikmm/matreshka | Ada | 3,739 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Text_Emphasize_Attributes is
pragma Preelaborate;
type ODF_Style_Text_Emphasize_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Text_Emphasize_Attribute_Access is
access all ODF_Style_Text_Emphasize_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Text_Emphasize_Attributes;
|
onox/sdlada | Ada | 7,313 | 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.Events.Joysticks
--
-- Joystick specific events.
--------------------------------------------------------------------------------------------------------------------
package SDL.Events.Joysticks is
-- Joystick events.
Axis_Motion : constant Event_Types := 16#0000_0600#;
Ball_Motion : constant Event_Types := Axis_Motion + 1;
Hat_Motion : constant Event_Types := Axis_Motion + 2;
Button_Down : constant Event_Types := Axis_Motion + 3;
Button_Up : constant Event_Types := Axis_Motion + 4;
Device_Added : constant Event_Types := Axis_Motion + 5;
Device_Removed : constant Event_Types := Axis_Motion + 6;
type IDs is range -2 ** 31 .. 2 ** 31 - 1 with
Convention => C,
Size => 32;
type Axes is range 0 .. 255 with
Convention => C,
Size => 8;
type Axes_Values is range -32768 .. 32767 with
Convention => C,
Size => 16;
type Axis_Events is
record
Event_Type : Event_Types; -- Will be set to Axis_Motion.
Time_Stamp : Time_Stamps;
Which : IDs;
Axis : Axes;
Padding_1 : Padding_8;
Padding_2 : Padding_8;
Padding_3 : Padding_8;
Value : Axes_Values;
Padding_4 : Padding_16;
end record with
Convention => C;
type Balls is range 0 .. 255 with
Convention => C,
Size => 8;
type Ball_Values is range -32768 .. 32767 with
Convention => C,
Size => 16;
type Ball_Events is
record
Event_Type : Event_Types; -- Will be set to Ball_Motion.
Time_Stamp : Time_Stamps;
Which : IDs;
Ball : Balls;
Padding_1 : Padding_8;
Padding_2 : Padding_8;
Padding_3 : Padding_8;
X_Relative : Ball_Values;
Y_Relative : Ball_Values;
end record with
Convention => C;
type Hats is range 0 .. 255 with
Convention => C,
Size => 8;
type Hat_Positions is mod 2 ** 8 with
Convention => C,
Size => 8;
Hat_Centred : constant Hat_Positions := 0;
Hat_Up : constant Hat_Positions := 1;
Hat_Right : constant Hat_Positions := 2;
Hat_Down : constant Hat_Positions := 4;
Hat_Left : constant Hat_Positions := 8;
Hat_Right_Up : constant Hat_Positions := Hat_Right or Hat_Up;
Hat_Right_Down : constant Hat_Positions := Hat_Right or Hat_Down;
Hat_Left_Up : constant Hat_Positions := Hat_Left or Hat_Up;
Hat_Left_Down : constant Hat_Positions := Hat_Left or Hat_Down;
type Hat_Events is
record
Event_Type : Event_Types; -- Will be set to Hat_Motion.
Time_Stamp : Time_Stamps;
Which : IDs;
Hat : Hats;
Position : Hat_Positions;
Padding_1 : Padding_8;
Padding_2 : Padding_8;
end record with
Convention => C;
type Buttons is range 0 .. 255 with
Convention => C,
Size => 8;
type Button_Events is
record
Event_Type : Event_Types; -- Will be set to Button_Down or Button_Up.
Time_Stamp : Time_Stamps;
Which : IDs;
Button : Buttons;
State : Button_State;
Padding_1 : Padding_8;
Padding_2 : Padding_8;
end record with
Convention => C;
type Device_Events is
record
Event_Type : Event_Types; -- Will be set to Device_Added or Device_Removed.
Time_Stamp : Time_Stamps;
Which : IDs;
end record with
Convention => C;
-- Update the joystick event data. This is called by the event loop.
procedure Update with
Import => True,
Convention => C,
External_Name => "SDL_JoystickUpdate";
function Is_Polling_Enabled return Boolean;
procedure Enable_Polling with
Inline => True;
procedure Disable_Polling with
Inline => True;
private
for Axis_Events use
record
Event_Type at 0 * SDL.Word range 0 .. 31;
Time_Stamp at 1 * SDL.Word range 0 .. 31;
Which at 2 * SDL.Word range 0 .. 31;
Axis at 3 * SDL.Word range 0 .. 7;
Padding_1 at 3 * SDL.Word range 8 .. 15;
Padding_2 at 3 * SDL.Word range 16 .. 23;
Padding_3 at 3 * SDL.Word range 24 .. 31;
Value at 4 * SDL.Word range 0 .. 15;
Padding_4 at 4 * SDL.Word range 16 .. 31;
end record;
for Ball_Events use
record
Event_Type at 0 * SDL.Word range 0 .. 31;
Time_Stamp at 1 * SDL.Word range 0 .. 31;
Which at 2 * SDL.Word range 0 .. 31;
Ball at 3 * SDL.Word range 0 .. 7;
Padding_1 at 3 * SDL.Word range 8 .. 15;
Padding_2 at 3 * SDL.Word range 16 .. 23;
Padding_3 at 3 * SDL.Word range 24 .. 31;
X_Relative at 4 * SDL.Word range 0 .. 15;
Y_Relative at 4 * SDL.Word range 16 .. 31;
end record;
for Hat_Events use
record
Event_Type at 0 * SDL.Word range 0 .. 31;
Time_Stamp at 1 * SDL.Word range 0 .. 31;
Which at 2 * SDL.Word range 0 .. 31;
Hat at 3 * SDL.Word range 0 .. 7;
Position at 3 * SDL.Word range 8 .. 15;
Padding_1 at 3 * SDL.Word range 16 .. 23;
Padding_2 at 3 * SDL.Word range 24 .. 31;
end record;
for Button_Events use
record
Event_Type at 0 * SDL.Word range 0 .. 31;
Time_Stamp at 1 * SDL.Word range 0 .. 31;
Which at 2 * SDL.Word range 0 .. 31;
Button at 3 * SDL.Word range 0 .. 7;
State at 3 * SDL.Word range 8 .. 15;
Padding_1 at 3 * SDL.Word range 16 .. 23;
Padding_2 at 3 * SDL.Word range 24 .. 31;
end record;
for Device_Events use
record
Event_Type at 0 * SDL.Word range 0 .. 31;
Time_Stamp at 1 * SDL.Word range 0 .. 31;
Which at 2 * SDL.Word range 0 .. 31;
end record;
end SDL.Events.Joysticks;
|
onox/orka | Ada | 735 | 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 Orka.Rendering.Debug is
pragma Pure;
end Orka.Rendering.Debug;
|
reznikmm/matreshka | Ada | 3,633 | 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.Navigation_Call_Exps.Hash is
new AMF.Elements.Generic_Hash (OCL_Navigation_Call_Exp, OCL_Navigation_Call_Exp_Access);
|
reznikmm/matreshka | Ada | 11,396 | 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$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DG.Clip_Paths;
with AMF.DG.Groups;
with AMF.DG.Markers;
with AMF.DG.Styles.Collections;
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.DD_Attributes;
with AMF.Visitors.DG_Iterators;
with AMF.Visitors.DG_Visitors;
package body AMF.Internals.DG_Paths is
-----------------
-- Get_Command --
-----------------
overriding function Get_Command
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Sequence_Of_Path_Command is
begin
return
AMF.Internals.Tables.DD_Attributes.Internal_Get_Command
(Self.Element);
end Get_Command;
----------------------
-- Get_Start_Marker --
----------------------
overriding function Get_Start_Marker
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Markers.DG_Marker_Access is
begin
return
AMF.DG.Markers.DG_Marker_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.DD_Attributes.Internal_Get_Start_Marker
(Self.Element)));
end Get_Start_Marker;
----------------------
-- Set_Start_Marker --
----------------------
overriding procedure Set_Start_Marker
(Self : not null access DG_Path_Proxy;
To : AMF.DG.Markers.DG_Marker_Access) is
begin
AMF.Internals.Tables.DD_Attributes.Internal_Set_Start_Marker
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Start_Marker;
--------------------
-- Get_End_Marker --
--------------------
overriding function Get_End_Marker
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Markers.DG_Marker_Access is
begin
return
AMF.DG.Markers.DG_Marker_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.DD_Attributes.Internal_Get_End_Marker
(Self.Element)));
end Get_End_Marker;
--------------------
-- Set_End_Marker --
--------------------
overriding procedure Set_End_Marker
(Self : not null access DG_Path_Proxy;
To : AMF.DG.Markers.DG_Marker_Access) is
begin
AMF.Internals.Tables.DD_Attributes.Internal_Set_End_Marker
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_End_Marker;
--------------------
-- Get_Mid_Marker --
--------------------
overriding function Get_Mid_Marker
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Markers.DG_Marker_Access is
begin
return
AMF.DG.Markers.DG_Marker_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.DD_Attributes.Internal_Get_Mid_Marker
(Self.Element)));
end Get_Mid_Marker;
--------------------
-- Set_Mid_Marker --
--------------------
overriding procedure Set_Mid_Marker
(Self : not null access DG_Path_Proxy;
To : AMF.DG.Markers.DG_Marker_Access) is
begin
AMF.Internals.Tables.DD_Attributes.Internal_Set_Mid_Marker
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Mid_Marker;
---------------
-- Get_Group --
---------------
overriding function Get_Group
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Groups.DG_Group_Access is
begin
return
AMF.DG.Groups.DG_Group_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.DD_Attributes.Internal_Get_Group
(Self.Element)));
end Get_Group;
---------------
-- Set_Group --
---------------
overriding procedure Set_Group
(Self : not null access DG_Path_Proxy;
To : AMF.DG.Groups.DG_Group_Access) is
begin
AMF.Internals.Tables.DD_Attributes.Internal_Set_Group
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Group;
---------------------
-- Get_Local_Style --
---------------------
overriding function Get_Local_Style
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style is
begin
return
AMF.DG.Styles.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.DD_Attributes.Internal_Get_Local_Style
(Self.Element)));
end Get_Local_Style;
----------------------
-- Get_Shared_Style --
----------------------
overriding function Get_Shared_Style
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style is
begin
return
AMF.DG.Styles.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.DD_Attributes.Internal_Get_Shared_Style
(Self.Element)));
end Get_Shared_Style;
-------------------
-- Get_Transform --
-------------------
overriding function Get_Transform
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Sequence_Of_DG_Transform is
begin
return
AMF.Internals.Tables.DD_Attributes.Internal_Get_Transform
(Self.Element);
end Get_Transform;
-------------------
-- Get_Clip_Path --
-------------------
overriding function Get_Clip_Path
(Self : not null access constant DG_Path_Proxy)
return AMF.DG.Clip_Paths.DG_Clip_Path_Access is
begin
return
AMF.DG.Clip_Paths.DG_Clip_Path_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.DD_Attributes.Internal_Get_Clip_Path
(Self.Element)));
end Get_Clip_Path;
-------------------
-- Set_Clip_Path --
-------------------
overriding procedure Set_Clip_Path
(Self : not null access DG_Path_Proxy;
To : AMF.DG.Clip_Paths.DG_Clip_Path_Access) is
begin
AMF.Internals.Tables.DD_Attributes.Internal_Set_Clip_Path
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Clip_Path;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant DG_Path_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.DG_Visitors.DG_Visitor'Class then
AMF.Visitors.DG_Visitors.DG_Visitor'Class
(Visitor).Enter_Path
(AMF.DG.Paths.DG_Path_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant DG_Path_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.DG_Visitors.DG_Visitor'Class then
AMF.Visitors.DG_Visitors.DG_Visitor'Class
(Visitor).Leave_Path
(AMF.DG.Paths.DG_Path_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant DG_Path_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.DG_Iterators.DG_Iterator'Class then
AMF.Visitors.DG_Iterators.DG_Iterator'Class
(Iterator).Visit_Path
(Visitor,
AMF.DG.Paths.DG_Path_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.DG_Paths;
|
reznikmm/matreshka | Ada | 5,011 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- 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$
------------------------------------------------------------------------------
-- Huffman table is able to read from bit stream elements encoded with
-- bit-pieces of variable size.
with Matreshka.Filters.Bit_Streams;
generic
type Encoded_Element is range <>;
Max_Length : Bit_Streams.Bit_Count;
package Matreshka.Filters.Huffman_Tables is
pragma Preelaborate;
subtype Length is Bit_Streams.Bit_Count range 0 .. Max_Length;
type Length_Map is array (Encoded_Element) of Length;
-- Map each encoded element to its length
type Huffman_Table is tagged private;
pragma Preelaborable_Initialization (Huffman_Table);
procedure Initialize
(Self : in out Huffman_Table;
Map : Length_Map);
-- Create Huffman table for given length Map
function Read
(Self : Huffman_Table;
Input : in out Matreshka.Filters.Bit_Streams.Bit_Stream;
Value : in out Encoded_Element)
return Boolean;
-- Read encoded Value from Input stream if it has enought bits
procedure Write
(Self : Huffman_Table;
Value : Encoded_Element;
Output : in out Matreshka.Filters.Bit_Streams.Bit_Stream);
-- Encode value and write in to Output
private
use type Matreshka.Filters.Bit_Streams.Bits;
subtype Bits is Bit_Streams.Bits range 0 .. 2 ** Natural (Max_Length) - 1;
type Value_Table is array (Bits) of Encoded_Element;
-- This table maps any value of length Max_Length to Encoded_Element.
-- Prefix of value is equal code of Encoded_Element.
type Bits_Array is array (Encoded_Element) of Bits;
type Huffman_Table is tagged record
Mask : Bits;
Max_Length : Length;
Values : Value_Table;
Length : Length_Map;
Bits : Bits_Array;
end record;
end Matreshka.Filters.Huffman_Tables;
|
charlie5/cBound | Ada | 1,348 | 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_glx_get_mapfv_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_glx_get_mapfv_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_mapfv_cookie_t.Item,
Element_Array => xcb.xcb_glx_get_mapfv_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_glx_get_mapfv_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_glx_get_mapfv_cookie_t.Pointer,
Element_Array => xcb.xcb_glx_get_mapfv_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_glx_get_mapfv_cookie_t;
|
reznikmm/matreshka | Ada | 4,001 | 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.Form_Validation_Attributes;
package Matreshka.ODF_Form.Validation_Attributes is
type Form_Validation_Attribute_Node is
new Matreshka.ODF_Form.Abstract_Form_Attribute_Node
and ODF.DOM.Form_Validation_Attributes.ODF_Form_Validation_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Form_Validation_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Form_Validation_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Form.Validation_Attributes;
|
stcarrez/stm32-ui | Ada | 983 | ads | -----------------------------------------------------------------------
-- clock-display-instance -- Display instances
-- 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.
-----------------------------------------------------------------------
package Clock.Display.Instances is
Display : aliased Clock.Display.Display_Type;
end Clock.Display.Instances;
|
stcarrez/ada-util | Ada | 2,325 | adb | --
-- Copyright (c) 2007, 2008 Tero Koskinen <[email protected]>
--
-- 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.
--
with Ada.Strings.Fixed;
package body Ahven.Temporary_Output is
use Ahven.AStrings;
use Ada.Strings.Fixed;
Temp_Counter : Natural := 0;
procedure Create_Temp (File : out Temporary_File) is
Filename : constant String := "ahven_temp_" &
Trim (Integer'Image (Temp_Counter), Ada.Strings.Both);
begin
if Temp_Counter < Natural'Last then
Temp_Counter := Temp_Counter + 1;
else
raise Temporary_File_Error;
end if;
File.Name := To_Bounded_String (Filename);
Ada.Text_IO.Create (File.Handle, Ada.Text_IO.Out_File, Filename);
end Create_Temp;
function Get_Name (File : Temporary_File) return String is
begin
return To_String (File.Name);
end Get_Name;
procedure Redirect_Output (To_File : in out Temporary_File) is
begin
Ada.Text_IO.Flush;
Ada.Text_IO.Set_Output (To_File.Handle);
end Redirect_Output;
procedure Restore_Output is
begin
Ada.Text_IO.Flush;
Ada.Text_IO.Set_Output (Ada.Text_IO.Standard_Output);
end Restore_Output;
procedure Remove_Temp (File : in out Temporary_File) is
begin
if not Ada.Text_IO.Is_Open (File.Handle) then
Ada.Text_IO.Open (File.Handle, Ada.Text_IO.Out_File,
To_String (File.Name));
end if;
Ada.Text_IO.Delete (File.Handle);
end Remove_Temp;
procedure Close_Temp (File : in out Temporary_File) is
begin
Ada.Text_IO.Close (File.Handle);
end Close_Temp;
end Ahven.Temporary_Output;
|
stcarrez/babel | Ada | 1,421 | ads | -----------------------------------------------------------------------
-- babel-base-users-tests - Unit tests for babel users
-- Copyright (C) 2015 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 Babel.Base.Users.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Test the Find function resolving some existing user.
procedure Test_Find (T : in out Test);
-- Test the Get_Name operation.
procedure Test_Get_Name (T : in out Test);
-- Test the Get_Uid operation.
procedure Test_Get_Uid (T : in out Test);
-- Test the Get_Group operation.
procedure Test_Get_Group (T : in out Test);
end Babel.Base.Users.Tests;
|
reznikmm/matreshka | Ada | 4,097 | 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.Form_Control_Implementation_Attributes;
package Matreshka.ODF_Form.Control_Implementation_Attributes is
type Form_Control_Implementation_Attribute_Node is
new Matreshka.ODF_Form.Abstract_Form_Attribute_Node
and ODF.DOM.Form_Control_Implementation_Attributes.ODF_Form_Control_Implementation_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Form_Control_Implementation_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Form_Control_Implementation_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Form.Control_Implementation_Attributes;
|
mirror/ncurses | Ada | 5,097 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Form_Demo.Aux --
-- --
-- S P E C --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 1998-2009,2011 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.12 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
package Sample.Form_Demo.Aux is
procedure Geometry (F : Form;
L : out Line_Count;
C : out Column_Count;
Y : out Line_Position;
X : out Column_Position);
-- Calculate the geometry for a panel being able to be used to display
-- the menu.
function Create (F : Form;
Title : String;
Lin : Line_Position;
Col : Column_Position) return Panel;
-- Create a panel decorated with a frame and the title at the specified
-- position. The dimension of the panel is derived from the menus layout.
procedure Destroy (F : Form;
P : in out Panel);
-- Destroy all the windowing structures associated with this menu and
-- panel.
function Get_Request (F : Form;
P : Panel;
Handle_CRLF : Boolean := True) return Key_Code;
-- Centralized request driver for all menus in this sample. This
-- gives us a common key binding for all menus.
function Make (Top : Line_Position;
Left : Column_Position;
Text : String) return Field;
-- create a label
function Make (Height : Line_Count := 1;
Width : Column_Count;
Top : Line_Position;
Left : Column_Position;
Off_Screen : Natural := 0) return Field;
-- create a editable field
function Default_Driver (F : Form;
K : Key_Code;
P : Panel) return Boolean;
function Count_Active (F : Form) return Natural;
-- Count the number of active fields in the form
end Sample.Form_Demo.Aux;
|
AdaCore/libadalang | Ada | 323 | ads | package Pkg is
pragma Elaborate_Body;
Test_Pkg_Public : Integer;
generic
package G is
Test_Pkg_Generic_Child : Integer;
end G;
private
Test_Pkg_Private : Integer;
package Inner is
Test_Pkg_Inner_Public : Integer;
private
Test_Pkg_Inner_Private : Integer;
end Inner;
end Pkg;
|
reznikmm/gela | Ada | 3,126 | ads | -- This package provides Value_Set implementation.
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Vectors;
with League.Strings;
with Gela.Arithmetic.Integers;
with Gela.Elements.Defining_Names;
with Gela.Semantic_Types;
with Gela.Value_Sets;
package Gela.Plain_Value_Sets is
pragma Preelaborate;
type Value_Set is limited new Gela.Value_Sets.Value_Set with private;
type Value_Set_Access is access all Value_Set'Class;
private
subtype Positive_Value_Index is Gela.Semantic_Types.Value_Index
range 1 .. Gela.Semantic_Types.Value_Index'Last;
type Value_Kinds is
(Integer_Value, String_Value, List_Value, Denote_Function);
type Value (Kind : Value_Kinds := String_Value) is record
case Kind is
when Denote_Function =>
Op : Gela.Semantic_Types.Static_Operator;
when Integer_Value =>
Integer : Gela.Arithmetic.Integers.Value;
when String_Value =>
String : League.Strings.Universal_String;
when List_Value =>
Head : Positive_Value_Index;
Tail : Positive_Value_Index;
end case;
end record;
function Hash (X : Value) return Ada.Containers.Hash_Type;
package Hash_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Value,
Element_Type => Positive_Value_Index,
Hash => Hash,
Equivalent_Keys => "=",
"=" => Gela.Semantic_Types."=");
package Vectors is new Ada.Containers.Vectors
(Index_Type => Positive_Value_Index,
Element_Type => Value,
"=" => "=");
type Value_Set is limited new Gela.Value_Sets.Value_Set with record
Map : Hash_Maps.Map;
Vector : Vectors.Vector;
end record;
not overriding procedure Put_Value
(Self : in out Value_Set;
Item : Value;
Value : out Gela.Semantic_Types.Value_Index);
overriding procedure String_Literal
(Self : in out Value_Set;
Image : League.Strings.Universal_String;
Value : out Gela.Semantic_Types.Value_Index);
overriding procedure Numeric_Literal
(Self : in out Value_Set;
Image : League.Strings.Universal_String;
Value : out Gela.Semantic_Types.Value_Index);
overriding procedure Name
(Self : in out Value_Set;
Name : Gela.Elements.Defining_Names.Defining_Name_Access;
Value : out Gela.Semantic_Types.Value_Index);
overriding procedure List
(Self : in out Value_Set;
Head : Gela.Semantic_Types.Value_Index;
Tail : Gela.Semantic_Types.Value_Index;
Value : out Gela.Semantic_Types.Value_Index);
overriding procedure Apply
(Self : in out Value_Set;
Name : Gela.Semantic_Types.Value_Index;
Args : Gela.Semantic_Types.Value_Index;
Value : out Gela.Semantic_Types.Value_Index);
overriding function Is_String
(Self : Value_Set;
Value : Gela.Semantic_Types.Value_Index) return Boolean;
overriding function Image
(Self : Value_Set;
Value : Gela.Semantic_Types.Value_Index)
return League.Strings.Universal_String;
end Gela.Plain_Value_Sets;
|
reznikmm/matreshka | Ada | 8,154 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DC;
with AMF.DG.Canvases;
with AMF.DG.Clip_Paths;
with AMF.DG.Graphical_Elements.Collections;
with AMF.DG.Groups;
with AMF.DG.Markers;
with AMF.DG.Styles.Collections;
with AMF.Internals.DG_Elements;
with AMF.Visitors;
package AMF.Internals.DG_Markers is
type DG_Marker_Proxy is
limited new AMF.Internals.DG_Elements.DG_Element_Proxy
and AMF.DG.Markers.DG_Marker with null record;
overriding function Get_Canvas
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Canvases.DG_Canvas_Access;
-- Getter of Marker::canvas.
--
-- a reference to the canvas that owns this marker.
overriding procedure Set_Canvas
(Self : not null access DG_Marker_Proxy;
To : AMF.DG.Canvases.DG_Canvas_Access);
-- Setter of Marker::canvas.
--
-- a reference to the canvas that owns this marker.
overriding function Get_Size
(Self : not null access constant DG_Marker_Proxy)
return AMF.DC.DC_Dimension;
-- Getter of Marker::size.
--
-- the size of the marker
overriding procedure Set_Size
(Self : not null access DG_Marker_Proxy;
To : AMF.DC.DC_Dimension);
-- Setter of Marker::size.
--
-- the size of the marker
overriding function Get_Reference
(Self : not null access constant DG_Marker_Proxy)
return AMF.DC.DC_Point;
-- Getter of Marker::reference.
--
-- a point within the bounds of the marker that aligns exactly with the
-- marked element's vertex.
overriding procedure Set_Reference
(Self : not null access DG_Marker_Proxy;
To : AMF.DC.DC_Point);
-- Setter of Marker::reference.
--
-- a point within the bounds of the marker that aligns exactly with the
-- marked element's vertex.
overriding function Get_Member
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Graphical_Elements.Collections.Ordered_Set_Of_DG_Graphical_Element;
-- Getter of Group::member.
--
-- the list of graphical elements that are members of (owned by) this
-- group.
overriding function Get_Group
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Groups.DG_Group_Access;
-- Getter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding procedure Set_Group
(Self : not null access DG_Marker_Proxy;
To : AMF.DG.Groups.DG_Group_Access);
-- Setter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding function Get_Local_Style
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::localStyle.
--
-- a list of locally-owned styles for this graphical element.
overriding function Get_Shared_Style
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::sharedStyle.
--
-- a list of shared styles for this graphical element.
overriding function Get_Transform
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Sequence_Of_DG_Transform;
-- Getter of GraphicalElement::transform.
--
-- a list of zero or more transforms to apply to this graphical element.
overriding function Get_Clip_Path
(Self : not null access constant DG_Marker_Proxy)
return AMF.DG.Clip_Paths.DG_Clip_Path_Access;
-- Getter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Set_Clip_Path
(Self : not null access DG_Marker_Proxy;
To : AMF.DG.Clip_Paths.DG_Clip_Path_Access);
-- Setter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Enter_Element
(Self : not null access constant DG_Marker_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant DG_Marker_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant DG_Marker_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.DG_Markers;
|
annexi-strayline/ASAP-HEX | Ada | 4,433 | ads | ------------------------------------------------------------------------------
-- --
-- Generic HEX String Handling Package --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018-2021, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai, Ensi Martini, Aninda Poddar, Noshen Atashe --
-- (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- Standard, verified package to represent an 8-bit modular value
with Interfaces;
with Hex.Modular_Codec;
package Hex.Unsigned_8
with SPARK_Mode => On
is
pragma Assertion_Policy (Pre => Check,
Post => Ignore,
Assert => Ignore);
subtype Unsigned_8 is Interfaces.Unsigned_8;
use type Unsigned_8;
package Codec is new Hex.Modular_Codec
(Modular_Value => Unsigned_8,
Bit_Width => 8);
Maximum_Length: Positive renames Codec.Max_Nibbles;
function Decode (Input: String) return Unsigned_8
renames Codec.Decode;
procedure Decode (Input: in String;
Value: out Unsigned_8)
renames Codec.Decode;
function Encode (Value: Unsigned_8; Use_Case: Set_Case := Lower_Case)
return String
renames Codec.Encode;
procedure Encode (Value : in Unsigned_8;
Buffer : out String;
Use_Case: in Set_Case := Lower_Case)
renames Codec.Encode;
end Hex.Unsigned_8;
|
AdaCore/gpr | Ada | 182 | ads | package p7_3 is
function p7_3_0 (Item : Integer) return Integer;
function p7_3_1 (Item : Integer) return Integer;
function p7_3_2 (Item : Integer) return Integer;
end p7_3;
|
stcarrez/ada-asf | Ada | 32,576 | adb | -----------------------------------------------------------------------
-- asf-components-html-forms -- ASF HTML Form Components
-- Copyright (C) 2010 - 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.Unchecked_Deallocation;
with Util.Beans.Objects;
with Util.Log.Loggers;
with Ada.Exceptions;
with ASF.Utils;
with ASF.Parts;
with ASF.Parts.Upload_Method;
with ASF.Converters;
with ASF.Requests;
with ASF.Components.Base;
with ASF.Components.Utils;
with ASF.Components.Root;
with ASF.Events.Faces.Actions;
with ASF.Applications.Main;
with ASF.Applications.Views;
package body ASF.Components.Html.Forms is
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("ASF.Components.Html.Forms");
FORM_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
INPUT_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
TEXTAREA_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
FILE_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set;
procedure Free is
new Ada.Unchecked_Deallocation (Object => ASF.Validators.Validator'Class,
Name => ASF.Validators.Validator_Access);
-- ------------------------------
-- Input Component
-- ------------------------------
-- ------------------------------
-- Find the form component which contains the input component.
-- Returns null if the input is not within a form component.
-- ------------------------------
function Get_Form (UI : in UIInput) return UIForm_Access is
use type ASF.Components.Base.UIComponent_Access;
Parent : ASF.Components.Base.UIComponent_Access := UI.Get_Parent;
begin
while Parent /= null loop
if Parent.all in UIForm'Class then
return UIForm'Class (Parent.all)'Access;
end if;
Parent := Parent.Get_Parent;
end loop;
return null;
end Get_Form;
-- ------------------------------
-- Check if this component has the required attribute set.
-- ------------------------------
function Is_Required (UI : in UIInput;
Context : in Faces_Context'Class) return Boolean is
Attr : constant EL.Objects.Object := UI.Get_Attribute (Name => REQUIRED_NAME,
Context => Context);
begin
if EL.Objects.Is_Null (Attr) then
return True;
end if;
return EL.Objects.To_Boolean (Attr);
end Is_Required;
-- ------------------------------
-- Get the value of the component. If the component has a submitted value, returns it.
-- If the component has a local value which is not null, returns it.
-- Otherwise, if we have a Value_Expression evaluate and returns the value.
-- ------------------------------
overriding
function Get_Value (UI : in UIInput) return EL.Objects.Object is
begin
if not Util.Beans.Objects.Is_Null (UI.Submitted_Value) then
return UI.Submitted_Value;
else
return Text.UIOutput (UI).Get_Value;
end if;
end Get_Value;
-- ------------------------------
-- Set the input component as a password field.
-- ------------------------------
procedure Set_Secret (UI : in out UIInput;
Value : in Boolean) is
begin
UI.Is_Secret := Value;
end Set_Secret;
-- ------------------------------
-- Render the input element.
-- ------------------------------
procedure Render_Input (UI : in UIInput;
Context : in out Faces_Context'Class;
Write_Id : in Boolean := True) is
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
Value : constant EL.Objects.Object := UIInput'Class (UI).Get_Value;
begin
Writer.Start_Element ("input");
if UI.Is_Secret then
Writer.Write_Attribute (Name => "type", Value => "password");
else
Writer.Write_Attribute (Name => "type", Value => "text");
end if;
Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id);
if not EL.Objects.Is_Null (Value) then
declare
Convert : constant access Converters.Converter'Class
:= UIInput'Class (UI).Get_Converter;
begin
if Convert /= null and then Util.Beans.Objects.Is_Null (UI.Submitted_Value) then
Writer.Write_Attribute (Name => "value",
Value => Convert.To_String (Value => Value,
Component => UI,
Context => Context));
else
Writer.Write_Attribute (Name => "value", Value => Value);
end if;
end;
end if;
UI.Render_Attributes (Context, INPUT_ATTRIBUTE_NAMES, Writer, Write_Id);
Writer.End_Element ("input");
end Render_Input;
overriding
procedure Encode_Begin (UI : in UIInput;
Context : in out Faces_Context'Class) is
begin
if UI.Is_Rendered (Context) then
UIInput'Class (UI).Render_Input (Context);
end if;
end Encode_Begin;
-- ------------------------------
-- Get the input parameter from the submitted context. This operation is called by
-- <tt>Process_Decodes</tt> to retrieve the request parameter associated with the component.
-- ------------------------------
function Get_Parameter (UI : in UIInput;
Context : in Faces_Context'Class) return String is
Id : constant Unbounded_String := UI.Get_Client_Id;
begin
return Context.Get_Parameter (To_String (Id));
end Get_Parameter;
-- ------------------------------
-- Convert the string into a value. If a converter is specified on the component,
-- use it to convert the value.
-- ------------------------------
function Convert_Value (UI : in UIInput;
Value : in String;
Context : in Faces_Context'Class) return EL.Objects.Object is
Convert : constant access ASF.Converters.Converter'Class
:= UIInput'Class (UI).Get_Converter (Context);
begin
if Convert = null then
return EL.Objects.To_Object (Value);
else
return Convert.To_Object (Context => Context,
Component => UI,
Value => Value);
end if;
end Convert_Value;
overriding
procedure Process_Decodes (UI : in out UIInput;
Context : in out Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
Id : constant Unbounded_String := UI.Get_Client_Id;
Val : constant String := UIInput'Class (UI).Get_Parameter (Context);
begin
-- SCz 2017-05-25: we don't know with AWS whether a parameter is
-- submitted or not. It returns the empty string when a parameter
-- is not found. If the value is empty and not required,
-- don't set the valid flag so that we get the JSF behavior.
if Val'Length = 0 and then not UI.Is_Required (Context) then
return;
end if;
if not UI.Is_Secret then
Log.Info ("Set input parameter {0} -> {1}", Id, Val);
else
Log.Info ("Set secret input parameter {0} -> XXXXXX", Id);
end if;
UI.Is_Submitted := True;
UI.Submitted_Value := UIInput'Class (UI).Convert_Value (Val, Context);
UI.Is_Valid := True;
exception
when E : others =>
UI.Is_Valid := False;
UI.Add_Message (Name => CONVERTER_MESSAGE_NAME,
Default => ERROR_MESSAGE_ID,
Arg1 => UI.Get_Label (Context),
Context => Context);
Log.Info (Utils.Get_Line_Info (UI)
& ": Exception raised when converting value {0} for component {1}: {2}",
Val, To_String (Id), Ada.Exceptions.Exception_Name (E));
end;
end Process_Decodes;
-- ------------------------------
-- Perform the component tree processing required by the <b>Process Validations</b>
-- phase of the request processing lifecycle for all facets of this component,
-- all children of this component, and this component itself, as follows:
-- <ul>
-- <li>If this component <b>rendered</b> property is false, skip further processing.
-- <li>Call the <b>Process_Validators</b> of all facets and children.
-- <ul>
-- ------------------------------
overriding
procedure Process_Validators (UI : in out UIInput;
Context : in out Faces_Context'Class) is
begin
-- Do not validate the component nor its children if the component is not rendered.
if not UI.Is_Rendered (Context) then
return;
end if;
UIInput'Class (UI).Validate (Context);
end Process_Validators;
-- ------------------------------
-- Validate the submitted value.
-- <ul>
-- <li>Retreive the submitted value
-- <li>If the value is null, exit without further processing.
-- <li>Validate the value by calling <b>Validate_Value</b>
-- </ul>
-- ------------------------------
procedure Validate (UI : in out UIInput;
Context : in out Faces_Context'Class) is
Id : constant String := Ada.Strings.Unbounded.To_String (UI.Get_Client_Id);
begin
Log.Debug ("Validating input field {0}", Id);
if UI.Is_Submitted then -- not EL.Objects.Is_Null (UI.Submitted_Value) then
UIInput'Class (UI).Validate_Value (UI.Submitted_Value, Context);
-- Render the response after the current phase if something is wrong.
if not UI.Is_Valid then
Log.Info ("{0}: submitted value for {1} is invalid", Utils.Get_Line_Info (UI), Id);
Context.Render_Response;
end if;
end if;
end Validate;
-- ------------------------------
-- Set the <b>valid</b> property:
-- <ul>
-- <li>If the <b>required</b> property is true, ensure the
-- value is not empty
-- <li>Call the <b>Validate</b> procedure on each validator
-- registered on this component.
-- <li>Set the <b>valid</b> property if all validator passed.
-- </ul>
-- ------------------------------
procedure Validate_Value (UI : in out UIInput;
Value : in EL.Objects.Object;
Context : in out Faces_Context'Class) is
use type ASF.Validators.Validator_Access;
begin
if EL.Objects.Is_Empty (Value)
and then UI.Is_Required (Context)
and then UI.Is_Valid
then
UI.Add_Message (Name => REQUIRED_MESSAGE_NAME,
Default => REQUIRED_MESSAGE_ID,
Arg1 => UI.Get_Label (Context),
Context => Context);
UI.Is_Valid := False;
end if;
if UI.Is_Valid and then not EL.Objects.Is_Empty (Value) then
for I in UI.Validators'Range loop
exit when UI.Validators (I).Validator = null;
UI.Validators (I).Validator.Validate (Context, UI, Value);
end loop;
end if;
exception
when ASF.Validators.Invalid_Value =>
UI.Is_Valid := False;
end Validate_Value;
overriding
procedure Process_Updates (UI : in out UIInput;
Context : in out Faces_Context'Class) is
begin
if UI.Is_Valid then
declare
VE : constant EL.Expressions.Value_Expression
:= UI.Get_Value_Expression (VALUE_NAME);
begin
VE.Set_Value (Value => UI.Submitted_Value, Context => Context.Get_ELContext.all);
end;
end if;
exception
when E : others =>
UI.Is_Valid := False;
UI.Add_Message (Name => CONVERTER_MESSAGE_NAME,
Default => ERROR_MESSAGE_ID,
Context => Context);
Log.Info (Utils.Get_Line_Info (UI)
& ": Exception raised when updating value {0} for component {1}: {2}",
EL.Objects.To_String (UI.Submitted_Value),
To_String (UI.Get_Client_Id), Ada.Exceptions.Exception_Name (E));
-- Render the response after the current phase if something is wrong.
Context.Render_Response;
end Process_Updates;
-- ------------------------------
-- Add the validator to be used on the component. The ASF implementation limits
-- to 5 the number of validators that can be set on a component (See UIInput).
-- The validator instance will be freed when the editable value holder is deleted
-- unless <b>Shared</b> is true.
-- ------------------------------
overriding
procedure Add_Validator (UI : in out UIInput;
Validator : in ASF.Validators.Validator_Access;
Shared : in Boolean := False) is
use type ASF.Validators.Validator_Access;
begin
for I in UI.Validators'Range loop
if UI.Validators (I).Validator = null then
UI.Validators (I).Validator := Validator;
UI.Validators (I).Shared := Shared;
return;
end if;
end loop;
Base.Log_Error (UI, "Too many validators added (max {0})",
Positive'Image (UI.Validators'Length));
if Shared then
declare
V : ASF.Validators.Validator_Access := Validator;
begin
Free (V);
end;
end if;
end Add_Validator;
-- ------------------------------
-- Delete the UI input instance.
-- ------------------------------
overriding
procedure Finalize (UI : in out UIInput) is
use type ASF.Validators.Validator_Access;
begin
-- If there are any validator that is not shared, delete the instance.
for I in UI.Validators'Range loop
exit when UI.Validators (I).Validator = null;
if not UI.Validators (I).Shared then
Free (UI.Validators (I).Validator);
end if;
end loop;
UIHtmlComponent (UI).Finalize;
end Finalize;
-- ------------------------------
-- Render the textarea element.
-- ------------------------------
overriding
procedure Render_Input (UI : in UIInputTextarea;
Context : in out Faces_Context'Class;
Write_Id : in Boolean := True) is
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
Value : constant EL.Objects.Object := UIInput'Class (UI).Get_Value;
begin
Writer.Start_Element ("textarea");
Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id);
UI.Render_Attributes (Context, TEXTAREA_ATTRIBUTE_NAMES, Writer, Write_Id);
if not EL.Objects.Is_Null (Value) then
declare
Convert : constant access Converters.Converter'Class
:= UIInput'Class (UI).Get_Converter;
begin
if Convert /= null and then Util.Beans.Objects.Is_Null (UI.Submitted_Value) then
Writer.Write_Text (Text => Convert.To_String (Value => Value,
Component => UI,
Context => Context));
else
Writer.Write_Text (Value => Value);
end if;
end;
end if;
Writer.End_Element ("textarea");
end Render_Input;
-- ------------------------------
-- Input_Hidden Component
-- ------------------------------
-- Render the inputHidden element.
overriding
procedure Render_Input (UI : in UIInput_Hidden;
Context : in out Faces_Context'Class;
Write_Id : in Boolean := True) is
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
Value : constant EL.Objects.Object := UIInput'Class (UI).Get_Value;
begin
Writer.Start_Element ("input");
Writer.Write_Attribute (Name => "type", Value => "hidden");
Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id);
if not EL.Objects.Is_Null (Value) then
declare
Convert : constant access Converters.Converter'Class
:= UIInput'Class (UI).Get_Converter;
begin
if Convert /= null and then Util.Beans.Objects.Is_Null (UI.Submitted_Value) then
Writer.Write_Attribute (Name => "value",
Value => Convert.To_String (Value => Value,
Component => UI,
Context => Context));
else
Writer.Write_Attribute (Name => "value", Value => Value);
end if;
end;
end if;
if Write_Id and then not UI.Is_Generated_Id then
Writer.Write_Attribute ("id", UI.Get_Client_Id);
end if;
Writer.End_Element ("input");
end Render_Input;
-- ------------------------------
-- Render the input file element.
-- ------------------------------
overriding
procedure Render_Input (UI : in UIInput_File;
Context : in out Faces_Context'Class;
Write_Id : in Boolean := True) is
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
begin
Writer.Start_Element ("input");
UI.Render_Attributes (Context, FILE_ATTRIBUTE_NAMES, Writer, Write_Id);
Writer.Write_Attribute (Name => "type", Value => "file");
Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id);
Writer.End_Element ("input");
end Render_Input;
-- ------------------------------
-- Validate the submitted value.
-- <ul>
-- <li>Retreive the submitted value
-- <li>If the value is null, exit without further processing.
-- <li>Validate the value by calling <b>Validate_Value</b>
-- </ul>
-- ------------------------------
overriding
procedure Validate (UI : in out UIInput_File;
Context : in out Faces_Context'Class) is
procedure Process_Part (Part : in ASF.Parts.Part'Class);
procedure Process_Part (Part : in ASF.Parts.Part'Class) is
pragma Unreferenced (Part);
begin
UI.Is_Valid := True;
end Process_Part;
Req : constant ASF.Requests.Request_Access := Context.Get_Request;
Id : constant String := To_String (UI.Get_Client_Id);
begin
Log.Debug ("Validating input file {0}", Id);
UI.Is_Valid := False;
Req.Process_Part (Id, Process_Part'Access);
if not UI.Is_Valid and then UI.Is_Required (Context) then
UI.Add_Message (Name => REQUIRED_MESSAGE_NAME,
Default => REQUIRED_MESSAGE_ID,
Arg1 => UI.Get_Label (Context),
Context => Context);
UI.Is_Valid := False;
-- Render the response after the current phase if something is wrong.
Context.Render_Response;
end if;
end Validate;
overriding
procedure Process_Updates (UI : in out UIInput_File;
Context : in out Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
procedure Process_Part (Part : in ASF.Parts.Part'Class);
Id : constant String := To_String (UI.Get_Client_Id);
Req : constant ASF.Requests.Request_Access := Context.Get_Request;
ME : constant EL.Expressions.Method_Expression
:= UI.Get_Method_Expression (VALUE_NAME);
procedure Process_Part (Part : in ASF.Parts.Part'Class) is
begin
ASF.Parts.Upload_Method.Execute (ME, Part, Context.Get_ELContext.all);
end Process_Part;
begin
Req.Process_Part (Id, Process_Part'Access);
UI.Is_Valid := True;
end;
exception
when E : others =>
UI.Is_Valid := False;
UI.Add_Message (Name => CONVERTER_MESSAGE_NAME,
Default => ERROR_MESSAGE_ID,
Context => Context);
Log.Info (Utils.Get_Line_Info (UI)
& ": Exception raised when updating value {0} for component {1}: {2}",
EL.Objects.To_String (UI.Submitted_Value),
To_String (UI.Get_Client_Id), Ada.Exceptions.Exception_Name (E));
Context.Queue_Exception (E);
end Process_Updates;
-- ------------------------------
-- Button Component
-- ------------------------------
-- ------------------------------
-- Get the value to write on the output.
-- ------------------------------
function Get_Value (UI : in UICommand) return EL.Objects.Object is
begin
return UI.Get_Attribute (UI.Get_Context.all, VALUE_NAME);
end Get_Value;
-- ------------------------------
-- Set the value to write on the output.
-- ------------------------------
procedure Set_Value (UI : in out UICommand;
Value : in EL.Objects.Object) is
begin
UI.Value := Value;
end Set_Value;
-- ------------------------------
-- Get the action method expression to invoke if the command is pressed.
-- ------------------------------
function Get_Action_Expression (UI : in UICommand;
Context : in Faces_Context'Class)
return EL.Expressions.Method_Expression is
pragma Unreferenced (Context);
begin
return UI.Get_Method_Expression (Name => ACTION_NAME);
end Get_Action_Expression;
overriding
procedure Process_Decodes (UI : in out UICommand;
Context : in out Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
Id : constant Unbounded_String := UI.Get_Client_Id;
Val : constant String := Context.Get_Parameter (To_String (Id));
begin
if Val /= "" then
Log.Info ("Command {0} was submitted with {1}", Id, Val);
ASF.Events.Faces.Actions.Post_Event (UI => UI,
Method => UI.Get_Action_Expression (Context));
else
Log.Debug ("Command {0} was not submitted", Id);
end if;
exception
when E : EL.Expressions.Invalid_Expression =>
Log.Info ("{0}: Command action looks invalid: {1}",
Utils.Get_Line_Info (UI), Ada.Exceptions.Exception_Message (E));
end;
end Process_Decodes;
-- ------------------------------
-- Broadcast the event to the event listeners installed on this component.
-- Listeners are called in the order in which they were added.
-- ------------------------------
overriding
procedure Broadcast (UI : in out UICommand;
Event : not null access ASF.Events.Faces.Faces_Event'Class;
Context : in out Faces_Context'Class) is
pragma Unreferenced (UI);
use ASF.Events.Faces.Actions;
App : constant access Applications.Main.Application'Class := Context.Get_Application;
Disp : constant Action_Listener_Access := App.Get_Action_Listener;
begin
if Disp /= null and then Event.all in Action_Event'Class then
Disp.Process_Action (Event => Action_Event (Event.all),
Context => Context);
end if;
end Broadcast;
overriding
procedure Encode_Begin (UI : in UICommand;
Context : in out Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
Value : constant EL.Objects.Object := UI.Get_Value;
begin
Writer.Start_Element ("input");
Writer.Write_Attribute (Name => "type", Value => "submit");
Writer.Write_Attribute (Name => "name", Value => UI.Get_Client_Id);
if not EL.Objects.Is_Null (Value) then
Writer.Write_Attribute (Name => "value", Value => Value);
end if;
UI.Render_Attributes (Context, INPUT_ATTRIBUTE_NAMES, Writer);
if Context.Is_Ajax_Request then
Writer.Write_Attribute (Name => "onclick",
Value => "return ASF.Submit(this);");
end if;
Writer.End_Element ("input");
end;
end Encode_Begin;
-- ------------------------------
-- Form Component
-- ------------------------------
-- ------------------------------
-- Check whether the form is submitted.
-- ------------------------------
function Is_Submitted (UI : in UIForm) return Boolean is
begin
return UI.Is_Submitted;
end Is_Submitted;
-- ------------------------------
-- Called during the <b>Apply Request</b> phase to indicate that this
-- form is submitted.
-- ------------------------------
procedure Set_Submitted (UI : in out UIForm) is
begin
UI.Is_Submitted := True;
end Set_Submitted;
-- ------------------------------
-- Get the action URL to set on the HTML form
-- ------------------------------
function Get_Action (UI : in UIForm;
Context : in Faces_Context'Class) return String is
pragma Unreferenced (UI);
App : constant ASF.Contexts.Faces.Application_Access := Context.Get_Application;
View_Handler : constant access Applications.Views.View_Handler'Class := App.Get_View_Handler;
View : constant ASF.Components.Root.UIViewRoot := Context.Get_View_Root;
begin
return View_Handler.Get_Action_URL (Context, ASF.Components.Root.Get_View_Id (View));
end Get_Action;
-- ------------------------------
-- Get the CSRF token validity. Returns 0 if the form has no CSRF token.
-- ------------------------------
function Get_Token_Validity (UI : in UIForm;
Context : in Faces_Context'Class) return Natural is
Validity : constant String := UI.Get_Attribute ("validity", Context);
begin
if Validity = "all" then
return 0;
elsif Validity'Length = 0 then
return 24 * 3600;
else
return Natural'Value (Validity);
end if;
exception
when Constraint_Error =>
UI.Log_Error ("Invalid validity value: '{0}'", Validity);
return 24 * 3600;
end Get_Token_Validity;
-- ------------------------------
-- Create the CSRF token for the form submission and the given form ID.
-- ------------------------------
function Create_Token (UI : in UIForm;
Id : in String;
Context : in Faces_Context'Class) return String is
Validity : constant Natural := UI.Get_Token_Validity (Context);
begin
if Validity = 0 then
return "1";
end if;
return Context.Create_Token (Id, Duration (Validity));
end Create_Token;
overriding
procedure Encode_Begin (UI : in UIForm;
Context : in out Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
Id : constant Unbounded_String := UI.Get_Client_Id;
Token : constant String := UI.Create_Token (To_String (Id), Context);
begin
Writer.Start_Element ("form");
Writer.Write_Attribute (Name => "method", Value => "post");
Writer.Write_Attribute (Name => "name", Value => Id);
Writer.Write_Attribute (Name => "action", Value => UI.Get_Action (Context));
UI.Render_Attributes (Context, FORM_ATTRIBUTE_NAMES, Writer);
Writer.Start_Element ("input");
Writer.Write_Attribute (Name => "type", Value => "hidden");
Writer.Write_Attribute (Name => "name", Value => Id);
Writer.Write_Attribute (Name => "value", Value => Token);
Writer.End_Element ("input");
end;
end Encode_Begin;
overriding
procedure Encode_End (UI : in UIForm;
Context : in out Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
Writer : constant Response_Writer_Access := Context.Get_Response_Writer;
begin
Writer.End_Element ("form");
end;
end Encode_End;
overriding
procedure Decode (UI : in out UIForm;
Context : in out Faces_Context'Class) is
Id : constant Unbounded_String := UI.Get_Client_Id;
Ident : constant String := To_String (Id);
Val : constant String := Context.Get_Parameter (Ident);
begin
if Val /= "" then
declare
Validity : constant Natural := UI.Get_Token_Validity (Context);
begin
Log.Debug ("Submission of form {0}", Id);
if Validity > 0 and then not Context.Verify_Token (Ident, Val) then
UI.Is_Valid := False;
UI.Add_Message (Name => EXPIRED_MESSAGE_NAME,
Default => EXPIRED_MESSAGE_ID,
Context => Context);
UI.Log_Error ("Token verification failed for form '{0}'", Ident);
else
UI.Is_Valid := True;
end if;
UIForm'Class (UI).Set_Submitted;
end;
end if;
end Decode;
overriding
procedure Process_Decodes (UI : in out UIForm;
Context : in out Faces_Context'Class) is
begin
-- Do not decode the component nor its children if the component is not rendered.
if not UI.Is_Rendered (Context) then
return;
end if;
Base.UIComponent'Class (UI).Decode (Context);
-- If the form is submitted, process the children.
-- Otherwise, none of the parameters are for this form.
if not UI.Is_Submitted then
Log.Debug ("Form {0} was not submitted", UI.Get_Client_Id);
elsif UI.Is_Valid then
Log.Info ("Decoding form {0}", UI.Get_Client_Id);
UI.Decode_Children (Context);
else
Log.Info ("Submitted form {0} has invalid CSRF token", UI.Get_Client_Id);
end if;
end Process_Decodes;
begin
ASF.Utils.Set_Text_Attributes (FORM_ATTRIBUTE_NAMES);
ASF.Utils.Set_Text_Attributes (INPUT_ATTRIBUTE_NAMES);
ASF.Utils.Set_Text_Attributes (TEXTAREA_ATTRIBUTE_NAMES);
ASF.Utils.Set_Interactive_Attributes (INPUT_ATTRIBUTE_NAMES);
ASF.Utils.Set_Interactive_Attributes (FORM_ATTRIBUTE_NAMES);
ASF.Utils.Set_Form_Attributes (FORM_ATTRIBUTE_NAMES);
ASF.Utils.Set_Input_Attributes (INPUT_ATTRIBUTE_NAMES);
ASF.Utils.Set_Textarea_Attributes (TEXTAREA_ATTRIBUTE_NAMES);
ASF.Utils.Set_File_Attributes (FILE_ATTRIBUTE_NAMES);
ASF.Utils.Set_Interactive_Attributes (FILE_ATTRIBUTE_NAMES);
ASF.Utils.Set_Text_Attributes (FILE_ATTRIBUTE_NAMES);
ASF.Utils.Set_Input_Attributes (FILE_ATTRIBUTE_NAMES);
end ASF.Components.Html.Forms;
|
gitter-badger/spat | Ada | 13,788 | ads | ------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. ([email protected])
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - Map information from JSON data into internal data structure.
--
-- Collect file contents.
--
------------------------------------------------------------------------------
private with Ada.Tags;
limited private with Ada.Containers.Hashed_Maps;
limited private with Ada.Containers.Hashed_Sets;
with SPAT.Entity.Tree;
limited with SPAT.Strings;
with SPAT.Timing_Item;
package SPAT.Spark_Info is
type Sorting_Criterion is (None, Name, Max_Time, Max_Success_Time);
type T is tagged limited private;
-- Binary representation of the information obtained from a .spark JSON
-- file.
---------------------------------------------------------------------------
-- Map_Spark_File
--
-- Traverses through the JSON data given in Root and translates it into
-- the data structure given in This.
--
-- Must be called first before the below subroutines can be called.
---------------------------------------------------------------------------
not overriding
procedure Map_Spark_File (This : in out T;
File : in SPARK_File_Name;
Root : in JSON_Value);
---------------------------------------------------------------------------
-- List_All_Entities
--
-- Returns an (optionally sorted) list of all entities (source unit names)
-- currently stored in This.
---------------------------------------------------------------------------
not overriding
function List_All_Entities
(This : in T;
Sort_By : in Sorting_Criterion := Name) return Strings.Entity_Names;
---------------------------------------------------------------------------
-- List_All_Files
--
-- Returns an (optionally sorted) list of the names of all files that have
-- been parsed into This.
---------------------------------------------------------------------------
not overriding
function List_All_Files
(This : in T;
Sort_By : in Sorting_Criterion := None) return Strings.SPARK_File_Names;
---------------------------------------------------------------------------
-- Num_Flows
--
-- Return the total number of flows (flow items) collected.
---------------------------------------------------------------------------
not overriding
function Num_Flows (This : not null access T)
return Ada.Containers.Count_Type;
---------------------------------------------------------------------------
-- Flow_Time
--
-- Reported time taken for the flow analysis for File.
---------------------------------------------------------------------------
not overriding
function Flow_Time (This : in T;
File : in SPARK_File_Name) return Duration;
---------------------------------------------------------------------------
-- Num_Proofs
--
-- Return the total number of proofs collected.
---------------------------------------------------------------------------
not overriding
function Num_Proofs (This : not null access T)
return Ada.Containers.Count_Type;
---------------------------------------------------------------------------
-- Proof_Time
--
-- Reported time taken for all the proofs for File.
---------------------------------------------------------------------------
not overriding
function Proof_Time (This : in T;
File : in SPARK_File_Name) return Duration;
---------------------------------------------------------------------------
-- Max_Proof_Time
---------------------------------------------------------------------------
not overriding
function Max_Proof_Time (This : in T;
File : in SPARK_File_Name) return Duration;
---------------------------------------------------------------------------
-- Max_Success_Proof_Time
--
-- Reported time for the longest successful proof.
-- If the time returned is -1.0, then nothing is proven.
---------------------------------------------------------------------------
not overriding
function Max_Success_Proof_Time (This : in T;
File : in SPARK_File_Name) return Duration;
---------------------------------------------------------------------------
-- Max_Proof_Time
--
-- Maximum time taken for a single proof for Entity.
---------------------------------------------------------------------------
not overriding
function Max_Proof_Time (This : in T;
Entity : in Entity_Name) return Duration;
---------------------------------------------------------------------------
-- Max_Success_Proof_Time
--
-- Maximum time taken for a single successful proof for Entity,
-- considering all verification conditions and proof paths in them.
---------------------------------------------------------------------------
not overriding
function Max_Success_Proof_Time (This : in T;
Entity : in Entity_Name) return Duration;
---------------------------------------------------------------------------
-- Total_Proof_Time
--
-- Total (accumulated) time taken for all proofs for Entity.
---------------------------------------------------------------------------
not overriding
function Total_Proof_Time (This : in T;
Entity : in Entity_Name) return Duration;
---------------------------------------------------------------------------
-- Proof_List
--
-- List of proof items for given Entity, sorted by time.
---------------------------------------------------------------------------
not overriding
function Proof_Tree
(This : in T;
Entity : in Entity_Name) return SPAT.Entity.Tree.Forward_Iterator'Class;
---------------------------------------------------------------------------
-- Iterate_Children
---------------------------------------------------------------------------
not overriding
function Iterate_Children (This : in T;
Entity : in Entity_Name;
Position : in SPAT.Entity.Tree.Cursor)
return SPAT.Entity.Tree.Forward_Iterator'Class;
---------------------------------------------------------------------------
-- Has_Failed_Attempts
--
-- Returns True if any of the proof attempts for Entity do not have a
-- "Valid" result.
---------------------------------------------------------------------------
not overriding
function Has_Failed_Attempts (This : in T;
Entity : in Entity_Name) return Boolean;
---------------------------------------------------------------------------
-- Has_Unjustified_Attempts
--
-- Returns True if some of the proof attempts for Entity are not "Valid"
-- and there is no justification message.
---------------------------------------------------------------------------
not overriding
function Has_Unjustified_Attempts
(This : in T;
Entity : in Entity_Name) return Boolean;
---------------------------------------------------------------------------
-- Has_Unproved_Attempts
--
-- Returns True if some of the proof attempts for Entity do have a "Valid"
-- result.
---------------------------------------------------------------------------
not overriding
function Has_Unproved_Attempts (This : in T;
Entity : in Entity_Name) return Boolean;
---------------------------------------------------------------------------
-- Print_Trees
--
-- Debugging subroutine to print the trees to Standard_Output. Only does
-- something if the Verbose flag is set.
---------------------------------------------------------------------------
not overriding
procedure Print_Trees (This : in T);
private
type Source_Lines_Sentinel is new Entity.T with null record;
---------------------------------------------------------------------------
-- Image
---------------------------------------------------------------------------
overriding
function Image (This : in Source_Lines_Sentinel) return String is
(Ada.Tags.External_Tag (T => Source_Lines_Sentinel'Class (This)'Tag) & ": ()");
Empty_Source_Lines_Sentinel : constant Source_Lines_Sentinel :=
(Entity.T with null record);
type Flows_Sentinel is new Entity.T with null record;
---------------------------------------------------------------------------
-- Image
---------------------------------------------------------------------------
overriding
function Image (This : in Flows_Sentinel) return String is
(Ada.Tags.External_Tag (T => Flows_Sentinel'Class (This)'Tag) & ": ()");
Empty_Flows_Sentinel : constant Flows_Sentinel :=
(Entity.T with null record);
type Proof_Cache is
record
Max_Proof_Time : Duration;
Max_Success_Proof_Time : Duration;
Total_Proof_Time : Duration;
Has_Failed_Attempts : Boolean;
Has_Unproved_Attempts : Boolean;
Has_Unjustified_Attempts : Boolean;
end record;
type Proofs_Sentinel is new Entity.T with
record
Cache : Proof_Cache;
end record;
---------------------------------------------------------------------------
-- Image
---------------------------------------------------------------------------
overriding
function Image (This : in Proofs_Sentinel) return String is
(Ada.Tags.External_Tag (T => Proofs_Sentinel'Class (This)'Tag) & ":" &
("(Max_Proof_Time => " & This.Cache.Max_Proof_Time'Image &
", Total_Proof_Time => " & This.Cache.Total_Proof_Time'Image &
", Has_Failed_Attempts => " & This.Cache.Has_Failed_Attempts'Image &
", Has_Unproved_Attempts => " & This.Cache.Has_Unproved_Attempts'Image &
")"));
Empty_Proofs_Sentinel : constant Proofs_Sentinel :=
(Entity.T with
Cache => Proof_Cache'(Max_Proof_Time => 0.0,
Max_Success_Proof_Time => 0.0,
Total_Proof_Time => 0.0,
Has_Failed_Attempts => False,
Has_Unproved_Attempts => False,
Has_Unjustified_Attempts => False));
-- Ordered set of known filenames. Used to build a cross reference from
-- an entity to the .spark file it has been found in.
package File_Sets is new
Ada.Containers.Hashed_Sets (Element_Type => SPARK_File_Name,
Hash => SPAT.Hash,
Equivalent_Elements => "=",
"=" => "=");
-- Type representing a source (file) entity.
type Analyzed_Entity is
record
SPARK_File : File_Sets.Cursor; -- File the entity was found in.
The_Tree : Entity.Tree.T; -- Holds all entities.
Source_Lines : Entity.Tree.Cursor; -- Currently unused.
Flows : Entity.Tree.Cursor; -- List of Flow_Items
Proofs : Entity.Tree.Cursor; -- List of Proof_Items
end record;
-- Entity_Name -> Analyzed_Entity mapping
package Analyzed_Entities is new
Ada.Containers.Hashed_Maps (Key_Type => Entity_Name,
Element_Type => Analyzed_Entity,
Hash => Hash,
Equivalent_Keys => "=");
-- File_Name -> Timings mapping
package File_Timings is new
Ada.Containers.Hashed_Maps (Key_Type => SPARK_File_Name,
Element_Type => Timing_Item.T,
Hash => Hash,
Equivalent_Keys => "=",
"=" => Timing_Item."=");
-- Cached information for calls to Max_Proof_Time and Max_Success_Proof_Time
-- on files.
type Cache_Info is
record
Max_Success_Proof_Time : Duration;
Max_Proof_Time : Duration;
end record;
package File_Cached_Info is new
Ada.Containers.Hashed_Maps (Key_Type => SPARK_File_Name,
Element_Type => Cache_Info,
Hash => Hash,
Equivalent_Keys => "=",
"=" => "=");
type T is tagged limited
record
Files : File_Sets.Set;
Entities : Analyzed_Entities.Map; -- The list of entities.
Timings : File_Timings.Map; -- The "timings" block for a file.
-- Cached data
Cached : File_Cached_Info.Map; -- Info per file
Flow_Count : Ada.Containers.Count_Type'Base;
Proof_Count : Ada.Containers.Count_Type'Base;
end record;
end SPAT.Spark_Info;
|
stcarrez/ada-servlet | Ada | 907 | ads | -----------------------------------------------------------------------
-- servlet-security -- Servlet Security
-- Copyright (C) 2012, 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.
-----------------------------------------------------------------------
package Servlet.Security is
end Servlet.Security;
|
AdaCore/libadalang | Ada | 242 | adb | with Types; use all type Types.Enum;
procedure Test is
X : Types.Enum;
begin
begin
case X is
when A => null;
when B => null;
when others => null;
end case;
end;
pragma Test_Block;
end Test;
|
OneWingedShark/Byron | Ada | 249 | ads | Pragma Ada_2012;
Pragma Assertion_Policy( Check );
With
Lexington.Token_Vector_Pkg;
-- Takes a string, returns a vector containing a single-token (a TEXT token).
Function Lexington.Aux.P0(Input : Wide_Wide_String) return Token_Vector_Pkg.Vector;
|
zenware/FizzBuzz | Ada | 664 | adb | -- Note: GNAT complains if the unit is simply named "Ada" since that is a system
-- unit. gnatmake silently refuses to do anything.
with Ada.Text_IO;
procedure Ada_FizzBuzz is
package IO renames Ada.Text_IO;
function FizzBuzz(N : Integer) return String is
begin
if N mod 3 = 0 and N mod 5 = 0 then
return "FizzBuzz";
elsif N mod 3 = 0 then
return "Fizz";
elsif N mod 5 = 0 then
return "Buzz";
else
return Integer'Image(N)(2 .. Integer'Image(N)'Last);
end if;
end FizzBuzz;
begin
for I in Integer range 1 .. 100 loop
IO.Put_Line(FizzBuzz(I));
end loop;
end Ada_FizzBuzz;
|
FROL256/ada-ray-tracer | Ada | 1,889 | adb | with Interfaces;
with Ada.Streams.Stream_IO;
use Interfaces;
use Ada.Streams.Stream_IO;
package body Bitmap is
procedure Init(im : out Image; w : Integer; h : Integer) is
begin
im.width := w;
im.height := h;
im.data := new PixelData(0 .. w*h-1);
end Init;
procedure Delete(im : in out Image) is
begin
im.width := 0;
im.height := 0;
delete(im.data);
im.data := null;
end Delete;
procedure LoadBMP(im : in out Image; a_fileName : String) is
begin
null;
end LoadBMP;
procedure SaveBMP(im : Image; a_fileName : String) is
BMP_File : File_Type;
S : Stream_Access;
header : BITBAPFILEHEADER;
info : BITMAPINFOHEADER;
px : Pixel;
pxU : Unsigned_32;
begin
header.bfType := 16#4d42#;
header.bfSize := 14 + 40 + DWORD(im.width*im.height*3);
header.bfReserved1 := 0;
header.bfReserved2 := 0;
header.bfOffBits := 14 + 40;
info.biSize := 40;
info.biWidth := DWORD(im.width);
info.biHeight := DWORD(im.height);
info.biPlanes := 1;
info.biBitCount := 24;
info.biCompression := 0;
info.biSizeImage := 0;
info.biXPelsPerMeter := 0;
info.biYPelsPerMeter := 0;
info.biClrUsed := 0;
info.biClrImportant := 0;
Create(File => BMP_File,
Mode => Out_File,
Name => a_fileName,
Form => "");
S := Stream(BMP_File);
BITBAPFILEHEADER'Write(S, header);
BITMAPINFOHEADER'Write(S, info);
for i in im.data'First .. im.data'Last loop
pxU := im.data(i);
px.b := Unsigned_8(Shift_Right(pxU,0) and 255);
px.g := Unsigned_8(Shift_Right(pxU,8) and 255);
px.r := Unsigned_8(Shift_Right(pxU,16) and 255);
Pixel'Write(S, px);
end loop;
Close(BMP_File);
end SaveBMP;
end Bitmap;
|
stcarrez/ada-enet | Ada | 5,277 | ads | -----------------------------------------------------------------------
-- net-headers -- Network headers
-- Copyright (C) 2016 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 Net.Headers is
pragma Preelaborate;
-- Convert integers to network byte order.
function To_Network (Val : in Uint32) return Uint32;
function To_Network (Val : in Uint16) return Uint16;
-- Convert integers to host byte order.
function To_Host (Val : in Uint32) return Uint32;
function To_Host (Val : in Uint16) return Uint16;
-- Ethernet header as defined for 802.3 Ethernet packet.
type Ether_Header is record
Ether_Dhost : Ether_Addr;
Ether_Shost : Ether_Addr;
Ether_Type : Uint16;
end record;
type Ether_Header_Access is access all Ether_Header;
type Arp_Header is record
Ar_Hdr : Uint16;
Ar_Pro : Uint16;
Ar_Hln : Uint8;
Ar_Pln : Uint8;
Ar_Op : Uint16;
end record;
type Ether_Arp is record
Ea_Hdr : Arp_Header;
Arp_Sha : Ether_Addr;
Arp_Spa : Ip_Addr;
Arp_Tha : Ether_Addr;
Arp_Tpa : Ip_Addr;
end record;
type Ether_Arp_Access is access all Ether_Arp;
-- ARP Ethernet packet
type Arp_Packet is record
Ethernet : Net.Headers.Ether_Header;
Arp : Net.Headers.Ether_Arp;
end record;
type Arp_Packet_Access is access all Arp_Packet;
-- IP packet header RFC 791.
type IP_Header is record
Ip_Ihl : Uint8;
Ip_Tos : Uint8;
Ip_Len : Uint16;
Ip_Id : Uint16;
Ip_Off : Uint16;
Ip_Ttl : Uint8;
Ip_P : Uint8;
Ip_Sum : Uint16;
Ip_Src : Ip_Addr;
Ip_Dst : Ip_Addr;
end record;
type IP_Header_Access is access all IP_Header;
-- UDP packet header RFC 768.
type UDP_Header is record
Uh_Sport : Uint16;
Uh_Dport : Uint16;
Uh_Ulen : Uint16;
Uh_Sum : Uint16;
end record;
type UDP_Header_Access is access all UDP_Header;
-- IGMP v2 packet header RFC 2236.
type IGMP_Header is record
Igmp_Type : Uint8;
Igmp_Code : Uint8;
Igmp_Cksum : Uint16;
Igmp_Group : Ip_Addr;
end record;
type IGMP_Header_Access is access all IGMP_Header;
IGMP_MEMBERSHIP_QUERY : constant Uint8 := 16#11#;
IGMP_V1_MEMBERSHIP_REPORT : constant Uint8 := 16#12#;
IGMP_V2_MEMBERSHIP_REPORT : constant Uint8 := 16#16#;
IGMP_V3_MEMBERSHIP_REPORT : constant Uint8 := 16#22#; -- RFC 3376.
IGMP_V2_LEAVE_GROUP : constant Uint8 := 16#17#;
IGMP_DVMRP : constant Uint8 := 16#13#;
IGMP_PIM : constant Uint8 := 16#14#;
type TCP_Header is record
Th_Sport : Uint16;
Th_Dport : Uint16;
Th_Seq : Uint32;
Th_Ack : Uint32;
Th_Off : Uint8;
Th_Flags : Uint8;
Th_Win : Uint16;
Th_Sum : Uint16;
Th_Urp : Uint16;
end record;
type TCP_Header_Access is access all TCP_Header;
ICMP_ECHO_REPLY : constant Uint8 := 0;
ICMP_UNREACHABLE : constant Uint8 := 3;
ICMP_ECHO_REQUEST : constant Uint8 := 8;
type ICMP_Header is record
Icmp_Type : Uint8;
Icmp_Code : Uint8;
Icmp_Checksum : Uint16;
Icmp_Id : Uint16; -- This should be an union
Icmp_Seq : Uint16;
end record;
type ICMP_Header_Access is access all ICMP_Header;
-- DHCP header as defined by RFC 1541.
type DHCP_Header is record
Op : Uint8;
Htype : Uint8;
Hlen : Uint8;
Hops : Uint8;
Xid1 : Uint16;
Xid2 : Uint16;
Secs : Uint16;
Flags : Uint16;
Ciaddr : Ip_Addr;
Yiaddr : Ip_Addr;
Siaddr : Ip_Addr;
Giaddr : Ip_Addr;
Chaddr : String (1 .. 16);
Sname : String (1 .. 64);
File : String (1 .. 128);
end record;
type DHCP_Header_Access is access all DHCP_Header;
for DHCP_Header use record
Op at 0 range 0 .. 7;
Htype at 1 range 0 .. 7;
Hlen at 2 range 0 .. 7;
Hops at 3 range 0 .. 7;
Xid1 at 4 range 0 .. 15;
Xid2 at 6 range 0 .. 15;
Secs at 8 range 0 .. 15;
Flags at 10 range 0 .. 15;
Ciaddr at 12 range 0 .. 31;
Yiaddr at 16 range 0 .. 31;
Siaddr at 20 range 0 .. 31;
Giaddr at 24 range 0 .. 31;
Chaddr at 28 range 0 .. 127;
Sname at 44 range 0 .. 511;
File at 108 range 0 .. 1023;
end record;
end Net.Headers;
|
reznikmm/matreshka | Ada | 7,990 | 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$
------------------------------------------------------------------------------
-- SOAP message decoder process events from SAX parser.
------------------------------------------------------------------------------
with League.Strings;
with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
with XML.SAX.Error_Handlers;
with XML.SAX.Parse_Exceptions;
with XML.SAX.Lexical_Handlers;
private with Web_Services.SOAP.Payloads.Decoders;
private with Web_Services.SOAP.Headers.Decoders;
with Web_Services.SOAP.Messages;
package Web_Services.SOAP.Message_Decoders is
type SOAP_Message_Decoder is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.Error_Handlers.SAX_Error_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with private;
function Success (Self : SOAP_Message_Decoder'Class) return Boolean;
function Message
(Self : SOAP_Message_Decoder'Class)
return Web_Services.SOAP.Messages.SOAP_Message_Access;
private
type States is
(Initial, -- Initial state.
SOAP_Envelope, -- SOAP Envelope element has been processed.
SOAP_Header, -- SOAP Header element has been processed.
Header_Element, -- SOAP Header child element has been processed.
Header_Ignore, -- Ignore child and grandchildren of SOAP Header.
SOAP_Body, -- SOAP Body element has beed processed.
Body_Element, -- SOAP Body child element has been processed.
Body_Ignore); -- Ignore child and grandchildren of SOAP Header.
type Modes is
(Strict, -- Strict mode: all 'SHOULD' assertions are
-- checked.
Conformant); -- Relaxed mode to pass SOAP conformance testsuite;
-- some 'SHOULD' assertions aren't checked.
type SOAP_Message_Decoder is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.Error_Handlers.SAX_Error_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with
record
Mode : Modes := Conformant;
State : States := Initial;
Depth : Natural := 0;
Payload_Decoder :
Web_Services.SOAP.Payloads.Decoders.SOAP_Payload_Decoder_Access;
Header_Decoder :
Web_Services.SOAP.Headers.Decoders.SOAP_Header_Decoder_Access;
Message : Web_Services.SOAP.Messages.SOAP_Message_Access;
Success : Boolean := True;
end record;
overriding procedure Characters
(Self : in out SOAP_Message_Decoder;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out SOAP_Message_Decoder;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Error
(Self : in out SOAP_Message_Decoder;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception;
Success : in out Boolean);
-- Stops processing of the message.
overriding function Error_String
(Self : SOAP_Message_Decoder) return League.Strings.Universal_String;
-- Returns error information as string.
overriding procedure Fatal_Error
(Self : in out SOAP_Message_Decoder;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception);
-- Stops processing of the message.
overriding procedure Processing_Instruction
(Self : in out SOAP_Message_Decoder;
Target : League.Strings.Universal_String;
Data : League.Strings.Universal_String;
Success : in out Boolean);
-- Handles processing instructions in XML stream. Processing instructions
-- are prohibited in SOAP messages, this subprogram always sets Success to
-- False.
overriding procedure Start_Document
(Self : in out SOAP_Message_Decoder;
Success : in out Boolean);
-- Handles start of processing of document. Used for initialization.
overriding procedure Start_DTD
(Self : in out SOAP_Message_Decoder;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Start_Element
(Self : in out SOAP_Message_Decoder;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
end Web_Services.SOAP.Message_Decoders;
|
strenkml/EE368 | Ada | 63 | ads |
package Test.DRAM is
procedure Run_Tests;
end Test.DRAM;
|
Skyfold/aws_sorter | Ada | 2,376 | adb | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2003-2012, AdaCore --
-- --
-- This 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 software is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- distributed with this software; see file COPYING3. If not, go --
-- to http://www.gnu.org/licenses for a complete copy of the license. --
------------------------------------------------------------------------------
with AWS.Parameters;
with sorter;
package body Text_Input_CB is
-------------
-- Text_CB --
-------------
function Text_CB
(Request : AWS.Status.Data)
return AWS.Response.Data
is
Text : constant String
:= AWS.Parameters.Get (AWS.Status.Parameters (Request), "text");
begin
if Text = "" then
return AWS.Response.Build
("text/html", "<html><body>"
& "<p> Write a list delimited by commas containing what you want to sort.</p>"
& "<form>"
& "<textarea rows=""1"" name=""text"" cols=""10""></textarea>"
& "<br><input type=""Submit"">"
& "</form></body></html>");
end if;
return AWS.Response.Build
("text/html", "<html><body>"
& "<p> Here is you sorted list <br><pre>"
& sorter.sort (text) & "</pre>"
& "<form>"
& "<input type=""Submit"" value=""Back"">"
& "</form></body></html>");
end Text_CB;
end Text_Input_CB;
|
reznikmm/matreshka | Ada | 63,070 | adb | ------------------------------------------------------------------------------
-- --
-- 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.Internals.Links;
with AMF.Internals.Tables.Primitive_Types_Notification;
with AMF.Internals.Tables.UTP_Element_Table;
with AMF.Internals.Tables.UTP_Types;
with AMF.Internals.Tables.Utp_Metamodel;
with AMF.Internals.Tables.Utp_Notification;
package body AMF.Internals.Tables.UTP_Attributes is
use type Matreshka.Internals.Strings.Shared_String_Access;
-- CodingRule
--
-- 2 CodingRule::base_Namespace
-- 3 CodingRule::base_Property
-- 1 CodingRule::base_ValueSpecification
-- 4 CodingRule::coding
--
-- DataPartition
--
-- 1 DataPartition::base_Classifier
--
-- DataPool
--
-- 1 DataPool::base_Classifier
-- 2 DataPool::base_Property
--
-- DataSelector
--
-- 1 DataSelector::base_Operation
--
-- Default
--
-- 1 Default::base_Behavior
--
-- DefaultApplication
--
-- 1 DefaultApplication::base_Dependency
-- 2 DefaultApplication::repetition
--
-- DetermAlt
--
-- 1 DetermAlt::base_CombinedFragment
--
-- FinishAction
--
-- 2 FinishAction::base_InvocationAction
-- 1 FinishAction::base_OpaqueAction
--
-- GetTimezoneAction
--
-- 1 GetTimezoneAction::base_ReadStructuralFeatureAction
--
-- LiteralAny
--
-- 1 LiteralAny::base_LiteralSpecification
--
-- LiteralAnyOrNull
--
-- 1 LiteralAnyOrNull::base_LiteralSpecification
--
-- LogAction
--
-- 1 LogAction::base_SendObjectAction
--
-- ManagedElement
--
-- 1 ManagedElement::base_Element
-- 5 ManagedElement::criticality
-- 3 ManagedElement::description
-- 2 ManagedElement::owner
-- 4 ManagedElement::version
--
-- ReadTimerAction
--
-- 1 ReadTimerAction::base_CallOperationAction
--
-- SUT
--
-- 1 SUT::base_Property
--
-- SetTimezoneAction
--
-- 1 SetTimezoneAction::base_WriteStructuralFeatureAction
--
-- StartTimerAction
--
-- 1 StartTimerAction::base_CallOperationAction
--
-- StopTimerAction
--
-- 1 StopTimerAction::base_CallOperationAction
--
-- TestCase
--
-- 4 TestCase::base_Behavior
-- 5 TestCase::base_Operation
-- 2 TestCase::compatibleSUTVariant
-- 1 TestCase::compatibleSUTVersion
-- 3 TestCase::priority
--
-- TestComponent
--
-- 3 TestComponent::base_StructuredClassifier
-- 2 TestComponent::compatibleSUTVariant
-- 1 TestComponent::compatibleSUTVersion
--
-- TestContext
--
-- 4 TestContext::base_BehavioredClassifier
-- 3 TestContext::base_StructuredClassifier
-- 2 TestContext::compatibleSUTVariant
-- 1 TestContext::compatibleSUTVersion
-- 5 TestContext::testLevel
--
-- TestLog
--
-- 1 TestLog::base_Behavior
-- 4 TestLog::duration
-- 3 TestLog::executedAt
-- 7 TestLog::sutVersion
-- 2 TestLog::tester
-- 5 TestLog::verdict
-- 6 TestLog::verdictReason
--
-- TestLogApplication
--
-- 1 TestLogApplication::base_Dependency
--
-- TestObjective
--
-- 1 TestObjective::base_Dependency
-- 3 TestObjective::priority
--
-- TestSuite
--
-- 1 TestSuite::base_Behavior
-- 3 TestSuite::priority
--
-- 1 TestSuite::testCase
-- TimeOut
--
-- 1 TimeOut::base_TimeEvent
--
-- TimeOutAction
--
-- 1 TimeOutAction::base_AcceptEventAction
--
-- TimeOutMessage
--
-- 1 TimeOutMessage::base_Message
--
-- TimerRunningAction
--
-- 1 TimerRunningAction::base_ReadStructuralFeatureAction
--
-- ValidationAction
--
-- 1 ValidationAction::base_CallOperationAction
--
-------------------------------------------
-- Internal_Get_Base_Accept_Event_Action --
-------------------------------------------
function Internal_Get_Base_Accept_Event_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Accept_Event_Action;
--------------------------------
-- Internal_Get_Base_Behavior --
--------------------------------
function Internal_Get_Base_Behavior
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Default =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Suite =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Behavior;
---------------------------------------------
-- Internal_Get_Base_Behaviored_Classifier --
---------------------------------------------
function Internal_Get_Base_Behaviored_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Behaviored_Classifier;
---------------------------------------------
-- Internal_Get_Base_Call_Operation_Action --
---------------------------------------------
function Internal_Get_Base_Call_Operation_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Read_Timer_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Start_Timer_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Stop_Timer_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Validation_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Call_Operation_Action;
----------------------------------
-- Internal_Get_Base_Classifier --
----------------------------------
function Internal_Get_Base_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Partition =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Classifier;
-----------------------------------------
-- Internal_Get_Base_Combined_Fragment --
-----------------------------------------
function Internal_Get_Base_Combined_Fragment
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Determ_Alt =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Combined_Fragment;
----------------------------------
-- Internal_Get_Base_Dependency --
----------------------------------
function Internal_Get_Base_Dependency
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Default_Application =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log_Application =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Objective =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Dependency;
-------------------------------
-- Internal_Get_Base_Element --
-------------------------------
function Internal_Get_Base_Element
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Managed_Element =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Element;
-----------------------------------------
-- Internal_Get_Base_Invocation_Action --
-----------------------------------------
function Internal_Get_Base_Invocation_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Invocation_Action;
---------------------------------------------
-- Internal_Get_Base_Literal_Specification --
---------------------------------------------
function Internal_Get_Base_Literal_Specification
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any_Or_Null =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Literal_Specification;
-------------------------------
-- Internal_Get_Base_Message --
-------------------------------
function Internal_Get_Base_Message
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Message =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Message;
---------------------------------
-- Internal_Get_Base_Namespace --
---------------------------------
function Internal_Get_Base_Namespace
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Namespace;
-------------------------------------
-- Internal_Get_Base_Opaque_Action --
-------------------------------------
function Internal_Get_Base_Opaque_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Opaque_Action;
---------------------------------
-- Internal_Get_Base_Operation --
---------------------------------
function Internal_Get_Base_Operation
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Selector =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Operation;
--------------------------------
-- Internal_Get_Base_Property --
--------------------------------
function Internal_Get_Base_Property
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_SUT =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Property;
------------------------------------------------------
-- Internal_Get_Base_Read_Structural_Feature_Action --
------------------------------------------------------
function Internal_Get_Base_Read_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Get_Timezone_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Timer_Running_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Read_Structural_Feature_Action;
------------------------------------------
-- Internal_Get_Base_Send_Object_Action --
------------------------------------------
function Internal_Get_Base_Send_Object_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Log_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Send_Object_Action;
---------------------------------------------
-- Internal_Get_Base_Structured_Classifier --
---------------------------------------------
function Internal_Get_Base_Structured_Classifier
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Component =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).Link, Self);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Structured_Classifier;
----------------------------------
-- Internal_Get_Base_Time_Event --
----------------------------------
function Internal_Get_Base_Time_Event
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Time_Event;
-------------------------------------------
-- Internal_Get_Base_Value_Specification --
-------------------------------------------
function Internal_Get_Base_Value_Specification
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Value_Specification;
-------------------------------------------------------
-- Internal_Get_Base_Write_Structural_Feature_Action --
-------------------------------------------------------
function Internal_Get_Base_Write_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Set_Timezone_Action =>
return
AMF.Internals.Links.Opposite_Element
(AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self);
when others =>
raise Program_Error;
end case;
end Internal_Get_Base_Write_Structural_Feature_Action;
-------------------------
-- Internal_Get_Coding --
-------------------------
function Internal_Get_Coding
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value;
end Internal_Get_Coding;
-----------------------------------------
-- Internal_Get_Compatible_SUT_Variant --
-----------------------------------------
function Internal_Get_Compatible_SUT_Variant
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String is
begin
return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Collection;
end Internal_Get_Compatible_SUT_Variant;
-----------------------------------------
-- Internal_Get_Compatible_SUT_Version --
-----------------------------------------
function Internal_Get_Compatible_SUT_Version
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String is
begin
return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).String_Collection;
end Internal_Get_Compatible_SUT_Version;
------------------------------
-- Internal_Get_Criticality --
------------------------------
function Internal_Get_Criticality
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value;
end Internal_Get_Criticality;
------------------------------
-- Internal_Get_Description --
------------------------------
function Internal_Get_Description
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value;
end Internal_Get_Description;
---------------------------
-- Internal_Get_Duration --
---------------------------
function Internal_Get_Duration
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value;
end Internal_Get_Duration;
------------------------------
-- Internal_Get_Executed_At --
------------------------------
function Internal_Get_Executed_At
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value;
end Internal_Get_Executed_At;
------------------------
-- Internal_Get_Owner --
------------------------
function Internal_Get_Owner
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Value;
end Internal_Get_Owner;
---------------------------
-- Internal_Get_Priority --
---------------------------
function Internal_Get_Priority
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value;
end Internal_Get_Priority;
-----------------------------
-- Internal_Get_Repetition --
-----------------------------
function Internal_Get_Repetition
(Self : AMF.Internals.AMF_Element)
return AMF.Unlimited_Natural is
begin
return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Unlimited_Natural_Value;
end Internal_Get_Repetition;
------------------------------
-- Internal_Get_Sut_Version --
------------------------------
function Internal_Get_Sut_Version
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (7).String_Value;
end Internal_Get_Sut_Version;
----------------------------
-- Internal_Get_Test_Case --
----------------------------
function Internal_Get_Test_Case
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_Element is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Suite =>
return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (0).Collection + 1;
when others =>
raise Program_Error;
end case;
end Internal_Get_Test_Case;
-----------------------------
-- Internal_Get_Test_Level --
-----------------------------
function Internal_Get_Test_Level
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value;
end Internal_Get_Test_Level;
-------------------------
-- Internal_Get_Tester --
-------------------------
function Internal_Get_Tester
(Self : AMF.Internals.AMF_Element)
return AMF.Internals.AMF_Collection_Of_String is
begin
return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Collection;
end Internal_Get_Tester;
--------------------------
-- Internal_Get_Verdict --
--------------------------
function Internal_Get_Verdict
(Self : AMF.Internals.AMF_Element)
return AMF.Utp.Utp_Verdict is
begin
return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Verdict_Value;
end Internal_Get_Verdict;
---------------------------------
-- Internal_Get_Verdict_Reason --
---------------------------------
function Internal_Get_Verdict_Reason
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (6).String_Value;
end Internal_Get_Verdict_Reason;
--------------------------
-- Internal_Get_Version --
--------------------------
function Internal_Get_Version
(Self : AMF.Internals.AMF_Element)
return Matreshka.Internals.Strings.Shared_String_Access is
begin
return
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value;
end Internal_Get_Version;
-------------------------------------------
-- Internal_Set_Base_Accept_Event_Action --
-------------------------------------------
procedure Internal_Set_Base_Accept_Event_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Time_Out_Action_Base_Accept_Event_Action_Extension_Time_Out_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Accept_Event_Action;
--------------------------------
-- Internal_Set_Base_Behavior --
--------------------------------
procedure Internal_Set_Base_Behavior
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Default =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Default_Base_Behavior_Extension_Default,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Case_Base_Behavior_Extension_Test_Case,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Log_Base_Behavior_Extension_Test_Log,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Suite =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Suite_Base_Behavior_Extension_Test_Suite,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Behavior;
---------------------------------------------
-- Internal_Set_Base_Behaviored_Classifier --
---------------------------------------------
procedure Internal_Set_Base_Behaviored_Classifier
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Context_Base_Behaviored_Classifier_Extension_Test_Context,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Behaviored_Classifier;
---------------------------------------------
-- Internal_Set_Base_Call_Operation_Action --
---------------------------------------------
procedure Internal_Set_Base_Call_Operation_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Read_Timer_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Read_Timer_Action_Base_Call_Operation_Action_Extension_Read_Timer_Action,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Start_Timer_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Start_Timer_Action_Base_Call_Operation_Action_Extension_Start_Timer_Action,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Stop_Timer_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Stop_Timer_Action_Base_Call_Operation_Action_Extension_Stop_Timer_Action,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Validation_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Validation_Action_Base_Call_Operation_Action_Extension_Validation_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Call_Operation_Action;
----------------------------------
-- Internal_Set_Base_Classifier --
----------------------------------
procedure Internal_Set_Base_Classifier
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Partition =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Partition_Base_Classifier_Extension_Data_Partition,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Pool_Base_Classifier_Extension_Data_Pool,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Classifier;
-----------------------------------------
-- Internal_Set_Base_Combined_Fragment --
-----------------------------------------
procedure Internal_Set_Base_Combined_Fragment
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Determ_Alt =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Determ_Alt_Base_Combined_Fragment_Extension_Determ_Alt,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Combined_Fragment;
----------------------------------
-- Internal_Set_Base_Dependency --
----------------------------------
procedure Internal_Set_Base_Dependency
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Default_Application =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Default_Application_Base_Dependency_Extension_Default_Application,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log_Application =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Log_Application_Base_Dependency_Extension_Test_Log_Application,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Objective =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Objective_Base_Dependency_Extension_Test_Objective,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Dependency;
-------------------------------
-- Internal_Set_Base_Element --
-------------------------------
procedure Internal_Set_Base_Element
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Managed_Element =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Managed_Element_Base_Element_Extension_Managed_Element,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Element;
-----------------------------------------
-- Internal_Set_Base_Invocation_Action --
-----------------------------------------
procedure Internal_Set_Base_Invocation_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Finish_Action_Base_Invocation_Action_Extension_Finish_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Invocation_Action;
---------------------------------------------
-- Internal_Set_Base_Literal_Specification --
---------------------------------------------
procedure Internal_Set_Base_Literal_Specification
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Literal_Any_Base_Literal_Specification_Extension_Literal_Any,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any_Or_Null =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Literal_Any_Or_Null_Base_Literal_Specification_Extension_Literal_Any_Or_Null,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Literal_Specification;
-------------------------------
-- Internal_Set_Base_Message --
-------------------------------
procedure Internal_Set_Base_Message
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Message =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Time_Out_Message_Base_Message_Extension_Time_Out_Message,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Message;
---------------------------------
-- Internal_Set_Base_Namespace --
---------------------------------
procedure Internal_Set_Base_Namespace
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Coding_Rule_Base_Namespace_Extension_Coding_Rule,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Namespace;
-------------------------------------
-- Internal_Set_Base_Opaque_Action --
-------------------------------------
procedure Internal_Set_Base_Opaque_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Finish_Action_Base_Opaque_Action_Extension_Finish_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Opaque_Action;
---------------------------------
-- Internal_Set_Base_Operation --
---------------------------------
procedure Internal_Set_Base_Operation
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Selector =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Selector_Base_Operation_Extension_Data_Selector,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Case_Base_Operation_Extension_Test_Case,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Operation;
--------------------------------
-- Internal_Set_Base_Property --
--------------------------------
procedure Internal_Set_Base_Property
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Coding_Rule_Base_Property_Extension_Coding_Rule,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Pool_Base_Property_Extension_Data_Pool,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_SUT =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_SUT_Base_Property_Extension_SUT,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Property;
------------------------------------------------------
-- Internal_Set_Base_Read_Structural_Feature_Action --
------------------------------------------------------
procedure Internal_Set_Base_Read_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Get_Timezone_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Get_Timezone_Action_Base_Read_Structural_Feature_Action_Extension_Get_Timezone_Action,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Timer_Running_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Timer_Running_Action_Base_Read_Structural_Feature_Action_Extension_Timer_Running_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Read_Structural_Feature_Action;
------------------------------------------
-- Internal_Set_Base_Send_Object_Action --
------------------------------------------
procedure Internal_Set_Base_Send_Object_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Log_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Log_Action_Base_Send_Object_Action_Extension_Log_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Send_Object_Action;
---------------------------------------------
-- Internal_Set_Base_Structured_Classifier --
---------------------------------------------
procedure Internal_Set_Base_Structured_Classifier
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Component =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Component_Base_Structured_Classifier_Extension_Test_Component,
Self,
To);
when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Context_Base_Structured_Classifier_Extension_Test_Context,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Structured_Classifier;
----------------------------------
-- Internal_Set_Base_Time_Event --
----------------------------------
procedure Internal_Set_Base_Time_Event
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Time_Out_Base_Time_Event_Extension_Time_Out,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Time_Event;
-------------------------------------------
-- Internal_Set_Base_Value_Specification --
-------------------------------------------
procedure Internal_Set_Base_Value_Specification
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Coding_Rule_Base_Value_Specification_Extension_Coding_Rule,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Value_Specification;
-------------------------------------------------------
-- Internal_Set_Base_Write_Structural_Feature_Action --
-------------------------------------------------------
procedure Internal_Set_Base_Write_Structural_Feature_Action
(Self : AMF.Internals.AMF_Element;
To : AMF.Internals.AMF_Element) is
begin
case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is
when AMF.Internals.Tables.UTP_Types.E_Utp_Set_Timezone_Action =>
AMF.Internals.Links.Create_Link
(AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Set_Timezone_Action_Base_Write_Structural_Feature_Action_Extension_Set_Timezone_Action,
Self,
To);
when others =>
raise Program_Error;
end case;
end Internal_Set_Base_Write_Structural_Feature_Action;
-------------------------
-- Internal_Set_Coding --
-------------------------
procedure Internal_Set_Coding
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old :=
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value;
UTP_Element_Table.Table (Self).Member (4).String_Value := To;
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (4).String_Value);
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Coding_Rule_Coding, Old, To);
Matreshka.Internals.Strings.Dereference (Old);
end Internal_Set_Coding;
------------------------------
-- Internal_Set_Criticality --
------------------------------
procedure Internal_Set_Criticality
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value;
UTP_Element_Table.Table (Self).Member (5).String_Value := To;
if UTP_Element_Table.Table (Self).Member (5).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (5).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Criticality, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Criticality;
------------------------------
-- Internal_Set_Description --
------------------------------
procedure Internal_Set_Description
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value;
UTP_Element_Table.Table (Self).Member (3).String_Value := To;
if UTP_Element_Table.Table (Self).Member (3).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (3).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Description, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Description;
---------------------------
-- Internal_Set_Duration --
---------------------------
procedure Internal_Set_Duration
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value;
UTP_Element_Table.Table (Self).Member (4).String_Value := To;
if UTP_Element_Table.Table (Self).Member (4).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (4).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Duration, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Duration;
------------------------------
-- Internal_Set_Executed_At --
------------------------------
procedure Internal_Set_Executed_At
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value;
UTP_Element_Table.Table (Self).Member (3).String_Value := To;
if UTP_Element_Table.Table (Self).Member (3).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (3).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Executed_At, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Executed_At;
------------------------
-- Internal_Set_Owner --
------------------------
procedure Internal_Set_Owner
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Value;
UTP_Element_Table.Table (Self).Member (2).String_Value := To;
if UTP_Element_Table.Table (Self).Member (2).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (2).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Owner, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Owner;
---------------------------
-- Internal_Set_Priority --
---------------------------
procedure Internal_Set_Priority
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value;
UTP_Element_Table.Table (Self).Member (3).String_Value := To;
if UTP_Element_Table.Table (Self).Member (3).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (3).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Case_Priority, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Priority;
-----------------------------
-- Internal_Set_Repetition --
-----------------------------
procedure Internal_Set_Repetition
(Self : AMF.Internals.AMF_Element;
To : AMF.Unlimited_Natural)
is
Old : AMF.Unlimited_Natural;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Unlimited_Natural_Value;
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Unlimited_Natural_Value := To;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Default_Application_Repetition, Old, To);
end Internal_Set_Repetition;
------------------------------
-- Internal_Set_Sut_Version --
------------------------------
procedure Internal_Set_Sut_Version
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (7).String_Value;
UTP_Element_Table.Table (Self).Member (7).String_Value := To;
if UTP_Element_Table.Table (Self).Member (7).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (7).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Sut_Version, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Sut_Version;
-----------------------------
-- Internal_Set_Test_Level --
-----------------------------
procedure Internal_Set_Test_Level
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value;
UTP_Element_Table.Table (Self).Member (5).String_Value := To;
if UTP_Element_Table.Table (Self).Member (5).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (5).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Context_Test_Level, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Test_Level;
--------------------------
-- Internal_Set_Verdict --
--------------------------
procedure Internal_Set_Verdict
(Self : AMF.Internals.AMF_Element;
To : AMF.Utp.Utp_Verdict)
is
Old : AMF.Utp.Utp_Verdict;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Verdict_Value;
AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Verdict_Value := To;
AMF.Internals.Tables.Utp_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Verdict, Old, To);
end Internal_Set_Verdict;
---------------------------------
-- Internal_Set_Verdict_Reason --
---------------------------------
procedure Internal_Set_Verdict_Reason
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (6).String_Value;
UTP_Element_Table.Table (Self).Member (6).String_Value := To;
if UTP_Element_Table.Table (Self).Member (6).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (6).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Verdict_Reason, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Verdict_Reason;
--------------------------
-- Internal_Set_Version --
--------------------------
procedure Internal_Set_Version
(Self : AMF.Internals.AMF_Element;
To : Matreshka.Internals.Strings.Shared_String_Access)
is
Old : Matreshka.Internals.Strings.Shared_String_Access;
begin
Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value;
UTP_Element_Table.Table (Self).Member (4).String_Value := To;
if UTP_Element_Table.Table (Self).Member (4).String_Value /= null then
Matreshka.Internals.Strings.Reference
(UTP_Element_Table.Table (Self).Member (4).String_Value);
end if;
AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set
(Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Version, Old, To);
if Old /= null then
Matreshka.Internals.Strings.Reference (Old);
end if;
end Internal_Set_Version;
end AMF.Internals.Tables.UTP_Attributes;
|
zhmu/ananas | Ada | 1,728 | adb | -- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_3 is
function F (I : Integer) return Integer is
begin
return I;
end;
function F2 return Integer is
begin
return Integer(Counter1);
end;
function F3 return Integer is
begin
return Timer1;
end;
Temp : Integer;
begin
Counter1 := Int(F(Integer(Counter2)));
Timer1 := F(Timer2);
Counter1 := Int(F(Timer1));
Timer1 := F(Integer(Counter1));
Temp := F(Integer(Counter1));
Counter1 := Int(F(Temp));
Temp := F(Timer1);
Timer1 := F(Temp);
Temp := F2;
Temp := F3;
end;
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter2" 1 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer2" 1 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*ptr" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*ptr" 0 "gimple"} }
|
reznikmm/matreshka | Ada | 3,633 | 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.UML.Connectable_Elements.Hash is
new AMF.Elements.Generic_Hash (UML_Connectable_Element, UML_Connectable_Element_Access);
|
peterfrankjohnson/kernel | Ada | 5,994 | adb | with System.Machine_Code; use System.Machine_Code;
with Interfaces; use Interfaces;
-- The different timers on the computer have different frequencies
-- therefore we need to be able to work out
--
-- timer cycles per second
-- --------------------------- = timer cycles per process
-- no of processes
-- 1000
-- --------------------------- = quantum (in milliseconds)
-- no of processes
--
-- Run Queue
--
-- +-------------------------------------+
-- | +------+ +------+ +------+ |
-- | | | | | | | |
-- | | 01 |<-| 06 |<-| 03 | |
-- | | | | | | | |
-- | +------+ +------+ +------+ |
-- +-------------------------------------+
--
-- Process 03 is at the start of the queue.
-- There is a pointer from 03 to 06 indicating it is next in the queue
-- If a new process needs to be added to the queue then it is added at
-- the end with a pointer from 01.
-- Processes which are blocking are in the Waiting Queue
-- Once they have completed waiting they are added to the end of the Run Queue
--
-- Waiting
-- +-------------------------------------+
-- | +------+ +------+ +------+ |
-- | | | | | | | |
-- | | 34 | | 15 | | 21 | |
-- | | | | | | | |
-- | +------+ +------+ +------+ |
-- | +------+ |
-- | | | |
-- | | 46 | |
-- | | | |
-- | +------+ |
-- +-------------------------------------+
--
package body Scheduler is
TaskASeq : Integer := 1;
TaskBSeq : Integer := 1;
InitProcess : Boolean := True;
procedure Initialise (CodeSelector : Word; DataSelector : Word; TSS : TaskStateSegment) is
begin
-- Save Selectors as these will be used later on when performing Context Switches
UserLevelCodeSelector := CodeSelector;
UserLevelDataSelector := DataSelector;
-- Scheduler.CreateProcess ("Kernel", Supervisor);
-- Scheduler.CreateProcess ("init", User, Scheduler.Init'Address)
Scheduler.CreateProcess ("Task A ", User, Scheduler.TaskA'Address);
Scheduler.CreateProcess ("Task B ", User, Scheduler.TaskB'Address);
end Initialise;
procedure CreateProcess (Name : ProcessName; Level : ProcessLevel; ProgramCounter : System.Address) is
P : Process_Ptr;
begin
P := new Process.Process;
P.ID := LastPID + 1;
LastPID := LastPID + 1;
P.Level := Level;
P.State := Run;
P.Name := Name;
P.PC := ProgramCounter;
Queue.InsertEnd (RunQueue, P);
end CreateProcess;
procedure Init is
begin
loop
null;
end loop;
end Init;
procedure TaskA is
begin
Put (" Task A: ",
Screen_Width_Range'First,
Screen_Height_Range'Last);
loop
if (TaskASeq = 1) then
Console.Put ("\", 10, Screen_Height_Range'Last);
TaskASeq := TaskASeq + 1;
elsif (TaskASeq = 2) then
Console.Put ("-", 10, Screen_Height_Range'Last);
TaskASeq := TaskASeq + 1;
elsif (TaskASeq = 3) then
Console.Put ("/", 10, Screen_Height_Range'Last);
TaskASeq := TaskASeq + 1;
elsif (TaskASeq = 4) then
Console.Put ("|", 10, Screen_Height_Range'Last);
TaskASeq := 1;
end if;
end loop;
end TaskA;
procedure TaskB is
begin
--Asm ("CLI");
--Asm ("HLT");
Put (" Task B: ",
Screen_Width_Range'First + 10,
Screen_Height_Range'Last);
loop
if (TaskBSeq = 1) then
Console.Put ("\", 20, Screen_Height_Range'Last);
TaskBSeq := TaskBSeq + 1;
elsif (TaskBSeq = 2) then
Console.Put ("-", 20, Screen_Height_Range'Last);
TaskBSeq := TaskBSeq + 1;
elsif (TaskBSeq = 3) then
Console.Put ("/", 20, Screen_Height_Range'Last);
TaskBSeq := TaskBSeq + 1;
elsif (TaskBSeq = 4) then
Console.Put ("|", 20, Screen_Height_Range'Last);
TaskBSeq := 1;
end if;
end loop;
end TaskB;
procedure MainLoop is
P : Process_Ptr;
RegisterC : Byte;
begin
CPU.Interrupts.Disable;
-- Put_Line ("IRQ8");
if InitProcess = True then
Put_Line (" Scheduler called using IRQ8 for first time, starting init process.");
end if;
-- loop
-- Get current Process
P := Queue.Current (RunQueue);
-- Put (" Process : ");
-- Put (P.ID);
-- Put (" - " & P.Name);
-- New_Line;
-- Advance through the Queue
Queue.Next (RunQueue);
if EndOfQueue = True then
Queue.Rewind (RunQueue);
end if;
EndOfQueue := Queue.EndOfQueue (RunQueue);
-- end loop;
-- Read Status Byte of RTC
CPU.OutputByte (16#70#, 16#0C#);
RegisterC := CPU.InputByte (16#71#);
-- Send EOI to PIC
CPU.OutputByte (16#A0#, 16#20#);
CPU.OutputByte (16#20#, 16#20#);
if InitProcess = True then
Put_Line (" Scheduler switching context to init process.");
InitProcess := False;
end if;
PerformContextSwitch (P);
loop
null;
end loop;
Asm ("LEAVE");
Asm ("IRET");
end MainLoop;
procedure PerformContextSwitch (P : Process_Ptr) is
begin
-- if (P.Level = User) then
ContextSwitch (UserLevelCodeSelector, UserLevelDataSelector, P.PC);
-- end if;
-- if (P.Level = Supervisor) then
-- null;
-- end if;
end PerformContextSwitch;
end Scheduler;
|
reznikmm/matreshka | Ada | 3,749 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with XML.DOM.Attributes;
package ODF.DOM.Style_Font_Pitch_Asian_Attributes is
pragma Preelaborate;
type ODF_Style_Font_Pitch_Asian_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Font_Pitch_Asian_Attribute_Access is
access all ODF_Style_Font_Pitch_Asian_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Font_Pitch_Asian_Attributes;
|
frmr/power-station | Ada | 2,591 | ads | with SPARK.Text_IO; use SPARK.Text_IO;
package power_station with SPARK_Mode is
procedure Start_Reactor with
Global => (In_Out => (Standard_Input, Standard_Output)),
Depends => (Standard_Output => (Standard_Input, Standard_Output),
Standard_Input => (Standard_Input)),
Pre => Status (Standard_Output) = Success,
Post => Status (Standard_Output) = Success;
private
procedure Check_Reading(Value : in Integer;
Warning, Danger : out Boolean) with
Depends => (Warning => Value,
Danger => Value),
Pre => (Value >= 0 and Value <= 3),
Post => ((if Value >= 2 then Warning = True) and
(if Value < 2 then Warning = False) and
(if Value = 3 then Danger = True) and
(if Value < 3 then Danger = False));
procedure Decrease_Pressure with
Global => (In_Out => (Standard_Output)),
Depends => (Standard_Output => (Standard_Output)),
Pre => Status (Standard_Output) = Success,
Post => Status (Standard_Output) = Success;
procedure Emergency_Shutdown with
Global => (In_Out => (Standard_Output)),
Depends => (Standard_Output => (Standard_Output)),
Pre => Status (Standard_Output) = Success,
Post => Status (Standard_Output) = Success;
procedure Increase_Pressure with
Global => (In_Out => (Standard_Output)),
Depends => (Standard_Output => (Standard_Output)),
Pre => Status (Standard_Output) = Success,
Post => Status (Standard_Output) = Success;
procedure Update_Reading(Name : in String;
Value : in out Integer;
Shutdown : out Boolean) with
Global => (In_Out => (Standard_Input, Standard_Output)),
Depends => (Standard_Output => (Standard_Input, Standard_Output, Name, Value),
Standard_Input => (Standard_Input),
Value => (Standard_Input, Value),
Shutdown => (Standard_Input)),
Pre => (Status (Standard_Output) = Success and
Value >= 0 and
Value <= 3),
Post => (Status (Standard_Output) = Success and
(if Value'Old = 0 then (Value = 0 or Value = 1)) and
(if Value'Old = 1 then (Value = 0 or Value = 1 or Value = 2)) and
(if Value'Old = 2 then (Value = 1 or Value = 2 or Value = 3)) and
(if Value'Old = 3 then (Value = 2 or Value = 3)));
end power_station;
|
reznikmm/matreshka | Ada | 61,873 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Interactions is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Interaction_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Interaction
(AMF.UML.Interactions.UML_Interaction_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Interaction_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Interaction
(AMF.UML.Interactions.UML_Interaction_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Interaction_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Interaction
(Visitor,
AMF.UML.Interactions.UML_Interaction_Access (Self),
Control);
end if;
end Visit_Element;
----------------
-- Get_Action --
----------------
overriding function Get_Action
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Actions.Collections.Set_Of_UML_Action is
begin
return
AMF.UML.Actions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Action
(Self.Element)));
end Get_Action;
---------------------
-- Get_Formal_Gate --
---------------------
overriding function Get_Formal_Gate
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Gates.Collections.Set_Of_UML_Gate is
begin
return
AMF.UML.Gates.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Formal_Gate
(Self.Element)));
end Get_Formal_Gate;
------------------
-- Get_Fragment --
------------------
overriding function Get_Fragment
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Interaction_Fragments.Collections.Ordered_Set_Of_UML_Interaction_Fragment is
begin
return
AMF.UML.Interaction_Fragments.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Fragment
(Self.Element)));
end Get_Fragment;
------------------
-- Get_Lifeline --
------------------
overriding function Get_Lifeline
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
begin
return
AMF.UML.Lifelines.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Lifeline
(Self.Element)));
end Get_Lifeline;
-----------------
-- Get_Message --
-----------------
overriding function Get_Message
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Messages.Collections.Set_Of_UML_Message is
begin
return
AMF.UML.Messages.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Message
(Self.Element)));
end Get_Message;
-----------------
-- Get_Context --
-----------------
overriding function Get_Context
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is
begin
return
AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Context
(Self.Element)));
end Get_Context;
----------------------
-- Get_Is_Reentrant --
----------------------
overriding function Get_Is_Reentrant
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Reentrant
(Self.Element);
end Get_Is_Reentrant;
----------------------
-- Set_Is_Reentrant --
----------------------
overriding procedure Set_Is_Reentrant
(Self : not null access UML_Interaction_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Reentrant
(Self.Element, To);
end Set_Is_Reentrant;
-------------------------
-- Get_Owned_Parameter --
-------------------------
overriding function Get_Owned_Parameter
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter is
begin
return
AMF.UML.Parameters.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter
(Self.Element)));
end Get_Owned_Parameter;
-----------------------------
-- Get_Owned_Parameter_Set --
-----------------------------
overriding function Get_Owned_Parameter_Set
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Parameter_Sets.Collections.Set_Of_UML_Parameter_Set is
begin
return
AMF.UML.Parameter_Sets.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Parameter_Set
(Self.Element)));
end Get_Owned_Parameter_Set;
-----------------------
-- Get_Postcondition --
-----------------------
overriding function Get_Postcondition
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Postcondition
(Self.Element)));
end Get_Postcondition;
----------------------
-- Get_Precondition --
----------------------
overriding function Get_Precondition
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Precondition
(Self.Element)));
end Get_Precondition;
----------------------------
-- Get_Redefined_Behavior --
----------------------------
overriding function Get_Redefined_Behavior
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is
begin
return
AMF.UML.Behaviors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Behavior
(Self.Element)));
end Get_Redefined_Behavior;
-----------------------
-- Get_Specification --
-----------------------
overriding function Get_Specification
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access is
begin
return
AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Specification
(Self.Element)));
end Get_Specification;
-----------------------
-- Set_Specification --
-----------------------
overriding procedure Set_Specification
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Behavioral_Features.UML_Behavioral_Feature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Specification
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Specification;
-------------------
-- Get_Extension --
-------------------
overriding function Get_Extension
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Extensions.Collections.Set_Of_UML_Extension is
begin
return
AMF.UML.Extensions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Extension
(Self.Element)));
end Get_Extension;
---------------------
-- Get_Is_Abstract --
---------------------
overriding function Get_Is_Abstract
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Abstract
(Self.Element);
end Get_Is_Abstract;
-------------------
-- Get_Is_Active --
-------------------
overriding function Get_Is_Active
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Active
(Self.Element);
end Get_Is_Active;
-------------------
-- Set_Is_Active --
-------------------
overriding procedure Set_Is_Active
(Self : not null access UML_Interaction_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Active
(Self.Element, To);
end Set_Is_Active;
---------------------------
-- Get_Nested_Classifier --
---------------------------
overriding function Get_Nested_Classifier
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classifiers.Collections.Ordered_Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Nested_Classifier
(Self.Element)));
end Get_Nested_Classifier;
-------------------------
-- Get_Owned_Attribute --
-------------------------
overriding function Get_Owned_Attribute
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Attribute
(Self.Element)));
end Get_Owned_Attribute;
-------------------------
-- Get_Owned_Operation --
-------------------------
overriding function Get_Owned_Operation
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation is
begin
return
AMF.UML.Operations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Operation
(Self.Element)));
end Get_Owned_Operation;
-------------------------
-- Get_Owned_Reception --
-------------------------
overriding function Get_Owned_Reception
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Receptions.Collections.Set_Of_UML_Reception is
begin
return
AMF.UML.Receptions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Reception
(Self.Element)));
end Get_Owned_Reception;
---------------------
-- Get_Super_Class --
---------------------
overriding function Get_Super_Class
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classes.Collections.Set_Of_UML_Class is
begin
return
AMF.UML.Classes.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Super_Class
(Self.Element)));
end Get_Super_Class;
-----------------------------
-- Get_Classifier_Behavior --
-----------------------------
overriding function Get_Classifier_Behavior
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access is
begin
return
AMF.UML.Behaviors.UML_Behavior_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Classifier_Behavior
(Self.Element)));
end Get_Classifier_Behavior;
-----------------------------
-- Set_Classifier_Behavior --
-----------------------------
overriding procedure Set_Classifier_Behavior
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Classifier_Behavior
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Classifier_Behavior;
-------------------------------
-- Get_Interface_Realization --
-------------------------------
overriding function Get_Interface_Realization
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Interface_Realizations.Collections.Set_Of_UML_Interface_Realization is
begin
return
AMF.UML.Interface_Realizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Interface_Realization
(Self.Element)));
end Get_Interface_Realization;
------------------------
-- Get_Owned_Behavior --
------------------------
overriding function Get_Owned_Behavior
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Behaviors.Collections.Set_Of_UML_Behavior is
begin
return
AMF.UML.Behaviors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Behavior
(Self.Element)));
end Get_Owned_Behavior;
-------------------
-- Get_Attribute --
-------------------
overriding function Get_Attribute
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Attribute
(Self.Element)));
end Get_Attribute;
---------------------------
-- Get_Collaboration_Use --
---------------------------
overriding function Get_Collaboration_Use
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Collaboration_Uses.Collections.Set_Of_UML_Collaboration_Use is
begin
return
AMF.UML.Collaboration_Uses.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Collaboration_Use
(Self.Element)));
end Get_Collaboration_Use;
-----------------
-- Get_Feature --
-----------------
overriding function Get_Feature
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
return
AMF.UML.Features.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Feature
(Self.Element)));
end Get_Feature;
-----------------
-- Get_General --
-----------------
overriding function Get_General
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_General
(Self.Element)));
end Get_General;
------------------------
-- Get_Generalization --
------------------------
overriding function Get_Generalization
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is
begin
return
AMF.UML.Generalizations.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Generalization
(Self.Element)));
end Get_Generalization;
--------------------------
-- Get_Inherited_Member --
--------------------------
overriding function Get_Inherited_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Inherited_Member
(Self.Element)));
end Get_Inherited_Member;
---------------------------------
-- Get_Is_Final_Specialization --
---------------------------------
overriding function Get_Is_Final_Specialization
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Final_Specialization
(Self.Element);
end Get_Is_Final_Specialization;
---------------------------------
-- Set_Is_Final_Specialization --
---------------------------------
overriding procedure Set_Is_Final_Specialization
(Self : not null access UML_Interaction_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Final_Specialization
(Self.Element, To);
end Set_Is_Final_Specialization;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access is
begin
return
AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Redefinable_Template_Signatures.UML_Redefinable_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
------------------------
-- Get_Owned_Use_Case --
------------------------
overriding function Get_Owned_Use_Case
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Use_Case
(Self.Element)));
end Get_Owned_Use_Case;
--------------------------
-- Get_Powertype_Extent --
--------------------------
overriding function Get_Powertype_Extent
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is
begin
return
AMF.UML.Generalization_Sets.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Powertype_Extent
(Self.Element)));
end Get_Powertype_Extent;
------------------------------
-- Get_Redefined_Classifier --
------------------------------
overriding function Get_Redefined_Classifier
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Classifier
(Self.Element)));
end Get_Redefined_Classifier;
------------------------
-- Get_Representation --
------------------------
overriding function Get_Representation
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access is
begin
return
AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Representation
(Self.Element)));
end Get_Representation;
------------------------
-- Set_Representation --
------------------------
overriding procedure Set_Representation
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Collaboration_Uses.UML_Collaboration_Use_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Representation
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Representation;
----------------------
-- Get_Substitution --
----------------------
overriding function Get_Substitution
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Substitutions.Collections.Set_Of_UML_Substitution is
begin
return
AMF.UML.Substitutions.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Substitution
(Self.Element)));
end Get_Substitution;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access is
begin
return
AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Classifier_Template_Parameters.UML_Classifier_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
------------------
-- Get_Use_Case --
------------------
overriding function Get_Use_Case
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Use_Cases.Collections.Set_Of_UML_Use_Case is
begin
return
AMF.UML.Use_Cases.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Use_Case
(Self.Element)));
end Get_Use_Case;
------------------------
-- Get_Element_Import --
------------------------
overriding function Get_Element_Import
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Element_Imports.Collections.Set_Of_UML_Element_Import is
begin
return
AMF.UML.Element_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Element_Import
(Self.Element)));
end Get_Element_Import;
-------------------------
-- Get_Imported_Member --
-------------------------
overriding function Get_Imported_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
return
AMF.UML.Packageable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Imported_Member
(Self.Element)));
end Get_Imported_Member;
----------------
-- Get_Member --
----------------
overriding function Get_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Member
(Self.Element)));
end Get_Member;
----------------------
-- Get_Owned_Member --
----------------------
overriding function Get_Owned_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
return
AMF.UML.Named_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Member
(Self.Element)));
end Get_Owned_Member;
--------------------
-- Get_Owned_Rule --
--------------------
overriding function Get_Owned_Rule
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Constraints.Collections.Set_Of_UML_Constraint is
begin
return
AMF.UML.Constraints.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Rule
(Self.Element)));
end Get_Owned_Rule;
------------------------
-- Get_Package_Import --
------------------------
overriding function Get_Package_Import
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Package_Imports.Collections.Set_Of_UML_Package_Import is
begin
return
AMF.UML.Package_Imports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Package_Import
(Self.Element)));
end Get_Package_Import;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Interaction_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-----------------
-- Get_Package --
-----------------
overriding function Get_Package
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Packages.UML_Package_Access is
begin
return
AMF.UML.Packages.UML_Package_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Package
(Self.Element)));
end Get_Package;
-----------------
-- Set_Package --
-----------------
overriding procedure Set_Package
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Packages.UML_Package_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Package
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Package;
-----------------------------------
-- Get_Owning_Template_Parameter --
-----------------------------------
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owning_Template_Parameter
(Self.Element)));
end Get_Owning_Template_Parameter;
-----------------------------------
-- Set_Owning_Template_Parameter --
-----------------------------------
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owning_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owning_Template_Parameter;
----------------------------
-- Get_Template_Parameter --
----------------------------
overriding function Get_Template_Parameter
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access is
begin
return
AMF.UML.Template_Parameters.UML_Template_Parameter_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Parameter
(Self.Element)));
end Get_Template_Parameter;
----------------------------
-- Set_Template_Parameter --
----------------------------
overriding procedure Set_Template_Parameter
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Template_Parameter
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Template_Parameter;
----------------------------------
-- Get_Owned_Template_Signature --
----------------------------------
overriding function Get_Owned_Template_Signature
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Template_Signatures.UML_Template_Signature_Access is
begin
return
AMF.UML.Template_Signatures.UML_Template_Signature_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Template_Signature
(Self.Element)));
end Get_Owned_Template_Signature;
----------------------------------
-- Set_Owned_Template_Signature --
----------------------------------
overriding procedure Set_Owned_Template_Signature
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Template_Signatures.UML_Template_Signature_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Owned_Template_Signature
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Owned_Template_Signature;
--------------------------
-- Get_Template_Binding --
--------------------------
overriding function Get_Template_Binding
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Template_Bindings.Collections.Set_Of_UML_Template_Binding is
begin
return
AMF.UML.Template_Bindings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Template_Binding
(Self.Element)));
end Get_Template_Binding;
-----------------
-- Get_Is_Leaf --
-----------------
overriding function Get_Is_Leaf
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
return
AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf
(Self.Element);
end Get_Is_Leaf;
-----------------
-- Set_Is_Leaf --
-----------------
overriding procedure Set_Is_Leaf
(Self : not null access UML_Interaction_Proxy;
To : Boolean) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Is_Leaf
(Self.Element, To);
end Set_Is_Leaf;
---------------------------
-- Get_Redefined_Element --
---------------------------
overriding function Get_Redefined_Element
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Redefinable_Elements.Collections.Set_Of_UML_Redefinable_Element is
begin
return
AMF.UML.Redefinable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_Element
(Self.Element)));
end Get_Redefined_Element;
------------------------------
-- Get_Redefinition_Context --
------------------------------
overriding function Get_Redefinition_Context
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
return
AMF.UML.Classifiers.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefinition_Context
(Self.Element)));
end Get_Redefinition_Context;
--------------------
-- Get_Owned_Port --
--------------------
overriding function Get_Owned_Port
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Ports.Collections.Set_Of_UML_Port is
begin
return
AMF.UML.Ports.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Port
(Self.Element)));
end Get_Owned_Port;
-------------------------
-- Get_Owned_Connector --
-------------------------
overriding function Get_Owned_Connector
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Connectors.Collections.Set_Of_UML_Connector is
begin
return
AMF.UML.Connectors.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Owned_Connector
(Self.Element)));
end Get_Owned_Connector;
--------------
-- Get_Part --
--------------
overriding function Get_Part
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
return
AMF.UML.Properties.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Part
(Self.Element)));
end Get_Part;
--------------
-- Get_Role --
--------------
overriding function Get_Role
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Connectable_Elements.Collections.Set_Of_UML_Connectable_Element is
begin
return
AMF.UML.Connectable_Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Role
(Self.Element)));
end Get_Role;
-----------------
-- Get_Covered --
-----------------
overriding function Get_Covered
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
begin
return
AMF.UML.Lifelines.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered
(Self.Element)));
end Get_Covered;
-------------------------------
-- Get_Enclosing_Interaction --
-------------------------------
overriding function Get_Enclosing_Interaction
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Interactions.UML_Interaction_Access is
begin
return
AMF.UML.Interactions.UML_Interaction_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Interaction
(Self.Element)));
end Get_Enclosing_Interaction;
-------------------------------
-- Set_Enclosing_Interaction --
-------------------------------
overriding procedure Set_Enclosing_Interaction
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Interactions.UML_Interaction_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Interaction
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Enclosing_Interaction;
---------------------------
-- Get_Enclosing_Operand --
---------------------------
overriding function Get_Enclosing_Operand
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is
begin
return
AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Operand
(Self.Element)));
end Get_Enclosing_Operand;
---------------------------
-- Set_Enclosing_Operand --
---------------------------
overriding procedure Set_Enclosing_Operand
(Self : not null access UML_Interaction_Proxy;
To : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Operand
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Enclosing_Operand;
--------------------------
-- Get_General_Ordering --
--------------------------
overriding function Get_General_Ordering
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
begin
return
AMF.UML.General_Orderings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_General_Ordering
(Self.Element)));
end Get_General_Ordering;
-------------
-- Context --
-------------
overriding function Context
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Behaviored_Classifiers.UML_Behaviored_Classifier_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Context unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Context";
return Context (Self);
end Context;
---------------
-- Extension --
---------------
overriding function Extension
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Extensions.Collections.Set_Of_UML_Extension is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Extension unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Extension";
return Extension (Self);
end Extension;
-------------
-- Inherit --
-------------
overriding function Inherit
(Self : not null access constant UML_Interaction_Proxy;
Inhs : AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherit unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Inherit";
return Inherit (Self, Inhs);
end Inherit;
-----------------
-- Super_Class --
-----------------
overriding function Super_Class
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classes.Collections.Set_Of_UML_Class is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Super_Class unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Super_Class";
return Super_Class (Self);
end Super_Class;
------------------
-- All_Features --
------------------
overriding function All_Features
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Features.Collections.Set_Of_UML_Feature is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Features unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.All_Features";
return All_Features (Self);
end All_Features;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant UML_Interaction_Proxy;
Other : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
-------------
-- General --
-------------
overriding function General
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Classifiers.Collections.Set_Of_UML_Classifier is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "General unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.General";
return General (Self);
end General;
-----------------------
-- Has_Visibility_Of --
-----------------------
overriding function Has_Visibility_Of
(Self : not null access constant UML_Interaction_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Has_Visibility_Of unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Has_Visibility_Of";
return Has_Visibility_Of (Self, N);
end Has_Visibility_Of;
-------------------------
-- Inheritable_Members --
-------------------------
overriding function Inheritable_Members
(Self : not null access constant UML_Interaction_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inheritable_Members unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Inheritable_Members";
return Inheritable_Members (Self, C);
end Inheritable_Members;
----------------------
-- Inherited_Member --
----------------------
overriding function Inherited_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Inherited_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Inherited_Member";
return Inherited_Member (Self);
end Inherited_Member;
-----------------
-- Is_Template --
-----------------
overriding function Is_Template
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Is_Template";
return Is_Template (Self);
end Is_Template;
-------------------------
-- May_Specialize_Type --
-------------------------
overriding function May_Specialize_Type
(Self : not null access constant UML_Interaction_Proxy;
C : AMF.UML.Classifiers.UML_Classifier_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "May_Specialize_Type unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.May_Specialize_Type";
return May_Specialize_Type (Self, C);
end May_Specialize_Type;
------------------------
-- Exclude_Collisions --
------------------------
overriding function Exclude_Collisions
(Self : not null access constant UML_Interaction_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Exclude_Collisions unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Exclude_Collisions";
return Exclude_Collisions (Self, Imps);
end Exclude_Collisions;
-------------------------
-- Get_Names_Of_Member --
-------------------------
overriding function Get_Names_Of_Member
(Self : not null access constant UML_Interaction_Proxy;
Element : AMF.UML.Named_Elements.UML_Named_Element_Access)
return AMF.String_Collections.Set_Of_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Get_Names_Of_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Get_Names_Of_Member";
return Get_Names_Of_Member (Self, Element);
end Get_Names_Of_Member;
--------------------
-- Import_Members --
--------------------
overriding function Import_Members
(Self : not null access constant UML_Interaction_Proxy;
Imps : AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Import_Members unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Import_Members";
return Import_Members (Self, Imps);
end Import_Members;
---------------------
-- Imported_Member --
---------------------
overriding function Imported_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Imported_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Imported_Member";
return Imported_Member (Self);
end Imported_Member;
---------------------------------
-- Members_Are_Distinguishable --
---------------------------------
overriding function Members_Are_Distinguishable
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Members_Are_Distinguishable unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Members_Are_Distinguishable";
return Members_Are_Distinguishable (Self);
end Members_Are_Distinguishable;
------------------
-- Owned_Member --
------------------
overriding function Owned_Member
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Named_Elements.Collections.Set_Of_UML_Named_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Owned_Member unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Owned_Member";
return Owned_Member (Self);
end Owned_Member;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Interaction_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Namespace";
return Namespace (Self);
end Namespace;
-----------------
-- Conforms_To --
-----------------
overriding function Conforms_To
(Self : not null access constant UML_Interaction_Proxy;
Other : AMF.UML.Types.UML_Type_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Conforms_To unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Conforms_To";
return Conforms_To (Self, Other);
end Conforms_To;
------------------------
-- Is_Compatible_With --
------------------------
overriding function Is_Compatible_With
(Self : not null access constant UML_Interaction_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Compatible_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Is_Compatible_With";
return Is_Compatible_With (Self, P);
end Is_Compatible_With;
---------------------------
-- Is_Template_Parameter --
---------------------------
overriding function Is_Template_Parameter
(Self : not null access constant UML_Interaction_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Template_Parameter unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Is_Template_Parameter";
return Is_Template_Parameter (Self);
end Is_Template_Parameter;
----------------------------
-- Parameterable_Elements --
----------------------------
overriding function Parameterable_Elements
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Parameterable_Elements.Collections.Set_Of_UML_Parameterable_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Parameterable_Elements unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Parameterable_Elements";
return Parameterable_Elements (Self);
end Parameterable_Elements;
------------------------
-- Is_Consistent_With --
------------------------
overriding function Is_Consistent_With
(Self : not null access constant UML_Interaction_Proxy;
Redefinee : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Consistent_With unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Is_Consistent_With";
return Is_Consistent_With (Self, Redefinee);
end Is_Consistent_With;
-----------------------------------
-- Is_Redefinition_Context_Valid --
-----------------------------------
overriding function Is_Redefinition_Context_Valid
(Self : not null access constant UML_Interaction_Proxy;
Redefined : AMF.UML.Redefinable_Elements.UML_Redefinable_Element_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Redefinition_Context_Valid unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Is_Redefinition_Context_Valid";
return Is_Redefinition_Context_Valid (Self, Redefined);
end Is_Redefinition_Context_Valid;
----------------
-- Owned_Port --
----------------
overriding function Owned_Port
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Ports.Collections.Set_Of_UML_Port is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Owned_Port unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Owned_Port";
return Owned_Port (Self);
end Owned_Port;
----------
-- Part --
----------
overriding function Part
(Self : not null access constant UML_Interaction_Proxy)
return AMF.UML.Properties.Collections.Set_Of_UML_Property is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Part unimplemented");
raise Program_Error with "Unimplemented procedure UML_Interaction_Proxy.Part";
return Part (Self);
end Part;
end AMF.Internals.UML_Interactions;
|
sungyeon/drake | Ada | 1,914 | ads | pragma License (Unrestricted);
-- Ada 2012
-- with Ada.Real_Time;
-- with Ada.Task_Identification;
package System.Multiprocessors.Dispatching_Domains is
Dispatching_Domain_Error : exception;
type Dispatching_Domain (<>) is limited private;
System_Dispatching_Domain : constant Dispatching_Domain;
-- function Create (First : CPU; Last : CPU_Range) return Dispatching_Domain;
-- function Get_First_CPU (Domain : Dispatching_Domain) return CPU;
-- function Get_Last_CPU (Domain : Dispatching_Domain) return CPU_Range;
-- Sets of CPUs in AI12-0033-1:
type CPU_Set is array (CPU range <>) of Boolean;
-- function Create (Set : CPU_Set) return Dispatching_Domain;
-- function Get_CPU_Set (Domain : Dispatching_Domain) return CPU_Set;
-- function Get_Dispatching_Domain (
-- T : Ada.Task_Identification.Task_Id :=
-- Ada.Task_Identification.Current_Task)
-- return Dispatching_Domain;
-- procedure Assign_Task (
-- Domain : in out Dispatching_Domain;
-- CPU : CPU_Range := Not_A_Specific_CPU;
-- T : Ada.Task_Identification.Task_Id :=
-- Ada.Task_Identification.Current_Task);
-- procedure Set_CPU (
-- CPU : CPU_Range;
-- T : Ada.Task_Identification.Task_Id :=
-- Ada.Task_Identification.Current_Task);
-- function Get_CPU (
-- T : Ada.Task_Identification.Task_Id :=
-- Ada.Task_Identification.Current_Task)
-- return CPU_Range;
-- procedure Delay_Until_And_Set_CPU (
-- Delay_Until_Time : Ada.Real_Time.Time;
-- CPU : CPU_Range);
private
type Dispatching_Domain is limited null record;
System_Dispatching_Domain : constant Dispatching_Domain := (null record);
-- called by gnatbind (s-mudido.adb)
procedure Freeze_Dispatching_Domains is null
with Export,
Convention => Ada,
External_Name => "__gnat_freeze_dispatching_domains";
end System.Multiprocessors.Dispatching_Domains;
|
Blady-Com/Gate3 | Ada | 1,438 | ads | with Glib.Xml_Int; use Glib.Xml_Int;
package Signal_Storage is
--
Bad_Identifier : exception;
-- raised when any signal name gives a bad Ada identifier
--
type Window_Record is record
Node : Node_Ptr;
Signumber : Natural := 0;
end record;
-- For each window, store the XML node and the number of signals in the
-- widget
Max_Object : constant := 50;
type Object_Index is range 0 .. Max_Object;
Object_Store : array (1 .. Object_Index'Last) of Window_Record;
-- storage for top windows that have signals or shows.
type Cb_Type is (Func, Proc);
-- Callback type is a function or procedure
-- function for event; procedure otherwise
type Signal_Rec is record
Signal : Node_Ptr;
Top_Window : Object_Index;
Callback : Cb_Type := Proc;
Has_Quit : Boolean := False;
end record;
-- description of infos required to process a signal
procedure Inc_Object_Number;
-- increment the number of top windows to show
function Get_Object_Number return Object_Index;
-- returns the number of top windows to show
procedure Initialize_Signals_Store;
procedure Store_Signal_Node (Signal : in Node_Ptr; Top_Object : in Object_Index);
function Get_Signal_Number return Natural;
-- returns the total number of signals in the project
function Retrieve_Signal_Node (Item : Natural) return Signal_Rec;
end Signal_Storage;
|
AdaCore/libadalang | Ada | 447 | adb | package body Test_Pkg is
package Foo is
procedure Bar;
end Foo;
function My_Body_Method (Self : A) return Integer;
function My_Method (Self : A) return Integer is
begin
return Self.My_Body_Method;
end My_Method;
function My_Body_Method (Self : A) return Integer is
pragma Unreferenced (Self);
begin
Foo.Bar;
return 15;
end My_Body_Method;
package body Foo is separate;
end Test_Pkg;
|
zhmu/ananas | Ada | 634 | adb | -- { dg-do compile }
package body No_Caching with SPARK_Mode is
Status : Boolean;
procedure Handle (V : Mult_Bit_Boolean) is
Ret_Val : Mult_Bit_Boolean := V with Volatile, No_Caching;
begin
if (Ret_Val = NV_TRUE) then
Do_Something;
elsif (Ret_Val = NV_FALSE) then
Do_Something_Else;
else
null;
-- Fault inject detected. Take punitive action
end if;
end Handle;
procedure Do_Something is
begin
Status := True;
end Do_Something;
procedure Do_Something_Else is
begin
Status := False;
end Do_Something_Else;
end No_Caching;
|
reznikmm/matreshka | Ada | 4,622 | 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_Svg.V_Ideographic_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Svg_V_Ideographic_Attribute_Node is
begin
return Self : Svg_V_Ideographic_Attribute_Node do
Matreshka.ODF_Svg.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Svg_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Svg_V_Ideographic_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.V_Ideographic_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Svg_URI,
Matreshka.ODF_String_Constants.V_Ideographic_Attribute,
Svg_V_Ideographic_Attribute_Node'Tag);
end Matreshka.ODF_Svg.V_Ideographic_Attributes;
|
sungyeon/drake | Ada | 103 | ads | pragma License (Unrestricted);
package Ada.Wide_Characters is
pragma Pure;
end Ada.Wide_Characters;
|
reznikmm/matreshka | Ada | 5,064 | 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.Generic_Collections;
package AMF.Utp.Finish_Actions.Collections is
pragma Preelaborate;
package Utp_Finish_Action_Collections is
new AMF.Generic_Collections
(Utp_Finish_Action,
Utp_Finish_Action_Access);
type Set_Of_Utp_Finish_Action is
new Utp_Finish_Action_Collections.Set with null record;
Empty_Set_Of_Utp_Finish_Action : constant Set_Of_Utp_Finish_Action;
type Ordered_Set_Of_Utp_Finish_Action is
new Utp_Finish_Action_Collections.Ordered_Set with null record;
Empty_Ordered_Set_Of_Utp_Finish_Action : constant Ordered_Set_Of_Utp_Finish_Action;
type Bag_Of_Utp_Finish_Action is
new Utp_Finish_Action_Collections.Bag with null record;
Empty_Bag_Of_Utp_Finish_Action : constant Bag_Of_Utp_Finish_Action;
type Sequence_Of_Utp_Finish_Action is
new Utp_Finish_Action_Collections.Sequence with null record;
Empty_Sequence_Of_Utp_Finish_Action : constant Sequence_Of_Utp_Finish_Action;
private
Empty_Set_Of_Utp_Finish_Action : constant Set_Of_Utp_Finish_Action
:= (Utp_Finish_Action_Collections.Set with null record);
Empty_Ordered_Set_Of_Utp_Finish_Action : constant Ordered_Set_Of_Utp_Finish_Action
:= (Utp_Finish_Action_Collections.Ordered_Set with null record);
Empty_Bag_Of_Utp_Finish_Action : constant Bag_Of_Utp_Finish_Action
:= (Utp_Finish_Action_Collections.Bag with null record);
Empty_Sequence_Of_Utp_Finish_Action : constant Sequence_Of_Utp_Finish_Action
:= (Utp_Finish_Action_Collections.Sequence with null record);
end AMF.Utp.Finish_Actions.Collections;
|
zhmu/ananas | Ada | 2,881 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S O C K E T S . L I N K E R _ O P T I O N S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2022, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package is used to provide target specific linker_options for the
-- support of sockets as required by the package GNAT.Sockets.
-- This is an empty version for default use where no additional libraries
-- are required. On some targets a target specific version of this unit
-- ensures linking with required libraries for proper sockets operation.
-- This package should not be directly with'ed by an application program
package GNAT.Sockets.Linker_Options is
end GNAT.Sockets.Linker_Options;
|
AdaCore/libadalang | Ada | 102 | adb |
procedure Main is
begin
null;
end Main;
with Test;
procedure Main2 is
begin
Test;
end Main2;
|
AdaCore/libadalang | Ada | 75 | ads | package Foo is
type T_Record is abstract tagged null record;
end Foo;
|
FROL256/ada-ray-tracer | Ada | 7,296 | adb | with Interfaces;
with Ada.Numerics.Float_Random;
with Ada.Numerics.Generic_Elementary_Functions;
with Vector_Math;
use Interfaces;
use Vector_Math;
package body Lights is
package Float_Functions is new Ada.Numerics.Generic_Elementary_Functions(float);
use Float_Functions;
function GetIntensity(l : LightRef) return float3 is
begin
return GetIntensity(l.all);
end GetIntensity;
function Sample(l : LightRef; gen : RandRef; lluminatingPoint : float3) return ShadowSample is
begin
return Sample(l.all, gen, lluminatingPoint);
end Sample;
function EvalPDF(l : LightRef; lluminatingPoint : float3; rayDir : float3; hitDist : float) return float is
begin
return EvalPDF(l.all, lluminatingPoint, rayDir, hitDist);
end EvalPDF;
function GetShapeType(l : LightRef) return LightShapes is
begin
return GetShapeType(l.all);
end GetShapeType;
-- explicit light sampling utils
--
epsilonDiv : constant float := 1.0e-20; -- small value for bsdf/pdf divisions
function PdfAtoW(aPdfA : in float; aDist : in float; aCosThere : in float) return float is
begin
return aPdfA*aDist*aDist/max(aCosThere, epsilonDiv);
end PdfAtoW;
---- Area Light
----
function AreaPDF(l : AreaLight) return float is
begin
return 1.0/l.surfaceArea;
end AreaPDF;
function Sample(l : AreaLight; gen : RandRef; lluminatingPoint : float3) return ShadowSample is
r1 : float := gen.rnd_uniform(0.0, 1.0);
r2 : float := gen.rnd_uniform(0.0, 1.0);
cosTheta : float; -- := max(dot(sdir, (-1.0)*lsam.norm), 0.0);
rayDir : float3;
d : float;
res : ShadowSample;
begin
res.pos.x := l.boxMin.x + r1*(l.boxMax.x - l.boxMin.x);
res.pos.y := l.boxMin.y;
res.pos.z := l.boxMin.z + r2*(l.boxMax.z - l.boxMin.z);
res.dir := l.normal;
rayDir := res.pos - lluminatingPoint;
d := length(rayDir);
rayDir := rayDir*(1.0/d);
cosTheta := max(dot(rayDir, (-1.0)*l.normal), 0.0);
res.pdf := PdfAtoW(AreaPDF(l), d, cosTheta);
res.intensity := l.intensity;
return res;
end Sample;
function EvalPDF(l : AreaLight; lluminatingPoint : float3; rayDir : float3; hitDist : float) return float is
cosTheta : float := max(dot(rayDir, (-1.0)*l.normal), 0.0);
begin
return PdfAtoW(AreaPDF(l), hitDist, cosTheta);
end EvalPDF;
function GetIntensity(l : AreaLight) return float3 is
begin
return l.intensity;
end GetIntensity;
function GetShapeType(l : AreaLight) return LightShapes is
begin
return Light_Shape_Rect;
end GetShapeType;
---- Sphere Light
----
function AreaPDF(l : SphereLight) return float is
begin
return 1.0/l.surfaceArea;
end AreaPDF;
procedure CoordinateSystem(v1 : in float3; v2 : out float3; v3 : out float3) is
invLen : float;
begin
if abs(v1.x) > abs(v1.y) then
invLen := 1.0 / sqrt(v1.x*v1.x + v1.z*v1.z);
v2 := (-v1.z * invLen, 0.0, v1.x * invLen);
else
invLen := 1.0 / sqrt(v1.y*v1.y + v1.z*v1.z);
v2 := (0.0, v1.z * invLen, -v1.y * invLen);
end if;
v3 := cross(v1, v2);
end CoordinateSystem;
function DistanceSquared(a : float3; b : float3) return float is
diff : float3 := (b - a);
begin
return dot(diff, diff);
exception -- floating point overflow may happen due to diff.x*diff.x may be too large
when Constraint_Error =>
return float'Last;
end DistanceSquared;
function UniformSampleSphere(u1 : float; u2 : float) return float3 is
x,y,z,r,phi : float;
begin
z := 1.0 - 2.0 * u1;
r := sqrt(max(0.0, 1.0 - z*z));
phi := 2.0 * M_PI * u2;
x := r * cos(phi);
y := r * sin(phi);
return (x,y,z);
end UniformSampleSphere;
function UniformSampleCone(u1 : float; u2 : float; costhetamax : float; x : float3; y : float3; z : float3) return float3 is
phi,costheta,sintheta : float;
begin
costheta := lerp(u1, costhetamax, 1.0);
sintheta := sqrt(1.0 - costheta*costheta);
phi := u2 * 2.0 * M_PI;
return cos(phi) * sintheta * x + sin(phi) * sintheta * y + costheta * z;
end UniformSampleCone;
function UniformConePdf(cosThetaMax : float) return float is
begin
return 1.0 / (2.0 * M_PI * (1.0 - cosThetaMax));
exception
when Constraint_Error =>
return 0.0; -- #NOTE: may be need return 1 ??
end UniformConePdf;
function RaySphereIntersect(rayPos : float3; rayDir : float3; sphPos : float3; radius : float) return float2 is
t1, t2 : float;
k : float3;
b, c, d, sqrtd : float;
res : float2;
begin
k := rayPos - sphPos;
b := dot(k,rayDir);
c := dot(k,k) - radius*radius;
d := b * b - c;
if d >= 0.0 then
sqrtd := sqrt(d);
t1 := -b - sqrtd;
t2 := -b + sqrtd;
res.x := min(t1,t2);
res.y := max(t1,t2);
else
res.x := -infinity;
res.y := -infinity;
end if;
return res;
exception
when Constraint_Error =>
return (-infinity,-infinity);
end RaySphereIntersect;
function Sample(l : SphereLight; gen : RandRef; lluminatingPoint : float3) return ShadowSample is
u1 : float := gen.rnd_uniform(0.0, 1.0);
u2 : float := gen.rnd_uniform(0.0, 1.0);
wc, wcX, wcY : float3;
sinThetaMax2,cosThetaMax,thit : float;
rpos, rdir : float3;
hitMinMax : float2;
res : ShadowSample;
begin
res.intensity := l.intensity;
if DistanceSquared(lluminatingPoint, l.center) - l.radius*l.radius < 1.0e-4 then
res.pos := l.center + l.radius*UniformSampleSphere(u1, u2);
res.dir := normalize(res.pos - l.center);
return res;
end if;
wc := normalize(l.center - lluminatingPoint);
CoordinateSystem(wc, v2 => wcX, v3 => wcY);
sinThetaMax2 := l.radius*l.radius / DistanceSquared(lluminatingPoint, l.center);
cosThetaMax := sqrt(max(0.0, 1.0 - sinThetaMax2));
rdir := UniformSampleCone(u1, u2, cosThetaMax, wcX, wcY, wc);
rpos := lluminatingPoint + rdir*(1.0e-3);
-- calc ray sphere intersection and store hit distance in thit
--
hitMinMax := RaySphereIntersect(rpos, rdir, l.center, l.radius);
if hitMinMax.x < 0.0 then -- !Intersect(r, &thit, &rayEpsilon, &dgSphere)
thit := dot(l.center - lluminatingPoint, normalize(rdir));
else
thit := hitMinMax.x;
end if;
res.pos := rpos + thit*rdir;
res.dir := normalize(res.pos - l.center);
res.pdf := EvalPDF(l, lluminatingPoint, rdir, thit);
return res;
end Sample;
function EvalPDF(l : SphereLight; lluminatingPoint : float3; rayDir : float3; hitDist : float) return float is
sinThetaMax2, cosThetaMax : float;
begin
if DistanceSquared(lluminatingPoint, l.center) - l.radius*l.radius < 1.0e-4 then
return 1.0/l.surfaceArea;
end if;
sinThetaMax2 := l.radius*l.radius / DistanceSquared(lluminatingPoint, l.center);
cosThetaMax := sqrt(max(0.0, 1.0 - sinThetaMax2));
return UniformConePdf(cosThetaMax);
end EvalPDF;
function GetIntensity(l : SphereLight) return float3 is
begin
return l.intensity;
end GetIntensity;
function GetShapeType(l : SphereLight) return LightShapes is
begin
return Light_Shape_Sphere;
end GetShapeType;
end Lights;
|
reznikmm/matreshka | Ada | 3,961 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2015, 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$
------------------------------------------------------------------------------
-- Checks that port component is parsed and converted to string correctly.
------------------------------------------------------------------------------
with League.IRIs;
with League.Strings;
procedure Test_379 is
use type League.Strings.Universal_String;
Image : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("http://forge.ada-ru.org:8080");
URL : League.IRIs.IRI;
begin
URL.Set_IRI (Image);
if URL.Get_Port /= 8080 then
raise Program_Error;
end if;
if URL.To_Universal_String /= Image then
raise Program_Error;
end if;
end Test_379;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.