repo_name
stringlengths 9
74
| language
stringclasses 1
value | length_bytes
int64 11
9.34M
| extension
stringclasses 2
values | content
stringlengths 11
9.34M
|
---|---|---|---|---|
stcarrez/dynamo | Ada | 41,861 | adb | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . S P A N _ E N D --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2012, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Asis.Declarations; use Asis.Declarations;
with Asis.Definitions; use Asis.Definitions;
with Asis.Elements; use Asis.Elements;
with Asis.Expressions; use Asis.Expressions;
with Asis.Extensions; use Asis.Extensions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Sinput; use A4G.A_Sinput;
with A4G.Span_Beginning;
with A4G.A_Types; use A4G.A_Types;
with A4G.Int_Knds; use A4G.Int_Knds;
with A4G.Skip_TB; use A4G.Skip_TB;
with Atree; use Atree;
with Nlists; use Nlists;
with Output; use Output;
with Sinfo; use Sinfo;
package body A4G.Span_End is
-- !!!??? This file is '-gnatg-compilable', but both its content and its
-- !!!??? documentation need revising
------------------------
-- Main Look-Up Table --
------------------------
-- Set_Image_End function is implemented as look-up table indexed by
-- Internal_Element_Kinds and switching onto the specific functions
-- which find the end of an Element of a given kind. This look-up table
-- is implemented as one-dimension array of references to specific search
-- functions. To save SLOCs, we define these specific functions without
-- giving their separate specifications before (the only exception is
-- made for Nonterminal_Component implementing the recursive search in
-- case of composite element), and we initialize the array
-- implementing the look-up table in its declaration
-------------------------------
-- Specific Search Functions --
-------------------------------
function Nonterminal_Component (E : Asis.Element) return Source_Ptr;
-- This function is used when Element to process has components.
-- It goes down to the right-most *terminal* component, and it unwinds
-- all the "syntax sugar" (such as '... end;' ')' etc) from all the
-- right-most component being traversed. In the very end it returns
-- the pointer in the Source Buffer set on the very last component of
-- the Element it was originally called. This function may cal
-- Set_Image_End which in turn call it again, and this makes the
-- recursive processing of an Element if its right-most component
-- itself has components.
function Word_Or_Character_End (E : Asis.Element) return Source_Ptr;
-- In some specific cases finding an end of identifier require special
-- processing. It happens with identifiers representing attribute
-- designators or labels. This function is used to find the end of
-- such an identifier
function Plus4 (E : Asis.Element) return Source_Ptr;
function Plus3 (E : Asis.Element) return Source_Ptr;
function Plus2 (E : Asis.Element) return Source_Ptr;
-- Jumping N position to the right
function No_Search (E : Asis.Element) return Source_Ptr;
-- Skips the syntax sugar after the end of its argument
function Access_To_Procedure_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of access_to_procedure
function Access_To_Protected_Procedure_End
(E : Asis.Element)
return Source_Ptr;
-- Looks for the end of a protected procedure
function Second_Word_After_Last_Component_End
(E : Asis.Element)
return Source_Ptr;
-- Used to skip syntax sugar like "end record"
function Second_Word_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of a second word after E
function Formal_Numeric_Type_Definition_End
(E : Asis.Element)
return Source_Ptr;
-- Looks for the end of a formal numeric type declaration other than a
-- formal decimal fixed point type definition
function Formal_Decimal_Fixed_Point_Definition_End
(E : Asis.Element)
return Source_Ptr;
-- Looks for the end of a formal decimal fixed point type definition
function Numeric_Literal_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of a numeric literal
function Character_Literal_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of a (defining) character literal, We can not just use
-- Plus2 for a character literal because of encodings
function Private_Type_Definition_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of a private type definition
function String_Literal_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of a string literal
function Operator_Symbol_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end of an operator symbol
function Unknown_Discriminant_Part_End
(E : Asis.Element)
return Source_Ptr;
-- Looks for the end of an unknown discriminant part
function A_Bug (E : Asis.Element) return Source_Ptr;
-- Placeholder for "others" choice, should never be called. Raises
-- Internal_Implementation_Error
-- --|A2005 start
-- Search functions added for new Ada 2005 features
function Interface_Definition_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end for an interface definition
function Component_Association_End (E : Asis.Element) return Source_Ptr;
-- Looks for the end for an component association, the problem here is that
-- the association can contain a box
function Formal_Discrete_Type_Definition_End
(E : Asis.Element)
return Source_Ptr;
-- Computes the end of the (<>) construct, taking into account possible
-- spaces between <> and brackets
function Function_Call_End (E : Asis.Element) return Source_Ptr;
-- Computes the end of the function call, making the difference between
-- traditional and prefixed notation of the function name
-- --|A2005 end
-- --|A2005 start
---------------------------
-- Character_Literal_End --
---------------------------
function Character_Literal_End (E : Asis.Element) return Source_Ptr is
Result : Source_Ptr := Get_Location (E) + 2;
-- '+ 2' is needed to process correctly ''' !
begin
while Get_Character (Result) /= ''' loop
Result := Result + 1;
end loop;
return Result;
end Character_Literal_End;
-------------------------------
-- Component_Association_End --
-------------------------------
function Component_Association_End (E : Asis.Element) return Source_Ptr is
S : Source_Ptr := Get_Location (E);
begin
if not Is_Nil (Component_Expression (E)) then
return Nonterminal_Component (E);
else
-- Here we have a component association of the form
-- something => <>
-- S points to "=>"
S := S + 2;
S := Search_Next_Word (S);
S := S + 1;
return S;
end if;
end Component_Association_End;
-----------------------------------------
-- Formal_Discrete_Type_Definition_End --
-----------------------------------------
function Formal_Discrete_Type_Definition_End
(E : Asis.Element)
return Source_Ptr
is
S : constant Source_Ptr := Get_Location (E);
begin
return Search_Rightmost_Symbol (S, ')');
end Formal_Discrete_Type_Definition_End;
-----------------------
-- Function_Call_End --
-----------------------
function Function_Call_End (E : Asis.Element) return Source_Ptr is
S : Source_Ptr := Get_Location (E);
begin
if Is_Prefix_Notation (E) then
if Function_Call_Parameters (E)'Length > 1 then
S := Nonterminal_Component (E);
else
S := Set_Image_End (Prefix (E));
-- S := Skip_Trailing_Brackets (E, S);
end if;
else
S := Nonterminal_Component (E);
end if;
return S;
end Function_Call_End;
-- --|A2005 end
---------------------------
-- Word_Or_Character_End --
---------------------------
function Word_Or_Character_End (E : Asis.Element) return Source_Ptr is
S : Source_Ptr := Get_Location (E);
begin
if Nkind (Node (E)) = N_Attribute_Definition_Clause then
-- this is a case of the attribute designator in a
-- pseudo-attribute-reference from an attribute definition clause
-- Note, that we can have more than one attribute here (see FA30-016)
-- e.g.
-- for Root'Class'Output use Class_Output;
S := A4G.Span_Beginning.Search_Identifier_Beginning (E);
end if;
if Special_Case (E) = Dummy_Class_Attribute_Designator then
S := Search_Rightmost_Symbol (S, ''');
S := Next_Identifier (S);
end if;
if Get_Character (S) = ''' then
-- Two cases are possible: character literal or An_Identifier Element
-- representing an attribute designator and based on
-- N_Attribute_Reference node
if Nkind (Node (E)) = N_Defining_Character_Literal
or else
Nkind (Node (E)) = N_Character_Literal
then
S := S + 2;
while Get_Character (S) /= ''' loop
-- Wide_ or Wide_Wide_Character literal
S := S + 1;
end loop;
return S;
end if;
elsif Get_Character (S) = '<' and then Get_Character (S + 1) = '<' then
S := S + 1;
-- this is a label, and now S points to the second character in "<<"
end if;
-- here we should find the end of an identifier
-- but in case of a label or an attribute designator S points
-- to ''' or to the second '<' in "<<", and we have to take into
-- account such crazy cases as spaces or/end comments between
-- ''' or "<<" and the identifier itself
if Get_Character (S) = '<' or else Get_Character (S) = ''' then
S := Next_Identifier (S);
end if;
-- and now it's safe to do this:
return Search_End_Of_Word (S);
end Word_Or_Character_End;
-----------
-- PlusN --
-----------
-- Only jumping N position to the right:
function Plus4 (E : Asis.Element) return Source_Ptr is
begin
return Get_Location (E) + 4;
end Plus4;
function Plus3 (E : Asis.Element) return Source_Ptr is
begin
return Get_Location (E) + 3;
end Plus3;
function Plus2 (E : Asis.Element) return Source_Ptr is
begin
return Get_Location (E) + 2;
end Plus2;
---------------
-- No_Search --
---------------
function No_Search (E : Asis.Element) return Source_Ptr is
S : constant Source_Ptr := Get_Location (E);
begin
return Skip_Trailing_Brackets (E, S);
end No_Search;
-----------------------------
-- Access_To_Procedure_End --
-----------------------------
function Access_To_Procedure_End (E : Asis.Element) return Source_Ptr is
-- We have to consider an access to procedure as a special case, because
-- if there is no formal parameter, we have to skip two words
-- (access procedure) and no syntax sugar
Last_Comp : Asis.Element;
S : Source_Ptr;
begin
Last_Comp := Get_Last_Component (E);
if Is_Nil (Last_Comp) then
S := Get_Location (E);
S := Search_End_Of_Word (S);
S := Search_Next_Word (S);
S := Search_End_Of_Word (S);
else
S := Set_Image_End (Last_Comp);
S := Skip_Trailing_Brackets (E, S);
end if;
return S;
end Access_To_Procedure_End;
---------------------------------------
-- Access_To_Protected_Procedure_End --
---------------------------------------
function Access_To_Protected_Procedure_End
(E : Asis.Element)
return Source_Ptr
is
-- Similar to Access_To_Procedure_End, but here we have to skip three
-- words ('access protected procedure') in case if no parameters
Last_Comp : Asis.Element;
S : Source_Ptr;
begin
Last_Comp := Get_Last_Component (E);
if Is_Nil (Last_Comp) then
S := Get_Location (E);
S := Search_End_Of_Word (S);
S := Search_Next_Word (S);
S := Search_End_Of_Word (S);
S := Search_Next_Word (S);
S := Search_End_Of_Word (S);
else
S := Set_Image_End (Last_Comp);
S := Skip_Trailing_Brackets (E, S);
end if;
return S;
end Access_To_Protected_Procedure_End;
------------------------------------------
-- Second_Word_After_Last_Component_End --
------------------------------------------
function Second_Word_After_Last_Component_End
(E : Asis.Element)
return Source_Ptr
is
-- We need this special case to skip "end record"
Last_Comp : Asis.Element;
S : Source_Ptr;
begin
Last_Comp := Get_Last_Component (E);
S := Set_Image_End (Last_Comp);
S := Search_Next_Word (S);
S := Search_End_Of_Word (S);
S := Search_Next_Word (S);
S := Search_End_Of_Word (S);
return S;
end Second_Word_After_Last_Component_End;
---------------------
-- Second_Word_End --
---------------------
function Second_Word_End (E : Asis.Element) return Source_Ptr is
S : Source_Ptr := Get_Location (E);
begin
S := Search_End_Of_Word (S);
S := Search_Next_Word (S);
S := Search_End_Of_Word (S);
return S;
end Second_Word_End;
----------------------------------------
-- Formal_Numeric_Type_Definition_End --
----------------------------------------
function Formal_Numeric_Type_Definition_End
(E : Asis.Element)
return Source_Ptr
is
S : constant Source_Ptr := Get_Location (E);
begin
return Search_Rightmost_Symbol (S, '>');
end Formal_Numeric_Type_Definition_End;
-----------------------------------------------
-- Formal_Decimal_Fixed_Point_Definition_End --
-----------------------------------------------
function Formal_Decimal_Fixed_Point_Definition_End
(E : Asis.Element)
return Source_Ptr
is
S : Source_Ptr := Get_Location (E);
begin
-- delta <>
S := Search_Rightmost_Symbol (S, '>');
-- digits <>
S := S + 1;
S := Search_Rightmost_Symbol (S, '>');
return Search_Rightmost_Symbol (S, '>');
end Formal_Decimal_Fixed_Point_Definition_End;
-- --|A2005 start
------------------------------
-- Interface_Definition_End --
------------------------------
function Interface_Definition_End (E : Asis.Element) return Source_Ptr is
S : Source_Ptr;
Last_Int : Asis.Element := Get_Last_Component (E);
begin
if Is_Nil (Last_Int) then
S := Get_Location (E);
S := Search_Prev_Word (S);
else
if Int_Kind (Last_Int) = A_Selected_Component then
Last_Int := Get_Last_Component (Last_Int);
end if;
S := Get_Location (Last_Int);
S := Search_End_Of_Word (S);
end if;
return S;
end Interface_Definition_End;
-- --|A2005 end
-------------------------
-- Numeric_Literal_End --
-------------------------
function Numeric_Literal_End (E : Asis.Element) return Source_Ptr is
begin
return Get_Num_Literal_End (Get_Location (E));
end Numeric_Literal_End;
---------------------------------
-- Private_Type_Definition_End --
---------------------------------
function Private_Type_Definition_End (E : Asis.Element) return Source_Ptr is
N : constant Node_Id := Node (E);
S : Source_Ptr := Get_Location (E);
begin
-- if the enclosing type declaration contains a discriminant part, we
-- should skip it first
if Nkind (N) = N_Private_Type_Declaration and then
Present (Discriminant_Specifications (N))
then
declare
Discr_Part : constant Asis.Element_List :=
Discriminants (Discriminant_Part (Enclosing_Element (E)));
Tmp : Asis.Element := Discr_Part (Discr_Part'Last);
begin
Tmp := Get_Last_Component (Tmp);
S := A4G.Span_End.Set_Image_End (Tmp);
end;
S := Search_Rightmost_Symbol (S, ')');
end if;
S := Search_Rightmost_Symbol (S, ';');
S := Search_Prev_Word (S);
return S;
end Private_Type_Definition_End;
------------------------
-- String_Literal_End --
------------------------
function String_Literal_End (E : Asis.Element) return Source_Ptr is
begin
return Get_String_End (Get_Location (E));
end String_Literal_End;
-------------------------
-- Operator_Symbol_End --
-------------------------
function Operator_Symbol_End (E : Asis.Element) return Source_Ptr is
-- the problem is that an operator symbol may (in a prefix call) or
-- may not (in an infix call) contain string quoters
function Operator_Len
(Op_Kind : Internal_Operator_Symbol_Kinds)
return Source_Ptr;
-- just returns the length of the string representing a given
-- operator symbol
function Operator_Len
(Op_Kind : Internal_Operator_Symbol_Kinds)
return Source_Ptr
is
begin
case Op_Kind is
when An_And_Operator |
An_Xor_Operator |
A_Mod_Operator |
A_Rem_Operator |
An_Abs_Operator |
A_Not_Operator =>
return 3;
when An_Or_Operator |
A_Not_Equal_Operator |
A_Less_Than_Or_Equal_Operator |
A_Greater_Than_Or_Equal_Operator |
An_Exponentiate_Operator =>
return 2;
when An_Equal_Operator |
A_Less_Than_Operator |
A_Greater_Than_Operator |
A_Plus_Operator |
A_Minus_Operator |
A_Concatenate_Operator |
A_Unary_Plus_Operator |
A_Unary_Minus_Operator |
A_Multiply_Operator |
A_Divide_Operator =>
return 1;
end case;
end Operator_Len;
S : Source_Ptr := Get_Location (E);
Op_Kind : constant Internal_Element_Kinds := Int_Kind (E);
begin
if Get_Character (S) = '"' or else
Get_Character (S) = '%'
then
S := S + 2;
end if;
return (S + Operator_Len (Op_Kind) - 1);
end Operator_Symbol_End;
-----------
-- A_Bug --
-----------
function A_Bug (E : Asis.Element) return Source_Ptr is
-- This function should never be called. We need it for "others"
-- choice in the aggregate initializing the look-up table for those
-- values of Internal_Element_Kinds which should never be processed
-- (they correspond to implicit root and universal types). This
-- function raises Internal_Implementation_Error;
begin
pragma Unreferenced (E);
raise Internal_Implementation_Error;
return No_Location;
end A_Bug;
-----------------------------------
-- Unknown_Discriminant_Part_End --
-----------------------------------
function Unknown_Discriminant_Part_End
(E : Asis.Element)
return Source_Ptr
is
S : constant Source_Ptr := Get_Location (E);
begin
return Search_Rightmost_Symbol (S, ')');
end Unknown_Discriminant_Part_End;
------------------
-- Search Array --
------------------
type Set_Source_Location_Type is access
function (E : Asis.Element) return Source_Ptr;
Search_Switch : constant array (Internal_Element_Kinds)
of Set_Source_Location_Type :=
(An_All_Calls_Remote_Pragma ..
-- An_Asynchronous_Pragma
-- An_Atomic_Pragma
-- An_Atomic_Components_Pragma
-- An_Attach_Handler_Pragma
-- A_Controlled_Pragma
-- A_Convention_Pragma
-- An_Elaborate_All_Pragma
-- An_Elaborate_Body_Pragma
-- An_Export_Pragma
-- An_Import_Pragma
-- An_Inline_Pragma
-- An_Inspection_Point_Pragma
-- An_Interrupt_Handler_Pragma
-- An_Interrupt_Priority_Pragma
-- A_List_Pragma
-- A_Locking_Policy_Pragma
-- A_Normalize_Scalars_Pragma
-- An_Optimize_Pragma
-- A_Pack_Pragma
-- A_Page_Pragma
-- A_Preelaborate_Pragma
-- A_Priority_Pragma
-- A_Pure_Pragma
-- A_Queuing_Policy_Pragma
-- A_Remote_Call_Interface_Pragma
-- A_Remote_Types_Pragma
-- A_Restrictions_Pragma
-- A_Reviewable_Pragma
-- A_Shared_Passive_Pragma
-- A_Suppress_Pragma
-- A_Task_Dispatching_Policy_Pragma
-- A_Volatile_Pragma
-- A_Volatile_Components_Pragma
-- An_Implementation_Defined_Pragma
An_Unknown_Pragma => Nonterminal_Component'Access,
A_Defining_Identifier => Word_Or_Character_End'Access,
A_Defining_Character_Literal => Character_Literal_End'Access,
A_Defining_Enumeration_Literal => Word_Or_Character_End'Access,
A_Defining_And_Operator => Plus4'Access,
A_Defining_Or_Operator => Plus3'Access,
A_Defining_Xor_Operator => Plus4'Access,
A_Defining_Equal_Operator => Plus2'Access,
A_Defining_Not_Equal_Operator => Plus3'Access,
A_Defining_Less_Than_Operator => Plus2'Access,
A_Defining_Less_Than_Or_Equal_Operator => Plus3'Access,
A_Defining_Greater_Than_Operator => Plus2'Access,
A_Defining_Greater_Than_Or_Equal_Operator => Plus3'Access,
A_Defining_Plus_Operator => Plus2'Access,
A_Defining_Minus_Operator => Plus2'Access,
A_Defining_Concatenate_Operator => Plus2'Access,
A_Defining_Unary_Plus_Operator => Plus2'Access,
A_Defining_Unary_Minus_Operator => Plus2'Access,
A_Defining_Multiply_Operator => Plus2'Access,
A_Defining_Divide_Operator => Plus2'Access,
A_Defining_Mod_Operator => Plus4'Access,
A_Defining_Rem_Operator => Plus4'Access,
A_Defining_Exponentiate_Operator => Plus3'Access,
A_Defining_Abs_Operator => Plus4'Access,
A_Defining_Not_Operator => Plus4'Access,
A_Defining_Expanded_Name ..
-- An_Ordinary_Type_Declaration
-- A_Task_Type_Declaration
-- A_Protected_Type_Declaration
-- An_Incomplete_Type_Declaration
-- A_Private_Type_Declaration
-- A_Private_Extension_Declaration
-- A_Subtype_Declaration
-- A_Variable_Declaration
-- A_Constant_Declaration
-- A_Deferred_Constant_Declaration
-- A_Single_Task_Declaration
-- A_Single_Protected_Declaration
-- An_Integer_Number_Declaration
A_Real_Number_Declaration => Nonterminal_Component'Access,
An_Enumeration_Literal_Specification => Word_Or_Character_End'Access,
A_Discriminant_Specification ..
-- A_Component_Declaration
-- A_Loop_Parameter_Specification
-- A_Generalized_Iterator_Specification
-- An_Element_Iterator_Specification
-- A_Procedure_Declaration
-- A_Function_Declaration
-- A_Parameter_Specification
-- A_Procedure_Body_Declaration
-- A_Function_Body_Declaration
-- A_Package_Declaration
-- A_Package_Body_Declaration
-- An_Object_Renaming_Declaration
-- An_Exception_Renaming_Declaration
-- A_Package_Renaming_Declaration
-- A_Procedure_Renaming_Declaration
-- A_Function_Renaming_Declaration
-- A_Generic_Package_Renaming_Declaration
-- A_Generic_Procedure_Renaming_Declaration
-- A_Generic_Function_Renaming_Declaration
-- A_Task_Body_Declaration
-- A_Protected_Body_Declaration
-- An_Entry_Declaration
-- An_Entry_Body_Declaration
-- An_Entry_Index_Specification
-- A_Procedure_Body_Stub
A_Function_Body_Stub => Nonterminal_Component'Access,
A_Package_Body_Stub ..
-- A_Task_Body_Stub
-- A_Protected_Body_Stub
An_Exception_Declaration => No_Search'Access,
A_Choice_Parameter_Specification => Word_Or_Character_End'Access,
A_Generic_Procedure_Declaration ..
-- A_Generic_Function_Declaration
-- A_Generic_Package_Declaration
-- A_Package_Instantiation
-- A_Procedure_Instantiation
-- A_Function_Instantiation
-- A_Formal_Object_Declaration
-- A_Formal_Type_Declaration
-- A_Formal_Procedure_Declaration
-- A_Formal_Function_Declaration
-- A_Formal_Package_Declaration
-- A_Formal_Package_Declaration_With_Box
-- A_Derived_Type_Definition
-- A_Derived_Record_Extension_Definition
-- An_Enumeration_Type_Definition
-- A_Signed_Integer_Type_Definition
-- A_Modular_Type_Definition
---------------------------------------------------------
-- !!! They all are implicit and cannot have image
-- |
-- |-> A_Root_Integer_Definition
-- |-> A_Root_Real_Definition
-- |-> A_Root_Fixed_Definition
-- |-> A_Universal_Integer_Definition
-- |-> A_Universal_Real_Definition
-- +-> A_Universal_Fixed_Definition
---------------------------------------------------------
-- A_Floating_Point_Definition
-- An_Ordinary_Fixed_Point_Definition
-- A_Decimal_Fixed_Point_Definition
-- An_Unconstrained_Array_Definition
-- A_Constrained_Array_Definition
-- A_Record_Type_Definition
A_Tagged_Record_Type_Definition => Nonterminal_Component'Access,
-- --|A2005 start
An_Ordinary_Interface ..
-- A_Limited_Interface,
-- A_Task_Interface,
-- A_Protected_Interface,
A_Synchronized_Interface => Interface_Definition_End'Access,
-- --|A2005 end
A_Pool_Specific_Access_To_Variable ..
-- An_Access_To_Variable
An_Access_To_Constant => Nonterminal_Component'Access,
An_Access_To_Procedure => Access_To_Procedure_End'Access,
An_Access_To_Protected_Procedure =>
Access_To_Protected_Procedure_End'Access,
An_Access_To_Function ..
-- An_Access_To_Protected_Function
-- A_Subtype_Indication
-- A_Range_Attribute_Reference
-- A_Simple_Expression_Range
-- A_Digits_Constraint
-- A_Delta_Constraint
-- An_Index_Constraint
-- A_Discriminant_Constraint
-- A_Component_Definition
-- A_Discrete_Subtype_Indication_As_Subtype_Definition
-- A_Discrete_Range_Attribute_Reference_As_Subtype_Definition
-- A_Discrete_Simple_Expression_Range_As_Subtype_Definition
-- A_Discrete_Subtype_Indication
-- A_Discrete_Range_Attribute_Reference
A_Discrete_Simple_Expression_Range => Nonterminal_Component'Access,
An_Unknown_Discriminant_Part => Unknown_Discriminant_Part_End'Access,
A_Known_Discriminant_Part => Nonterminal_Component'Access,
A_Record_Definition =>
Second_Word_After_Last_Component_End'Access,
A_Null_Record_Definition => Second_Word_End'Access,
A_Null_Component => No_Search'Access,
A_Variant_Part => Nonterminal_Component'Access,
A_Variant => Nonterminal_Component'Access,
An_Others_Choice => Word_Or_Character_End'Access,
-- --|A2005 start
An_Anonymous_Access_To_Variable ..
An_Anonymous_Access_To_Constant => Nonterminal_Component'Access,
An_Anonymous_Access_To_Procedure ..
An_Anonymous_Access_To_Protected_Procedure =>
Access_To_Procedure_End'Access,
An_Anonymous_Access_To_Function ..
An_Anonymous_Access_To_Protected_Function =>
Nonterminal_Component'Access,
-- --|A2005 end
A_Private_Type_Definition =>
Private_Type_Definition_End'Access,
A_Tagged_Private_Type_Definition =>
Private_Type_Definition_End'Access,
A_Private_Extension_Definition =>
Second_Word_After_Last_Component_End'Access,
A_Task_Definition => Nonterminal_Component'Access,
A_Protected_Definition => Nonterminal_Component'Access,
A_Formal_Private_Type_Definition => Word_Or_Character_End'Access,
A_Formal_Tagged_Private_Type_Definition => Word_Or_Character_End'Access,
A_Formal_Derived_Type_Definition => Nonterminal_Component'Access,
A_Formal_Discrete_Type_Definition =>
Formal_Discrete_Type_Definition_End'Access,
A_Formal_Signed_Integer_Type_Definition ..
-- A_Formal_Modular_Type_Definition
-- A_Formal_Floating_Point_Definition
A_Formal_Ordinary_Fixed_Point_Definition =>
Formal_Numeric_Type_Definition_End'Access,
A_Formal_Decimal_Fixed_Point_Definition =>
Formal_Decimal_Fixed_Point_Definition_End'Access,
-- --|A2005 start
A_Formal_Ordinary_Interface ..
-- A_Formal_Limited_Interface
-- A_Formal_Task_Interface
-- A_Formal_Protected_Interface
A_Formal_Synchronized_Interface => Interface_Definition_End'Access,
-- --|A2005 end
A_Formal_Unconstrained_Array_Definition ..
-- A_Formal_Constrained_Array_Definition
-- A_Formal_Pool_Specific_Access_To_Variable
-- A_Formal_Access_To_Variable
A_Formal_Access_To_Constant => Nonterminal_Component'Access,
A_Formal_Access_To_Procedure => Access_To_Procedure_End'Access,
A_Formal_Access_To_Protected_Procedure =>
Access_To_Protected_Procedure_End'Access,
A_Formal_Access_To_Function => Nonterminal_Component'Access,
A_Formal_Access_To_Protected_Function => Nonterminal_Component'Access,
An_Aspect_Specification => Nonterminal_Component'Access,
An_Integer_Literal => Numeric_Literal_End'Access,
A_Real_Literal => Numeric_Literal_End'Access,
A_String_Literal => String_Literal_End'Access,
An_Identifier => Word_Or_Character_End'Access,
An_And_Operator ..
-- An_Or_Operator
-- An_Xor_Operator
-- An_Equal_Operator
-- A_Not_Equal_Operator
-- A_Less_Than_Operator
-- A_Less_Than_Or_Equal_Operator
-- A_Greater_Than_Operator
-- A_Greater_Than_Or_Equal_Operator
-- A_Plus_Operator
-- A_Minus_Operator
-- A_Concatenate_Operator
-- A_Unary_Plus_Operator
-- A_Unary_Minus_Operator
-- A_Multiply_Operator
-- A_Divide_Operator
-- A_Mod_Operator
-- A_Rem_Operator
-- An_Exponentiate_Operator
-- An_Abs_Operator
A_Not_Operator => Operator_Symbol_End'Access,
A_Character_Literal => Character_Literal_End'Access,
An_Enumeration_Literal => Word_Or_Character_End'Access,
An_Explicit_Dereference => Plus2'Access,
A_Function_Call => Function_Call_End'Access,
An_Indexed_Component ..
-- A_Slice
A_Selected_Component => Nonterminal_Component'Access,
An_Access_Attribute ..
-- An_Address_Attribute
-- An_Adjacent_Attribute
-- An_Aft_Attribute
-- An_Alignment_Attribute
-- A_Base_Attribute
-- A_Bit_Order_Attribute
-- A_Body_Version_Attribute
-- A_Callable_Attribute
-- A_Caller_Attribute
-- A_Ceiling_Attribute
-- A_Class_Attribute
-- A_Component_Size_Attribute
-- A_Compose_Attribute
-- A_Constrained_Attribute
-- A_Copy_Sign_Attribute
-- A_Count_Attribute
-- A_Definite_Attribute
-- A_Delta_Attribute
-- A_Denorm_Attribute
-- A_Digits_Attribute
-- An_Exponent_Attribute
-- An_External_Tag_Attribute
-- A_First_Attribute
-- A_First_Bit_Attribute
-- A_Floor_Attribute
-- A_Fore_Attribute
-- A_Fraction_Attribute
-- An_Identity_Attribute
-- An_Image_Attribute
-- An_Input_Attribute
-- A_Last_Attribute
-- A_Last_Bit_Attribute
-- A_Leading_Part_Attribute
-- A_Length_Attribute
-- A_Machine_Attribute
-- A_Machine_Emax_Attribute
-- A_Machine_Emin_Attribute
-- A_Machine_Mantissa_Attribute
-- A_Machine_Overflows_Attribute
-- A_Machine_Radix_Attribute
-- A_Machine_Rounds_Attribute
-- A_Max_Attribute
-- A_Max_Size_In_Storage_Elements_Attribute
-- A_Min_Attribute
-- A_Model_Attribute
-- A_Model_Emin_Attribute
-- A_Model_Epsilon_Attribute
-- A_Model_Mantissa_Attribute
-- A_Model_Small_Attribute
-- A_Modulus_Attribute
-- An_Output_Attribute
-- A_Partition_ID_Attribute
-- A_Pos_Attribute
-- A_Position_Attribute
-- A_Pred_Attribute
-- A_Range_Attribute
-- A_Read_Attribute
-- A_Remainder_Attribute
-- A_Round_Attribute
-- A_Rounding_Attribute
-- A_Safe_First_Attribute
-- A_Safe_Last_Attribute
-- A_Scale_Attribute
-- A_Scaling_Attribute
-- A_Signed_Zeros_Attribute
-- A_Size_Attribute
-- A_Small_Attribute
-- A_Storage_Pool_Attribute
-- A_Storage_Size_Attribute
-- A_Succ_Attribute
-- A_Tag_Attribute
-- A_Terminated_Attribute
-- A_Truncation_Attribute
-- An_Unbiased_Rounding_Attribute
-- An_Unchecked_Access_Attribute
-- A_Val_Attribute
-- A_Valid_Attribute
-- A_Value_Attribute
-- A_Version_Attribute
-- A_Wide_Image_Attribute
-- A_Wide_Value_Attribute
-- A_Wide_Width_Attribute
-- A_Width_Attribute
-- A_Write_Attribute
-- An_Implementation_Defined_Attribute
An_Unknown_Attribute => Nonterminal_Component'Access,
A_Record_Aggregate ..
-- An_Extension_Aggregate
-- A_Positional_Array_Aggregate
-- A_Named_Array_Aggregate
-- An_And_Then_Short_Circuit
-- An_Or_Else_Short_Circuit
-- An_In_Range_Membership_Test
-- A_Not_In_Range_Membership_Test
-- An_In_Type_Membership_Test
-- A_Not_In_Type_Membership_Test
-- An_In_Membership_Test
A_Not_In_Membership_Test => Nonterminal_Component'Access,
A_Null_Literal => Plus3'Access,
A_Parenthesized_Expression ..
-- A_Type_Conversion
-- A_Qualified_Expression
-- An_Allocation_From_Subtype
-- An_Allocation_From_Qualified_Expression
-- A_Conditional_Expression -- Ada 2015
-- A_Pragma_Argument_Association
A_Discriminant_Association => Nonterminal_Component'Access,
-- --|A2005 start
A_Record_Component_Association ..
An_Array_Component_Association => Component_Association_End'Access,
-- --|A2005 end
A_Parameter_Association ..
-- A_Generic_Association
-- A_Null_Statement
-- We can treat this statement as a Nonterminal_Component.
-- Get_Last_Comp function will return Nil_Element.
-- An_Assignment_Statement
-- An_If_Statement
-- A_Case_Statement
-- A_Loop_Statement
-- A_While_Loop_Statement
-- A_For_Loop_Statement
-- A_Block_Statement
-- An_Exit_Statement
-- A_Goto_Statement
-- A_Procedure_Call_Statement
-- A_Return_Statement
-- An_Accept_Statement
-- An_Entry_Call_Statement
-- A_Requeue_Statement
-- We can treat this statement as a Nonterminal_Component.
-- Get_Last_Comp function will return Nil_Element.
-- A_Requeue_Statement_With_Abort
-- A_Delay_Until_Statement
-- A_Delay_Relative_Statement
-- A_Terminate_Alternative_Statement
-- We can treat this statement as a Nonterminal_Component.
-- Get_Last_Comp function will return Nil_Element.
-- A_Selective_Accept_Statement
-- A_Timed_Entry_Call_Statement
-- A_Conditional_Entry_Call_Statement
-- An_Asynchronous_Select_Statement
-- An_Abort_Statement
-- A_Raise_Statement
-- A_Code_Statement
-- An_If_Path
-- An_Elsif_Path
-- An_Else_Path
-- A_Case_Path
-- A_Select_Path
-- An_Or_Path
-- A_Then_Abort_Path
-- A_Case_Expression_Path -- Ada 2012
-- An_If_Expression_Path -- Ada 2012
-- An_Elsif_Expression_Path -- Ada 2012
-- An_Else_Expression_Path -- Ada 2012
-- A_Use_Package_Clause
-- A_Use_Type_Clause
-- A_Use_All_Type_Clause -- Ada 2012
-- A_With_Clause
-- An_Attribute_Definition_Clause
-- An_Enumeration_Representation_Clause
-- A_Record_Representation_Clause
-- An_At_Clause
-- A_Component_Clause
An_Exception_Handler => Nonterminal_Component'Access,
others => A_Bug'Access);
---------------------------
-- Nonterminal_Component --
---------------------------
function Nonterminal_Component (E : Asis.Element) return Source_Ptr is
Last_Comp : Asis.Element;
Image_End : Source_Ptr;
begin
if Debug_Flag_X then
Write_Str ("Nonterminal_Component - called for ");
Write_Str (Internal_Element_Kinds'Image (Int_Kind (E)));
Write_Eol;
end if;
Last_Comp := Get_Last_Component (E);
if not Is_Nil (Last_Comp) then
Image_End := Set_Image_End (Last_Comp);
else
Image_End := Get_Location (E);
end if;
Image_End := Skip_Trailing_Brackets (E, Image_End);
return Image_End;
end Nonterminal_Component;
-------------------
-- Set_Image_End --
-------------------
function Set_Image_End (E : Asis.Element) return Source_Ptr is
begin
-- all that this function does is switching to the function
-- implementing the specific processing for the given element
-- kind
if Debug_Flag_X then
Write_Str (" Set_Image_End - called for ");
Write_Str (Internal_Element_Kinds'Image (Int_Kind (E)));
Write_Eol;
Write_Eol;
end if;
return Search_Switch (Int_Kind (E)) (E);
end Set_Image_End;
end A4G.Span_End;
|
stcarrez/ada-ado | Ada | 1,627 | ads | -----------------------------------------------------------------------
-- ado-objects-tests -- Tests for ADO.Objects
-- Copyright (C) 2011, 2020, 2021 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 ADO.Objects.Tests is
type Test is new Util.Tests.Test with null record;
procedure Test_Key (T : in out Test);
procedure Test_Object_Ref (T : in out Test);
procedure Test_Create_Object (T : in out Test);
procedure Test_Delete_Object (T : in out Test);
-- Test Is_Inserted and Is_Null
procedure Test_Is_Inserted (T : in out Test);
-- Test Is_Modified
procedure Test_Is_Modified (T : in out Test);
-- Test object creation/update/load with string as key.
procedure Test_String_Key (T : in out Test);
-- Test float.
procedure Test_Float (T : in out Test);
-- Add the tests in the test suite
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
end ADO.Objects.Tests;
|
Rodeo-McCabe/orka | Ada | 2,553 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with System;
with GL.API;
with GL.Enums.Getter;
with GL.Low_Level;
with GL.Types.Indirect;
package body GL.Compute is
Indices : constant array (Index_3D) of UInt := (X => 0, Y => 1, Z => 2);
procedure Dispatch_Compute (X, Y, Z : UInt := 1) is
begin
API.Dispatch_Compute.Ref (X, Y, Z);
end Dispatch_Compute;
procedure Dispatch_Compute_Indirect (Offset : Size := 0) is
use GL.Types.Indirect;
Offset_In_Bytes : constant Size
:= Offset * Dispatch_Indirect_Command'Size / System.Storage_Unit;
begin
API.Dispatch_Compute_Indirect.Ref (Low_Level.IntPtr (Offset_In_Bytes));
end Dispatch_Compute_Indirect;
function Max_Compute_Shared_Memory_Size return Size is
Value : Size := 0;
begin
API.Get_Size.Ref (Enums.Getter.Max_Compute_Shared_Memory_Size, Value);
return Value;
end Max_Compute_Shared_Memory_Size;
function Max_Compute_Work_Group_Invocations return Size is
Value : Size := 0;
begin
API.Get_Size.Ref (Enums.Getter.Max_Compute_Work_Group_Invocations, Value);
return Value;
end Max_Compute_Work_Group_Invocations;
function Max_Compute_Work_Group_Count return Dimension_Size_Array is
Values : Dimension_Size_Array := (others => 0);
begin
for Dimension in Values'Range loop
API.Get_Size_I.Ref (Enums.Getter.Max_Compute_Work_Group_Count,
Indices (Dimension), Values (Dimension));
end loop;
return Values;
end Max_Compute_Work_Group_Count;
function Max_Compute_Work_Group_Size return Dimension_Size_Array is
Values : Dimension_Size_Array := (others => 0);
begin
for Dimension in Values'Range loop
API.Get_Size_I.Ref (Enums.Getter.Max_Compute_Work_Group_Size,
Indices (Dimension), Values (Dimension));
end loop;
return Values;
end Max_Compute_Work_Group_Size;
end GL.Compute;
|
Skyfold/aws_sorter | Ada | 145 | ads | package common_types is
type Number_Array is array (Natural range <>) of Float;
type Job_Types is (Merge_Job, Sort_Job);
end common_types;
|
pat-rogers/LmcpGen | Ada | 138 | ads | package Utilities is
generic
Width: Positive;
function LeftPad (Str : String; Level : Natural) return String;
end Utilities; |
AdaCore/training_material | Ada | 1,013 | adb | package body Employee is
function Get_Staff return Employee_T is
begin
return 0;
end Get_Staff;
function Get_Supervisor return Employee_T is
begin
return 0;
end Get_Supervisor;
function Get_Manager return Employee_T is
begin
return 0;
end Get_Manager;
function Last_Name
(This : Employee_T)
return String is
begin
return "";
end Last_Name;
function First_Name
(This : Employee_T)
return String is
begin
return "";
end First_Name;
function Hourly_Rate
(This : Employee_T)
return Float is
begin
return 0.0;
end Hourly_Rate;
function Project
(This : Employee_T)
return String is
begin
return "";
end Project;
function Department
(This : Employee_T)
return String is
begin
return "";
end Department;
function Staff_Count
(This : Employee_T)
return String is
begin
return "";
end Staff_Count;
end Employee;
|
burratoo/Acton | Ada | 4,474 | adb | ------------------------------------------------------------------------------------------
-- --
-- OAK CORE SUPPORT PACKAGE --
-- ARM ARM7TDMI --
-- --
-- OAK.CORE_SUPPORT_PACKAGE.CALL_STACK.OPS --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
package body Oak.Core_Support_Package.Call_Stack.Ops is
use System.Storage_Elements;
----------------------------------
-- Set_Task_Instruction_Pointer --
----------------------------------
procedure Set_Task_Instruction_Pointer
(Stack : in out Call_Stack_Handler;
Instruction_Address : in System.Address) is
begin
Asm
-- Calculate the start of the agent's stack
("mov r6, %0" & ASCII.LF & ASCII.HT &
-- 8-byte alignment. Holds full frame
"sub r6, #72" & ASCII.LF & ASCII.HT &
"mov r4, #0" & ASCII.LF & ASCII.HT & -- Agent fp
"mov r5, #0" & ASCII.LF & ASCII.HT & -- Agent ip
"mov r7, #0" & ASCII.LF & ASCII.HT & -- Agent lr
-- Default CPSR value - User mode, all interrupts enabled
"mov r8, #0x10" & ASCII.LF & ASCII.HT &
"mov r9, %1" & ASCII.LF & ASCII.HT & -- Agent first instr.
-- Stack.Pointer lives here
"sub %0, #60" & ASCII.LF & ASCII.HT &
-- Store the agent's fp, sp, lr, initial address and agent CPSR onto
-- the agents register store (represented by Stack.Pointer)
"stm %0, {r4 - r7}" & ASCII.LF & ASCII.HT &
"stmdb %0, {r8 - r9}",
Outputs => Address'Asm_Output ("+r", Stack.Pointer),
Inputs => Address'Asm_Input ("r", Instruction_Address),
Volatile => True,
Clobber => "r4, r5, r6, r7, r8, r9");
end Set_Task_Instruction_Pointer;
procedure Set_Task_Body_Procedure
(Stack : in out Call_Stack_Handler;
Procedure_Address : in System.Address;
Task_Value_Record : in System.Address) is
begin
Asm
-- Calculate the start of the agent's stack
("mov r5, %0" & ASCII.LF & ASCII.HT &
"sub r5, #72" & ASCII.LF & ASCII.HT & -- 8-byte alignment
-- Default CPSR value - User mode, all interrupts enabled
"mov r6, #0x10" & ASCII.LF & ASCII.HT &
"mov r4, #0" & ASCII.LF & ASCII.HT & -- fp, lr
"sub %0, #60" & ASCII.LF & ASCII.HT &
-- Store the stack pointer, procedure argument, link register
-- and agent CPSR onto the agents register store (represented by
-- Stack.Pointer).
"str %2, [%0]" & ASCII.LF & ASCII.HT & -- r0 = Task_Value_Record
"str r4, [%0, #44]" & ASCII.LF & ASCII.HT & -- r11 = agent fp
"str r5, [%0, #52]" & ASCII.LF & ASCII.HT & -- r13 = agent sp
"str r4, [%0, #56]" & ASCII.LF & ASCII.HT & -- r14 = agent lr
-- Agent start addr. 4 bytes need to be added on the address since
-- the full agent switch will remove these 4 bytes (Needed since
-- the full switch is normally used when the agent is interrupts
-- through an IRQ or FIQ interrupt. The return instructions from
-- these interrupts need to remove the 4 bytes that where added to
-- the pc in the course of taking these interrupts.
"add r7, %1, #4" & ASCII.LF & ASCII.HT &
"stmdb %0, {r6, r7}", -- Procedure start address and CPSR
Outputs => Address'Asm_Output ("+r", Stack.Pointer),
Inputs => (Address'Asm_Input ("r", Procedure_Address),
Address'Asm_Input ("r", Task_Value_Record)),
Volatile => True,
Clobber => "r4, r5, r6, r7");
end Set_Task_Body_Procedure;
end Oak.Core_Support_Package.Call_Stack.Ops;
|
msrLi/portingSources | Ada | 939 | adb | -- Copyright 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 body Pck is
function Make (H, L : Natural) return Packed_Array is
begin
return (H .. L => False);
end Make;
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
end Pck;
|
tyudosen/HeterogeneousStack | Ada | 3,417 | adb | with Ada.Text_IO; use Ada.Text_IO;
with hetro_stack;
package body hetro_stack_elems is
package IIO is new Ada.Text_IO.Integer_IO(Integer); use IIO;
---------- Procedure(s) for Vehicle Record -------------------------------------------
procedure AssignVehicleType(aVehicle: in out Vehicle; CarOrPlane: in Vehicles) is
begin
aVehicle.VehicleType := CarOrPlane;
end AssignVehicleType;
procedure AssignNumDoors(aVehicle: in out Vehicle; Num: in Integer) is
begin
aVehicle.NumOfDoors := Num;
end AssignNumDoors;
procedure PrintNumOfDoors(aVehicle: in out Vehicle) is
begin
put("Number Doors: ");
put(aVehicle.NumOfDoors);
new_line;
end PrintNumOfDoors;
procedure Print(aVehicle: in Vehicle) is
begin
null;
end Print;
function Compare(aVehicle: in Vehicle; Other: in Vehicle'Class) return Boolean is
begin
return False;
end Compare;
---------Procedure for Car Record ------------------------------------------------------
procedure AssignManf(aCar: in out CarRec; Manf: in CarString) is
begin
aCar.Manf := Manf;
end AssignManf;
procedure PrintCarString(PrtStr: CarString) is
begin
for Index in 1..5 loop
put(PrtStr(Index));
end loop;
end PrintCarString;
procedure Print(aCar: in CarRec) is
begin
put_line("-------------------------------------------------------------------------------------");
put("Vehicle Type: ");
VehiclesIO.put(aCar.VehicleType);new_line;
put("Manufacturer: ");
PrintCarString(aCar.Manf) ;new_line;
put("Number of Doors: ");
put(aCar.NumOfDoors, 0);new_line;
put_line("-------------------------------------------------------------------------------------");
end Print;
function Compare(aCar: in CarRec; Other: in Vehicle'Class) return Boolean is
begin
return Other in CarRec and then aCar.Manf = CarRec(Other).Manf;
end Compare;
---------Procedures for Plane Record -----------------------------------------------------
procedure AssignNumEngines(aPlane: in out PlaneRec; Num: in Integer) is
begin
aPlane.NumOfEngines := Num;
end AssignNumEngines;
procedure AssignManf(aPlane: in out PlaneRec; Manf: in PlaneString) is
begin
aPlane.Manf := Manf;
end AssignManf;
procedure PrintPlaneString(PrtStr: PlaneString) is
begin
for Index in 1..8 loop
put(PrtStr(Index));
end loop;
end PrintPlaneString;
procedure Print(aPlane: in PlaneRec) is
begin
put_line("-------------------------------------------------------------------------------------");
put("Vehicle Type: ");
VehiclesIO.put(aPlane.VehicleType);new_line;
put("Manufacturer: ");
PrintPlaneString(aPlane.Manf);new_line;
put("Number of Doors: ");
put(aPlane.NumOfDoors, 0);new_line;
put("Number of Engines: ");
put(aPlane.NumOfEngines, 0);new_line;
put_line("-------------------------------------------------------------------------------------");
end Print;
function Compare(aPlane: in PlaneRec; Other: in Vehicle'Class) return Boolean is
begin
return Other in PlaneRec and then aPlane.Manf = PlaneRec(Other).Manf;
end Compare;
end hetro_stack_elems; |
reznikmm/matreshka | Ada | 5,739 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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 Ada.Wide_Wide_Text_IO;
with League.Strings;
with XML.SAX.Attributes;
with XML.SAX.String_Output_Destinations;
with XML.SAX.Pretty_Writers;
use League.Strings;
procedure Escape_Test is
Output : aliased
XML.SAX.String_Output_Destinations.String_Output_Destination;
Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer;
OK : Boolean := True;
Attrs : XML.SAX.Attributes.SAX_Attributes;
NS_URI : constant Universal_String := To_Universal_String ("");
Local_Name : constant Universal_String := To_Universal_String ("");
Qualified_Name : constant Universal_String := To_Universal_String ("A");
Reference : constant Universal_String
:= To_Universal_String ("<?xml version='1.1'?>"
& "<A>some_text</A>"
& "<A>alert('hello');</A>"
& "<A>aa&bb'cc<dd>ee</A>");
------------
-- Assert --
------------
procedure Assert (OK : Boolean) is
begin
if not OK then
Ada.Wide_Wide_Text_IO.Put_Line
(Writer.Error_String.To_Wide_Wide_String);
raise Program_Error with "Assertion Failed";
end if;
end Assert;
begin
-- Creating document
Writer.Set_Output_Destination (Output'Unchecked_Access);
Writer.Set_Version (XML.SAX.Pretty_Writers.XML_1_1);
-- Adding first tag
Writer.Start_Document (OK);
Assert (OK);
Writer.Start_Element (NS_URI, Local_Name, Qualified_Name, Attrs, OK);
Assert (OK);
Writer.Characters (To_Universal_String ("some_text"), OK);
Assert (OK);
Writer.End_Element (NS_URI, Local_Name, Qualified_Name, OK);
Assert (OK);
Writer.Start_Element (NS_URI, Local_Name, Qualified_Name, Attrs, OK);
Assert (OK);
Writer.Characters (To_Universal_String ("alert('hello');"), OK);
Assert (OK);
Writer.End_Element (NS_URI, Local_Name, Qualified_Name, OK);
Assert (OK);
Writer.Start_Element (NS_URI, Local_Name, Qualified_Name, Attrs, OK);
Assert (OK);
Writer.Characters (To_Universal_String ("aa&bb'cc<dd>ee"), OK);
Assert (OK);
Writer.End_Element (NS_URI, Local_Name, Qualified_Name, OK);
Assert (OK);
Writer.End_Document (OK);
Assert (OK);
Assert (Output.Get_Text = Reference);
-- Ada.Wide_Wide_Text_IO.Put_Line (Writer.Text.To_Wide_Wide_String);
end Escape_Test;
|
onox/json-ada | Ada | 8,188 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Exceptions;
with Ada.Unchecked_Deallocation;
with JSON.Tokenizers;
package body JSON.Parsers is
package Tokenizers is new JSON.Tokenizers (Types);
use type Tokenizers.Token_Kind;
function Parse_Token
(Stream : Streams.Stream_Ptr;
Token : Tokenizers.Token;
Allocator : Types.Memory_Allocator_Ptr;
Depth : Positive) return Types.JSON_Value;
function Parse_Array
(Stream : Streams.Stream_Ptr;
Allocator : Types.Memory_Allocator_Ptr;
Depth : Positive) return Types.JSON_Value
is
Token : Tokenizers.Token;
JSON_Array : Types.JSON_Value := Types.Create_Array (Allocator, Depth + 1);
Repeat : Boolean := False;
begin
loop
Tokenizers.Read_Token (Stream.all, Token);
-- Either expect ']' character or (if not the first element)
-- a value separator (',' character)
if Token.Kind = Tokenizers.End_Array_Token then
exit;
elsif Repeat and Token.Kind /= Tokenizers.Value_Separator_Token then
raise Parse_Error with "Expected value separator (',' character)";
elsif Repeat then
-- Value separator has been read, now read the next value
Tokenizers.Read_Token (Stream.all, Token);
end if;
-- Parse value and append it to the array
JSON_Array.Append (Parse_Token (Stream, Token, Allocator, Depth + 1));
Repeat := True;
end loop;
return JSON_Array;
end Parse_Array;
function Parse_Object
(Stream : Streams.Stream_Ptr;
Allocator : Types.Memory_Allocator_Ptr;
Depth : Positive) return Types.JSON_Value
is
Token : Tokenizers.Token;
JSON_Object : Types.JSON_Value := Types.Create_Object (Allocator, Depth + 1);
Repeat : Boolean := False;
begin
loop
Tokenizers.Read_Token (Stream.all, Token);
-- Either expect '}' character or (if not the first member)
-- a value separator (',' character)
if Token.Kind = Tokenizers.End_Object_Token then
exit;
elsif Repeat and Token.Kind /= Tokenizers.Value_Separator_Token then
raise Parse_Error with "Expected value separator (',' character)";
elsif Repeat then
-- Value separator has been read, now read the next value
Tokenizers.Read_Token (Stream.all, Token);
end if;
-- Parse member key
if Token.Kind /= Tokenizers.String_Token then
raise Parse_Error with "Expected key to be a string";
end if;
declare
Key : constant Types.JSON_Value
:= Types.Create_String (Stream, Token.String_Offset, Token.String_Length);
begin
-- Expect name separator (':' character) between key and value
Tokenizers.Read_Token (Stream.all, Token);
if Token.Kind /= Tokenizers.Name_Separator_Token then
raise Parse_Error with "Expected name separator (':' character)";
end if;
-- Parse member value and insert key-value pair in the object
Tokenizers.Read_Token (Stream.all, Token);
JSON_Object.Insert
(Key, Parse_Token (Stream, Token, Allocator, Depth + 1),
Check_Duplicate_Keys);
end;
Repeat := True;
end loop;
return JSON_Object;
end Parse_Object;
function Parse_Token
(Stream : Streams.Stream_Ptr;
Token : Tokenizers.Token;
Allocator : Types.Memory_Allocator_Ptr;
Depth : Positive) return Types.JSON_Value is
begin
case Token.Kind is
when Tokenizers.Begin_Array_Token =>
return Parse_Array (Stream, Allocator, Depth);
when Tokenizers.Begin_Object_Token =>
return Parse_Object (Stream, Allocator, Depth);
when Tokenizers.String_Token =>
return Types.Create_String (Stream, Token.String_Offset, Token.String_Length);
when Tokenizers.Integer_Token =>
return Types.Create_Integer (Token.Integer_Value);
when Tokenizers.Float_Token =>
return Types.Create_Float (Token.Float_Value);
when Tokenizers.Boolean_Token =>
return Types.Create_Boolean (Token.Boolean_Value);
when Tokenizers.Null_Token =>
return Types.Create_Null;
when others =>
raise Parse_Error with "Unexpected token " & Token.Kind'Image;
end case;
end Parse_Token;
function Parse
(Stream : Streams.Stream_Ptr;
Allocator : Types.Memory_Allocator_Ptr) return Types.JSON_Value
is
Token : Tokenizers.Token;
begin
Tokenizers.Read_Token (Stream.all, Token);
return Value : constant Types.JSON_Value
:= Parse_Token (Stream, Token, Allocator, Positive'First)
do
Tokenizers.Read_Token (Stream.all, Token, Expect_EOF => True);
end return;
exception
when E : Tokenizers.Tokenizer_Error =>
raise Parse_Error with Ada.Exceptions.Exception_Message (E);
end Parse;
function Create
(Pointer : not null JSON.Streams.Stream_Element_Array_Access;
Maximum_Depth : Positive := Default_Maximum_Depth) return Parser
is
Allocator : Types.Memory_Allocator (Maximum_Depth);
begin
return
(AF.Limited_Controlled with
Pointer => Pointer,
Own_Pointer => False,
Stream => Stream_Holders.To_Holder (Streams.Create_Stream (Pointer)),
Allocator => Memory_Holders.To_Holder (Allocator));
end Create;
function Create
(Text : String;
Maximum_Depth : Positive := Default_Maximum_Depth) return Parser
is
Allocator : Types.Memory_Allocator (Maximum_Depth);
begin
return Result : Parser :=
(AF.Limited_Controlled with
Pointer => Streams.From_Text (Text),
Own_Pointer => True,
Allocator => Memory_Holders.To_Holder (Allocator),
others => <>)
do
Result.Stream := Stream_Holders.To_Holder (Streams.Create_Stream (Result.Pointer));
end return;
end Create;
function Create_From_File
(File_Name : String;
Maximum_Depth : Positive := Default_Maximum_Depth) return Parser
is
Allocator : Types.Memory_Allocator (Maximum_Depth);
begin
return Result : Parser :=
(AF.Limited_Controlled with
Pointer => Streams.From_File (File_Name),
Own_Pointer => True,
Allocator => Memory_Holders.To_Holder (Allocator),
others => <>)
do
Result.Stream := Stream_Holders.To_Holder (Streams.Create_Stream (Result.Pointer));
end return;
end Create_From_File;
function Parse (Object : in out Parser) return Types.JSON_Value is
begin
return Parse (Object.Stream.Reference.Element, Object.Allocator.Reference.Element);
end Parse;
overriding
procedure Finalize (Object : in out Parser) is
procedure Free is new Ada.Unchecked_Deallocation
(Object => Streams.AS.Stream_Element_Array,
Name => Streams.Stream_Element_Array_Access);
use type Streams.Stream_Element_Array_Access;
begin
if Object.Pointer /= null then
Object.Stream.Clear;
Object.Allocator.Clear;
if Object.Own_Pointer then
Free (Object.Pointer);
end if;
Object.Pointer := null;
end if;
end Finalize;
end JSON.Parsers;
|
LionelDraghi/smk | Ada | 5,697 | ads | -- -----------------------------------------------------------------------------
-- smk, the smart make (http://lionel.draghi.free.fr/smk/)
-- © 2018, 2019 Lionel Draghi <[email protected]>
-- SPDX-License-Identifier: APSL-2.0
-- -----------------------------------------------------------------------------
-- 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.Calendar;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
private package Smk.Files is
-- --------------------------------------------------------------------------
-- Purpose:
-- This package defines a File and related operations
-- --------------------------------------------------------------------------
type File_Status is (New_File,
Identical,
Updated,
Missing,
Unknown) with Default_Value => Unknown;
Status_Image : constant array (File_Status) of String (1 .. 7) :=
(New_File => "New ",
Identical => "Identic", -- Identical
Updated => "Updated",
Missing => "Missing",
Unknown => "Unknown");
Short_Status_Image : constant array (File_Status) of Character :=
(New_File => 'N',
Identical => '=',
Updated => 'U',
Missing => 'M',
Unknown => '?');
-- --------------------------------------------------------------------------
type File_Role is (Source,
Target,
Unused) with Default_Value => Unused;
Role_Image : constant array (File_Role) of String (1 .. 6) :=
(Source => "Source",
Target => "Target",
Unused => "Unused");
-- --------------------------------------------------------------------------
type File_Name is new Unbounded_String;
function "+" (Name : File_Name) return String;
function "+" (Name : String) return File_Name;
No_File : constant File_Name
:= File_Name (Ada.Strings.Unbounded.Null_Unbounded_String);
-- --------------------------------------------------------------------------
function Shorten (Name : String) return String;
function Shorten (Name : File_Name) return String;
-- returns Name if Settings.Shorten_File_Names = False,
-- or a short path from current dir the the file.
-- NB : Name must be a Full_Name (a rooted path)
-- --------------------------------------------------------------------------
type File_Type is private;
-- --------------------------------------------------------------------------
function Create (File : File_Name;
Role : File_Role) return File_Type;
-- --------------------------------------------------------------------------
function Time_Tag (File : File_Type) return Ada.Calendar.Time;
function Is_Dir (File : File_Type) return Boolean;
function Is_System (File : File_Type) return Boolean;
-- Is_System returns True if the File_Name starts with "/usr/, "/lib/", etc.
function Role (File : File_Type) return File_Role
with Pre => not (Is_Source (File) and Is_Target (File)); -- can't be both
function Status (File : File_Type) return File_Status;
function Is_Source (File : File_Type) return Boolean;
function Is_Target (File : File_Type) return Boolean;
function Is_Unused (File : File_Type) return Boolean is
(not Is_Source (File) and not Is_Target (File));
-- -----------------------------------------------------------------------
function Has_Target (Name : File_Name;
Target : String) return Boolean;
-- File is a Full_Name
-- return True if Target match the right part of File
-- --------------------------------------------------------------------------
function File_Image (Name : File_Name;
File : File_Type;
Prefix : String := "") return String;
-- Return a string according to Long_Listing_Format setting
-- if True: [Fil] [Normal] [Source] [Identic] [<timetag>] ogg-to-mp3.sh
-- if False: ogg-to-mp3.sh
-- --------------------------------------------------------------------------
function Is_Dir (File_Name : in String) return Boolean;
-- --------------------------------------------------------------------------
procedure Update_File_Status (Name : in File_Name;
File : in out File_Type;
Previous_Status : out File_Status;
Current_Status : out File_Status);
private
-- --------------------------------------------------------------------------
type File_Type is record
Time_Tag : Ada.Calendar.Time;
Is_System : Boolean;
Is_Dir : Boolean;
Is_Source : Boolean;
Is_Target : Boolean;
Status : File_Status;
end record;
end Smk.Files;
|
DrenfongWong/tkm-rpc | Ada | 1,351 | ads | with Tkmrpc.Types;
with Tkmrpc.Results;
with Tkmrpc.Operations;
package Tkmrpc.Response is
Response_Size : constant := 1024;
Header_Size : constant := 24;
Body_Size : constant := Response_Size - Header_Size;
type Header_Type is record
Operation : Operations.Operation_Type;
Request_Id : Types.Request_Id_Type;
Result : Results.Result_Type;
end record;
for Header_Type use record
Operation at 0 range 0 .. (8 * 8) - 1;
Request_Id at 8 range 0 .. (8 * 8) - 1;
Result at 16 range 0 .. (8 * 8) - 1;
end record;
for Header_Type'Size use Header_Size * 8;
subtype Padded_Data_Range is Natural range 1 .. Body_Size;
subtype Padded_Data_Type is Types.Byte_Sequence (Padded_Data_Range);
type Data_Type is record
Header : Header_Type;
Padded_Data : Padded_Data_Type;
end record;
for Data_Type use record
Header at 0 range 0 .. (Header_Size * 8) - 1;
Padded_Data at Header_Size range 0 .. (Body_Size * 8) - 1;
end record;
for Data_Type'Size use Response_Size * 8;
Null_Data : constant Data_Type := Data_Type'
(Header => Header_Type'
(Operation => 0,
Request_Id => 0,
Result => Results.Invalid_Operation),
Padded_Data => Padded_Data_Type'(others => 0));
end Tkmrpc.Response;
|
reznikmm/matreshka | Ada | 9,220 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-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$
------------------------------------------------------------------------------
private with Ada.Finalization;
with League.Strings;
with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
with XML.SAX.DTD_Handlers;
with XML.SAX.Entity_Resolvers;
with XML.SAX.Error_Handlers;
with XML.SAX.Input_Sources;
with XML.SAX.Locators;
with XML.SAX.Lexical_Handlers;
with XML.SAX.Parse_Exceptions;
package SAX_Events_Writers is
type SAX_Events_Writer is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.DTD_Handlers.SAX_DTD_Handler
and XML.SAX.Entity_Resolvers.SAX_Entity_Resolver
and XML.SAX.Error_Handlers.SAX_Error_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with private;
not overriding procedure Set_Testsuite_URI
(Self : in out SAX_Events_Writer;
URI : League.Strings.Universal_String);
not overriding procedure Done (Self : in out SAX_Events_Writer);
not overriding function Has_Fatal_Errors
(Self : SAX_Events_Writer) return Boolean;
not overriding function Has_Errors
(Self : SAX_Events_Writer) return Boolean;
not overriding function Text
(Self : SAX_Events_Writer) return League.Strings.Universal_String;
overriding procedure Characters
(Self : in out SAX_Events_Writer;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_CDATA
(Self : in out SAX_Events_Writer;
Success : in out Boolean);
overriding procedure End_Document
(Self : in out SAX_Events_Writer;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out SAX_Events_Writer;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_Prefix_Mapping
(Self : in out SAX_Events_Writer;
Prefix : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Error
(Self : in out SAX_Events_Writer;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception;
Success : in out Boolean);
overriding function Error_String
(Self : SAX_Events_Writer)
return League.Strings.Universal_String;
overriding procedure Fatal_Error
(Self : in out SAX_Events_Writer;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception);
overriding procedure Ignorable_Whitespace
(Self : in out SAX_Events_Writer;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Notation_Declaration
(Self : in out SAX_Events_Writer;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Processing_Instruction
(Self : in out SAX_Events_Writer;
Target : League.Strings.Universal_String;
Data : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Resolve_Entity
(Self : in out SAX_Events_Writer;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
Base_URI : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Source : out XML.SAX.Input_Sources.SAX_Input_Source_Access;
Success : in out Boolean);
overriding procedure Set_Document_Locator
(Self : in out SAX_Events_Writer;
Locator : XML.SAX.Locators.SAX_Locator);
overriding procedure Skipped_Entity
(Self : in out SAX_Events_Writer;
Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Start_CDATA
(Self : in out SAX_Events_Writer;
Success : in out Boolean);
overriding procedure Start_Document
(Self : in out SAX_Events_Writer;
Success : in out Boolean);
overriding procedure Start_Element
(Self : in out SAX_Events_Writer;
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);
overriding procedure Start_Prefix_Mapping
(Self : in out SAX_Events_Writer;
Prefix : League.Strings.Universal_String;
URI : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Unparsed_Entity_Declaration
(Self : in out SAX_Events_Writer;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Notation_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Warning
(Self : in out SAX_Events_Writer;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception;
Success : in out Boolean);
private
type SAX_Events_Writer is
limited new Ada.Finalization.Limited_Controlled
and XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.DTD_Handlers.SAX_DTD_Handler
and XML.SAX.Entity_Resolvers.SAX_Entity_Resolver
and XML.SAX.Error_Handlers.SAX_Error_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with
record
Fatal_Errors : Boolean := False;
Errors : Boolean := False;
Result : League.Strings.Universal_String;
URI : League.Strings.Universal_String;
end record;
not overriding procedure Add_Line
(Self : in out SAX_Events_Writer;
Item : League.Strings.Universal_String);
-- Adds line to result.
overriding procedure Initialize (Self : in out SAX_Events_Writer);
end SAX_Events_Writers;
|
reznikmm/matreshka | Ada | 4,851 | 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.
------------------------------------------------------------------------------
-- Line is a marked element that defines a shape consisting of one straight
-- line between two points.
------------------------------------------------------------------------------
limited with AMF.DC;
with AMF.DG.Marked_Elements;
package AMF.DG.Lines is
pragma Preelaborate;
type DG_Line is limited interface
and AMF.DG.Marked_Elements.DG_Marked_Element;
type DG_Line_Access is
access all DG_Line'Class;
for DG_Line_Access'Storage_Size use 0;
not overriding function Get_Start
(Self : not null access constant DG_Line)
return AMF.DC.DC_Point is abstract;
-- Getter of Line::start.
--
-- the starting point of the line in the x-y coordinate system.
not overriding procedure Set_Start
(Self : not null access DG_Line;
To : AMF.DC.DC_Point) is abstract;
-- Setter of Line::start.
--
-- the starting point of the line in the x-y coordinate system.
not overriding function Get_End
(Self : not null access constant DG_Line)
return AMF.DC.DC_Point is abstract;
-- Getter of Line::end.
--
-- the ending point of the line in the x-y coordinate system.
not overriding procedure Set_End
(Self : not null access DG_Line;
To : AMF.DC.DC_Point) is abstract;
-- Setter of Line::end.
--
-- the ending point of the line in the x-y coordinate system.
end AMF.DG.Lines;
|
burratoo/Acton | Ada | 1,740 | adb | ------------------------------------------------------------------------------------------
-- --
-- ACTON PROCESSOR SUPPORT PACKAGE --
-- --
-- ATMEL.AT91SAM7S.ADC --
-- --
-- Copyright (C) 2014-2021, Patrick Bernardi --
-- --
------------------------------------------------------------------------------------------
with Atmel.AT91SAM7S.PMC;
package body Atmel.AT91SAM7S.ADC is
procedure Initialise_Interface (Settings : Mode_Type) is
begin
-- Turn on ADC clock
PMC.Peripheral_Clock_Enable_Register :=
(P_ADC => Enable,
others => No_Change);
Mode_Register := Settings;
Interface_Ready := True;
end Initialise_Interface;
procedure Enable_Channel (Channel : ADC_Channel_Id) is
Channel_To_Enable : ADC_Enable_Set := (others => No_Change);
begin
Channel_To_Enable (Channel) := Enable;
Channel_Enable_Register.Channel := Channel_To_Enable;
end Enable_Channel;
procedure Disable_Channel (Channel : ADC_Channel_Id) is
Channel_To_Disable : ADC_Disable_Set := (others => No_Change);
begin
Channel_To_Disable (Channel) := Disable;
Channel_Disable_Register.Channel := Channel_To_Disable;
end Disable_Channel;
end Atmel.AT91SAM7S.ADC;
|
optikos/ada-lsp | Ada | 804 | ads | -- Copyright (c) 2017 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
private with GNAT.OS_Lib;
private with League.Regexps;
with LSP.Types;
with LSP.Messages;
package Checkers is
type Checker is tagged private;
not overriding procedure Initialize
(Self : in out Checker;
Project : LSP.Types.LSP_String);
not overriding procedure Run
(Self : in out Checker;
File : LSP.Types.LSP_String;
Result : in out LSP.Messages.Diagnostic_Vector);
private
type Checker is tagged record
Project : LSP.Types.LSP_String;
Pattern : League.Regexps.Regexp_Pattern;
Compiler : GNAT.OS_Lib.String_Access;
end record;
end Checkers;
|
optikos/oasis | Ada | 3,436 | adb | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Null_Components is
function Create
(Null_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Null_Component is
begin
return Result : Null_Component :=
(Null_Token => Null_Token, Semicolon_Token => Semicolon_Token,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Null_Component is
begin
return Result : Implicit_Null_Component :=
(Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Null_Token
(Self : Null_Component)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Null_Token;
end Null_Token;
overriding function Semicolon_Token
(Self : Null_Component)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Null_Component)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Null_Component)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Null_Component)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : aliased in out Base_Null_Component'Class) is
begin
null;
end Initialize;
overriding function Is_Null_Component_Element
(Self : Base_Null_Component)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Null_Component_Element;
overriding function Is_Definition_Element
(Self : Base_Null_Component)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition_Element;
overriding procedure Visit
(Self : not null access Base_Null_Component;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Null_Component (Self);
end Visit;
overriding function To_Null_Component_Text
(Self : aliased in out Null_Component)
return Program.Elements.Null_Components.Null_Component_Text_Access is
begin
return Self'Unchecked_Access;
end To_Null_Component_Text;
overriding function To_Null_Component_Text
(Self : aliased in out Implicit_Null_Component)
return Program.Elements.Null_Components.Null_Component_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Null_Component_Text;
end Program.Nodes.Null_Components;
|
onox/orka | Ada | 3,460 | adb | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Unchecked_Conversion;
with EGL.API;
with EGL.Errors;
package body EGL.Objects.Surfaces is
Color_Space : constant Int := 16#309D#;
Color_Space_sRGB : constant Int := 16#3089#;
Color_Space_Linear : constant Int := 16#308A#;
function Create_Surface
(Display : Displays.Display;
Config : Configs.Config;
Window : Native_Window_Ptr;
sRGB : Boolean) return Surface
is
No_Surface : constant ID_Type := ID_Type (System.Null_Address);
Attributes : constant Int_Array :=
(Color_Space,
(if sRGB then Color_Space_sRGB else Color_Space_Linear),
None);
ID : constant ID_Type :=
API.Create_Platform_Window_Surface.Ref
(Display.ID, Config.ID, Window, Attributes);
-- TODO Support EGL_EXT_present_opaque
-- (so that background will be opaque; alpha of FB gets ignored)
begin
if ID = No_Surface then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Result : Surface (Display.Platform) do
Result.Reference.ID := ID;
Result.Display := Display;
end return;
end Create_Surface;
function Width (Object : Surface) return Natural is
Result : Int;
begin
if not Boolean (API.Query_Surface (Object.Display.ID, Object.ID, Width, Result)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Natural (Result);
end Width;
function Height (Object : Surface) return Natural is
Result : Int;
begin
if not Boolean (API.Query_Surface (Object.Display.ID, Object.ID, Height, Result)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Natural (Result);
end Height;
function Behavior (Object : Surface) return Swap_Behavior is
Result : Int;
function Convert is new Ada.Unchecked_Conversion
(Source => Int, Target => Swap_Behavior);
begin
if not Boolean (API.Query_Surface
(Object.Display.ID, Object.ID, EGL.Swap_Behavior, Result))
then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Convert (Result);
end Behavior;
procedure Swap_Buffers (Object : Surface) is
begin
if not Boolean (API.Swap_Buffers (Object.Display.ID, Object.ID)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
end Swap_Buffers;
overriding procedure Pre_Finalize (Object : in out Surface) is
No_Surface : constant ID_Type := ID_Type (System.Null_Address);
begin
pragma Assert (Object.ID /= No_Surface);
if not Boolean (API.Destroy_Surface (Object.Display.ID, Object.ID)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.ID := No_Surface;
end Pre_Finalize;
end EGL.Objects.Surfaces;
|
reznikmm/matreshka | Ada | 7,620 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013-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.SAX.File_Input_Sources;
with XML.SAX.Simple_Readers;
with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;
with Ada.Directories;
package body XSD_To_Ada.Mappings.XML is
Map_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("map");
Ada_Tag : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("ada");
Type_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("type");
Multiplicity_Attribute : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String ("multiplicity");
-----------------
-- End_Element --
-----------------
overriding procedure End_Element
(Self : in out Mapping_XML;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean) is
begin
null;
end End_Element;
------------------
-- Error_String --
------------------
overriding function Error_String
(Self : Mapping_XML) return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return League.Strings.Empty_Universal_String;
end Error_String;
------------------
-- Read_Mapping --
------------------
function Read_Mapping
(File_Name : League.Strings.Universal_String)
return XSD_To_Ada.Mappings.XML.Mapping_XML
is
Source : aliased Standard.XML.SAX.File_Input_Sources.File_Input_Source;
Reader : aliased Standard.XML.SAX.Simple_Readers.Simple_Reader;
Handler : aliased XSD_To_Ada.Mappings.XML.Mapping_XML;
begin
Reader.Set_Content_Handler (Handler'Unchecked_Access);
Source.Open_By_File_Name (File_Name);
Reader.Parse (Source'Access);
return Handler;
end Read_Mapping;
------------------------
-- Read_Payload_Types --
------------------------
procedure Read_Payload_Types (File_Path : String)
is
Input_File : Ada.Wide_Wide_Text_IO.File_Type;
begin
if Ada.Directories.Exists (File_Path) then
Ada.Wide_Wide_Text_IO.Open
(Input_File, In_File, File_Path);
while not End_Of_File (Input_File) loop
Payload_Types.Append
(League.Strings.To_Universal_String (Get_Line (Input_File)));
end loop;
else
raise Constraint_Error with "File " & File_Path & "dosen't exist";
end if;
end Read_Payload_Types;
-------------------
-- Start_Element --
-------------------
overriding procedure Start_Element
(Self : in out Mapping_XML;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : Standard.XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean)
is
pragma Unreferenced (Namespace_URI);
pragma Unreferenced (Local_Name);
pragma Unreferenced (Success);
use League.Strings;
Multiplicity : XSD_To_Ada.Mappings.Multiplicity_Kind;
begin
if Qualified_Name = Map_Tag then
Self.Current.Name := Attributes.Value (Type_Attribute);
elsif Qualified_Name = Ada_Tag then
if League.Strings.To_UTF_8_String
(Attributes.Value (Multiplicity_Attribute)) = "Vector"
then
Multiplicity := Vector;
elsif League.Strings.To_UTF_8_String
(Attributes.Value (Multiplicity_Attribute)) = "Optional"
then
Multiplicity := Optional;
else
Multiplicity := Single;
end if;
Self.Current.Multiplicity := Multiplicity;
if Self.Mapping.Contains (Self.Current) then
raise Constraint_Error
with "Duplicate mapping for '"
& Self.Current.Name.To_UTF_8_String & '''
& "/" & Self.Current.Multiplicity'Img;
else
Self.Mapping.Insert
(Self.Current, (Ada_Name => Attributes.Value (Type_Attribute)));
end if;
end if;
end Start_Element;
end XSD_To_Ada.Mappings.XML;
|
reznikmm/matreshka | Ada | 56,296 | 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.
------------------------------------------------------------------------------
package AMF.Internals.Tables.CMOF_Metamodel.Objects is
procedure Initialize;
private
procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_99 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_100 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_101 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_102 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_103 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_104 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_105 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_106 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_107 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_108 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_109 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_110 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_111 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_112 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_113 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_114 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_115 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_116 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_117 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_118 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_119 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_120 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_121 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_122 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_123 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_124 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_125 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_126 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_127 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_128 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_129 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_130 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_131 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_132 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_133 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_134 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_135 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_136 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_137 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_138 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_139 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_140 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_141 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_142 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_143 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_144 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_145 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_146 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_147 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_148 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_149 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_150 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_151 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_152 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_153 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_154 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_155 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_156 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_157 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_158 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_159 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_160 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_161 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_162 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_163 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_164 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_165 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_166 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_167 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_168 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_169 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_170 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_171 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_172 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_173 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_174 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_175 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_176 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_177 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_178 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_179 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_180 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_181 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_182 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_183 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_184 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_185 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_186 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_187 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_188 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_189 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_190 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_191 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_192 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_193 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_194 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_195 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_196 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_197 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_198 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_199 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_200 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_201 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_202 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_203 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_204 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_205 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_206 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_207 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_208 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_209 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_210 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_211 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_212 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_213 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_214 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_215 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_216 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_217 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_218 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_219 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_220 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_221 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_222 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_223 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_224 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_225 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_226 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_227 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_228 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_229 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_230 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_231 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_232 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_233 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_234 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_235 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_236 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_237 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_238 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_239 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_240 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_241 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_242 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_243 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_244 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_245 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_246 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_247 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_248 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_249 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_250 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_251 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_252 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_253 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_254 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_255 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_256 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_257 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_258 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_259 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_260 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_261 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_262 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_263 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_264 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_265 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_266 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_267 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_268 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_269 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_270 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_271 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_272 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_273 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_274 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_275 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_276 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_277 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_278 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_279 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_280 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_281 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_282 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_283 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_284 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_285 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_286 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_287 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_288 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_289 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_290 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_291 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_292 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_293 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_294 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_295 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_296 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_297 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_298 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_299 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_300 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_301 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_302 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_303 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_304 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_305 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_306 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_307 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_308 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_309 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_310 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_311 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_312 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_313 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_314 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_315 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_316 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_317 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_318 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_319 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_320 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_321 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_322 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_323 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_324 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_325 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_326 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_327 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_328 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_329 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_330 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_331 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_332 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_333 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_334 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_335 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_336 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_337 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_338 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_339 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_340 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_341 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_342 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_343 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_344 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_345 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_346 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_347 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_348 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_349 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_350 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_351 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_352 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_353 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_354 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_355 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_356 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_357 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_358 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_359 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_360 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_361 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_362 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_363 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_364 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_365 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_366 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_367 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_368 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_369 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_370 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_371 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_372 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_373 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_374 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_375 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_376 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_377 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_378 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_379 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_380 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_381 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_382 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_383 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_384 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_385 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_386 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_387 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_388 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_389 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_390 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_391 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_392 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_393 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_394 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_395 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_396 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_397 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_398 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_399 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_400 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_401 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_402 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_403 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_404 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_405 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_406 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_407 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_408 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_409 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_410 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_411 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_412 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_413 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_414 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_415 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_416 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_417 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_418 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_419 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_420 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_421 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_422 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_423 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_424 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_425 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_426 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_427 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_428 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_429 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_430 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_431 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_432 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_433 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_434 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_435 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_436 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_437 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_438 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_439 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_440 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_441 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_442 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_443 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_444 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_445 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_446 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_447 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_448 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_449 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_450 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_451 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_452 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_453 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_454 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_455 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_456 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_457 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_458 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_459 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_460 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_461 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_462 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_463 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_464 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_465 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_466 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_467 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_468 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_469 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_470 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_471 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_472 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_473 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_474 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_475 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_476 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_477 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_478 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_479 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_480 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_481 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_482 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_483 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_484 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_485 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_486 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_487 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_488 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_489 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_490 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_491 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_492 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_493 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_494 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_495 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_496 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_497 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_498 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_499 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_500 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_501 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_502 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_503 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_504 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_505 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_506 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_507 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_508 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_509 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_510 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_511 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_512 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_513 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_514 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_515 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_516 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_517 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_518 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_519 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_520 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_521 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_522 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_523 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_524 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_525 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_526 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_527 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_528 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_529 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_530 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_531 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_532 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_533 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_534 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_535 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_536 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_537 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_538 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_539 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_540 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_541 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_542 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_543 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_544 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_545 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_546 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_547 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_548 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_549 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_550 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_551 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_552 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_553 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_554 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_555 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_556 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_557 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_558 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_559 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_560 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_561 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_562 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_563 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_564 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_565 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_566 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_567 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_568 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_569 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_570 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_571 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_572 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_573 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_574 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_575 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_576 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_577 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_578 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_579 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_580 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_581 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_582 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_583 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_584 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_585 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_586 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_587 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_588 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_589 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_590 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_591 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_592 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_593 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_594 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_595 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_596 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_597 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_598 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_599 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_600 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_601 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_602 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_603 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_604 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_605 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_606 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_607 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_608 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_609 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_610 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_611 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_612 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_613 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_614 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_615 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_616 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_617 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_618 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_619 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_620 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_621 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_622 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_623 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_624 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_625 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_626 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_627 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_628 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_629 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_630 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_631 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_632 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_633 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_634 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_635 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_636 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_637 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_638 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_639 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_640 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_641 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_642 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_643 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_644 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_645 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_646 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_647 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_648 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_649 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_650 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_651 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_652 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_653 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_654 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_655 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_656 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_657 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_658 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_659 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_660 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_661 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_662 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_663 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_664 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_665 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_666 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_667 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_668 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_669 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_670 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_671 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_672 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_673 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_674 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_675 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_676 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_677 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_678 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_679 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_680 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_681 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_682 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_683 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_684 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_685 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_686 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_687 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_688 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_689 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_690 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_691 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_692 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_693 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_694 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_695 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_696 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_697 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_698 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_699 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_700 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_701 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_702 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_703 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_704 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_705 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_706 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_707 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_708 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_709 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_710 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_711 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_712 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_713 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_714 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_715 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_716 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_717 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_718 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_719 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_720 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_721 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_722 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_723 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_724 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_725 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_726 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_727 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_728 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_729 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_730 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_731 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_732 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_733 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_734 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_735 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_736 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_737 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_738 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_739 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_740 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_741 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_742 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_743 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_744 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_745 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_746 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_747 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_748 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_749 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_750 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_751 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_752 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_753 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_754 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_755 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_756 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_757 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_758 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_759 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_760 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_761 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_762 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_763 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_764 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_765 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_766 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_767 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_768 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_769 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_770 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_771 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_772 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_773 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_774 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_775 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_776 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_777 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_778 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_779 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_780 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_781 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_782 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_783 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_784 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_785 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_786 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_787 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_788 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_789 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_790 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_791 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_792 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_793 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_794 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_795 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_796 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_797 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_798 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_799 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_800 (Extent : AMF.Internals.AMF_Extent);
end AMF.Internals.Tables.CMOF_Metamodel.Objects;
|
usainzg/EHU | Ada | 1,977 | adb | WITH Ada.Text_IO;
USE Ada.Text_IO;
WITH Salas, Cine;
USE Salas;
PROCEDURE Probar_Cines IS
S1,
S2,
S3,
S4,
S5 : Salas.Sala;
BEGIN
S1 := Crear_Sala(" Ava ", 12,18);
Modificar_Pelicula(S1, "FormaDAgua");
S2 := Crear_Sala("Marilyn", 12,18);
Modificar_Pelicula(S2,"BlackPanth");
S3 := Crear_Sala("Audrey ", 11,10);
Modificar_Pelicula(S3,"HiloInvisi");
S4 := Crear_Sala("Hepburn", 11,10);
Modificar_Pelicula(S4,"CuaderSara");
S5 := Crear_Sala(" Rita ", 11,10);
Modificar_Pelicula(S5,"HiloInvisi");
Cine.Crear_Cine(" Golem ");
Cine.Anadir_Sala(S1);
Cine.Anadir_Sala(S2);
Cine.Anadir_Sala(S3);
Cine.Anadir_Sala(S4);
Cine.Anadir_Sala(S5);
Cine.Mostrar_Salas;
Cine.Mostrar_Cartelera;
New_Line;
New_Line;
Cine.Vender_Localidades_Contiguas("HiloInvisi", 9);
Cine.Vender_Localidades_Contiguas( "HiloInvisi" ,8);
Cine.Vender_Localidades_Contiguas( "HiloInvisi", 7);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 6);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 5);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 10);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 6);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 3);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 10);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 10);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 10);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 10);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 6);
Cine.Vender_Localidades_Contiguas("HiloInvisi", 6);
Cine.Vender_Localidades_Contiguas("CuaderSara", 10);
Cine.Vender_Localidades_Contiguas("CuaderSara", 10);
Cine.Vender_Localidades_Contiguas("CuaderSara", 10);
Cine.Vender_Localidades_Contiguas("CuaderSara", 10);
Cine.Mostrar_Salas;
Cine.Cambiar_Peliculas("HiloInvisi", "SinPelicul");
Cine.Mostrar_Cartelera;
END Probar_Cines;
|
reznikmm/matreshka | Ada | 4,737 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Number.Transliteration_Language_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Number_Transliteration_Language_Attribute_Node is
begin
return Self : Number_Transliteration_Language_Attribute_Node do
Matreshka.ODF_Number.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Number_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Number_Transliteration_Language_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Transliteration_Language_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Number_URI,
Matreshka.ODF_String_Constants.Transliteration_Language_Attribute,
Number_Transliteration_Language_Attribute_Node'Tag);
end Matreshka.ODF_Number.Transliteration_Language_Attributes;
|
stcarrez/mat | Ada | 14,797 | adb | -----------------------------------------------------------------------
-- mat-events-targets - Events received and collected from a target
-- Copyright (C) 2014, 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.Unchecked_Deallocation;
package body MAT.Events.Targets is
ITERATE_COUNT : constant Event_Id_Type := 10_000;
-- ------------------------------
-- Add the event in the list of events and increment the event counter.
-- Update the event instance to allocate the event Id.
-- ------------------------------
procedure Insert (Target : in out Target_Events;
Event : in out Target_Event_Type) is
begin
Target.Events.Insert (Event);
Util.Concurrent.Counters.Increment (Target.Event_Count);
end Insert;
-- ------------------------------
-- Update the Size and Prev_Id information in the event identified by <tt>Id</tt>.
-- Update the event represented by <tt>Prev_Id</tt> so that its Next_Id refers
-- to the <tt>Id</tt> event.
-- ------------------------------
procedure Update_Event (Target : in out Target_Events;
Id : in Event_Id_Type;
Size : in MAT.Types.Target_Size;
Prev_Id : in Event_Id_Type) is
begin
Target.Events.Update_Event (Id, Size, Prev_Id);
end Update_Event;
procedure Get_Events (Target : in out Target_Events;
Start : in MAT.Types.Target_Time;
Finish : in MAT.Types.Target_Time;
Into : in out MAT.Events.Tools.Target_Event_Vector) is
begin
Target.Events.Get_Events (Start, Finish, Into);
end Get_Events;
-- ------------------------------
-- Get the start and finish time for the events that have been received.
-- ------------------------------
procedure Get_Time_Range (Target : in out Target_Events;
Start : out MAT.Types.Target_Time;
Finish : out MAT.Types.Target_Time) is
begin
Target.Events.Get_Time_Range (Start, Finish);
end Get_Time_Range;
-- ------------------------------
-- Get the first and last event that have been received.
-- ------------------------------
procedure Get_Limits (Target : in out Target_Events;
First : out Target_Event_Type;
Last : out Target_Event_Type) is
begin
Target.Events.Get_Limits (First, Last);
end Get_Limits;
-- ------------------------------
-- Get the probe event with the given allocated unique id.
-- ------------------------------
function Get_Event (Target : in Target_Events;
Id : in Event_Id_Type) return Target_Event_Type is
begin
return Target.Events.Get_Event (Id);
end Get_Event;
-- ------------------------------
-- Get the current event counter.
-- ------------------------------
function Get_Event_Counter (Target : in Target_Events) return Integer is
begin
return Util.Concurrent.Counters.Value (Target.Event_Count);
end Get_Event_Counter;
-- ------------------------------
-- Iterate over the events starting from the <tt>Start</tt> event and until the
-- <tt>Finish</tt> event is found (inclusive). Execute the <tt>Process</tt> procedure
-- with each event instance.
-- ------------------------------
procedure Iterate (Target : in out Target_Events;
Start : in Event_Id_Type;
Finish : in Event_Id_Type;
Process : access procedure (Event : in Target_Event_Type)) is
begin
Target.Events.Iterate (Start, Finish, Process);
end Iterate;
-- ------------------------------
-- Iterate over the events starting from first first event up to the last event collected.
-- Execute the <tt>Process</tt> procedure with each event instance.
-- ------------------------------
procedure Iterate (Target : in out Target_Events;
Process : access procedure (Event : in Target_Event_Type)) is
First_Event : Target_Event_Type;
Last_Event : Target_Event_Type;
First_Id : Event_Id_Type;
begin
Target.Get_Limits (First_Event, Last_Event);
First_Id := First_Event.Id;
while First_Id < Last_Event.Id loop
-- Iterate over the events in groups of 10_000 to release the lock and give some
-- opportunity to the server thread to add new events.
Target.Iterate (Start => First_Id,
Finish => First_Id + ITERATE_COUNT,
Process => Process);
First_Id := First_Id + ITERATE_COUNT;
end loop;
end Iterate;
-- ------------------------------
-- Release the storage allocated for the events.
-- ------------------------------
overriding
procedure Finalize (Target : in out Target_Events) is
begin
Target.Events.Clear;
end Finalize;
protected body Event_Collector is
procedure Update (Id : in Event_Id_Type;
Process : not null access procedure (Event : in out Target_Event_Type));
-- ------------------------------
-- Internal operation to update the event represented by <tt>Id</tt>.
-- ------------------------------
procedure Update (Id : in Event_Id_Type;
Process : not null access procedure (Event : in out Target_Event_Type)) is
Iter : constant Event_Id_Cursor := Ids.Floor (Id);
Block : Event_Block_Access;
Pos : Event_Id_Type;
begin
if Event_Id_Maps.Has_Element (Iter) then
Block := Event_Id_Maps.Element (Iter);
Pos := Id - Block.Events (Block.Events'First).Id + Block.Events'First;
if Pos <= Block.Count then
Process (Block.Events (Pos));
end if;
end if;
end Update;
-- ------------------------------
-- Update the Size and Prev_Id information in the event identified by <tt>Id</tt>.
-- Update the event represented by <tt>Prev_Id</tt> so that its Next_Id refers
-- to the <tt>Id</tt> event.
-- ------------------------------
procedure Update_Event (Id : in Event_Id_Type;
Size : in MAT.Types.Target_Size;
Prev_Id : in Event_Id_Type) is
procedure Update_Size (Event : in out Target_Event_Type);
procedure Update_Next (Event : in out Target_Event_Type);
procedure Update_Size (Event : in out Target_Event_Type) is
begin
if Event.Index = MSG_REALLOC then
Event.Old_Size := Size;
else
Event.Size := Size;
end if;
Event.Prev_Id := Prev_Id;
end Update_Size;
procedure Update_Next (Event : in out Target_Event_Type) is
begin
Event.Next_Id := Id;
end Update_Next;
begin
Update (Id, Update_Size'Access);
Update (Prev_Id, Update_Next'Access);
end Update_Event;
-- ------------------------------
-- Add the event in the list of events.
-- Update the event instance to allocate the event Id.
-- ------------------------------
procedure Insert (Event : in out Target_Event_Type) is
begin
if Current = null then
Current := new Event_Block;
Current.Start := Event.Time;
Events.Insert (Event.Time, Current);
Ids.Insert (Last_Id, Current);
end if;
Event.Id := Last_Id;
Current.Count := Current.Count + 1;
Current.Events (Current.Count) := Event;
Last_Id := Last_Id + 1;
Current.Finish := Event.Time;
if Current.Count = Current.Events'Last then
Current := null;
end if;
end Insert;
procedure Get_Events (Start : in MAT.Types.Target_Time;
Finish : in MAT.Types.Target_Time;
Into : in out MAT.Events.Tools.Target_Event_Vector) is
Iter : Event_Cursor := Events.Floor (Start);
Block : Event_Block_Access;
begin
while Event_Maps.Has_Element (Iter) loop
Block := Event_Maps.Element (Iter);
exit when Block.Start > Finish;
for I in Block.Events'First .. Block.Count loop
exit when Block.Events (I).Time > Finish;
if Block.Events (I).Time >= Start then
Into.Append (Block.Events (I));
end if;
end loop;
Event_Maps.Next (Iter);
end loop;
end Get_Events;
-- ------------------------------
-- Get the start and finish time for the events that have been received.
-- ------------------------------
procedure Get_Time_Range (Start : out MAT.Types.Target_Time;
Finish : out MAT.Types.Target_Time) is
First : constant Event_Block_Access := Events.First_Element;
Last : constant Event_Block_Access := Events.Last_Element;
begin
Start := First.Events (First.Events'First).Time;
Finish := Last.Events (Last.Count).Time;
end Get_Time_Range;
-- ------------------------------
-- Get the first and last event that have been received.
-- ------------------------------
procedure Get_Limits (First : out Target_Event_Type;
Last : out Target_Event_Type) is
First_Block : constant Event_Block_Access := Events.First_Element;
Last_Block : constant Event_Block_Access := Events.Last_Element;
begin
First := First_Block.Events (First_Block.Events'First);
Last := Last_Block.Events (Last_Block.Count);
end Get_Limits;
-- ------------------------------
-- Get the probe event with the given allocated unique id.
-- ------------------------------
function Get_Event (Id : in Event_Id_Type) return Target_Event_Type is
Iter : Event_Id_Cursor := Ids.Floor (Id);
Block : Event_Block_Access;
Pos : Event_Id_Type;
begin
while Event_Id_Maps.Has_Element (Iter) loop
Block := Event_Id_Maps.Element (Iter);
exit when Id < Block.Events (Block.Events'First).Id;
Pos := Id - Block.Events (Block.Events'First).Id + Block.Events'First;
if Pos <= Block.Count then
return Block.Events (Pos);
end if;
Event_Id_Maps.Next (Iter);
end loop;
raise MAT.Events.Tools.Not_Found;
end Get_Event;
-- ------------------------------
-- Iterate over the events starting from the <tt>Start</tt> event and until the
-- <tt>Finish</tt> event is found (inclusive). Execute the <tt>Process</tt> procedure
-- with each event instance.
-- ------------------------------
procedure Iterate (Start : in Event_Id_Type;
Finish : in Event_Id_Type;
Process : access procedure (Event : in Target_Event_Type)) is
Iter : Event_Id_Cursor := Ids.Floor (Start);
Block : Event_Block_Access;
Pos : Event_Id_Type;
Id : Event_Id_Type := Start;
begin
-- First, find the block and position of the first event.
while Event_Id_Maps.Has_Element (Iter) loop
Block := Event_Id_Maps.Element (Iter);
exit when Id < Block.Events (Block.Events'First).Id;
Pos := Id - Block.Events (Block.Events'First).Id + Block.Events'First;
if Start <= Finish then
if Pos <= Block.Count then
-- Second, iterate over the events moving to the next event block
-- until we reach the last event.
loop
Process (Block.Events (Pos));
exit when Id > Finish;
Pos := Pos + 1;
Id := Id + 1;
if Pos > Block.Count then
Event_Id_Maps.Next (Iter);
exit when not Event_Id_Maps.Has_Element (Iter);
Block := Event_Id_Maps.Element (Iter);
Pos := Block.Events'First;
end if;
end loop;
end if;
Event_Id_Maps.Next (Iter);
else
if Pos <= Block.Count then
-- Second, iterate over the events moving to the next event block
-- until we reach the last event.
loop
Process (Block.Events (Pos));
exit when Id <= Finish;
Id := Id - 1;
if Pos = Block.Events'First then
Event_Id_Maps.Previous (Iter);
exit when not Event_Id_Maps.Has_Element (Iter);
Block := Event_Id_Maps.Element (Iter);
Pos := Block.Count;
else
Pos := Pos - 1;
end if;
end loop;
end if;
Event_Id_Maps.Previous (Iter);
end if;
end loop;
end Iterate;
-- ------------------------------
-- Clear the events.
-- ------------------------------
procedure Clear is
procedure Free is
new Ada.Unchecked_Deallocation (Event_Block, Event_Block_Access);
begin
while not Events.Is_Empty loop
declare
Block : Event_Block_Access := Events.First_Element;
begin
Free (Block);
Events.Delete_First;
end;
end loop;
Current := null;
Last_Id := 0;
Ids.Clear;
end Clear;
end Event_Collector;
end MAT.Events.Targets;
|
BrickBot/Bound-T-H8-300 | Ada | 7,456 | adb | -- Flow.Life.Show (body)
--
-- 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.4 $
-- $Date: 2015/10/24 20:05:48 $
--
-- $Log: flow-life-show.adb,v $
-- Revision 1.4 2015/10/24 20:05:48 niklas
-- Moved to free licence.
--
-- Revision 1.3 2007-02-13 20:15:49 Niklas
-- BT-CH-0044.
--
-- Revision 1.2 2005/09/16 13:02:37 niklas
-- Extended Show_Per_Node to display the edge indices.
--
-- Revision 1.1 2005/09/12 19:02:59 niklas
-- BT-CH-0008.
--
with Ada.Text_IO;
with Flow.Computation;
with Flow.Computation.Show;
package body Flow.Life.Show is
use Ada.Text_IO;
procedure Show_Intro
--
-- Outputs the introductory text.
--
is
begin
Put_Line (
"A '"
& Computation.Show.Feasible_Mark(True)
& "' means feasible, a '"
& Computation.Show.Feasible_Mark(False)
& "' means infeasible.");
New_Line;
end Show_Intro;
procedure Show_Step (
Step : in Step_Index_T;
Living : in Living_T;
Margin_Col : in Ada.Text_IO.Positive_Count;
Effect_Col : in Ada.Text_IO.Positive_Count)
--
-- Displays the "live" effect of the given Step.
--
is
Live : constant Arithmetic.Assignment_List_T :=
Live_Assignments (Step, Living);
-- The "live" assignments.
Dead : constant Arithmetic.Assignment_List_T :=
Dead_Definitions (Step, Living);
-- The "dead" Defining assignments.
begin
Set_Col (Margin_Col);
Put (Computation.Show.Feasible_Mark(Computation.Is_Feasible (
Step, Model (Living).all)));
Put (Step_Index_T'Image (Step));
Set_Col (Effect_Col);
Put (Arithmetic.Image (Live));
if Dead'Length > 0 then
Put ("; dead def");
for D in Dead'Range loop
Put (' ');
Put (Arithmetic.Image (Dead(D).Target));
end loop;
end if;
New_Line;
end Show_Step;
procedure Show_Per_Node (Living : in Living_T)
--
-- Displays the Living effects, taking the current Col position
-- as the left margin for each line (some lines may be more indented).
--
-- The output is ordered by node index, with the steps in each node
-- ordered in flow sequence.
is
Node_Margin : constant Positive_Count := Col;
-- The current column is taken as the left margin.
Step_Margin : constant Positive_Count := Node_Margin + 10;
-- The column for starting the display of steps.
Effect_Col : constant Positive_Count := Step_Margin + 8;
-- The column for the Effect of each step.
Edge_Margin : constant Positive_Count := Node_Margin + 5;
-- The column for starting the display of an out-edge.
Graph : constant Graph_T := Flow.Life.Graph (Living);
-- The underlying flow-graph.
Node : Node_T;
-- The current node in the Graph.
procedure Show (Steps : in Step_List_T)
--
-- Shows the "live" effect of all the steps in a node.
--
is
begin
for S in Steps'Range loop
Show_Step (
Step => Index (Steps(S)),
Living => Living,
Margin_Col => Step_Margin,
Effect_Col => Effect_Col);
end loop;
end Show;
procedure Show (Edges : in Edge_List_T)
--
-- Shows the edges that leave the node.
--
is
Edge : Edge_T;
-- One of the Edges.
begin
for E in Edges'Range loop
Edge := Edges(E);
Set_Col (Edge_Margin);
Put (Computation.Show.Feasible_Mark(
Computation.Is_Feasible (Edge, Model (Living).all)));
Put (" ->");
Put (Node_Index_T'Image (Index (Target (Edge))));
Put_Line (
" when "
& Arithmetic.Image (
Computation.Condition (Edge, Model (Living).all))
& ", edge"
& Edge_Index_T'Image (Index (Edge)));
end loop;
if Edges'Length = 0 then
Set_Col (Edge_Margin);
Put_Line ("stop");
end if;
end Show;
begin -- Show_Per_Node
Put_Line ("Live arithmetic effects per node:");
Show_Intro;
Set_Col (Node_Margin); Put ("Node");
Set_Col (Step_Margin); Put ("Step");
Set_Col (Effect_Col ); Put ("Effect");
New_Line;
for N in 1 .. Max_Node (Graph) loop
Node := Node_At (N, Graph);
Set_Col (Node_Margin);
Put (Computation.Show.Feasible_Mark(Computation.Is_Feasible (
Node, Model (Living).all)));
Put (Node_Index_T'Image (N));
Show (Steps => Steps_In (Node));
Show (Edges => Edges_From (Node, Graph));
end loop;
New_Line;
end Show_Per_Node;
procedure Show_Per_Step (Living : in Living_T)
is
Margin : constant Positive_Count := Col;
-- The current column is taken as the left margin.
Effect_Col : constant Positive_Count := Margin + 8;
-- The column for the Effect of each step.
Graph : constant Graph_T := Flow.Life.Graph (Living);
-- The underlying flow-graph.
begin
Put_Line ("Live arithmetic effects per step:");
Show_Intro;
Set_Col (Margin);
Put ("Step"); Set_Col (Effect_Col); Put_Line ("Effect");
for S in 1 .. Max_Step (Graph) loop
Show_Step (
Step => S,
Living => Living,
Margin_Col => Margin,
Effect_Col => Effect_Col);
end loop;
New_Line;
end Show_Per_Step;
end Flow.Life.Show;
|
tum-ei-rcs/StratoX | Ada | 4,163 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . M E M O R Y --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- 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 is a simplified version of this package, for use with a configurable
-- run-time library that does not provide Ada tasking. It does not provide
-- any deallocation routine.
-- This package provides the low level memory allocation/deallocation
-- mechanisms used by GNAT.
package System.Memory
with SPARK_Mode => On is
pragma Elaborate_Body;
type size_t is mod 2 ** Standard'Address_Size;
-- Note: the reason we redefine this here instead of using the
-- definition in Interfaces.C is that we do not want to drag in
-- all of Interfaces.C just because System.Memory is used.
function Alloc (Size : size_t) return System.Address;
-- This is the low level allocation routine. Given a size in storage
-- units, it returns the address of a maximally aligned block of
-- memory.
--
-- A first check is performed to discard memory allocations that are
-- obviously too big, preventing problems of memory wraparound. If Size is
-- greater than the maximum number of storage elements (taking into account
-- the maximum alignment) in the machine, then a Storage_Error exception is
-- raised before trying to perform the memory allocation.
--
-- If Size is set to zero on entry, then a minimal (but non-zero)
-- size block is allocated.
--
-- If there is not enough free memory on the heap for the requested
-- allocation then a Storage_Error exception is raised and the heap remains
-- unchanged.
--
-- Note: this is roughly equivalent to the standard C malloc call
-- with the additional semantics as described above.
private
pragma SPARK_Mode (Off);
-- The following names are used from the generated compiler code
pragma Export (C, Alloc, "__gnat_malloc");
end System.Memory;
|
michalkonecny/polypaver | Ada | 196 | ads | package PP_Integer is
--# function Is_Integer(Variable : Integer) return Boolean;
--# function Is_Range(Variable : Integer; Min : Integer; Max : Integer) return Boolean;
end PP_Integer;
|
strenkml/EE368 | Ada | 1,152 | ads |
package Memory.Transform.EOR is
type EOR_Type is new Transform_Type with private;
type EOR_Pointer is access all EOR_Type'Class;
function Create_EOR return EOR_Pointer;
function Random_EOR(next : access Memory_Type'Class;
generator : Distribution_Type;
max_cost : Cost_Type) return Memory_Pointer;
overriding
function Clone(mem : EOR_Type) return Memory_Pointer;
overriding
procedure Permute(mem : in out EOR_Type;
generator : in Distribution_Type;
max_cost : in Cost_Type);
overriding
function Is_Empty(mem : EOR_Type) return Boolean;
overriding
function Get_Name(mem : EOR_Type) return String;
private
type EOR_Type is new Transform_Type with null record;
overriding
function Apply(mem : EOR_Type;
address : Address_Type;
dir : Boolean) return Address_Type;
overriding
function Get_Alignment(mem : EOR_Type) return Positive;
overriding
function Get_Transform_Length(mem : EOR_Type) return Natural;
end Memory.Transform.EOR;
|
cborao/Ada-P2 | Ada | 205 | ads |
--PRÁCTICA 2: César Borao Moratinos (chat_messages)
package Chat_Messages is
type Message_Type is (Init, Writer, Server, Collection_Request, Collection_Data, Ban, Shutdown);
end Chat_Messages;
|
scls19fr/openphysic | Ada | 11,039 | ads | -- Instantiating this package:
-- To instantiate this package, you must include the following
-- as parameters:
--
-- the base floating-point type used as real/imaginary components
-- the real vector type defined using this base type
-- the real matrix type defined using this base type
-- the complex type based on the base floating-point type
--
-- The complex array operations and complex number operations must also
-- be visible at the point of instantiation of the complex array package,
-- to allow them to be inherited.
--
-- Example:
--
-- package Real_Arrays is new Generic_Real_Arrays(Float);
-- package Complex_Types is new Ada.Numerics.Generic_Complex_Types(Float);
-- use Real_Arrays;
-- use Complex_Types;
-- package Complex_Arrays is new Generic_Complex_Arrays(Float,
-- Real_Vector,
-- Real_Matrix,
-- Complex);
with ARRAY_EXCEPTIONS, ADA.NUMERICS;
generic
type REAL is digits <>;
type REAL_VECTOR is array (INTEGER range <>) of REAL;
type REAL_MATRIX is array (INTEGER range <>,
INTEGER range <>) of REAL;
type COMPLEX is private;
with function RE (X : COMPLEX) return REAL is <>;
with function IM (X : COMPLEX) return REAL is <>;
with procedure SET_RE (X : in out COMPLEX;
RE : in REAL) is <>;
with procedure SET_IM (X : in out COMPLEX;
IM : in REAL) is <>;
with function COMPOSE_FROM_CARTESIAN
(RE, IM : REAL) return COMPLEX is <>;
with function MODULUS (X : COMPLEX) return REAL is <>;
with function ARGUMENT (X : COMPLEX) return REAL is <>;
with function ARGUMENT (X : COMPLEX;
CYCLE : REAL) return REAL is <>;
with function COMPOSE_FROM_POLAR
(MODULUS, ARGUMENT : REAL) return COMPLEX is <>;
with function COMPOSE_FROM_POLAR
(MODULUS, ARGUMENT, CYCLE : REAL) return COMPLEX is <>;
with function "-" (RIGHT : COMPLEX) return COMPLEX is <>;
with function CONJUGATE (X : COMPLEX) return COMPLEX is <>;
with function "+" (LEFT, RIGHT : COMPLEX) return COMPLEX is <>;
with function "-" (LEFT, RIGHT : COMPLEX) return COMPLEX is <>;
with function "*" (LEFT, RIGHT : COMPLEX) return COMPLEX is <>;
with function "/" (LEFT, RIGHT : COMPLEX) return COMPLEX is <>;
with function "**" (LEFT : COMPLEX;
RIGHT : INTEGER) return COMPLEX is <>;
with function "+" (LEFT : REAL;
RIGHT : COMPLEX) return COMPLEX is <>;
with function "-" (LEFT : REAL;
RIGHT : COMPLEX) return COMPLEX is <>;
with function "*" (LEFT : REAL;
RIGHT : COMPLEX) return COMPLEX is <>;
with function "/" (LEFT : REAL;
RIGHT : COMPLEX) return COMPLEX is <>;
with function "/" (LEFT : COMPLEX;
RIGHT : REAL) return COMPLEX is <>;
package GENERIC_COMPLEX_ARRAYS is
-- TYPES --
type COMPLEX_VECTOR is array (INTEGER range <>) of COMPLEX;
type COMPLEX_MATRIX is array (INTEGER range <>,
INTEGER range <>) of COMPLEX;
-- SUBPROGRAMS for COMPLEX_VECTOR types --
-- COMPLEX_VECTOR selection, conversion and composition operations --
function RE (X : COMPLEX_VECTOR) return REAL_VECTOR;
function IM (X : COMPLEX_VECTOR) return REAL_VECTOR;
procedure SET_RE (X : in out COMPLEX_VECTOR;
RE : in REAL_VECTOR);
procedure SET_IM (X : in out COMPLEX_VECTOR;
IM : in REAL_VECTOR);
function COMPOSE_FROM_CARTESIAN
(RE : REAL_VECTOR) return COMPLEX_VECTOR;
function COMPOSE_FROM_CARTESIAN
(RE, IM : REAL_VECTOR) return COMPLEX_VECTOR;
function MODULUS (X : COMPLEX_VECTOR) return REAL_VECTOR;
function "abs" (RIGHT : COMPLEX_VECTOR) return REAL_VECTOR
renames MODULUS;
function ARGUMENT (X : COMPLEX_VECTOR) return REAL_VECTOR;
function ARGUMENT (X : COMPLEX_VECTOR;
CYCLE : REAL) return REAL_VECTOR;
function COMPOSE_FROM_POLAR
(MODULUS, ARGUMENT : REAL_VECTOR) return COMPLEX_VECTOR;
function COMPOSE_FROM_POLAR
(MODULUS, ARGUMENT : REAL_VECTOR;
CYCLE : REAL) return COMPLEX_VECTOR;
-- COMPLEX_VECTOR arithmetic operations --
function "+" (RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "-" (RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function CONJUGATE (X : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "+" (LEFT, RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "-" (LEFT, RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT, RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "/" (LEFT, RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "**" (LEFT : COMPLEX_VECTOR;
RIGHT : INTEGER) return COMPLEX_VECTOR;
function "*" (LEFT, RIGHT : COMPLEX_VECTOR) return COMPLEX;
-- Mixed REAL_VECTOR and COMPLEX_VECTOR arithmetic operations --
function "+" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "+" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_VECTOR) return COMPLEX_VECTOR;
function "-" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "-" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_VECTOR) return COMPLEX_VECTOR;
function "/" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "/" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_VECTOR) return COMPLEX;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_VECTOR) return COMPLEX;
-- COMPLEX_VECTOR scaling operations --
function "*" (LEFT : COMPLEX;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : COMPLEX) return COMPLEX_VECTOR;
function "/" (LEFT : COMPLEX_VECTOR;
RIGHT : COMPLEX) return COMPLEX_VECTOR;
function "*" (LEFT : REAL;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL) return COMPLEX_VECTOR;
function "/" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL) return COMPLEX_VECTOR;
-- Other COMPLEX_VECTOR operations --
function UNIT_VECTOR (INDEX : INTEGER;
ORDER : POSITIVE;
FIRST : INTEGER := 1) return COMPLEX_VECTOR;
-- SUBPROGRAMS for COMPLEX_MATRIX TYPES --
-- COMPLEX_MATRIX selection, conversion and composition operations --
function RE (X : COMPLEX_MATRIX) return REAL_MATRIX;
function IM (X : COMPLEX_MATRIX) return REAL_MATRIX;
procedure SET_RE (X : in out COMPLEX_MATRIX;
RE : in REAL_MATRIX);
procedure SET_IM (X : in out COMPLEX_MATRIX;
IM : in REAL_MATRIX);
function COMPOSE_FROM_CARTESIAN
(RE : REAL_MATRIX) return COMPLEX_MATRIX;
function COMPOSE_FROM_CARTESIAN
(RE, IM : REAL_MATRIX) return COMPLEX_MATRIX;
function MODULUS (X : COMPLEX_MATRIX) return REAL_MATRIX;
function "abs" (RIGHT : COMPLEX_MATRIX) return REAL_MATRIX
renames MODULUS;
function ARGUMENT (X : COMPLEX_MATRIX) return REAL_MATRIX;
function ARGUMENT (X : COMPLEX_MATRIX;
CYCLE : REAL) return REAL_MATRIX;
function COMPOSE_FROM_POLAR
(MODULUS, ARGUMENT : REAL_MATRIX) return COMPLEX_MATRIX;
function COMPOSE_FROM_POLAR
(MODULUS, ARGUMENT : REAL_MATRIX;
CYCLE : REAL) return COMPLEX_MATRIX;
-- COMPLEX_MATRIX arithmetic operations --
function "+" (RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "-" (RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function CONJUGATE (X : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function TRANSPOSE (X : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "+" (LEFT, RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "-" (LEFT, RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT, RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT, RIGHT : COMPLEX_VECTOR) return COMPLEX_MATRIX;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : COMPLEX_MATRIX) return COMPLEX_VECTOR;
function "*" (LEFT : COMPLEX_MATRIX;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
-- Mixed REAL_MATRIX and COMPLEX_MATRIX arithmetic operations --
function "+" (LEFT : REAL_MATRIX;
RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "+" (LEFT : COMPLEX_MATRIX;
RIGHT : REAL_MATRIX) return COMPLEX_MATRIX;
function "-" (LEFT : REAL_MATRIX;
RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "-" (LEFT : COMPLEX_MATRIX;
RIGHT : REAL_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT : REAL_MATRIX;
RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT : COMPLEX_MATRIX;
RIGHT : REAL_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_VECTOR) return COMPLEX_MATRIX;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_VECTOR) return COMPLEX_MATRIX;
function "*" (LEFT : REAL_VECTOR;
RIGHT : COMPLEX_MATRIX) return COMPLEX_VECTOR;
function "*" (LEFT : COMPLEX_VECTOR;
RIGHT : REAL_MATRIX) return COMPLEX_VECTOR;
function "*" (LEFT : REAL_MATRIX;
RIGHT : COMPLEX_VECTOR) return COMPLEX_VECTOR;
function "*" (LEFT : COMPLEX_MATRIX;
RIGHT : REAL_VECTOR) return COMPLEX_VECTOR;
-- COMPLEX_MATRIX scaling operations --
function "*" (LEFT : COMPLEX;
RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT : COMPLEX_MATRIX;
RIGHT : COMPLEX) return COMPLEX_MATRIX;
function "/" (LEFT : COMPLEX_MATRIX;
RIGHT : COMPLEX) return COMPLEX_MATRIX;
function "*" (LEFT : REAL; RIGHT : COMPLEX_MATRIX) return COMPLEX_MATRIX;
function "*" (LEFT : COMPLEX_MATRIX;
RIGHT : REAL) return COMPLEX_MATRIX;
function "/" (LEFT : COMPLEX_MATRIX;
RIGHT : REAL) return COMPLEX_MATRIX;
-- Other COMPLEX_MATRIX operations --
function IDENTITY_MATRIX (ORDER : POSITIVE;
FIRST_1, FIRST_2 : INTEGER := 1) return COMPLEX_MATRIX;
-- EXCEPTIONS --
ARGUMENT_ERROR: exception renames ADA.NUMERICS.ARGUMENT_ERROR;
ARRAY_INDEX_ERROR: exception renames ARRAY_EXCEPTIONS.ARRAY_INDEX_ERROR;
end GENERIC_COMPLEX_ARRAYS;
|
Fabien-Chouteau/lvgl-ada | Ada | 4,627 | ads | with Lv.Style;
package Lv.Objx.Slider is
subtype Instance is Obj_T;
type Style_T is (Style_Bg,
Style_Indic,
Style_Knob);
-- Create a slider objects
-- @param par pointer to an object, it will be the parent of the new slider
-- @param copy pointer to a slider object, if not NULL then the new object will be copied from it
-- @return pointer to the created slider
function Create (Par : Obj_T; Copy : Instance) return Instance;
----------------------
-- Setter functions --
----------------------
-- Set a new value on the slider
-- @param self pointer to a slider object
-- @param value new value
procedure Set_Value (Self : Instance; Value : Int16_T);
-- Set a new value with animation on a slider
-- @param self pointer to a slider object
-- @param value new value
-- @param anim_time animation time in milliseconds
procedure Set_Value_Anim
(Self : Instance;
Value : Int16_T;
Anim_Time : Uint16_T);
-- Set minimum and the maximum values of a bar
-- @param self pointer to the slider object
-- @param min minimum value
-- @param max maximum value
procedure Set_Range (Self : Instance; Min : Int16_T; Max : Int16_T);
-- Set a function which will be called when a new value is set on the slider
-- @param self pointer to slider object
-- @param action a callback function
procedure Set_Action (Self : Instance; Action : Action_Func_T);
-- Set the 'knob in' attribute of a slider
-- @param self pointer to slider object
-- @param in true: the knob is drawn always in the slider;
-- false: the knob can be out on the edges
procedure Set_Knob_In (Self : Instance; In_P : U_Bool);
-- Set a style of a slider
-- @param self pointer to a slider object
-- @param type which style should be set
-- @param style pointer to a style
procedure Set_Style
(Self : Instance;
Type_P : Style_T;
Style : Lv.Style.Style);
----------------------
-- Getter functions --
----------------------
-- Get the value of a slider
-- @param self pointer to a slider object
-- @return the value of the slider
function Value (Self : Instance) return Int16_T;
-- Get the minimum value of a slider
-- @param self pointer to a slider object
-- @return the minimum value of the slider
function Min_Value (Self : Instance) return Int16_T;
-- Get the maximum value of a slider
-- @param self pointer to a slider object
-- @return the maximum value of the slider
function Max_Value (Self : Instance) return Int16_T;
-- Get the slider action function
-- @param self pointer to slider object
-- @return the callback function
function Action (Self : Instance) return Action_Func_T;
-- Give the slider is being dragged or not
-- @param self pointer to a slider object
-- @return true: drag in progress false: not dragged
function Is_Dragged (Self : Instance) return U_Bool;
-- Get the 'knob in' attribute of a slider
-- @param self pointer to slider object
-- @return true: the knob is drawn always in the slider;
-- false: the knob can be out on the edges
function Knob_In (Self : Instance) return U_Bool;
-- Get a style of a slider
-- @param self pointer to a slider object
-- @param type which style should be get
-- @return style pointer to a style
function Style
(Self : Instance;
Type_P : Style_T) return Lv.Style.Style;
-------------
-- Imports --
-------------
pragma Import (C, Create, "lv_slider_create");
pragma Import (C, Set_Value, "lv_slider_set_value_inline");
pragma Import (C, Set_Value_Anim, "lv_slider_set_value_anim_inline");
pragma Import (C, Set_Range, "lv_slider_set_range_inline");
pragma Import (C, Set_Action, "lv_slider_set_action");
pragma Import (C, Set_Knob_In, "lv_slider_set_knob_in");
pragma Import (C, Set_Style, "lv_slider_set_style");
pragma Import (C, Value, "lv_slider_get_value");
pragma Import (C, Min_Value, "lv_slider_get_min_value_inline");
pragma Import (C, Max_Value, "lv_slider_get_max_value_inline");
pragma Import (C, Action, "lv_slider_get_action");
pragma Import (C, Is_Dragged, "lv_slider_is_dragged");
pragma Import (C, Knob_In, "lv_slider_get_knob_in");
pragma Import (C, Style, "lv_slider_get_style");
for Style_T'Size use 8;
for Style_T use (Style_Bg => 0,
Style_Indic => 1,
Style_Knob => 2);
end Lv.Objx.Slider;
|
BrickBot/Bound-T-H8-300 | Ada | 3,394 | ads | -- Options.Traversal (decl)
--
-- Grouped traversal of (sets of) options, for display purposes.
--
-- 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:51 $
--
-- $Log: options-traversal.ads,v $
-- Revision 1.2 2015/10/24 19:36:51 niklas
-- Moved to free licence.
--
-- Revision 1.1 2011-08-31 04:17:13 niklas
-- Added for BT-CH-0222: Option registry. Option -dump. External help files.
--
private
package Options.Traversal is
type Visitor_T is abstract tagged null record;
--
-- Defines the actions to be taken for options and option groups
-- during the traversal of an option set.
procedure Visit (
Visitor : in out Visitor_T;
Option : in Option_Element_T)
is abstract;
--
-- This Option is traversed.
procedure Enter_Group (
Visitor : in out Visitor_T;
Group : in Group_T)
is abstract;
--
-- The traversal is entering a set of options that belong to this Group.
procedure Leave_Group (
Visitor : in out Visitor_T;
Group : in Group_T)
is abstract;
--
-- The traversal is leaving a set of options that belong to this Group.
procedure Traverse (
List : in Option_List_T;
Within : in Group_Set_T := Null_Group_Set;
Synonyms : in Boolean;
Visitor : in out Visitor_T'Class);
--
-- Traverses the given List of options in a tree order by groups
-- and the priorities of the groups, assuming that the traversal
-- has already "entered" Within the given groups. Inclusion of
-- synonyms is optional.
end Options.Traversal;
|
jrmarino/AdaBase | Ada | 1,780 | adb | with AdaBase;
with Connect;
with Ada.Text_IO;
with AdaBase.Results.Sets;
procedure Stored_Procs is
package CON renames Connect;
package TIO renames Ada.Text_IO;
package ARS renames AdaBase.Results.Sets;
stmt_acc : CON.Stmt_Type_access;
procedure dump_result;
procedure dump_result
is
function pad (S : String) return String;
function pad (S : String) return String
is
field : String (1 .. 15) := (others => ' ');
len : Natural := S'Length;
begin
field (1 .. len) := S;
return field;
end pad;
row : ARS.Datarow;
numcols : constant Natural := stmt_acc.column_count;
begin
for c in Natural range 1 .. numcols loop
TIO.Put (pad (stmt_acc.column_name (c)));
end loop;
TIO.Put_Line ("");
for c in Natural range 1 .. numcols loop
TIO.Put ("============== ");
end loop;
TIO.Put_Line ("");
loop
row := stmt_acc.fetch_next;
exit when row.data_exhausted;
for c in Natural range 1 .. numcols loop
TIO.Put (pad (row.column (c).as_string));
end loop;
TIO.Put_Line ("");
end loop;
TIO.Put_Line ("");
end dump_result;
set_fetched : Boolean;
set_present : Boolean;
begin
CON.connect_database;
declare
stmt : aliased CON.Stmt_Type :=
CON.DR.call_stored_procedure ("multiple_rowsets", "");
begin
set_fetched := stmt.successful;
stmt_acc := stmt'Unchecked_Access;
loop
if set_fetched then
dump_result;
end if;
stmt.fetch_next_set (set_present, set_fetched);
exit when not set_present;
end loop;
end;
CON.DR.disconnect;
end Stored_Procs;
|
zhmu/ananas | Ada | 3,785 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ T E X T _ I O . D E C I M A L _ A U X --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains implementation for Ada.Wide_Wide_Text_IO.Decimal_IO
-- Routines in this package are identical semantically to those in Decimal_IO,
-- except that the default parameters have been removed because they are
-- supplied explicitly by the calls from within these units, and there is an
-- additional Scale parameter giving the value of Num'Scale. In addition the
-- Get routines return the value rather than store it in an Out parameter.
private generic
type Int is range <>;
with function Scan
(Str : String;
Ptr : not null access Integer;
Max : Integer;
Scale : Integer) return Int;
with procedure Set_Image
(V : Int;
S : in out String;
P : in out Natural;
Scale : Integer;
Fore : Natural;
Aft : Natural;
Exp : Natural);
package Ada.Wide_Wide_Text_IO.Decimal_Aux is
function Get
(File : File_Type;
Width : Field;
Scale : Integer) return Int;
procedure Put
(File : File_Type;
Item : Int;
Fore : Field;
Aft : Field;
Exp : Field;
Scale : Integer);
function Gets
(From : String;
Last : out Positive;
Scale : Integer) return Int;
procedure Puts
(To : out String;
Item : Int;
Aft : Field;
Exp : Field;
Scale : Integer);
end Ada.Wide_Wide_Text_IO.Decimal_Aux;
|
reznikmm/matreshka | Ada | 3,729 | 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.Form_Allow_Deletes_Attributes is
pragma Preelaborate;
type ODF_Form_Allow_Deletes_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Form_Allow_Deletes_Attribute_Access is
access all ODF_Form_Allow_Deletes_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Form_Allow_Deletes_Attributes;
|
flyx/FreeTypeAda | Ada | 7,668 | ads | -- part of FreeTypeAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
package FT.Faces is
pragma Preelaborate;
-- reference-counted smart pointer
type Face_Reference is new Ada.Finalization.Controlled with private;
type Face_Index_Type is new Interfaces.C.long;
type Char_Index_Type is new UInt;
type Encoding is (None, Adobe_Custom, Adobe_Expert, Adobe_Standard,
Apple_Roman, Big5, GB2312, Johab, Adobe_Latin_1,
Old_Latin_2, SJIS, MS_Symbol, Unicode, Wansung);
type Load_Flag is (Load_Default, Load_No_Scale, Load_No_Hinting, Load_Render,
Load_No_Bitmap, Load_Vertical_Layout, Load_Force_Autohint,
Load_Crop_Bitmap, Load_Pedantic, Load_Advance_Only,
Load_Ignore_Global_Advance_Width, Load_No_Recourse,
Load_Ignore_Transform, Load_Monochrome, Load_Linear_Design,
Load_SBits_Only, Load_No_Autohint, Load_Load_Colour,
Load_Compute_Metrics, Load_Bitmap_Metrics_Only);
type Render_Mode is (Render_Mode_Normal, Render_Mode_Light,
Render_Mode_Mono, Render_Mode_LCD,
Render_Mode_LCD_V, Render_Mode_Max);
procedure New_Face (Library : Library_Reference; File_Path_Name : String;
Face_Index : Face_Index_Type;
Object : in out Face_Reference);
function Initialized (Object : Face_Reference) return Boolean;
-- may be called manually to remove the managed pointer and decrease the
-- reference-count early. idempotent.
--
-- post-condation : Object.Initialized = False
overriding procedure Finalize (Object : in out Face_Reference);
function Size (Object : Face_Reference) return Bitmap_Size;
procedure Kerning (Object : Face_Reference; Left_Glyph : UInt;
Right_Glyph : UInt; Kern_Mode : UInt;
aKerning : access Vector);
function Character_Index (Object : Face_Reference; Char_Code : ULong)
return Char_Index_Type;
procedure Load_Glyph (Object : Face_Reference; Glyph_Index : Char_Index_Type;
Flags : Load_Flag);
procedure Load_Character (Object : Face_Reference; Char_Code : ULong;
Flags : Load_Flag);
function Metrics (Object : Face_Reference) return Size_Metrics;
procedure Set_Pixel_Sizes (Object : Face_Reference;
Pixel_Width : UInt;
Pixel_Height : UInt);
function Glyph_Slot (Object : Face_Reference) return Glyph_Slot_Reference;
Image_Error : exception;
Undefined_Character_Code : constant Char_Index_Type;
private
for Face_Index_Type'Size use Interfaces.C.long'Size;
for Char_Index_Type'Size use UInt'Size;
procedure Check_Face_Ptr (Object : Face_Reference);
type Face_Reference is new Ada.Finalization.Controlled with record
Data : aliased Face_Ptr;
-- deallocation of the library will trigger deallocation of all Face_Ptr
-- objects. therefore, we keep a reference to the library here to make
-- sure the library outlives the Face_Reference.
Library : Library_Reference;
end record;
overriding procedure Adjust (Object : in out Face_Reference);
-- Encoding courtesy of OpenGLAda.src.ftgl.ftgl.ads type Charset
-- (Felix Krause <[email protected]>, 2013)
for Encoding use (None => 0,
MS_Symbol => Character'Pos ('s') * 2 ** 24 +
Character'Pos ('y') * 2 ** 16 +
Character'Pos ('m') * 2 ** 8 +
Character'Pos ('b'),
Unicode => Character'Pos ('u') * 2 ** 24 +
Character'Pos ('n') * 2 ** 16 +
Character'Pos ('i') * 2 ** 8 +
Character'Pos ('c'),
SJIS => Character'Pos ('s') * 2 ** 24 +
Character'Pos ('j') * 2 ** 16 +
Character'Pos ('i') * 2 ** 8 +
Character'Pos ('s'),
GB2312 => Character'Pos ('g') * 2 ** 24 +
Character'Pos ('b') * 2 ** 16 +
Character'Pos (' ') * 2 ** 8 +
Character'Pos (' '),
Big5 => Character'Pos ('b') * 2 ** 24 +
Character'Pos ('i') * 2 ** 16 +
Character'Pos ('g') * 2 ** 8 +
Character'Pos ('5'),
Wansung => Character'Pos ('w') * 2 ** 24 +
Character'Pos ('a') * 2 ** 16 +
Character'Pos ('n') * 2 ** 8 +
Character'Pos ('s'),
Johab => Character'Pos ('j') * 2 ** 24 +
Character'Pos ('o') * 2 ** 16 +
Character'Pos ('h') * 2 ** 8 +
Character'Pos ('a'),
Adobe_Standard => Character'Pos ('A') * 2 ** 24 +
Character'Pos ('D') * 2 ** 16 +
Character'Pos ('O') * 2 ** 8 +
Character'Pos ('B'),
Adobe_Expert => Character'Pos ('A') * 2 ** 24 +
Character'Pos ('D') * 2 ** 16 +
Character'Pos ('B') * 2 ** 8 +
Character'Pos ('E'),
Adobe_Custom => Character'Pos ('A') * 2 ** 24 +
Character'Pos ('D') * 2 ** 16 +
Character'Pos ('B') * 2 ** 8 +
Character'Pos ('C'),
Adobe_Latin_1 => Character'Pos ('l') * 2 ** 24 +
Character'Pos ('a') * 2 ** 16 +
Character'Pos ('t') * 2 ** 8 +
Character'Pos ('1'),
Old_Latin_2 => Character'Pos ('l') * 2 ** 24 +
Character'Pos ('a') * 2 ** 16 +
Character'Pos ('t') * 2 ** 8 +
Character'Pos ('2'),
Apple_Roman => Character'Pos ('a') * 2 ** 24 +
Character'Pos ('r') * 2 ** 16 +
Character'Pos ('m') * 2 ** 8 +
Character'Pos ('n'));
for Load_Flag use
(Load_Default => 16#000000#,
Load_No_Scale => 16#000001#,
Load_No_Hinting => 16#000002#,
Load_Render => 16#000004#,
Load_No_Bitmap => 16#000008#,
Load_Vertical_Layout => 16#000010#,
Load_Force_Autohint => 16#000020#,
Load_Crop_Bitmap => 16#000040#,
Load_Pedantic => 16#000080#,
Load_Advance_Only => 16#000100#,
Load_Ignore_Global_Advance_Width => 16#000200#,
Load_No_Recourse => 16#000400#,
Load_Ignore_Transform => 16#000800#,
Load_Monochrome => 16#001000#,
Load_Linear_Design => 16#002000#,
Load_SBits_Only => 16#0004000#,
Load_No_Autohint => 16#008000#,
Load_Load_Colour => 16#100000#,
Load_Compute_Metrics => 16#200000#,
Load_Bitmap_Metrics_Only => 16#400000#);
for Load_Flag'Size use 32;
Undefined_Character_Code : constant Char_Index_Type := 0;
end FT.Faces;
|
zhmu/ananas | Ada | 676 | ads | with Ada.Containers.Vectors;
generic
type Vertex_Key is private;
package Debug4_Pkg is
type Vertex_Id is new Natural;
subtype Valid_Vertex_Id is Vertex_Id range 1 .. Vertex_Id'Last;
package VIL is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Valid_Vertex_Id);
use VIL;
subtype Vertex_Index_List is VIL.Vector;
package VL is new Ada.Containers.Vectors
(Index_Type => Valid_Vertex_Id,
Element_Type => Vertex_Key);
use VL;
subtype Vertex_List is VL.Vector;
type T is tagged record
Vertices : Vertex_List;
end record;
function Dominator_Tree (G : T'Class) return T;
end Debug4_Pkg;
|
stcarrez/ada-mail | Ada | 2,488 | adb | -----------------------------------------------------------------------
-- mail-headers-tests -- Tests for headers
-- Copyright (C) 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 Util.Test_Caller;
package body Mail.Headers.Tests is
pragma Warnings (Off, "*line is too long*");
package Caller is new Util.Test_Caller (Test, "headers");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Mail.Headers.Decode",
Test_Decode'Access);
end Add_Tests;
procedure Test_Decode (T : in out Test) is
begin
Util.Tests.Assert_Equals
(T, "0.9909" & ASCII.CR, Decode ("=?iso-8859-1?Q?0.9909=0D?="),
"Invalid decode");
Util.Tests.Assert_Equals
(T, "définitive de votre compte de courriel NERIM.FR!",
Decode ("=?iso-8859-1?Q?d=E9finitive_de_votre_compte_de_courriel_NERIM.FR!?="),
"Invalid decode");
Util.Tests.Assert_Equals
(T, "Re: Télé-réunion du bureau",
Decode ("=?UTF-8?B?UmU6IFTDqWzDqS1yw6l1bmlvbiBkdSBidXJlYXU=?="),
"Invalid decode");
Util.Tests.Assert_Equals
(T, "Re: Télé-réunion du bureau",
Decode ("Re: =?iso-8859-1?B?VOls6S1y6XVuaW8=?= =?iso-8859-1?Q?n?= du bureau"),
"Invalid decode");
Util.Tests.Assert_Equals
(T, "MySQL <[email protected]>",
Decode ("=?utf-8?B?TXlTUUw=?= <[email protected]>"),
"Invalid decode");
Util.Tests.Assert_Equals
(T, "Live Webinar: MySQL Cluster - Architectural Deep Dive, June 17th 2009",
Decode ("=?utf-8?B?TGl2ZSBXZWJpbmFyOiBNeVNRTCBDbHVzdGVyIC0gQXJjaGl0ZWN0dXJh"
& "bCBEZWVwIERpdmUsIEp1bmUgMTd0aCAyMDA5?="),
"Invalid decode");
end Test_Decode;
end Mail.Headers.Tests;
|
flyx/OpenGLAda | Ada | 10,323 | adb | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with Ada.Characters.Handling;
with Ada.Direct_IO;
with Ada.Directories;
with Ada.Strings.Maps;
package body Tokenization is
function Case_Insensitive_Hash (S : String) return Ada.Containers.Hash_Type is
begin
return Ada.Strings.Hash (Ada.Characters.Handling.To_Lower (S));
end Case_Insensitive_Hash;
function Case_Insensitive_Equals (Left, Right : String) return Boolean is
use Ada.Characters.Handling;
begin
return To_Lower (Left) = To_Lower (Right);
end Case_Insensitive_Equals;
use Ada.Strings.Maps;
Inline_Separators : constant Character_Set :=
To_Set (Character'Val (9)) or To_Set (' ');
Newlines : constant Character_Set :=
To_Set (Character'Val (10)) or To_Set (Character'Val (13));
Separators : constant Character_Set :=
Inline_Separators or Newlines;
Single_Delimiters : constant Character_Set :=
To_Set ("&'()*+,-./:;<=>|");
Compound_Delimiters : constant array(1 .. 10) of String (1 .. 2) :=
("=>", "..", "**", ":=", "/=", ">=", "<=", "<<", ">>", "<>");
function Tokenize (File_Path : String) return Tokenizer is
File_Size : constant Natural := Natural (Ada.Directories.Size (File_Path));
subtype File_String is String (1 .. File_Size);
package File_String_IO is new Ada.Direct_IO (File_String);
File : File_String_IO.File_Type;
begin
File_String_IO.Open (File, File_String_IO.In_File, File_Path);
return Ret : Tokenizer :=
Tokenizer'(Length => File_Size, Pos => 1, Depth => 0, Cur_Line => 1,
Cur_Column => 1, others => <>) do
File_String_IO.Read (File, Ret.Input);
File_String_IO.Close (File);
Ret.Symbol_Table.Insert ("access", Keyword_Access);
Ret.Symbol_Table.Insert ("constant", Keyword_Constant);
Ret.Symbol_Table.Insert ("dynamic", Keyword_Dynamic);
Ret.Symbol_Table.Insert ("end", Keyword_End);
Ret.Symbol_Table.Insert ("function", Keyword_Function);
Ret.Symbol_Table.Insert ("in", Keyword_In);
Ret.Symbol_Table.Insert ("is", Keyword_Is);
Ret.Symbol_Table.Insert ("out", Keyword_Out);
Ret.Symbol_Table.Insert ("package", Keyword_Package);
Ret.Symbol_Table.Insert ("pragma", Keyword_Pragma);
Ret.Symbol_Table.Insert ("procedure", Keyword_Procedure);
Ret.Symbol_Table.Insert ("return", Keyword_Return);
Ret.Symbol_Table.Insert ("spec", Keyword_Spec);
Ret.Symbol_Table.Insert ("static", Keyword_Static);
Ret.Symbol_Table.Insert ("subtype", Keyword_Subtype);
Ret.Symbol_Table.Insert ("type", Keyword_Type);
Ret.Symbol_Table.Insert ("use", Keyword_Use);
Ret.Symbol_Table.Insert ("with", Keyword_With);
Ret.Symbol_Table.Insert ("wrapper", Keyword_Wrapper);
end return;
end Tokenize;
function Id (Object : in out Tokenizer; Symbol : String) return Symbol_Id is
use String_Indexer;
use type Ada.Containers.Count_Type;
Position: Cursor;
Inserted: Boolean;
begin
Object.Symbol_Table.Insert
(Symbol, Symbol_Id (Object.Symbol_Table.Length + 1), Position, Inserted);
return Element (Position);
end Id;
function Next (Object : in out Tokenizer) return Token is
I : Positive := Object.Pos;
Cur : Character;
New_Line : Positive := Object.Cur_Line;
New_Column : Positive := Object.Cur_Column;
function Next_Char return Character is
begin
return Ret : constant Character := Object.Input (I) do
I := I + 1;
if Ret = Character'Val (10) then -- Linefeed
New_Line := New_Line + 1;
New_Column := 1;
else
New_Column := New_Column + 1;
end if;
end return;
end Next_Char;
procedure Update_Pos is
begin
Object.Pos := I;
Object.Cur_Line := New_Line;
Object.Cur_Column := New_Column;
end Update_Pos;
procedure Skip (Set : Character_Set) is
begin
while I <= Object.Input'Length loop
exit when not Is_In (Object.Input (I), Set);
Cur := Next_Char;
end loop;
end Skip;
begin
Skip (Separators);
Update_Pos;
Object.Prev_Line := Object.Cur_Line;
Object.Prev_Column := Object.Cur_Column;
if I > Object.Input'Length then
return Token'(Kind => Stream_End, Length => 0,
Start => Object.Pos, Content => "");
end if;
Cur := Next_Char;
if Is_In (Cur, Single_Delimiters) then
if I <= Object.Input'Length then
declare
Next : constant Character := Object.Input (I);
begin
if Cur = '-' and Next = '-' then
Cur := Next_Char; -- properly advance I/line/column
Skip (not Newlines);
return Ret : constant Token :=
Token'(Kind => Comment, Length => I - Object.Pos - 2,
Start => Object.Pos + 2,
Content => Object.Input (Object.Pos + 2 .. I - 1)) do
Update_Pos;
end return;
else
declare
Possible_Compound : constant String := Cur & Next;
begin
for J in 1 .. 10 loop
if Compound_Delimiters (J) = Possible_Compound then
Cur := Next_Char; -- properly advace I/line/column
return Ret : constant Token :=
Token'(Kind => Delimiter, Length => 2,
Start => Object.Pos,
Content => Possible_Compound) do
Update_Pos;
end return;
end if;
end loop;
if Cur = '(' then
Object.Depth := Object.Depth + 1;
elsif Cur = ')' then
if Object.Depth = 0 then
raise Tokenization_Error with "Extra `)`!";
end if;
Object.Depth := Object.Depth - 1;
end if;
return Ret : constant Token :=
Token'(Kind => Delimiter, Length => 1, Start => Object.Pos,
Content => (1 => Cur)) do
Update_Pos;
end return;
end;
end if;
end;
else
return Ret : constant Token :=
Token'(Kind => Delimiter, Length => 1,
Start => Object.Pos, Content => (1 => Cur)) do
Update_Pos;
end return;
end if;
elsif Cur = '"' then
while I <= Object.Input'Length loop
<<continue>>
Cur := Next_Char;
if Cur = '"' then
if I <= Object.Input'Length then
if Object.Input (I) = '"' then
Cur := Next_Char; -- properly advance I/line/column
goto continue;
end if;
end if;
return Ret : constant Token :=
Token'(Kind => String_Literal, Length => I - Object.Pos - 2,
Start => Object.Pos + 1,
Content => Object.Input (Object.Pos + 1 .. I - 2)) do
Update_Pos;
end return;
end if;
end loop;
raise Tokenization_Error with "Unclosed string literal";
else
Skip (not (Separators or Single_Delimiters));
return Ret : Token :=
Token'(Kind => Identifier, Length => I - Object.Pos,
Start => Object.Pos,
Content => Object.Input (Object.Pos .. I - 1),
Id => <>) do
Ret.Id := Id (Object, Ret.Content);
Update_Pos;
end return;
end if;
end Next;
function Paren_Depth (Object : Tokenizer) return Natural is
begin
return Object.Depth;
end Paren_Depth;
function Line (Object : Tokenizer) return Positive is (Object.Prev_Line);
function Column (Object : Tokenizer) return Positive is (Object.Prev_Column);
function To_String (T : Token) return String is
begin
if T.Kind = Identifier and then Is_Keyword (T.Id) then
return "KEYWORD'(""" & T.Content & """)";
else
return T.Kind'Img & "'(""" & T.Content & """)";
end if;
end To_String;
function Input_Substring (Object : Tokenizer; From, To : Token) return String is
(Object.Input (From.Start .. To.Start + To.Content'Length - 1));
function Is_Keyword (Id : Symbol_Id) return Boolean is
(Id < Keyword_Wrapper);
function Copy (T : Token) return Token is
begin
case T.Kind is
when Identifier =>
return Token'(Kind => Identifier, Length => T.Length,
Start => T.Start, Content => T.Content, Id => T.Id);
when Numeric_Literal =>
return Token'(Kind => Numeric_Literal, Length => T.Length,
Start => T.Start, Content => T.Content);
when String_Literal =>
return Token'(Kind => String_Literal, Length => T.Length,
Start => T.Start, Content => T.Content);
when Delimiter =>
return Token'(Kind => Delimiter, Length => T.Length,
Start => T.Start, Content => T.Content);
when Comment =>
return Token'(Kind => Comment, Length => T.Length,
Start => T.Start, Content => T.Content);
when Stream_End =>
return Token'(Kind => Stream_End, Length => 0,
Start => T.Start, Content => "");
end case;
end Copy;
procedure Register_Symbol (Object : in out Tokenizer; Symbol : String;
New_Id : out Symbol_Id) is
begin
New_Id := Id (Object, Symbol);
end Register_Symbol;
end Tokenization; |
melwyncarlo/ProjectEuler | Ada | 1,346 | adb | with Ada.Integer_Text_IO;
-- Copyright 2021 Melwyn Francis Carlo
procedure A023 is
use Ada.Integer_Text_IO;
Abundant_Numbers : array (Integer range 1 .. 10000) of Integer :=
(others => 0);
N : Integer := 1;
Count_Val : Integer := 1;
J_Max, K, Count_By_2, Proper_Divisors_Sum : Integer;
Abundant_Sum_Found : Boolean;
begin
for I in 2 .. 28123 loop
Proper_Divisors_Sum := 0;
J_Max := Integer (Float'Floor (Float (I) / 2.0));
for J in 1 .. J_Max loop
if (I mod J) = 0 then
Proper_Divisors_Sum := Proper_Divisors_Sum + J;
end if;
end loop;
if Proper_Divisors_Sum > I then
Abundant_Numbers (Count_Val) := I;
Count_Val := Count_Val + 1;
end if;
Count_By_2 := Integer (Float'Floor (Float (Count_Val) / 2.0));
Abundant_Sum_Found := False;
for J in 1 .. Count_By_2 loop
K := J;
while (Abundant_Numbers (J) + Abundant_Numbers (K)) < I loop
K := K + 1;
end loop;
if (Abundant_Numbers (J) + Abundant_Numbers (K)) = I then
Abundant_Sum_Found := True;
exit;
end if;
end loop;
if not Abundant_Sum_Found then
N := N + I;
end if;
end loop;
Put (N, Width => 0);
end A023;
|
fengjixuchui/ewok-kernel | Ada | 3,403 | adb | --
-- Copyright 2018 The wookey project team <[email protected]>
-- - Ryad Benadjila
-- - Arnauld Michelizza
-- - Mathieu Renard
-- - Philippe Thierry
-- - Philippe Trebuchet
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ada.unchecked_conversion;
with ewok.tasks; use ewok.tasks;
with ewok.tasks.debug;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.sched;
with ewok.debug;
with ewok.interrupts;
with soc.interrupts;
with m4.scb;
package body ewok.mpu.handler
with spark_mode => off
is
function memory_fault_handler
(frame_a : t_stack_frame_access)
return t_stack_frame_access
is
#if not CONFIG_KERNEL_PANIC_FREEZE
new_frame_a : t_stack_frame_access
#end if;
current : ewok.tasks.t_task_access;
begin
if m4.scb.SCB.CFSR.MMFSR.MMARVALID then
debug.log (debug.ERROR, "MPU: MMFAR.ADDRESS = " &
system_address'image (m4.scb.SCB.MMFAR.ADDRESS));
end if;
if m4.scb.SCB.CFSR.MMFSR.MLSPERR then
debug.log (debug.ERROR, "MPU: MemManage fault during floating-point lazy state preservation");
end if;
if m4.scb.SCB.CFSR.MMFSR.MSTKERR then
debug.log (debug.ERROR, "MPU: stacking for an exception entry has caused access violation");
end if;
if m4.scb.SCB.CFSR.MMFSR.MUNSTKERR then
debug.log (debug.ERROR, "MPU: unstack for an exception return has caused access violation");
end if;
if m4.scb.SCB.CFSR.MMFSR.DACCVIOL then
debug.log (debug.ERROR, "MPU: the processor attempted a load or store at a location that does not permit the operation");
end if;
if m4.scb.SCB.CFSR.MMFSR.IACCVIOL then
debug.log (debug.ERROR, "MPU: the processor attempted an instruction fetch from a location that does not permit execution");
end if;
current := ewok.tasks.get_task (ewok.sched.get_current);
if current = NULL then
debug.panic ("MPU: No current task.");
end if;
debug.log (debug.ERROR, "MPU: task: " & current.all.name);
ewok.tasks.debug.crashdump (frame_a);
-- On memory fault, the task is not scheduled anymore
ewok.tasks.set_state
(current.all.id, TASK_MODE_MAINTHREAD, ewok.tasks.TASK_STATE_FAULT);
#if CONFIG_KERNEL_PANIC_FREEZE
debug.panic ("panic!");
return frame_a;
#else
new_frame_a := ewok.sched.do_schedule (frame_a);
return new_frame_a;
#end if;
end memory_fault_handler;
procedure init
is
ok : boolean;
begin
ewok.interrupts.set_task_switching_handler
(soc.interrupts.INT_MEMMANAGE,
memory_fault_handler'access,
ID_KERNEL,
ID_DEV_UNUSED,
ok);
if not ok then raise program_error; end if;
end init;
end ewok.mpu.handler;
|
reznikmm/matreshka | Ada | 8,290 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.Element_Collections;
with AMF.Internals.Tables.MOFEXT_Attribute_Mappings;
with AMF.Internals.Tables.MOFEXT_Element_Table;
with AMF.Internals.Tables.MOF_Metamodel;
with AMF.Internals.Tables.UML_Metamodel;
package body AMF.Internals.Factories.MOFEXT_Module_Factory is
procedure Construct_Union
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link);
--------------------
-- Connect_Extent --
--------------------
overriding procedure Connect_Extent
(Self : not null access constant MOF_Module_Factory;
Element : AMF.Internals.AMF_Element;
Extent : AMF.Internals.AMF_Extent)
is
pragma Unreferenced (Self);
begin
AMF.Internals.Tables.MOFEXT_Element_Table.Table (Element).Extent :=
Extent;
end Connect_Extent;
----------------------
-- Connect_Link_End --
----------------------
overriding procedure Connect_Link_End
(Self : not null access constant MOF_Module_Factory;
Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link;
Other : AMF.Internals.AMF_Element)
is
pragma Unreferenced (Self);
use AMF.Internals.Tables;
use AMF.Internals.Tables.MOFEXT_Attribute_Mappings;
use AMF.Internals.Tables.MOF_Metamodel;
use AMF.Internals.Tables.UML_Metamodel;
begin
-- Properties which comes from UML metamodel.
if Property in MB_UML .. ML_UML then
declare
PO : constant AMF.Internals.CMOF_Element := Property - MB_UML;
begin
if PO in UML_Collection_Offset'Range (2) then
AMF.Internals.Element_Collections.Internal_Append
(MOFEXT_Element_Table.Table (Element).Member (0).Collection
+ UML_Collection_Offset
(MOFEXT_Element_Table.Table (Element).Kind, PO),
Other,
Link);
elsif PO in UML_Member_Offset'Range (2)
and then UML_Member_Offset
(MOFEXT_Element_Table.Table (Element).Kind, PO) /= 0
then
MOFEXT_Element_Table.Table (Element).Member
(UML_Member_Offset
(MOFEXT_Element_Table.Table (Element).Kind, PO)).Link := Link;
else
AMF.Internals.Element_Collections.Internal_Append
(MOFEXT_Element_Table.Table (Element).Member (0).Collection,
Other,
Link);
end if;
end;
elsif Property in MB_MOF .. ML_MOF then
declare
PO : constant AMF.Internals.CMOF_Element := Property - MB_MOF;
begin
if PO in MOF_Collection_Offset'Range (2) then
AMF.Internals.Element_Collections.Internal_Append
(MOFEXT_Element_Table.Table (Element).Member (0).Collection
+ MOF_Collection_Offset
(MOFEXT_Element_Table.Table (Element).Kind, PO),
Other,
Link);
elsif PO in MOF_Member_Offset'Range (2)
and then MOF_Member_Offset
(MOFEXT_Element_Table.Table (Element).Kind, PO) /= 0
then
MOFEXT_Element_Table.Table (Element).Member
(MOF_Member_Offset
(MOFEXT_Element_Table.Table (Element).Kind, PO)).Link := Link;
else
AMF.Internals.Element_Collections.Internal_Append
(MOFEXT_Element_Table.Table (Element).Member (0).Collection,
Other,
Link);
end if;
end;
end if;
end Connect_Link_End;
---------------------
-- Construct_Union --
---------------------
procedure Construct_Union
(Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link) is separate;
--------------------------
-- Synchronize_Link_Set --
--------------------------
overriding procedure Synchronize_Link_Set
(Self : not null access constant MOF_Module_Factory;
Element : AMF.Internals.AMF_Element;
Property : AMF.Internals.CMOF_Element;
Link : AMF.Internals.AMF_Link)
is
pragma Unreferenced (Self);
begin
-- Construct derived unions.
Construct_Union (Element, Property, Link);
end Synchronize_Link_Set;
----------------
-- To_Element --
----------------
overriding function To_Element
(Self : not null access constant MOF_Module_Factory;
Element : AMF.Internals.AMF_Element) return AMF.Elements.Element_Access
is
pragma Unreferenced (Self);
begin
return AMF.Internals.Tables.MOFEXT_Element_Table.Table (Element).Proxy;
end To_Element;
end AMF.Internals.Factories.MOFEXT_Module_Factory;
|
reznikmm/matreshka | Ada | 3,627 | 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.Exception_Handlers.Hash is
new AMF.Elements.Generic_Hash (UML_Exception_Handler, UML_Exception_Handler_Access);
|
jwarwick/aoc_2019_ada | Ada | 407 | ads | with AUnit;
with AUnit.Test_Cases;
package Day1.Test is
type Test is new AUnit.Test_Cases.Test_Case with null record;
function Name (T : Test) return AUnit.Message_String;
procedure Register_Tests (T : in out Test);
-- Test routines
procedure Test_Part1 (T : in out AUnit.Test_Cases.Test_Case'Class);
procedure Test_Part2 (T : in out AUnit.Test_Cases.Test_Case'Class);
end Day1.Test;
|
reznikmm/matreshka | Ada | 3,639 | 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.Db_Index_Elements is
pragma Preelaborate;
type ODF_Db_Index is limited interface
and XML.DOM.Elements.DOM_Element;
type ODF_Db_Index_Access is
access all ODF_Db_Index'Class
with Storage_Size => 0;
end ODF.DOM.Db_Index_Elements;
|
veyselharun/ABench2020 | Ada | 2,069 | adb | --
-- ABench2020 Benchmark Suite
--
-- Parallel Factorial Program
--
-- Licensed under the MIT License. See LICENSE file in the ABench root
-- directory for license information.
--
-- Uncomment the line below to print the result.
-- with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
procedure PFactorial is
function Calculate_Factorial (Start_Value : Long_Integer; End_Value : Long_Integer) return Long_Integer is
Result : Long_Integer := 1;
begin
for I in Long_Integer range Start_Value .. End_Value loop
Result := Result * I;
end loop;
return Result;
end;
task type Factorial_Task is
entry Start (Start_Value : in Long_Integer; End_Value : in Long_Integer);
entry Report (Result_Value : out Long_Integer);
end Factorial_Task;
task body Factorial_Task is
Local_Start_Value : Long_Integer;
Local_End_Value : Long_Integer;
Local_Result_Value : Long_Integer;
begin
accept Start (Start_Value : in Long_Integer; End_Value : in Long_Integer) do
Local_Start_Value := Start_Value;
Local_End_Value := End_Value;
end Start;
Local_Result_Value := Calculate_Factorial (Local_Start_Value, Local_End_Value);
accept Report (Result_Value : out Long_Integer) do
Result_Value := Local_Result_Value;
end Report;
end;
Task1 : Factorial_Task;
Task2 : Factorial_Task;
External_Value : Long_Integer := Long_Integer'Value (Ada.Command_Line.Argument (1));
Factorial_Value : Long_Integer := 1;
Thread1_Value : Long_Integer := 1;
Thread2_Value : Long_Integer := 1;
begin
Task1.Start (1, External_Value / 2);
Task2.Start (External_Value / 2 + 1 , External_Value);
Task1.Report (Thread1_Value);
Task2.Report (Thread2_Value);
Factorial_Value := Thread1_Value * Thread2_Value;
-- Uncomment the line below to print the result.
-- Put_Line (Long_Integer'Image (Factorial_Value));
end;
|
reznikmm/matreshka | Ada | 4,041 | 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.Text_Animation_Delay_Attributes;
package Matreshka.ODF_Text.Animation_Delay_Attributes is
type Text_Animation_Delay_Attribute_Node is
new Matreshka.ODF_Text.Abstract_Text_Attribute_Node
and ODF.DOM.Text_Animation_Delay_Attributes.ODF_Text_Animation_Delay_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Animation_Delay_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Text_Animation_Delay_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Text.Animation_Delay_Attributes;
|
simonjwright/Quaternions | Ada | 5,081 | adb | with AUnit.Assertions; use AUnit.Assertions;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package body Test.Test_Suite is
use Quaternions;
function Image (Q : Quaternion) return String
is ("("
& Q.W'Image
& ","
& Q.X'Image
& ","
& Q.Y'Image
& ","
& Q.Y'Image
& ")");
type Case_1 is new Test_Case with null record;
overriding
function Name (C : Case_1) return AUnit.Message_String
is (new String'("quaternions"));
overriding
procedure Register_Tests (C : in out Case_1);
function Suite return AUnit.Test_Suites.Access_Test_Suite
is
Result : constant AUnit.Test_Suites.Access_Test_Suite
:= new AUnit.Test_Suites.Test_Suite;
begin
pragma Warnings (Off, "use of an anonymous access type allocator");
AUnit.Test_Suites.Add_Test (Result, new Case_1);
pragma Warnings (On, "use of an anonymous access type allocator");
return Result;
end Suite;
procedure Unary_Minus (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Addition (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Subtraction (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Multiplication (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Division (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Conjugate (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Norm (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Normalize (Dummy : in out AUnit.Test_Cases.Test_Case'Class);
procedure Register_Tests (C : in out Case_1)
is
begin
Registration.Register_Routine
(C,
Unary_Minus'Access,
"unary minus");
Registration.Register_Routine
(C,
Addition'Access,
"addition");
Registration.Register_Routine
(C,
Subtraction'Access,
"subtraction");
Registration.Register_Routine
(C,
Multiplication'Access,
"multiplication");
Registration.Register_Routine
(C,
Division'Access,
"division");
Registration.Register_Routine
(C,
Conjugate'Access,
"conjugate");
Registration.Register_Routine
(C,
Norm'Access,
"norm");
Registration.Register_Routine
(C,
Normalize'Access,
"normalize");
end Register_Tests;
procedure Unary_Minus (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (1.0, 2.0, 3.0, 4.0);
Q2 : Quaternion;
begin
Q2 := -Q1;
Assert (Q2 = (-1.0, -2.0, -3.0, -4.0), "-q1");
end Unary_Minus;
procedure Addition (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (1.0, 2.0, 3.0, 4.0);
Q2 : constant Quaternion := (-1.0, 0.0, -1.0, 0.0);
Q3 : Quaternion;
begin
Q3 := Q1 + Q2;
Assert (Q3 = (0.0, 2.0, 2.0, 4.0), "q1+q2");
end Addition;
procedure Subtraction (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (1.0, 2.0, 3.0, 4.0);
Q2 : constant Quaternion := (-1.0, 0.0, -1.0, 0.0);
Q3 : Quaternion;
begin
Q3 := Q1 - Q2;
Assert (Q3 = (2.0, 2.0, 4.0, 4.0), "q1-q2");
end Subtraction;
procedure Multiplication (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (1.0, 2.0, 3.0, 4.0);
Q2 : Quaternion;
Q3 : Quaternion;
begin
Q2 := Q1 * 2.0;
Assert (Q2 = (2.0, 4.0, 6.0, 8.0), "q1*r");
Q3 := 3.0 * Q1;
Assert (Q3 = (3.0, 6.0, 9.0, 12.0), "r*q1");
Q3 := Q1 * Q2;
pragma Style_Checks (Off); -- line length > 79
-- From https://www.euclideanspace.com/maths/algebra/realNormedAlgebra/other/dualQuaternion/calculator/index.htm
pragma Style_Checks (On);
Assert (Q3 = (-56.0, 8.0, 12.0, 16.0), "q1*q2" & ", got " & Image (Q3));
end Multiplication;
procedure Division (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (1.0, 2.0, 3.0, 4.0);
Q2 : Quaternion;
begin
Q2 := Q1 / 2.0;
Assert (Q2 = (0.5, 1.0, 1.5, 2.0), "q1/r");
end Division;
procedure Conjugate (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (1.0, 2.0, 3.0, 4.0);
Q2 : Quaternion;
begin
Q2 := Conjugate (Q1);
Assert (Q2 = (1.0, -2.0, -3.0, -4.0), "conjugate(q1)");
end Conjugate;
procedure Norm (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (3.0, 0.0, 0.0, 4.0);
R : Float;
begin
R := Norm (Q1);
Assert (R = 5.0, "norm(q1)");
end Norm;
procedure Normalize (Dummy : in out AUnit.Test_Cases.Test_Case'Class)
is
Q1 : constant Quaternion := (3.0, 0.0, 0.0, 4.0);
Q2 : Quaternion;
begin
Q2 := Normalize (Q1);
Assert (Q2 = (0.6, 0.0, 0.0, 0.8), "normalize(q1)");
end Normalize;
end Test.Test_Suite;
|
zyron92/banana_tree_generator | Ada | 1,934 | adb | with Ada.Command_Line, Ada.Text_IO, Ada.Integer_Text_IO, Parseur, Traceur_Intermediaire, Traceur_Final;
use Ada.Command_Line, Ada.Text_IO, Ada.Integer_Text_IO, Parseur, Traceur_Intermediaire, Traceur_Final;
procedure Main is
Nombre_Sommets: Natural;
--Conversion des caractères 0,1 en format boolean
function Valeur_Boolean(C: in Character) return Boolean is
begin
case C is
when '0' => return False;
when '1' => return True;
when others => raise Erreur_Option;
end case;
end Valeur_Boolean;
begin
if Argument_Count /= 4 then
Put_Line(Standard_Error, "Utilisation : ./main Fichier_Graphe.kn Trace.svg Option[1:que trace intermediare, 2:trace_final_avec_Intermediaire, 3:trace_final_sans_Intermediare] Angle[Minimale:1/Maximale:0]");
return;
end if;
--Arg1 => fichier d'entrée
--Arg2 => fichier de sortie
--Arg3 => option
--Lecture du fichier d'entrée pour identifier le nombre des sommets
Lecture_En_Tete(Argument(1), Nombre_Sommets);
declare
G : Graphe(1..Nombre_Sommets);
begin
--Lecture du fichier d'entrée pour construire le graphe et remplir le tableau contenant les informations sur les sommets
Lecture(Argument(1), G);
--Selon les options, nous générons le tracé
case Argument(3)(1) is
when '1' => Generer_Trace_Intermediaire (Argument(2), (R=>0,G=>0,B=>0), "0.1", G);
when '2' => Generer_Trace_Final (Argument(2), (R=>255,G=>0,B=>0), "0.1", G, True, Valeur_Boolean(Argument(4)(1)));
when '3' => Generer_Trace_Final (Argument(2), (R=>255,G=>0,B=>0), "0.1", G, False, Valeur_Boolean(Argument(4)(1)));
when others => raise Erreur_Option;
end case;
end;
exception
when Erreur_Lecture_Config
=> Put_Line(Standard_Error, "Arrêt du programme");
when Erreur_Option
=> Put_Line(Standard_Error, "Les arguments entrés ne sont pas valides");
end Main;
|
Kidev/Ada_Drivers_Library | Ada | 1,742 | ads | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Vendor : constant String := "STMicro"; -- From board definition
Max_Mount_Points : constant := 2; -- From default value
Max_Mount_Name_Length : constant := 128; -- From default value
Runtime_Profile : constant String := "ravenscar-full"; -- From command line
Device_Name : constant String := "STM32F429ZITx"; -- From board definition
Device_Family : constant String := "STM32F4"; -- From board definition
Runtime_Name : constant String := "ravenscar-full-stm32f429disco"; -- From default value
Has_Ravenscar_Full_Runtime : constant String := "True"; -- From board definition
CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition
Board : constant String := "STM32F429_Discovery"; -- From command line
Has_ZFP_Runtime : constant String := "False"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "True"; -- From board definition
High_Speed_External_Clock : constant := 8000000; -- From board definition
Max_Path_Length : constant := 1024; -- From default value
Runtime_Name_Suffix : constant String := "stm32f429disco"; -- From board definition
Architecture : constant String := "ARM"; -- From board definition
end ADL_Config;
|
luk9400/nsi | Ada | 317 | adb | package body Rev with SPARK_Mode is
procedure Reve (S : in out String) is
Tmp: String := S;
begin
for I in S'Range loop
S(I) := Tmp(S'First + S'Last - I);
pragma Loop_Invariant (for all J in S'First .. I => S(J) = Tmp(S'First + S'Last - J));
end loop;
end Reve;
end Rev;
|
reznikmm/matreshka | Ada | 8,090 | 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$
------------------------------------------------------------------------------
with AMF.CMOF.Elements;
with AMF.DC;
with AMF.DI.Styles;
with AMF.Internals.UML_Elements;
with AMF.Internals.UMLDI_UML_Diagram_Elements;
with AMF.UML.Elements.Collections;
with AMF.UMLDI.UML_Shapes;
with AMF.UMLDI.UML_Styles;
with AMF.Visitors;
package AMF.Internals.UMLDI_UML_Shapes is
package Diagram_Elements is
new AMF.Internals.UMLDI_UML_Diagram_Elements
(AMF.Internals.UML_Elements.UML_Element_Base);
type UMLDI_UML_Shape_Proxy is
limited new Diagram_Elements.UMLDI_UML_Diagram_Element_Proxy
and AMF.UMLDI.UML_Shapes.UMLDI_UML_Shape with null record;
overriding function Get_Is_Icon
(Self : not null access constant UMLDI_UML_Shape_Proxy)
return Boolean;
-- Getter of UMLDiagramElement::isIcon.
--
-- For modelElements that have an option to be shown with shapes other
-- than rectangles, such as Actors, or with other identifying shapes
-- inside them, such as arrows distinguishing InputPins and OutputPins, or
-- edges that have an option to be shown with lines other than solid with
-- open arrow heads, such as Realization. A value of true for isIcon
-- indicates the alternative notation shall be shown.
overriding procedure Set_Is_Icon
(Self : not null access UMLDI_UML_Shape_Proxy;
To : Boolean);
-- Setter of UMLDiagramElement::isIcon.
--
-- For modelElements that have an option to be shown with shapes other
-- than rectangles, such as Actors, or with other identifying shapes
-- inside them, such as arrows distinguishing InputPins and OutputPins, or
-- edges that have an option to be shown with lines other than solid with
-- open arrow heads, such as Realization. A value of true for isIcon
-- indicates the alternative notation shall be shown.
overriding function Get_Local_Style
(Self : not null access constant UMLDI_UML_Shape_Proxy)
return AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access;
-- Getter of UMLDiagramElement::localStyle.
--
-- Restricts owned styles to UMLStyles.
overriding procedure Set_Local_Style
(Self : not null access UMLDI_UML_Shape_Proxy;
To : AMF.UMLDI.UML_Styles.UMLDI_UML_Style_Access);
-- Setter of UMLDiagramElement::localStyle.
--
-- Restricts owned styles to UMLStyles.
overriding function Get_Model_Element
(Self : not null access constant UMLDI_UML_Shape_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element;
-- Getter of UMLDiagramElement::modelElement.
--
-- Restricts UMLDiagramElements to show UML Elements, rather than other
-- language elements.
overriding function Get_Model_Element
(Self : not null access constant UMLDI_UML_Shape_Proxy)
return AMF.CMOF.Elements.CMOF_Element_Access;
-- Getter of DiagramElement::modelElement.
--
-- a reference to a depicted model element, which can be any MOF-based
-- element
overriding function Get_Local_Style
(Self : not null access constant UMLDI_UML_Shape_Proxy)
return AMF.DI.Styles.DI_Style_Access;
-- Getter of DiagramElement::localStyle.
--
-- a reference to an optional locally-owned style for this diagram element.
overriding procedure Set_Local_Style
(Self : not null access UMLDI_UML_Shape_Proxy;
To : AMF.DI.Styles.DI_Style_Access);
-- Setter of DiagramElement::localStyle.
--
-- a reference to an optional locally-owned style for this diagram element.
overriding function Get_Bounds
(Self : not null access constant UMLDI_UML_Shape_Proxy)
return AMF.DC.Optional_DC_Bounds;
-- Getter of Shape::bounds.
--
-- the optional bounds of the shape relative to the origin of its nesting
-- plane.
overriding procedure Set_Bounds
(Self : not null access UMLDI_UML_Shape_Proxy;
To : AMF.DC.Optional_DC_Bounds);
-- Setter of Shape::bounds.
--
-- the optional bounds of the shape relative to the origin of its nesting
-- plane.
overriding procedure Enter_Element
(Self : not null access constant UMLDI_UML_Shape_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 UMLDI_UML_Shape_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 UMLDI_UML_Shape_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.UMLDI_UML_Shapes;
|
reinertk/cpros | Ada | 2,494 | ads | --------------------------------------------------------------------------------------
--
-- Copyright (c) 2016 Reinert Korsnes
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
--
-- NB: this is the MIT License, as found 2016-09-27 on the site
-- http://www.opensource.org/licenses/mit-license.php
--------------------------------------------------------------------------------------
-- Change log:
--
--------------------------------------------------------------------------------------
with Ada.Characters.Latin_1;
package split_string is
command_white_space1 : constant String := " ,|" & Ada.Characters.Latin_1.HT;
-- command_single1 : constant String := "&";
function number_of_words
(fs : String;
ws : String := command_white_space1) return Natural;
function word
(fs : in String;
word_number : Natural;
ws : String := command_white_space1) return String;
function last_word
(fs : String;
ws : String := command_white_space1) return String;
function first_word
(fs : String;
ws : String := command_white_space1) return String;
function collect1
(fs : String;
from_word_number : Natural;
ws : String := command_white_space1) return String;
function remove_comment1 (fs : String; cc : String := "#") return String;
function expand1 (fs : String; singles : String) return String;
end split_string;
|
zhmu/ananas | Ada | 505 | adb | -- { dg-do run }
-- { dg-options "-O0 -gnata -gnateV" }
with Ada.Exceptions; use Ada.Exceptions;
procedure Valid_Scalars2 is
Traced : Boolean := False;
procedure Trace (E : in Exception_Occurrence) is
pragma Assert (E'Valid_scalars);
begin
Traced := True;
end Trace;
begin
raise Program_Error;
exception
when E : others =>
pragma Assert (E'Valid_scalars);
Trace (E);
if not Traced then
raise Program_Error;
end if;
end Valid_Scalars2;
|
reznikmm/matreshka | Ada | 3,872 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 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$
------------------------------------------------------------------------------
with Asis;
with Engines.Contexts;
with League.Strings;
package Properties.Expressions.Record_Aggregate is
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String;
function Typed_Array_Initialize
(Engine : access Engines.Contexts.Context;
Element : Asis.Expression;
Name : Engines.Text_Property) return League.Strings.Universal_String;
end Properties.Expressions.Record_Aggregate;
|
reznikmm/matreshka | Ada | 6,900 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Draw.Area_Polygon_Elements is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Elements.Element_L2_Parameters)
return Draw_Area_Polygon_Element_Node is
begin
return Self : Draw_Area_Polygon_Element_Node do
Matreshka.ODF_Draw.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Draw_Prefix);
end return;
end Create;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Draw_Area_Polygon_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Enter_Draw_Area_Polygon
(ODF.DOM.Draw_Area_Polygon_Elements.ODF_Draw_Area_Polygon_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Enter_Node (Visitor, Control);
end if;
end Enter_Node;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Draw_Area_Polygon_Element_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Area_Polygon_Element;
end Get_Local_Name;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Draw_Area_Polygon_Element_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Visitor in ODF.DOM.Visitors.Abstract_ODF_Visitor'Class then
ODF.DOM.Visitors.Abstract_ODF_Visitor'Class
(Visitor).Leave_Draw_Area_Polygon
(ODF.DOM.Draw_Area_Polygon_Elements.ODF_Draw_Area_Polygon_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Leave_Node (Visitor, Control);
end if;
end Leave_Node;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Draw_Area_Polygon_Element_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
if Iterator in ODF.DOM.Iterators.Abstract_ODF_Iterator'Class then
ODF.DOM.Iterators.Abstract_ODF_Iterator'Class
(Iterator).Visit_Draw_Area_Polygon
(Visitor,
ODF.DOM.Draw_Area_Polygon_Elements.ODF_Draw_Area_Polygon_Access
(Self),
Control);
else
Matreshka.DOM_Elements.Abstract_Element_Node
(Self.all).Visit_Node (Iterator, Visitor, Control);
end if;
end Visit_Node;
begin
Matreshka.DOM_Documents.Register_Element
(Matreshka.ODF_String_Constants.Draw_URI,
Matreshka.ODF_String_Constants.Area_Polygon_Element,
Draw_Area_Polygon_Element_Node'Tag);
end Matreshka.ODF_Draw.Area_Polygon_Elements;
|
zhmu/ananas | Ada | 3,956 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.STRINGS.TEXT_BUFFERS.FILES --
-- --
-- S p e c --
-- --
-- Copyright (C) 2020-2022, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Finalization;
with System.OS_Lib;
package Ada.Strings.Text_Buffers.Files is
type File_Buffer is new Root_Buffer_Type with private;
-- Output written to a File_Buffer is written to the associated file.
function Create_From_FD
(FD : System.OS_Lib.File_Descriptor;
Close_Upon_Finalization : Boolean := True)
return File_Buffer;
-- file closed upon finalization if specified
function Create_File (Name : String) return File_Buffer;
-- file closed upon finalization
function Create_Standard_Output_Buffer return File_Buffer is
(Create_From_FD (System.OS_Lib.Standout,
Close_Upon_Finalization => False));
function Create_Standard_Error_Buffer return File_Buffer is
(Create_From_FD (System.OS_Lib.Standerr,
Close_Upon_Finalization => False));
private
procedure Put_UTF_8_Implementation
(Buffer : in out Root_Buffer_Type'Class;
Item : UTF_Encoding.UTF_8_String)
with Pre => Buffer in File_Buffer'Class;
package Mapping is new Output_Mapping (Put_UTF_8_Implementation);
package OS renames System.OS_Lib;
type Self_Ref (Self : not null access File_Buffer)
is new Finalization.Limited_Controlled with null record;
overriding procedure Finalize (Ref : in out Self_Ref);
type File_Buffer is new Mapping.Buffer_Type with record
FD : OS.File_Descriptor := OS.Invalid_FD;
Ref : Self_Ref (File_Buffer'Access);
Close_Upon_Finalization : Boolean := False;
end record;
end Ada.Strings.Text_Buffers.Files;
|
tum-ei-rcs/StratoX | Ada | 926 | ads |
with Bit_Types;
package HAL.I2C is
pragma Preelaborate;
type Mode_Type is (MASTER, SLAVE);
type Speed_Type is (SLOW, FAST);
type Configuration_Type is record
Mode : Mode_Type;
Speed : Speed_Type;
end record
type Data_Type is array(Natural range <>) of Byte;
type Port_Type is (UNKNOWN, I2C1, I2C2);
type Address_Type is Bits_10;
type I2C_Device_Type is record
Port : Port_Type;
Address : Address_Type
end record;
procedure initialize(Port : in Port_Type; Configuration : in Configuration_Type);
-- writes data to tx buffer
procedure write (Device : in I2C_Device_Type; Data : in Data_Type);
-- reads data from the TX Buffer
procedure read (Device : in I2C_Device_Type; Data : out Data_Type);
-- writes and reads data
procedure transfer (Device : in I2C_Device_Type; Data_TX : in Data_Type; Data_RX : out Data_Type);
end HAL.I2C;
|
zhmu/ananas | Ada | 128 | adb | -- { dg-do compile } */
-- { dg-options "-cargs -I -gnatws" }
-- { dg-error "search directory missing" "" { target *-*-* } 0 }
|
stcarrez/ada-awa | Ada | 32,286 | adb | -----------------------------------------------------------------------
-- AWA.Audits.Models -- AWA.Audits.Models
-----------------------------------------------------------------------
-- File generated by Dynamo DO NOT MODIFY
-- Template used: templates/model/package-body.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 Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
pragma Warnings (On);
package body AWA.Audits.Models is
pragma Style_Checks ("-mrIu");
pragma Warnings (Off, "formal parameter * is not referenced");
pragma Warnings (Off, "use clause for type *");
pragma Warnings (Off, "use clause for private type *");
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
function Audit_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Audit_Key;
function Audit_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_INTEGER,
Of_Class => AUDIT_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Audit_Key;
function "=" (Left, Right : Audit_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Audit_Ref'Class;
Impl : out Audit_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Audit_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Audit_Ref) is
Impl : Audit_Access;
begin
Impl := new Audit_Impl;
Impl.Date := ADO.DEFAULT_TIME;
Impl.Old_Value.Is_Null := True;
Impl.New_Value.Is_Null := True;
Impl.Entity_Id := ADO.NO_IDENTIFIER;
Impl.Field := 0;
Impl.Entity_Type := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Audit
-- ----------------------------------------
procedure Set_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, Value);
end Set_Id;
function Get_Id (Object : in Audit_Ref)
return ADO.Identifier is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Object.all)'Access;
begin
return Impl.Get_Key_Value;
end Get_Id;
procedure Set_Date (Object : in out Audit_Ref;
Value : in Ada.Calendar.Time) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Time (Impl.all, 2, Impl.Date, Value);
end Set_Date;
function Get_Date (Object : in Audit_Ref)
return Ada.Calendar.Time is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Date;
end Get_Date;
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Old_Value, Value);
end Set_Old_Value;
procedure Set_Old_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 3, Impl.Old_Value, Value);
end Set_Old_Value;
function Get_Old_Value (Object : in Audit_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_Old_Value;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_Old_Value;
function Get_Old_Value (Object : in Audit_Ref)
return ADO.Nullable_String is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Old_Value;
end Get_Old_Value;
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 4, Impl.New_Value, Value);
end Set_New_Value;
procedure Set_New_Value (Object : in out Audit_Ref;
Value : in ADO.Nullable_String) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 4, Impl.New_Value, Value);
end Set_New_Value;
function Get_New_Value (Object : in Audit_Ref)
return String is
Value : constant ADO.Nullable_String := Object.Get_New_Value;
begin
if Value.Is_Null then
return "";
else
return Ada.Strings.Unbounded.To_String (Value.Value);
end if;
end Get_New_Value;
function Get_New_Value (Object : in Audit_Ref)
return ADO.Nullable_String is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.New_Value;
end Get_New_Value;
procedure Set_Entity_Id (Object : in out Audit_Ref;
Value : in ADO.Identifier) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Identifier (Impl.all, 5, Impl.Entity_Id, Value);
end Set_Entity_Id;
function Get_Entity_Id (Object : in Audit_Ref)
return ADO.Identifier is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Id;
end Get_Entity_Id;
procedure Set_Field (Object : in out Audit_Ref;
Value : in Integer) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Integer (Impl.all, 6, Impl.Field, Value);
end Set_Field;
function Get_Field (Object : in Audit_Ref)
return Integer is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Field;
end Get_Field;
procedure Set_Session (Object : in out Audit_Ref;
Value : in AWA.Users.Models.Session_Ref'Class) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 7, Impl.Session, Value);
end Set_Session;
function Get_Session (Object : in Audit_Ref)
return AWA.Users.Models.Session_Ref'Class is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Session;
end Get_Session;
procedure Set_Entity_Type (Object : in out Audit_Ref;
Value : in ADO.Entity_Type) is
Impl : Audit_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 8, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Audit_Ref)
return ADO.Entity_Type is
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
-- Copy of the object.
procedure Copy (Object : in Audit_Ref;
Into : in out Audit_Ref) is
Result : Audit_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Audit_Access
:= Audit_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Audit_Access
:= new Audit_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Date := Impl.Date;
Copy.Old_Value := Impl.Old_Value;
Copy.New_Value := Impl.New_Value;
Copy.Entity_Id := Impl.Entity_Id;
Copy.Field := Impl.Field;
Copy.Session := Impl.Session;
Copy.Entity_Type := Impl.Entity_Type;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Audit_Access := new Audit_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier) is
Impl : constant Audit_Access := new Audit_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in ADO.Identifier;
Found : out Boolean) is
Impl : constant Audit_Access := new Audit_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Audit_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Audit_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Audit_Impl) is
type Audit_Impl_Ptr is access all Audit_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Audit_Impl, Audit_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Audit_Impl_Ptr := Audit_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, AUDIT_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant ADO.Identifier := Object.Get_Key_Value;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (AUDIT_DEF'Access);
begin
if Object.Is_Modified (6) then
Stmt.Save_Field (Name => COL_5_1_NAME, -- field
Value => Object.Field);
Object.Clear_Modified (6);
end if;
if Object.Is_Modified (7) then
Stmt.Save_Field (Name => COL_6_1_NAME, -- session_id
Value => Object.Session);
Object.Clear_Modified (7);
end if;
if Object.Is_Modified (8) then
Stmt.Save_Field (Name => COL_7_1_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (8);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (AUDIT_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_1_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_1_NAME, -- date
Value => Object.Date);
Query.Save_Field (Name => COL_2_1_NAME, -- old_value
Value => Object.Old_Value);
Query.Save_Field (Name => COL_3_1_NAME, -- new_value
Value => Object.New_Value);
Query.Save_Field (Name => COL_4_1_NAME, -- entity_id
Value => Object.Entity_Id);
Query.Save_Field (Name => COL_5_1_NAME, -- field
Value => Object.Field);
Query.Save_Field (Name => COL_6_1_NAME, -- session_id
Value => Object.Session);
Query.Save_Field (Name => COL_7_1_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Audit_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (AUDIT_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Audit_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Audit_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Audit_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "date" then
return Util.Beans.Objects.Time.To_Object (Impl.Date);
elsif Name = "old_value" then
if Impl.Old_Value.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.Old_Value.Value);
end if;
elsif Name = "new_value" then
if Impl.New_Value.Is_Null then
return Util.Beans.Objects.Null_Object;
else
return Util.Beans.Objects.To_Object (Impl.New_Value.Value);
end if;
elsif Name = "entity_id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Id));
elsif Name = "field" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Field));
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
procedure List (Object : in out Audit_Vector;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, AUDIT_DEF'Access);
begin
Stmt.Execute;
Audit_Vectors.Clear (Object);
while Stmt.Has_Elements loop
declare
Item : Audit_Ref;
Impl : constant Audit_Access := new Audit_Impl;
begin
Impl.Load (Stmt, Session);
ADO.Objects.Set_Object (Item, Impl.all'Access);
Object.Append (Item);
end;
Stmt.Next;
end loop;
end List;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Audit_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Identifier (0));
Object.Date := Stmt.Get_Time (1);
Object.Old_Value := Stmt.Get_Nullable_String (2);
Object.New_Value := Stmt.Get_Nullable_String (3);
Object.Entity_Id := Stmt.Get_Identifier (4);
Object.Field := Stmt.Get_Integer (5);
if not Stmt.Is_Null (6) then
Object.Session.Set_Key_Value (Stmt.Get_Identifier (6), Session);
end if;
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (7));
ADO.Objects.Set_Created (Object);
end Load;
function Audit_Field_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_STRING,
Of_Class => AUDIT_FIELD_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Audit_Field_Key;
function Audit_Field_Key (Id : in String) return ADO.Objects.Object_Key is
Result : ADO.Objects.Object_Key (Of_Type => ADO.Objects.KEY_STRING,
Of_Class => AUDIT_FIELD_DEF'Access);
begin
ADO.Objects.Set_Value (Result, Id);
return Result;
end Audit_Field_Key;
function "=" (Left, Right : Audit_Field_Ref'Class) return Boolean is
begin
return ADO.Objects.Object_Ref'Class (Left) = ADO.Objects.Object_Ref'Class (Right);
end "=";
procedure Set_Field (Object : in out Audit_Field_Ref'Class;
Impl : out Audit_Field_Access) is
Result : ADO.Objects.Object_Record_Access;
begin
Object.Prepare_Modify (Result);
Impl := Audit_Field_Impl (Result.all)'Access;
end Set_Field;
-- Internal method to allocate the Object_Record instance
overriding
procedure Allocate (Object : in out Audit_Field_Ref) is
Impl : Audit_Field_Access;
begin
Impl := new Audit_Field_Impl;
Impl.Entity_Type := 0;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Allocate;
-- ----------------------------------------
-- Data object: Audit_Field
-- ----------------------------------------
procedure Set_Id (Object : in out Audit_Field_Ref;
Value : in Integer) is
Impl : Audit_Field_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Key_Value (Impl.all, 1, ADO.Identifier (Value));
end Set_Id;
function Get_Id (Object : in Audit_Field_Ref)
return Integer is
Impl : constant Audit_Field_Access
:= Audit_Field_Impl (Object.Get_Object.all)'Access;
begin
return Integer (ADO.Identifier '(Impl.Get_Key_Value));
end Get_Id;
procedure Set_Name (Object : in out Audit_Field_Ref;
Value : in String) is
Impl : Audit_Field_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
procedure Set_Name (Object : in out Audit_Field_Ref;
Value : in Ada.Strings.Unbounded.Unbounded_String) is
Impl : Audit_Field_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Unbounded_String (Impl.all, 2, Impl.Name, Value);
end Set_Name;
function Get_Name (Object : in Audit_Field_Ref)
return String is
begin
return Ada.Strings.Unbounded.To_String (Object.Get_Name);
end Get_Name;
function Get_Name (Object : in Audit_Field_Ref)
return Ada.Strings.Unbounded.Unbounded_String is
Impl : constant Audit_Field_Access
:= Audit_Field_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Name;
end Get_Name;
procedure Set_Entity_Type (Object : in out Audit_Field_Ref;
Value : in ADO.Entity_Type) is
Impl : Audit_Field_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Entity_Type (Impl.all, 3, Impl.Entity_Type, Value);
end Set_Entity_Type;
function Get_Entity_Type (Object : in Audit_Field_Ref)
return ADO.Entity_Type is
Impl : constant Audit_Field_Access
:= Audit_Field_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Entity_Type;
end Get_Entity_Type;
-- Copy of the object.
procedure Copy (Object : in Audit_Field_Ref;
Into : in out Audit_Field_Ref) is
Result : Audit_Field_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Audit_Field_Access
:= Audit_Field_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Audit_Field_Access
:= new Audit_Field_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
Copy.Entity_Type := Impl.Entity_Type;
end;
end if;
Into := Result;
end Copy;
overriding
procedure Find (Object : in out Audit_Field_Ref;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Impl : constant Audit_Field_Access := new Audit_Field_Impl;
begin
Impl.Find (Session, Query, Found);
if Found then
ADO.Objects.Set_Object (Object, Impl.all'Access);
else
ADO.Objects.Set_Object (Object, null);
Destroy (Impl);
end if;
end Find;
procedure Load (Object : in out Audit_Field_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Integer) is
Impl : constant Audit_Field_Access := new Audit_Field_Impl;
Found : Boolean;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
raise ADO.Objects.NOT_FOUND;
end if;
ADO.Objects.Set_Object (Object, Impl.all'Access);
end Load;
procedure Load (Object : in out Audit_Field_Ref;
Session : in out ADO.Sessions.Session'Class;
Id : in Integer;
Found : out Boolean) is
Impl : constant Audit_Field_Access := new Audit_Field_Impl;
Query : ADO.SQL.Query;
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Impl.Find (Session, Query, Found);
if not Found then
Destroy (Impl);
else
ADO.Objects.Set_Object (Object, Impl.all'Access);
end if;
end Load;
overriding
procedure Save (Object : in out Audit_Field_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl = null then
Impl := new Audit_Field_Impl;
ADO.Objects.Set_Object (Object, Impl);
end if;
if not ADO.Objects.Is_Created (Impl.all) then
Impl.Create (Session);
else
Impl.Save (Session);
end if;
end Save;
overriding
procedure Delete (Object : in out Audit_Field_Ref;
Session : in out ADO.Sessions.Master_Session'Class) is
Impl : constant ADO.Objects.Object_Record_Access := Object.Get_Object;
begin
if Impl /= null then
Impl.Delete (Session);
end if;
end Delete;
-- --------------------
-- Free the object
-- --------------------
overriding
procedure Destroy (Object : access Audit_Field_Impl) is
type Audit_Field_Impl_Ptr is access all Audit_Field_Impl;
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Audit_Field_Impl, Audit_Field_Impl_Ptr);
pragma Warnings (Off, "*redundant conversion*");
Ptr : Audit_Field_Impl_Ptr := Audit_Field_Impl (Object.all)'Access;
pragma Warnings (On, "*redundant conversion*");
begin
Unchecked_Free (Ptr);
end Destroy;
overriding
procedure Find (Object : in out Audit_Field_Impl;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.SQL.Query'Class;
Found : out Boolean) is
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Query, AUDIT_FIELD_DEF'Access);
begin
Stmt.Execute;
if Stmt.Has_Elements then
Object.Load (Stmt, Session);
Stmt.Next;
Found := not Stmt.Has_Elements;
else
Found := False;
end if;
end Find;
overriding
procedure Load (Object : in out Audit_Field_Impl;
Session : in out ADO.Sessions.Session'Class) is
Found : Boolean;
Query : ADO.SQL.Query;
Id : constant Integer := Integer (ADO.Identifier '(Object.Get_Key_Value));
begin
Query.Bind_Param (Position => 1, Value => Id);
Query.Set_Filter ("id = ?");
Object.Find (Session, Query, Found);
if not Found then
raise ADO.Objects.NOT_FOUND;
end if;
end Load;
overriding
procedure Save (Object : in out Audit_Field_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Update_Statement
:= Session.Create_Statement (AUDIT_FIELD_DEF'Access);
begin
if Object.Is_Modified (1) then
Stmt.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Object.Clear_Modified (1);
end if;
if Object.Is_Modified (2) then
Stmt.Save_Field (Name => COL_1_2_NAME, -- name
Value => Object.Name);
Object.Clear_Modified (2);
end if;
if Object.Is_Modified (3) then
Stmt.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Object.Clear_Modified (3);
end if;
if Stmt.Has_Save_Fields then
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
declare
Result : Integer;
begin
Stmt.Execute (Result);
if Result /= 1 then
if Result /= 0 then
raise ADO.Objects.UPDATE_ERROR;
end if;
end if;
end;
end if;
end Save;
overriding
procedure Create (Object : in out Audit_Field_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Query : ADO.Statements.Insert_Statement
:= Session.Create_Statement (AUDIT_FIELD_DEF'Access);
Result : Integer;
begin
Session.Allocate (Id => Object);
Query.Save_Field (Name => COL_0_2_NAME, -- id
Value => Object.Get_Key);
Query.Save_Field (Name => COL_1_2_NAME, -- name
Value => Object.Name);
Query.Save_Field (Name => COL_2_2_NAME, -- entity_type
Value => Object.Entity_Type);
Query.Execute (Result);
if Result /= 1 then
raise ADO.Objects.INSERT_ERROR;
end if;
ADO.Objects.Set_Created (Object);
end Create;
overriding
procedure Delete (Object : in out Audit_Field_Impl;
Session : in out ADO.Sessions.Master_Session'Class) is
Stmt : ADO.Statements.Delete_Statement
:= Session.Create_Statement (AUDIT_FIELD_DEF'Access);
begin
Stmt.Set_Filter (Filter => "id = ?");
Stmt.Add_Param (Value => Object.Get_Key);
Stmt.Execute;
end Delete;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Audit_Field_Ref;
Name : in String) return Util.Beans.Objects.Object is
Obj : ADO.Objects.Object_Record_Access;
Impl : access Audit_Field_Impl;
begin
if From.Is_Null then
return Util.Beans.Objects.Null_Object;
end if;
Obj := From.Get_Load_Object;
Impl := Audit_Field_Impl (Obj.all)'Access;
if Name = "id" then
return ADO.Objects.To_Object (Impl.Get_Key);
elsif Name = "name" then
return Util.Beans.Objects.To_Object (Impl.Name);
elsif Name = "entity_type" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (Impl.Entity_Type));
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Load the object from current iterator position
-- ------------------------------
procedure Load (Object : in out Audit_Field_Impl;
Stmt : in out ADO.Statements.Query_Statement'Class;
Session : in out ADO.Sessions.Session'Class) is
begin
Object.Set_Key_Value (Stmt.Get_Unbounded_String (0));
Object.Name := Stmt.Get_Unbounded_String (1);
Object.Entity_Type := ADO.Entity_Type (Stmt.Get_Integer (2));
ADO.Objects.Set_Created (Object);
end Load;
end AWA.Audits.Models;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 4,912 | ads | pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32L0x1.svd
pragma Restrictions (No_Elaboration_Code);
with System;
package STM32_SVD.PWR is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CR_LPDS_Field is STM32_SVD.Bit;
subtype CR_PDDS_Field is STM32_SVD.Bit;
subtype CR_CWUF_Field is STM32_SVD.Bit;
subtype CR_CSBF_Field is STM32_SVD.Bit;
subtype CR_PVDE_Field is STM32_SVD.Bit;
subtype CR_PLS_Field is STM32_SVD.UInt3;
subtype CR_DBP_Field is STM32_SVD.Bit;
subtype CR_ULP_Field is STM32_SVD.Bit;
subtype CR_FWU_Field is STM32_SVD.Bit;
subtype CR_VOS_Field is STM32_SVD.UInt2;
subtype CR_DS_EE_KOFF_Field is STM32_SVD.Bit;
subtype CR_LPRUN_Field is STM32_SVD.Bit;
-- power control register
type CR_Register is record
-- Low-power deep sleep
LPDS : CR_LPDS_Field := 16#0#;
-- Power down deepsleep
PDDS : CR_PDDS_Field := 16#0#;
-- Clear wakeup flag
CWUF : CR_CWUF_Field := 16#0#;
-- Clear standby flag
CSBF : CR_CSBF_Field := 16#0#;
-- Power voltage detector enable
PVDE : CR_PVDE_Field := 16#0#;
-- PVD level selection
PLS : CR_PLS_Field := 16#0#;
-- Disable backup domain write protection
DBP : CR_DBP_Field := 16#0#;
-- Ultra-low-power mode
ULP : CR_ULP_Field := 16#0#;
-- Fast wakeup
FWU : CR_FWU_Field := 16#0#;
-- Voltage scaling range selection
VOS : CR_VOS_Field := 16#2#;
-- Deep sleep mode with Flash memory kept off
DS_EE_KOFF : CR_DS_EE_KOFF_Field := 16#0#;
-- Low power run mode
LPRUN : CR_LPRUN_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32_SVD.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
LPDS at 0 range 0 .. 0;
PDDS at 0 range 1 .. 1;
CWUF at 0 range 2 .. 2;
CSBF at 0 range 3 .. 3;
PVDE at 0 range 4 .. 4;
PLS at 0 range 5 .. 7;
DBP at 0 range 8 .. 8;
ULP at 0 range 9 .. 9;
FWU at 0 range 10 .. 10;
VOS at 0 range 11 .. 12;
DS_EE_KOFF at 0 range 13 .. 13;
LPRUN at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
subtype CSR_WUF_Field is STM32_SVD.Bit;
subtype CSR_SBF_Field is STM32_SVD.Bit;
subtype CSR_PVDO_Field is STM32_SVD.Bit;
subtype CSR_BRR_Field is STM32_SVD.Bit;
subtype CSR_VOSF_Field is STM32_SVD.Bit;
subtype CSR_REGLPF_Field is STM32_SVD.Bit;
subtype CSR_EWUP_Field is STM32_SVD.Bit;
subtype CSR_BRE_Field is STM32_SVD.Bit;
-- power control/status register
type CSR_Register is record
-- Read-only. Wakeup flag
WUF : CSR_WUF_Field := 16#0#;
-- Read-only. Standby flag
SBF : CSR_SBF_Field := 16#0#;
-- Read-only. PVD output
PVDO : CSR_PVDO_Field := 16#0#;
-- Read-only. Backup regulator ready
BRR : CSR_BRR_Field := 16#0#;
-- Read-only. Voltage Scaling select flag
VOSF : CSR_VOSF_Field := 16#0#;
-- Read-only. Regulator LP flag
REGLPF : CSR_REGLPF_Field := 16#0#;
-- unspecified
Reserved_6_7 : STM32_SVD.UInt2 := 16#0#;
-- Enable WKUP pin
EWUP : CSR_EWUP_Field := 16#0#;
-- Backup regulator enable
BRE : CSR_BRE_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32_SVD.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
WUF at 0 range 0 .. 0;
SBF at 0 range 1 .. 1;
PVDO at 0 range 2 .. 2;
BRR at 0 range 3 .. 3;
VOSF at 0 range 4 .. 4;
REGLPF at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
EWUP at 0 range 8 .. 8;
BRE at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Power control
type PWR_Peripheral is record
-- power control register
CR : aliased CR_Register;
-- power control/status register
CSR : aliased CSR_Register;
end record
with Volatile;
for PWR_Peripheral use record
CR at 16#0# range 0 .. 31;
CSR at 16#4# range 0 .. 31;
end record;
-- Power control
PWR_Periph : aliased PWR_Peripheral
with Import, Address => PWR_Base;
end STM32_SVD.PWR;
|
python36/vibecrypt | Ada | 309 | ads | with byte_package; use byte_package;
with raiden;
package file_crypter is
subtype key_s is raiden.key_s;
type mode is (encrypt, decrypt);
procedure init_key(key : raiden.key_s);
procedure file_crypt(in_file : byte_io.File_Type; out_file : out byte_io.File_Type; mode_crypt : mode);
end file_crypter;
|
reznikmm/matreshka | Ada | 3,971 | 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_Lines_Attributes;
package Matreshka.ODF_Chart.Lines_Attributes is
type Chart_Lines_Attribute_Node is
new Matreshka.ODF_Chart.Abstract_Chart_Attribute_Node
and ODF.DOM.Chart_Lines_Attributes.ODF_Chart_Lines_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Chart_Lines_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Chart_Lines_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Chart.Lines_Attributes;
|
yannickmoy/atomic | Ada | 9,162 | adb | with System;
package body Atomic.Generic_Signed64
with SPARK_Mode => Off
is
Size_Suffix : constant String := "8";
-- The value of this constant is the only difference between the package
-- bodies for the different data sizes (8, 16, 32, 64).
----------
-- Load --
----------
function Load
(This : aliased Instance;
Order : Mem_Order := Seq_Cst)
return T
is
function Intrinsic
(Ptr : System.Address;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_load_" & Size_Suffix);
begin
return Intrinsic (This'Address, Order'Enum_Rep);
end Load;
-----------
-- Store --
-----------
procedure Store
(This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
is
procedure Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer);
pragma Import (Intrinsic, Intrinsic, "__atomic_store_" & Size_Suffix);
begin
Intrinsic (This'Address, Val, Order'Enum_Rep);
end Store;
---------
-- Add --
---------
procedure Add (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
is
Unused : T;
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_add_fetch_" & Size_Suffix);
begin
Unused := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Add;
---------
-- Sub --
---------
procedure Sub (This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
is
Unused : T;
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_sub_fetch_" & Size_Suffix);
begin
Unused := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Sub;
-- SPARK compatible --
--------------
-- Exchange --
--------------
procedure Exchange (This : aliased in out Instance;
Val : T;
Old : out T;
Order : Mem_Order := Seq_Cst)
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_exchange_" & Size_Suffix);
begin
Old := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Exchange;
----------------------
-- Compare_Exchange --
----------------------
procedure Compare_Exchange (This : aliased in out Instance;
Expected : T;
Desired : T;
Weak : Boolean;
Success : out Boolean;
Success_Order : Mem_Order := Seq_Cst;
Failure_Order : Mem_Order := Seq_Cst)
is
function Intrinsic
(Ptr : System.Address;
Expected : System.Address;
Desired : T;
Weak : Boolean;
Success_Order, Failure_Order : Integer) return Boolean;
pragma Import (Intrinsic, Intrinsic,
"__atomic_compare_exchange_" & Size_Suffix);
Exp : T := Expected;
begin
Success := Intrinsic (This'Address, Exp'Address,
Desired,
Weak,
Success_Order'Enum_Rep,
Failure_Order'Enum_Rep);
end Compare_Exchange;
---------------
-- Add_Fetch --
---------------
procedure Add_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_add_fetch_" & Size_Suffix);
begin
Result := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Add_Fetch;
---------------
-- Sub_Fetch --
---------------
procedure Sub_Fetch (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_sub_fetch_" & Size_Suffix);
begin
Result := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Sub_Fetch;
---------------
-- Fetch_Add --
---------------
procedure Fetch_Add (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_add_" & Size_Suffix);
begin
Result := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Fetch_Add;
---------------
-- Fetch_Sub --
---------------
procedure Fetch_Sub (This : aliased in out Instance;
Val : T;
Result : out T;
Order : Mem_Order := Seq_Cst)
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_sub_" & Size_Suffix);
begin
Result := Intrinsic (This'Address, Val, Order'Enum_Rep);
end Fetch_Sub;
-- NOT SPARK Compatible --
--------------
-- Exchange --
--------------
function Exchange
(This : aliased in out Instance;
Val : T;
Order : Mem_Order := Seq_Cst)
return T
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_exchange_" & Size_Suffix);
begin
return Intrinsic (This'Address, Val, Order'Enum_Rep);
end Exchange;
----------------------
-- Compare_Exchange --
----------------------
function Compare_Exchange
(This : aliased in out Instance;
Expected : T;
Desired : T;
Weak : Boolean;
Success_Order : Mem_Order := Seq_Cst;
Failure_Order : Mem_Order := Seq_Cst)
return Boolean
is
function Intrinsic
(Ptr : System.Address;
Expected : System.Address;
Desired : T;
Weak : Boolean;
Success_Order, Failure_Order : Integer) return Boolean;
pragma Import (Intrinsic, Intrinsic,
"__atomic_compare_exchange_" & Size_Suffix);
Exp : T := Expected;
begin
return Intrinsic (This'Address, Exp'Address,
Desired,
Weak,
Success_Order'Enum_Rep,
Failure_Order'Enum_Rep);
end Compare_Exchange;
---------------
-- Add_Fetch --
---------------
function Add_Fetch
(This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst)
return T
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_add_fetch_" & Size_Suffix);
begin
return Intrinsic (This'Address, Val, Order'Enum_Rep);
end Add_Fetch;
---------------
-- Sub_Fetch --
---------------
function Sub_Fetch
(This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst)
return T
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_sub_fetch_" & Size_Suffix);
begin
return Intrinsic (This'Address, Val, Order'Enum_Rep);
end Sub_Fetch;
---------------
-- Fetch_Add --
---------------
function Fetch_Add
(This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst)
return T
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_add_" & Size_Suffix);
begin
return Intrinsic (This'Address, Val, Order'Enum_Rep);
end Fetch_Add;
---------------
-- Fetch_Sub --
---------------
function Fetch_Sub
(This : aliased in out Instance; Val : T; Order : Mem_Order := Seq_Cst)
return T
is
function Intrinsic
(Ptr : System.Address;
Val : T;
Model : Integer) return T;
pragma Import (Intrinsic, Intrinsic, "__atomic_fetch_sub_" & Size_Suffix);
begin
return Intrinsic (This'Address, Val, Order'Enum_Rep);
end Fetch_Sub;
end Atomic.Generic_Signed64;
|
reznikmm/matreshka | Ada | 3,754 | 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_Layout_Grid_Color_Attributes is
pragma Preelaborate;
type ODF_Style_Layout_Grid_Color_Attribute is limited interface
and XML.DOM.Attributes.DOM_Attribute;
type ODF_Style_Layout_Grid_Color_Attribute_Access is
access all ODF_Style_Layout_Grid_Color_Attribute'Class
with Storage_Size => 0;
end ODF.DOM.Style_Layout_Grid_Color_Attributes;
|
jscparker/math_packages | Ada | 12,752 | adb |
-----------------------------------------------------------------------
-- package body Crout_LU, LU decomposition, with equation solving
-- Copyright (C) 2008-2018 Jonathan S. Parker
--
-- 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 Crout_LU is
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Two : constant Real := +2.0;
Min_Allowed_Real : constant Real := Two ** (Real'Machine_Emin - Real'Machine_Emin / 8);
---------
-- "-" --
---------
function "-"
(A, B : in Col_Vector)
return Col_Vector
is
Result : Col_Vector;
begin
for J in Index loop
Result(J) := A(J) - B(J);
end loop;
return Result;
end "-";
-------------
-- Product --
-------------
function Product
(A : Matrix;
V : Row_Vector;
Final_Index : Index := Index'Last;
Starting_Index : Index := Index'First)
return Row_Vector
is
Result : Col_Vector := (others => Zero);
Sum : Real;
begin
for i in Starting_Index .. Final_Index loop
Sum := Zero;
for j in Starting_Index .. Final_Index loop
Sum := Sum + A(i, j) * V(j);
end loop;
Result (i) := Sum;
end loop;
return Result;
end Product;
--------------------------
-- Scale_Cols_Then_Rows --
--------------------------
procedure Scale_Cols_Then_Rows
(A : in out Matrix;
Scalings : out Scale_Vectors;
Final_Index : in Index := Index'Last;
Starting_Index : in Index := Index'First)
is
Sum, Scale_Factor : Real;
Power_of_Two : Integer;
begin
-- Scale each column to near unity:
Scalings (For_Cols) := (others => One);
for Col in Starting_Index .. Final_Index loop
Sum := Zero;
for j in Starting_Index .. Final_Index loop
Sum := Sum + Abs A(j, Col);
end loop;
Power_of_Two := Real'Exponent (Sum + Min_Allowed_Real);
Scale_Factor := Two ** (-Power_of_Two);
for j in Starting_Index .. Final_Index loop
A(j, Col) := Scale_Factor * A(j, Col);
end loop;
Scalings (For_Cols)(Col) := Scale_Factor;
end loop;
-- Scale each row to near unity:
Scalings (For_Rows) := (others => One);
for Row in Starting_Index .. Final_Index loop
Sum := Zero;
for j in Starting_Index .. Final_Index loop
Sum := Sum + Abs A(Row, j);
end loop;
Power_of_Two := Real'Exponent (Sum + Min_Allowed_Real);
Scale_Factor := Two ** (-Power_of_Two);
for j in Starting_Index .. Final_Index loop
A(Row, j) := Scale_Factor * A(Row, j);
end loop;
Scalings (For_Rows)(Row) := Scale_Factor;
end loop;
end Scale_Cols_Then_Rows;
------------------
-- LU_Decompose --
------------------
-- The upper matrix is U, the lower L.
-- We assume that the diagonal elements of L are One. Thus
-- the diagonal elements of U but not L appear on the
-- the diagonal of the output matrix A.
procedure LU_Decompose
(A : in out Matrix;
Scalings : out Scale_Vectors;
Row_Permutation : out Rearrangement;
Final_Index : in Index := Index'Last;
Starting_Index : in Index := Index'First;
Scaling_Desired : in Boolean := False)
is
Stage : Index;
tmp_Index, The_Pivotal_Row : Index;
Sum, tmp : Real;
Min_Allowed_Pivot_Val, Reciprocal_Pivot_Val : Real;
Pivot_Val, Abs_Pivot_Val : Real;
Min_Pivot_Ratio : constant Real := Two**(-Real'Machine_Mantissa-24);
Max_Pivot_Val : Real := Min_Allowed_Real;
-----------------------------
-- Find_Max_Element_Of_Col --
-----------------------------
procedure Find_Max_Element_Of_Col
(Col_ID : in Index;
Starting_Index : in Index;
Index_of_Max_Element : out Index;
Val_of_Max_Element : out Real;
Abs_Val_of_Max_Element : out Real)
is
Pivot_Val, Abs_Pivot_Val : Real;
begin
Val_of_Max_Element := A (Starting_Index, Col_ID);
Abs_Val_of_Max_Element := Abs (Val_of_Max_Element);
Index_of_Max_Element := Starting_Index;
if Final_Index > Starting_Index then
for k in Starting_Index+1..Final_Index loop
Pivot_Val := A (k, Col_ID);
Abs_Pivot_Val := Abs (Pivot_Val);
if Abs_Pivot_Val > Abs_Val_of_Max_Element then
Val_of_Max_Element := Pivot_Val;
Abs_Val_of_Max_Element := Abs_Pivot_Val;
Index_of_Max_Element := k;
end if;
end loop;
end if;
end Find_Max_Element_Of_Col;
begin
for I in Index loop
Row_Permutation(I) := I;
end loop;
Scalings(Diag_Inverse) := (others => Zero);
Scalings(For_Cols) := (others => One);
Scalings(For_Rows) := (others => One);
if Scaling_Desired then
Scale_Cols_Then_Rows (A, Scalings, Final_Index, Starting_Index);
end if;
-- Step 0: 1 X 1 matrices:
if Final_Index = Starting_Index then
Pivot_Val := A(Starting_Index, Starting_Index);
if Abs (Pivot_Val) < Min_Allowed_Real then
A(Starting_Index, Starting_Index) := Zero;
else
A(Starting_Index, Starting_Index) := Pivot_Val;
Scalings(Diag_Inverse)(Starting_Index) := One / Pivot_Val;
end if;
return;
end if;
-- Process goes through stages Starting_Index..Final_Index.
-- The last stage is a special case.
--
-- At each stage calculate row "stage" of the Upper
-- matrix U and Col "Stage" of the Lower matrix L.
-- The matrix A is overwritten with these, because the elements
-- of A in those places are never needed in future stages.
-- However, the elements of U and L ARE needed in those places,
-- so to get those elements we access A (which stores them).
for Stage in Starting_Index .. Final_Index-1 loop
if Stage > Starting_Index then
for Row in Stage .. Final_Index loop
Sum := Zero;
for K in Starting_Index .. Stage-1 loop
--Sum := Sum + L(Row, K)*U(K, Stage);
Sum := Sum + A(Row, K)*A(K, Stage);
end loop;
A(Row, Stage) := A(Row, Stage) - Sum;
end loop;
end if;
-- Step 2. Swap rows of L and A if necessary.
-- Do it by swapping rows of A.
-- Notice that the Rows of U that have already been calculated and
-- stored in A, namely (1..Stage-1), are untouched by the swap.
Find_Max_Element_Of_Col
(Col_ID => Stage,
Starting_Index => Stage,
Index_of_Max_Element => The_Pivotal_Row,
Val_of_Max_Element => Pivot_Val,
Abs_Val_of_Max_Element => Abs_Pivot_Val);
if The_Pivotal_Row /= Stage then
for j in Starting_Index .. Final_Index loop
tmp := A(The_Pivotal_Row, j);
A(The_Pivotal_Row, j) := A(Stage, j);
A(Stage, j) := tmp;
end loop;
tmp_Index := Row_Permutation(The_Pivotal_Row);
Row_Permutation(The_Pivotal_Row) := Row_Permutation(Stage);
Row_Permutation(Stage) := tmp_Index;
end if;
-- Step 3:
-- Update Ith_row = Stage of the upper triangular matrix U.
-- Update Ith_col = Stage of the lower triangular matrix L.
-- The rules are that the diagonal elements of L are 1 even
-- though Pivot_Val * Reciprocal_Pivot_Val /= 1.
-- Constraint is that L*U = A when possible.
if Abs_Pivot_Val > Max_Pivot_Val then
Max_Pivot_Val := Abs_Pivot_Val;
end if;
Min_Allowed_Pivot_Val := Max_Pivot_Val * Min_Pivot_Ratio + Min_Allowed_Real;
if (Abs_Pivot_Val < Abs Min_Allowed_Pivot_Val) then
Reciprocal_Pivot_Val := Zero;
else
Reciprocal_Pivot_Val := One / Pivot_Val;
end if;
Scalings(Diag_Inverse)(Stage) := Reciprocal_Pivot_Val;
A(Stage, Stage) := Pivot_Val;
for Row in Stage+1 .. Final_Index loop
A(Row, Stage) := A(Row, Stage) * Reciprocal_Pivot_Val;
end loop;
if Stage > Starting_Index then
for Col in Stage+1 .. Final_Index loop
Sum := Zero;
for K in Starting_Index .. Stage-1 loop
--Sum := Sum + L(Stage, K)*U(K, Col);
Sum := Sum + A(Stage, K)*A(K, Col);
end loop;
--U(Stage, Col) := A(Stage, Col) - Sum;
A(Stage, Col) := A(Stage, Col) - Sum;
end loop;
end if;
end loop; -- Stage
-- Step 4: Get final row and column.
Stage := Final_Index;
Sum := Zero;
for K in Starting_Index .. Stage-1 loop
--Sum := Sum + L(Stage, K)*U(K, Stage);
Sum := Sum + A(Stage, K)*A(K, Stage);
end loop;
Pivot_Val := A(Stage, Stage) - Sum;
Abs_Pivot_Val := Abs Pivot_Val;
Min_Allowed_Pivot_Val := Max_Pivot_Val * Min_Pivot_Ratio + Min_Allowed_Real;
if (Abs_Pivot_Val < Abs Min_Allowed_Pivot_Val) then
Reciprocal_Pivot_Val := Zero;
else
Reciprocal_Pivot_Val := One / Pivot_Val;
end if;
Scalings(Diag_Inverse)(Stage) := Reciprocal_Pivot_Val;
A(Stage, Stage) := Pivot_Val;
end LU_Decompose;
--------------
-- LU_Solve --
--------------
procedure LU_Solve
(X : out Row_Vector;
B : in Row_Vector;
A_LU : in Matrix;
Scalings : in Scale_Vectors;
Row_Permutation : in Rearrangement;
Final_Index : in Index := Index'Last;
Starting_Index : in Index := Index'First)
is
Z, B2, B_s : Row_Vector;
Sum : Real;
begin
X := (others => Zero);
-- A*X = B was changed to (S_r*A*S_c) * (S_c^(-1)*X) = (S_r*B).
-- The matrix LU'd was (S_r*A*S_c). Let B_s = (S_r*B). Solve for
-- X_s = (S_c^(-1)*X).
--
-- The matrix equation is now P*L*U*X_s = B_s (the scaled B).
--
-- First assume L*U*X_s is B2, and solve for B2 in the equation P*B2 = B_s.
-- Permute the elements of the vector B_s according to "Permutation":
-- Get B_s = S_r*B:
for i in Starting_Index .. Final_Index loop
B_s(i) := Scalings(For_Rows)(i) * B(i);
end loop;
-- Get B2 by solving P*B2 = B_s = B:
for i in Starting_Index .. Final_Index loop
B2(i) := B_s(Row_Permutation(i));
end loop;
-- The matrix equation is now L*U*X = B2.
-- Assume U*X is Z, and solve for Z in the equation L*Z = B2.
-- Remember that by assumption L(I, I) = One, U(I, I) /= One.
Z(Starting_Index) := B2(Starting_Index);
if Starting_Index < Final_Index then
for Row in Starting_Index+1 .. Final_Index loop
Sum := Zero;
for Col in Starting_Index .. Row-1 loop
Sum := Sum + A_LU(Row, Col) * Z(Col);
end loop;
Z(Row) := B2(Row) - Sum;
end loop;
end if;
-- Solve for X_s in the equation U X_s = Z.
X(Final_Index) := Z(Final_Index) * Scalings(Diag_Inverse)(Final_Index);
if Final_Index > Starting_Index then
for Row in reverse Starting_Index .. Final_Index-1 loop
Sum := Zero;
for Col in Row+1 .. Final_Index loop
Sum := Sum + A_LU(Row, Col) * X(Col);
end loop;
X(Row) := (Z(Row) - Sum) * Scalings(Diag_Inverse)(Row);
end loop;
end if;
-- Solved for the scaled X_s (but called it X); now get the real X:
for i in Starting_Index .. Final_Index loop
X(i) := Scalings(For_Cols)(i) * X(i);
end loop;
end LU_Solve;
end Crout_LU;
|
reznikmm/matreshka | Ada | 4,599 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Text.Increment_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Text_Increment_Attribute_Node is
begin
return Self : Text_Increment_Attribute_Node do
Matreshka.ODF_Text.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Text_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Text_Increment_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Increment_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Text_URI,
Matreshka.ODF_String_Constants.Increment_Attribute,
Text_Increment_Attribute_Node'Tag);
end Matreshka.ODF_Text.Increment_Attributes;
|
reznikmm/matreshka | Ada | 18,652 | 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.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.OCL_Attributes;
with AMF.OCL.Collection_Literal_Parts.Collections;
with AMF.UML.Comments.Collections;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces.Collections;
with AMF.UML.Packages.Collections;
with AMF.UML.String_Expressions;
with AMF.UML.Types;
with AMF.Visitors.OCL_Iterators;
with AMF.Visitors.OCL_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.OCL_Collection_Literal_Exps is
--------------
-- Get_Kind --
--------------
overriding function Get_Kind
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.OCL.OCL_Collection_Kind is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Kind
(Self.Element);
end Get_Kind;
--------------
-- Set_Kind --
--------------
overriding procedure Set_Kind
(Self : not null access OCL_Collection_Literal_Exp_Proxy;
To : AMF.OCL.OCL_Collection_Kind) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Kind
(Self.Element, To);
end Set_Kind;
--------------
-- Get_Part --
--------------
overriding function Get_Part
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.OCL.Collection_Literal_Parts.Collections.Ordered_Set_Of_OCL_Collection_Literal_Part is
begin
return
AMF.OCL.Collection_Literal_Parts.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Part
(Self.Element)));
end Get_Part;
--------------
-- Get_Type --
--------------
overriding function Get_Type
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Types.UML_Type_Access is
begin
return
AMF.UML.Types.UML_Type_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Type
(Self.Element)));
end Get_Type;
--------------
-- Set_Type --
--------------
overriding procedure Set_Type
(Self : not null access OCL_Collection_Literal_Exp_Proxy;
To : AMF.UML.Types.UML_Type_Access) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Type
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Type;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant OCL_Collection_Literal_Exp_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.OCL_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
--------------
-- Get_Name --
--------------
overriding function Get_Name
(Self : not null access constant OCL_Collection_Literal_Exp_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.OCL_Attributes.Internal_Get_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_Name;
--------------
-- Set_Name --
--------------
overriding procedure Set_Name
(Self : not null access OCL_Collection_Literal_Exp_Proxy;
To : AMF.Optional_String) is
begin
if To.Is_Empty then
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element, null);
else
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Name
(Self.Element,
League.Strings.Internals.Internal (To.Value));
end if;
end Set_Name;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant OCL_Collection_Literal_Exp_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.OCL_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access OCL_Collection_Literal_Exp_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.OCL_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 OCL_Collection_Literal_Exp_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.OCL_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant OCL_Collection_Literal_Exp_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.OCL_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_Visibility --
--------------------
overriding function Get_Visibility
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Optional_UML_Visibility_Kind is
begin
return
AMF.Internals.Tables.OCL_Attributes.Internal_Get_Visibility
(Self.Element);
end Get_Visibility;
--------------------
-- Set_Visibility --
--------------------
overriding procedure Set_Visibility
(Self : not null access OCL_Collection_Literal_Exp_Proxy;
To : AMF.UML.Optional_UML_Visibility_Kind) is
begin
AMF.Internals.Tables.OCL_Attributes.Internal_Set_Visibility
(Self.Element, To);
end Set_Visibility;
-----------------------
-- Get_Owned_Comment --
-----------------------
overriding function Get_Owned_Comment
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Comments.Collections.Set_Of_UML_Comment is
begin
return
AMF.UML.Comments.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Comment
(Self.Element)));
end Get_Owned_Comment;
-----------------------
-- Get_Owned_Element --
-----------------------
overriding function Get_Owned_Element
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
return
AMF.UML.Elements.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owned_Element
(Self.Element)));
end Get_Owned_Element;
---------------
-- Get_Owner --
---------------
overriding function Get_Owner
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Elements.UML_Element_Access is
begin
return
AMF.UML.Elements.UML_Element_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.OCL_Attributes.Internal_Get_Owner
(Self.Element)));
end Get_Owner;
--------------------
-- All_Namespaces --
--------------------
overriding function All_Namespaces
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Namespaces unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Collection_Literal_Exp_Proxy.All_Namespaces";
return All_Namespaces (Self);
end All_Namespaces;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant OCL_Collection_Literal_Exp_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 OCL_Collection_Literal_Exp_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 OCL_Collection_Literal_Exp_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 OCL_Collection_Literal_Exp_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant OCL_Collection_Literal_Exp_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 OCL_Collection_Literal_Exp_Proxy.Namespace";
return Namespace (Self);
end Namespace;
--------------------
-- Qualified_Name --
--------------------
overriding function Qualified_Name
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Qualified_Name unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Collection_Literal_Exp_Proxy.Qualified_Name";
return Qualified_Name (Self);
end Qualified_Name;
---------------
-- Separator --
---------------
overriding function Separator
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return League.Strings.Universal_String is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Separator unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Collection_Literal_Exp_Proxy.Separator";
return Separator (Self);
end Separator;
------------------------
-- All_Owned_Elements --
------------------------
overriding function All_Owned_Elements
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return AMF.UML.Elements.Collections.Set_Of_UML_Element is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Collection_Literal_Exp_Proxy.All_Owned_Elements";
return All_Owned_Elements (Self);
end All_Owned_Elements;
-------------------
-- Must_Be_Owned --
-------------------
overriding function Must_Be_Owned
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Must_Be_Owned unimplemented");
raise Program_Error with "Unimplemented procedure OCL_Collection_Literal_Exp_Proxy.Must_Be_Owned";
return Must_Be_Owned (Self);
end Must_Be_Owned;
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Enter_Collection_Literal_Exp
(AMF.OCL.Collection_Literal_Exps.OCL_Collection_Literal_Exp_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant OCL_Collection_Literal_Exp_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.OCL_Visitors.OCL_Visitor'Class then
AMF.Visitors.OCL_Visitors.OCL_Visitor'Class
(Visitor).Leave_Collection_Literal_Exp
(AMF.OCL.Collection_Literal_Exps.OCL_Collection_Literal_Exp_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant OCL_Collection_Literal_Exp_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.OCL_Iterators.OCL_Iterator'Class then
AMF.Visitors.OCL_Iterators.OCL_Iterator'Class
(Iterator).Visit_Collection_Literal_Exp
(Visitor,
AMF.OCL.Collection_Literal_Exps.OCL_Collection_Literal_Exp_Access (Self),
Control);
end if;
end Visit_Element;
end AMF.Internals.OCL_Collection_Literal_Exps;
|
optikos/oasis | Ada | 4,273 | ads | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Enumeration_Literal_Specifications;
with Program.Elements.Enumeration_Types;
with Program.Element_Visitors;
package Program.Nodes.Enumeration_Types is
pragma Preelaborate;
type Enumeration_Type is
new Program.Nodes.Node
and Program.Elements.Enumeration_Types.Enumeration_Type
and Program.Elements.Enumeration_Types.Enumeration_Type_Text
with private;
function Create
(Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Literals : not null Program.Elements
.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Enumeration_Type;
type Implicit_Enumeration_Type is
new Program.Nodes.Node
and Program.Elements.Enumeration_Types.Enumeration_Type
with private;
function Create
(Literals : not null Program.Elements
.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Enumeration_Type
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Enumeration_Type is
abstract new Program.Nodes.Node
and Program.Elements.Enumeration_Types.Enumeration_Type
with record
Literals : not null Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access;
end record;
procedure Initialize (Self : aliased in out Base_Enumeration_Type'Class);
overriding procedure Visit
(Self : not null access Base_Enumeration_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Literals
(Self : Base_Enumeration_Type)
return not null Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Vector_Access;
overriding function Is_Enumeration_Type_Element
(Self : Base_Enumeration_Type)
return Boolean;
overriding function Is_Type_Definition_Element
(Self : Base_Enumeration_Type)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Enumeration_Type)
return Boolean;
type Enumeration_Type is
new Base_Enumeration_Type
and Program.Elements.Enumeration_Types.Enumeration_Type_Text
with record
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Enumeration_Type_Text
(Self : aliased in out Enumeration_Type)
return Program.Elements.Enumeration_Types.Enumeration_Type_Text_Access;
overriding function Left_Bracket_Token
(Self : Enumeration_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Right_Bracket_Token
(Self : Enumeration_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Enumeration_Type is
new Base_Enumeration_Type
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Enumeration_Type_Text
(Self : aliased in out Implicit_Enumeration_Type)
return Program.Elements.Enumeration_Types.Enumeration_Type_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Enumeration_Type)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Enumeration_Type)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Enumeration_Type)
return Boolean;
end Program.Nodes.Enumeration_Types;
|
reznikmm/matreshka | Ada | 6,718 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Web API Definition --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-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 package provides binding for interface HTMLCanvasElement.
------------------------------------------------------------------------------
with WebAPI.HTML.Elements;
with WebAPI.HTML.Rendering_Contexts;
package WebAPI.HTML.Canvas_Elements is
pragma Preelaborate;
type HTML_Canvas_Element is limited interface
and WebAPI.HTML.Elements.HTML_Element;
type HTML_Canvas_Element_Access is access all HTML_Canvas_Element'Class
with Storage_Size => 0;
not overriding function Get_Width
(Self : not null access constant HTML_Canvas_Element)
return WebAPI.DOM_Unsigned_Long is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "width";
not overriding procedure Set_Width
(Self : not null access HTML_Canvas_Element;
To : WebAPI.DOM_Unsigned_Long) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "width";
not overriding function Get_Height
(Self : not null access constant HTML_Canvas_Element)
return WebAPI.DOM_Unsigned_Long is abstract
with Import => True,
Convention => JavaScript_Property_Getter,
Link_Name => "height";
not overriding procedure Set_Height
(Self : not null access HTML_Canvas_Element;
To : WebAPI.DOM_Unsigned_Long) is abstract
with Import => True,
Convention => JavaScript_Property_Setter,
Link_Name => "height";
not overriding function Get_Context
(Self : not null access HTML_Canvas_Element;
Context_Id : WebAPI.DOM_String)
return WebAPI.HTML.Rendering_Contexts.Rendering_Context_Access
is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "getContext";
-- Returns an object that exposes an API for drawing on the canvas. The
-- first argument specifies the desired API, either "2d" or "webgl".
-- Subsequent arguments are handled by that API.
--
-- This specification defines the "2d" context below. There is also a
-- specification that defines a "webgl" context. [WEBGL]
--
-- Returns null if the given context ID is not supported, if the canvas has
-- already been initialised with the other context type (e.g. trying to
-- get a "2d" context after getting a "webgl" context).
--
-- Throws an InvalidStateError exception if the setContext() or
-- transferControlToProxy() methods have been used.
not overriding function Probably_Supports_Context
(Self : not null access HTML_Canvas_Element;
Context_Id : WebAPI.DOM_String) return Boolean is abstract
with Import => True,
Convention => JavaScript_Method,
Link_Name => "probablySupportsContext";
-- Returns false if calling getContext() with the same arguments would
-- definitely return null, and true otherwise.
--
-- This return value is not a guarantee that getContext() will or will not
-- return an object, as conditions (e.g. availability of system resources)
-- can vary over time.
--
-- Throws an InvalidStateError exception if the setContext() or
-- transferControlToProxy() methods have been used.
end WebAPI.HTML.Canvas_Elements;
|
sungyeon/drake | Ada | 345 | ads | pragma License (Unrestricted);
-- Ada 2012, specialized for Linux
package System.Multiprocessors is
pragma Preelaborate;
type CPU_Range is range 0 .. Integer'Last;
Not_A_Specific_CPU : constant CPU_Range := 0;
subtype CPU is CPU_Range range 1 .. CPU_Range'Last;
function Number_Of_CPUs return CPU;
end System.Multiprocessors;
|
OneWingedShark/Risi | Ada | 2,091 | ads | Pragma Ada_2012;
Pragma Wide_Character_Encoding( UTF8 );
With
System,
System.Address_Image,
Ada.Strings.Unbounded,
Ada.Strings.Less_Case_Insensitive,
Ada.Containers.Indefinite_Ordered_Maps,
Ada.Containers.Indefinite_Vectors,
Risi_Script.Types.Implementation;
Private Package Risi_Script.Types.Internals with Elaborate_Body is
------------------------
-- AUXILARY PACKAGES --
------------------------
Package Hash is new Ada.Containers.Indefinite_Ordered_Maps(
"=" => Risi_Script.Types.Implementation."=",
"<" => Ada.Strings.Less_Case_Insensitive,
Key_Type => String,
Element_Type => Risi_Script.Types.Implementation.Representation
);
Package List is new Ada.Containers.Indefinite_Vectors(
"=" => Risi_Script.Types.Implementation."=",
Index_Type => Positive,
Element_Type => Risi_Script.Types.Implementation.Representation
);
---------------------
-- AUXILARY TYPES --
---------------------
Type Integer_Type is new Long_Long_Integer;
SubType Array_Type is List.Vector;
SubType Hash_Type is Hash.Map;
SubType String_Type is Ada.Strings.Unbounded.Unbounded_String;
Type Real_Type is new Long_Long_Float;
Type Pointer_Type is new System.Address;
SubType Reference_Type is Risi_Script.Types.Implementation.Representation;
Type Fixed_Type is delta 10.0**(-4) digits 18 with Size => 64;
Type Boolean_Type is new Boolean;
Type Func_Type is not null access function(X, Y : Integer) return Integer;
------------------------
-- AUXILARY GENERICS --
------------------------
Generic
Type X;
with Function Create( Element : X ) return Risi_Script.Types.Implementation.Representation is <>;
Function To_Array(Value : X ) return Array_Type;
Generic
Type X;
with Function Create( Element : X ) return Risi_Script.Types.Implementation.Representation is <>;
Function To_Hash(Value : X ) return Hash_Type;
End Risi_Script.Types.Internals;
|
AdaCore/gpr | Ada | 43 | ads | package test7 is
I : Integer;
end test7; |
RREE/ada-util | Ada | 5,415 | ads | -----------------------------------------------------------------------
-- util-beans-factory -- Bean Registration and Factory
-- Copyright (C) 2010, 2018 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Util.Beans.Basic;
with Util.Beans.Methods;
private with Ada.Containers.Indefinite_Hashed_Maps;
private with Ada.Strings.Unbounded.Hash;
-- The <b>EL.Beans.Factory</b> package is a registry for the creation
-- of request, session and application beans.
package Util.Beans.Factory is
-- The bean definition is a small descriptor used by the
-- factory to create the bean instance when it is needed.
-- It also defines the methods that can be specified and
-- invoked as part of a <b>Method_Expression</b>.
type Bean_Definition (Method_Count : Natural) is abstract tagged limited record
Methods : Util.Beans.Methods.Method_Binding_Array (1 .. Method_Count);
end record;
type Bean_Definition_Access is access constant Bean_Definition'Class;
-- Create a bean.
function Create (Def : in Bean_Definition)
return Util.Beans.Basic.Readonly_Bean_Access is abstract;
-- Free the bean instance.
procedure Destroy (Def : in Bean_Definition;
Bean : in out Util.Beans.Basic.Readonly_Bean_Access) is abstract;
-- Defines the scope of the bean instance.
type Scope_Type is
(
-- Application scope means the bean is shared by all sessions and requests
APPLICATION_SCOPE,
-- Session scope means the bean is created one for each session.
SESSION_SCOPE,
-- Request scope means the bean is created for each request
REQUEST_SCOPE,
ANY_SCOPE);
-- ------------------------------
-- Binding
-- ------------------------------
type Binding is interface;
type Binding_Access is access all Binding'Class;
procedure Create (Factory : in Binding;
Name : in Ada.Strings.Unbounded.Unbounded_String;
Result : out Util.Beans.Basic.Readonly_Bean_Access;
Definition : out Bean_Definition_Access;
Scope : out Scope_Type) is abstract;
-- ------------------------------
-- Bean Factory
-- ------------------------------
-- Factory for bean creation
type Bean_Factory is limited private;
-- Register under the given name a function to create the bean instance when
-- it is accessed for a first time. The scope defines the scope of the bean.
-- bean
procedure Register (Factory : in out Bean_Factory;
Name : in String;
Definition : in Bean_Definition_Access;
Scope : in Scope_Type := REQUEST_SCOPE);
-- Register under the given name a function to create the bean instance when
-- it is accessed for a first time. The scope defines the scope of the bean.
-- bean
procedure Register (Factory : in out Bean_Factory;
Name : in String;
Bind : in Binding_Access);
-- Register all the definitions from a factory to a main factory.
procedure Register (Factory : in out Bean_Factory;
From : in Bean_Factory);
-- Create a bean by using the create operation registered for the name
procedure Create (Factory : in Bean_Factory;
Name : in Ada.Strings.Unbounded.Unbounded_String;
Result : out Util.Beans.Basic.Readonly_Bean_Access;
Definition : out Bean_Definition_Access;
Scope : out Scope_Type);
type Simple_Binding is new Binding with private;
procedure Create (Factory : in Simple_Binding;
Name : in Ada.Strings.Unbounded.Unbounded_String;
Result : out Util.Beans.Basic.Readonly_Bean_Access;
Definition : out Bean_Definition_Access;
Scope : out Scope_Type);
private
type Simple_Binding is new Binding with record
Def : Bean_Definition_Access;
Scope : Scope_Type;
end record;
type Simple_Binding_Access is access all Simple_Binding;
use Ada.Strings.Unbounded;
package Bean_Maps is new
Ada.Containers.Indefinite_Hashed_Maps (Key_Type => Unbounded_String,
Element_Type => Binding_Access,
Hash => Ada.Strings.Unbounded.Hash,
Equivalent_Keys => "=");
type Bean_Factory is limited record
Map : Bean_Maps.Map;
end record;
end Util.Beans.Factory;
|
ekoeppen/STM32_Generic_Ada_Drivers | Ada | 6,510 | ads | pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32L0x1.svd
pragma Restrictions (No_Elaboration_Code);
with System;
package STM32_SVD.Firewall is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype FIREWALL_CSSA_ADD_Field is STM32_SVD.UInt16;
-- Code segment start address
type FIREWALL_CSSA_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte := 16#0#;
-- code segment start address
ADD : FIREWALL_CSSA_ADD_Field := 16#0#;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_CSSA_Register use record
Reserved_0_7 at 0 range 0 .. 7;
ADD at 0 range 8 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FIREWALL_CSL_LENG_Field is STM32_SVD.UInt14;
-- Code segment length
type FIREWALL_CSL_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte := 16#0#;
-- code segment length
LENG : FIREWALL_CSL_LENG_Field := 16#0#;
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_CSL_Register use record
Reserved_0_7 at 0 range 0 .. 7;
LENG at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
subtype FIREWALL_NVDSSA_ADD_Field is STM32_SVD.UInt16;
-- Non-volatile data segment start address
type FIREWALL_NVDSSA_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte := 16#0#;
-- Non-volatile data segment start address
ADD : FIREWALL_NVDSSA_ADD_Field := 16#0#;
-- unspecified
Reserved_24_31 : STM32_SVD.Byte := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_NVDSSA_Register use record
Reserved_0_7 at 0 range 0 .. 7;
ADD at 0 range 8 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FIREWALL_NVDSL_LENG_Field is STM32_SVD.UInt14;
-- Non-volatile data segment length
type FIREWALL_NVDSL_Register is record
-- unspecified
Reserved_0_7 : STM32_SVD.Byte := 16#0#;
-- Non-volatile data segment length
LENG : FIREWALL_NVDSL_LENG_Field := 16#0#;
-- unspecified
Reserved_22_31 : STM32_SVD.UInt10 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_NVDSL_Register use record
Reserved_0_7 at 0 range 0 .. 7;
LENG at 0 range 8 .. 21;
Reserved_22_31 at 0 range 22 .. 31;
end record;
subtype FIREWALL_VDSSA_ADD_Field is STM32_SVD.UInt10;
-- Volatile data segment start address
type FIREWALL_VDSSA_Register is record
-- unspecified
Reserved_0_5 : STM32_SVD.UInt6 := 16#0#;
-- Volatile data segment start address
ADD : FIREWALL_VDSSA_ADD_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_VDSSA_Register use record
Reserved_0_5 at 0 range 0 .. 5;
ADD at 0 range 6 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FIREWALL_VDSL_LENG_Field is STM32_SVD.UInt10;
-- Volatile data segment length
type FIREWALL_VDSL_Register is record
-- unspecified
Reserved_0_5 : STM32_SVD.UInt6 := 16#0#;
-- Non-volatile data segment length
LENG : FIREWALL_VDSL_LENG_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32_SVD.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_VDSL_Register use record
Reserved_0_5 at 0 range 0 .. 5;
LENG at 0 range 6 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype FIREWALL_CR_FPA_Field is STM32_SVD.Bit;
subtype FIREWALL_CR_VDS_Field is STM32_SVD.Bit;
subtype FIREWALL_CR_VDE_Field is STM32_SVD.Bit;
-- Configuration register
type FIREWALL_CR_Register is record
-- Firewall pre alarm
FPA : FIREWALL_CR_FPA_Field := 16#0#;
-- Volatile data shared
VDS : FIREWALL_CR_VDS_Field := 16#0#;
-- Volatile data execution
VDE : FIREWALL_CR_VDE_Field := 16#0#;
-- unspecified
Reserved_3_31 : STM32_SVD.UInt29 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for FIREWALL_CR_Register use record
FPA at 0 range 0 .. 0;
VDS at 0 range 1 .. 1;
VDE at 0 range 2 .. 2;
Reserved_3_31 at 0 range 3 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Firewall
type Firewall_Peripheral is record
-- Code segment start address
FIREWALL_CSSA : aliased FIREWALL_CSSA_Register;
-- Code segment length
FIREWALL_CSL : aliased FIREWALL_CSL_Register;
-- Non-volatile data segment start address
FIREWALL_NVDSSA : aliased FIREWALL_NVDSSA_Register;
-- Non-volatile data segment length
FIREWALL_NVDSL : aliased FIREWALL_NVDSL_Register;
-- Volatile data segment start address
FIREWALL_VDSSA : aliased FIREWALL_VDSSA_Register;
-- Volatile data segment length
FIREWALL_VDSL : aliased FIREWALL_VDSL_Register;
-- Configuration register
FIREWALL_CR : aliased FIREWALL_CR_Register;
end record
with Volatile;
for Firewall_Peripheral use record
FIREWALL_CSSA at 16#0# range 0 .. 31;
FIREWALL_CSL at 16#4# range 0 .. 31;
FIREWALL_NVDSSA at 16#8# range 0 .. 31;
FIREWALL_NVDSL at 16#C# range 0 .. 31;
FIREWALL_VDSSA at 16#10# range 0 .. 31;
FIREWALL_VDSL at 16#14# range 0 .. 31;
FIREWALL_CR at 16#20# range 0 .. 31;
end record;
-- Firewall
Firewall_Periph : aliased Firewall_Peripheral
with Import, Address => Firewall_Base;
end STM32_SVD.Firewall;
|
stcarrez/mat | Ada | 1,165 | adb |
-- Warning: This file is automatically generated by AFLEX.
-- It is useless to modify it. Change the ".Y" & ".L" files instead.
package body MAT.Expressions.Lexer_DFA is
-- Nov 2002. Fixed insufficient buffer size bug causing
-- damage to comments at about the 1000-th character
function YYText return String is
J : Integer := yytext_ptr;
begin
while J <= yy_ch_buf'Last and then yy_ch_buf (J) /= ASCII.NUL loop
J := J + 1;
end loop;
declare
subtype Sliding_Type is String (1 .. J - yytext_ptr);
begin
return Sliding_Type (yy_ch_buf (yytext_ptr .. J - 1));
end;
end YYText;
-- Returns the length of the matched text
function YYLength return Integer is
begin
return yy_cp - yy_bp;
end YYLength;
-- Done after the current pattern has been matched and before the
-- corresponding action - sets up yytext
procedure YY_DO_BEFORE_ACTION is
begin
yytext_ptr := yy_bp;
yy_hold_char := yy_ch_buf (yy_cp);
yy_ch_buf (yy_cp) := ASCII.NUL;
yy_c_buf_p := yy_cp;
end YY_DO_BEFORE_ACTION;
end MAT.Expressions.Lexer_DFA;
|
AdaCore/libadalang | Ada | 61 | ads | package Pkg.Child.Grand_Child is
end Pkg.Child.Grand_Child;
|
sparre/Command-Line-Parser-Generator | Ada | 599 | adb | with Ada.Text_IO;
package body Dotted_Type_Name is
procedure Trim (Sides : Ada.Strings.Trim_End := Ada.Strings.Both) is
use Ada.Strings, Ada.Text_IO;
begin
Put_Line (" Trim (Sides => " & Trim_End'Image (Sides) & ");");
end Trim;
procedure Trim_More (Prefix : String;
Side : Ada.Strings.Trim_End := Ada.Strings.Both) is
use Ada.Strings, Ada.Text_IO;
begin
Put_Line (" Trim_More (Prefix => """ & Prefix & """);");
Put_Line (" Trim_More (Side => " & Trim_End'Image (Side) & ");");
end Trim_More;
end Dotted_Type_Name;
|
shaggie76/Aristophanes | Ada | 5,951 | adb | ----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
-- $Id: zlib-streams.adb,v 1.9 2003/08/12 13:15:31 vagul Exp $
with Ada.Unchecked_Deallocation;
package body ZLib.Streams is
-----------
-- Close --
-----------
procedure Close (Stream : in out Stream_Type) is
procedure Free is new Ada.Unchecked_Deallocation
(Stream_Element_Array, Buffer_Access);
begin
if Stream.Mode = Out_Stream or Stream.Mode = Duplex then
-- We should flush the data written by the writer.
Flush (Stream, Finish);
Close (Stream.Writer);
end if;
if Stream.Mode = In_Stream or Stream.Mode = Duplex then
Close (Stream.Reader);
Free (Stream.Buffer);
end if;
end Close;
------------
-- Create --
------------
procedure Create
(Stream : out Stream_Type;
Mode : in Stream_Mode;
Back : in Stream_Access;
Back_Compressed : in Boolean;
Level : in Compression_Level := Default_Compression;
Strategy : in Strategy_Type := Default_Strategy;
Header : in Header_Type := Default;
Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size;
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size)
is
subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size);
procedure Init_Filter
(Filter : in out Filter_Type;
Compress : in Boolean);
-----------------
-- Init_Filter --
-----------------
procedure Init_Filter
(Filter : in out Filter_Type;
Compress : in Boolean) is
begin
if Compress then
Deflate_Init
(Filter, Level, Strategy, Header => Header);
else
Inflate_Init (Filter, Header => Header);
end if;
end Init_Filter;
begin
Stream.Back := Back;
Stream.Mode := Mode;
if Mode = Out_Stream or Mode = Duplex then
Init_Filter (Stream.Writer, Back_Compressed);
Stream.Buffer_Size := Write_Buffer_Size;
else
Stream.Buffer_Size := 0;
end if;
if Mode = In_Stream or Mode = Duplex then
Init_Filter (Stream.Reader, not Back_Compressed);
Stream.Buffer := new Buffer_Subtype;
Stream.Rest_First := Stream.Buffer'Last + 1;
end if;
end Create;
-----------
-- Flush --
-----------
procedure Flush
(Stream : in out Stream_Type;
Mode : in Flush_Mode := Sync_Flush)
is
Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size);
Last : Stream_Element_Offset;
begin
loop
Flush (Stream.Writer, Buffer, Last, Mode);
Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
exit when Last < Buffer'Last;
end loop;
end Flush;
----------
-- Read --
----------
procedure Read
(Stream : in out Stream_Type;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
procedure Read
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset);
----------
-- Read --
----------
procedure Read
(Item : out Stream_Element_Array;
Last : out Stream_Element_Offset) is
begin
Ada.Streams.Read (Stream.Back.all, Item, Last);
end Read;
procedure Read is new ZLib.Read
(Read => Read,
Buffer => Stream.Buffer.all,
Rest_First => Stream.Rest_First,
Rest_Last => Stream.Rest_Last);
begin
Read (Stream.Reader, Item, Last);
end Read;
-------------------
-- Read_Total_In --
-------------------
function Read_Total_In (Stream : in Stream_Type) return Count is
begin
return Total_In (Stream.Reader);
end Read_Total_In;
--------------------
-- Read_Total_Out --
--------------------
function Read_Total_Out (Stream : in Stream_Type) return Count is
begin
return Total_Out (Stream.Reader);
end Read_Total_Out;
-----------
-- Write --
-----------
procedure Write
(Stream : in out Stream_Type;
Item : in Stream_Element_Array)
is
procedure Write (Item : in Stream_Element_Array);
-----------
-- Write --
-----------
procedure Write (Item : in Stream_Element_Array) is
begin
Ada.Streams.Write (Stream.Back.all, Item);
end Write;
procedure Write is new ZLib.Write
(Write => Write,
Buffer_Size => Stream.Buffer_Size);
begin
Write (Stream.Writer, Item, No_Flush);
end Write;
--------------------
-- Write_Total_In --
--------------------
function Write_Total_In (Stream : in Stream_Type) return Count is
begin
return Total_In (Stream.Writer);
end Write_Total_In;
---------------------
-- Write_Total_Out --
---------------------
function Write_Total_Out (Stream : in Stream_Type) return Count is
begin
return Total_Out (Stream.Writer);
end Write_Total_Out;
end ZLib.Streams;
|
reznikmm/matreshka | Ada | 4,714 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package Matreshka.ODF_Elements.Table.Table_Column is
type Table_Table_Column_Node is
new Matreshka.ODF_Elements.Table.Table_Node_Base with null record;
type Table_Table_Column_Access is
access all Table_Table_Column_Node'Class;
overriding procedure Enter_Element
(Self : not null access Table_Table_Column_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding function Get_Local_Name
(Self : not null access constant Table_Table_Column_Node)
return League.Strings.Universal_String;
overriding procedure Leave_Element
(Self : not null access Table_Table_Column_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access Table_Table_Column_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);
-- Dispatch call to corresponding subprogram of iterator interface.
end Matreshka.ODF_Elements.Table.Table_Column;
|
reznikmm/matreshka | Ada | 4,041 | ads | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with ODF.DOM.Draw_Text_Path_Scale_Attributes;
package Matreshka.ODF_Draw.Text_Path_Scale_Attributes is
type Draw_Text_Path_Scale_Attribute_Node is
new Matreshka.ODF_Draw.Abstract_Draw_Attribute_Node
and ODF.DOM.Draw_Text_Path_Scale_Attributes.ODF_Draw_Text_Path_Scale_Attribute
with null record;
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Draw_Text_Path_Scale_Attribute_Node;
overriding function Get_Local_Name
(Self : not null access constant Draw_Text_Path_Scale_Attribute_Node)
return League.Strings.Universal_String;
end Matreshka.ODF_Draw.Text_Path_Scale_Attributes;
|
pat-rogers/LmcpGen | Ada | 315 | adb | package body Conversion_Equality_Lemmas with
SPARK_Mode => Off
is
procedure Lemma_Conversion_Equality
(This_Numeric : Numeric;
These_Bytes : Bytes)
is
pragma Unreferenced (This_Numeric, These_Bytes);
begin
null;
end Lemma_Conversion_Equality;
end Conversion_Equality_Lemmas;
|
MinimSecure/unum-sdk | Ada | 883 | adb | -- Copyright 2008-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Call_Me (D : in out Data) is
begin
if D.One > D.Two then
D.Three := D.Four;
end if;
end Call_Me;
end Pck;
|
aherd2985/Amass | Ada | 1,888 | 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.
local json = require("json")
name = "Shodan"
type = "api"
function start()
setratelimit(2)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local resp
local vurl = buildurl(domain, c.key)
-- Check if the response data is in the graph database
if (cfg.ttl ~= nil and cfg.ttl > 0) then
resp = obtain_response(domain, cfg.ttl)
end
if (resp == nil or resp == "") then
local err
resp, err = request(ctx, {
url=vurl,
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return
end
if (cfg.ttl ~= nil and cfg.ttl > 0) then
cache_response(domain, resp)
end
end
local d = json.decode(resp)
if (d == nil or #(d.subdomains) == 0) then
return
end
for i, sub in pairs(d.subdomains) do
sendnames(ctx, sub .. "." .. domain)
end
end
function buildurl(domain, key)
return "https://api.shodan.io/dns/domain/" .. domain .. "?key=" .. key
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
local found = {}
for i, v in pairs(names) do
if found[v] == nil then
newname(ctx, v)
found[v] = true
end
end
end
|
jgrant27/ada_aws_benchmark | Ada | 1,981 | adb | -----------------------------------------------------------------------
-- aws_rest_api -- Ada Web Server Rest API Benchmark
-- Copyright (C) 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with AWS.Config;
with AWS.Config.Set;
with AWS.Server;
with AWS.Services.Dispatchers.URI;
with AWS.Status;
With AWS.Response;
procedure AWS_Rest_Api is
Dispatcher : AWS.Services.Dispatchers.URI.Handler;
WS : AWS.Server.HTTP;
Config : AWS.Config.Object;
-- REST callback function
function Get_Api (Request : in AWS.Status.Data) return AWS.Response.Data is
pragma Unreferenced (Request);
begin
return AWS.Response.Build
("application/json", "{""greeting"":""Hello World!""}");
end Get_Api;
begin
-- Setup AWS dispatchers.
AWS.Services.Dispatchers.URI.Register (Dispatcher, "/api",
Get_Api'Unrestricted_Access,
Prefix => True);
-- Configure AWS.
Config := AWS.Config.Get_Current;
AWS.Config.Set.Reuse_Address (Config, True);
AWS.Config.Set.Max_Connection (Config, 16);
AWS.Config.Set.Accept_Queue_Size (Config, 512);
AWS.Server.Start (WS, Dispatcher => Dispatcher, Config => Config);
AWS.Server.Wait;
AWS.Server.Shutdown (WS);
end AWS_Rest_Api;
|
onox/orka | Ada | 3,739 | ads | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
private with Interfaces.C.Strings;
with Interfaces.C;
with System;
with Ada.Strings.Unbounded;
package EGL is
pragma Preelaborate;
package C renames Interfaces.C;
type Bool is new Boolean;
subtype Int is C.int;
subtype Enum is C.unsigned;
subtype Attrib is C.ptrdiff_t;
type ID_Type is private;
function None return Int;
function None return Attrib;
type Enum_Array is array (Natural range <>) of Enum
with Convention => C;
type Attribute_Array is array (Natural range <>) of Attrib
with Convention => C;
type Int_Array is array (Natural range <>) of Int
with Convention => C;
package SU renames Ada.Strings.Unbounded;
type String_List is array (Positive range <>) of SU.Unbounded_String;
function Has_Extension (Extensions : String_List; Name : String) return Boolean;
-- Return True if the extension with the given name can be found in
-- the list of extensions, False otherwise
procedure Check_Extension (Extensions : String_List; Name : String);
-- Raise Feature_Not_Supported if the extension with the given
-- name cannot be found in the list of extensions
Feature_Not_Supported : exception;
-- Raised when a function that is not available is called
type Native_Window_Ptr is private;
type Native_Display_Ptr is private;
private
type Native_Window is limited null record;
type Native_Window_Ptr is access all Native_Window
with Convention => C;
pragma No_Strict_Aliasing (Native_Window_Ptr);
type Native_Display is limited null record;
type Native_Display_Ptr is access all Native_Display
with Convention => C;
pragma No_Strict_Aliasing (Native_Display_Ptr);
function None return Int is (16#3038#);
function None return Attrib is (16#3038#);
type Void_Ptr is new System.Address;
type ID_Type is new Void_Ptr;
type ID_Array is array (Natural range <>) of ID_Type
with Convention => C;
for Bool use (False => 0, True => 1);
for Bool'Size use C.unsigned'Size;
function Trim (Value : C.Strings.chars_ptr) return String;
function Extensions (Value : C.Strings.chars_ptr) return String_List;
type Display_Query_Param is (Vendor, Version, Extensions, Client_APIs);
for Display_Query_Param use
(Vendor => 16#3053#,
Version => 16#3054#,
Extensions => 16#3055#,
Client_APIs => 16#308D#);
for Display_Query_Param'Size use Int'Size;
type Context_Query_Param is (Render_Buffer);
for Context_Query_Param use
(Render_Buffer => 16#3086#);
for Context_Query_Param'Size use Int'Size;
type Surface_Query_Param is (Height, Width, Swap_Behavior);
for Surface_Query_Param use
(Height => 16#3056#,
Width => 16#3057#,
Swap_Behavior => 16#3093#);
for Surface_Query_Param'Size use Int'Size;
type Device_Query_Param is (Extensions, DRM_Device_File);
for Device_Query_Param use
(Extensions => 16#3055#,
DRM_Device_File => 16#3233#);
for Device_Query_Param'Size use Int'Size;
end EGL;
|
eqcola/ada-ado | Ada | 8,327 | ads | -----------------------------------------------------------------------
-- ado-statements-sqlite -- SQLite database statements
-- Copyright (C) 2009, 2010, 2011, 2012, 2013, 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 System;
with ADO.Drivers.Connections.Sqlite;
package ADO.Statements.Sqlite is
type Handle is null record;
-- ------------------------------
-- Delete statement
-- ------------------------------
type Sqlite_Delete_Statement is new Delete_Statement with private;
type Sqlite_Delete_Statement_Access is access all Sqlite_Delete_Statement'Class;
-- Execute the query
overriding
procedure Execute (Stmt : in out Sqlite_Delete_Statement;
Result : out Natural);
-- Create the delete statement
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access;
-- ------------------------------
-- Update statement
-- ------------------------------
type Sqlite_Update_Statement is new Update_Statement with private;
type Sqlite_Update_Statement_Access is access all Sqlite_Update_Statement'Class;
-- Execute the query
overriding
procedure Execute (Stmt : in out Sqlite_Update_Statement);
-- Execute the query
overriding
procedure Execute (Stmt : in out Sqlite_Update_Statement;
Result : out Integer);
-- Create an update statement
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access;
-- ------------------------------
-- Insert statement
-- ------------------------------
type Sqlite_Insert_Statement is new Insert_Statement with private;
type Sqlite_Insert_Statement_Access is access all Sqlite_Insert_Statement'Class;
-- Execute the query
overriding
procedure Execute (Stmt : in out Sqlite_Insert_Statement;
Result : out Integer);
-- Create an insert statement.
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access;
-- ------------------------------
-- Query statement for SQLite
-- ------------------------------
type Sqlite_Query_Statement is new Query_Statement with private;
type Sqlite_Query_Statement_Access is access all Sqlite_Query_Statement'Class;
-- Execute the query
overriding
procedure Execute (Query : in out Sqlite_Query_Statement);
-- Get the number of rows returned by the query
overriding
function Get_Row_Count (Query : in Sqlite_Query_Statement) return Natural;
-- Returns True if there is more data (row) to fetch
overriding
function Has_Elements (Query : in Sqlite_Query_Statement) return Boolean;
-- Fetch the next row
overriding
procedure Next (Query : in out Sqlite_Query_Statement);
-- Returns true if the column <b>Column</b> is null.
overriding
function Is_Null (Query : in Sqlite_Query_Statement;
Column : in Natural) return Boolean;
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Int64</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
overriding
function Get_Int64 (Query : Sqlite_Query_Statement;
Column : Natural) return Int64;
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
overriding
function Get_Unbounded_String (Query : Sqlite_Query_Statement;
Column : Natural) return Unbounded_String;
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Unbounded_String</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
overriding
function Get_String (Query : Sqlite_Query_Statement;
Column : Natural) return String;
-- Get the column value at position <b>Column</b> and
-- return it as a <b>Blob</b> reference.
overriding
function Get_Blob (Query : in Sqlite_Query_Statement;
Column : in Natural) return ADO.Blob_Ref;
-- Get the column value at position <b>Column</b> and
-- return it as an <b>Time</b>.
-- Raises <b>Invalid_Type</b> if the value cannot be converted.
-- Raises <b>Invalid_Column</b> if the column does not exist.
function Get_Time (Query : Sqlite_Query_Statement;
Column : Natural) return Ada.Calendar.Time;
-- Get the column type
-- Raises <b>Invalid_Column</b> if the column does not exist.
overriding
function Get_Column_Type (Query : Sqlite_Query_Statement;
Column : Natural)
return ADO.Schemas.Column_Type;
-- Get the column name.
-- Raises <b>Invalid_Column</b> if the column does not exist.
overriding
function Get_Column_Name (Query : in Sqlite_Query_Statement;
Column : in Natural)
return String;
-- Get the number of columns in the result.
overriding
function Get_Column_Count (Query : in Sqlite_Query_Statement)
return Natural;
-- Deletes the query statement.
overriding
procedure Finalize (Query : in out Sqlite_Query_Statement);
-- Create the query statement.
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access;
-- Create the query statement.
function Create_Statement (Database : in ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Query : in String)
return Query_Statement_Access;
private
type State is (HAS_ROW, HAS_MORE, DONE, ERROR);
type Sqlite_Query_Statement is new Query_Statement with record
This_Query : aliased ADO.SQL.Query;
Connection : ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Stmt : ADO.Drivers.Connections.Sqlite.Sqlite_Access := System.Null_Address;
Counter : Natural := 1;
Status : State := DONE;
Max_Column : Natural;
end record;
type Sqlite_Delete_Statement is new Delete_Statement with record
Connection : ADO.Drivers.Connections.Sqlite.Sqlite_Access;
Table : ADO.Schemas.Class_Mapping_Access;
Delete_Query : aliased ADO.SQL.Query;
end record;
type Sqlite_Update_Statement is new Update_Statement with record
Connection : ADO.Drivers.Connections.Sqlite.Sqlite_Access;
This_Query : aliased ADO.SQL.Update_Query;
Table : ADO.Schemas.Class_Mapping_Access;
end record;
type Sqlite_Insert_Statement is new Insert_Statement with record
Connection : ADO.Drivers.Connections.Sqlite.Sqlite_Access;
This_Query : aliased ADO.SQL.Update_Query;
Table : ADO.Schemas.Class_Mapping_Access;
end record;
end ADO.Statements.Sqlite;
|
reznikmm/matreshka | Ada | 4,632 | adb | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Open Document Toolkit --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Matreshka.DOM_Documents;
with Matreshka.ODF_String_Constants;
with ODF.DOM.Iterators;
with ODF.DOM.Visitors;
package body Matreshka.ODF_Table.Border_Model_Attributes is
------------
-- Create --
------------
overriding function Create
(Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters)
return Table_Border_Model_Attribute_Node is
begin
return Self : Table_Border_Model_Attribute_Node do
Matreshka.ODF_Table.Constructors.Initialize
(Self'Unchecked_Access,
Parameters.Document,
Matreshka.ODF_String_Constants.Table_Prefix);
end return;
end Create;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Table_Border_Model_Attribute_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return Matreshka.ODF_String_Constants.Border_Model_Attribute;
end Get_Local_Name;
begin
Matreshka.DOM_Documents.Register_Attribute
(Matreshka.ODF_String_Constants.Table_URI,
Matreshka.ODF_String_Constants.Border_Model_Attribute,
Table_Border_Model_Attribute_Node'Tag);
end Matreshka.ODF_Table.Border_Model_Attributes;
|
sparre/Command-Line-Parser-Generator | Ada | 762 | ads | -- Copyright: JSA Research & Innovation <[email protected]>
-- License: Beer Ware
pragma License (Unrestricted);
with Command_Line_Parser_Generator.Zsh_Argument_Pattern;
package Command_Line_Parser_Generator.Formal_Parameter is
type Instance is tagged
record
Name : Source_Text;
Flag : Boolean;
Image_Function : Source_Text;
Value_Function : Source_Text;
Default_Value : Source_Text;
Type_Name : Source_Text;
Zsh_Pattern : Zsh_Argument_Pattern.Instance;
end record;
function Has_Default_Value (Item : in Instance) return Boolean;
function Image (Item : in Instance) return Wide_String;
end Command_Line_Parser_Generator.Formal_Parameter;
|
msrLi/portingSources | Ada | 998 | adb | -- Copyright 2006-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/>.
with Pck; use Pck;
procedure P is
Small : Data_Small;
Large : Data_Large;
Vector : Small_Float_Vector;
begin
Small := Create_Small;
Large := Create_Large;
Vector := Create_Small_Float_Vector;
Small (1) := Large (1);
Small (2) := Integer (Vector (1));
end P;
|
mirror/ncurses | Ada | 3,122 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- ncurses --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright 2020 Thomas E. Dickey --
-- Copyright 2000 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: 1.2 $
-- Binding Version 01.00
------------------------------------------------------------------------------
package ncurses2.m is
function main return Integer;
end ncurses2.m;
|
zhmu/ananas | Ada | 1,339 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- U N C H E C K E D _ C O N V E R S I O N --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
generic
type Source (<>) is limited private;
type Target (<>) is limited private;
function Unchecked_Conversion (S : Source) return Target;
pragma Import (Intrinsic, Unchecked_Conversion);
pragma Pure (Unchecked_Conversion);
|
charlie5/lace | Ada | 6,968 | adb | with
lace.Event.Logger,
lace.Event.utility,
ada.unchecked_Deallocation;
package body lace.make_Observer.deferred
is
use type Event.Logger.view;
overriding
procedure destroy (Self : in out Item)
is
begin
make_Observer.destroy (make_Observer.item (Self)); -- Destroy base class.
Self.pending_Events.free;
end destroy;
-------------
-- Operations
--
overriding
procedure receive (Self : access Item; the_Event : in Event.item'Class := Event.null_Event;
from_Subject : in Event.subject_Name)
is
begin
Self.pending_Events.add (the_Event, from_Subject);
end receive;
overriding
procedure respond (Self : access Item)
is
use Event_Vectors;
my_Name : constant String := Observer.item'Class (Self.all).Name;
procedure actuate (the_Responses : in event_response_Map;
the_Events : in Event_Vector;
from_subject_Name : in Event.subject_Name)
is
Cursor : Event_Vectors.Cursor := the_Events.First;
begin
while has_Element (Cursor)
loop
declare
use event_response_Maps,
Event.utility,
ada.Containers;
use type Observer.view;
the_Event : constant Event.item'Class := Element (Cursor);
Response : constant event_response_Maps.Cursor := the_Responses.find (to_Kind (the_Event'Tag));
begin
if has_Element (Response)
then
Element (Response).respond (the_Event);
if Observer.Logger /= null
then
Observer.Logger.log_Response (Element (Response),
Observer.view (Self),
the_Event,
from_subject_Name);
end if;
elsif Self.Responses.relay_Target /= null
then
-- Self.relay_Target.notify (the_Event, from_Subject_Name); -- todo: Re-enable relayed events.
if Observer.Logger /= null
then
Observer.Logger.log ("[Warning] ~ Relayed events are currently disabled.");
else
raise program_Error with "Event relaying is currently disabled.";
end if;
else
if Observer.Logger /= null
then
Observer.Logger.log ("[Warning] ~ Observer "
& my_Name
& " has no response to " & Name_of (the_Event)
& " from " & from_subject_Name & ".");
Observer.Logger.log (" Count of responses =>"
& the_Responses.Length'Image);
else
raise program_Error with "Observer " & my_Name & " has no response to " & Name_of (the_Event)
& " from " & from_subject_Name & ".";
end if;
end if;
end;
next (Cursor);
end loop;
end actuate;
the_subject_Events : subject_events_Pairs (1 .. 5_000);
Count : Natural;
begin
Self.pending_Events.fetch (the_subject_Events, Count);
for i in 1 .. Count
loop
declare
procedure deallocate is new ada.unchecked_Deallocation (String, String_view);
subject_Name : String_view := the_subject_Events (i).Subject;
the_Events : Event_vector renames the_subject_Events (i).Events;
begin
if Self.Responses.Contains (subject_Name.all)
then
actuate (Self.Responses.Element (subject_Name.all),
the_Events,
subject_Name.all);
else
declare
Message : constant String := my_Name & " has no responses for events from " & subject_Name.all & ".";
begin
if Observer.Logger /= null
then
Observer.Logger.log (Message);
else
raise program_Error with Message;
end if;
end;
end if;
deallocate (subject_Name);
end;
end loop;
end respond;
--------------
-- Safe Events
--
protected
body safe_Events
is
procedure add (the_Event : in Event.item'Class)
is
begin
the_Events.append (the_Event);
end add;
procedure fetch (all_Events : out Event_Vector)
is
begin
all_Events := the_Events;
the_Events.clear;
end fetch;
end safe_Events;
----------------------------------
-- safe Subject Map of safe Events
--
protected
body safe_subject_Map_of_safe_events
is
procedure add (the_Event : in Event.item'Class;
from_Subject : in String)
is
begin
if not the_Map.contains (from_Subject)
then
the_Map.insert (from_Subject,
new safe_Events);
end if;
the_Map.Element (from_Subject).add (the_Event);
end add;
procedure fetch (all_Events : out subject_events_Pairs;
Count : out Natural)
is
use subject_Maps_of_safe_events;
Cursor : subject_Maps_of_safe_events.Cursor := the_Map.First;
Index : Natural := 0;
begin
while has_Element (Cursor)
loop
declare
the_Events : Event_vector;
begin
Element (Cursor).fetch (the_Events);
Index := Index + 1;
all_Events (Index) := (subject => new String' (Key (Cursor)),
events => the_Events);
end;
next (Cursor);
end loop;
Count := Index;
end fetch;
procedure free
is
use subject_Maps_of_safe_events;
procedure deallocate is new ada.unchecked_Deallocation (safe_Events,
safe_Events_view);
Cursor : subject_Maps_of_safe_events.Cursor := the_Map.First;
the_Events : safe_Events_view;
begin
while has_Element (Cursor)
loop
the_Events := Element (Cursor);
deallocate (the_Events);
next (Cursor);
end loop;
end free;
end safe_subject_Map_of_safe_events;
end lace.make_Observer.deferred;
|
google-code/ada-util | Ada | 1,125 | ads | -----------------------------------------------------------------------
-- serialize-io-jcsv-tests -- Unit tests for CSV parser
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Serialize.IO.CSV.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
procedure Test_Parser (T : in out Test);
end Util.Serialize.IO.CSV.Tests;
|
jrmarino/AdaBase | Ada | 371 | ads | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
private
with Ada.Finalization;
package AdaBase.Driver is
pragma Pure;
type Base_Pure is abstract tagged private;
private
package FIN renames Ada.Finalization;
type Base_Pure is abstract new FIN.Controlled with null record;
end AdaBase.Driver;
|
apple-oss-distributions/old_ncurses | Ada | 3,927 | adb | ------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding --
-- --
-- Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: Juergen Pfeifer <[email protected]> 1996
-- Version Control:
-- $Revision: 1.1.1.1 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Interfaces.C;
with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
package body Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is
use type Interfaces.C.int;
procedure Set_Field_Type (Fld : in Field;
Typ : in AlphaNumeric_Field)
is
C_AlphaNumeric_Field_Type : C_Field_Type;
pragma Import (C, C_AlphaNumeric_Field_Type, "TYPE_ALNUM");
function Set_Fld_Type (F : Field := Fld;
Cft : C_Field_Type := C_AlphaNumeric_Field_Type;
Arg1 : C_Int) return C_Int;
pragma Import (C, Set_Fld_Type, "set_field_type");
Res : Eti_Error;
begin
Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width));
if Res /= E_Ok then
Eti_Exception (Res);
end if;
Wrap_Builtin (Fld, Typ);
end Set_Field_Type;
end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric;
|
zhmu/ananas | Ada | 17,569 | ads | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . S T O R A G E _ P O O L S . S U B P O O L S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011-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. --
-- --
------------------------------------------------------------------------------
with Ada.Finalization;
with System.Finalization_Masters;
with System.Storage_Elements;
package System.Storage_Pools.Subpools is
pragma Preelaborate;
type Root_Storage_Pool_With_Subpools is abstract
new Root_Storage_Pool with private;
pragma Preelaborable_Initialization (Root_Storage_Pool_With_Subpools);
-- The base for all implementations of Storage_Pool_With_Subpools. This
-- type is Limited_Controlled by derivation. To use subpools, an access
-- type must be associated with an implementation descending from type
-- Root_Storage_Pool_With_Subpools.
type Root_Subpool is abstract tagged limited private;
pragma Preelaborable_Initialization (Root_Subpool);
-- The base for all implementations of Subpool. Objects of this type are
-- managed by the pool_with_subpools.
type Subpool_Handle is access all Root_Subpool'Class;
for Subpool_Handle'Storage_Size use 0;
-- Since subpools are limited types by definition, a handle is instead used
-- to manage subpool abstractions.
overriding procedure Allocate
(Pool : in out Root_Storage_Pool_With_Subpools;
Storage_Address : out System.Address;
Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count);
-- Allocate an object described by Size_In_Storage_Elements and Alignment
-- on the default subpool of Pool. Controlled types allocated through this
-- routine will NOT be handled properly.
procedure Allocate_From_Subpool
(Pool : in out Root_Storage_Pool_With_Subpools;
Storage_Address : out System.Address;
Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count;
Subpool : not null Subpool_Handle) is abstract;
-- ??? This precondition causes errors in simple tests, disabled for now
-- with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access;
-- This routine requires implementation. Allocate an object described by
-- Size_In_Storage_Elements and Alignment on a subpool.
function Create_Subpool
(Pool : in out Root_Storage_Pool_With_Subpools)
return not null Subpool_Handle is abstract;
-- This routine requires implementation. Create a subpool within the given
-- pool_with_subpools.
overriding procedure Deallocate
(Pool : in out Root_Storage_Pool_With_Subpools;
Storage_Address : System.Address;
Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count)
is null;
procedure Deallocate_Subpool
(Pool : in out Root_Storage_Pool_With_Subpools;
Subpool : in out Subpool_Handle)
is abstract;
-- This precondition causes errors in simple tests, disabled for now???
-- with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access;
-- This routine requires implementation. Reclaim the storage a particular
-- subpool occupies in a pool_with_subpools. This routine is called by
-- Ada.Unchecked_Deallocate_Subpool.
function Default_Subpool_For_Pool
(Pool : in out Root_Storage_Pool_With_Subpools)
return not null Subpool_Handle;
-- Return a common subpool which is used for object allocations without a
-- Subpool_Handle_Name in the allocator. The default implementation of this
-- routine raises Program_Error.
function Pool_Of_Subpool
(Subpool : not null Subpool_Handle)
return access Root_Storage_Pool_With_Subpools'Class;
-- Return the owner of the subpool
procedure Set_Pool_Of_Subpool
(Subpool : not null Subpool_Handle;
To : in out Root_Storage_Pool_With_Subpools'Class);
-- Set the owner of the subpool. This is intended to be called from
-- Create_Subpool or similar subpool constructors. Raises Program_Error
-- if the subpool already belongs to a pool.
overriding function Storage_Size
(Pool : Root_Storage_Pool_With_Subpools)
return System.Storage_Elements.Storage_Count
is
(System.Storage_Elements.Storage_Count'Last);
private
-- Model
-- Pool_With_Subpools SP_Node SP_Node SP_Node
-- +-->+--------------------+ +-----+ +-----+ +-----+
-- | | Subpools -------->| ------->| ------->| ------->
-- | +--------------------+ +-----+ +-----+ +-----+
-- | |Finalization_Started|<------ |<------- |<------- |<---
-- | +--------------------+ +-----+ +-----+ +-----+
-- +--- Controller.Encl_Pool| | nul | | + | | + |
-- | +--------------------+ +-----+ +--|--+ +--:--+
-- | : : Dummy | ^ :
-- | : : | | :
-- | Root_Subpool V |
-- | +-------------+ |
-- +-------------------------------- Owner | |
-- FM_Node FM_Node +-------------+ |
-- +-----+ +-----+<-- Master.Objects| |
-- <------ |<------ | +-------------+ |
-- +-----+ +-----+ | Node -------+
-- | ------>| -----> +-------------+
-- +-----+ +-----+ : :
-- |ctrl | Dummy : :
-- | obj |
-- +-----+
--
-- SP_Nodes are created on the heap. FM_Nodes and associated objects are
-- created on the pool_with_subpools.
type Any_Storage_Pool_With_Subpools_Ptr
is access all Root_Storage_Pool_With_Subpools'Class;
for Any_Storage_Pool_With_Subpools_Ptr'Storage_Size use 0;
-- A pool controller is a special controlled object which ensures the
-- proper initialization and finalization of the enclosing pool.
type Pool_Controller (Enclosing_Pool : Any_Storage_Pool_With_Subpools_Ptr)
is new Ada.Finalization.Limited_Controlled with null record;
-- Subpool list types. Each pool_with_subpools contains a list of subpools.
-- This is an indirect doubly linked list since subpools are not supposed
-- to be allocatable by language design.
type SP_Node;
type SP_Node_Ptr is access all SP_Node;
type SP_Node is record
Prev : SP_Node_Ptr := null;
Next : SP_Node_Ptr := null;
Subpool : Subpool_Handle := null;
end record;
-- Root_Storage_Pool_With_Subpools internal structure. The type uses a
-- special controller to perform initialization and finalization actions
-- on itself. This is necessary because the end user of this package may
-- decide to override Initialize and Finalize, thus disabling the desired
-- behavior.
-- Pool_With_Subpools SP_Node SP_Node SP_Node
-- +-->+--------------------+ +-----+ +-----+ +-----+
-- | | Subpools -------->| ------->| ------->| ------->
-- | +--------------------+ +-----+ +-----+ +-----+
-- | |Finalization_Started| : : : : : :
-- | +--------------------+
-- +--- Controller.Encl_Pool|
-- +--------------------+
-- : End-user :
-- : components :
type Root_Storage_Pool_With_Subpools is abstract
new Root_Storage_Pool with
record
Subpools : aliased SP_Node;
-- A doubly linked list of subpools
Finalization_Started : Boolean := False;
pragma Atomic (Finalization_Started);
-- A flag which prevents the creation of new subpools while the master
-- pool is being finalized. The flag needs to be atomic because it is
-- accessed without Lock_Task / Unlock_Task.
Controller : Pool_Controller
(Root_Storage_Pool_With_Subpools'Unchecked_Access);
-- A component which ensures that the enclosing pool is initialized and
-- finalized at the appropriate places.
end record;
-- A subpool is an abstraction layer which sits on top of a pool. It
-- contains links to all controlled objects allocated on a particular
-- subpool.
-- Pool_With_Subpools SP_Node SP_Node SP_Node
-- +-->+----------------+ +-----+ +-----+ +-----+
-- | | Subpools ------>| ------->| ------->| ------->
-- | +----------------+ +-----+ +-----+ +-----+
-- | : :<------ |<------- |<------- |
-- | : : +-----+ +-----+ +-----+
-- | |null | | + | | + |
-- | +-----+ +--|--+ +--:--+
-- | | ^ :
-- | Root_Subpool V |
-- | +-------------+ |
-- +---------------------------- Owner | |
-- +-------------+ |
-- .......... Master | |
-- +-------------+ |
-- | Node -------+
-- +-------------+
-- : End-user :
-- : components :
type Root_Subpool is abstract tagged limited record
Owner : Any_Storage_Pool_With_Subpools_Ptr := null;
-- A reference to the master pool_with_subpools
Master : aliased System.Finalization_Masters.Finalization_Master;
-- A heterogeneous collection of controlled objects
Node : SP_Node_Ptr := null;
-- A link to the doubly linked list node which contains the subpool.
-- This back pointer is used in subpool deallocation.
end record;
procedure Adjust_Controlled_Dereference
(Addr : in out System.Address;
Storage_Size : in out System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count);
-- Given the memory attributes of a heap-allocated object that is known to
-- be controlled, adjust the address and size of the object to include the
-- two hidden pointers inserted by the finalization machinery.
-- ??? Once Storage_Pools.Allocate_Any is removed, this should be renamed
-- to Allocate_Any.
procedure Allocate_Any_Controlled
(Pool : in out Root_Storage_Pool'Class;
Context_Subpool : Subpool_Handle;
Context_Master : Finalization_Masters.Finalization_Master_Ptr;
Fin_Address : Finalization_Masters.Finalize_Address_Ptr;
Addr : out System.Address;
Storage_Size : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count;
Is_Controlled : Boolean;
On_Subpool : Boolean);
-- Compiler interface. This version of Allocate handles all possible cases,
-- either on a pool or a pool_with_subpools, regardless of the controlled
-- status of the allocated object. Parameter usage:
--
-- * Pool - The pool associated with the access type. Pool can be any
-- derivation from Root_Storage_Pool, including a pool_with_subpools.
--
-- * Context_Subpool - The subpool handle name of an allocator. If no
-- subpool handle is present at the point of allocation, the actual
-- would be null.
--
-- * Context_Master - The finalization master associated with the access
-- type. If the access type's designated type is not controlled, the
-- actual would be null.
--
-- * Fin_Address - TSS routine Finalize_Address of the designated type.
-- If the designated type is not controlled, the actual would be null.
--
-- * Addr - The address of the allocated object.
--
-- * Storage_Size - The size of the allocated object.
--
-- * Alignment - The alignment of the allocated object.
--
-- * Is_Controlled - A flag which determines whether the allocated object
-- is controlled. When set to True, the machinery generates additional
-- data.
--
-- * On_Subpool - A flag which determines whether the a subpool handle
-- name is present at the point of allocation. This is used for error
-- diagnostics.
procedure Deallocate_Any_Controlled
(Pool : in out Root_Storage_Pool'Class;
Addr : System.Address;
Storage_Size : System.Storage_Elements.Storage_Count;
Alignment : System.Storage_Elements.Storage_Count;
Is_Controlled : Boolean);
-- Compiler interface. This version of Deallocate handles all possible
-- cases, either from a pool or a pool_with_subpools, regardless of the
-- controlled status of the deallocated object. Parameter usage:
--
-- * Pool - The pool associated with the access type. Pool can be any
-- derivation from Root_Storage_Pool, including a pool_with_subpools.
--
-- * Addr - The address of the allocated object.
--
-- * Storage_Size - The size of the allocated object.
--
-- * Alignment - The alignment of the allocated object.
--
-- * Is_Controlled - A flag which determines whether the allocated object
-- is controlled. When set to True, the machinery generates additional
-- data.
procedure Detach (N : not null SP_Node_Ptr);
-- Unhook a subpool node from an arbitrary subpool list
overriding procedure Finalize (Controller : in out Pool_Controller);
-- Buffer routine, calls Finalize_Pool
procedure Finalize_Pool (Pool : in out Root_Storage_Pool_With_Subpools);
-- Iterate over all subpools of Pool, detach them one by one and finalize
-- their masters. This action first detaches a controlled object from a
-- particular master, then invokes its Finalize_Address primitive.
function Header_Size_With_Padding
(Alignment : System.Storage_Elements.Storage_Count)
return System.Storage_Elements.Storage_Count;
-- Given an arbitrary alignment, calculate the size of the header which
-- precedes a controlled object as the nearest multiple rounded up of the
-- alignment.
overriding procedure Initialize (Controller : in out Pool_Controller);
-- Buffer routine, calls Initialize_Pool
procedure Initialize_Pool (Pool : in out Root_Storage_Pool_With_Subpools);
-- Setup the doubly linked list of subpools
procedure Print_Pool (Pool : Root_Storage_Pool_With_Subpools);
-- Debug routine, output the contents of a pool_with_subpools
procedure Print_Subpool (Subpool : Subpool_Handle);
-- Debug routine, output the contents of a subpool
end System.Storage_Pools.Subpools;
|
seL4/isabelle | Ada | 750 | ads | -------------------------------------------------------------------------------
-- Longest increasing subsequence of an array of integers
-------------------------------------------------------------------------------
package Liseq is
type Vector is array (Integer range <>) of Integer;
--# function Liseq_prfx(A: Vector; i: Integer) return Integer;
--# function Liseq_ends_at(A: Vector; i: Integer) return Integer;
--# function Max_ext(A: Vector; i, j: Integer) return Integer;
procedure Liseq_length(A: in Vector; L: in out Vector; maxi: out Integer);
--# derives maxi, L from A, L;
--# pre A'First = 0 and L'First = 0 and A'Last = L'Last and A'Last < Integer'Last;
--# post maxi = Liseq_prfx (A, A'Last+1);
end Liseq;
|
riccardo-bernardini/eugen | Ada | 8,757 | ads | with Ada.Containers.Vectors;
with Ada.Iterator_Interfaces;
with EU_Projects.Node_Tables;
--
-- A partner descriptor keeps some basic information about the
-- partner such as
--
-- * The name (a short version, too)
-- * A label
-- * An index
--
-- Moreover, every partner has
--
-- * One or more roles (name, description and PM cost)
-- * One or more expenses
--
-- Expenses can be divisible or undivisible. Divisible expenses are related
-- to a collections of goods/services where one pays a price per unit.
-- For example, the expense for buying one or more cards is divisible.
-- An example of undivisible expense is the expense for a single service.
-- Honestly, the distintion is quite fuzzy (it is an undivisible expense or
-- it is a divisble one with just one object?), but in some context it
-- could be handy to be able to do this distinction.
--
-- It is possible to iterate over all the roles and all the expenses using
-- All_Expenses and All_Roles.
--
package EU_Projects.Nodes.Partners is
type Partner (<>) is new Nodes.Node_Type with private;
type Partner_Access is access all Partner;
subtype Partner_Index is Node_Index;
No_Partner : constant Extended_Node_Index := No_Index;
type Partner_Label is new Node_Label;
type Partner_Name_Array is array (Partner_Index range <>) of Partner_Label;
type Role_Name is new Dotted_Identifier;
subtype Country_Code is String (1 .. 2)
with Dynamic_Predicate => (for all C of Country_Code => C in 'A' .. 'Z');
function Create (ID : Partner_Label;
Name : String;
Short_Name : String;
Country : Country_Code;
Node_Dir : in out Node_Tables.Node_Table)
return Partner_Access;
procedure Set_Index (Item : in out Partner;
Idx : Partner_Index);
function Country (Item : Partner) return Country_Code;
function Dependency_List (Item : partner)
return Node_Label_Lists.Vector
is (Node_Label_Lists.Empty_Vector);
overriding function Full_Index (Item : Partner;
Prefixed : Boolean) return String;
procedure Add_Role (To : in out Partner;
Role : in Role_Name;
Description : in String;
Monthly_Cost : in Currency);
procedure Add_Undivisible_Expense (To : in out Partner;
Description : in String;
Cost : in Currency);
procedure Add_Divisible_Expense (To : in out Partner;
Description : in String;
Unit_Cost : in Currency;
Amount : in Natural);
type Cursor is private;
function Has_Element (X : Cursor) return Boolean;
package Expense_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Cursor,
Has_Element => Has_Element);
function All_Expenses
(Item : Partner)
return Expense_Iterator_Interfaces.Forward_Iterator'Class;
function Is_Divisible (Pos : Cursor) return Boolean;
function Unit_Cost (Pos : Cursor) return Currency
with
Pre => Is_Divisible (Pos);
function Amount (Pos : Cursor) return Natural
with
Pre => Is_Divisible (Pos);
function Total_Cost (Pos : Cursor) return Currency;
function Description (Pos : Cursor) return String;
type Role_Cursor is private;
function Has_Element (X : Role_Cursor) return Boolean;
package Role_Iterator_Interfaces is
new Ada.Iterator_Interfaces (Cursor => Role_Cursor,
Has_Element => Has_Element);
function All_Roles
(Item : Partner)
return Role_Iterator_Interfaces.Forward_Iterator'Class;
function Cost (Pos : Role_Cursor) return Currency;
function Description (Pos : Role_Cursor) return String;
function Name (Pos : Role_Cursor) return String;
pragma Warnings (Off);
overriding function Get_Symbolic_Instant
(X : Partner;
Var : Simple_Identifier)
return Times.Time_Expressions.Symbolic_Instant
is (raise Unknown_Instant_Var);
overriding function Get_Symbolic_Duration
(X : Partner;
Var : Simple_Identifier)
return Times.Time_Expressions.Symbolic_Duration
is (raise Unknown_Duration_Var);
pragma Warnings (On);
private
type Personnel_Cost is
record
Role : Role_Name;
Monthly_Cost : Currency;
Description : Unbounded_String;
end record;
type Expense (Divisible : Boolean := False) is
record
Description : Unbounded_String;
case Divisible is
when True =>
Unit_Cost : Currency;
Amount : Natural;
when False =>
Cost : Currency;
end case;
end record;
package Personnel_Cost_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Personnel_Cost);
package Other_Cost_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => Expense);
type Partner is new Nodes.Node_Type
with
record
Personnel_Costs : Personnel_Cost_Vectors.Vector;
Other_Costs : Other_Cost_Vectors.Vector;
Country : Country_Code;
end record;
function Country (Item : Partner) return Country_Code
is (Item.Country);
type Cursor is
record
Pos : Other_Cost_Vectors.Cursor;
end record;
type Role_Cursor is
record
Pos : Personnel_Cost_Vectors.Cursor;
end record;
type Expense_Iterator is
new Expense_Iterator_Interfaces.Forward_Iterator
with
record
Start : Other_Cost_Vectors.Cursor;
end record;
overriding
function Full_Index (Item : Partner;
Prefixed : Boolean) return String
is (Image (Item.Index));
overriding
function First (Object : Expense_Iterator) return Cursor
is (Cursor'(Pos => Object.Start));
overriding
function Next
(Object : Expense_Iterator;
Position : Cursor) return Cursor
is (Cursor'(Pos => Other_Cost_Vectors.Next (Position.Pos)));
function All_Expenses
(Item : Partner)
return Expense_Iterator_Interfaces.Forward_Iterator'Class
is (Expense_Iterator'(Expense_Iterator_Interfaces.Forward_Iterator
with
Start => Item.Other_Costs.First));
function Has_Element (X : Cursor) return Boolean
is (Other_Cost_Vectors.Has_Element (X.Pos));
function Is_Divisible (Pos : Cursor) return Boolean
is (Other_Cost_Vectors.Element (Pos.Pos).Divisible);
function Unit_Cost (Pos : Cursor) return Currency
is (Other_Cost_Vectors.Element (Pos.Pos).Unit_Cost);
function Total_Cost (Pos : Cursor) return Currency
is (
if Is_Divisible (Pos)
then
Unit_Cost (Pos) * Amount (Pos)
else
Other_Cost_Vectors.Element (Pos.Pos).Cost
);
function Amount (Pos : Cursor) return Natural
is (Other_Cost_Vectors.Element (Pos.Pos).Amount);
function Description (Pos : Cursor) return String
is (To_String (Other_Cost_Vectors.Element (Pos.Pos).Description));
type Role_Iterator is
new Role_Iterator_Interfaces.Forward_Iterator
with
record
Start : Personnel_Cost_Vectors.Cursor;
end record;
function First (Object : Role_Iterator) return Role_Cursor
is (Role_Cursor'(Pos => Object.Start));
overriding
function Next
(Object : Role_Iterator;
Position : Role_Cursor) return Role_Cursor
is (Role_Cursor'(Pos => Personnel_Cost_Vectors.Next (Position.Pos)));
function Has_Element (X : Role_Cursor) return Boolean
is (Personnel_Cost_Vectors.Has_Element (X.Pos));
function All_Roles
(Item : Partner)
return Role_Iterator_Interfaces.Forward_Iterator'Class
is (Role_Iterator'(Role_Iterator_Interfaces.Forward_Iterator
with
Start => Item.Personnel_Costs.First));
function Cost (Pos : Role_Cursor) return Currency
is (Personnel_Cost_Vectors.Element (Pos.Pos).Monthly_Cost);
function Description (Pos : Role_Cursor) return String
is (To_String (Personnel_Cost_Vectors.Element (Pos.Pos).Description));
function Name (Pos : Role_Cursor) return String
is (Image (Personnel_Cost_Vectors.Element (Pos.Pos).Role));
end EU_Projects.Nodes.Partners;
|
stcarrez/ada-el | Ada | 946 | ads | -----------------------------------------------------------------------
-- el-objects -- Generic Typed Data Representation
-- Copyright (C) 2009, 2010, 2021 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.Beans.Objects;
package EL.Objects renames Util.Beans.Objects;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.