------------------------------------------------------------------------------ -- The Ada Semantic Interface Specification -- -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- -- Related Documents: -- Proposed ASIS 95 Draft Version 2.0.E -- November 1995 -- -- Please submit requests, questions, or comments via email to: -- asis-technical@sw-eng.falls-church.va.us -- -- This specification is in the public domain and can be freely distributed. -- -- --|WG ASISWG November 2-3, 1995 Meeting Decisions reflected in this draft are: --|WG --|WG Ada 95 child unit hierarchy --|WC Reinstating queries References and Is_Referenced --|WG The function hash is now generic --|WG --|WG ASISWG March 2-3, 1996 Meeting Decisions reflected in this draft are: --|WG Environment/Context/Container changes --|WG Corresponding_First_Subtype, Corresponding_Last_Constraint, and --|WG Corresponding_Last_Subtype shall act as normalizers, accepting type --|WG definitions. This retains the functional semantics of similar queries --|WG in ASIS 1.1.1. --|WG --|WG ASISWG Discussion Topics addressed: --|WG Adding Configuration_Pragmas query for Context --|WG Adding A_Configuration_Compilation literal to Unit_Kinds --|WG Marking optional interfaces: Asis.Ids, Asis.Data_Decomposition, and --|WG Asis.Portable_Transfer. --|WG --|WG ASISWG Discussion Topics not addressed: --|WG Add sentinel to define document sections --|WG Glossary Definitions will be in the specification --|WG Adding some OO queries --|WG Use Ada.Streams instead of ASIS_Portable_Transfer --|WG -- -- Several sentinels mark portions of the ASIS 95 text. These are not -- intended to be permanent, but provide a way to automate the construction -- of accompanying documents. -- -- The sentinels and their meanings are: -- -- --|95 These comments describe changes made in ASIS 95 (differences with -- ASIS 1.1.1). -- -- --|OP (OPen issues) These comments mark open issues regarding the current -- version of the specification. -- -- --|ER (Element Reference) These comments mark an element kind reference -- which acts as a header for the section of queries that work on this -- element kind. -- -- --|CR (Child Reference) These sentinel comments follow sentinel comments -- marking element references (--|ER) and reference child element -- queries that decompose the element into its children. -- -- --|IM (IMplicit reference) These comments follow any sentinel comments -- marking child reference element queries (--|CR) and list element -- queries that provide related implicit elements. -- -- --|SR (Semantic Reference) These comments follow any sentinel comments -- marking child reference element queries (--|CR) and list element -- queries that provide semantically related elements. -- -- --|AN (Application Note ) These comments describe suggested uses, -- further analysis, or other notes of interest to ASIS applications. -- -- --|IP (Implementation Permissions) These comments describe permissions -- given a vendor when implementing the associated type or query. -- -- --|IR (Implementation Requirements) These comments describe additional -- requirements for conforming implementations. -- -- --|DR (Documentation Requirements) These comments describe additional -- documentation requirements for conforming implementations. -- -- --|TR (Traceability Reference) These comments trace requirements or -- issues. -- --|OP------------------------------------------------------------------------- --|OP Format requirements: --|OP 1. RM 95 terms need to be completed. --|OP 2. commentary sentinels need to be completed. --|OP 3. return subtypes need to be consistent with returns kinds lists. --|OP 4. order of literals in appropriate/returns lists is not complete. --|OP 5. lines and spacing is not complete. ------------------------------------------------------------------------------ package ASIS_Element_Kinds is ------------------------------------------------------------------------------ -- ASIS_Element_Kinds -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- Enumeration types describing the various kinds of elements. -- --|95 Changes in ASIS 95 from ASIS 83 ---------------------------------------- --|95 package ASIS_Element_Kinds is new. --|95------------------------------------------------------------------------- --|95 The element kinds hierarchy is new. --|95------------------------------------------------------------------------- --|95 All type declarations of element kinds and subordinate element kinds are --|95 in this package. ------------------------------------------------------------------------------ -- Element_Kinds Hierarchy -- -- ASIS offers hierarchical classification of elements. At the highest -- level, the Element_Kinds type provides literals that define "kinds" or -- classes listed below into which all non-nil elements are grouped. Elements -- in each of the Element_Kinds classes, with the exception of -- An_Exception_Handler, can be further classified by a subordinate kind at the -- next level in the hierarchy. Several subordinate kinds also have additional -- subordinate kinds. -- -- For example, Element_Kinds'A_Declaration might be classified into -- Declaration_Kinds'A_Parameter_Specification which might be further -- classified into Trait_Kinds'An_Access_Trait and into Mode_Kinds'An_In_Mode. -- This would fully identify the syntax of an element such as: -- (Who : IN ACCESS Person) -- -- All Element_Kind and subordinate kinds Queries are in Asis.Elements. -- -- It is not necessary to strictly follow the hierarchy; any element can be -- classified by any subordinate kind from any level. However, meaningful -- results will only be obtained from subordinate kinds that are appropriate. -- These are designated within the hierarchy shown below: -- -- Element_Kinds -> Subordinate Kinds ------------------------------------------------------------------------------ -- Key: Read "->" as "may be further classified by its" -- -- A_Pragma -> Pragma_Kinds -- -- A_Defining_Name -> Defining_Name_Kinds -- -> Operator_Kinds -- -- A_Declaration -> Declaration_Kinds -- -> Trait_Kinds -- -> Declaration_Origins -- -> Mode_Kinds -- -> Default_Kinds -- -- A_Definition -> Definition_Kinds -- -> Trait_Kinds -- -> Type_Kinds -- -> Trait_Kinds -- -> Formal_Type_Kinds -- -> Trait_Kinds -- -> Access_Type_Kinds -- -> Root_Type_Kinds -- -> Constraint_Kinds -- -> Discrete_Range_Kinds -- -- An_Expression -> Expression_Kinds -- -> Operator_Kinds -- -> Attribute_Kinds -- -- An_Association -> Association_Kinds -- -- A_Statement -> Statement_Kinds -- -- A_Path -> Path_Kinds -- -- A_Clause -> Clause_Kinds -- -> Representation_Clause_Kinds -- -- An_Exception_Handler -- --|95------------------------------------------------------------------------- --|95 Element_Kinds: many literals are new, reordered, reorganized, and have --|95 improved names reflecting Ada 95 terminology. ------------------------------------------------------------------------------ -- Element_Kinds - general element classifications -- Literals -- ASIS package with queries for these kinds ------------------------------------------------------------------------------ type Element_Kinds is ( Not_An_Element, -- Nil_Element A_Pragma, -- Asis.Elements A_Defining_Name, -- Asis.Declarations A_Declaration, -- Asis.Declarations A_Definition, -- Asis.Definitions An_Expression, -- Asis.Expressions An_Association, -- Asis.Expressions A_Statement, -- Asis.Statements A_Path, -- Asis.Statements A_Clause, -- Asis.Clauses An_Exception_Handler); -- Asis.Statements ------------------------------------------------------------------------------ -- Pragma_Kinds - classifications for pragmas -- Literals -- RM 95 ------------------------------------------------------------------------------ type Pragma_Kinds is ( Not_A_Pragma, -- An unexpected element An_All_Calls_Remote_Pragma, -- I.2.3(6) An_Asynchronous_Pragma, -- I.4.1(3) An_Atomic_Pragma, -- G.5(3) An_Atomic_Components_Pragma, -- G.5(3) An_Attach_Handler_Pragma, -- G.3.1(3) A_Controlled_Pragma, -- 13.11.3(3), B(12) A_Convention_Pragma, -- B(16), M.1(5) A_Discard_Names_Pragma, -- C.5(2), An_Elaborate_Pragma, -- 10.2.1(19), An_Elaborate_All_Pragma, -- 10.2.1(19), B(8) An_Elaborate_Body_Pragma, -- 10.2.1(21), B(9) An_Export_Pragma, -- B(15), M.1(5) An_Import_Pragma, -- B(14), M.1(5) An_Inline_Pragma, -- 6.3.2(4), B(5) An_Inspection_Point_Pragma, -- L.2.2(2) An_Interrupt_Handler_Pragma, -- G.3.1(2) An_Interrupt_Priority_Pragma, -- H.1(4) A_Linker_Options_Pragma, -- B.1(4), A_List_Pragma, -- 2.8(18), B(2) A_Locking_Policy_Pragma, -- H.3(3) A_Normalize_Scalars_Pragma, -- L.1.1(2) An_Optimize_Pragma, -- 2.8(18), B(4) A_Pack_Pragma, -- 13.2(2), B(11) A_Page_Pragma, -- 2.8(18), B(3) A_Preelaborate_Pragma, -- 10.2.1(3), B(6) A_Priority_Pragma, -- H.1(3) A_Pure_Pragma, -- 10.2.1(13), B(7) A_Queuing_Policy_Pragma, -- H.4(3) A_Remote_Call_Interface_Pragma, -- I.2.3(4) A_Remote_Types_Pragma, -- I.2.2(4) A_Restrictions_Pragma, -- 13.12(2), B(13) A_Reviewable_Pragma, -- L.2.1(2) A_Shared_Passive_Pragma, -- I.2.1(4) A_Storage_Size_Pragma, -- 13.3(62), A_Suppress_Pragma, -- 11.5(4), B(10) A_Task_Dispatching_Policy_Pragma, -- H.2.2(2) A_Volatile_Pragma, -- G.5(3) A_Volatile_Components_Pragma, -- G.5(3) An_Implementation_Defined_Pragma, -- Vendor Annex M An_Unknown_Pragma); -- Unknown to ASIS ------------------------------------------------------------------------------ -- Defining_Name_Kinds - names defined by declarations and specifications. -- Literals -- RM 95 ------------------------------------------------------------------------------ type Defining_Name_Kinds is ( Not_A_Defining_Name, -- An unexpected element A_Defining_Identifier, -- 3.1 A_Defining_Character_Literal, -- 3.5.1 A_Defining_Enumeration_Literal, -- 3.5.1 A_Defining_Operator_Symbol, -- 6.1 A_Defining_Expanded_Name); -- 6.1 program_unit_name.defining_identifier ------------------------------------------------------------------------------ -- Declaration_Kinds - declarations and specifications having defining_names. -- Literals -- RM 95 -> Subordinate Kinds ------------------------------------------------------------------------------ type Declaration_Kinds is ( Not_A_Declaration, -- An unexpected element An_Ordinary_Type_Declaration, -- 3.2.1 -- a full_type_declaration of the form: -- type defining_identifier [known_discriminant_part] is type_definition; A_Task_Type_Declaration, -- 3.2.1 A_Protected_Type_Declaration, -- 3.2.1 An_Incomplete_Type_Declaration, -- 3.2.1 A_Private_Type_Declaration, -- 3.2.1 -> Trait_Kinds A_Private_Extension_Declaration, -- 3.2.1 -> Trait_Kinds A_Subtype_Declaration, -- 3.2.2 A_Variable_Declaration, -- 3.3.1 -> Trait_Kinds A_Constant_Declaration, -- 3.3.1 -> Trait_Kinds A_Deferred_Constant_Declaration, -- 3.3.1 -> Trait_Kinds A_Single_Task_Declaration, -- 3.3.1 A_Single_Protected_Declaration, -- 3.3.1 An_Integer_Number_Declaration, -- 3.3.2 A_Real_Number_Declaration, -- 3.3.2 An_Enumeration_Literal_Specification, -- 3.5.1 A_Discriminant_Specification, -- 3.7 -> Trait_Kinds A_Component_Declaration, -- 3.8 A_Loop_Parameter_Specification, -- 5.5 -> Trait_Kinds A_Procedure_Declaration, -- 6.1 -> Trait_Kinds A_Function_Declaration, -- 6.1 -> Trait_Kinds A_Parameter_Specification, -- 6.1 -> Trait_Kinds -- -> Mode_Kinds A_Procedure_Body_Declaration, -- 6.3 A_Function_Body_Declaration, -- 6.3 A_Package_Declaration, -- 7.1 A_Package_Body_Declaration, -- 7.2 An_Object_Renaming_Declaration, -- 8.5.1 An_Exception_Renaming_Declaration, -- 8.5.2 A_Package_Renaming_Declaration, -- 8.5.3 A_Procedure_Renaming_Declaration, -- 8.5.4 A_Function_Renaming_Declaration, -- 8.5.4 A_Generic_Package_Renaming_Declaration, -- 8.5.5 A_Generic_Procedure_Renaming_Declaration, -- 8.5.5 A_Generic_Function_Renaming_Declaration, -- 8.5.5 A_Task_Body_Declaration, -- 9.1 A_Protected_Body_Declaration, -- 9.4 An_Entry_Declaration, -- 9.5.2 An_Entry_Body_Declaration, -- 9.5.2 An_Entry_Index_Specification, -- 9.5.2 A_Procedure_Body_Stub, -- 10.1.3 A_Function_Body_Stub, -- 10.1.3 A_Package_Body_Stub, -- 10.1.3 A_Task_Body_Stub, -- 10.1.3 A_Protected_Body_Stub, -- 10.1.3 An_Exception_Declaration, -- 11.1 A_Choice_Parameter_Specification, -- 11.2 A_Generic_Procedure_Declaration, -- 12.1 A_Generic_Function_Declaration, -- 12.1 A_Generic_Package_Declaration, -- 12.1 A_Package_Instantiation, -- 12.3 A_Procedure_Instantiation, -- 12.3 A_Function_Instantiation, -- 12.3 A_Formal_Object_Declaration, -- 12.4 -> Mode_Kinds A_Formal_Type_Declaration, -- 12.5 A_Formal_Procedure_Declaration, -- 12.6 -> Default_Kinds A_Formal_Function_Declaration, -- 12.6 -> Default_Kinds A_Formal_Package_Declaration, -- 12.7 A_Formal_Package_Declaration_With_Box); -- 12.7 subtype A_Type_Declaration is Declaration_Kinds range An_Ordinary_Type_Declaration .. A_Private_Extension_Declaration; subtype A_Full_Type_Declaration is Declaration_Kinds range An_Ordinary_Type_Declaration .. A_Protected_Type_Declaration; subtype An_Object_Declaration is Declaration_Kinds range A_Variable_Declaration .. A_Single_Protected_Declaration; subtype A_Number_Declaration is Declaration_Kinds range An_Integer_Number_Declaration .. A_Real_Number_Declaration; subtype A_Renaming_Declaration is Declaration_Kinds range An_Object_Renaming_Declaration .. A_Generic_Function_Renaming_Declaration; subtype A_Body_Stub is Declaration_Kinds range A_Procedure_Body_Stub .. A_Protected_Body_Stub; subtype A_Generic_Declaration is Declaration_Kinds range A_Generic_Procedure_Declaration .. A_Generic_Package_Declaration; subtype A_Generic_Instantiation is Declaration_Kinds range A_Package_Instantiation .. A_Function_Instantiation; subtype A_Formal_Declaration is Declaration_Kinds range A_Formal_Object_Declaration .. A_Formal_Package_Declaration_With_Box; ------------------------------------------------------------------------------ -- Trait_Kinds -- -- Trait_Kinds provide a means of further classifying the syntactic structure -- or "trait" of certain A_Declaration and A_Definition elements. -- Trait_Kinds are determined only by the presence (or absence) of certain -- reserved words. The semantics of an element are not considered. -- The reserved words of interest here are ABSTRACT, ALIASED, LIMITED, PRIVATE, -- REVERSE, and ACCESS when it appears in an access_definition. -- Trait_Kinds enumerates all combinations useful in this classification. -- -- For example, A_Variable_Declaration element that is semantically a -- limited type because its components are of a limited type is -- An_Ordinary_Trait, not A_Limited_Trait, since the reserved word LIMITED -- does not appear in its declaration or definition. -- -- The subordinate Trait_Kinds allow Declaration_Kinds and Definition_Kinds -- to enumerate fewer higher level elements, and be less cluttered by all -- possible permutations of syntactic possibilities. ie. In the case of a -- record_type_definition, Definition_Kinds can provide just two literals that -- dfferentiate between ordinary record types and tagged record types: -- -- A_Record_Type_Definition, -- 3.8 -> Trait_Kinds -- A_Tagged_Record_Type_Definition, -- 3.8 -> Trait_Kinds -- -- The remaining classification can be accomplished, if desired, using -- Trait_Kinds to determine if the definition is abstract, or limited, or both. -- Without Trait_Kinds, Definition_Kinds would need six literals to identify -- all the syntactic combinations for a record_type_definition. -- -- Elements expected by the Trait_Kind query are any Declaration_Kinds or -- Definition_Kinds for which Trait_Kinds is a subordinate kind: the literal -- definition will have "-> Trait_Kinds" following it. For example, the -- definitions of: -- -- A_Discriminant_Specification, -- 3.7 -> Trait_Kinds -- A_Component_Declaration, -- 3.8 -- -- indicate A_Discriminant_Specification is an expected kind while -- A_Component_Declaration is unexpected. -- -- All Declaration_Kinds and Definition_Kinds for which Trait_Kinds is not a -- subordinate kind, and all other Element_Kinds, are unexpected and are -- Not_A_Trait. -- -- An_Ordinary_Trait is any expected element whose syntax does not explicitly -- contain any of the reserved words listed above. -- ------------------------------------------------------------------------------ -- Trait_Kinds -- Literals ------------------------------------------------------------------------------ type Trait_Kinds is ( Not_A_Trait, -- An unexpected element An_Ordinary_Trait, -- The declaration or definition does -- not contain the reserved words -- ALIASED, REVERSE, PRIVATE, -- LIMITED, ABSTRACT, or -- ACCESS in an access_definition An_Aliased_Trait, -- ALIASED is present An_Access_Definition_Trait, -- ACCESS in an access_definition is -- present A_Reverse_Trait, -- REVERSE is present A_Private_Trait, -- Only PRIVATE is present A_Limited_Trait, -- Only LIMITED is present A_Limited_Private_Trait, -- LIMITED and PRIVATE are present An_Abstract_Trait, -- Only ABSTRACT is present An_Abstract_Private_Trait, -- ABSTRACT and PRIVATE are present An_Abstract_Limited_Trait, -- ABSTRACT and LIMITED are present An_Abstract_Limited_Private_Trait); -- ABSTRACT, LIMITED, and PRIVATE are -- present ------------------------------------------------------------------------------ -- Declaration_Origins -- Literals -- RM 95 ------------------------------------------------------------------------------ type Declaration_Origins is ( Not_A_Declaration_Origin, -- An unexpected element An_Explicit_Declaration, -- explicitly declared in the text -- of a program, or within an -- expanded generic template An_Implicit_Predefined_Declaration, -- 3.2.3(1) An_Implicit_Inherited_Declaration); -- 3.4(7-23) ------------------------------------------------------------------------------ -- Mode_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Mode_Kinds is ( -- 6.1 Not_A_Mode, -- An unexpected element A_Default_In_Mode, -- procedure A(B : C); An_In_Mode, -- procedure A(B : IN C); An_Out_Mode, -- procedure A(B : OUT C); An_In_Out_Mode); -- procedure A(B : IN OUT C); ------------------------------------------------------------------------------ -- Default_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Default_Kinds is ( -- 12.6 Not_A_Default, -- An unexpected element A_Name_Default, -- with subprogram_specification is default_name; A_Box_Default, -- with subprogram_specification is <>; A_Nil_Default); -- with subprogram_specification; ------------------------------------------------------------------------------ -- Definition_Kinds -- Literals -- RM 95 -> Subordinate Kinds ------------------------------------------------------------------------------ type Definition_Kinds is ( Not_A_Definition, -- An unexpected element A_Type_Definition, -- 3.2.1 -> Type_Kinds A_Subtype_Indication, -- 3.2.2 A_Constraint, -- 3.2.2 -> Constraint_Kinds A_Component_Definition, -- 3.6 -> Trait_Kinds A_Discrete_Subtype_Definition, -- 3.6 -> Discrete_Range_Kinds A_Discrete_Range, -- 3.6.1 -> Discrete_Range_Kinds An_Unknown_Discriminant_Part, -- 3.7 A_Known_Discriminant_Part, -- 3.7 A_Record_Definition, -- 3.8 A_Null_Record_Definition, -- 3.8 A_Null_Component, -- 3.8 A_Variant_Part, -- 3.8 A_Variant, -- 3.8 An_Others_Choice, -- 3.8.1, 4.3.1, 4.3.3, 11.2 A_Private_Type_Definition, -- 7.3 -> Trait_Kinds A_Tagged_Private_Type_Definition, -- 7.3 -> Trait_Kinds A_Private_Extension_Definition, -- 7.3 -> Trait_Kinds A_Task_Definition, -- 9.1 A_Protected_Definition, -- 9.4 A_Formal_Type_Definition); -- 12.5 -> Formal_Type_Kinds ------------------------------------------------------------------------------ -- Type_Kinds -- Literals -- RM 95 -> Subordinate Kinds ------------------------------------------------------------------------------ type Type_Kinds is ( Not_A_Type_Definition, -- An unexpected element A_Derived_Type_Definition, -- 3.4 -> Trait_Kinds A_Derived_Record_Extension_Definition, -- 3.4 -> Trait_Kinds An_Enumeration_Type_Definition, -- 3.5.1 A_Signed_Integer_Type_Definition, -- 3.5.4 A_Modular_Type_Definition, -- 3.5.4 A_Root_Type_Definition, -- 3.5.4(10), 3.5.6(4) -- -> Root_Type_Kinds A_Floating_Point_Definition, -- 3.5.7 An_Ordinary_Fixed_Point_Definition, -- 3.5.9 A_Decimal_Fixed_Point_Definition, -- 3.5.9 An_Unconstrained_Array_Definition, -- 3.6 A_Constrained_Array_Definition, -- 3.6 A_Record_Type_Definition, -- 3.8 -> Trait_Kinds A_Tagged_Record_Type_Definition, -- 3.8 -> Trait_Kinds An_Access_Type_Definition); -- 3.10 -> Access_Type_Kinds ------------------------------------------------------------------------------ -- Formal_Type_Kinds -- Literals -- RM 95 -> Subordinate Kinds ------------------------------------------------------------------------------ type Formal_Type_Kinds is ( Not_A_Formal_Type_Definition, -- An unexpected element A_Formal_Private_Type_Definition, -- 12.5.1 -> Trait_Kinds A_Formal_Tagged_Private_Type_Definition, -- 12.5.1 -> Trait_Kinds A_Formal_Derived_Type_Definition, -- 12.5.1 -> Trait_Kinds A_Formal_Discrete_Type_Definition, -- 12.5.2 A_Formal_Signed_Integer_Type_Definition, -- 12.5.2 A_Formal_Modular_Type_Definition, -- 12.5.2 A_Formal_Floating_Point_Definition, -- 12.5.2 A_Formal_Ordinary_Fixed_Point_Definition, -- 12.5.2 A_Formal_Decimal_Fixed_Point_Definition, -- 12.5.2 A_Formal_Unconstrained_Array_Definition, -- 12.5.3 A_Formal_Constrained_Array_Definition, -- 12.5.3 A_Formal_Access_Type_Definition); -- 12.5.4 -> Access_Type_Kinds ------------------------------------------------------------------------------ -- Access_Type_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Access_Type_Kinds is ( -- 3.10 Not_An_Access_Type_Definition, -- An unexpected element A_Pool_Specific_Access_To_Variable, -- access subtype_indication An_Access_To_Variable, -- access all subtype_indication An_Access_To_Constant, -- access constant subtype_indication An_Access_To_Procedure, -- access procedure An_Access_To_Protected_Procedure, -- access protected procedure An_Access_To_Function, -- access function An_Access_To_Protected_Function); -- access protected function subtype Access_To_Object_Definition is Access_Type_Kinds range A_Pool_Specific_Access_To_Variable .. An_Access_To_Constant; subtype Access_To_Subprogram_Definition is Access_Type_Kinds range An_Access_To_Procedure .. An_Access_To_Protected_Function; ------------------------------------------------------------------------------ -- Root_Type_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Root_Type_Kinds is ( Not_A_Root_Type_Definition, -- An unexpected element A_Root_Integer_Definition, -- 3.5.4(9) A_Root_Real_Definition, -- 3.5.6(2) A_Root_Fixed_Definition, -- 3.5.6(2) A_Universal_Integer_Definition, -- 3.5.4(10) A_Universal_Real_Definition, -- 3.5.6(4) A_Universal_Fixed_Definition); -- 3.5.6(4) ------------------------------------------------------------------------------ -- Constraint_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Constraint_Kinds is ( Not_A_Constraint, -- An unexpected element A_Range_Attribute_Reference, -- 3.2.2, 3.5 A_Simple_Expression_Range, -- 3.2.2, 3.5 A_Digits_Constraint, -- 3.2.2, 3.5.9 A_Delta_Constraint, -- 3.2.2, J.3 An_Index_Constraint, -- 3.2.2, 3.6.1 A_Discriminant_Constraint); -- 3.2.2 ------------------------------------------------------------------------------ -- Discrete_Range_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Discrete_Range_Kinds is ( Not_A_Discrete_Range, -- An unexpected element A_Discrete_Subtype_Indication, -- 3.6.1, 3.2.2 A_Discrete_Range_Attribute_Reference, -- 3.6.1, 3.5 A_Discrete_Simple_Expression_Range); -- 3.6.1, 3.5 ------------------------------------------------------------------------------ -- Association_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Association_Kinds is ( Not_An_Association, -- An unexpected element A_Pragma_Argument_Association, -- 2.8 A_Discriminant_Association, -- 3.7.1 A_Record_Component_Association, -- 4.3.1 An_Array_Component_Association, -- 4.3.3 A_Parameter_Association, -- 6.4 A_Generic_Association); -- 12.3 ------------------------------------------------------------------------------ -- Expression_Kinds - general expression classifications -- Literals -- RM 95 -> Subordinate Kinds ------------------------------------------------------------------------------ type Expression_Kinds is ( Not_An_Expression, -- An unexpected element An_Integer_Literal, -- 2.4 A_Real_Literal, -- 2.4.1 A_String_Literal, -- 2.6 An_Identifier, -- 4.1 An_Operator_Symbol, -- 4.1 A_Character_Literal, -- 4.1 An_Enumeration_Literal, -- 4.1 An_Explicit_Dereference, -- 4.1 A_Function_Call, -- 4.1 An_Indexed_Component, -- 4.1.1 A_Slice, -- 4.1.2 A_Selected_Component, -- 4.1.3 An_Attribute_Reference, -- 4.1.4 -> Attribute_Kinds A_Record_Aggregate, -- 4.3 An_Extension_Aggregate, -- 4.3 A_Positional_Array_Aggregate, -- 4.3 A_Named_Array_Aggregate, -- 4.3 An_And_Then_Short_Circuit, -- 4.4 An_Or_Else_Short_Circuit, -- 4.4 An_In_Range_Membership_Test, -- 4.4 A_Not_In_Range_Membership_Test, -- 4.4 An_In_Type_Membership_Test, -- 4.4 A_Not_In_Type_Membership_Test, -- 4.4 A_Null_Literal, -- 4.4 A_Parenthesized_Expression, -- 4.4 A_Type_Conversion, -- 4.6 A_Qualified_Expression, -- 4.7 An_Allocation_From_Subtype, -- 4.8 An_Allocation_From_Qualified_Expression); -- 4.8 ------------------------------------------------------------------------------ -- Operator_Kinds - classification of the various Ada predefined operators -- Literals -- RM 95 ------------------------------------------------------------------------------ type Operator_Kinds is ( -- 4.5 Not_An_Operator, -- An unexpected element An_And_Operator, -- and An_Or_Operator, -- or An_Xor_Operator, -- xor 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, -- mod A_Rem_Operator, -- rem An_Exponentiate_Operator, -- ** An_Abs_Operator, -- abs A_Not_Operator); -- not ------------------------------------------------------------------------------ -- Attribute_Kinds - classifications for all known Ada attributes -- Literals -- RM 95 ------------------------------------------------------------------------------ type Attribute_Kinds is ( Not_An_Attribute, -- An unexpected element An_Access_Attribute, -- 3.10.2(24), 3.10.2(32), K(2), K(4) An_Address_Attribute, -- 13.3(11), J.7.1(5), K(6) An_Adjacent_Attribute, -- A.5.3(48), K(8) An_Aft_Attribute, -- 3.5.10(5), K(12) An_Alignment_Attribute, -- 13.3(23), K(14) A_Base_Attribute, -- 3.5(15), K(17) A_Bit_Order_Attribute, -- 13.5.3(4), K(19) A_Body_Version_Attribute, -- E.3(4), K(21) A_Callable_Attribute, -- 9.9(2), K(23) A_Caller_Attribute, -- C.7.1(14), K(25) A_Ceiling_Attribute, -- A.5.3(33), K(27) A_Class_Attribute, -- 3.9(14), 7.3.1(9), K(31), K(34) A_Component_Size_Attribute, -- 13.3(69), K(36) A_Compose_Attribute, -- A.5.3(24), K(38) A_Constrained_Attribute, -- 3.7.2(3), J.4(2), K(42) A_Copy_Sign_Attribute, -- A.5.3(51), K(44) A_Count_Attribute, -- 9.9(5), K(48) A_Definite_Attribute, -- 12.5.1(23), K(50) A_Delta_Attribute, -- 3.5.10(3), K(52) A_Denorm_Attribute, -- A.5.3(9), K(54) A_Digits_Attribute, -- 3.5.8(2), 3.5.10(7), K(56), K(58) An_Exponent_Attribute, -- A.5.3(18), K(60) An_External_Tag_Attribute, -- 13.3(75), K(64) A_First_Attribute, -- 3.5(12), 3.6.2(3), K(68), K(70) A_First_Bit_Attribute, -- 13.5.2(3), K(72) A_Floor_Attribute, -- A.5.3(30), K(74) A_Fore_Attribute, -- 3.5.10(4), K(78) A_Fraction_Attribute, -- A.5.3(21), K(80) An_Identity_Attribute, -- 11.4.1(9), C.7.1(12), K(84), K(86) An_Image_Attribute, -- 3.5(35), K(88) An_Input_Attribute, -- 13.13.2(22), 13.13.2(32), K(92), K(96) A_Last_Attribute, -- 3.5(13), 3.6.2(5), K(102), K(104) A_Last_Bit_Attribute, -- 13.5.2(4), K(106) A_Leading_Part_Attribute, -- A.5.3(54), K(108) A_Length_Attribute, -- 3.6.2(9), K(117) A_Machine_Attribute, -- A.5.3(60), K(119) A_Machine_Emax_Attribute, -- A.5.3(8), K(123) A_Machine_Emin_Attribute, -- A.5.3(7), K(125) A_Machine_Mantissa_Attribute, -- A.5.3(6), K(127) A_Machine_Overflows_Attribute, -- A.5.3(12), A.5.4(4), K(129), K(131) A_Machine_Radix_Attribute, -- A.5.3(2), A.5.4(2), K(133), K(135) A_Machine_Rounds_Attribute, -- A.5.3(11), A.5.4(3), K(137), K(139) A_Max_Attribute, -- 3.5(19), K(141) A_Max_Size_In_Storage_Elements_Attribute,-- 13.11.1(3), K(145) A_Min_Attribute, -- 3.5(16), K(147) A_Model_Attribute, -- A.5.3(68), G.2.2(7), K(151) A_Model_Emin_Attribute, -- A.5.3(65), G.2.2(4), K(155) A_Model_Epsilon_Attribute, -- A.5.3(66), K(157) A_Model_Mantissa_Attribute, -- A.5.3(64), G.2.2(3), K(159) A_Model_Small_Attribute, -- A.5.3(67), K(161) A_Modulus_Attribute, -- 3.5.4(17), K(163) An_Output_Attribute, -- 13.13.2(19), 13.13.2(29), K(165), K(169) A_Partition_ID_Attribute, -- E.1(9), K(173) A_Pos_Attribute, -- 3.5.5(2), K(175) A_Position_Attribute, -- 13.5.2(2), K(179) A_Pred_Attribute, -- 3.5(25), K(181) A_Range_Attribute, -- 3.5(14), 3.6.2(7), K(187), K(189) A_Read_Attribute, -- 13.13.2(6), 13.13.2(14), K(191), K(195) A_Remainder_Attribute, -- A.5.3(45), K(199) A_Round_Attribute, -- 3.5.10(12), K(203) A_Rounding_Attribute, -- A.5.3(36), K(207) A_Safe_First_Attribute, -- A.5.3(71), G.2.2(5), K(211) A_Safe_Last_Attribute, -- A.5.3(72), G.2.2(6), K(213) A_Scale_Attribute, -- 3.5.10(11), K(215) A_Scaling_Attribute, -- A.5.3(27), K(217) A_Signed_Zeros_Attribute, -- A.5.3(13), K(221) A_Size_Attribute, -- 13.3(40), 13.3(45), K(223), K(228) A_Small_Attribute, -- 3.5.10(2), K(230) A_Storage_Pool_Attribute, -- 13.11(13), K(232) A_Storage_Size_Attribute, -- 13.3(60), 13.11(14), J.9(2), K(234), -- K(236) A_Succ_Attribute, -- 3.5(22), K(238) A_Tag_Attribute, -- 3.9(16), 3.9(18), K(242), K(244) A_Terminated_Attribute, -- 9.9(3), K(246) A_Truncation_Attribute, -- A.5.3(42), K(248) An_Unbiased_Rounding_Attribute,-- A.5.3(39), K(252) An_Unchecked_Access_Attribute, -- 13.10(3), H.4(18), K(256) A_Val_Attribute, -- 3.5.5(5), K(258) A_Valid_Attribute, -- 13.9.2(3), H(6), K(262) A_Value_Attribute, -- 3.5(52), K(264) A_Version_Attribute, -- E.3(3), K(268) A_Wide_Image_Attribute, -- 3.5(28), K(270) A_Wide_Value_Attribute, -- 3.5(40), K(274) A_Wide_Width_Attribute, -- 3.5(38), K(278) A_Width_Attribute, -- 3.5(39), K(280) A_Write_Attribute, -- 13.13.2(3), 13.13.2(11), K(282), K(286) An_Implementation_Defined_Attribute, -- Vendor Annex M An_Unknown_Attribute); -- Unknown to ASIS ------------------------------------------------------------------------------ -- Statement_Kinds - classifications of Ada statements -- Literals -- RM 95 ------------------------------------------------------------------------------ type Statement_Kinds is ( Not_A_Statement, -- An unexpected element A_Null_Statement, -- 5.1 An_Assignment_Statement, -- 5.2 An_If_Statement, -- 5.3 A_Case_Statement, -- 5.4 A_Loop_Statement, -- 5.5 A_While_Loop_Statement, -- 5.5 A_For_Loop_Statement, -- 5.5 A_Block_Statement, -- 5.6 An_Exit_Statement, -- 5.7 A_Goto_Statement, -- 5.8 A_Procedure_Call_Statement, -- 6.4 A_Return_Statement, -- 6.5 An_Accept_Statement, -- 9.5.2 An_Entry_Call_Statement, -- 9.5.3 A_Requeue_Statement, -- 9.5.4 A_Requeue_Statement_With_Abort, -- 9.5.4 A_Delay_Until_Statement, -- 9.6 A_Delay_Relative_Statement, -- 9.6 A_Terminate_Alternative_Statement, -- 9.7.1 A_Selective_Accept_Statement, -- 9.7.2 A_Timed_Entry_Call_Statement, -- 9.7.3 A_Conditional_Entry_Call_Statement, -- 9.7.3 An_Asynchronous_Select_Statement, -- 9.7.4 An_Abort_Statement, -- 9.8 A_Raise_Statement, -- 11.3 A_Code_Statement); -- 13.8 ------------------------------------------------------------------------------ -- Path_Kinds -- -- A_Path elements represent execution path alternatives presented by -- if_statements, case_statements, and the four forms of select_statements. -- Each statement path alternative encloses component elements that -- represent a sequence_of_statements. Some forms of A_Path elements also -- have as a component elements that represent a condition, an optional -- guard, or a discrete_choice_list. -- -- ASIS treats select_alternatives, entry_call_alternatives, and -- triggering_alternatives, as the syntactic equivalent of a -- sequence_of_statements. Specifically, terminate_alternatives (terminate;) -- are treated as the syntactical equivalent of a single statement and are -- represented as Statement_Kinds'A_Terminate_Alternative_Statement. -- This allows queries to directly provide the sequence_of_statements enclosed -- by A_Path elements, avoiding the extra step of returning an element -- representing such an alternative. -- -- For example, -- -- select -- A_Select_Path enclosing a sequence of two statements -- -- accept Next_Work_Item(WI : in Work_Item) do -- Current_Work_Item := WI; -- end; -- Process_Work_Item(Current_Work_Item); -- -- or -- An_Or_Path enclosing a quard and a sequence of two statements -- -- when Done_Early => -- accept Shut_Down; -- exit; -- -- or -- An_Or_Path enclosing a sequence with only a single statement -- -- terminate; -- -- end select; -- ------------------------------------------------------------------------------ -- Path_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ type Path_Kinds is ( Not_A_Path, -- An unexpected element An_If_Path, -- 5.3: -- if condition then -- sequence_of_statements An_Elsif_Path, -- 5.3: -- elsif condition then -- sequence_of_statements An_Else_Path, -- 5.3, 9.7.1, 9.7.3: -- else sequence_of_statements A_Case_Path, -- 5.4: -- when discrete_choice_list => -- sequence_of_statements A_Select_Path, -- 9.7.1: -- select [guard] select_alternative -- 9.7.2, 9.7.3: -- select entry_call_alternative -- 9.7.4: -- select triggering_alternative An_Or_Path, -- 9.7.1: -- or [guard] select_alternative -- 9.7.2: -- or delay_alternative A_Then_Abort_Path); -- 9.7.4 -- then abort sequence_of_statements ------------------------------------------------------------------------------ -- Clause_Kinds -- Literals -- RM 95 -> Subordinate Kinds ------------------------------------------------------------------------------ type Clause_Kinds is ( Not_A_Clause, -- An unexpected element A_Use_Package_Clause, -- 8.4 A_Use_Type_Clause, -- 8.4 A_With_Clause, -- 10.1.2 A_Representation_Clause, -- 13.1 -> Representation_Clause_Kinds A_Component_Clause); -- 13.5.1 ------------------------------------------------------------------------------ -- Representation_Clause_Kinds - varieties of representation clauses -- Literals -- RM 95 ------------------------------------------------------------------------------ type Representation_Clause_Kinds is ( Not_A_Representation_Clause, -- An unexpected element An_Attribute_Definition_Clause, -- 13.3 An_Enumeration_Representation_Clause, -- 13.4 A_Record_Representation_Clause, -- 13.5.1 An_At_Clause); -- J.7 end ASIS_Element_Kinds; ------------------------------------------------------------------------------ package ASIS_Unit_Kinds is ------------------------------------------------------------------------------ -- ASIS.Element_Kinds -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- Enumeration types describing the various kinds of units. -- --|95------------------------------------------------------------------------- --|95 package ASIS_Unit_Kinds is new --|95------------------------------------------------------------------------- --|95 type Unit_Kinds has been expanded. --|95 A_Configuration_Compilation literal is new. ------------------------------------------------------------------------------ -- Unit_Kinds - the varieties of compilation units of compilations, -- including compilations having no compilation units but consisting of -- configuration pragmas or comments. ------------------------------------------------------------------------------ type Unit_Kinds is ( Not_A_Unit, -- A Nil_Compilation_Unit A_Procedure, A_Function, A_Package, A_Generic_Procedure, A_Generic_Function, A_Generic_Package, A_Procedure_Instance, A_Function_Instance, A_Package_Instance, A_Procedure_Renaming, A_Function_Renaming, A_Package_Renaming, A_Generic_Procedure_Renaming, A_Generic_Function_Renaming, A_Generic_Package_Renaming, A_Procedure_Body, -- A unit interpreted only as the completion -- of a procedure, or a unit interpreted as -- both the declaration and body of a library -- procedure. RM 95 10.1.4(4) A_Function_Body, -- A unit interpreted only as the completion -- of a function, or a unit interpreted as -- both the declaration and body of a library -- function. RM 95 10.1.4(4) A_Package_Body, A_Procedure_Body_Subunit, A_Function_Body_Subunit, A_Package_Body_Subunit, A_Task_Body_Subunit, A_Protected_Body_Subunit, A_Nonexistent_Declaration, -- A unit that does not exist but is: -- 1) mentioned in a with clause of -- another unit or, -- 2) a required corresponding -- library_unit_declaration A_Nonexistent_Body, -- A unit that does not exist but is: -- 1) known to be a corresponding -- subunit or, -- 2) a required corresponding -- library_unit_body A_Configuration_Compilation, -- A compilation with no compilation_units, -- but possibly containing comments, -- configuration pragmas, or both. An_Unknown_Unit); -- An indeterminable or proprietary unit --|95------------------------------------------------------------------------- --|95 subtype declarations for Unit_Kinds are new. subtype A_Subprogram_Declaration is Unit_Kinds range A_Procedure .. A_Function; subtype A_Subprogram_Renaming is Unit_Kinds range A_Procedure_Renaming .. A_Function_Renaming; subtype A_Generic_Declaration is Unit_Kinds range A_Generic_Procedure .. A_Generic_Package; subtype A_Generic_Instance is Unit_Kinds range A_Procedure_Instance .. A_Package_Instance; subtype A_Subprogram_Body is Unit_Kinds range A_Procedure_Body .. A_Function_Body; subtype A_Library_Unit_Body is Unit_Kinds range A_Procedure_Body .. A_Package_Body; subtype A_Generic_Renaming is Unit_Kinds range A_Generic_Procedure_Renaming .. A_Generic_Package_Renaming; subtype A_Renaming is Unit_Kinds range A_Procedure_Renaming .. A_Generic_Package_Renaming; subtype A_Subunit is Unit_Kinds range A_Procedure_Body_Subunit .. A_Protected_Body_Subunit; --|95------------------------------------------------------------------------- --|95 type Unit_Classes is new ------------------------------------------------------------------------------ -- Unit_Classes - classification of public, private, body, and subunit. ------------------------------------------------------------------------------ type Unit_Classes is ( -- RM 95 10.1.1(12), 10.1.3 Not_A_Class, -- A nil, nonexistent, unknown, -- or configuration compilation unit class. A_Public_Declaration, -- library_unit_declaration or -- library_unit_renaming_declaration. A_Public_Body, -- library_unit_body interpreted only as a -- completion. Its declaration is public. A_Public_Declaration_And_Body, -- subprogram_body interpreted as both a -- declaration and body of a library subprogram -- RM 95 10.1.4(4). A_Private_Declaration, -- private library_unit_declaration or -- private library_unit_renaming_declaration. A_Private_Body, -- library_unit_body interpreted only as a -- completion. Its declaration is private. A_Separate_Body); -- separate (parent_unit_name) proper_body. --|95------------------------------------------------------------------------- --|95 type Unit_States of ASIS 2.0.B is deleted. --|95 The method to determine consistency is to use one of the two semantic --|95 dependence queries: Elaboration_Order or Semantic_Dependence_Order. --|95 These queries return a value of the type Relationship, which contains --|95 lists of consistent, inconsistent, missing and circular units. ------------------------------------------------------------------------------ -- Unit_Origins - classification of possible unit origination ------------------------------------------------------------------------------ type Unit_Origins is ( Not_An_Origin, -- A nil or nonexistent unit origin -- An_Unknown_Unit can be any origin A_Predefined_Unit, -- Ada predefined language environment units -- defined in Annex A. These include -- Standard and the three root library -- units: Ada, Interfaces, and System, -- and their descendents. i.e. Ada.Text_Io, -- Ada.Calendar, Interfaces.C, etc. An_Implementation_Unit, -- Implementation specific library units, -- eg. runtime support packages, utility -- libraries, etc. It is not required -- that any implementation supplied units -- have this origin. This is a suggestion. -- Implementations might provide, for -- example, precompiled versions of public -- domain software that could have -- An_Application_Unit origin. An_Application_Unit); -- Neither A_Predefined_Unit or -- An_Implementation_Unit ------------------------------------------------------------------------------ -- Relation_Kinds - classification of unit relationships --|95------------------------------------------------------------------------- --|95 Added Ancestors and Descendants literals to Relation_Kinds. --|95------------------------------------------------------------------------- --|95 Relation_Kinds: The Definition of Supporters now includes parent units. --|95------------------------------------------------------------------------- --|95 Relation_Kinds: The definition of Dependents now includes child units. --|95------------------------------------------------------------------------- --|95 Relation_Kinds: The definition of Family now includes descendants. --|95------------------------------------------------------------------------- --|95 Relation_Kinds: The definition of Extended_Family now includes --|95 descendants and ancestors. ------------------------------------------------------------------------------ type Relation_Kinds is ( Ancestors, Descendants, ---------------------------------------------------------------------- -- Definition: ANCESTORS of a unit; DESCENDANTS of a unit -- -- Ancestors of a library unit are itself, its parent, its parent's -- parent, and so on. (Standard is an ancestor of every library unit). -- -- The Descendants relation is the inverse of the ancestor relation. -- RM 95 10.1.1(11). ---------------------------------------------------------------------- Direct_Supporters, Supporters, ---------------------------------------------------------------------- -- Definition: SUPPORTERS of a unit -- -- Supporters of a compilation unit are units on which it semantically -- depends. RM 95 10.1.1(26). -- -- The Supporters relation is transitive; units that are supporters of library -- units mentioned in a with clause of a compilation unit are also supporters -- of that compilation unit. -- -- Direct_Supporters of a compilation unit are Supporters that are directly -- visible within the compilation unit. -- -- A parent declaration is a Direct_Supporter of its descendant units. -- -- Each library unit mentioned in the with clauses of a compilation unit -- is a Direct_Supporter of that compilation unit and (recursively) any -- completion, child units, or subunits that are included in the declarative -- region of that compilation unit. RM 95 8.1(7-10). -- -- A library_unit_body has as a Direct_Supporter, its corresponding -- library_unit_declaration, if any. -- -- The parent body of a subunit is a Direct_Supporter of the subunit. -- -- A compilation unit defining a type later named in an attribute_reference -- in another compilation unit is a Direct_Supporter of the other compilation -- unit. -- -- The package Standard is a Direct_Supporter of every unit, whether or not -- it is mentioned in a with clause. -- -- For example: -- If A withs B and B withs C. -- Then C directly supports B, B directly supports A, -- C indirectly supports A, and -- both B and C are supporters of A. -- ---------------------------------------------------------------------- Direct_Dependents, Dependents, ---------------------------------------------------------------------- -- Definition: DEPENDENTS of a unit -- -- Dependents of a compilation unit are all the compilation units that -- depend semantically on it. -- -- The Dependents relation is transitive; Dependents of a unit include the -- unit's Dependents, each dependent unit's Dependents, and so on. A unit -- that is a dependent of a compilation unit also (indirectly) is a dependent -- of the compilation unit's Supporters. -- -- Direct_Dependents of a compilation unit are Dependents within which the -- compilation unit is directly visible. -- -- Child units are Direct_Dependents of their ancestor units. -- -- A compilation unit that mentions other library units in its with -- clauses is one of the Direct_Dependents of those library units. -- -- A library_unit body is a Direct_Dependent of its corresponding -- library_unit_declaration, if any. -- -- A subunit is a Direct_Dependent of its parent body. -- -- A compilation unit that contains an attribute_reference of a type defined -- in another compilation unit is a Direct_Dependent of the other unit. -- -- -- For example: -- If A withs B and B withs C -- then A directly depends on B, B directly depends on C, -- A indirectly depends on C, and -- both A and B are dependents of C. -- -- Dependencies between compilation units may also be introduced by -- inline inclusions (RM 95 10.1.4(7)) and for certain other compiler -- optimizations. These relations are intended to reflect all of these -- considerations. ---------------------------------------------------------------------- Family, ---------------------------------------------------------------------- -- Definition: FAMILY of a unit -- -- The family of a given unit is defined as the set of compilation -- units that comprise the given unit's declaration, body, ancestors, -- descendants, and subunits (and subunits of subunits, etc.). ---------------------------------------------------------------------- --|OP Proposal to remove Direct_Supporters and Direct_Dependents. --|OP May need a new relation to describe the union of Family and Supporters Extended_Family); ---------------------------------------------------------------------- -- Definition: EXTENDED FAMILY of a unit; CLOSURE of a unit -- -- The extended family of a given unit is defined as the set of all -- the Ada units ultimately needed by that unit to form a partition. -- RM 95 10.2(2-7). -- -- The term closure is commonly used with similar meaning. -- -- For example: -- Assume the body of C has a subunit C.S and the declaration of C has -- child units C.Y and C.Z. -- If A withs B, B withs C, B withs C.Y, and C does not with a library -- unit. Then the extended family of A is: -- library unit declaration C -- child library unit declaration C.Y -- child library unit body C.Y, if any -- library unit body C -- subunit C.S -- library unit declaration B -- library unit body B, if any -- library unit declaration A -- library unit body A, if any -- -- Child unit C.Z is only part of the Extended_Family if it is needed. -- end ASIS_Unit_Kinds; ------------------------------------------------------------------------------ package ASIS_Errors is ------------------------------------------------------------------------------ -- ASIS_Errors -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This enumeration type describes the various kinds of errors. -- --|95------------------------------------------------------------------------- --|95 package ASIS_Errors is a new ASIS package ------------------------------------------------------------------------------ -- ASIS reports all operational errors by raising an exception. Whenever an -- ASIS implementation raises one of the exceptions declared in package -- Asis.Exceptions, it will previously have set the values returned by the -- Status and Diagnosis queries to indicate the cause of the error. The -- possible values for Status are indicated here along with suggestions for -- the associated contents of the Diagnosis string. -- -- ASIS applications are encouraged to follow this same convention whenever -- they explicitly raise any ASIS exception--always record a Status and -- Diagnosis prior to raising the exception. -- --|95------------------------------------------------------------------------- --|95 Text_Error is new. ------------------------------------------------------------------------------ type Error_Kinds is ( Not_An_Error, -- No error is presently recorded Value_Error, -- Routine argument value invalid Initialization_Error, -- ASIS is uninitialized Environment_Error, -- ASIS could not initialize Parameter_Error, -- Bad Parameter given to Initialize Capacity_Error, -- Implementation overloaded Name_Error, -- Context/object not found Use_Error, -- Context/object not use/open-able Data_Error, -- Context/object bad/invalid/corrupt Text_Error, -- The program text cannot be located Storage_Error, -- Storage_Error suppressed Obsolete_Reference_Error, -- Argument or result is invalid due to -- and inconsistent compilation unit Unhandled_Exception_Error, -- Unexpected exception suppressed Not_Implemented_Error, -- Functionality not implemented Internal_Error); -- Implementation internal failure package Exceptions is ------------------------------------------------------------------------------ -- All defined ASIS exceptions. ------------------------------------------------------------------------------ Asis_Inappropriate_Context : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is passed a Context value that is not appropriate for the -- operation. This exception will typically indicate that a user error -- has occurred within the application. ------------------------------------------------------------------------------ Asis_Inappropriate_Container : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is passed a Container value that is not appropriate for -- the operation. This exception will typically indicate that a user error -- has occurred within the application. ------------------------------------------------------------------------------ Asis_Inappropriate_Compilation_Unit : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is passed a Compilation_Unit value that is not -- appropriate. This exception will typically indicate that a user -- error has occurred within the application. ------------------------------------------------------------------------------ Asis_Inappropriate_Element : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is given an Element value that is not appropriate. This -- exception will typically indicate that a user error has occurred within -- the application. ------------------------------------------------------------------------------ Asis_Inappropriate_Line : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is given a Line value that is not appropriate. ------------------------------------------------------------------------------ Asis_Inappropriate_Line_Number : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is given a Line_Number value that is not appropriate. -- This exception will typically indicate that a user error has occurred -- within the application. ------------------------------------------------------------------------------ Asis_Failed : exception; ------------------------------------------------------------------------------ -- All ASIS routines may raise Failed whenever they cannot normally complete -- their operation. This exception will typically indicate a failure of the -- underlying ASIS implementation. -- -- This is a catch-all exception that may be raised for different reasons -- in different ASIS implementations. ------------------------------------------------------------------------------ end Exceptions; end ASIS_Errors; with Asis_Errors; with Asis_Unit_Kinds; with Asis_Element_Kinds; with Calendar; ------------------------------------------------------------------------------ package Asis_Type_Primitives is ------------------------------------------------------------------------------ -- Asis_Type_Primitives -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- ****************** Sample Implementation Module ******************* -- * The purpose of this package is to serve as an example. It is * -- * for demonstration and documentation purposes only. A * -- * conforming ASIS implementation is not required to include a * -- * package with the name of Asis_Type_Primitives. * -- * * -- * Many of the types, operators, subprograms, and subpackages * -- * declared in this package are part of any conforming ASIS * -- * implementation. Vendors may place declarations, similar to * -- * these, anywhere they deem convenient. Applications obtain * -- * visibility to these declarations by way of renames that appear * -- * in package ASIS. * -- * * -- * This package demonstrates one possible scheme for implementing * -- * the most primitive ASIS types. The commentary below specifies * -- * many implementation details, choices, and constraints that * -- * must be followed by all implementations. Except for the * -- * nested packages that are ultimately made visible to * -- * applications via package ASIS, the contents of this package * -- * may not be of interest to anyone other than an ASIS implementor.* -- ******************************************************************* -- -- Basic low level type and subtype declarations for ASIS. This package, and -- its companion package, Asis_Vendor_Primitives, are intended to: -- -- - Demonstrate a method for defining the vendor-specific aspects of ASIS -- types. -- -- - Specify which ASIS types have vendor-specific definitions. -- -- - Specify the allowable variations for vendor-specific definitions. -- -- - Specify the portable operational characteristics of all vendor-based -- ASIS types. -- -- This package has the following sub-packages: -- -- - Numerics - numeric types and operations -- - Times - time/duration type -- -- The Numerics, and Times packages are visible to ASIS -- applications and must be declared with contents as shown here. The exact -- location of these subpackages is not specified. Their vendor-specific -- location is portably renamed in package ASIS. -- -- Other sample top level declarations may be found in the -- Asis_Vendor_Primitives package. -- -- This package forms a lower layer of a model ASIS implementation. ------------------------------------------------------------------------------ package Numerics is ------------------------------------------------------------------------------ -- The purpose of the ASIS numeric types are: -- -- - to provide a set of subtypes that have portable names, in -- order to reduce potential portability problems between different Ada -- implementations having very different Standard Integers and other numeric -- types. -- -- - to guarantee as much as possible that all ASIS implementations will have -- adequate sizing ranges for lists and strings. ------------------------------------------------------------------------------ --|95------------------------------------------------------------------------- --|95 Asis_Integer is a subtype of Standard.Integer. ------------------------------------------------------------------------------ -- Asis_Integer -- -- A numeric subtype that allows each ASIS implementation to place constraints -- on the lower and upper bounds. Whenever possible, the range of this type -- should meet or exceed -(2**31-1) .. 2**31-1. -- -- The actual range of Asis_Integer is the only allowed variation for these -- declarations. ------------------------------------------------------------------------------ subtype Asis_Integer is Standard.Integer; -- Or, the subtype can be constrained further if needed: -- -- Asis_Integer_Implementation_Lower : constant := -- Standard.Integer'Last; -- Asis_Integer_Implementation_Upper : constant := -- Standard.Integer'First; -- subtype Asis_Integer is Standard.Integer range -- Asis_Integer_Implementation_Lower .. -- Asis_Integer_Implementation_Upper; subtype Asis_Natural is Asis_Integer range 0 .. Asis_Integer'Last; subtype Asis_Positive is Asis_Integer range 1 .. Asis_Integer'Last; ------------------------------------------------------------------------------ -- List_Index -- -- A numeric subtype that, if possible, should have the same range as -- Asis_Positive. However, some implementations may need to enforce a smaller -- upper bound on the range of list values. -- -- The actual upper bound on the range of List_Index is the only allowed -- variation for this declaration. ------------------------------------------------------------------------------ List_Index_Implementation_Upper : constant Asis_Positive := Asis_Positive'Last; subtype List_Index is Asis_Positive range 1 .. List_Index_Implementation_Upper; end Numerics; subtype Asis_Integer is Numerics.Asis_Integer; subtype Asis_Natural is Numerics.Asis_Natural; subtype Asis_Positive is Numerics.Asis_Positive; subtype List_Index is Numerics.List_Index; ------------------------------------------------------------------------------ -- ASIS_Character and ASIS_String are subtypes of Standard.Character -- and Standard.String. ------------------------------------------------------------------------------ subtype Asis_Character is Standard.Character; subtype Asis_String is Standard.String; Nil_Asis_String : constant Asis_String := ""; -- package Times is ------------------------------------------------------------------------------ -- The purpose of the Asis_Time type is to provide a way to represent -- compilation times and time-of-last-update for compilation units. ------------------------------------------------------------------------------ subtype Asis_Time is Calendar.Time; ------------------------------------------------------------------------------ -- A private type from the predefined library package Calendar. Operations on -- Asis_Time are provided by Calendar. ------------------------------------------------------------------------------ Nil_Asis_Time : constant Calendar.Time := Calendar.Time_Of (Year => 1901, Month => 1, Day => 1, Seconds => 0.0); package Operations renames Calendar; end Times; subtype Asis_Time is Times.Asis_Time; Nil_Asis_Time : Asis_Time renames Times.Nil_Asis_Time; end Asis_Type_Primitives; package Asis_Type_Primitives.Vendor is -- A package something like this could be used by the ASIS vendor. -- It may or may not have the name "Vendor". It would probably contain -- declarations of these varieties of types. type Context_Id is record X : Boolean := False; end record; type Unit_Id is record X : Boolean := False; end record; type Element_Id is record X : Boolean := False; end record; type Line_Id is record X : Boolean := False; end record; type Id is record X : Boolean := False; end record; type Id_Segment is record X : Boolean := False; end record; Nil_Context_Id : constant Context_Id := (X => False); Nil_Unit_Id : constant Unit_Id := (X => False); Nil_Element_Id : constant Element_Id := (X => False); Nil_Line_Id : constant Line_Id := (X => False); Nil_Id : constant Id := (X => False); Nil_Id_Segment : constant Id_Segment := (X => False); end Asis_Type_Primitives.Vendor; with Asis_Errors; with Asis_Element_Kinds; with Asis_Type_Primitives; with Asis_Type_Primitives.Vendor; with Asis_Unit_Kinds; ------------------------------------------------------------------------------ package Asis_Vendor_Primitives is ------------------------------------------------------------------------------ -- Asis_Vendor_Primitives -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- ****************** Sample Implementation Module ***************** -- * The purpose of this package is to serve as an example. It is * -- * for demonstration and documentation purposes only. A * -- * conforming ASIS implementation is not required to include a * -- * package with the name of Asis_Vendor_Primitives. * -- * * -- * Many of the types, operators, subprograms, and subpackages * -- * declared in this package are part of any conforming ASIS * -- * implementation. Vendors may place declarations, similar to * -- * these, anywhere they deem convenient. Applications obtain * -- * Visibility to these declarations by way of renames that appear* -- * in package ASIS. * -- * * -- * This package demonstrates one possible scheme for implementing* -- * the basic ASIS types. The commentary below specifies many * -- * implementation details, choices, and constraints that must be * -- * followed by all implementations. Except for the subpackage: * -- * Lines, that is ultimately made visible to applications via a * -- * rename located in packages ASIS, the contents of this package * -- * may not be of interest to anyone that is not themselves * -- * implementing ASIS. * -- ***************************************************************** -- -- Basic top level type and subtype declarations for ASIS. This package, and -- its companion package, Asis_Type_Primitives, are intended to: -- -- - Demonstrate a method for defining the vendor-specific aspects of ASIS -- types. -- -- - Specify which ASIS types have vendor-specific definitions. -- -- - Specify the allowable variations for vendor-specific definitions. -- -- - Specify the portable operational characteristics of all vendor-based -- ASIS types. -- -- This package has the following sub-packages: -- -- - Compilation_Units - Compilation_Unit types and operations -- - Elements - Element types and operations -- - Ids - unique Id types and operations -- - Ada_Environments - Context types and operations -- - Lines - Line types and operations -- -- The Lines package is visible to ASIS applications and must be declared as -- shown here. The exact location of this package is not specified. Its -- vendor-specific location is renamed in package ASIS. All portable ASIS -- applications will refer to this package as ASIS.Limes. -- -- Other sample low level declarations may be found in the -- Asis_Type_Primitives package. -- -- This package forms a middle layer of a model ASIS implementation, -- implemented as a series of layers, that might be diagrammed as follows: -- -- +-------------------------------------------------------------- -- | package Asis (Root library unit of the ASIS subsystem) -- +-------------------------------------------------------------- -- | child packages -- | Asis.Implementation, Asis.Ada_Environments, -- | Asis.Elements, Asis.Declarations, Asis.Expressions -- | Asis.Statements, Asis.Definitions, Asis.Compilation_Units -- | Asis.Clauses, Asis.Ids, Asis.Data_Decomposition, etc. -- +-------------------------------------------------------------- -- | Vendor implementation of ASIS subprogram support -- +-------------------------------------------------------------- -- | package Asis_Vendor_Primitives - complex type declarations -- +-------------------------------------------------------------- -- | Vendor declarations of complex Library/Unit/Element types -- +-------------------------------------------------------------- -- | package Asis_Type_Primitives - simple type declarations -- +-------------------------------------------------------------- -- | package Asis_Element_Kinds - all element kind enumerations -- +-------------------------------------------------------------- -- | package Asis_Unit_Kinds - all CU enumerations -- +-------------------------------------------------------------- -- -- Asis_Vendor_Primitives is declared as an exact superset of the lower level -- Asis_Type_Primitives package. Packages "above" it in the layer hierarchy -- would WITH it and would completely ignore the lower level -- Asis_Type_Primitives. ------------------------------------------------------------------------------ subtype Unit_Kinds is Asis_Unit_Kinds.Unit_Kinds; subtype Unit_Classes is Asis_Unit_Kinds.Unit_Classes; subtype Unit_Origins is Asis_Unit_Kinds.Unit_Origins; subtype Relation_Kinds is Asis_Unit_Kinds.Relation_Kinds; subtype Element_Kinds is Asis_Element_Kinds.Element_Kinds; subtype Pragma_Kinds is Asis_Element_Kinds.Pragma_Kinds; subtype Defining_Name_Kinds is Asis_Element_Kinds.Defining_Name_Kinds; subtype Operator_Kinds is Asis_Element_Kinds.Operator_Kinds; subtype Declaration_Kinds is Asis_Element_Kinds.Declaration_Kinds; subtype Declaration_Origins is Asis_Element_Kinds.Declaration_Origins; subtype Mode_Kinds is Asis_Element_Kinds.Mode_Kinds; subtype Default_Kinds is Asis_Element_Kinds.Default_Kinds; subtype Definition_Kinds is Asis_Element_Kinds.Definition_Kinds; subtype Trait_Kinds is Asis_Element_Kinds.Trait_Kinds; subtype Type_Kinds is Asis_Element_Kinds.Type_Kinds; subtype Formal_Type_Kinds is Asis_Element_Kinds.Formal_Type_Kinds; subtype Access_Type_Kinds is Asis_Element_Kinds.Access_Type_Kinds; subtype Root_Type_Kinds is Asis_Element_Kinds.Root_Type_Kinds; subtype Constraint_Kinds is Asis_Element_Kinds.Constraint_Kinds; subtype Discrete_Range_Kinds is Asis_Element_Kinds.Discrete_Range_Kinds; subtype Expression_Kinds is Asis_Element_Kinds.Expression_Kinds; subtype Attribute_Kinds is Asis_Element_Kinds.Attribute_Kinds; subtype Association_Kinds is Asis_Element_Kinds.Association_Kinds; subtype Statement_Kinds is Asis_Element_Kinds.Statement_Kinds; subtype Path_Kinds is Asis_Element_Kinds.Path_Kinds; subtype Clause_Kinds is Asis_Element_Kinds.Clause_Kinds; subtype Representation_Clause_Kinds is Asis_Element_Kinds.Representation_Clause_Kinds; package Errors renames Asis_Errors; package Numerics renames Asis_Type_Primitives.Numerics; package Times renames Asis_Type_Primitives.Times; subtype Asis_Integer is Numerics.Asis_Integer; subtype Asis_Natural is Numerics.Asis_Natural; subtype Asis_Positive is Numerics.Asis_Positive; subtype List_Index is Numerics.List_Index; subtype Asis_Character is Asis_Type_Primitives.Asis_Character; subtype Asis_String is Asis_Type_Primitives.Asis_String; Nil_Asis_String : Asis_String renames Asis_Type_Primitives.Nil_Asis_String; subtype Asis_Time is Times.Asis_Time; Nil_Asis_Time : Asis_Time renames Times.Nil_Asis_Time; package Compilation_Units is ------------------------------------------------------------------------------ -- Compilation_Unit must be an undiscriminated private type, or, must be -- derived from an undiscriminated private type. It may be declared as a new -- type or as a subtype of an existing type. ------------------------------------------------------------------------------ -- These types may be declared literally as shown: type Compilation_Unit is private; Nil_Compilation_Unit : constant Compilation_Unit; type Compilation_Unit_List is array (List_Index range <>) of Compilation_Unit; -- -- Or, they may be renamed into their ASIS context using declarations -- -- of the following forms: -- -- subtype Compilation_Unit is Vendor.Unit_Id; -- -- Nil_Compilation_Unit : Compilation_Unit -- renames Vendor.Nil_Unit_Id; -- -- subtype Compilation_Unit_List is Vendor.Unit_Id_List; -- -- function "&" (Left : in Compilation_Unit_List; -- Right : in Compilation_Unit_List) -- return Compilation_Unit_List -- renames Vendor."&"; -- -- function "&" (Left : in Compilation_Unit_List; -- Right : in Compilation_Unit) -- return Compilation_Unit_List -- renames Vendor."&"; -- -- function "&" (Left : in Compilation_Unit; -- Right : in Compilation_Unit_List) -- return Compilation_Unit_List -- renames Vendor."&"; -- -- function "&" (Left : in Compilation_Unit; -- Right : in Compilation_Unit) -- return Compilation_Unit_List -- renames Vendor."&"; type Relationship (Consistent_Length : Asis_Natural; Inconsistent_Length : Asis_Natural; Missing_Length : Asis_Natural; Circular_Length : Asis_Natural) is record Consistent : Compilation_Unit_List (1 .. Consistent_Length); Inconsistent : Compilation_Unit_List (1 .. Inconsistent_Length); Missing : Compilation_Unit_List (1 .. Missing_Length); Circular : Compilation_Unit_List (1 .. Circular_Length); end record; function Nil_Relationship return Relationship; private type Compilation_Unit is new Asis_Type_Primitives.Vendor.Unit_Id; Nil_Compilation_Unit : constant Compilation_Unit := Compilation_Unit (Asis_Type_Primitives.Vendor.Nil_Unit_Id); end Compilation_Units; subtype Compilation_Unit is Compilation_Units.Compilation_Unit; subtype Compilation_Unit_List is Compilation_Units.Compilation_Unit_List; subtype Relationship is Compilation_Units.Relationship; Nil_Compilation_Unit : Compilation_Unit renames Compilation_Units.Nil_Compilation_Unit; Nil_Compilation_Unit_List : constant Compilation_Unit_List (1 .. 0) := (1 .. 0 => Nil_Compilation_Unit); Nil_Relationship : constant Relationship := Compilation_Units.Nil_Relationship; package Elements is ------------------------------------------------------------------------------ -- ASIS Elements are representations of the syntactic and semantic information -- available from most Ada environments. -- -- The ASIS Element type must be an undiscriminated private type, or, must be -- derived from an undiscriminated private type. It may be declared as a new -- type or as a subtype of an existing type. ------------------------------------------------------------------------------ -- These types may be declared literally as shown: type Element is private; Nil_Element : constant Element; type Element_List is array (List_Index range <>) of Element; -- -- Or, they may be renamed into their ASIS context using declarations -- -- of the following forms: -- -- subtype Element is Asis_Type_Primitives.Vendor.Element_Id; -- -- Nil_Element : Element renames -- Asis_Type_Primitives.Vendor.Nil_Element_Id; -- -- subtype Element_List is Asis_Type_Primitives.Vendor.Element_Id_List; -- -- function "&" (Left : in Element_List; -- Right : in Element_List) return Element_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Element_List; -- Right : in Element) return Element_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Element; -- Right : in Element_List) return Element_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Element; -- Right : in Element) return Element_List -- renames Asis_Type_Primitives.Vendor."&"; private type Element is new Asis_Type_Primitives.Vendor.Element_Id; Nil_Element : constant Element := Element (Asis_Type_Primitives.Vendor.Nil_Element_Id); end Elements; subtype Element is Elements.Element; subtype Element_List is Elements.Element_List; Nil_Element : Element renames Elements.Nil_Element; Nil_Element_List : constant Element_List (1 .. 0) := (1 .. 0 => Nil_Element); subtype Access_Type_Definition is Element; subtype Association is Element; subtype Association_List is Element_List; subtype Case_Statement_Alternative is Element; subtype Clause is Element; subtype Component_Clause is Element; subtype Component_Clause_List is Element_List; subtype Component_Declaration is Element; subtype Component_Definition is Element; subtype Constraint is Element; subtype Context_Clause is Element; subtype Context_Clause_List is Element_List; subtype Declaration is Element; subtype Declaration_List is Element_List; subtype Declarative_Item_List is Element_List; subtype Definition is Element; subtype Definition_List is Element_List; subtype Discrete_Range is Element; subtype Discrete_Range_List is Element_List; subtype Discrete_Subtype_Definition is Element; subtype Discriminant_Association is Element; subtype Discriminant_Association_List is Element_List; subtype Discriminant_Specification_List is Element_List; subtype Defining_Name is Element; subtype Defining_Name_List is Element_List; subtype Exception_Handler is Element; subtype Exception_Handler_List is Element_List; subtype Expression is Element; subtype Expression_List is Element_List; subtype Formal_Type_Definition is Element; subtype Generic_Formal_Parameter is Element; subtype Generic_Formal_Parameter_List is Element_List; subtype Identifier is Element; subtype Identifier_List is Element_List; subtype Name is Element; subtype Name_List is Element_List; subtype Parameter_Specification is Element; subtype Parameter_Specification_List is Element_List; subtype Path is Element; subtype Path_List is Element_List; subtype Pragma_Element is Element; subtype Pragma_Element_List is Element_List; subtype Range_Constraint is Element; subtype Record_Component is Element; subtype Record_Component_List is Element_List; subtype Record_Definition is Element; subtype Representation_Clause is Element; subtype Representation_Clause_List is Element_List; subtype Root_Type_Definition is Element; subtype Select_Alternative is Element; subtype Statement is Element; subtype Statement_List is Element_List; subtype Subtype_Indication is Element; subtype Subtype_Mark is Element; subtype Type_Definition is Element; subtype Variant is Element; subtype Variant_Component_List is Element_List; subtype Variant_List is Element_List; package Ids is ------------------------------------------------------------------------------ -- ASIS Ids are a means of identifying particular Element values obtained from -- a particular physical compilation unit. Ids are "relative names". Each Id -- value is valid (is usable, makes sense, can be interpreted) only in the -- context of an appropriate open ASIS Context. -- -- Id must be an undiscriminated private type, or, must be derived from an -- undiscriminated private type. It may be declared as a new type or as a -- subtype of an existing type. ------------------------------------------------------------------------------ -- These types may be declared literally as shown: type Id is private; type Id_Segment is private; Nil_Id : constant Id; Nil_Id_Segment : constant Id_Segment; type Id_List is array (List_Index range <>) of Id; type Id_Segment_List is array (List_Index range <>) of Id_Segment; function Hash (Id : in Ids.Id_Segment) return Asis_Integer; function Hash (Id : in Ids.Id_Segment_List) return Asis_Integer; function Hash (Id : in Ids.Id) return Asis_Integer; function "<" (Left : in Id; Right : in Id) return Boolean; function ">" (Left : in Id; Right : in Id) return Boolean; function "<" (Left : in Id_List; Right : in Id_List) return Boolean; function ">" (Left : in Id_List; Right : in Id_List) return Boolean; function "<" (Left : in Id_Segment; Right : in Id_Segment) return Boolean; function ">" (Left : in Id_Segment; Right : in Id_Segment) return Boolean; function "<" (Left : in Id_Segment_List; Right : in Id_Segment_List) return Boolean; function ">" (Left : in Id_Segment_List; Right : in Id_Segment_List) return Boolean; -- -- Or, they may be renamed into their ASIS context using declarations -- -- of the following forms: -- -- subtype Id is Asis_Type_Primitives.Vendor.Id; -- -- Nil_Id : Id renames Asis_Type_Primitives.Vendor.Nil_Id; -- -- subtype Id_List is Asis_Type_Primitives.Vendor.Id_List; -- -- subtype Id_Segment is Asis_Type_Primitives.Vendor.Id_Segment; -- -- Nil_Id_Segment : Id_Segment -- renames Asis_Type_Primitives.Vendor.Nil_Id_Segment; -- -- subtype Id_Segment_List is Asis_Type_Primitives.Vendor.Id_Segment_List; -- -- function "=" (Left : in Id; -- Right : in Id) -- return Boolean -- renames Asis_Type_Primitives.Vendor."="; -- -- function "<" (Left : in Id; -- Right : in Id) -- return Boolean -- renames Asis_Type_Primitives.Vendor."<"; -- -- function ">" (Left : in Id; -- Right : in Id) -- return Boolean -- renames Asis_Type_Primitives.Vendor.">"; -- -- function "&" (Left : in Id_List; -- Right : in Id_List) -- return Id_List renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Id_List; -- Right : in Id) -- return Id_List renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Id; -- Right : in Id_List) return Id_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Id; -- Right : in Id) -- return Id_List renames Asis_Type_Primitives.Vendor."&"; -- -- function "=" (Left : in Id_List; -- Right : in Id_List) -- return Boolean -- renames Asis_Type_Primitives.Vendor."="; -- -- function "<" (Left : in Id_List; -- Right : in Id_List) -- return Boolean -- renames Asis_Type_Primitives.Vendor."<"; -- -- function ">" (Left : in Id_List; -- Right : in Id_List) -- return Boolean -- renames Asis_Type_Primitives.Vendor.">"; -- -- function "<" (Left : in Id_Segment; -- Right : in Id_Segment) return Boolean; -- renames Asis_Type_Primitives.Vendor."<"; -- -- function ">" (Left : in Id_Segment; -- Right : in Id_Segment) return Boolean; -- renames Asis_Type_Primitives.Vendor.">"; -- -- function "<" (Left : in Id_Segment_List; -- Right : in Id_Segment_List) return Boolean; -- renames Asis_Type_Primitives.Vendor."<"; -- -- function ">" (Left : in Id_Segment_List; -- Right : in Id_Segment_List) return Boolean; -- renames Asis_Type_Primitives.Vendor.">"; private type Id is new Asis_Type_Primitives.Vendor.Id; type Id_Segment is new Asis_Type_Primitives.Vendor.Id_Segment; Nil_Id : constant Id := Id (Asis_Type_Primitives.Vendor.Nil_Id); Nil_Id_Segment : constant Id_Segment := Id_Segment (Asis_Type_Primitives.Vendor.Nil_Id_Segment); end Ids; subtype Id is Ids.Id; subtype Id_List is Ids.Id_List; subtype Id_Segment is Ids.Id_Segment; subtype Id_Segment_List is Ids.Id_Segment_List; Nil_Id : Id renames Ids.Nil_Id; Nil_Id_Segment : Id_Segment renames Ids.Nil_Id_Segment; package Ada_Environments is ------------------------------------------------------------------------------ -- Context must be an undiscriminated limited private type, or, must be -- derived from an undiscriminated limited private type. It may be declared -- as a new type or as a subtype of an existing type. ------------------------------------------------------------------------------ -- These types may be declared literally as shown: type Context is limited private; type Container is private; Nil_Container : constant Container; type Container_List is array (List_Index range <>) of Container; -- -- Or, they may be renamed into their ASIS context using declarations -- -- of the following forms: -- -- subtype Context is Asis_Type_Primitives.Vendor.Context_Id; private type Context is new Asis_Type_Primitives.Vendor.Context_Id; type Container is new Asis_Type_Primitives.Vendor.Context_Id; Nil_Container : constant Container := Container(Asis_Type_Primitives.Vendor.Nil_Context_Id); end Ada_Environments; subtype Context is Ada_Environments.Context; subtype Container is Ada_Environments.Container; subtype Container_List is Ada_Environments.Container_List; Nil_Container : Ada_Environments.Container renames Ada_Environments.Nil_Container; Nil_Container_List : constant Ada_Environments.Container_List (1 .. 0) := (1 .. 0 => Nil_Container); package Lines is ------------------------------------------------------------------------------ -- ASIS Lines are representations of the compilation text. This text shall -- be supported by all ASIS implementations. -- -- Line must be an undiscriminated private type, or, must be derived from an -- undiscriminated private type. It may be declared as a new type or as a -- subtype of an existing type. ------------------------------------------------------------------------------ Maximum_Line_Number : constant Asis_Natural := Asis_Natural'Last; subtype Line_Number is Asis_Natural range 0 .. Maximum_Line_Number; subtype Line_Number_Positive is Line_Number range 1 .. Maximum_Line_Number; ------------------------------------------------------------------------------ -- Line_Number -- -- A numeric subtype that allows each ASIS implementation to place constraints -- on the upper bound for Line_Lists and compilation unit size. -- -- The actual upper bound of Line_Number (Maximum_Line_Number) is the only -- allowed variation for these declarations. -- -- Line_Number = 0 is reserved to act as an "invalid" Line_Number value. No -- unit text line will ever have a Line_Number of zero. ------------------------------------------------------------------------------ Maximum_Line_Length : constant Asis_Natural := Asis_Natural'Last; subtype Character_Position is Asis_Natural range 0 .. Maximum_Line_Length; subtype Character_Position_Positive is Character_Position range 1 .. Maximum_Line_Length; ------------------------------------------------------------------------------ -- Character_Position -- -- A numeric subtype that allows each ASIS implementation to place constraints -- on the upper bound for Character_Position and for compilation unit line -- lengths. -- -- The actual upper bound of Character_Position (Maximum_Line_Length) is the -- only allowed variation for these declarations. -- -- Character_Position = 0 is reserved to act as an "invalid" -- Character_Position value. No unit text line will ever have a character in -- position zero. ------------------------------------------------------------------------------ type Span is record First_Line : Line_Number_Positive := 1; -- 1..0 - empty First_Column : Character_Position_Positive := 1; -- 1..0 - empty Last_Line : Line_Number := 0; Last_Column : Character_Position := 0; end record; ------------------------------------------------------------------------------ -- Span -- -- A single text position is identified by a line number and a column number, -- that represent the text's position within the compilation unit. -- -- An implementation may choose to ignore (to not support) text character -- position values, in which case, the Is_Span_Column_Position_Supported -- function will return False. -- -- The text of an element may span one or more lines. The textual Span of an -- element identifies the lower and upper bound of a span of text positions. -- -- Spans and positions give client tools the option of accessing compilation -- unit text through the queries provided by this package, or, to access -- the text directly through the original compilation unit text file. -- -- Note: The original compilation unit text may or may not have existed in a -- "file", and any such file may or may not still exist. RM 95 10.1 specifies -- that the text of a compilation unit is submitted to a compiler. It does -- not specify that the text is stored in a "file", nor does it specify that -- the text of a compilation unit has any particular lifetime. ------------------------------------------------------------------------------ Nil_Span : constant Span := (First_Line => 1, First_Column => 1, Last_Line => 0, Last_Column => 0); -- These types may be declared literally as shown: type Line is private; Nil_Line : constant Line; type Line_List is array (Line_Number_Positive range <>) of Line; -- -- Or, they may be renamed into their ASIS context using declarations -- -- of the following forms: -- -- subtype Line is Asis_Type_Primitives.Vendor.Line_Id; -- -- Nil_Line : Line renames Asis_Type_Primitives.Vendor.Nil_Line_Id; -- -- subtype Line_List is Asis_Type_Primitives.Vendor.Line_Id_List; -- -- function "&" (Left : in Line_List; -- Right : in Line_List) -- return Line_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Line_List; -- Right : in Line) -- return Line_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Line; -- Right : in Line_List) -- return Line_List -- renames Asis_Type_Primitives.Vendor."&"; -- -- function "&" (Left : in Line; -- Right : in Line) -- return Line_List -- renames Asis_Type_Primitives.Vendor."&"; private type Line is new Asis_Type_Primitives.Vendor.Line_Id; Nil_Line : constant Line := Line (Asis_Type_Primitives.Vendor.Nil_Line_Id); end Lines; subtype Line is Lines.Line; subtype Line_List is Lines.Line_List; Nil_Line : Line renames Lines.Nil_Line; Nil_Line_List : constant Line_List (1 .. 0) := (others => Nil_Line); subtype Line_Number is Lines.Line_Number; subtype Line_Number_Positive is Lines.Line_Number_Positive; subtype Character_Position is Lines.Character_Position; subtype Character_Position_Positive is Lines.Character_Position_Positive; Maximum_Line_Number : Line_Number renames Lines.Maximum_Line_Number; Maximum_Line_Length : Character_Position renames Lines.Maximum_Line_Length; subtype Span is Lines.Span; Nil_Span : Span renames Lines.Nil_Span; end Asis_Vendor_Primitives; with Asis_Errors; with Asis_Element_Kinds; with Asis_Unit_Kinds; with Asis_Vendor_Primitives; ------------------------------------------------------------------------------ package Asis is ------------------------------------------------------------------------------ -- Asis -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- Encapsulates vendor-specific declarations, which are made available to ASIS -- and its client applications in a vendor-independent manner. -- -- Package ASIS is the root of the ASIS interface. -- ------------------------------------------------------------------------------ -- Abstract -- -- The Ada Semantic Interface Specification (ASIS) is an interface between an -- Ada environment as defined by ISO/IEC 8652:1995 (the Ada95 Reference Manual) -- and any tool requiring information from this environment. An Ada environment -- includes valuable semantic and syntactic information. ASIS is an open and -- published callable interface which gives CASE tool and application -- developers access to this information. ASIS has been designed to be -- independent of underlying Ada environment implementations, thus supporting -- portability of software engineering tools while relieving tool developers -- from having to understand the complexities of an Ada environment's -- proprietary internal representation. -- ------------------------------------------------------------------------------ -- The ASIS Subsystem -- -- The following packages make up the ASIS interface. Only these packages -- should be referenced (WITHed) by a portable application. Other packages, -- which may be present in a specific ASIS implementation, may or may not be -- present in other ASIS implementations. -- -- package Asis -- -- This is the root package of the ASIS interface. All other packages -- are logically nested packages or child packages. -- -- package Asis.Ada_Environments -- -- Defines operations for creating, opening, closing, and -- querying Context values. -- -- package Asis.Clauses -- -- Defines queries dealing with context_clauses and -- representation_clauses. -- -- package Asis.Compilation_Units -- -- Defines queries that deal with Compilation_Units and the gateway -- queries between Compilation_Units, Elements, and Contexts. -- -- package Asis.Data_Decomposition (Optional annex) -- -- Defines queries to decompose data values using the type information -- and a Portable_Data stream, representing an actual data values of -- that type. -- -- package Asis.Declarations -- -- Defines queries dealing with Ada declarations. -- -- package Asis.Definitions -- -- Defines queries dealing with the definition portion of Ada -- object, type, and subtype declarations. -- -- package Asis.Elements -- -- Defines general Element queries and queries for pragmas. -- -- package Asis.Element_Kinds (or Asis_Element_Kinds) -- -- Defines enumeration types describing the various kinds of elements. -- -- package Asis.Errors (or Asis_Errors) -- -- Defines the kinds of errors. -- -- package Asis.Exceptions (or Asis_Errors.Exceptions) -- -- Defines the exceptions used by the ASIS interface. -- -- package Asis.Expressions -- -- Defines all queries dealing with Ada expressions. -- -- package Asis.Ids (Optional annex) -- -- Defines of the queries dealing with ASIS Id values and conversions -- between Elements and Ids. -- -- package Asis.Implementation -- -- Provides initialization and finalization queries. -- -- package Asis.Implementation.Permissions -- -- Provides implementation options queries. -- -- package Asis.Statements -- -- Defines queries dealing with Ada statements. -- -- package Asis.Text -- -- Defines the operations for obtaining compilation text spans, lines, -- and images of elements. -- -- package Asis.Unit_Kinds (or, Asis_Unit_Kinds) -- -- Defines enumeration types describing the kinds of compilation units. -- ------------------------------------------------------------------------------ -- Simple numeric and string types used by the ASIS interface. ------------------------------------------------------------------------------ package Numerics renames Asis_Vendor_Primitives.Numerics; subtype Asis_Integer is Asis_Vendor_Primitives.Numerics.Asis_Integer; subtype Asis_Natural is Asis_Vendor_Primitives.Numerics.Asis_Natural; subtype Asis_Positive is Asis_Vendor_Primitives.Numerics.Asis_Positive; subtype List_Index is Asis_Vendor_Primitives.Numerics.List_Index; subtype Asis_Character is Asis_Vendor_Primitives.Asis_Character; subtype Asis_String is Asis_Vendor_Primitives.Asis_String; Nil_Asis_String : Asis_String renames Asis_Vendor_Primitives.Nil_Asis_String; ------------------------------------------------------------------------------ -- Type used to express ASIS time and duration values. ------------------------------------------------------------------------------ package Times renames Asis_Vendor_Primitives.Times; subtype Asis_Time is Asis_Vendor_Primitives.Times.Asis_Time; Nil_Asis_Time : Asis_Time renames Asis_Vendor_Primitives.Times.Nil_Asis_Time; ------------------------------------------------------------------------------ -- The Ada Environment Context abstraction (a limited private type). -- -- The ASIS Context is a view of a particular implementation of an Ada -- environment. ASIS requires an application to identify that view of -- the Ada environment. An ASIS CONTEXT identifies an Ada environment -- as defined by ISO/IEC 8652:1995. The Ada environment is well -- defined for Ada implementations. ISO/IEC 8652:1995 provides for an -- implementation defined method to enter compilation units into the -- Ada environment. Implementation permissions allow for illegal and -- inconsistent units to be in the environment. The use of ASIS may -- result in the exception Asis_Failed being raised if the Ada -- environment includes such units. -- -- Defined by the implementation, an ASIS context is a way to identify -- a set of COMPILATION UNITs to be processed by an ASIS application. -- This may include things such as the pathname, search rules, etc., -- which would be attributes of the Ada environment and consequently -- would become part of the ASIS CONTEXT only because it is a "view" of -- the Ada environment. -- -- Because the contents of the Ada environment are (Ada-)implementation -- defined, the ASIS context may contain illegal compilation units. -- An ASIS CONTEXT is a handle to a set of COMPILATION UNITs accessible -- by an ASIS application. The set of COMPILATION UNITSs available -- from an ASIS context may be inconsistent, and may contain illegal -- COMPILATION UNITs. The contents are selected from the Ada -- environment as defined by the corresponding Ada Implementation. -- ASIS should allow multiple open contexts. -- -- In the Context abstraction, a logical handle is associated with Name and -- Parameters values that are used by the implementation to identify and -- connect to the information in the Ada environment. -- -- Some implementations may not need explicit Name and/or Parameters values to -- identify their Ada environment. Other implementations may choose to -- implement the Ada environement as a single external file in which case the -- name and parameters values may simply supply the Name, Form, and any other -- values needed to open such a file. ------------------------------------------------------------------------------ subtype Context is Asis_Vendor_Primitives.Context; ------------------------------------------------------------------------------ -- The Container abstraction (a private type). -- -- A logical collection of COMPILATION UNITs. For example, one container -- may hold COMPILATION UNITs which include Ada predefined library units, -- another container may hold implementation defined packages. -- Alternatively, there may be 26 containers, each holding COMPILATION UNITs -- that begin with their respective letter of the alphabet. The point is -- that no vendor-independent semantics are associated with a container; -- it is simply a logical collection. -- ------------------------------------------------------------------------------ subtype Container is Asis_Vendor_Primitives.Container; subtype Container_List is Asis_Vendor_Primitives.Container_List; Nil_Container : Container renames Asis_Vendor_Primitives.Nil_Container; Nil_Container_List : Container_List renames Asis_Vendor_Primitives.Nil_Container_List; ------------------------------------------------------------------------------ -- The Ada Compilation Unit abstraction (a private type). -- -- The text of a program is submitted to the compiler in one or more -- compilations. Each compilation is a succession of compilation units. -- -- Compilation units are composed of three distinct parts: -- 1) A context clause. -- 2) The declaration of a library_item or unit. -- 3) Pragmas that apply to the compilation, of which the unit is a -- part. -- -- The context clause contains zero or more with clauses, use clauses, -- pragma ELABORATEs, and possibly other pragmas. -- -- ASIS treats Pragmas that appear immediately after the context clause -- and before the subsequent declaration part as belonging to the context -- clause part. -- -- The declaration associated with a compilation unit will be one of: a -- package, a procedure, a function, a generic, or a subunit for normal units. -- The associated declaration will be a Nil_Element for An_Unknown_Unit and -- Nonexistent units. -- -- The abstract type Compilation_Unit is a handle for compilation units as a -- whole. An object of the type Compilation_Unit deals with the external view -- of compilation units such as their relationships with other units or their -- compilation attributes. ------------------------------------------------------------------------------ subtype Compilation_Unit is Asis_Vendor_Primitives.Compilation_Unit; subtype Compilation_Unit_List is Asis_Vendor_Primitives. Compilation_Unit_List; subtype Relationship is Asis_Vendor_Primitives.Relationship; Nil_Compilation_Unit : Compilation_Unit renames Asis_Vendor_Primitives.Nil_Compilation_Unit; Nil_Compilation_Unit_List : Compilation_Unit_List renames Asis_Vendor_Primitives.Nil_Compilation_Unit_List; Nil_Relationship : Relationship renames Asis_Vendor_Primitives.Nil_Relationship; subtype Unit_Kinds is Asis_Unit_Kinds.Unit_Kinds; subtype Unit_Classes is Asis_Unit_Kinds.Unit_Classes; subtype Unit_Origins is Asis_Unit_Kinds.Unit_Origins; subtype Relation_Kinds is Asis_Unit_Kinds.Relation_Kinds; ------------------------------------------------------------------------------ -- The Ada program element abstraction (a private type). -- -- The Element type is a distinct abstract type representing handles for the -- lexical elements that form the text of compilation units. Elements deal -- with the internal or "textual" view of compilation units. -- -- Operations are provided that split a Compilation_Unit object into its three -- component Elements: -- 1) A context clause represented by an Element_List containing -- WITH clauses, USE clauses, and pragmas. -- 2) An Element associated with the declaration. -- 3) A list of pragmas, that are not part of the context clause but which -- nonetheless affect the compilation of the unit. -- ------------------------------------------------------------------------------ subtype Element is Asis_Vendor_Primitives.Element; subtype Element_List is Asis_Vendor_Primitives.Element_List; Nil_Element : Element renames Asis_Vendor_Primitives.Nil_Element; Nil_Element_List : constant Element_List (1 .. 0) := (1 .. 0 => Nil_Element); ------------------------------------------------------------------------------ -- Subtypes of Element and Element_List ------------------------------------------------------------------------------ subtype Access_Type_Definition is Element; subtype Association is Element; subtype Association_List is Element_List; subtype Case_Statement_Alternative is Element; subtype Clause is Element; subtype Component_Clause is Element; subtype Component_Clause_List is Element_List; subtype Component_Declaration is Element; subtype Component_Definition is Element; subtype Constraint is Element; subtype Context_Clause is Element; subtype Context_Clause_List is Element_List; subtype Declaration is Element; subtype Declaration_List is Element_List; subtype Declarative_Item_List is Element_List; subtype Definition is Element; subtype Definition_List is Element_List; subtype Discrete_Range is Element; subtype Discrete_Range_List is Element_List; subtype Discrete_Subtype_Definition is Element; subtype Discriminant_Association is Element; subtype Discriminant_Association_List is Element_List; subtype Discriminant_Specification_List is Element_List; subtype Defining_Name is Element; subtype Defining_Name_List is Element_List; subtype Exception_Handler is Element; subtype Exception_Handler_List is Element_List; subtype Expression is Element; subtype Expression_List is Element_List; subtype Formal_Type_Definition is Element; subtype Generic_Formal_Parameter is Element; subtype Generic_Formal_Parameter_List is Element_List; subtype Identifier is Element; subtype Identifier_List is Element_List; subtype Name is Element; subtype Name_List is Element_List; subtype Parameter_Specification is Element; subtype Parameter_Specification_List is Element_List; subtype Path is Element; subtype Path_List is Element_List; subtype Pragma_Element is Element; subtype Pragma_Element_List is Element_List; subtype Range_Constraint is Element; subtype Record_Component is Element; subtype Record_Component_List is Element_List; subtype Record_Definition is Element; subtype Representation_Clause is Element; subtype Representation_Clause_List is Element_List; subtype Root_Type_Definition is Element; subtype Select_Alternative is Element; subtype Statement is Element; subtype Statement_List is Element_List; subtype Subtype_Indication is Element; subtype Subtype_Mark is Element; subtype Type_Definition is Element; subtype Variant is Element; subtype Variant_Component_List is Element_List; subtype Variant_List is Element_List; ------------------------------------------------------------------------------ -- Enumeration types describing the various kinds of elements. ------------------------------------------------------------------------------ subtype Element_Kinds is Asis_Element_Kinds.Element_Kinds; subtype Pragma_Kinds is Asis_Element_Kinds.Pragma_Kinds; subtype Defining_Name_Kinds is Asis_Element_Kinds.Defining_Name_Kinds; subtype Declaration_Kinds is Asis_Element_Kinds.Declaration_Kinds; subtype Trait_Kinds is Asis_Element_Kinds.Trait_Kinds; subtype Declaration_Origins is Asis_Element_Kinds.Declaration_Origins; subtype Mode_Kinds is Asis_Element_Kinds.Mode_Kinds; subtype Default_Kinds is Asis_Element_Kinds.Default_Kinds; subtype Definition_Kinds is Asis_Element_Kinds.Definition_Kinds; subtype Type_Kinds is Asis_Element_Kinds.Type_Kinds; subtype Formal_Type_Kinds is Asis_Element_Kinds.Formal_Type_Kinds; subtype Access_Type_Kinds is Asis_Element_Kinds.Access_Type_Kinds; subtype Root_Type_Kinds is Asis_Element_Kinds.Root_Type_Kinds; subtype Constraint_Kinds is Asis_Element_Kinds.Constraint_Kinds; subtype Discrete_Range_Kinds is Asis_Element_Kinds.Discrete_Range_Kinds; subtype Expression_Kinds is Asis_Element_Kinds.Expression_Kinds; subtype Operator_Kinds is Asis_Element_Kinds.Operator_Kinds; subtype Attribute_Kinds is Asis_Element_Kinds.Attribute_Kinds; subtype Association_Kinds is Asis_Element_Kinds.Association_Kinds; subtype Statement_Kinds is Asis_Element_Kinds.Statement_Kinds; subtype Path_Kinds is Asis_Element_Kinds.Path_Kinds; subtype Clause_Kinds is Asis_Element_Kinds.Clause_Kinds; subtype Representation_Clause_Kinds is Asis_Element_Kinds.Representation_Clause_Kinds; ------------------------------------------------------------------------------ -- The Ada element Id abstraction (a private type). -- -- The Id type is a distinct abstract type representing permanent "names" -- that correspond to specific Element values. -- -- These names may be written to files, retrieved at a later time, and -- converted to Element values. ------------------------------------------------------------------------------ subtype Id is Asis_Vendor_Primitives.Id; subtype Id_List is Asis_Vendor_Primitives.Id_List; subtype Id_Segment is Asis_Vendor_Primitives.Id_Segment; subtype Id_Segment_List is Asis_Vendor_Primitives.Id_Segment_List; Nil_Id : Id renames Asis_Vendor_Primitives.Nil_Id; Nil_Id_Segment : Id_Segment renames Asis_Vendor_Primitives.Nil_Id_Segment; ------------------------------------------------------------------------------ -- An Ada text line abstraction (a private type). -- -- Used to represent text fragments from a compilation. ------------------------------------------------------------------------------ subtype Line is Asis_Vendor_Primitives.Line; subtype Line_List is Asis_Vendor_Primitives.Line_List; Nil_Line : Line renames Asis_Vendor_Primitives.Nil_Line; Nil_Line_List : Line_List renames Asis_Vendor_Primitives.Nil_Line_List; subtype Line_Number is Asis_Vendor_Primitives. Line_Number; subtype Line_Number_Positive is Asis_Vendor_Primitives. Line_Number_Positive; subtype Character_Position is Asis_Vendor_Primitives. Character_Position; subtype Character_Position_Positive is Asis_Vendor_Primitives. Character_Position_Positive; Maximum_Line_Number : Line_Number renames Asis_Vendor_Primitives.Maximum_Line_Number; Maximum_Line_Length : Character_Position renames Asis_Vendor_Primitives.Maximum_Line_Length; subtype Span is Asis_Vendor_Primitives.Span; Nil_Span : Span renames Asis_Vendor_Primitives.Nil_Span; ------------------------------------------------------------------------------ -- Errors and Exceptions -- -- The Diagnosis and Status queries are provided in the Asis.Implementation -- package to supply more information about the reasons for raising any -- exception. ------------------------------------------------------------------------------ package Errors renames Asis_Errors; package Exceptions renames Asis_Errors.Exceptions; Asis_Inappropriate_Context : exception renames Exceptions.Asis_Inappropriate_Context; Asis_Inappropriate_Container : exception renames Exceptions.Asis_Inappropriate_Container; Asis_Inappropriate_Compilation_Unit : exception renames Exceptions.Asis_Inappropriate_Compilation_Unit; Asis_Inappropriate_Element : exception renames Exceptions.Asis_Inappropriate_Element; Asis_Inappropriate_Line : exception renames Exceptions.Asis_Inappropriate_Line; Asis_Inappropriate_Line_Number : exception renames Exceptions.Asis_Inappropriate_Line_Number; Asis_Failed : exception renames Exceptions.Asis_Failed; ------------------------------------------------------------------------------ -- An ASIS application should follow these steps (possibly in a loop): -- -- 1) Asis.Implementation.Initialize; -- Initialize the ASIS interface -- 2) Asis.Ada_Environments.Associate(..); -- Name an Ada Environment -- 3) Asis.Ada_Environments.Open(..); -- Access an Ada Environment -- 4) Use the various Asis queries. -- Fetch a unit, its attributes, -- -- get its Unit_Declaration element, -- -- traverse its elements, etc -- 5) Asis.Ada_Environments.Close(..); -- Drop access to an Ada Environment -- 6) Asis.Ada_Environments.Dissociate(..);-- Release the Ada Environment name -- 7) Asis.Implementation.Finalize; -- Release all resources -- -- More than one element may be manipulated at one time. (The exact number -- is subject to vendor/target specific limitations. See your vendor's -- documentation.) An element, obtained from a compilation unit can continue -- to be manipulated even after the compilation unit value has been discarded -- or forgotten. An element is only valid while the Context, from which the -- element's compilation unit was obtained, remains open. -- -- An ASIS application is erroneous if: -- -- 1) It uses any ASIS query, other than those exported by -- Asis.Environment, while Asis.Environment.Is_Initialized = False. -- 2) It attempts to use a Context before opening it (exceptions to this -- are Asis.Ada_Environments: Associate, Dissociate, and the Context query -- functions). -- 3) It attempts to use a Context after closing it (exceptions to this -- are Asis.Ada_Environments: Associate, Dissociate, and the Context query -- functions). -- 4) It attempts to Dissociate or Associate an open Context. -- 5) It attempts to manipulate a Compilation_Unit whose Context has been -- closed. -- 6) It attempts to obtain Compilation_Unit information from an unopened -- Context. -- 7) It attempts to manipulate an Element from a Closed Context. -- -- General Usage Rules: -- -- All queries returning list values will always return lists with a -- 'First of one (1). -- -- All queries with a Context parameter of mode IN raise -- Asis_Inappropriate_Context the Context value is not open. The Status -- will be set to Value_Error. -- -- All queries with an Element or Line parameter attempt to detect the use -- of invalid values and raise Asis_Inappropriate_Element in response. The -- Status will be set to Value_Error. (An invalid value is one where the -- associated Context variable has been closed.) Not all ASIS implementations -- will be able to detect the use of invalid values. An application that -- depends upon the success/failure of this invalid value detection will not -- be portable. -- -- All queries other than simple boolean or enumeration value queries, raise -- Asis_Inappropriate_Element if passed an Element that is not appropriate to -- the query. The commentary for each query will indicate the appropriate -- element kinds. -- -- It is generally inappropriate to mix elements of distinct subtypes. eg. -- Passing a statement to a query expecting a declaration is inappropriate. -- It is also inappropriate to mix kinds of elements within a subtype when a -- query is expecting a specific kind. eg. Passing a type declaration to -- a query expecting a procedure declaration is inappropriate. -- -- Any query may raise Asis_Failed with a Status of Obsolete_Reference_Error -- if the argument or result is itself, or is part of, an inconsistent -- compilation unit. -- -- Any ASIS_Text query may raise Asis_Failed with a Status of Text_Error if -- the program text cannot be located or retrieved for any reason such as -- renaming, deletion, corruption, or moving of the text or Ada environment. -- ------------------------------------------------------------------------------ end Asis; --|95------------------------------------------------------------------------- --|95 package Asis_Implementation is new replacing Asis_Environment. ------------------------------------------------------------------------------ package Asis.Implementation is ------------------------------------------------------------------------------ -- Asis.Implementation -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package provides queries to initialize, finalize, and query the -- error status of the ASIS Implementation. -- ------------------------------------------------------------------------------ function Asis_Version return Asis.Asis_String; function Asis_Vendor return Asis.Asis_String; function Asis_Vendor_Version return Asis.Asis_String; function Asis_Vendor_Information return Asis.Asis_String; ------------------------------------------------------------------------------ -- Returns Asis_String values which identify: -- -- Asis_Version - the version of the ASIS interface, eg. "1.2" -- Asis_Vendor - the name of the vendor, eg. "Ada Inc." -- Asis_Vendor_Version - the vendor's implementation version, eg. "5.2a" -- Asis_Vendor_Information - vendor information, eg. "Copyright ..." -- ------------------------------------------------------------------------------ function Is_Initialized return Boolean; ------------------------------------------------------------------------------ -- Returns True if ASIS is currently initialized. -- ------------------------------------------------------------------------------ procedure Initialize (Parameters : in Asis.Asis_String := Asis.Nil_Asis_String); ------------------------------------------------------------------------------ -- Parameters - Specifies vendor specific parameters. -- -- Performs any necessary initialization activities. This must be invoked -- at least once before any other ASIS services are used. Parameter values -- are vendor dependent. The call is ignored if ASIS is already initialized. -- All ASIS queries and services are ready for use once this call completes. -- -- Raises Asis_Failed if ASIS failed to initialize or if the Parameters -- argument is invalid. Status will be Environment_Error or Parameter_Error. -- --|AN Application Note: --|AN --|AN The ASIS implementation may be Initialized and Finalized any number of --|AN times during the operation of an ASIS program. However, all existing --|AN Environment, Compilation_Unit and Element values become invalid when --|AN ASIS Is_Finalized. Subsequent calls to ASIS queries or services using --|AN such invalid Compilation_Unit or Element values are erroneous. --|AN ------------------------------------------------------------------------------ function Is_Finalized return Boolean; ------------------------------------------------------------------------------ -- Returns True if ASIS is currently finalized or if ASIS has never been -- initialized. -- ------------------------------------------------------------------------------ procedure Finalize (Parameters : in Asis.Asis_String := Asis.Nil_Asis_String); ------------------------------------------------------------------------------ -- Parameters - Specifies any implementation required parameter values. -- -- Performs any necessary ASIS termination activities. This should be invoked -- once following the last use of other ASIS queries. Parameter values are -- vendor dependent. The call is ignored if ASIS is already finalized. -- Subsequent calls to ASIS Environment, Compilation_Unit, and Element queries, -- are erroneous while the environment Is_Finalized. -- -- Raises Asis_Failed if the ASIS implementation failed to finalize. Status -- is likely to be Internal_Error and will not be Not_An_Error. -- ------------------------------------------------------------------------------ -- Whenever an error condition is detected, and any ASIS exception is raised, -- an Asis.Errors.Error_Kinds value and a Diagnosis string is stored. These -- values can be retrieved by the Status and Diagnosis functions. The -- Diagnosis function will retrieve the diagnostic message describing the -- error. -- -- Error information always refers to the most recently recorded error. -- -- Note that Diagnosis values are vendor dependent and may vary greatly among -- ASIS implementations. -- ------------------------------------------------------------------------------ function Status return Asis.Errors.Error_Kinds; ------------------------------------------------------------------------------ -- Returns the Error_Kinds value for the most recent error. -- ------------------------------------------------------------------------------ function Diagnosis return Asis.Asis_String; ------------------------------------------------------------------------------ -- Returns an Asis_String value describing the most recent error. -- -- Will typically return a Nil_Asis_String if Status = Not_An_Error. -- ------------------------------------------------------------------------------ procedure Set_Status (Status : Asis.Errors.Error_Kinds := Asis.Errors.Not_An_Error; Diagnosis : Asis.Asis_String := Asis.Nil_Asis_String); ------------------------------------------------------------------------------ -- Status - Specifies the new status to be recorded -- Diagnosis - Specifies the new diagnosis to be recorded -- -- Sets (clears, if the defaults are used) the Status and Diagnosis -- information. Future calls to Status will return this Status (Not_An_Error) -- and this Diagnosis (Nil_Asis_String). -- -- Raises Asis_Failed, with a Status of Internal_Error and a Diagnosis of -- Nil_Asis_String, if the Status parameter is Not_An_Error and the Diagnosis -- parameter is not the Nil_Asis_String. -- end Asis.Implementation; --|95------------------------------------------------------------------------- --|95 package ASIS_Implementation_Permissions is new. ------------------------------------------------------------------------------ package ASIS.Implementation.Permissions is --|OP------------------------------------------------------------------------- --|OP Need query to determine if multiple object declarations are normalized --|OP to an equivalent sequence of single declarations. ------------------------------------------------------------------------------ function Is_Formal_Parameter_Named_Notation_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if it is possible to detect usage of named notation. -- -- Returns False if this implementation will always change parameter lists -- using named notation to positional lists in function, subprogram, and -- entry calls. In that case, the Formal_Parameter query will always return -- a Nil_Element unless the parameter list is obtained with Normalized = True. -- -- This function affects association lists for aggregates, instantiations, -- discriminant lists, entry calls, and subprogram calls. -- ------------------------------------------------------------------------------ function Default_In_Mode_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if the A_Default_In_Mode kind is supported by this -- implementation. -- --|95------------------------------------------------------------------------- --|95 function Generic_Parameters_Include_Defaults was deleted. Reason --|95 REDUNDANT. An implementation that includes defaults must always return --|95 normalized association lists. The query Generic_Actual_Part_Normalized --|95 provides this determination. --|95------------------------------------------------------------------------- --|95 function Generic_Actual_Part_Normalized was called --|95 Generic_Parameters_Normalized. ------------------------------------------------------------------------------ function Generic_Actual_Part_Normalized return Boolean; ------------------------------------------------------------------------------ -- Returns True if the query Generic_Actual_Part will always return artificial -- Is_Normalized associations using defining_identifiers instead of -- generic_formal_parameter_selector_names, and using default_expressions or -- default_names. -- -- if Generic_Actual_Part_Normalized then the query Generic_Actual_Part will -- always behave as if called with Normalized => True. --|95------------------------------------------------------------------------- --|95 function Record_Component_Associations_Normalized was called --|95 Components_Normalized. ------------------------------------------------------------------------------ function Record_Component_Associations_Normalized return Boolean; ------------------------------------------------------------------------------ -- Returns True if the query Record_Component_Associations will always return -- artificial Is_Normalized associations using defining_identifiers instead of -- component_selector_names. -- -- if Record_Component_Associations_Normalized then the query -- Record_Component_Associations will always behave as if called with -- Normalized => True. -- ------------------------------------------------------------------------------ function Is_Prefix_Call_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if the ASIS implementation has the ability to determine -- whether calls are in prefix form. -- --|95------------------------------------------------------------------------- --|95 function Function_Call_Parameters_Include_Defaults was deleted. Reason --|95 REDUNDANT. An implementation that includes defaults must always return --|95 normalized association lists. The query --|95 Function_Call_Parameters_Normalized provides this determination. ------------------------------------------------------------------------------ function Function_Call_Parameters_Normalized return Boolean; ------------------------------------------------------------------------------ -- Returns True if the query Function_Call_Parameters will always return -- artificial Is_Normalized associations using defining_identifiers instead of -- formal_parameter_selector_names, and using default_expressions. -- -- if Function_Call_Parameters_Normalized then the query -- Function_Call_Parameters will always behave as if called with -- Normalized => True. -- --|95------------------------------------------------------------------------- --|95 function Call_Parameters_Include_Defaults was deleted. Reason --|95 REDUNDANT. An implementation that includes defaults must always return --|95 normalized association lists. The query --|95 Call_Statement_Parameters_Normalized provides this determination. --|95------------------------------------------------------------------------- --|95 function Call_Statement_Parameters_Normalized was called --|95 Call_Parameters_Normalized. ------------------------------------------------------------------------------ function Call_Statement_Parameters_Normalized return Boolean; ------------------------------------------------------------------------------ -- Returns True if the query Call_Statement_Parameters will always return -- artificial Is_Normalized associations using defining_identifiers instead of -- formal_parameter_selector_names, and using default_expressions. -- -- if Call_Statement_Parameters_Normalized then the query -- Call_Statement_Parameters will always behave as if called with -- Normalized => True. -- --|95------------------------------------------------------------------------- --|95 function Discriminant_Associations_Include_Defaults was deleted. Reason --|95 OBSOLETE. It is not possible to obtain either a normalized or --|95 unnormalized discriminant_association list for an unconstrained record --|95 or derived subtype_indication where the discriminant_associations are --|95 supplied by default; there is no constraint to query, and a Nil_Element --|95 is returned from the query Subtype_Constraint. ------------------------------------------------------------------------------ function Discriminant_Associations_Normalized return Boolean; ------------------------------------------------------------------------------ -- Returns True if the query Discriminant_Associations will always return -- artificial Is_Normalized associations using defining_identifiers instead of -- discriminant_selector_names. -- -- if Discriminant_Associations_Normalized then the query -- Discriminant_Associations will always behave as if called with -- Normalized => True. -- ------------------------------------------------------------------------------ function Is_Line_Number_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if the implementation can return valid line numbers for -- Elements. -- -- An implementation may choose to ignore line number values in which case -- this function returns False. -- ------------------------------------------------------------------------------ function Is_Span_Column_Position_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if the implementation can return valid character positions for -- elements. -- -- An implementation may choose to ignore column character position values -- within spans in which case this function returns False. This function will -- be False if Is_Line_Number_Supported = False. -- ------------------------------------------------------------------------------ function Is_Commentary_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if the implementation can return comments. -- -- An implementation may choose to ignore comments in the text in which case -- the function Is_Commentary_Supported returns False. -- ------------------------------------------------------------------------------ function Attributes_Are_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if an implementation supports compilation unit attributes. -- Returns False if all attributes will return Has_Attribute() = False. -- ------------------------------------------------------------------------------ function Minimal_Inconsistent_Units return Boolean; ------------------------------------------------------------------------------ -- Returns True if Relationships are implemented as a minimal set of -- relationships. -- --|95------------------------------------------------------------------------- --|95 function Implicit_Components_Supported is new. ------------------------------------------------------------------------------ function Implicit_Components_Supported return Boolean; ------------------------------------------------------------------------------ -- Returns True if the implementation provides elements representing -- implicit implementation-defined components. end ASIS.Implementation.Permissions; ------------------------------------------------------------------------------ package Asis.Ada_Environments is ------------------------------------------------------------------------------ -- Asis.Ada_Environments - ASIS 95 Draft Version 2.0.F -- May 1996 -- -- Asis.Ada_Environments encapsulates a set of queries that map physical Ada -- compilation and program execution environments to logical ASIS environments. -- -- An ASIS Context is associated with some set of Ada compilation units -- maintained by an underlying Ada implementation or a stand-alone ASIS -- implementation. After this association has been made, this set of units -- is considered to be part of the compile-time Ada environment, which forms -- the outermost context of any compilation, as specified in section 10.1.4 of -- the Ada 95 Reference Manual. This same environment context provides the -- implicit outermost anonymous task during program execution. -- --|IR Implementation Requirment --|IR --|IR The concrete mechanism of this association is vendor-specific: --|IR --|IR Each ASIS implementation will provide the means to construct an ASIS --|IR Context value that defines the environment declarative_part or --|IR "context" from which ASIS can obtain library units. --|IR ------------------------------------------------------------------------------ function Default_Name return Asis.Asis_String; ------------------------------------------------------------------------------ -- Returns the default context name. If there is no default context name, a -- Nil_Asis_String is returned. -- ------------------------------------------------------------------------------ function Default_Parameters return Asis.Asis_String; ------------------------------------------------------------------------------ -- Returns the default context parameters. If there are no default context -- parameters, a Nil_Asis_String is returned. -- ------------------------------------------------------------------------------ procedure Associate (Context : in out Asis.Context; Name : in Asis.Asis_String; Parameters : in Asis.Asis_String := Default_Parameters); ------------------------------------------------------------------------------ -- Context - Specifies the Context to associate -- Name - Specifies the name for the Context association -- Parameters - Specifies parameters to use when opening the Context -- -- Used to give name and parameter associations to a Context. The -- Has_Associations query is used to test whether or not a Context has -- been given name and parameter associations. The Name and Parameters -- queries are used to examine name and parameter associations. -- -- A Context has at most one set of name/parameter values associated with -- it at any time. Name and parameter associations cannot be modified while a -- Context is open Previous name and parameters associations for this Context -- are replaced by this call. -- -- ASIS implementations are encouraged, but not required, to validate the -- Parameters string immediately. It is recognized that some options cannot -- be completely validated until the Open is performed. An invalid Parameters -- value is reported by raising Asis_Failed with a Status of Parameter_Error. -- -- Raises Asis_Inappropriate_Context if the Context is open. -- ------------------------------------------------------------------------------ procedure Open (Context : in out Asis.Context); ------------------------------------------------------------------------------ -- Context - Specifies the Context to open -- -- Opens the ASIS Context using the Context's associated name and parameter -- values. -- -- Raises Asis_Inappropriate_Context if the Context is already open or if it -- is uninitialized (does not have associated name and parameter values). -- -- Raises Asis_Failed if the Context could not be opened for any reason. The -- most likely Status values would be Name_Error, Use_Error, Data_Error, and -- Parameter_Error. Other possibilities include Storage_Error and -- Capacity_Error. -- ------------------------------------------------------------------------------ procedure Close (Context : in out Asis.Context); ------------------------------------------------------------------------------ -- Context - Specifies the Context to close -- -- Closes the ASIS Context. Any previous Context name and parameter -- associations are retained. This allows the same Context to be re-opened -- later with the same associations. -- -- All Compilation_Unit and Element values obtained from the Context become -- invalid when it is closed. Subsequent calls to ASIS services using such -- invalid Compilation_Unit or Element values are erroneous. ASIS -- implementations will attempt to detect such usage and raise Asis_Failed in -- response. Applications should be aware that the ability to detect the use -- of such "dangling references" is implementation specific and not all -- implementations will be able to raise Asis_Failed at the appropriate -- points. Thus, applications that attempt to utilize invalid values may -- exhibit unpredictable behavior. -- -- Raises Asis_Inappropriate_Context if the Context is not open. -- ------------------------------------------------------------------------------ procedure Dissociate (Context : in out Asis.Context); ------------------------------------------------------------------------------ -- Context - Specifies the Context whose name and parameter associations are -- to be cleared -- -- Severs all previous associations for the Context. A Context that does not -- have associations (is uninitialized) will be returned unchanged. The -- Context variable is returned to its uninitialized state. -- -- Contexts that have been given Names and Parameters should be Dissociated -- when they are no longer necessary. Some amount of program storage may be -- tied up by the stored Name and Parameter strings. This space is only -- freed when a Context is Dissociated or when ASIS is Finalized. -- -- This operation has no physical affect on any vendor Ada environment. -- -- Raises Asis_Inappropriate_Context if the Context is open. -- ------------------------------------------------------------------------------ function Is_Equal (Left : in Asis.Context; Right : in Asis.Context) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first Context -- Right - Specifies the second Context -- -- Returns True if Left and Right designate the same Ada environments and the -- same set of associated compilation units. The Context variables may be -- open or closed. --|OP clarify with additional comments -- -- Unless both Contexts are open, this operation is implemented as a pair of -- simple string comparisons between the Name and Parameter associations for -- the two Contexts. If both Contexts are open, this operation acts as a -- set comparison and returns True if both sets contain the same units (all -- unit versions are included in the comparison). -- --|AN Application Note: --|AN --|AN With some implementations, Is_Equal may be True before the Contexts --|AN are opened, but may be False after the Contexts are open. --|AN One possible cause for this is a sequence of events such as: --|AN --|AN 1) ASIS program A opens the Left Context for READ, --|AN 2) non-ASIS program B opens the Context for UPDATE, and creates a new --|AN version of the vendor Context, --|AN 3) ASIS program A opens the Right Context for READ, and gets the new --|AN version. --|AN ------------------------------------------------------------------------------ function Is_Identical (Left : in Asis.Context; Right : in Asis.Context) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first Context -- Right - Specifies the second Context -- -- Returns True if Left and Right both designate the value associated with -- one specific open ASIS Context variable. --|OP clarify with additional comments -- -- Returns False otherwise or if either Context is not open. -- --|AN Application Note: --|AN --|AN No two physically separate open Context variables are ever Is_Identical. --|AN The value associated with an open ASIS Context variable is also directly --|AN associated with every Compilation_Unit or Element derived from that --|AN Context. It is possible to obtain these Context values by way of the --|AN Enclosing_Context and the Enclosing_Compilation_Unit queries. These --|AN Context values can be tested for identity with each other or with --|AN specific Context variables. An open ASIS Context variable and an --|AN Enclosing_Context value are only Is_Identical if the Compilation_Unit in --|AN question was derived specifically from that open ASIS Context variable. --|AN ------------------------------------------------------------------------------ function Exists (Context : in Asis.Context) return Boolean; ------------------------------------------------------------------------------ -- Context - Specifies a Context with associated name and parameter values -- -- Returns True if the Context is open or if the Context designates an Ada -- environment that can be determined to exist. -- -- Returns False for any uninitialized Context variable. -- --|IP Implementation Permissions: --|IP --|IP No guarantee is made that the Context is readable or that an Open --|IP operation on this Context would actually succeed. The associated --|IP parameter value for the Context may not be fully validated by this --|IP simple existence check. It may contain information that can only be --|IP verified by an actual Open. --|IP ------------------------------------------------------------------------------ function Is_Open (Context : in Asis.Context) return Boolean; ------------------------------------------------------------------------------ -- Context - Specifies the Context to check -- -- Returns True if the Context is currently open. -- ------------------------------------------------------------------------------ function Has_Associations (Context : in Asis.Context) return Boolean; ------------------------------------------------------------------------------ -- Context - Specifies the Context to check -- -- Returns True if name and parameter values have been associated with this -- Context. -- -- Returns False for an uninitialized Context. -- ------------------------------------------------------------------------------ function Name (Context : in Asis.Context) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Context - Specifies the Context to check -- -- Returns the Name value associated with the Context. -- -- Returns a Nil_Asis_String if the Context is uninitialized. -- ------------------------------------------------------------------------------ function Parameters (Context : in Asis.Context) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Context - Specifies the Context to check -- -- Returns the Parameters value associated with the Context. -- -- Returns a Nil_Asis_String if the Context is uninitialized. -- ------------------------------------------------------------------------------ function Debug_Image (Context : in Asis.Context) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Context - Specifies the Context to represent -- -- Returns an Asis_String value containing implementation defined debugging -- information associated with the Context. -- -- The return value uses Asis.Text.Delimiter_Image to separate lines in -- multi-line results. The return value is not terminated with -- Asis.Text.Delimiter_Image. -- -- Returns a Nil_Asis_String if the Context is uninitialized. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS vendor. They can be presumed -- to contain information useful when debugging the implementation itself. -- They are also suitable for use by the ASIS application when printing simple -- application debugging messages during application development. They are -- intended to be, to some worthwhile degree, intelligible to the user. -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. ------------------------------------------------------------------------------ end Asis.Ada_Environments; ------------------------------------------------------------------------------ package Asis.Ada_Environments.Containers is ------------------------------------------------------------------------------ -- Asis.Ada_Environments.Containers -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- If an Ada implementation supports the notion of a program library or -- "library" as specified in section 10(2) of the Ada 95 Reference Manual, -- then an ASIS Context value can be mapped onto one or more vendor libraries -- represented by Containers. -- -- ASIS implementations must minimally map the Asis.Context to a list of -- one Asis.Container whose Name is that of the Asis.Context Name. ------------------------------------------------------------------------------ function Defining_Containers (Context : in Asis.Context) return Asis.Container_List; ------------------------------------------------------------------------------ -- Context - Specifies the Context to define -- -- Returns a Container_List value that defines the single environment Context. -- Each Container will have an Enclosing_Context that Is_Identical to the -- Context argument. The order of Container values in the list is not defined. -- -- Returns a minimal list of length one if the ASIS Ada implementation does -- not support the concept of a program library. In this case, the Container -- will have the same name as the given Context. -- -- Raises Asis_Inappropriate_Context if the Context is not open. -- ------------------------------------------------------------------------------ function Enclosing_Context (Container : in Asis.Container) return Asis.Context; ------------------------------------------------------------------------------ -- Container - Specifies the Container to query -- -- Returns the Context value associated with the Container. -- -- Returns the Context for which the Container value was originally obtained. -- Container values obtained through the Defining_Containers query will always -- remember the Context from which they were defined. -- -- Because Context is limited private, this function is only intended to be -- used to supply a Context parameter for other queries. -- -- Raises Asis_Inappropriate_Container if the Container is a Nil_Container. -- ------------------------------------------------------------------------------ function Library_Unit_Declarations (Container : in Asis.Container) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Container - Specifies the Container to query -- -- Returns a list of all library_unit_declarations and -- library_unit_renaming_declarations contained in the Container. Individual -- units will appear only once in an order that is not defined. -- -- A Nil_Compilation_Unit_List is returned if there are no declarations of -- library units within the Container. -- -- This query will never return a unit with A_Configuration_Compilation or -- a Nonexistent unit kind. -- -- All units in the result will have an Enclosing_Container value that -- Is_Identical to the Container. -- -- Raises Asis_Inappropriate_Context if the Enclosing_Context(Container) -- is not open. -- --|95------------------------------------------------------------------------- --|95 function Compilation_Unit_Bodies was called Secondary_Units. ------------------------------------------------------------------------------ function Compilation_Unit_Bodies (Container : in Asis.Container) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Container - Specifies the Container to query -- -- Returns a list of all library_unit_bodies and subunits contained in the -- Container. Individual units will appear only once in an order that is not -- defined. -- -- A Nil_Compilation_Unit_List is returned if there are no bodies within the -- Container. -- -- This query will never return a unit with A_Configuration_Compilation or -- a Nonexistent unit kind. -- -- All units in the result will have an Enclosing_Container value that -- Is_Identical to the Container. -- -- Raises Asis_Inappropriate_Context if the Enclosing_Context(Container) -- is not open. -- ------------------------------------------------------------------------------ function Compilation_Units (Container : in Asis.Container) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Container - Specifies the Container to query -- -- Returns a list of all compilation units contained in the Container. -- Individual units will appear only once in an order that is not defined. -- -- A Nil_Compilation_Unit_List is returned if there are no units within the -- Container. -- -- This query will never return a unit with A_Configuration_Compilation or -- a Nonexistent unit kind. -- -- All units in the result will have an Enclosing_Container value that -- Is_Identical to the Container. -- -- Raises Asis_Inappropriate_Context if the Enclosing_Context(Container) -- is not open. -- ------------------------------------------------------------------------------ function Is_Equal (Left : in Asis.Container; Right : in Asis.Container) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first Container -- Right - Specifies the second Container -- -- Returns True if Left and Right designate Container values that contain the -- same set of compilation units. The Container values may have been defined -- from different Context values. -- ------------------------------------------------------------------------------ function Is_Identical (Left : in Asis.Container; Right : in Asis.Container) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first Container -- Right - Specifies the second Container -- -- Returns True if Is_Equal(Left, Right) and the Container values have been -- defined from Is_Equal Context values. -- ------------------------------------------------------------------------------ function Name (Container : in Asis.Container) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Context - Specifies the Container to name -- -- Returns the Name value associated with the Container. -- -- Returns a Nil_Asis_String if the Container is a Nil_Container. -- end Asis.Ada_Environments.Containers; ------------------------------------------------------------------------------ package Asis.Compilation_Units is ------------------------------------------------------------------------------ -- Asis.Compilation_Units -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of queries that implement the -- ASIS Compilation_Unit abstraction. -- -- More than one compilation unit may be manipulated at one time. (The exact -- number is subject to vendor specific limitations.) -- -- A specific Compilation_Unit value is valid (usable) for as long as the ASIS -- Context variable, used to create it, remains open. Once an ASIS Context is -- closed, all associated Compilation_Unit values become invalid. It is -- erroneous to use an invalid Compilation_Unit value. -- --|95------------------------------------------------------------------------- --|95 function Unit_Kind was called Kind. The return type Unit_Kinds was --|95 called Compilation_Unit_Kinds. ------------------------------------------------------------------------------ function Unit_Kind (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Unit_Kinds; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the compilation unit to query -- -- Returns the Unit_Kinds value of the compilation unit. -- Returns Not_A_Unit for a Nil_Compilation_Unit. -- -- All Unit_Kinds are expected. -- -- Returns An_Unknown_Unit for any compilation unit that exists, but that -- does not have semantic element information available through ASIS. -- -- Returns a Nonexistent kind for units that have name-only entries in the -- environment Context. Such entries may exist for names because: -- -- - They represent an illegal compilation unit added to the environment. -- -- - They are referenced by some existing unit, but the program text for the -- referenced unit has never been supplied, compiled, or otherwise -- inserted into the environment. -- -- - They represent a separate subunit that has never been supplied, -- compiled, or otherwise inserted into the environment.. -- -- - The unit may have existed at one time but the semantic information is no -- longer available. It may be inconsistent, have been removed by some -- user or Ada environment operations, or simply have been lost as the -- result of some sort of failure. -- --|95------------------------------------------------------------------------- --|95 function Unit_Class is new. ------------------------------------------------------------------------------ function Unit_Class (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Unit_Classes; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the compilation unit to query -- -- Returns the Unit_Classes value of the compilation unit. -- Returns Not_A_Class for a Nil_Compilation_Unit. -- -- All Unit_Kinds are expected. -- --|95------------------------------------------------------------------------- --|95 function Unit_State of ASIS 2.0.B is deleted. --|95 The method to determine consistency is to use one of the two semantic --|95 dependence queries: Elaboration_Order or Semantic_Dependence_Order. --|95------------------------------------------------------------------------- --|95 function Unit_Origin was called Origin. The return type Unit_Origins --|95 was called Compilation_Unit_Origins. ------------------------------------------------------------------------------ function Unit_Origin (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Unit_Origins; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the compilation unit to query -- -- Returns the Unit_Origins value of the unit. -- Returns Not_An_Origin for a compilation_unit whose Unit_Kind is -- Not_A_Unit, An_Unknown_Unit, A_Nonexistant_Declaration, or -- A_Nonexistant_Body. -- -- All Unit_Kinds are expected. -- ------------------------------------------------------------------------------ function Enclosing_Context (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Context; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose Context is required -- -- Returns the Context containing the compilation unit. -- -- Compilation units always remember the ASIS Context and Container from -- which they were obtained. -- -- Because Context is limited private, this function is only intended to be -- used to supply a Context parameter for other queries. This conveniently -- eliminates the need to make the original Context visible at the place of -- each call where a Context parameter is required. -- -- Two Compilation_Unit values, that represent the same physical compilation -- units (same Ada vendor Context implementation unit value) will test as -- Is_Equal, but not Is_Identical, if they were obtained from different open -- ASIS Context variables. -- -- Raises Asis_Inappropriate_Compilation_Unit if the unit is a -- Nil_Compilation_Unit. -- ------------------------------------------------------------------------------ function Enclosing_Container (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Container; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose Container is required -- -- Returns the Container of the Context containing the compilation unit. -- Compilation units always remember the ASIS Context and Container from -- which they were obtained. -- -- Raises Asis_Inappropriate_Compilation_Unit if the unit is a -- Nil_Compilation_Unit. -- --|95------------------------------------------------------------------------- --|95 function Library_Unit_Declaration was called Library_Unit. ------------------------------------------------------------------------------ function Library_Unit_Declaration (Name : in String; Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Name - Specifies the defining program unit name -- Context - Specifies a program Context environment -- -- Returns the library_unit_declaration or library_unit_renaming_declaration -- with the distinct name, contained in the Context. -- -- A Nil_Compilation_Unit is returned if no such declaration exists. -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to the Context. Never returns a unit with a nonexistent unit kind. -- --|95------------------------------------------------------------------------- --|95 function Compilation_Unit_Body was called Secondary_Unit. ------------------------------------------------------------------------------ function Compilation_Unit_Body (Name : in String; Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Name - Specifies the defining_program_unit_name -- Context - Specifies a program Context environment -- -- Returns the library_unit_body or subunit with the distinct name, contained -- in the library. -- -- The name must include a parent_unit_name to specify the name of a child -- library unit or a subunit. -- -- A Nil_Compilation_Unit is returned if no such body exists. -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to the Context. Never returns a unit with a nonexistent unit kind. -- --|95------------------------------------------------------------------------- --|95 function Library_Unit_Declarations was called Library_Units. ------------------------------------------------------------------------------ function Library_Unit_Declarations (Context : in Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Context - Specifies a program Context environment -- -- Returns a list of all library_unit_declarations and -- library_unit_renaming_declarations contained in the Context. Individual -- units will appear only once in an order that is not defined. -- -- A Nil_Compilation_Unit_List is returned if there are no declarations of -- library units within the Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a Nonexistent unit kind. -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to the Context. -- --|95------------------------------------------------------------------------- --|95 function Compilation_Unit_Bodies was called Secondary_Units. ------------------------------------------------------------------------------ function Compilation_Unit_Bodies (Context : in Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Context - Specifies a program Context environment -- -- Returns a list of all library_unit_bodies and subunits contained in the -- Context. Individual units will appear only once in an order that is not -- defined. -- -- A Nil_Compilation_Unit_List is returned if there are no bodies within the -- Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a Nonexistent unit kind. -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to the Context. -- ------------------------------------------------------------------------------ function Compilation_Units (Context : in Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Context - Specifies a program Context environment -- -- Returns a list of all compilation units contained in the Context. -- Individual units will appear only once in an order that is not defined. -- -- A Nil_Compilation_Unit_List is returned if there are no units within the -- Context. -- -- This query will never return a unit with A_Configuration_Compilation or -- a Nonexistent unit kind. -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to the Context. -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Children is new. ------------------------------------------------------------------------------ function Corresponding_Children (Library_Unit : in Asis.Compilation_Unit) return Asis.Compilation_Unit_List; function Corresponding_Children (Library_Unit : in Asis.Compilation_Unit; Context : in Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Library_Unit - Specifies the library unit whose children are desired -- Context - Specifies a program Context environment -- -- Returns a list of the child units for the given parent library unit. -- -- Both the declaration and body (if any) of each child unit are returned. -- Descendants beyond immediate children (ie. children of children) are not -- returned by this query. --|AN -- Use the compilation unit relationship queries -- with a Relation_Kinds of Descendants to create a list of children, children -- of children, and so on. -- -- Returns a Nil_Compilation_Unit_List for all library unit arguments that -- do not have any child units contained in the given Context. -- -- These two function calls will always produce identical results: -- -- Units := Corresponding_Children( Unit ); -- Units := Corresponding_Children( Unit, Enclosing_Context( Unit )); -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to the Context. -- -- The Enclosing_Context for any non-Nil result will always be the given -- Context, regardless of the Enclosing_Context value for the Library_Unit -- argument. This query is one means of obtaining (Is_Equal) child units -- from separate ASIS Context values whose underlying vendor implementations -- overlap. -- -- Appropriate Unit_Kinds: -- A_Package -- A_Generic_Package -- A_Package_Instantiation -- -- Returns Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- An_Unknown_Unit -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Parent_Declaration is new. ------------------------------------------------------------------------------ function Corresponding_Parent_Declaration (Library_Unit : in Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Parent_Declaration (Library_Unit : in Asis.Compilation_Unit; Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Library_Unit - Specifies the unit whose parent is desired -- Context - Specifies a program Context environment -- -- Returns the parent unit of the given library_unit. -- -- Returns a Nil_Compilation_Unit if the Library_Unit argument represents -- package Standard. Root Library_Unit arguments return the package Standard. -- -- Returns A_Nonexistent_Declaration when the Library_Unit has a -- parent_unit_name denoted in the defining_program_unit_name but the parent -- unit is not contained in the given Context. -- -- These two function calls will always produce identical results: -- -- Unit := Corresponding_Parent_Declaration( Unit ); -- Unit := Corresponding_Parent_Declaration( Unit, Enclosing_Context( Unit )); -- -- Any non-Nil result will have an Enclosing_Context value that Is_Identical -- to the Context. -- -- The Enclosing_Context for any non-Nil result will always be the given -- Context, regardless of the Enclosing_Context value for the Library_Unit -- argument. This query is one means of obtaining (Is_Equal) parent units -- from separate ASIS Context values whose underlying vendor implementations -- overlap. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- -- Returns Unit_Kinds: -- Not_A_Unit -- A_Package -- A_Generic_Package -- A_Package_Instance -- A_Nonexistent_Declaration -- An_Unknown_Unit -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Declaration was called Corresponding_Library_Unit. ------------------------------------------------------------------------------ function Corresponding_Declaration (Library_Item : in Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Declaration (Library_Item : in Asis.Compilation_Unit; Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Library_Item - Specifies the library_item whose declaration is desired -- Context - Specifies a program Context environment -- -- Returns the corresponding library_unit_declaration, if any, for the -- library_unit_body. The corresponding library_unit is the unit upon which -- the library_unit_body depends semantically. -- -- Returns a unit that Is_Equal to the argument if: -- -- - the argument is a library_unit_declaration, -- a library_unit_renaming_declaration, or a subunit. -- -- - the argument is A_Nonexistent_Declaration or A_Nonexistent_Body. -- -- Returns a Nil_Compilation_Unit for library_unit_body arguments that do -- not have a corresponding library_unit contained in the given Context. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Appropriate Unit_Kinds: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- An_Unknown_Unit -- See Implementation Permissions -- -- Appropriate Unit_Kinds returning the argument Library_Item: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- A_Nonexistent_Declaration -- A_Nonexistent_Body -- -- Returns all Unit_Kinds. -- --|IR Implementation Requirements: --|IR --|IR Any non-Nil result will have an Enclosing_Context value that --|IR Is_Identical to the Context. --|IR --|IR These two function calls will always produce identical results: --|IR --|IR Unit := Corresponding_Declaration( Unit ); --|IR Unit := Corresponding_Declaration( Unit, Enclosing_Context( Unit )); --|IR --|IR The Enclosing_Context for any non-Nil result will always be the given --|IR Context, regardless of the Enclosing_Context value for the Library_Item --|IR argument. This query is one means of obtaining corresponding --|IR (Is_Equal) units from separate ASIS Context values whose underlying --|IR vendor implementations overlap. --|IR --|IP Implementation Permissions: --|IP --|IP The handling of An_Unknown_Unit is vendor specific. The expected use --|IP for An_Unknown_Unit is to hide proprietary implementation details --|IP contained within unit bodies. In these cases, it should be possible --|IP to obtain an appropriate library_unit_declaration when starting with --|IP An_Unknown_Unit. Some vendors may chose to simply return the --|IP An_Unknown_Unit argument in all cases. --|IP --|95------------------------------------------------------------------------- --|95 function Corresponding_Body was called Corresponding_Secondary_Unit. ------------------------------------------------------------------------------ function Corresponding_Body (Library_Item : in Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Body (Library_Item : in Asis.Compilation_Unit; Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Library_Item - Specifies the library_item whose body is desired -- Context - Specifies a program Context environment -- -- Returns the corresponding library_unit_body, if any, for the -- library_unit_declaration. The corresponding library_unit_body is the unit -- that depends semantically on the library_unit_declaration. -- -- Returns a unit that Is_Equal to the argument if: -- -- - the argument is a an instance of a library_unit_declaration, -- a library_unit_body, a library_unit_renaming_declaration, or a subunit. -- -- - the argument is A_Nonexistent_Declaration or A_Nonexistent_Body. -- -- Returns a Nil_Compilation_Unit for library_unit_declaration arguments that -- do not have a corresponding library_unit_body contained in the given -- Context. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- An_Unknown_Unit -- See Implementation Permissions -- -- Appropriate Unit_Kinds returning the argument Library_Item: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- A_Nonexistent_Declaration -- A_Nonexistent_Body -- -- Returns all Unit_Kinds. -- --|IR Implementation Requirements: --|IR --|IR Any non-Nil result will have an Enclosing_Context value that --|IR Is_Identical to the Context. --|IR --|IR These two function calls will always produce identical results: --|IR --|IR Unit := Corresponding_Body( Unit ); --|IR Unit := Corresponding_Body( Unit, Enclosing_Context( Unit )); --|IR --|IR The Enclosing_Context for any non-Nil result will always be the given --|IR Context, regardless of the Enclosing_Context value for the Library_Item --|IR argument. This query is one means of obtaining corresponding --|IR (Is_Equal) units from separate ASIS Context values whose underlying --|IR vendor implementations overlap. --|IR --|IP Implementation Permissions: --|IP --|IP The handling of An_Unknown_Unit is vendor specific. The expected use --|IP for An_Unknown_Unit is to hide proprietary implementation details --|IP contained within unit bodies. In some cases, it may be possible --|IP to obtain an appropriate library_unit_body when starting with --|IP An_Unknown_Unit. Some vendors may chose to simply return the --|IP An_Unknown_Unit argument in all cases. --|IP --|95------------------------------------------------------------------------- --|95 function Compilation_Pragmas moved to Asis.Elements. ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the unit to test -- -- Returns True if the compilation_unit is a Nil_Compilation_Unit. -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Compilation_Unit_List) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the unit list to test -- -- Returns True if the compilation_unit list has a length of zero. -- ------------------------------------------------------------------------------ function Is_Equal (Left : in Asis.Compilation_Unit; Right : in Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first unit to compare -- Right - Specifies the second unit to compare -- -- Returns True if Left and Right represent the same physical compilation unit -- or if both are Nil_Compilation_Unit values. The two units may or may not -- be from the same ASIS Context variable. -- -- Two Nonexistent units are Is_Equal if they have the same Name and Unit_Kind. -- ------------------------------------------------------------------------------ function Is_Identical (Left : in Asis.Compilation_Unit; Right : in Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first unit to compare -- Right - Specifies the second unit to compare -- -- Returns True if Left and Right represent the same physical compilation -- unit, from the same open ASIS Context variable, or, if both are -- Nil_Compilation_Unit values. -- -- Two Nonexistent units are Is_Identical if they have the same -- Unique_Name and the same Enclosing_Context. -- ------------------------------------------------------------------------------ function Name (Compilation_Unit : in Asis.Compilation_Unit) return String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose name is desired -- -- Returns the String image of the fully expanded Ada name of the given -- compilation unit. This may be a simple name ("A") of a root library -- unit, or an expanded name ("A.B") of a subunit or non-root child unit. -- An expanded name shall contain the full parent_unit_name as its prefix. -- Returns an empty string only if A_Configuration_Compilation or a -- Nil_Compilation_Unit is given. -- -- The case of names returned by this query may vary between vendors. -- Vendors are encouraged, but not required, to return names in the same case -- as was used in the original compilation text. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ function Unique_Name (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose name is desired -- -- Returns an Asis_String that uniquely identifies the given compilation unit -- within the underlying Ada Context implementation. The result may vary -- depending on the ASIS implementation. The unique name may include the name -- and parameters of the Context, file system paths, sublibrary files, version -- numbers, kind, or any other information that a vendor may need to uniquely -- identify the compilation unit. -- -- Returns a Nil_Asis_String only if a Nil_Compilation_Unit is given. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ function Exists (Compilation_Unit : in Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to test -- -- Returns False for any unit with Not_A_Unit or Nonexistent kind. -- Returns True for all other unit kinds. -- -- All Unit_Kinds are expected. -- --|95------------------------------------------------------------------------- --|95 Can_Be_Main_Program True for declarations, bodies and renamings. ------------------------------------------------------------------------------ function Can_Be_Main_Program (Compilation_Unit : in Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to test -- -- Returns True if the Compilation_Unit exists and is a subprogram -- library_unit_declaration, library_unit_renaming_declaration, or -- library_unit_body that can be used as a main subprogram. See RM 95 10.2(7). -- -- Results of this function may vary according to the requirements an Ada -- implementation may impose on a main subprogram. -- -- All Unit_Kinds are expected. -- --|95------------------------------------------------------------------------- --|95 function Body_Is_Optional was deleted: Bodies are not optional. --|95------------------------------------------------------------------------- --|95 function Is_Body_Required is new. ------------------------------------------------------------------------------ function Is_Body_Required (Compilation_Unit : in Asis.Compilation_Unit) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to test -- -- Returns True if the Compilation_Unit exists and is a library unit -- package declaration that requires a body. See RM 95 7.2(4). -- -- All Unit_Kinds are expected. -- --|95------------------------------------------------------------------------- --|95 function Text_Name was Text_File_Name. Ada 95 has no concept of --|95 source or text file. --|95 Text_Name availablity is a required feature of ASIS. ------------------------------------------------------------------------------ function Text_Name (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose text name is desired -- -- Returns the name of the text, or other structure, that was the source -- of the compilation that resulted in this Compilation_Unit. Returns a -- Nil_Asis_String if the unit has a Nil or Nonexistent kind, or if the text -- name is not available for any reason. -- -- All Unit_Kinds are appropriate. -- --|95------------------------------------------------------------------------- --|95 function Text_Form was Text_File_Form. Ada 95 has no concept of --|95 source or text file. --|95 Text_Form availablity is a required feature of ASIS. ------------------------------------------------------------------------------ function Text_Form (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose text form is desired -- -- Returns the Form parameter (as for Text_Io.Open) for the text, or -- other structure, that was the source of the compilation that resulted in -- this Compilation_Unit. Returns a Nil_Asis_String if the unit has a Nil or -- Nonexistent kind, if the text was created with an empty Form parameter, -- or if the text Form parameter value is not available for any reason. -- -- All Unit_Kinds are appropriate. -- --|95------------------------------------------------------------------------- --|95 function Object_Name was Object_File_Name. ------------------------------------------------------------------------------ function Object_Name (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose object name is desired -- -- Returns the name of the object, or other structure, that was the -- machine-code result of the compilation for this Compilation_Unit. Returns -- a Nil_Asis_String if the unit has a Nil or Nonexistent kind, or if the -- object name is not available for any reason. -- -- All Unit_Kinds are appropriate. -- --|95------------------------------------------------------------------------- --|95 function Object_Form was Object_File_Form. ------------------------------------------------------------------------------ function Object_Form (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit whose object form is desired -- -- Returns the Form parameter (as for Text_Io.Open) for the object, or -- other structure, that was the machine-code result of the compilation of -- this Compilation_Unit. Returns a Nil_Asis_String if the unit has a Nil or -- Nonexistent kind, if the object was created with an empty Form parameter, -- or if the object Form parameter value is not available for any reason. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ function Compilation_Command_Line_Options (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- -- Returns the command line options used to compile the Compilation_Unit. -- Returns Nil_Asis_String if the unit has a Nil or Nonexistent unit kind, or -- if the command line options are not available for any reason. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ function Time_Of_Last_Update (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_Time; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- -- Returns the time that this physical compilation unit was most recently -- updated in its vendor Ada Environment. This will often be the time of its -- last compilation. The exact significance of the result is vendor specific. -- Returns Nil_Asis_Time if the unit has a Nil or Nonexistent unit kind, or if -- the time of last update is not available, or not meaningful, for any -- reason. -- -- All Unit_Kinds are appropriate. -- ------------------------------------------------------------------------------ function Compilation_Cpu_Time (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_Time; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- -- Returns the CPU time used to compile the physical compilation unit -- associated with the Compilation_Unit argument. The exact significance, or -- accuracy, of the result is vendor specific. Returns Nil_Asis_Time if the -- unit has a Nil or Nonexistent unit kind, of if the CPU time for the last -- compilation is not available for any reason. -- -- All Unit_Kinds are appropriate. -- -- The return value is relative to Nil_Asis_Time. For example: -- A value where Year = 1901, Month = 1, Day = 1, and Seconds = 10.0 -- indicates the compilation took 10.0 seconds. -- A value where Year = 1902, Month = 4, Day = 6, and Seconds = 23.0 -- indicates the compilation took 1 year, 3 months, 5 days, 23.0 seconds. -- ------------------------------------------------------------------------------ function Has_Attribute (Compilation_Unit : in Asis.Compilation_Unit; Attribute : in Asis.Asis_String) return Boolean; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- Attribute - Specifies the name of the attribute to query -- -- Returns True if the compilation unit has the given attribute. -- -- Returns False if the unit is a Nil_Compilation_Unit argument, the -- Attribute does not exist, or the implementation does not support attributes. -- -- All Unit_Kinds are expected. -- -- Results of this query may vary across ASIS implementations. -- ------------------------------------------------------------------------------ function Attribute_Value_Delimiter return Asis.Asis_String; ------------------------------------------------------------------------------ -- Returns the Asis_String used as a delimiter separating individual values -- within the Asis_String Attribute_Values of a compilation unit. -- -- Results of this query may vary across ASIS implementations. The result -- may be Nil_Asis_String for implementations that do not support attributes, -- or that do not support more than one attribute. -- ------------------------------------------------------------------------------ function Attribute_Values (Compilation_Unit : in Asis.Compilation_Unit; Attribute : in Asis.Asis_String) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- Attribute - Specifies the name of the attribute to query -- -- Returns an Asis_String containing zero or more images of values that are -- associated with the given attribute. When more than one value is returned, -- the Attribute_Value_Delimiter string is used to separate the individual -- values. Returns Nil_Asis_String if the unit is a Nil_Compilation_Unit -- argument, the unit has no values for this Attribute, or the implementation -- does not support attributes. -- -- All Unit_Kinds are appropriate. -- -- Results of this query may vary across ASIS implementations. -- ------------------------------------------------------------------------------ function Attribute_Time (Compilation_Unit : in Asis.Compilation_Unit; Attribute : in Asis.Asis_String) return Asis.Asis_Time; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- Attribute - Specifies the name of the attribute to query -- -- Returns the Asis_Time value associated with the given attribute. Returns -- Nil_Asis_Time if the argument is a Nil_Compilation_Unit, the unit does -- not have the given Attribute, or the implementation does not record times -- for attributes. -- -- All Unit_Kinds are appropriate. -- -- Results of this query may vary across ASIS implementations. -- --|95------------------------------------------------------------------------- --|95 function Enclosing_Compilation_Unit moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Unit_Declaration moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Context_Clause_Elements moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Referenced_Units was deleted. Reason REPLACED. The new --|95 query Clause_Names provides the equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Is_Subunit was deleted. Reason: SECONDARY. Use Unit_Kind. ------------------------------------------------------------------------------ function Subunits (Parent_Body : in Asis.Compilation_Unit) return Asis.Compilation_Unit_List; function Subunits (Parent_Body : in Asis.Compilation_Unit; Context : in Asis.Context) return Asis.Compilation_Unit_List; ------------------------------------------------------------------------------ -- Parent_Body - Specifies the parent unit to query -- Context - Specifies the program Context to use for context -- -- Returns a complete list of subunit values, with one value for each body -- stub that appears in the given Parent_Body. Returns a -- Nil_Compilation_Unit_List if the parent unit does not contain any body -- stubs. Every unit in the result will have an Enclosing_Context that -- Is_Identical to the Context. -- -- These two function calls will always produce identical results: -- -- SUnits := Subunits( PUnit ); -- SUnits := Subunits( PUnit, Enclosing_Context( PUnit )); -- -- The result may include unit values with a Nonexistent unit kind. It -- includes values for subunits that actually exist in the given Context as -- well as values for subunits that do not exist, but whose name can be -- deduced from the body stub and the name of the parent unit. These -- nonexistent units are known to be library_unit_bodies so their unit -- kind will be A_Nonexistent_Body. -- -- Subunit lists are also available through the Semantic_Dependence_Order -- query using the Family relation. -- -- Raises Asis_Inappropriate_Compilation_Unit if the unit is a -- Nil_Compilation_Unit. -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Subunit_Parent_Body was called Subunit_Parent. ------------------------------------------------------------------------------ function Corresponding_Subunit_Parent_Body (Subunit : in Asis.Compilation_Unit) return Asis.Compilation_Unit; function Corresponding_Subunit_Parent_Body (Subunit : in Asis.Compilation_Unit; Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Subunit - Specifies the subunit to query -- Context - Specifies the program Context to use for context -- -- Returns the Compilation_Unit containing the body stub of the given Subunit. -- Returns a Nil_Compilation_Unit if the subunit parent is not contained in -- the Context. Any non-Nil result will have an Enclosing_Context value that -- Is_Identical to the Context. -- -- These two function calls will always produce identical results: -- -- PUnit := Corresponding_Subunit_Parent_Body( SUnit ); -- PUnit := Corresponding_Subunit_Parent_Body( SUnit, -- Enclosing_Context( SUnit )); -- -- Appropriate Unit_Kinds: -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- -- Returns Unit_Kinds: -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- --|95------------------------------------------------------------------------- --|95 function Subunit_Ancestor was deleted. Reason: OBSOLETE. --|95 Ada 95 does not define the ancestor of subunits. --|95 To locate the parent of a subunit that is not itself a subunit, --|95 repeatedly call Corresponding_Subunit_Parent_Body until a unit that --|95 is not a subunit is returned. --|95------------------------------------------------------------------------- --|95 DEPENDENCES replaces COMPILATION ORDER terminology. --|95------------------------------------------------------------------------- --|95 The term Consistent replaces the term Existing in the type Relationship. --|95 --|95 The order of units within each inconsistent units pair are reversed. --|95 The inconsistent unit pairs are ordered such that there are no forward --|95 semantic dependencies. Units that are themselves the cause for the --|95 inconsistency now reference A_Nil_Compilation_Unit rather than --|95 themselves as the first unit of the pair. --|95 --|95 The order of units within each circular units pair are reversed, also --|95 to avoid forward semantic dependence. ------------------------------------------------------------------------------ -- Semantic Dependence Relationships - RM 95 10.1.1(24). -- Elaboration Dependence Relationships - RM 95 10.1.1(25). -- -- Relationship queries provide references to compilation units that are -- related, in some specific fashion, to one or more given compilation units. -- Compilation units located by these queries are returned as a set of -- ordered lists. -- -- type Relationship (Consistent_Length : Asis.Asis_Natural; -- Inconsistent_Length : Asis.Asis_Natural; -- Missing_Length : Asis.Asis_Natural; -- Circular_Length : Asis.Asis_Natural) is -- record -- Consistent : Compilation_Unit_List (1 .. Consistent_Length); -- Inconsistent : Compilation_Unit_List (1 .. Inconsistent_Length); -- Missing : Compilation_Unit_List (1 .. Missing_Length); -- Circular : Compilation_Unit_List (1 .. Circular_Length); -- end record; -- -- The following describes the semantics of the unit lists returned by the -- queries Semantic_Dependence_Order and Elaboration_Order: -- -- Each query returns a set of four lists. Every unit returned will have the -- same Enclosing_Context. The lists are: -- -- 1) (Consistent) A list of consistent ordered units. -- 2) (Inconsistent) A list of units that are inconsistent with one or -- more units on which they semantically depend. -- 3) (Missing) A list of units that have missing (nonexistent) related -- units. -- 4) (Circular) A list of circular semantic dependencies between units. -- -- -- 1) The consistent units list: -- -- The semantics for the ordering of units in the first list are defined by -- the individual queries. -- -- Every unit in this list is unique. No duplicates will be returned; no two -- units in the list will be Is_Equal or Is_Identical. -- -- -- 2) The inconsistent units list: -- -- The second list is made up of unit pairs. -- -- Each pairing defines an inconsistent semantic dependence relationship. -- The second unit of each pair depends semantically on the first unit. -- All units appearing second (units with even numbered list indexes) are -- always considered to be inconsistent and will not appear in the consistent -- units list. Units appearing first can be either consistent units that -- also appear in the consistent units list, or can be inconsistent units -- that are part of an inconsistent transitive relationship. -- -- The unit pairs are ordered such that there are no forward semantic -- dependencies between the inconsistent units. Each inconsistent unit's -- supporters always precede it in the list. -- -- As an example, given four units, A withs B, B withs C, and C withs D; -- if D is recompiled, the inconsistent list would minimally contain six -- units with the three pairs: -- -- DC CB BA -- -- The list indicates that units C, B, and A are inconsistent (the second -- units of each pair). Semantic dependencies such as B depends on C -- also are indicated. The units C, B, and A are in an order that could be -- submitted to the compiler (a possible recompilation order). -- -- If a unit is inconsistent because the source for the unit has been -- edited (or otherwise been made inconsistent by some action of the user -- or implementation) then the unit references A_Nil_Compilation_Unit as the -- cause of the inconsistency. eg. (Nil A Nil B) would be a list of two -- inconsistent units, neither of which can point to a third unit as the -- cause for their being inconsistent. --|IP --|IP An implementation is allowed to use A_Nil_Compilation_Unit value for --|IP the first unit of each pair if it cannot determine the supporting unit --|IP causing the inconsistent semantic dependence. -- -- This list will be returned in one of two forms. The "minimal" form, or -- the "maximal" form. -- -- minimal (inconsistent Direct_Dependents only): DC CB BA -- maximal (inconsistent Dependents all listed): DC DB DA CB CA BA -- -- The minimal form reports each direct relationship once. -- The maximal form reports each direct and indirect relationship once for -- every occurence. -- -- The minimal report simply indicates the X withed by Y dependencies, each -- such pair is reported once: -- -- D withed by C => DC -- C withed by B => CB -- B withed by A => BA -- -- The maximal report reports all direct and indirect dependencies: -- -- D withed by C withed by B withed by A => DC DB DA -- C withed by B withed by A => CB CA -- B withed by A => BA -- -- The query Minimal_Inconsistent_Units returns True if the minimal form is -- used and False if the maximal form is used. -- -- -- 3) The missing dependence list: -- -- The third list is made up of unit pairs. Each pairing consists of a -- unit followed by a missing related unit needed by the first unit. -- A missing unit is a required Compilation_Unit, with a known name, with a -- Unit_Kind that is either A_Nonexistent_Declaration or A_Nonexistent_Body. -- -- For example: -- -- Given a list containing the units: AB AC -- -- If Unit_Kind(B) = A_Nonexistent_Declaration and -- Unit_Kind(C) = A_Nonexistent_Body then -- -- It can be deduced that: -- A is missing a needed supporter B (A depends semantically on B). -- A is missing a needed related unit body C -- (depending on the kind for A, C may be A's required body or some subunit -- of A) -- -- A unit is reported as missing only if the Post-Compilation Rules of Ada -- determine it to be needed. RM 95 10.2. -- -- -- 4) The circular dependence list: -- -- Circular dependencies between compilation units are provided in the fourth -- list. There may be more than one set of circular dependencies. The -- ordering of distinct sets in the list is implementation defined. This list -- will never contain Nonexistent units. -- -- The list is made up of unit pairs. The second unit of each pair depends -- semantically on the first unit. A circularity is established when the -- first unit of a pair also appears as the second unit of a later pair. -- (See the unit A in the example below; it is the first unit of the first -- pair and is the second unit of the third pair). The next set of circular -- dependent units, if any, starts with the next unit in the list (the unit -- D in the example below). -- -- For example: -- -- Given a list containing the units: AC CB BA DG GF FE ED -- -- It can be determined that there are two sets of circularly dependent -- units: -- {A, B, C} and {D, E, F, G} -- -- The dependencies are: A depends on B, B depends on C, C depends on A. -- D depends on E, E depends on F, F depends on G, G depends on D. -- -- Each circle of dependence is reported exactly once. It is not reported -- once for each unit in the circle. -- --|AN Application Note: --|AN --|AN To properly determine unit consistency, use one of the two semantic --|AN dependence queries: Elaboration_Order or Semantic_Dependence_Order. --|AN These queries return a value of the type Relationship, which contains --|AN lists of consistent, inconsistent, missing and circular units. --|AN --|AN For these two queries, the existence of units in one or more of the --|AN inconsistent, missing, or circular units list means that the consistent --|AN unit list may not be complete. --|AN --|AN Applications that do not check for inconsistent, missing, or circular --|AN units before using the consistent list might not operate as expected. --|AN --|95------------------------------------------------------------------------- --|95 function Semantic_Dependence_Order was Related_Compilation_Units. ------------------------------------------------------------------------------ function Semantic_Dependence_Order (Compilation_Units : in Asis.Compilation_Unit_List; Dependent_Units : in Asis.Compilation_Unit_List; Context : in Asis.Context; Relation : in Asis.Relation_Kinds) return Asis.Relationship; ------------------------------------------------------------------------------ -- Compilation_Units - Specifies a list of pertinent units -- Dependent_Units - Specifies dependents used to limit the query -- Context - Specifies a program Context for context -- Relation - Specifies the relationship to query -- -- Produces a Relationship value containing compilation_units related to the -- given Compilation_Units by the specified relation. -- -- The compilation_units in the consistent units list are ordered such that -- there are no forward semantic dependences. -- -- Dependent_Units are ignored unless the Relation is Descendants, -- Direct_Dependents or Dependents. The union of units in the extended -- families of the Dependent_Units list provide a limiting context for the -- query. Only members of these extended families will be present in the -- result. -- -- If the Dependent_Units list is Is_Nil, the context for the search is the -- entire Context. The result of such a query will be the full (unlimited) -- list of Direct_Dependents or Dependents for the Compilation_Units. -- -- All units in the result will have an Enclosing_Context value that -- Is_Identical to the Context. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- An_Unknown_Unit -- See Implementation Permissions -- --|IP Implementation Permissions: --|IP --|IP The handling of An_Unknown_Unit is vendor specific. It may be possible --|IP to obtain Semantic Dependence Relationships when starting with a list --|IP containing one or more units that are An_Unknown_Unit. However, results --|IP may vary across ASIS implementations. --|IP --|95------------------------------------------------------------------------- --|95 function Compilation_Order was deleted. Reason: REPLACED by --|95 functionality of the new relationship query Semantic_Dependence_Order --|95 that defines consistent units to be ordered such that there are no --|95 forward semantic dependences. --|95------------------------------------------------------------------------- --|95 function Recompilation_Order was deleted. Reason: REPLACED by --|95 functionality of the new relationship query Semantic_Dependence_Order --|95 that provides inconsistent units. --|95------------------------------------------------------------------------- --|95 function Direct_Supporters was deleted. Reason: SECONDARY. Similar --|95 functionality can be implemented with the new Semantic_Dependence_Order. --|95------------------------------------------------------------------------- --|95 function Supporters was deleted. Reason: SECONDARY. Similar --|95 functionality can be implemented with the new Semantic_Dependence_Order. --|95------------------------------------------------------------------------- --|95 function Direct_Dependents was deleted. Reason: SECONDARY. Similar --|95 functionality can be implemented with the new Semantic_Dependence_Order. --|95------------------------------------------------------------------------- --|95 function Dependents was deleted. Reason: SECONDARY. Similar --|95 functionality can be implemented with the new Semantic_Dependence_Order. --|95------------------------------------------------------------------------- --|95 function Is_Obsolete was deleted. Reason: REPLACED. --|95 function Is_Consistent was deleted. Reason: REPLACED. --|95 Equivalent functionality of the deleted functions Is_Consistent and --|95 Is_Obsolete is provided by the new semantic dependence queries: --|95 Elaboration_Order or Semantic_Dependence_Order. ------------------------------------------------------------------------------ function Elaboration_Order (Compilation_Units : in Asis.Compilation_Unit_List; Context : in Asis.Context) return Asis.Relationship; ------------------------------------------------------------------------------ -- Compilation_Units - Specifies a list of units to elaborate -- Context - Specifies a program Context for context -- -- Produces, in elaboration order, a Relationship value containing compilation -- units required to elaborate the given compilation units. -- -- The return value contains the set of ordered lists described above for the -- queries on Semantic Dependence Relationships. If the inconsistent, -- missing, and circular lists are empty, the consistent list will contain -- all units required to elaborate the arguments. --|IP --|IP The Relationship value may include any number of vendor-specific --|IP runtime support packages. -- -- The first unit in the Consistent units list will always be the -- specification for package Standard. The list will contain all units -- required to elaborate the arguments. -- -- Use the Context_Clause_Elements query to get pragma ELABORATE elements -- for a compilation unit. -- -- Appropriate Unit_Kinds: -- A_Procedure -- A_Function -- A_Package -- A_Generic_Procedure -- A_Generic_Function -- A_Generic_Package -- A_Procedure_Instance -- A_Function_Instance -- A_Package_Instance -- A_Procedure_Renaming -- A_Function_Renaming -- A_Package_Renaming -- A_Generic_Procedure_Renaming -- A_Generic_Function_Renaming -- A_Generic_Package_Renaming -- A_Procedure_Body -- A_Function_Body -- A_Package_Body -- A_Procedure_Body_Subunit -- A_Function_Body_Subunit -- A_Package_Body_Subunit -- A_Task_Body_Subunit -- A_Protected_Body_Subunit -- An_Unknown_Unit -- See Implementation Permissions -- --|IP Implementation Permissions: --|IP --|IP The handling of An_Unknown_Unit is vendor specific. It may be possible --|IP to obtain Semantic Dependence Relationships when starting with a list --|IP containing one or more units that are An_Unknown_Unit. However, results --|IP may vary across ASIS implementations. --|IP ------------------------------------------------------------------------------ function Debug_Image (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies a unit to convert -- -- Returns an Asis_String value containing implementation defined debug -- information associated with the compilation unit. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS vendor. They can be presumed -- to contain information useful when debugging the implementation itself. -- They are also suitable for use by the ASIS application when printing simple -- application debugging messages during application development. They are -- intended to be, to some worthwhile degree, intelligible to the user. -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. ------------------------------------------------------------------------------ end Asis.Compilation_Units; ------------------------------------------------------------------------------ package Asis.Elements is ------------------------------------------------------------------------------ -- Asis.Elements - ASIS 95 Draft Version 2.0.F -- May 1996 -- -- Asis.Elements encapsulates a set of queries that operate on all elements -- and some queries specific to A_Pragma elements. -- --|95------------------------------------------------------------------------- --|95 --|95 Changes to package Asis_Elements. --|95 --|95------------------------------------------------------------------------- --|95 function Unit_Declaration moved from Asis.Compilation_Units. ------------------------------------------------------------------------------ -- Gateway queries between Compilation_Units and Elements ------------------------------------------------------------------------------ function Unit_Declaration (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Declaration; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- -- Returns the element representing the declaration of the compilation_unit. -- -- Returns a Nil_Element if the unit is A_Nonexistent_Declaration, -- A_Nonexistent_Body, A_Configuration_Compilation, or An_Unknown_Unit. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Body_Declaration -- A_Function_Declaration -- A_Function_Instantiation -- A_Generic_Function_Declaration -- A_Generic_Package_Declaration -- A_Generic_Procedure_Declaration -- A_Package_Body_Declaration -- A_Package_Declaration -- A_Package_Instantiation -- A_Procedure_Body_Declaration -- A_Procedure_Declaration -- A_Procedure_Instantiation -- A_Task_Body_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_Protected_Body_Declaration -- --|95------------------------------------------------------------------------- --|95 function Enclosing_Compilation_Unit moved from Asis.Compilation_Units. ------------------------------------------------------------------------------ function Enclosing_Compilation_Unit (Element : in Asis.Element) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Element - Specifies an Element whose Compilation_Unit is desired -- -- Returns the Compilation_Unit that contains the given Element. -- -- Raises Asis_Inappropriate_Element if the Element is a Nil_Element. -- --|95------------------------------------------------------------------------- --|95 function Context_Clause_Elements moved from Asis.Compilation_Units. ------------------------------------------------------------------------------ function Context_Clause_Elements (Compilation_Unit : in Asis.Compilation_Unit; Include_Pragmas : in Boolean := False) return Asis.Context_Clause_List; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of with clauses, use clauses, and pragmas that explicitly -- appear in the context clause of the compilation unit, in their order of -- appearance. -- -- Returns a Nil_Element_List if the unit has A_Nonexistent_Declaration, -- A_Nonexistent_Body, or An_Unknown_Unit Unit_Kind. -- --|IR -- All pragma ELABORATEs for this unit will appear in this list. Other -- pragmas will appear in this list, or in the Compilation_Pragmas list, or -- both. --|IP -- Vendors are encouraged to use this list to return all pragmas whose -- full effect is determined by their exact textual position. Pragmas, that -- do not have placement dependencies, may be returned in either list. Only -- pragmas that actually appear in the unit's context clause are returned -- by this query. All other pragmas, affecting the compilation of this -- unit, are available from the Compilation_Pragmas query. -- -- Ada predefined packages, such as package Standard, may or may not have -- context-clause elements available for processing by applications. The -- physical existence of a package Standard is vendor specific. The same is -- true for other Ada predefined packages, such as Ada.Text_Io and -- Ada.Direct_Io. The Origin query can be used to determine whether or not -- a particular unit is an Ada Predefined unit. -- --|IP -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name with clauses and use clauses -- into an equivalent sequence of single-name with clause and use clauses. -- Similarly, an implementation may retain only a single reference to a name -- that appeared more than once in the original context clause. -- Some vendors will return only pragma -- ELABORATEs in this list and return all other pragmas via the -- Compilation_Pragmas query. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Returns Element_Kinds: -- A_Pragma -- A_Clause -- -- Returns Clause_Kinds: -- A_With_Clause -- A_Use_Package_Clause -- ------------------------------------------------------------------------------ function Configuration_Pragmas (Context : in Asis.Context) return Asis.Pragma_Element_List; ------------------------------------------------------------------------------ -- Context - Specifies the Context to query -- -- Returns a list of pragmas that apply to all future compilation_units -- compiled into the same Context. Pragmas returned by this query shall -- have appeard in a compilation that had no compilation_units. -- To the extent that order is meaningful, the pragmas should be in -- their order of appearance in the compilation. (The order is vendor -- dependent, many pragmas have the same effect regardless of order.) -- -- Returns a Nil_Element_List if there are no such configuration pragmas. -- -- Returns Element_Kinds: -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 function Compilation_Pragmas moved from Asis.Compilation_Units. ------------------------------------------------------------------------------ function Compilation_Pragmas (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Pragma_Element_List; ------------------------------------------------------------------------------ -- Compilation_Unit - Specifies the unit to query -- -- Returns a list of pragmas that apply to the compilation of the unit. -- To the extent that order is meaningful, the pragmas should be in -- their order of appearance in the compilation. (The order is vendor -- dependent, many pragmas have the same effect regardless of order.) -- -- There are two sources for the pragmas that appear in this list: -- -- - Program unit pragmas appearing at the place of a compilation_unit. -- See RM 95 10.1.5(4). -- -- - Configuration pragmas appearing appearing before the first -- compilation_unit of a compilation. See RM 95 10.1.5(8). -- -- This query does not return ELABORATE pragmas from the unit context -- clause of the compilation unit; they do not apply to the compilation, -- only to the unit. -- -- Use the Context_Clause_Elements query to obtain a list of all pragmas -- (including ELABORATE pragmas) from the context clause of a compilation unit. -- -- Pragmas from this query may be duplicates of some or all of the -- non-ELABORATE pragmas available from the Context_Clause_Elements query. -- Such duplication is simply the result of the textual position of the -- pragma--globally effective pragmas may appear textually within the context -- clause of a particular unit, and be returned as part of the Context_Clause -- for that unit. -- -- Ada predefined packages, such as package Standard, may or may not have -- pragmas available for processing by applications. The physical -- existence of a package Standard is vendor specific. The same is true for -- other Ada predefined packages, such as Ada.Text_Io and Ada.Direct_Io. -- The Origin query can be used to determine whether or not a particular unit -- is an Ada Predefined unit. -- -- Returns a Nil_Element_List if the compilation unit: -- -- - has no such applicable pragmas. -- -- - is an An_Unknown_Unit, A_Nonexistent_Declaration, or A_Nonexistent_Body. -- -- All Unit_Kinds are appropriate except Not_A_Unit. -- -- Returns Element_Kinds: -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 The Element_Kinds Hierarchy is new. ------------------------------------------------------------------------------ -- Element_Kinds Hierarchy ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------ -- Element_Kinds Value Subordinate Kinds ------------------------------------------------------------------------------ -- -- Key: Read "->" as "can be further categorized by its" -- -- A_Pragma -> Pragma_Kinds -- -- A_Defining_Name -> Defining_Name_Kinds -- -> Operator_Kinds -- -- A_Declaration -> Declaration_Kinds -- -> Declaration_Origin -- -> Mode_Kinds -- -> Default_Kinds -- -- A_Definition -> Definition_Kinds -- -> Trait_Kinds -- -> Type_Kinds -- -> Formal_Type_Kinds -- -> Access_Type_Kinds -- -> Root_Type_Kinds -- -> Constraint_Kinds -- -> Discrete_Range_Kinds -- -- An_Expression -> Expression_Kinds -- -> Operator_Kinds -- -> Attribute_Kinds -- -- An_Association -> Association_Kinds -- -- A_Statement -> Statement_Kinds -- -- A_Path -> Path_Kinds -- -- A_Clause -> Clause_Kinds -- -> Representation_Clause_Kinds -- -- An_Exception_Handler -- --|95------------------------------------------------------------------------- --|95 All Kind queries are moved here to Asis.Elements. ------------------------------------------------------------------------------ function Element_Kind (Element : in Asis.Element) return Asis.Element_Kinds; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the Element_Kinds value of Element. -- Returns Not_An_Element for a Nil_Element. -- -- All element kinds are expected. -- ------------------------------------------------------------------------------ function Pragma_Kind (Pragma_Element : Asis.Pragma_Element) return Asis.Pragma_Kinds; ------------------------------------------------------------------------------ -- Pragma_Element - Specifies the element to query -- -- Returns the Pragma_Kinds value of Pragma_Element. -- Returns Not_A_Pragma for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Element_Kinds: -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 function Defining_Name_Kind is new. ------------------------------------------------------------------------------ function Defining_Name_Kind (Defining_Name : in Asis.Defining_Name) return Asis.Defining_Name_Kinds; ------------------------------------------------------------------------------ -- Defining_Name - Specifies the element to query -- -- Returns the Defining_Name_Kinds value of the Defining_Name. -- -- Returns Not_A_Defining_Name for any unexpected element such as a -- Nil_Element, A_Clause, or A_Statement. -- -- Expected Element_Kinds: -- A_Defining_Name -- --|95------------------------------------------------------------------------- --|95 function Declaration_Kind was Kind and moved from Asis.Declarations. ------------------------------------------------------------------------------ function Declaration_Kind (Declaration : in Asis.Declaration) return Asis.Declaration_Kinds; ------------------------------------------------------------------------------ -- Declaration - Specifies the element to query -- -- Returns the Declaration_Kinds value of the Declaration. -- -- Returns Not_A_Declaration for any unexpected element such as a -- Nil_Element, A_Definition, or A_Statement. -- -- Expected Element_Kinds: -- A_Declaration -- --|95------------------------------------------------------------------------- --|95 function Trait_Kind is new. ------------------------------------------------------------------------------ function Trait_Kind (Element : in Asis.Element) return Asis.Trait_Kinds; ------------------------------------------------------------------------------ -- Element - Specifies the Element to query -- -- Returns the Trait_Kinds value of the Element. -- -- Returns Not_A_Trait for any unexpected element such as a -- Nil_Element, A_Statement, or An_Expression. -- -- Expected Declaration_Kinds: -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Variable_Declaration -- A_Constant_Declaration -- A_Deferred_Constant_Declaration -- A_Discriminant_Specification -- A_Loop_Parameter_Specification -- A_Procedure_Declaration -- A_Function_Declaration -- A_Parameter_Specification -- -- Expected Definition_Kinds: -- A_Component_Definition -- A_Private_Type_Definition -- A_Tagged_Private_Type_Definition -- A_Private_Extension_Definition -- -- Expected Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- A_Record_Type_Definition -- A_Tagged_Record_Type_Definition -- -- Expected Formal_Type_Kinds: -- A_Formal_Private_Type_Definition -- A_Formal_Tagged_Private_Type_Definition -- A_Formal_Derived_Type_Definition -- --|95------------------------------------------------------------------------- --|95 function Declaration_Origin was Origin and moved from Asis.Declarations. ------------------------------------------------------------------------------ function Declaration_Origin (Declaration : in Asis.Declaration) return Asis.Declaration_Origins; ------------------------------------------------------------------------------ -- Declaration - Specifies the Declaration to query -- -- Returns the Declaration_Origins value of the Declaration. -- -- Returns Not_A_Declaration_Origin for any unexpected element such as a -- Nil_Element, A_Definition, or A_Clause. -- -- Expected Element_Kinds: -- A_Declaration -- --|95------------------------------------------------------------------------- --|95 function Mode_Kind moved from Asis.Declarations. ------------------------------------------------------------------------------ function Mode_Kind (Declaration : in Asis.Declaration) return Asis.Mode_Kinds; ------------------------------------------------------------------------------ -- Declaration - Specifies the element to query -- -- Returns the Mode_Kinds value of the Declaration. -- -- Returns Not_A_Mode for any unexpected element such as a -- Nil_Element, A_Definition, or A_Statement. -- -- Expected Declaration_Kinds: -- A_Parameter_Specification -- A_Formal_Object_Declaration -- --|95------------------------------------------------------------------------- --|95 function Default_Kind was --|95 Generic_Formal_Subprogram_Default_Kind and moved from Asis.Declarations. ------------------------------------------------------------------------------ function Default_Kind (Declaration : in Asis.Generic_Formal_Parameter) return Asis.Default_Kinds; ------------------------------------------------------------------------------ -- Declaration - Specifies the element to query -- -- Returns the Default_Kinds value of the Declaration. -- -- Returns Not_A_Declaration for any unexpected element such as a -- Nil_Element, A_Definition, or A_Statement. -- -- Expected Declaration_Kinds: -- A_Formal_Function_Declaration -- A_Formal_Procedure_Declaration -- --|95------------------------------------------------------------------------- --|95 function Definition_Kind is new. ------------------------------------------------------------------------------ function Definition_Kind (Definition : in Asis.Definition) return Asis.Definition_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the Definition to query -- -- Returns the Definition_Kinds value of the Definition. -- -- Returns Not_A_Definition for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Element_Kinds: -- A_Definition -- --|95------------------------------------------------------------------------- --|95 function Type_Kind was Kind and moved from Asis.Definitions. ------------------------------------------------------------------------------ function Type_Kind (Definition : in Asis.Type_Definition) return Asis.Type_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the Type_Definition to query -- -- Returns the Type_Kinds value of the Definition. -- -- Returns Not_A_Type_Definition for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Definition_Kinds: -- A_Type_Definition -- --|95------------------------------------------------------------------------- --|95 function Formal_Type_Kind is new. ------------------------------------------------------------------------------ function Formal_Type_Kind (Definition : in Asis.Formal_Type_Definition) return Asis.Formal_Type_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the Formal_Type_Definition to query -- -- Returns the Formal_Type_Kinds value of the Definition. -- -- Returns Not_A_Formal_Type_Definition for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Definition_Kinds: -- A_Formal_Type_Definition -- --|95------------------------------------------------------------------------- --|95 function Access_Type_Kind is new. ------------------------------------------------------------------------------ function Access_Type_Kind (Definition : in Asis.Access_Type_Definition) return Asis.Access_Type_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the Access_Type_Definition to query -- -- Returns the Access_Type_Kinds value of the Definition. -- -- Returns Not_An_Access_Type_Definition for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Type_Kinds: -- An_Access_Type_Definition -- --|95------------------------------------------------------------------------- --|95 function Root_Type_Kind is new. ------------------------------------------------------------------------------ function Root_Type_Kind (Definition : in Asis.Root_Type_Definition) return Asis.Root_Type_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the Root_Type_Definition to query -- -- Returns the Root_Type_Kinds value of the Definition. -- -- Returns Not_A_Root_Type_Definition for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Type_Kinds: -- A_Root_Type_Definition -- --|95------------------------------------------------------------------------- --|95 function Constraint_Kind was moved from Asis.Definitions. ------------------------------------------------------------------------------ function Constraint_Kind (Definition : in Asis.Constraint) return Asis.Constraint_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the constraint to query -- -- Returns the Constraint_Kinds value of the Definition. -- -- Returns Not_A_Constraint_Kind for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Definition_Kinds: -- A_Constraint -- --|95------------------------------------------------------------------------- --|95 function Discrete_Range_Kind was moved from Asis.Definitions. ------------------------------------------------------------------------------ function Discrete_Range_Kind (Definition : in Asis.Discrete_Range) return Asis.Discrete_Range_Kinds; ------------------------------------------------------------------------------ -- Definition - Specifies the discrete_range to query -- -- Returns the Discrete_Range_Kinds value of the Definition. -- -- Returns Not_A_Discrete_Range for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Definition_Kinds: -- A_Discrete_Subtype_Definition -- A_Discrete_Range -- --|95------------------------------------------------------------------------- --|95 function Expression_Kind was Kind and moved from Asis.Expressions. ------------------------------------------------------------------------------ function Expression_Kind (Expression : in Asis.Expression) return Asis.Expression_Kinds; ------------------------------------------------------------------------------ -- Expression - Specifies the Expression to query -- -- Returns the Expression_Kinds value of the Expression. -- -- Returns Not_An_Expression for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Element_Kinds: -- An_Expression --|95------------------------------------------------------------------------- --|95 function Operator_Kind moved from Asis.Expressions. ------------------------------------------------------------------------------ function Operator_Kind (Element : in Asis.Element) return Asis.Operator_Kinds; ------------------------------------------------------------------------------ -- Element - Specifies the Element to query -- -- Returns the Operator_Kinds value of the A_Defining_Name or An_Expression -- element. -- -- Returns Not_An_Operator for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Defining_Name_Kinds: -- A_Defining_Operator_Symbol -- -- Expected Expression_Kinds: -- An_Operator_Symbol -- --|95------------------------------------------------------------------------- --|95 function Attribute_Kind moved from Asis.Expressions. ------------------------------------------------------------------------------ function Attribute_Kind (Expression : in Asis.Expression) return Asis.Attribute_Kinds; ------------------------------------------------------------------------------ -- Expression - Specifies the Expression to query -- -- Returns the Attribute_Kinds value of the Expression. -- -- Returns Not_An_Attribute_Designator for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Expression_Kinds: -- An_Attribute_Reference -- --|95------------------------------------------------------------------------- --|95 function Association_Kind is new. ------------------------------------------------------------------------------ function Association_Kind (Association : in Asis.Association) return Asis.Association_Kinds; ------------------------------------------------------------------------------ -- Association - Specifies the Association to query -- -- Returns the Association_Kinds value of the Association. -- -- Returns Not_An_Association for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Element_Kinds: -- An_Association -- --|95------------------------------------------------------------------------- --|95 function Statement_Kind was Kind and moved from Asis.Statements. ------------------------------------------------------------------------------ function Statement_Kind (Statement : in Asis.Statement) return Asis.Statement_Kinds; ------------------------------------------------------------------------------ -- Statement - Specifies the element to query -- -- Returns the Statement_Kinds value of the statement. -- -- Returns Not_A_Statement for any unexpected element such as a -- Nil_Element, A_Definition, or A_Declaration. -- -- Expected Element_Kinds: -- A_Statement -- --|95------------------------------------------------------------------------- --|95 function Path_Kind is new. ------------------------------------------------------------------------------ function Path_Kind (Path : in Asis.Path) return Asis.Path_Kinds; ------------------------------------------------------------------------------ -- Path - Specifies the Path to query -- -- Returns the Path_Kinds value of the Path. -- -- Returns Not_An_Path for any unexpected element such as a -- Nil_Element, A_Statement, or A_Declaration. -- -- Expected Element_Kinds: -- A_Path -- --|95------------------------------------------------------------------------- --|95 function Clause_Kind is new. ------------------------------------------------------------------------------ function Clause_Kind (Clause : in Asis.Clause) return Asis.Clause_Kinds; ------------------------------------------------------------------------------ -- Clause - Specifies the element to query -- -- Returns the Clause_Kinds value of the Clause. -- -- Returns Not_A_Clause for any unexpected element such as a -- Nil_Element, A_Definition, or A_Declaration. -- -- Expected Element_Kinds: -- A_Clause -- --|95------------------------------------------------------------------------- --|95 function Representation_Clause_Kind moved from Asis.Clauses. ------------------------------------------------------------------------------ function Representation_Clause_Kind (Clause : in Asis.Representation_Clause) return Asis.Representation_Clause_Kinds; ------------------------------------------------------------------------------ -- Clause - Specifies the element to query -- -- Returns the Representation_Clause_Kinds value of the Clause. -- -- Returns Not_A_Representation_Clause for any unexpected element such as a -- Nil_Element, A_Definition, or A_Declaration. -- -- Expected Clause_Kinds: -- A_Representation_Clause -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the element to check -- -- Returns True if the program element is the Nil_Element. -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Element_List) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the element list to check -- -- Returns True if the element list has a length of zero. -- ------------------------------------------------------------------------------ function Is_Equal (Left : in Asis.Element; Right : in Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the left element to compare -- Right - Specifies the right element to compare -- -- Returns True if Left and Right represent the same physical element, -- from the same physical compilation unit. The two elements may or -- may not be from the same open ASIS Context variable. -- -- Implies: Is_Equal (Enclosing_Compilation_Unit (Left), -- Enclosing_Compilation_Unit (Right)) = True -- ------------------------------------------------------------------------------ function Is_Identical (Left : in Asis.Element; Right : in Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the left element -- Right - Specifies the right element -- -- Returns True if Left and Right represent the same physical element, -- from the same physical compilation unit, from the same open ASIS -- Context variable. -- -- Implies: Is_Identical (Enclosing_Compilation_Unit (Left), -- Enclosing_Compilation_Unit (Right)) = True -- --|95------------------------------------------------------------------------- --|95 function Is_Part_Of_Implicit moved from Asis.Declarations. ------------------------------------------------------------------------------ function Is_Part_Of_Implicit (Element : in Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns True for any Element that is, or that forms part of, any -- implicitly declared or specified program Element structure. -- -- Returns False for a Nil_Element, or any Element that correspond to text -- which was actually specified explicitly (typed, entered, written). -- -- Generic instance specifications and bodies, while implicit, are treated -- as a special case. These elements will not normally test as -- Is_Part_Of_Implicit. Rather, they are Is_Part_Of_Instance. They only test -- as Is_Part_Of_Implicit if one of the following rules applies. This is -- done so that it is possible to determine whether a declaration, which -- happens to occur within an instance, is actually an implicit result of -- another declaration which occurs explicitly within the generic template. -- -- Implicit Elements are those that represent these portions of the Ada -- language: -- -- RM 95 4.5.(9) - All predefined operator declarations and their -- component elements are Is_Part_Of_Implicit -- RM 95 3.4(16) - Implicit predefined operators of the derived type. -- RM 95 3.4(17-22) - Implicit inherited subprogram declarations and their -- component elements are Is_Part_Of_Implicit -- RM 95 6.4(9) - Implicit actual parameter expressions (defaults). -- - The A_Parameter_Association that includes a defaulted -- parameter value Is_Normalized and also -- Is_Part_Of_Implicit. The Formal_Parameter and the -- Actual_Parameter values from such Associations are not -- Is_Part_Of_Implicit unless they are from default -- initializations for an inherited subprogram declaration -- and have an Enclosing_Element that is the parameter -- specification of the subprogram declaration. (Those -- elements are shared with (were created by) the original -- subprogram declaration.) -- - All A_Parameter_Associations from a Normalized list are -- Is_Part_Of_Implicit. -- RM 95 6.6 (6) - Inequality operator declarations for limited private -- types are Is_Part_Of_Implicit. -- - Depending on the ASIS implementation, a "/=" appearing -- in the compilation may result in a "NOT" and an "=" in -- the internal representation. These two elements would -- test as Is_Part_Of_Implicit because they do not represent -- actual text from the original compilation text. -- RM 95 12.3 (16) - implicit generic instance specifications and bodies -- are not Is_Part_Of_Implicit; they are Is_Part_Of_Instance -- and are only implicit if some other rule makes them so -- --|95------------------------------------------------------------------------- --|95 function Is_Part_Of_Inherited was called Is_Part_Of_Derived and --|95 moved from Asis.Declarations. ------------------------------------------------------------------------------ function Is_Part_Of_Inherited (Element : in Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns True for any Element that is, or that forms part of, an -- inherited primitive subprogram declaration. -- -- Returns False for any other Element including a Nil_Element. -- --|95------------------------------------------------------------------------- --|95 function Is_Part_Of_Instance moved from Asis.Declarations. ------------------------------------------------------------------------------ function Is_Part_Of_Instance (Element : Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Element - Specifies the element to test -- -- Returns True if the Element is part of an implicit generic specification -- instance or an implicit generic body instance. -- -- Returns False for explicit, inherited, and predefined Elements that are -- not the result of a generic expansion. -- -- Returns False for a Nil_Element. -- -- Instantiations are not themselves Is_Part_Of_Instance unless they are -- encountered while traversing a generic instance. -- --|95------------------------------------------------------------------------- --|95 Traverse_Control - Semantics of the control are more precisely defined. --|95 Abandon_Siblings Prevents traversal of the current element's children --|95 as well as its remaining siblings. ------------------------------------------------------------------------------ -- Traverse_Control - controls for the traversal generic ------------------------------------------------------------------------------ type Traverse_Control is ( Continue, -- Continues the normal depth-first traversal. Abandon_Children, -- Prevents traversal of the current element's -- children. Abandon_Siblings, -- Prevents traversal of the current element's -- children and remaining siblings. Terminate_Immediately); -- Does exactly that. generic type State_Information is limited private; with procedure Pre_Operation (Element : in Asis.Element; Control : in out Traverse_Control; State : in out State_Information) is <>; with procedure Post_Operation (Element : in Asis.Element; Control : in out Traverse_Control; State : in out State_Information) is <>; procedure Traverse_Element (Element : in Asis.Element; Control : in out Traverse_Control; State : in out State_Information); ------------------------------------------------------------------------------ -- Element - Specifies the initial element in the traversal -- Control - Specifies what next to do with the traversal -- State_Information - Specifies other information for the traversal -- -- Traverses the element and all its component elements, if any. -- Component elements are all elements that can be obtained by a combination -- of the ASIS structural queries appropriate for the given element. -- -- If an element has one or more component elements, each is called a child -- element. An element's parent element is its Enclosing_Element. Children -- with the same parent are sibling elements. The type Traverse_Control uses -- the terms children and siblings to control the traverse. -- -- For each element, the formal procedure Pre_Operation is called when first -- visiting the element. Each of that element's children are then visited -- and finally the formal procedure Post_Operation is called for the element. -- -- The order of Element traversal is in terms of the textual representation of -- the Elements. Elements are traversed in left-to-right and top-to-bottom -- order. -- -- Traversal of Implicit Elements: -- -- Implicit elements are not traversed by default. However, they may be -- explicitly queried and then passed to the traversal instance. Implicit -- elements include implicit predefined operator declarations, implicit -- inherited subprogram declarations, implicit expanded generic specifications -- and bodies, default expressions supplied to procedure, function, and entry -- calls, etc. -- -- Applications that wish to traverse these implicit Elements must query for -- them at the appropriate places in a traversal and then recursively call -- their instantiation of the traversal generic. (Implicit elements provided -- by ASIS do not cover all posible Ada implicit constructs. For example, -- implicit initializations for variables of an access type are not provided -- by ASIS.) -- -- Traversal of Association lists: -- -- Argument and association lists for procedure calls, function calls, entry -- calls, generic instantiations, and aggregates are traversed in their -- unnormalized forms, as if the Normalized parameter was False for those -- queries. Implementations that always normalize certain associations may -- return Is_Normalized associations. See the Implementation Permissions -- for the queries Discriminant_Associations, Generic_Actual_Part, -- Call_Statement_Parameters, Record_Component_Associations, or -- Function_Call_Parameters. -- -- Applications that wish to explicitly traverse normalized associations can -- do so by querying the appropriate locations in order to obtain the -- normalized list. The list can then be traversed by recursively calling -- the traverse instance. Once that sub-traversal is finished, the Control -- parameter can be set to Abandon_Children to skip processing of the -- unnormalized argument list. -- -- Traversal can be controlled with the Control parameter. -- -- A call to an instance of Traverse_Element will not result in calls to -- Pre_Operation or Post_Operation unless Control is set to Continue. -- -- The actual subprograms matching Pre_Operation and Post_Operation can set -- their Control parameter to affect the traverse: -- -- Continue -- Continues the normal depth-first traversal. -- -- Abandon_Children -- Prevents traversal of the current element's -- -- children. -- -- -- -- If set in a Pre_Operation, traversal picks up -- -- with the next sibling element of the current -- -- element. -- -- -- -- If set in a Post_Operation, this is the -- -- same as Continue, all children will already -- -- have been traversed. Traversal picks up with -- -- the Post_Operation of the parent. -- -- Abandon_Siblings -- Prevents traversal of the current element's -- -- children and remaining siblings. -- -- -- -- If set in a Pre_Operation, this abandons the -- -- associated Post_Operation for the current -- -- element. Traversal picks up with the -- -- Post_Operation of the parent. -- -- -- -- If set in a Post_Operation, traversal picks -- -- up with the Post_Operation of the parent. -- -- Terminate_Immediately -- Does exactly that. -- -- Raises Asis_Inappropriate_Element if the element is a Nil_Element -- ------------------------------------------------------------------------------ function Enclosing_Element (Element : in Asis.Element) return Asis.Element; function Enclosing_Element (Element : in Asis.Element; Element_Context : in Asis.Element) return Asis.Element; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- Element_Context - Specifies a context expected to contain the element -- -- Returns the Element that immediately encloses the given element. This -- query is intended to exactly reverse any single parent-to-child element -- traversal. For any structural query that returns a subcomponent of an -- element (or that returns a list of subcomponents), the original element -- can be determined by passing the subcomponent element to this query. -- Note: Semantic queries (queries that test the meaning of a program rather -- than its structure) return Elements that usually do not have the original -- argument Element as their parent. -- -- Returns a Nil_Element if: -- -- - the element is the declaration part of a compilation unit -- (Unit_Declaration). -- -- - the element is with clause or use clause of a context clause -- (Context_Clause_Elements). -- -- - the element is a pragma for a compilation unit -- (Compilation_Pragmas and Context_Clause_Elements). -- -- Use Enclosing_Compilation_Unit to get the enclosing compilation unit for -- any element value other than Nil_Element. -- -- Raises Asis_Inappropriate_Element if the Element is a Nil_Element. -- -- Examples: -- -- Given a A_Declaration/A_Full_Type_Declaration in the declarative region -- of a block statement, returns the A_Statement/A_Block_Statement Element -- that encloses the type declaration. -- -- Given A_Statement, from the sequence of statements within a loop -- statement, returns the enclosing A_Statement/A_Loop_Statement. -- -- Given the An_Expression/An_Identifier selector from an expanded name, -- returns the An_Expression/A_Selected_Component that represents the -- combination of the prefix, the dot, and the selector. -- --|AN Application Note: --|AN --|AN The optional Element_Context parameter is used only to optimize --|AN this query. This speed up is only present for ASIS implementations --|AN where the underlying vendor environment does not have "parent pointers". --|AN For these implementations, this query is implemented as a "search". --|AN The Enclosing_Compilation_Unit is searched for the argument Element. --|AN The Element_Context parameter provides a means of shortening the search. --|AN Note: If the argument Element is not a sub-element of the Element_Context --|AN parameter, or if the Element_Context is a Nil_Element, the result of the --|AN call will be a Nil_Element. --|AN --|AN Implementations that do not require the Element_Context parameter may --|AN ignore it. They are encouraged, but not required, to test the --|AN Element_Context parameter and to determine if it is an invalid Element --|AN value (its associated Environment Context may be closed). --|AN --|AN Portable applications should not use the Element_Context parameter since --|AN if may lead to unexpected differences when porting an application --|AN between ASIS implementations where one implementation uses the --|AN parameter and the other implementation does not. Passing a "wrong" --|AN Element_Context to an implementation that ignores it, is harmless. --|AN Passing a "wrong" Element_Context to an implementation that may utilize --|AN it, can lead to an unexpected Nil_Element result. --|AN --|95------------------------------------------------------------------------- --|95 function Enclosing_Generic was moved from Asis.Declarations. ------------------------------------------------------------------------------ function Enclosing_Generic (Element : Asis.Element) return Asis.Element; ------------------------------------------------------------------------------ -- Element - Specifies an Element that may be part of a generic declaration -- or the body of a generic declaration -- -- Returns the generic declaration, or the generic body declaration, that -- encloses the given Element. -- -- Returns a Nil_Element if the Element is not part of any generic declaration -- or body. -- -- Raises Asis_Inappropriate_Element when given a Nil_Element. -- ------------------------------------------------------------------------------ function Pragmas (Element_Context : in Asis.Element) return Asis.Pragma_Element_List; ------------------------------------------------------------------------------ -- Element_Context - Specifies the element to query -- -- Returns the list of pragmas, in their order of appearance, that appear -- directly within the given Element_Context. Returns only those pragmas -- that are immediate component elements of the given Element_Context. -- Pragmas embedded within other component elements are not returned. -- For example, returns the pragmas in a package specification, in the -- statement list of a loop, or in a record component list. -- -- This query returns exactly those pragmas that would be returned by the -- various queries, that accept these same argument kinds, and that -- return Declaration_Lists and Statement_Lists, where the inclusion of -- Pragmas is controlled by an Include_Pragmas parameter. -- -- Returns a Nil_Element_List if there are no pragmas. -- -- Appropriate Element_Kinds: -- A_Path (pragmas from the statement list + -- pragmas immediately preceding the -- reserved word WHEN of the first -- alternative) -- An_Exception_Handler (pragmas from the statement list + -- pragmas immediately preceding the -- reserved word WHEN of the first -- exception handler) -- -- Appropriate Declaration_Kinds: -- A_Procedure_Body_Declaration (pragmas from decl region + statements) -- A_Function_Body_Declaration (pragmas from decl region + statements) -- A_Package_Declaration (pragmas from visible + private decl -- regions) -- A_Package_Body_Declaration (pragmas from decl region + statements) -- A_Task_Body_Declaration (pragmas from decl region + statements) -- A_Protected_Body_Declaration (pragmas from decl region) -- An_Entry_Body_Declaration (pragmas from decl region + statements) -- A_Generic_Procedure_Declaration (pragmas from formal decl region) -- A_Generic_Function_Declaration (pragmas from formal decl region) -- A_Generic_Package_Declaration (pragmas from formal + visible + -- private decl regions) -- -- Appropriate Definition_Kinds: -- A_Record_Definition (pragmas from the component list) -- A_Variant_Part (pragmas immediately preceding the -- first reserved word WHEN + between -- variants) -- A_Variant (pragmas from the component list) -- A_Task_Definition (pragmas from visible + private -- decl regions) -- A_Protected_Definition (pragmas from visible + private -- decl regions) -- -- Appropriate Statement_Kinds: -- A_Loop_Statement (pragmas from statement list) -- A_While_Loop_Statement (pragmas from statement list) -- A_For_Loop_Statement (pragmas from statement list) -- A_Block_Statement (pragmas from decl region + statements) -- An_Accept_Statement (pragmas from statement list + -- -- Appropriate Representation_Clause_Kinds: -- A_Record_Representation_Clause (pragmas from component specifications) -- -- Returns Element_Kinds: -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Pragmas was called Associated_Pragmas. ------------------------------------------------------------------------------ function Corresponding_Pragmas (Element : in Asis.Element) return Asis.Pragma_Element_List; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the list of pragmas semantically associated with the given element, -- in their order of appearance, or, in any order that does not affect their -- relative interpretations. These are pragmas that directly affect the -- given element. For example, a pragma PACK affects the type it names. -- -- Returns a Nil_Element_List if there are no semantically associated pragmas. -- --|AN Application Note: --|AN --|AN If the argument is a inherited entry declaration from a derived task --|AN type, all pragmas returned will be elements taken from the original task --|AN type's declarative item list. Their Enclosing_Element is the original --|AN type definition and not the derived type definition. --|AN -- Appropriate Element_Kinds: -- A_Declaration -- A_Statement -- -- Returns Element_Kinds: -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 function Is_Predefined for pragmas was deleted. Reason: HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Pragma_Name_Image was called Name. ------------------------------------------------------------------------------ function Pragma_Name_Image (Pragma_Element : in Asis.Pragma_Element) return String; ------------------------------------------------------------------------------ -- Pragma_Element - Specifies the element to query -- -- Returns the Sting image of the simple name of the pragma. -- -- The case of names returned by this query may vary between vendors. -- Vendors are encouraged, but not required, to return names in the same case -- as was used in the original compilation text. -- -- Appropriate Element_Kinds: -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 function Pragma_Argument_Associations was called Argument_Associations. ------------------------------------------------------------------------------ function Pragma_Argument_Associations (Pragma_Element : in Asis.Pragma_Element) return Asis.Association_List; ------------------------------------------------------------------------------ -- Pragma_Element - Specifies the element to query -- -- Returns a list of the pragma_argument_associations of the pragma, in their -- order of appearance. -- -- Appropriate Element_Kinds: -- A_Pragma -- -- Returns Element_Kinds: -- A_Pragma_Argument_Association -- ------------------------------------------------------------------------------ function Debug_Image (Element : in Asis.Element) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Element - Specifies the program element to convert -- -- Returns an Asis_String value containing implementation defined debug -- information associated with the element. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS vendor. They can be presumed -- to contain information useful when debugging the implementation itself. -- They are also suitable for use by the ASIS application when printing simple -- application debugging messages during application development. They are -- intended to be, to some worthwhile degree, intelligible to the user. -- --|95------------------------------------------------------------------------- --|95 function Hash was moved out of the nested package Operations. ------------------------------------------------------------------------------ generic type Asis_Hash is range <>; function Hash (Element : in Asis.Element) return Asis_Hash; --|OP------------------------------------------------------------------------- --|OP Hash needs a complete description. This will be vendor-dependent. --|95------------------------------------------------------------------------- --|95 package Operations was deleted. Kind declaration in new package. ------------------------------------------------------------------------------ end Asis.Elements; ------------------------------------------------------------------------------ package Asis.Declarations is ------------------------------------------------------------------------------ -- Asis.Declarations - ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of queries that operate on A_Defining_Name -- and A_Declaration elements. --|95------------------------------------------------------------------------- --|95 --|95 Changes to package Asis_Declarations. --|95 --|95------------------------------------------------------------------------- --|95 function Kind called Declaration_Kind and moved to Asis.Elements --|95------------------------------------------------------------------------- --|95 function Origin called Declaration_Origin and moved to Asis.Elements --|ER------------------------------------------------------------------------- --|ER A_Declaration - 3.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR ------------------------------------------------------------------------------ function Names (Declaration : in Asis.Declaration) return Asis.Defining_Name_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the element to query -- -- Returns a list of names defined by the declaration, in their order of -- appearance. Declarations that define a single name will return a list of -- length one. -- -- Examples: -- type Foo is (Pooh, Baah); -- -- Returns a list containing one A_Defining_Name: Foo. -- -- One, Uno : constant Integer := 1; -- -- Returns a list of two A_Defining_Name elements: One and Uno. -- -- Function designators that define operators are A_Defining_Operator_Symbol. -- -- Results of this query may vary across ASIS implementations. Some -- implementations may normalize all multi-name declarations into an -- equivalent series of corresponding single name declarations. For those -- implementations, this query will always return a list containing a single -- name. See RM 95 3.3.1(7). -- -- Appropriate Element_Kinds: -- A_Declaration -- -- Returns Element_Kinds: -- A_Defining_Name -- --|ER------------------------------------------------------------------------- --|ER A_Defining_Name - 3.1 --|ER------------------------------------------------------------------------- --|ER A_Defining_Identifier - 3.1 - no child elements --|ER A_Defining_Operator_Symbol - 6.1 - no child elements --|ER --|ER String image returned by: --|ER function Name --|95------------------------------------------------------------------------- --|95 function Defining_Name_Image is a new query specific to A_Defining_Name --|95 elements ------------------------------------------------------------------------------ function Defining_Name_Image (Defining_Name : in Asis.Defining_Name) return String; ------------------------------------------------------------------------------ -- Defining_Name - Specifies the element to query -- -- Returns the String image of the name. Embedded quotes (for operator -- designator strings) are doubled. -- -- A_Defining_Identifier elements are simple identifier names "Abc" (name Abc). -- -- A_Defining_Operator_Symbol elements have names with embedded quotes -- """abs""" (function "abs"). -- -- A_Defining_Character_Literal elements have names with embedded apostrophes -- "'x'" (literal 'x'). -- -- A_Defining_Enumeration_Literal elements have simple identifier names -- "Blue" (literal Blue). -- -- A_Defining_Expanded_Name elements are prefix.selector names "A.B.C" -- (name A.B.C). -- -- The case of names returned by this query may vary between vendors. -- Vendors are encouraged, but not required, to return names in the same case -- as was used in the original compilation text. -- -- Appropriate Element_Kinds: -- A_Defining_Name -- --|ER------------------------------------------------------------------------- --|ER A_Defining_Character_Literal - 3.5.1 - no child elements --|ER A_Defining_Enumeration_Literal - 3.5.1 - no child elements --|ER --|ER String image returned by: --|ER function Name --|ER --|ER String image of enumeration_literal value returned by: --|ER function Position_Number_Image --|ER function Representation_Value_Image --|95------------------------------------------------------------------------- --|95 function Position_Number_Image was moved from Asis.Expressions and --|95 works on A_Defining_Name elements only. ------------------------------------------------------------------------------ function Position_Number_Image (Defining_Name : in Asis.Defining_Name) return String; ------------------------------------------------------------------------------ -- Expression - Specifies the literal expression to query -- -- Returns the String image of the position number of the value of the -- enumeration_literal. -- -- The string returned is the image of the universal_integer value that would -- be returned by the attribute 'Pos if it were applied to the value. -- For example: Integer'Image(Color'Pos(Blue)). -- -- Appropriate Defining_Name_Kinds: -- A_Defining_Character_Literal -- A_Defining_Enumeration_Literal -- --|95------------------------------------------------------------------------- --|95 function Representation_Value_Image was moved from Asis.Expressions and --|95 works on A_Defining_Name elements only. ------------------------------------------------------------------------------ function Representation_Value_Image (Defining_Name : in Asis.Defining_Name) return String; ------------------------------------------------------------------------------ -- Expression - Specifies the literal expression to query -- -- Returns the String image of the internal code for the enumeration_literal. -- -- If a representation_clause is defined for the enumeration type then the -- string returned is the Integer'Image of the corresponding value given in -- the enumeration_aggregate. Otherwise, the string returned is the same as -- the Position_Number_Image. -- -- Appropriate Defining_Name_Kinds: -- A_Defining_Character_Literal -- A_Defining_Enumeration_Literal -- --|ER------------------------------------------------------------------------- --|ER A_Defining_Expanded_Name - 6.1 --|ER --|ER String image returned by: --|ER function Name --|CR --|CR Child elements returned by: --|CR function Defining_Prefix --|CR function Defining_Selector --|95------------------------------------------------------------------------- --|95 Defining_Prefix is a new query ------------------------------------------------------------------------------ function Defining_Prefix (Defining_Name : in Asis.Defining_Name) return Asis.Name; ------------------------------------------------------------------------------ -- Defining_Name - Specifies the element to query -- -- Returns the element that forms the prefix of the name. The prefix is the -- name to the left of the rightmost 'dot' in the expanded name. -- The Defining_Prefix of A.B is A, and of A.B.C is A.B. -- -- Appropriate Defining_Name_Kinds: -- A_Defining_Expanded_Name -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- --|95------------------------------------------------------------------------- --|95 Defining_Selector is a new query ------------------------------------------------------------------------------ function Defining_Selector (Defining_Name : in Asis.Defining_Name) return Asis.Defining_Name; ------------------------------------------------------------------------------ -- Defining_Name - Specifies the element to query -- -- Returns the element that forms the selector of the name. The selector is -- the name to the right of the rightmost 'dot' in the expanded name. -- The Defining_Selector of A.B is B, and of A.B.C is C. -- -- Appropriate Defining_Name_Kinds: -- A_Defining_Expanded_Name -- -- Returns Defining_Name_Kinds: -- A_Defining_Identifier -- --|ER------------------------------------------------------------------------- --|ER An_Ordinary_Type_Declaration - 3.2.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Discriminant_Part --|CR function Type_Declaration_View --|95------------------------------------------------------------------------- --|95 function Discriminant_Part is a new query; an intermediate step --|95 before the Asis.Definitions.Discriminants query. ------------------------------------------------------------------------------ function Discriminant_Part (Declaration : in Asis.Declaration) return Asis.Definition; ----------------------------------------------------------------------------- -- Declaration - Specifies the type declaration to query -- -- Returns the discriminant_part, if any, from the type_declaration or -- formal_type_declaration. -- -- Returns a Nil_Element if the Declaration has no explicit discriminant_part. -- -- Appropriate Declaration_Kinds: -- 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_Formal_Type_Declaration -- -- Returns Definition_Kinds: -- Not_A_Definition -- An_Unknown_Discriminant_Part -- A_Known_Discriminant_Part -- --|95------------------------------------------------------------------------- --|95 Type_Declaration_Definition was deleted. Reason: REPLACED. --|95 The new query Type_Declaration_View provides equivalent functionality --|95 with added definition for task and protected elements. ------------------------------------------------------------------------------ function Type_Declaration_View (Declaration : in Asis.Declaration) return Asis.Definition; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration element to query -- -- Returns the definition characteristics that form the view of the -- type_declaration. The view is the remainder of the declaration following -- the reserved word IS. -- -- For a full_type_declaration, returns the type_definition, task_definition, -- or protected_definition following the reserved word IS in the declaration. -- -- Returns a Nil_Element for a task_type_declaration that has no explicit -- task_definition. -- -- For a private_type_declaration or private_extension_declaration, returns -- the definition element representing the private decalration view. -- -- For a subtype_declaration, returns the subtype_indication. -- -- For a formal_type_declaration, returns the formal_type_definition. -- -- Appropriate Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- -- Returns Definition_Kinds: -- Not_A_Definition -- A_Type_Definition -- A_Subtype_Indication -- A_Private_Type_Definition -- A_Tagged_Private_Type_Definition -- A_Private_Extension_Definition -- A_Task_Definition -- A_Protected_Definition -- A_Formal_Type_Definition -- --|ER------------------------------------------------------------------------- --|ER A_Subtype_Declaration - 3.2.2 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Type_Declaration_View --|ER------------------------------------------------------------------------- --|ER A_Variable_Declaration - 3.3.1 --|CR --|CR Child elements: --|CR function Names --|CR function Object_Declaration_View --|CR function Initial_Value --|95------------------------------------------------------------------------- --|95 Object_Declaration_Definition was deleted. Reason: REPLACED. --|95 The new query Object_Declaration_View provides equivalent functionality --|95 with added definition for single task and single protected elements ------------------------------------------------------------------------------ function Object_Declaration_View (Declaration : in Asis.Declaration) return Asis.Definition; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration element to query -- -- Returns the definition characteristics that form the view of the -- object_declaration. The view is the subtype_indication or full type -- definition of the object_declaration. An initial value, if any, is not -- part of this view. -- -- For a single_task_declaration or single_protected_declaration, returns -- the task_definition or protected_definition following the reserved word IS. -- -- Returns a Nil_Element for a single_task_declaration that has no explicit -- task_definition. -- -- For a component_declaration, returns the component_definition following -- the colon. -- -- For all other object_declaration variables or constants, returns the -- subtype_indication or array_type_definition following the colon. -- -- Appropriate Declaration_Kinds: -- A_Variable_Declaration -- A_Constant_Declaration -- A_Deferred_Constant_Declaration -- A_Single_Protected_Declaration -- A_Single_Task_Declaration -- A_Component_Declaration -- -- Returns Definition_Kinds: -- Not_A_Definition -- A_Type_Definition -- Returns Type_Kinds: -- A_Constrained_Array_Definition -- A_Subtype_Indication -- A_Task_Definition -- A_Protected_Definition -- A_Component_Definition -- --|95------------------------------------------------------------------------- --|95 function Is_Initialized was deleted. Reason SECONDARY. The presence --|95 of an initial value expression can be determined by Initial_Value. ------------------------------------------------------------------------------ function Initial_Value (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the object declaration to query -- -- Returns the initialization expression [:= expression] of the declaration. -- -- Returns a Nil_Element if the declaration does not include an explicit -- initialization. -- -- Appropriate Declaration_Kinds: -- A_Variable_Declaration -- A_Constant_Declaration -- An_Integer_Number_Declaration -- A_Real_Number_Declaration -- A_Discriminant_Specification -- A_Component_Declaration -- A_Parameter_Specification -- A_Formal_Object_Declaration -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression -- --|ER------------------------------------------------------------------------- --|ER A_Constant_Declaration - 3.3.1 --|CR --|CR Child elements: --|CR function Names --|CR function Object_Declaration_View --|CR function Initial_Value --|SR --|SR Semantic elements: --|SR function Corresponding_Constant_Declaration ------------------------------------------------------------------------------ function Corresponding_Constant_Declaration (Name : in Asis.Defining_Name) return Asis.Declaration; ------------------------------------------------------------------------------ -- Name - Specifies the name of a constant declaration to query -- -- Returns the corresponding full constant declaration when given the name -- from a deferred constant declaration. -- -- Returns the corresponding deferred constant declaration when given the name -- from a full constant declaration. -- -- Returns a Nil_Element if the deferred constant declaration is completed -- by a pragma Import. -- -- Returns a Nil_Element if the full constant declaration has no corresponding -- deferred constant declaration. -- -- Raises Asis_Inappropriate_Element with a Status of Value_Error if the -- argument is not the name of a constant or a deferred constant. -- -- The name of a constant declaration is available from both the Names and the -- Corresponding_Name_Definition queries. -- -- Appropriate Element_Kinds: -- A_Defining_Name -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Constant_Declaration -- A_Deferred_Constant_Declaration -- --|ER------------------------------------------------------------------------- --|ER A_Deferred_Constant_Declaration - 3.3.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Object_Declaration_View --|ER------------------------------------------------------------------------- --|ER An_Integer_Number_Declaration - 3.3.2 --|ER A_Real_Number_Declaration - 3.3.2 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Initial_Value --|ER------------------------------------------------------------------------- --|ER An_Enumeration_Literal_Specification - 3.5.1 --|CR --|CR Child elements returned by: --|CR function Names --|95------------------------------------------------------------------------- --|95 function Is_Character_Literal was deleted. Reason HIERARCHY. --|ER------------------------------------------------------------------------- --|ER A_Discriminant_Specification - 3.7 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Declaration_Subtype_Mark --|CR function Initial_Value --|95------------------------------------------------------------------------- --|95 function Declaration_Subtype_Mark is a new query replacing --|95 parts of Object_Declaration_Definition and Type_Mark functionality. ------------------------------------------------------------------------------ function Declaration_Subtype_Mark (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration element to query -- -- Returns the expression element that names the subtype_mark of the -- declaration. -- -- Appropriate Declaration_Kinds: -- A_Discriminant_Specification -- A_Parameter_Specification -- A_Formal_Object_Declaration -- An_Object_Renaming_Declaration -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- --|ER------------------------------------------------------------------------- --|ER A_Component_Declaration - 3.8 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Object_Declaration_View --|CR function Initial_Value --|ER------------------------------------------------------------------------- --|ER An_Incomplete_Type_Declaration - 3.10.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Discriminant_Part --|95------------------------------------------------------------------------- --|95 function Is_Variable was deleted. Reason HIERARCHY. --|95 function Is_Constant was deleted. Reason HIERARCHY. --|95 function Is_Type_Declaration was deleted. Reason HIERARCHY. --|95 function Is_Private was deleted. Reason HIERARCHY and ILL_DEFINED. --|95 function Is_Limited was deleted Reason HIERARCHY and ILL_DEFINED. --|95------------------------------------------------------------------------- --|95 function Is_Discriminated was deleted. Reason REPLACED. --|95------------------------------------------------------------------------- --|95 function Discriminants on A_Declaration was deleted. Reason REPLACED. --|95 Discriminants are obtained from A_Declaration elements using --|95 Discriminant_Part and the new function Discriminants that operates on --|95 A_Known_Discriminant_Part element. ------------------------------------------------------------------------------ function Corresponding_Type_Declaration (Declaration : in Asis.Declaration) return Asis.Declaration; function Corresponding_Type_Declaration (Declaration : in Asis.Declaration; Context : in Asis.Context) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the type declaration to query -- Context - Specifies the program Context to use for obtaining package -- body information -- -- Returns the corresponding full type declaration when given a private or -- incomplete type declaration. Returns the corresponding private or -- incomplete type declaration when given a full type declaration. -- -- These two function calls will always produce identical results: -- -- Decl2 := Corresponding_Type_Declaration( Decl1 ); -- Decl2 := Corresponding_Type_Declaration -- ( Decl1, -- Enclosing_Context( Enclosing_Compilation_Unit( Decl1 ))); -- -- Returns a Nil_Element when a full type declaration is given that has no -- corresponding private or incomplete type declaration, or when a -- corresponding type declaration does not exist within the given Context -- context. -- -- The Context parameter is used whenever the corresponding full type of -- an incomplete type is in a corresponding package body. See RM 95 3.10.1(3). -- Any non-Nil result will always have the given Context as its -- Enclosing_Context. -- -- Appropriate Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- An_Incomplete_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- An_Incomplete_Type_Declaration -- A_Private_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 function Is_Part_Of_Implicit moved to Asis.Elements. --|95 function Is_Part_Of_Inherited was called Is_Part_Of_Derived and --|95 moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Implicit_Inherited_Subprograms was called --|95 Implicit_Derived_Subprograms and moved to Asis.Definitions. --|95 function Implicit_Attribute_Functions was deleted. Reason OBSOLETE. --|95 function Type_Operators moved to Asis.Definitions and is now called --|95 Corresponding_Type_Operators. --|95------------------------------------------------------------------------- --|95 function Base_Type is now called Corresponding_First_Subtype and --|95 works on A_Declaration elements returning A_Declaration. ------------------------------------------------------------------------------ function Corresponding_First_Subtype (Declaration : in Asis.Declaration) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the subtype_declaration to query -- -- This function recursively unwinds subtyping to return at a type_declaration -- that defines the first subtype of the argument. -- -- Returns a declaration that Is_Equal to the argument if the argument is -- already the first subtype. -- -- Appropriate Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Formal_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 function Last_Constraint is now called Corresponding_Last_Constraint --|95 and works on A_Declaration elements returning A_Declaration. ------------------------------------------------------------------------------ function Corresponding_Last_Constraint (Declaration : in Asis.Declaration) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the subtype_declaration or type_declaration to -- query -- -- This function recursively unwinds subtyping to return at a declaration -- that is either a type_declaration or subtype_declaration that imposes -- an explicit constraint on the argument. -- -- Unwinds a minimum of one level of subtyping even if an argument declaration -- itself has a constraint. -- -- Returns a declaration that Is_Equal to the argument if the argument is -- a type_decalration, i.e. the first subtype. -- -- Appropriate Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 function Last_Subtype is now called Corresponding_Last_Subtype --|95 and works on A_Declaration elements returning A_Declaration. ------------------------------------------------------------------------------ function Corresponding_Last_Subtype (Declaration : in Asis.Declaration) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the subtype_declaration or type_declaration to -- query -- -- This function unwinds subtyping a single level to arrive at a declaration -- that is either a type_declaration or subtype_declaration. -- -- Returns a declaration that Is_Equal to the argument if the argument is -- a type_decalration, i.e. the first subtype. -- -- Appropriate Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 Associated_Representation_Clauses is called --|95 Corresponding_Representation_Clauses and moved to Asis.Declarations ------------------------------------------------------------------------------ function Corresponding_Representation_Clauses (Declaration : in Asis.Declaration) return Asis.Representation_Clause_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration to query -- -- Returns all representation_clauses that apply to the declaration. -- -- Returns a Nil_Element_List if no clauses apply to the declaration. -- -- The clauses returned may be the clauses applying to a parent_type if the -- type is a derived type with no explicit representation. These clauses -- are not Is_Part_Of_Implicit, they are the actual representation_clauses -- specified in conjunction with the declaration of the parent_type. -- -- All Declaration_Kinds are appropriate except Not_A_Declaration. -- -- Returns Clause_Kinds: -- Not_A_Clause -- A_Representation_Clause -- --|ER------------------------------------------------------------------------- --|ER A_Loop_Parameter_Specification - 5.5 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Specification_Subtype_Definition --|95------------------------------------------------------------------------- --|95 Specification_Subtype_Definition replaces Loop_Parameter_Range --|95 and works on entry index specification elements ------------------------------------------------------------------------------ function Specification_Subtype_Definition (Specification : in Asis.Declaration) return Asis.Discrete_Subtype_Definition; ------------------------------------------------------------------------------ -- Specification - Specifies the loop_parameter_specification or -- entry_index_specification to query -- -- Returns the discrete_subtype_definition of the specification. -- -- Appropriate Declaration_Kinds: -- A_Loop_Parameter_Specification -- An_Entry_Index_Specification -- -- Returns Definition_Kinds: -- A_Discrete_Subtype_Definition -- --|ER------------------------------------------------------------------------- --|ER A_Procedure_Declaration - 6.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|95------------------------------------------------------------------------- --|95 function Is_Specification was deleted. Reason HIERARCHY. --|95 function Is_Package was deleted. Reason HIERARCHY. --|95 function Is_Task was deleted. Reason HIERARCHY. --|95 function Is_Procedure was deleted. Reason HIERARCHY. --|95 function Is_Function was deleted. Reason HIERARCHY. --|95 function Is_Subprogram was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Parameter_Mode_Kind moved to Asis.Elements and is now called --|95 Mode_Kind. --|95------------------------------------------------------------------------- --|95 function Parameters is now called Parameter_Profile. ------------------------------------------------------------------------------ function Parameter_Profile (Declaration : in Asis.Declaration) return Asis.Parameter_Specification_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the subprogram or entry declaration to query -- -- Returns a list of parameter specifications in the formal part of the -- subprogram or entry declaration, in their order of appearance. -- -- Returns a Nil_Element_List if the subprogram or entry has no -- parameters. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multiple name parameter specifications into -- an equivalent sequence of corresponding single name parameter -- specifications. See RM 95 3.3.1(7). -- -- Appropriate Declaration_Kinds: -- A_Procedure_Declaration -- A_Function_Declaration -- A_Procedure_Body_Declaration -- A_Function_Body_Declaration -- A_Procedure_Renaming_Declaration -- A_Function_Renaming_Declaration -- An_Entry_Declaration -- An_Entry_Body_Declaration -- A_Procedure_Body_Stub -- A_Function_Body_Stub -- A_Generic_Function_Declaration -- A_Generic_Procedure_Declaration -- A_Formal_Function_Declaration -- A_Formal_Procedure_Declaration -- -- Returns Declaration_Kinds: -- A_Parameter_Specification -- --|ER------------------------------------------------------------------------- --|ER A_Function_Declaration - 6.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Result_Profile --|95------------------------------------------------------------------------- --|95 function Return_Type is now called Result_Profile. --|95 An_Enumeration_Literal_Specification is not appropriate. ------------------------------------------------------------------------------ function Result_Profile (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the function declaration to query -- -- Returns the subtype mark expression for the return type for any function -- declaration. -- -- Appropriate Declaration_Kinds: -- A_Function_Declaration -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Generic_Function_Declaration -- A_Formal_Function_Declaration -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- --|ER------------------------------------------------------------------------- --|ER A_Parameter_Specification - 6.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Declaration_Subtype_Mark --|CR function Initial_Value --|ER------------------------------------------------------------------------- --|ER A_Procedure_Body_Declaration - 6.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Body_Declarative_Items --|CR function Body_Statements --|CR function Body_Exception_Handlers --|CR function Body_Block_Statement - obsolescent, not recommended --|95------------------------------------------------------------------------- --|95 function Subprogram_Body_Block was deleted. Reason REPLACED. --|95 function Package_Body_Block was deleted. Reason REPLACED. --|95 function Task_Body_Block was deleted. Reason REPLACED. --|95 The intermediate step of converting unit bodies to implicit --|95 block statements is eliminated. Child elements of unit bodies --|95 are returned by function Body_Declarative_Items, function --|95 Body_Statements, and function Body_Exception_Handlers. --|95------------------------------------------------------------------------- --|95 function Body_Declarative_Items is a new query. ------------------------------------------------------------------------------ function Body_Declarative_Items (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Element_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the body declaration to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of all basic declarations, representation specifications, -- use clauses, and pragmas in the declarative part of the body, in their -- order of appearance. -- -- Returns a Nil_Element_List if there are no declarative_items or pragmas. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name declarations into an -- equivalent sequence of corresponding single name object declarations. -- See RM 95 3.3.1(7). -- -- Appropriate Declaration_Kinds: -- A_Function_Body_Declaration -- A_Procedure_Body_Declaration -- A_Package_Body_Declaration -- A_Task_Body_Declaration -- A_Protected_Body_Declaration -- An_Entry_Body_Declaration -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause --|95------------------------------------------------------------------------- --|95 function Body_Statements is a new query. ------------------------------------------------------------------------------ function Body_Statements (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the body declaration to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the statements and pragmas for the body, in -- their order of appearance. -- -- Returns a Nil_Element_List if there are no statements or pragmas. -- -- Appropriate Declaration_Kinds: -- A_Function_Body_Declaration -- A_Procedure_Body_Declaration -- A_Package_Body_Declaration -- A_Task_Body_Declaration -- An_Entry_Body_Declaration -- -- Returns Element_Kinds: -- A_Pragma -- A_Statement -- --|95------------------------------------------------------------------------- --|95 function Body_Exception_Handlers is a new query. ------------------------------------------------------------------------------ function Body_Exception_Handlers (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Exception_Handler_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the body declaration to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the exception_handlers of the body, in their order of -- appearance. -- -- The only pragmas returned are those following the reserved word EXCEPTION -- and preceding the reserved word WHEN of first exception handler. -- -- Returns a Nil_Element_List if there are no exception_handlers or pragmas. -- -- Appropriate Declaration_Kinds: -- A_Function_Body_Declaration -- A_Procedure_Body_Declaration -- A_Package_Body_Declaration -- A_Task_Body_Declaration -- An_Entry_Body_Declaration -- -- Returns Element_Kinds: -- An_Exception_Handler -- A_Pragma -- --|ER------------------------------------------------------------------------- --|ER A_Function_Body_Declaration - 6.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Result_Profile --|CR function Body_Declarative_Items --|CR function Body_Statements --|CR function Body_Exception_Handlers --|CR function Body_Block_Statement - obsolescent, not recommended --|95------------------------------------------------------------------------- --|95 function Subprogram_Body_Block was deleted. Reason REPLACED. --|95 function Package_Body_Block was deleted. Reason REPLACED. --|95 function Task_Body_Block was deleted. Reason REPLACED. --|95 The new query function Body_Block_Statement supplies the equivalent --|95 combined functionality. This functionality is redundant with the new --|95 queries Body_Declarative_Items, Body_Statements, and --|95 Body_Exception_Handlers. Use of the query Body_Block_Statement is not --|95 recommended in new programs. --|95------------------------------------------------------------------------- --|95 function Body_Block_Statement is a new query that supplies the --|95 equivalent combined functionality of the replaced queries: --|95 Subprogram_Body_Block, Package_Body_Block, and Task_Body_Block. ------------------------------------------------------------------------------ function Body_Block_Statement (Declaration : in Asis.Declaration) return Asis.Statement; ------------------------------------------------------------------------------ -- Declaration - Specifies the program_unit body to query -- -- Returns a block statement that is the structural equivalent of the body. -- The block statement is not Is_Part_Of_Implicit. The block includes -- the declarative part, the sequence of statements, and any exception -- handlers. -- -- Appropriate Declaration_Kinds: -- A_Function_Body_Declaration -- A_Procedure_Body_Declaration -- A_Package_Body_Declaration -- A_Task_Body_Declaration -- An_Entry_Body_Declaration -- -- Returns Statement_Kinds: -- A_Block_Statement -- --|AN Application Note: --|AN --|AN This function is an obsolescent feature retained for compatibility with --|AN ASIS 83. It is never called by Traverse_Element. Use of this query is --|AN not recommended in new programs. --|AN ------------------------------------------------------------------------------ function Is_Name_Repeated (Declaration : in Asis.Declaration) return Boolean; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration to query -- -- Returns True if the name of the declaration is repeated after the END -- which terminates the declaration. -- -- Returns False for any unexpected Element. -- -- Expected Declaration_Kinds: -- A_Package_Declaration -- A_Package_Body_Declaration -- A_Procedure_Body_Declaration -- A_Function_Body_Declaration -- A_Generic_Package_Declaration -- A_Task_Type_Declaration -- A_Single_Task_Declaration -- A_Task_Body_Declaration -- A_Protected_Type_Declaration -- A_Single_Protected_Declaration -- A_Protected_Body_Declaration -- An_Entry_Body_Declaration -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Declaration was called --|95 Corresponding_Specification. The name and semantics have been changed --|95 to closely match the query Corresponding_Declaration for --|95 Compilation_Units. ------------------------------------------------------------------------------ function Corresponding_Declaration (Declaration : in Asis.Declaration) return Asis.Declaration; function Corresponding_Declaration (Declaration : in Asis.Declaration; Context : in Asis.Context) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the specification to query -- Context - Specifies a Context to use -- -- Returns the corresponding specification of a subprogram, package, or task -- body declaration. Returns the expanded generic specification template for -- generic instantiations. The argument may be a Unit_Declaration from a -- Compilation_Unit, or, it may be any appropriate body declaration from any -- declarative context. -- -- These two function calls will always produce identical results: -- -- Decl2 := Corresponding_Declaration (Decl1); -- Decl2 := Corresponding_Declaration -- (Decl1, -- Enclosing_Context( Enclosing_Compilation_Unit( Decl1 ))); -- -- If a specification declaration is given, the same element is returned, -- unless it is a generic instantiation or an inherited subprogram declaration -- (see below). -- -- Returns a Nil_Element if no explicit specification exists, or the -- declaration is the proper body of a subunit. -- -- The Context parameter is used to locate the corresponding specification -- within a particular Context. The Context need not be the Enclosing_Context -- of the Declaration. Any non-Nil result will always have the given Context -- as its Enclosing_Context. This implies that while a non-Nil result may be -- Is_Equal with the argument, it will only be Is_Identical if the -- Enclosing_Context of the Declaration is the same as the Context parameter. -- -- If a generic instantiation is given, the expanded generic specification -- template representing the instance is returned and Is_Part_Of_Instance. -- For example, an argument that is A_Package_Instantiation, results in a -- value that is A_Package_Declaration that can be analyzed with all -- appropriate queries. -- -- The Enclosing_Element of the expanded specification is the generic -- instantiation. The Enclosing_Compilation_Unit of the expanded template is -- that of the instantiation. -- -- If an inherited subprogram declaration is given, the specification -- returned is the one for the user-defined subprogram from which the -- argument was ultimately inherited. -- -- Appropriate Declaration_Kinds returning a specification: -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Instantiation -- A_Package_Body_Declaration -- A_Package_Body_Stub -- A_Package_Instantiation -- A_Procedure_Body_Declaration -- A_Procedure_Body_Stub -- A_Procedure_Instantiation -- A_Task_Body_Declaration -- A_Task_Body_Stub -- -- Appropriate Declaration_Kinds returning the argument Declaration: -- A_Function_Declaration -- A_Function_Renaming_Declaration -- A_Generic_Function_Declaration -- A_Generic_Package_Declaration -- A_Generic_Procedure_Declaration -- A_Package_Declaration -- A_Package_Renaming_Declaration -- A_Procedure_Declaration -- A_Procedure_Renaming_Declaration -- A_Single_Task_Declaration -- A_Task_Type_Declaration -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Declaration -- A_Function_Renaming_Declaration -- A_Generic_Function_Declaration -- A_Generic_Package_Declaration -- A_Generic_Procedure_Declaration -- A_Package_Declaration -- A_Package_Renaming_Declaration -- A_Procedure_Declaration -- A_Procedure_Renaming_Declaration -- A_Single_Task_Declaration -- A_Task_Type_Declaration -- ------------------------------------------------------------------------------ function Corresponding_Body (Declaration : in Asis.Declaration) return Asis.Declaration; function Corresponding_Body (Declaration : in Asis.Declaration; Context : in Asis.Context) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the specification to query -- Context - Specifies a Context to use -- -- Returns the corresponding body for a given subprogram, package, or task -- specification declaration. Returns the expanded generic body template for -- generic instantiations. The argument may be a Unit_Declaration from a -- Compilation_Unit, or, it may be any appropriate specification declaration -- from any declarative context. -- -- These two function calls will always produce identical results: -- -- Decl2 := Corresponding_Body (Decl1); -- Decl2 := Corresponding_Body -- (Decl1, -- Enclosing_Context( Enclosing_Compilation_Unit( Decl1 ))); -- -- If a body declaration is given, the same element is returned. -- -- Returns a Nil_Element if no body exists in the Context. -- -- The Context parameter is used to locate the corresponding specification -- within a particular Context. The Context need not be the Enclosing_Context -- of the Declaration. Any non-Nil result will always have the given Context -- as its Enclosing_Context. This implies that while a non-Nil result may be -- Is_Equal with the argument, it will only be Is_Identical if the -- Enclosing_Context of the Declaration is the same as the Context parameter. -- -- Implicit predefined operations (eg. "+", "=", etc.) will not typically -- have unit bodies. (Corresponding_Body returns a Nil_Element.) -- User-defined overloads of the predefined operations will have -- Corresponding_Body values once the bodies have inserted into the -- environement. The Corresponding_Body of an inherited subprogram is that -- of the original user-defined subprogram. -- -- If a generic instantiation is given, the body representing the expanded -- generic body template is returned. (eg. an argument that is -- A_Package_Instantiation, results in a value that is -- A_Package_Body_Declaration that can be analyzed with all appropriate ASIS -- queries. -- -- Returns a Nil_Element if the body of the generic has not yet been compiled -- or inserted into the Ada Environment Context. -- -- The Enclosing_Element of the expanded body is the generic instantiation. -- The Enclosing_Compilation_Unit of the expanded template is that of the -- instantiation. -- -- Appropriate Declaration_Kinds returning a body: -- A_Function_Declaration -- A_Function_Instantiation -- A_Generic_Package_Declaration -- A_Generic_Procedure_Declaration -- A_Generic_Function_Declaration -- A_Package_Declaration -- A_Package_Instantiation -- A_Procedure_Declaration -- A_Procedure_Instantiation -- A_Single_Task_Declaration -- A_Task_Type_Declaration -- -- Appropriate Declaration_Kinds returning the argument Declaration: -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Package_Body_Declaration -- A_Package_Body_Stub -- A_Package_Renaming_Declaration -- A_Procedure_Body_Declaration -- A_Procedure_Renaming_Declaration -- A_Procedure_Body_Stub -- A_Task_Body_Declaration -- A_Task_Body_Stub -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Package_Body_Declaration -- A_Package_Body_Stub -- A_Package_Renaming_Declaration -- A_Procedure_Body_Declaration -- A_Procedure_Renaming_Declaration -- A_Procedure_Body_Stub -- A_Task_Body_Declaration -- A_Task_Body_Stub --|95------------------------------------------------------------------------- --|95 function Corresponding_Subprogram_Derivation was called --|95 Subprogram_Derivation ------------------------------------------------------------------------------ function Corresponding_Subprogram_Derivation (Declaration : in Asis.Declaration) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies an implicit inherited subprogram declaration -- -- Returns the subprogram declaration from which the given implicit inherited -- subprogram argument was inherited. The result may itself be an implicitly -- inherited subprogram. -- -- Appropriate Element_Kinds: -- A_Declaration -- -- Appropriate Declaration_Kinds: -- A_Function_Declaration -- A_Procedure_Declaration -- -- Returns Element_Kinds: -- A_Declaration -- -- Returns Declaration_Kinds: -- A_Function_Body_Declaration -- A_Function_Declaration -- A_Function_Renaming_Declaration -- A_Procedure_Body_Declaration -- A_Procedure_Declaration -- A_Procedure_Renaming_Declaration -- -- Raises Asis_Inappropriate_Element for a subprogram declaration that is not -- Is_Part_Of_Inherited. ------------------------------------------------------------------------------ function Corresponding_Type (Declaration : in Asis.Declaration) return Asis.Type_Definition; ------------------------------------------------------------------------------ -- Declaration - Specifies the subprogram_declaration to query -- -- Returns the type definition for which this entity is an implicit -- declaration. The result will often be a derived type. However, this query -- also works for declarations of predefined operators such as "+" and "=". -- Raises Asis_Inappropriate_Element if the argument is not an implicit -- declaration resulting from the declaration of a type. -- -- Appropriate Element_Kinds: -- A_Declaration -- -- Appropriate Declaration_Kinds: -- A_Function_Declaration -- A_Procedure_Declaration -- -- Returns Element_Kinds: -- A_Type_Definition -- -- Returns Definition_Kinds: -- ------------------------------------------------------------------------------ function Corresponding_Equality_Operator (Declaration : in Asis.Declaration) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies an equality or an inequality operator declaration -- -- If given an explicit Declaration of "=" whose result type is Boolean: -- -- - Returns the complimentary implicit "/=" operator declaration. -- -- - Returns a Nil_Element if the Ada implementation has not defined an -- implicit "/=" for the "=". Implementations of this sort will transform -- a A/=B expression into a NOT(A=B) expression. The function call -- representing the NOT operation will be Is_Part_Of_Implicit in this case. -- -- If given an implicit Declaration of "/=" whose result type is Boolean: -- -- - Returns the complimentary explicit "=" operator declaration. -- -- Returns a Nil_Element for any other function_declaration. -- -- Appropriate Declaration_Kinds: -- A_Function_Declaration -- -- Returns Declaration_Kinds: -- A_Function_Declaration -- --|ER------------------------------------------------------------------------- --|ER A_Package_Declaration - 7.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Visible_Part_Declarative_Items --|CR function Private_Part_Declarative_Items ------------------------------------------------------------------------------ function Visible_Part_Declarative_Items (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the package to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of all basic declarations, representation specifications, -- use clauses, and pragmas in the visible part of a package, in their order -- of appearance. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name object declarations into an -- equivalent sequence of corresponding single name object declarations. -- See RM 95 3.3.1(7). -- -- Appropriate Declaration_Kinds: -- A_Generic_Package_Declaration -- A_Package_Declaration -- -- Returns Element_Kinds: -- A_Declaration -- A_Pragma -- A_Clause ------------------------------------------------------------------------------ function Is_Private_Present (Declaration : in Asis.Declaration) return Boolean; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration to query -- -- Returns True if the argument is a package specification which has a reserved -- word PRIVATE which marks the beginning of a (possibly empty) private part. -- -- Returns False for any package specification without a private part. -- Returns False for any unexpected Element. -- -- Expected Element_Kinds: -- A_Declaration -- -- Expected Declaration_Kinds: -- A_Generic_Package_Declaration -- A_Package_Declaration -- ------------------------------------------------------------------------------ function Private_Part_Declarative_Items (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the package to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of all basic declarations, representation specifications, -- use clauses, and pragmas in the private part of a package in their order of -- appearance. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name object declarations into an -- equivalent sequence of corresponding single name object declarations. -- See RM 95 3.3.1(7). -- -- Appropriate Declaration_Kinds: -- A_Generic_Package_Declaration -- A_Package_Declaration -- -- Returns Element_Kinds: -- A_Declaration -- A_Pragma -- A_Clause -- --|ER------------------------------------------------------------------------- --|ER A_Package_Body_Declaration - 7.2 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Body_Declarative_Items --|CR function Body_Statements --|CR function Body_Exception_Handlers --|CR function Body_Block_Statement - obsolescent, not recommended --|ER------------------------------------------------------------------------- --|ER A_Private_Type_Declaration - 7.3 --|ER A_Private_Extension_Declaration - 7.3 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Discriminant_Part --|CR function Type_Declaration_View --|ER------------------------------------------------------------------------- --|ER An_Object_Renaming_Declaration - 8.5.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Declaration_Subtype_Mark --|CR function Renamed_Entity --|95------------------------------------------------------------------------- --|95 function Is_Renaming_Declaration was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ function Renamed_Entity (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the rename declaration to query -- -- Returns the name expression that follows the reserved word RENAMES in the -- renaming declaration. -- -- Appropriate Declaration_Kinds: -- An_Exception_Renaming_Declaration -- A_Function_Renaming_Declaration -- An_Object_Renaming_Declaration -- A_Package_Renaming_Declaration -- A_Procedure_Renaming_Declaration -- A_Generic_Package_Renaming_Declaration -- A_Generic_Procedure_Renaming_Declaration -- A_Generic_Function_Renaming_Declaration -- -- Returns Element_Kinds: -- An_Expression -- --|ER------------------------------------------------------------------------- --|ER An_Exception_Renaming_Declaration - 8.5.2 --|ER A_Package_Renaming_Declaration - 8.5.3 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Renamed_Entity --|ER------------------------------------------------------------------------- --|ER A_Procedure_Renaming_Declaration - 8.5.4 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Renamed_Entity --|ER------------------------------------------------------------------------- --|ER A_Function_Renaming_Declaration - 8.5.4 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Result_Profile --|CR function Renamed_Entity --|ER------------------------------------------------------------------------- --|ER A_Generic_Package_Renaming_Declaration - 8.5.5 --|ER A_Generic_Procedure_Renaming_Declaration - 8.5.5 --|ER A_Generic_Function_Renaming_Declaration - 8.5.5 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Renamed_Entity --|95------------------------------------------------------------------------- --|95 Corresponding_Base_Entity is the new name for Renamed_Base_Entity ------------------------------------------------------------------------------ function Corresponding_Base_Entity (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the rename declaration to query -- -- Unwinds recursive renamings to return the expression used to name -- the first renamed entity that is not itself a renamed entity. This -- expression is the name expression found in the last RENAME declaration -- when following a chain of successive renaming declarations. -- -- Appropriate Declaration_Kinds: -- An_Object_Renaming_Declaration -- An_Exception_Renaming_Declaration -- A_Procedure_Renaming_Declaration -- A_Function_Renaming_Declaration -- A_Package_Renaming_Declaration -- A_Generic_Package_Renaming_Declaration -- A_Generic_Procedure_Renaming_Declaration -- A_Generic_Function_Renaming_Declaration -- -- Returns Element_Kinds: -- An_Expression -- --|ER------------------------------------------------------------------------- --|ER A_Task_Type_Declaration - 9.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Discriminant_Part --|CR function Type_Declaration_View --|ER------------------------------------------------------------------------- --|ER A_Single_Task_Declaration - 9.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Object_Declaration_View --|ER------------------------------------------------------------------------- --|ER A_Task_Body_Declaration - 9.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Body_Declarative_Items --|CR function Body_Statements --|CR function Body_Exception_Handlers --|CR function Body_Block_Statement - obsolescent, not recommended --|95------------------------------------------------------------------------- --|95 function Is_Interface_Present was deleted. Reason REPLACED. --|95 The new query Type_Declaration_View provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Task_Declaration_Declarative_Items was deleted. Reason REPLACED. --|95 function Entry_Declarations was deleted. Reason REPLACED and REDUNDANT. --|95 Equivalent functionality is provided by the new Asis.Definitions --|95 functions Visible_Part_Items and Private_Part_Items that operate --|95 on A_Task_Definition elements. --|ER------------------------------------------------------------------------- --|ER A_Protected_Type_Declaration - 9.4 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Discriminant_Part --|CR function Type_Declaration_View --|ER------------------------------------------------------------------------- --|ER A_Single_Protected_Declaration - 9.4 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Object_Declaration_View --|ER------------------------------------------------------------------------- --|ER A_Protected_Body_Declaration - 9.4 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Protected_Operation_Items --|95------------------------------------------------------------------------- --|95 function Protected_Operation_Items is a new query. ------------------------------------------------------------------------------ function Protected_Operation_Items (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the protected_body declaration to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of protected_operation_items and pragmas of the -- protected_body, in order of appearance. -- -- Returns a Nil_Element_List if there are no items or pragmas. -- -- Appropriate Declaration_Kinds: -- A_Protected_Body_Declaration -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause -- -- Returns Declaration_Kinds: -- A_Procedure_Declaration -- A_Function_Declaration -- A_Procedure_Body_Declaration -- A_Function_Body_Declaration -- An_Entry_Body_Declaration -- -- Returns Clause_Kinds: -- A_Representation_Clause -- --|ER------------------------------------------------------------------------- --|ER An_Entry_Declaration - 9.5.2 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Entry_Family_Definition --|CR function Parameter_Profile --|95------------------------------------------------------------------------- --|95 function Entry_Family_Definition was called Family_Index ------------------------------------------------------------------------------ function Entry_Family_Definition (Declaration : in Asis.Declaration) return Asis.Discrete_Subtype_Definition; ------------------------------------------------------------------------------ -- Declaration - Specifies the entry declaration to query -- -- Returns the discrete_subtype_definition element for the entry family of -- an entry_declaration. -- -- Returns a Nil_Element if the entry_declaration does not define a family -- of entries. -- -- Appropriate Declaration_Kinds: -- An_Entry_Declaration -- -- Returns Definition_Kinds: -- Not_A_Definition -- A_Discrete_Subtype_Definition -- --|ER------------------------------------------------------------------------- --|ER An_Entry_Body_Declaration - 9.5.2 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Entry_Index_Specification --|CR function Parameter_Profile --|CR function Entry_Barrier --|CR function Body_Declarative_Items --|CR function Body_Statements --|CR function Body_Exception_Handlers --|CR function Body_Block_Statement - obsolescent, not recommended --|95------------------------------------------------------------------------- --|95 function Entry_Index_Specification is a new query. ------------------------------------------------------------------------------ function Entry_Index_Specification (Declaration : in Asis.Declaration) return Asis.Declaration; ------------------------------------------------------------------------------ -- Declaration - Specifies the entry body declaration to query -- -- Returns the An_Entry_Index_Specification element of an entry body -- declaration. -- -- Returns a Nil_Element if the entry does not declare any -- An_Entry_Index_Specification element. -- -- Appropriate Declaration_Kinds: -- An_Entry_Body_Declaration -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- An_Entry_Index_Specification -- --|95------------------------------------------------------------------------- --|95 function Entry_Barrier is a new query. ------------------------------------------------------------------------------ function Entry_Barrier (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the entry body declaration to query -- -- Returns the expression following the reserved word WHEN in an entry body -- declaration. -- -- Appropriate Declaration_Kinds: -- An_Entry_Body_Declaration -- -- Returns Element_Kinds: -- An_Expression -- --|ER------------------------------------------------------------------------- --|ER A_Procedure_Body_Stub - 10.1.3 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|ER------------------------------------------------------------------------- --|ER A_Function_Body_Stub - 10.1.3 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Result_Profile --|ER------------------------------------------------------------------------- --|ER A_Package_Body_Stub - 10.1.3 --|ER A_Task_Body_Stub - 10.1.3 --|ER A_Protected_Body_Stub - 10.1.3 --|CR --|CR Child elements returned by: --|CR function Names --|95------------------------------------------------------------------------- --|95 function Subunit is now called Corresponding_Subunit. ------------------------------------------------------------------------------ function Corresponding_Subunit (Body_Stub : in Asis.Declaration) return Asis.Declaration; function Corresponding_Subunit (Body_Stub : in Asis.Declaration; Context : in Asis.Context) return Asis.Declaration; ------------------------------------------------------------------------------ -- Body_Stub - Specifies the stub to query -- Context - Specifies a Context to use to locate the subunit -- -- Returns the Unit_Declaration of the subunit compilation unit corresponding -- to the body stub. -- -- Returns a Nil_Element if the subunit does not exist in the Context. -- -- These two function calls will always produce identical results: -- -- Decl2 := Corresponding_Subunit (Decl1); -- Decl2 := Corresponding_Subunit -- (Decl1, -- Enclosing_Context( Enclosing_Compilation_Unit( Decl1 ))); -- -- The Context parameter is used to locate the corresponding subunit body. -- Any non-Nil result will always have the given Context as its -- Enclosing_Context. -- -- Appropriate Declaration_Kinds: -- A_Function_Body_Stub -- A_Package_Body_Stub -- A_Procedure_Body_Stub -- A_Task_Body_Stub -- A_Protected_Body_Stub -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Body_Declaration -- A_Package_Body_Declaration -- A_Procedure_Body_Declaration -- A_Task_Body_Declaration -- A_Protected_Body_Declaration ------------------------------------------------------------------------------ function Is_Subunit (Declaration : in Asis.Declaration) return Boolean; ------------------------------------------------------------------------------ -- Declaration - Specifies the declaration to query -- -- Returns True if the declaration is the proper_body of a subunit. -- -- Returns False for any unexpected Element. -- --|AN -- Equivalent to: -- Declaration = Unit_Declaration(Enclosing_Compilation_Unit(Declaration)) -- and Unit_Kind(Enclosing_Compilation_Unit(Declaration)) in A_Subunit. -- -- Expected Declaration_Kinds: -- A_Procedure_Body_Declaration -- A_Function_Body_Declaration -- A_Package_Body_Declaration -- A_Task_Body_Declaration -- A_Protected_Body_Declaration -- --|95------------------------------------------------------------------------- --|95 function Body_Stub is now called Corresponding_Body_Stub. ------------------------------------------------------------------------------ function Corresponding_Body_Stub (Subunit : in Asis.Declaration) return Asis.Declaration; function Corresponding_Body_Stub (Subunit : in Asis.Declaration; Context : in Asis.Context) return Asis.Declaration; ------------------------------------------------------------------------------ -- Subunit - Specifies the Is_Subunit declaration to query -- Context - Specifies a Context to use to locate the parent unit -- -- Returns the body stub declaration located in the subunit's parent unit. -- -- Returns a Nil_Element if the parent unit does not exist in the Context. -- -- These two function calls will always produce identical results: -- -- Decl2 := Corresponding_Body_Stub (Decl1); -- Decl2 := Corresponding_Body_Stub -- (Decl1, -- Enclosing_Context( Enclosing_Compilation_Unit( Decl1 ))); -- -- The Context parameter is used to locate the corresponding parent body. Any -- non-Nil result will always have the given Context as its Enclosing_Context. -- -- Appropriate Declaration Kinds: -- (Is_Subunit(Declaration) must also be True) -- A_Function_Body_Declaration -- A_Package_Body_Declaration -- A_Procedure_Body_Declaration -- A_Task_Body_Declaration -- A_Protected_Body_Declaration -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Body_Stub -- A_Package_Body_Stub -- A_Procedure_Body_Stub -- A_Task_Body_Stub -- A_Protected_Body_Stub -- --|ER------------------------------------------------------------------------- --|ER An_Exception_Declaration - 11.1 --|CR --|CR Child elements returned by: --|CR function Names --|ER------------------------------------------------------------------------- --|ER A_Choice_Parameter_Specification - 11.2 --|CR --|CR Child elements returned by: --|CR function Names --|ER------------------------------------------------------------------------- --|ER A_Generic_Procedure_Declaration - 12.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Generic_Formal_Part --|CR function Parameter_Profile --|95------------------------------------------------------------------------- --|95 function Is_Generic was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Is_Part_Of_Instance moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Generic_Formal_Parameters is called Generic_Formal_Part. ------------------------------------------------------------------------------ function Generic_Formal_Part (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Element_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the generic declaration to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of generic formal parameter declarations, use clauses, -- and pragmas, in their order of appearance. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name object declarations into an -- equivalent sequence of corresponding single name object declarations. -- See RM 95 3.3.1(7). -- -- Appropriate Declaration_Kinds: -- A_Generic_Package_Declaration -- A_Generic_Procedure_Declaration -- A_Generic_Function_Declaration -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause -- -- Returns Declaration_Kinds: -- 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 -- -- Returns Clause_Kinds: -- A_Use_Package_Clause -- A_Use_Type_Clause -- --|ER------------------------------------------------------------------------- --|ER A_Generic_Function_Declaration - 12.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Generic_Formal_Part --|CR function Parameter_Profile --|CR function Result_Profile --|ER------------------------------------------------------------------------- --|ER A_Generic_Package_Declaration - 12.1 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Generic_Formal_Part --|CR function Visible_Part_Declarative_Items --|CR function Private_Part_Declarative_Items --|95------------------------------------------------------------------------- --|95 function Enclosing_Generic moved to Asis.Elements. --|ER------------------------------------------------------------------------- --|ER A_Package_Instantiation - 12.3 --|ER A_Procedure_Instantiation - 12.3 --|ER A_Function_Instantiation - 12.3 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Generic_Unit_Name --|CR function Generic_Actual_Part --|95------------------------------------------------------------------------- --|95 function Is_Generic_Instantiation was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ -- -- Instantiations can always be analyzed in terms of the generic actual -- parameters supplied with the instantiation. A generic instance is a copy -- of the generic unit, and while there is no explicit (textual) specification -- in the program text, an implicit specification and body, if there is one, -- with the generic actual parameters is implied. -- -- To analyze the implicit instance specification or body of a generic -- instantiation: -- - Use Corresponding_Declaration to return the implicit expanded -- specification of an instantiation. -- - Use Corresponding_Body to return the implicit body of an instantiation. -- - Then analyze the specification or body with any appropriate -- queries. -- -- To analyze the explicit generic specification or body referenced by a -- generic instantiation: -- - Use Generic_Unit_Name to obtain the name of the generic unit. -- - Then use Corresponding_Name_Declaration to get to the generic -- declaration. -- - Then use Corresponding_Body to get to the body of the generic -- declaration. ------------------------------------------------------------------------------ function Generic_Unit_Name (Declaration : in Asis.Declaration) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the generic instantiation to query -- -- Returns the name following the reserved word NEW in the generic -- instantiation. The name denotes the generic package, generic procedure, or -- generic function that is the template for this generic instance. -- -- Appropriate Declaration_Kinds: -- A_Function_Instantiation -- A_Package_Instantiation -- A_Procedure_Instantiation -- A_Formal_Package_Declaration -- A_Formal_Package_Declaration_With_Box -- -- Returns Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Selected_Component -- --|95------------------------------------------------------------------------- --|95 function Generic_Actual_Part was called Generic_Parameters. ------------------------------------------------------------------------------ function Generic_Actual_Part (Declaration : in Asis.Declaration; Normalized : in Boolean := False) return Asis.Association_List; ------------------------------------------------------------------------------ -- Declaration - Specifies the generic_instantiation to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of the generic_associations of the instantiation. -- -- Returns a Nil_Element_List if there are no generic_associations. -- -- An unnormalized list contains only explicit associations ordered as they -- appear in the program text. Each unnormalized association has an optional -- generic_formal_parameter_selector_name and an -- explicit_generic_actual_parameter component. -- -- A normalized list contains artificial associations representing all -- explicit and default associations. It has a length equal to the number of -- generic_formal_parameter_declarations of the generic_formal_part of the -- template. The order of normalized associations matches the order of -- generic_formal_parameter_declarations. -- -- Each normalized association represents a one on one mapping of a -- generic_formal_parameter_declaration to the explicit or default expression -- or name. A normalized association has one A_Defining_Name component that -- denotes the generic_formal_parameter_declaration, and one An_Expression -- component that is either the explicit_generic_actual_parameter, or a -- default_expression or default_name. -- -- -- Appropriate Declaration_Kinds: -- A_Function_Instantiation -- A_Package_Instantiation -- A_Procedure_Instantiation -- A_Formal_Package_Declaration -- -- Returns Association_Kinds: -- A_Generic_Association -- --|IR Implementation Requirements: --|IR --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. --|IR Normalized associations provided by default are Is_Defaulted_Association. --|IR Normalized associations are never Is_Equal to unnormalized associations. --|IR --|IP Implementation Permissions: --|IP --|IP An implementation may choose to always include default parameters in its --|IP internal representation. --|IP --|IP An implementation may also choose to normalize its representation --|IP to use defining_identifiers rather than --|IP generic_formal_parameter_selector_names. --|IP --|IP In either case, this query will return Is_Normalized associations even if --|IP Normalized is False, and the query Generic_Actual_Part_Normalized will --|IP return True. --|IP --|ER------------------------------------------------------------------------- --|ER A_Formal_Object_Declaration - 12.4 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Declaration_Subtype_Mark --|CR function Initial_Value --|ER------------------------------------------------------------------------- --|ER A_Formal_Type_Declaration - 12.5 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Discriminant_Part --|CR function Type_Declaration_View --|ER------------------------------------------------------------------------- --|ER A_Formal_Procedure_Declaration - 12.6 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Formal_Subprogram_Default --|95------------------------------------------------------------------------- --|95 function Is_Generic_Formal was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Generic_Formal_Subprogram_Default_Kind is now called --|95 Default_Kind and moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Generic_Formal_Subprogram_Default is called --|95 Formal_Subprogram_Default. ------------------------------------------------------------------------------ function Formal_Subprogram_Default (Declaration : in Asis.Generic_Formal_Parameter) return Asis.Expression; ------------------------------------------------------------------------------ -- Declaration - Specifies the generic formal subprogram declaration to query -- -- Returns the name appearing after the reserved word IS in the given generic -- formal subprogram declaration. -- -- Appropriate Declaration_Kinds: -- A_Formal_Function_Declaration -- A_Formal_Procedure_Declaration -- -- Appropriate Default_Kinds: -- A_Default_Name -- -- Returns Element_Kinds: -- An_Expression -- --|ER------------------------------------------------------------------------- --|ER A_Formal_Function_Declaration - 12.6 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Parameter_Profile --|CR function Result_Profile --|CR function Formal_Subprogram_Default --|ER------------------------------------------------------------------------- --|ER A_Formal_Package_Declaration - 12.7 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Generic_Unit_Name --|CR function Generic_Actual_Part --|ER------------------------------------------------------------------------- --|ER A_Formal_Package_Declaration_With_Box - 12.7 --|CR --|CR Child elements returned by: --|CR function Names --|CR function Generic_Unit_Name ------------------------------------------------------------------------------ function Corresponding_Generic_Element (Reference : in Asis.Element) return Asis.Defining_Name; ------------------------------------------------------------------------------ -- Reference - Specifies an expression that references an entity declared -- within the implicit specification of a generic -- instantiation, or, specifies the defining name of such an -- entity --|OP------------------------------------------------------------------------- --|OP Need a better description. -- -- Given a reference to some implicit entity, whose declaration occurs within -- an implicit generic instance, returns the corresponding entity name -- definition from the generic template used to create the generic instance. -- (RM 95 12.3 (16)) -- -- Returns the first A_Defining_Name, from the generic template, that -- corresponds to the entity referenced. -- -- Returns a Nil_Element if the argument does not refer to an entity declared -- as a component of a generic package instantiation. The entity name may -- refer to an ordinary declaration, an inherited subprogram declaration, or a -- predefined operator declaration. -- -- Appropriate Element_Kinds: -- A_Defining_Name -- An_Expression -- -- Appropriate Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Character_Literal -- An_Enumeration_Literal -- -- Returns Element_Kinds: -- Not_An_Element -- A_Defining_Name -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. Kind declaration in new package. ------------------------------------------------------------------------------ end Asis.Declarations; ------------------------------------------------------------------------------ package Asis.Definitions is ------------------------------------------------------------------------------ -- Asis.Definitions -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of queries that operate on A_Definition -- and An_Association elements. --|95------------------------------------------------------------------------- --|95 --|95 Changes to package Asis_Definitions. --|95 --|95------------------------------------------------------------------------- --|95 function Kind called Definition_Kind and moved to Asis.Elements --|95------------------------------------------------------------------------- --|95 function Type_Definition_Declaration is deleted. Reason REDUNDANT. --|95 Asis.Elements.Enclosing_Element provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Implicit_Predefined_Operators was deleted. Reason REDUNDANT. --|95 The equivalent functionality is provided by the function --|95 Corresponding_Type_Operators. --|95------------------------------------------------------------------------- --|95 function Implicit_Attribute_Functions was deleted. Reason OBSOLETE. --|95 Ada 95 terminology defines attribute_reference which can denote both --|95 functions and procedures. --|95------------------------------------------------------------------------- --|95 function Corresponding_Type_Operators was called Type_Operators and --|95 moved from Asis.Declarations. ------------------------------------------------------------------------------ --|ER A_Type_Definition - 3.2.1 ------------------------------------------------------------------------------ function Corresponding_Type_Operators (Type_Definition : in Asis.Type_Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the type to query -- -- Returns a list of operators. These include all predefined operators, and -- all user-defined operator overloads, that have been implicitly or -- explicitly declared for the type. (RM 95 7.3.1(2)) -- -- This list includes only operators appropriate for the type, from the set: -- and or xor = /= < <= > >= + - & * / mod rem ** abs not -- -- Returns a Nil_Element_List if there are no predefined or overloaded -- operators for the type. -- -- Returns a Nil_Element_List if the the implementation does not provide -- such implicit declarations. -- -- The Enclosing_Element for each implicit declaration is the declaration (type -- or object) that declared the type. -- -- For limited private types, if a user-defined equality operator has -- been defined, an Ada implementation has two choices when dealing with an -- instance of the "/=" operator. a) treat A/=B as NOT(A=B), b) implicitly -- create a "/=" operator. Implementations that take the second alternative -- will include this implicit inequality operation in their result. -- Implementations that choose the first alternative are encouraged to hide -- this choice beneath the ASIS interface and to "fake" an inequality -- operation. Failing that, the function call, representing the NOT -- operation, must have Is_Part_Of_Implicit = True so that an ASIS application -- can tell the difference between a user-specified NOT(A=B) and an -- implementation-specific A/=B transformation. -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- -- Returns Declaration_Kinds: -- A_Function_Declaration -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Function_Instantiation -- A_Formal_Function_Declaration -- --|IP Implementation Permissions: --|IP --|IP The result may or may not include language defined operators that have --|IP been overridden by user-defined overloads. Operators that are totally --|IP hidden, in all contexts, by user-defined operators may be omitted from --|IP the list. --|IP --|IP Some implementations do not represent all forms of implicit --|IP declarations such that elements representing them can be easily --|IP provided. An implementation can choose whether or not to construct --|IP and provide artificial declarations for implicitly declared elements. --|IP ------------------------------------------------------------------------------ -- A_Derived_Type_Definition - 3.4 -- -- Child elements returned by: -- function Parent_Subtype_Indication ------------------------------------------------------------------------------ -- A_Derived_Record_Extension_Definition - 3.4 -- -- Child elements returned by: -- function Parent_Subtype_Indication -- function Record_Definition --|95------------------------------------------------------------------------- --|95 function Parent_Subtype_Indication is new name of Parent_Subtype. ------------------------------------------------------------------------------ function Parent_Subtype_Indication (Type_Definition : in Asis.Type_Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- Returns the parent_subtype_indication following the reserved word NEW. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- --|95------------------------------------------------------------------------- --|95 function Record_Definition is a new query. ------------------------------------------------------------------------------ function Record_Definition (Type_Definition : in Asis.Type_Definition) return Asis.Definition; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the definition to query -- -- Returns the record definition of the type_definition. -- -- Appropriate Type_Kinds: -- A_Derived_Record_Extension_Definition -- A_Record_Type_Definition -- A_Tagged_Record_Type_Definition -- -- Returns Definition_Kinds: -- A_Record_Definition -- A_Null_Record_Definition -- --|95------------------------------------------------------------------------- --|95 function Implicit_Inherited_Definitions is a new query. ------------------------------------------------------------------------------ function Implicit_Inherited_Declarations (Definition : in Asis.Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Definition - Specifies the derived type to query -- -- Returns a list of Is_Part_Of_Implicit inherited enumeration_literals, -- discriminants, components, protected subprograms, or entries of a -- derived_type_definition whose parent type is an enumeration type, or a -- composite type other than an array type. See RM 95 3.4(10-14). -- -- Returns a Nil_Element_List if the root type of derived_type_definition is -- not an enumeration, record, task, or protected type. -- -- Returns a Nil_Element_List if the the implementation does not provide -- such implicit declarations. -- -- The Enclosing_Element for each of the implicit declarations is the -- Declaration argument. -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- A_Private_Extension_Definition -- A_Formal_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Derived_Type_Definition -- --|IP Implementation Permissions: --|IP --|IP Some implementations do not represent all forms of implicit --|IP declarations such that elements representing them can be easily --|IP provided. An implementation can choose whether or not to construct --|IP and provide artificial declarations for implicitly declared elements. --|IP --|AN Application Note: --|AN --|AN This query returns only implicit inherited entry declarations for --|AN derived task types. All representation clauses and pragmas associated --|AN with the entries of the original task type (the root type of the --|AN derived task type) apply to the inherited entries. Those are available --|AN by examining the original type or by calling Associated_Pragmas and --|AN Corresponding_Representation_Clauses. These functions will return the --|AN pragmas and clauses from the original type. --|AN --|95------------------------------------------------------------------------- --|95 function Implicit_Inherited_Subprograms was called --|95 Implicit_Derived_Subprograms and moved from Asis.Declarations. ------------------------------------------------------------------------------ function Implicit_Inherited_Subprograms (Definition : in Asis.Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Definition - Specifies the derived type to query -- -- Returns the list of user-defined inherited primitive subprograms that have -- been implicitly declared for the derived_type_definition. -- -- The list result does not include hidden inherited subprograms (RM 95 8.3). -- -- Returns a Nil_Element_List if there are no inherited subprograms for the -- derived type. -- -- Returns a Nil_Element_List if the the implementation does not provide -- such implicit declarations. -- -- The Enclosing_Element for each of the subprogram declarations is the -- Definition argument. -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- A_Private_Extension_Definition -- A_Formal_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Derived_Type_Definition -- -- Returns Declaration_Kinds: -- A_Function_Declaration -- A_Procedure_Declaration -- --|IP Implementation Permissions: --|IP --|IP Some implementations do not represent all forms of implicit --|IP declarations such that elements representing them can be easily --|IP provided. An implementation can choose whether or not to construct --|IP and provide artificial declarations for implicitly declared elements. --|IP --|95------------------------------------------------------------------------- --|95 function Corresponding_Parent_Subtype was called Parent_Type and --|95 returns a declaration element. Unwinds one step. ------------------------------------------------------------------------------ function Corresponding_Parent_Subtype (Type_Definition : in Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- Returns the parent subtype declaration of the derived_type_definition. -- The parent subtype is defined by the parent_subtype_indication. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Subtype_Declaration -- A_Formal_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Root_Type was called Ground_Type and --|95 returns a declaration element. ------------------------------------------------------------------------------ function Corresponding_Root_Type (Type_Definition : in Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- This function recursively unwinds all type derivations and subtyping to -- arrive at a full_type_declaration that is neither a derived type or a -- subtype. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Formal_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Type_Structure was called Type_Structure and --|95 returns a declaration element. ------------------------------------------------------------------------------ function Corresponding_Type_Structure (Type_Definition : in Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- Returns the type structure from which the specified type definition has -- been derived. This function will recursively unwind derivations and -- subtyping until the type_declaration derives a change of representation or -- is no longer derived. See RM 95 13.6. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Formal_Type_Declaration -- --|95------------------------------------------------------------------------- --|95 function Is_Predefined on type_definition was deleted. Reason SECONDARY. ------------------------------------------------------------------------------ -- An_Enumeration_Type_Definition - 3.5.1 -- -- Child elements returned by: -- function Enumeration_Literal_Declarations --|OP------------------------------------------------------------------------- --|OP Semantic changes, ie. operational changes, differences in appropriate --|OP lists should be noted for all queries. --|95------------------------------------------------------------------------- --|95 function Enumeration_Literal_Declarations semantics have been changed. --|95 It no longer works on A_Derived_Type_Definition (whose root type is an --|95 enumeration type). That functionality has been assumed by the new query --|95 Implicit_Inherited_Definitions. ------------------------------------------------------------------------------ function Enumeration_Literal_Declarations (Type_Definition : in Asis.Type_Definition) return Asis.Declaration_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the enumeration type definition to query -- -- Returns a list of the literals declared in an enumeration_type_definition, -- in their order of appearance. -- -- Appropriate Type_Kinds: -- An_Enumeration_Type_Definition -- -- Returns Declaration_Kinds: -- An_Enumeration_Literal_Specification -- --|95------------------------------------------------------------------------- --|95 function Enumeration_Literal_Names was deleted. Reason REDUNDANT and --|95 SECONDARY. ------------------------------------------------------------------------------ -- A_Signed_Integer_Type_Definition - 3.5.4 -- -- Child elements returned by: -- function Integer_Constraint ------------------------------------------------------------------------------ function Integer_Constraint (Type_Definition : in Asis.Type_Definition) return Asis.Range_Constraint; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the signed_integer_type_definition to query -- -- Returns the range_constraint of the signed_integer_type_definition. -- -- Appropriate Type_Kinds: -- A_Signed_Integer_Type_Definition -- -- Returns Constraint_Kinds: -- A_Simple_Expression_Range -- ------------------------------------------------------------------------------ -- A_Modular_Type_Definition - 3.5.4 -- -- Child elements returned by: -- function Mod_Static_Expression --|95------------------------------------------------------------------------- --|95 function Mod_Static_Expression is a new query. ------------------------------------------------------------------------------ function Mod_Static_Expression (Type_Definition : in Asis.Type_Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the modular_type_definition to query -- -- Returns the static_expression following the reserved word MOD. -- -- Appropriate Type_Kinds: -- A_Modular_Type_Definition -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ -- A_Floating_Point_Definition - 3.5.7 -- -- Child elements returned by: -- function Digits_Expression -- function Real_Range_Constraint -- ------------------------------------------------------------------------------ -- A_Decimal_Fixed_Point_Definition - 3.5.9 -- -- Child elements returned by: -- function Digits_Expression -- function Delta_Expression -- function Real_Range_Constraint --|95------------------------------------------------------------------------- --|95 function Real_Type_Constraint was deleted. Reason REPLACED. --|95 Equivalent functionality is provided by new functions Digits_Expression, --|95 Delta_Expression, and Real_Range_Constraint. --|95------------------------------------------------------------------------- --|95 function Digits_Expression was called Floating_Accuracy_Definition. ------------------------------------------------------------------------------ function Digits_Expression (Definition : in Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the static_expression following the reserved word DIGITS. -- -- Appropriate Definition_Kinds: -- A_Floating_Point_Definition -- A_Decimal_Fixed_Point_Definition -- A_Constraint -- Appropriate Constraint_Kinds: -- A_Digits_Constraint -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ -- An_Ordinary_Fixed_Point_Definition - 3.5.9 -- -- Child elements returned by: -- function Delta_Expression --|95------------------------------------------------------------------------- --|95 function Delta_Expression was called Fixed_Accuracy_Definition. ------------------------------------------------------------------------------ function Delta_Expression (Definition : in Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the static_expression following the reserved word DELTA. -- -- Appropriate Definition_Kinds: -- An_Ordinary_Fixed_Point_Definition -- A_Decimal_Fixed_Point_Definition -- A_Constraint -- Appropriate Constraint_Kinds: -- A_Delta_Constraint -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Real_Range_Constraint was called Floating_Point_Range_Constraint. ------------------------------------------------------------------------------ function Real_Range_Constraint (Definition : in Asis.Definition) return Asis.Range_Constraint; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the real_range_specification range_constraint of the definition. -- -- Returns a Nil_Element if there is no explicit range_constraint. -- -- Appropriate Definition_Kinds: -- A_Floating_Point_Definition -- An_Ordinary_Fixed_Point_Definition -- A_Decimal_Fixed_Point_Definition -- A_Constraint -- Appropriate Constraint_Kinds: -- A_Digits_Constraint -- A_Delta_Constraint -- -- Returns Constraint_Kinds: -- Not_A_Constraint -- A_Simple_Expression_Range -- ------------------------------------------------------------------------------ -- An_Unconstrained_Array_Definition 3.6 -- -- Child elements returned by: -- function Index_Subtype_Definitions -- function Array_Component_Definition ------------------------------------------------------------------------------ function Index_Subtype_Definitions (Type_Definition : in Asis.Type_Definition) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array_type_definition to query -- -- Returns a list of the index_subtype_definition subtype mark names for -- an unconstrained_array_definition, in their order of appearance. -- -- Appropriate Type_Kinds: -- An_Unconstrained_Array_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Unconstrained_Array_Definition -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- --|95------------------------------------------------------------------------- --|95 function Is_Constrained_Array was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ -- A_Constrained_Array_Definition 3.6 -- -- Child elements returned by: -- function Discrete_Subtype_Definitions -- function Array_Component_Definition --|95------------------------------------------------------------------------- --|95 function Index_Constraint was deleted. Reason REPLACED. The new query --|95 Discrete_Subtype_Definitions provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Discrete_Subtype_Definitions is a new query. ------------------------------------------------------------------------------ function Discrete_Subtype_Definitions (Type_Definition : in Asis.Type_Definition) return Asis.Definition_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array_type_definition to query -- -- Returns the list of discrete_subtype_definition elements of a -- constrained_array_definition, in their order of appearance. -- -- Appropriate Type_Kinds: -- A_Constrained_Array_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Constrained_Array_Definition -- -- Returns Definition_Kinds: -- A_Discrete_Subtype_Definition -- --|95------------------------------------------------------------------------- --|95 function Array_Component_Definition was called --|95 Component_Subtype_Indication. ------------------------------------------------------------------------------ function Array_Component_Definition (Type_Definition : in Asis.Type_Definition) return Asis.Component_Definition; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array_type_definition to query -- -- Returns the component_definition of the array_type_definition. -- -- Appropriate Type_Kinds: -- An_Unconstrained_Array_Definition -- A_Constrained_Array_Definition -- -- Appropriate Formal_Type_Kinds: -- A_Formal_Unconstrained_Array_Definition -- A_Formal_Constrained_Array_Definition -- -- Returns Definition_Kinds: -- A_Component_Definition -- --|95------------------------------------------------------------------------- --|95 function Is_Discriminated was deleted. Reason REPLACED. --|95 Presence of discriminants can be determined with the new function --|95 Discriminant_Part. --|95------------------------------------------------------------------------- --|95 function Discriminants on A_Type_Definition was deleted. Reason REPLACED. --|95 Discriminants are obtained from A_Declaration elements using --|95 Discriminant_Part and the new function Discriminants that operates on --|95 A_Known_Discriminant_Part element. ------------------------------------------------------------------------------ -- A_Record_Type_Definition - 3.7 -- A_Tagged_Record_Type_Definition - 3.7 -- -- Child elements returned by: -- function Record_Definition ------------------------------------------------------------------------------ -- An_Access_Type_Definition - 3.10 -- -- Child elements returned by: -- function Access_To_Object_Definition -- function Access_To_Subprogram_Parameter_Profile -- function Access_To_Function_Result_Profile --|95------------------------------------------------------------------------- --|95 function Access_To was deleted. Reason REPLACED. Equivalent --|95 functionality is provided by new queries Access_To_Object_Definition, --|95 Access_To_Subprogram_Parameter_Profile, and --|95 Access_To_Function_Result_Profile --|95------------------------------------------------------------------------- --|95 function Access_To_Object_Definition is a new query. ------------------------------------------------------------------------------ function Access_To_Object_Definition (Type_Definition : in Asis.Type_Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the access_type_definition to query -- -- Returns the subtype_indication following the reserved word ACCESS. -- -- Appropriate Type_Kinds: -- An_Access_Type_Definition. -- A_Formal_Access_Type_Definition. -- -- Appropriate Access_Type_Kinds: -- A_Pool_Specific_Access_To_Variable -- An_Access_To_Variable -- An_Access_To_Constant -- -- Returns Element_Kinds: -- A_Subtype_Indication -- --|95------------------------------------------------------------------------- --|95 function Access_To_Subprogram_Parameter_Profile is a new query. ------------------------------------------------------------------------------ function Access_To_Subprogram_Parameter_Profile (Type_Definition : in Asis.Type_Definition) return Asis.Parameter_Specification_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the access_type_definition to query -- -- Returns a list of parameter_specifications in the formal part of the -- parameter_profile in the access_to_subprogram_definition. -- -- Returns a Nil_Element_List if the parameter_profile has no formal part. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multiple name parameter_specifications into -- an equivalent sequence of corresponding single name -- parameter_specifications. See RM 95 3.3.1(7). -- -- Appropriate Type_Kinds: -- An_Access_Type_Definition. -- A_Formal_Access_Type_Definition. -- -- Appropriate Access_Type_Kinds: -- An_Access_To_Procedure -- An_Access_To_Protected_Procedure -- An_Access_To_Function -- An_Access_To_Protected_Function -- -- Returns Declaration_Kinds: -- A_Parameter_Specification -- --|95------------------------------------------------------------------------- --|95 function Access_To_Function_Result_Profile is a new query. ------------------------------------------------------------------------------ function Access_To_Function_Result_Profile (Type_Definition : in Asis.Type_Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the access_type_definition to query -- -- Returns the subtype_mark expression for the return_type for the access -- function. -- -- Appropriate Type_Kinds: -- An_Access_Type_Definition. -- A_Formal_Access_Type_Definition. -- -- Appropriate Access_Type_Kinds: -- An_Access_To_Function -- An_Access_To_Protected_Function -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- ------------------------------------------------------------------------------ -- A_Root_Type_Definition - 3.5.4(9), 3.5.6(2) - No child elements ------------------------------------------------------------------------------ -- --|95------------------------------------------------------------------------- --|95 function Subtype_Definition_Subtype_Indication was deleted. Reason --|95 REPLACED. Changes to the element kind hierarchy along with removal of --|95 Type_Definition_Declaration allow this unnecessary kludge to be removed. ------------------------------------------------------------------------------ -- A_Subtype_Indication - 3.3.2 -- -- Child elements returned by: -- function Subtype_Mark -- function Subtype_Constraint --|95------------------------------------------------------------------------- --|95 function Subtype_Mark was called Type_Mark. ------------------------------------------------------------------------------ function Subtype_Mark (Definition : in Asis.Definition) return Asis.Expression; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the subtype_mark expression of the definition. -- -- Appropriate Definition_Kinds: -- A_Subtype_Indication -- A_Discrete_Subtype_Definition -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- A_Discrete_Range -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- A_Formal_Derived_Type_Definition -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- ------------------------------------------------------------------------------ function Subtype_Constraint (Definition : in Asis.Definition) return Asis.Constraint; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the constraint of the subtype_indication. -- -- Returns a Nil_Element if no explicit constraint is present. -- -- Appropriate Definition_Kinds: -- A_Subtype_Indication -- A_Discrete_Subtype_Definition -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- A_Discrete_Range -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Subtype_Indication -- -- Returns Definition_Kinds: -- Not_A_Definition -- A_Constraint -- --|AN Application Note: --|AN --|AN When an unconstrained subtype indication for a type having --|AN discriminants with default values is used, a Nil_Element will be --|AN returned by this function. Use the queries Subtype_Mark, and --|AN Corresponding_Name_Declaration [, and Corresponding_First_Subtype] --|AN to obtain the declaration defining the defaults. --|AN --|95------------------------------------------------------------------------- --|95 function Constraint_Kinds was moved to Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Choice_Kind was deleted. Reason REPLACED. --|95 function Choice_Simple_Expression was deleted. Reason REPLACED. --|95 function Choice_Discrete_Range was deleted. Reason REPLACED. --|95 function Choice_Name was deleted. Reason REPLACED. --|95 Queries that formely returned A_Choice were changed to return either --|95 An_Expression or A_Definiton, bypassing the extra A_Choice element. --|95 The new functionality makes these choice queries obsolete. --|95------------------------------------------------------------------------- --|95 function Discrete_Range_Kind was moved to Asis.Elements. ------------------------------------------------------------------------------ -- A_Constraint - 3.2.2 -- -- A_Simple_Expression_Range - 3.5 -- -- Child elements returned by: -- function Lower_Bound -- function Upper_Bound ------------------------------------------------------------------------------ function Lower_Bound (Constraint : in Asis.Range_Constraint) return Asis.Expression; ------------------------------------------------------------------------------ -- Constraint - Specifies the range_constraint or discrete_range to query -- -- Returns the simple_expression for the lower bound of the range. -- -- Appropriate Constraint_Kinds: -- A_Simple_Expression_Range -- -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Simple_Expression_Range -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ function Upper_Bound (Constraint : in Asis.Range_Constraint) return Asis.Expression; ------------------------------------------------------------------------------ -- Constraint - Specifies the range_constraint or discrete_range to query -- -- Returns the simple_expression for the upper bound of the range. -- -- Appropriate Constraint_Kinds: -- A_Simple_Expression_Range -- -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Simple_Expression_Range -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ -- A_Range_Attribute_Reference - 3.5 -- -- Child elements returned by: -- function Range_Attribute ------------------------------------------------------------------------------ function Range_Attribute (Constraint : in Asis.Range_Constraint) return Asis.Expression; ------------------------------------------------------------------------------ -- Constraint - Specifies the range_attribute_reference or -- discrete_range_attribute_reference to query -- -- Returns the range_attribute_reference expression of the range. -- -- Appropriate Constraint_Kinds: -- A_Range_Attribute_Reference -- -- Appropriate Discrete_Range_Kinds: -- A_Discrete_Range_Attribute_Reference -- -- Returns Expression_Kinds: -- An_Attribute_Reference -- ------------------------------------------------------------------------------ -- A_Digits_Constraint - 3.5.9 -- -- Child elements returned by: -- function Digits_Expression -- function Real_Range_Constraint ------------------------------------------------------------------------------ -- A_Delta_Constraint - J.3 -- -- Child elements returned by: -- function Delta_Expression -- function Real_Range_Constraint ------------------------------------------------------------------------------ -- An_Index_Constraint - 3.6.1 -- -- Child elements returned by: -- function Discrete_Ranges ------------------------------------------------------------------------------ function Discrete_Ranges (Constraint : in Asis.Constraint) return Asis.Discrete_Range_List; ------------------------------------------------------------------------------ -- Constraint - Specifies the array index_constraint to query -- -- Returns the list of discrete_range components for an index_constraint, -- in their order of appearance. -- -- Appropriate Constraint_Kinds: -- An_Index_Constraint -- -- Returns Definition_Kinds: -- A_Discrete_Range -- ------------------------------------------------------------------------------ -- A_Discriminant_Constraint - 3.7.1 -- -- Child elements returned by: -- function Discriminant_Associations ------------------------------------------------------------------------------ function Discriminant_Associations (Constraint : in Asis.Constraint; Normalized : in Boolean := False) return Asis.Discriminant_Association_List; ------------------------------------------------------------------------------ -- Constraint - Specifies the discriminant_constraint to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of the discriminant_associations of the -- discriminant_constraint. -- -- Returns a Nil_Element_List if there are no discriminant_associations. -- -- An unnormalized list contains only explicit associations ordered as they -- appear in the program text. Each unnormalized association has a list of -- discriminant_selector_names and an explicit expression. -- -- A normalized list contains artificial associations representing all -- explicit associations. It has a length equal to the number of -- discriminant_specifications of the known_discriminant_part. The order of -- normalized associations matches the order of discriminant_specifications. -- -- Each normalized association represents a one on one mapping of a -- discriminant_specification to the explicit expression. A normalized -- association has one A_Defining_Name component that denotes the -- discriminant_specification, and one An_Expression component that is the -- explicit expression. -- -- -- Appropriate Constraint_Kinds: -- A_Discriminant_Constraint -- -- Returns Association_Kinds: -- A_Discriminant_Association -- --|IR Implementation Requirements: --|IR --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. --|IR Normalized associations are never Is_Equal to unnormalized associations. --|IR --|IP Implementation Permissions: --|IP --|IP An implementation may chose to normalize its internal representation --|IP to use defining_identifiers instead of discriminant_selector_names. --|IP --|IP If so, this query will return Is_Normalized associations even if --|IP Normalized is False, and the query Discriminant_Associations_Normalized --|IP will return True. --|IP --|AN Application Note: --|AN --|AN It is not possible to obtain either a normalized or unnormalized --|AN discriminant_association list for an unconstrained record or derived --|AN subtype_indication where the discriminant_associations are supplied --|AN by default; there is no constraint to query, and a Nil_Element is --|AN returned from the query Subtype_Constraint. --|AN --|95------------------------------------------------------------------------- --|95 function Discriminant_Selector_Names was called --|95 Discriminant_Simple_Names and has moved to Asis.Expressions. --|95------------------------------------------------------------------------- --|95 function Discriminant_Expression moved to Asis.Expressions. ------------------------------------------------------------------------------ -- A_Component_Definition - 3.6 -- -- Child elements returned by: -- function Component_Subtype_Indication --|95------------------------------------------------------------------------- --|95 function Component_Subtype_Indication is a new query. ------------------------------------------------------------------------------ function Component_Subtype_Indication (Component_Definition : in Asis.Component_Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Component_Definition - Specifies the component_definition to query -- -- Returns the subtype_indication of the component_definition. -- -- Appropriate Definition_Kinds: -- A_Component_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- ------------------------------------------------------------------------------ -- A_Discrete_Subtype_Definition - 3.6 -- A_Discrete_Range - 3.6.1 -- -- A_Discrete_Subtype_Indication -- -- Child elements returned by: -- function Subtype_Mark -- function Subtype_Constraint -- -- A_Discrete_Simple_Expression_Range -- -- Child elements returned by: -- function Lower_Bound -- function Upper_Bound -- -- A_Discrete_Range_Attribute_Reference - 3.5 -- -- Child elements returned by: -- function Range_Attribute -- ------------------------------------------------------------------------------ -- An_Unknown_Discriminant_Part - 3.7 - No child elements ------------------------------------------------------------------------------ -- A_Known_Discriminant_Part - 3.7 -- -- Child elements returned by: -- function Discriminants --|95------------------------------------------------------------------------- --|95 function Discriminants is a new query. ------------------------------------------------------------------------------ function Discriminants (Definition : in Asis.Definition) return Asis.Discriminant_Specification_List; ----------------------------------------------------------------------------- -- Definition - Specifies the known_discriminant_part to query -- -- Returns a list of discriminant_specifications, in their order of appearance. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multi-name discriminant_specifications into -- an equivalent sequence of single name discriminant_specifications. -- See RM 95 3.3.1(7). -- -- Appropriate Definition_Kinds: -- A_Known_Discriminant_Part -- -- Returns Declaration_Kinds: -- A_Discriminant_Specification -- ------------------------------------------------------------------------------ -- A_Record_Definition - 3.8 -- -- Child elements returned by: -- function Record_Components -- function Implicit_Components --|95------------------------------------------------------------------------- --|95 function Record_Components operates on A_Record_Definition or --|95 A_Variant elements rather than A_Type_Definition elements. ------------------------------------------------------------------------------ function Record_Components (Definition : in Asis.Definition; Include_Pragmas : in Boolean := False) return Asis.Record_Component_List; ------------------------------------------------------------------------------ -- Definition - Specifies the record_definition or variant to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the components and pragmas of the record_definition or -- variant, in their order of appearance. -- -- Declarations are not returned for implementation-defined components of the -- record_definition. See RM 95 13.5.1 (15). These components are not -- normally visible to the ASIS application. However, they can be obtained -- with the query Implicit_Components. -- -- Appropriate Definition_Kinds: -- A_Record_Definition -- A_Variant -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Definition -- A_Clause -- -- Returns Declaration_Kinds: -- A_Component_Declaration -- -- Returns Definition_Kinds: -- A_Null_Component -- A_Variant_Part -- -- Returns Representation_Clause_Kinds: -- An_Attribute_Definition_Clause -- --|95------------------------------------------------------------------------- --|95 function Implicit_Components operates on A_Record_Definition or --|95 A_Variant elements rather than A_Type_Definition elements. ------------------------------------------------------------------------------ function Implicit_Components (Definition : in Asis.Definition) return Asis.Record_Component_List; ------------------------------------------------------------------------------ -- Definition - Specifies the record_definition or variant to query -- -- Returns a list of all implicit implementation-defined components of the -- record_definition or variant. The Enclosing_Element of each component is -- the Definition argument. Each component will be Is_Part_Of_Implicit. -- -- Returns a Nil_Element_List if there are no implicit implementation-defined -- components or if the the ASIS implementation does not support such -- implicit declarations. -- -- Appropriate Definition_Kinds: -- A_Record_Definition -- A_Variant -- -- Returns Element_Kinds: -- A_Declaration -- -- Returns Declaration_Kinds: -- A_Component_Declaration -- --|IP Implementation Permissions: --|IP --|IP Some implementations do not represent all forms of implicit --|IP declarations such that elements representing them can be easily --|IP provided. An implementation can choose whether or not to construct --|IP and provide artificial declarations for implicitly declared elements. --|IP --|IP Use the query Implicit_Components_Supported to determine if the --|IP implementation provides implicit record components. --|IP --|95------------------------------------------------------------------------- --|95 function Component_Kind was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ -- A_Null_Record_Definition - 3.8 - No child elements ------------------------------------------------------------------------------ -- A_Variant_Part - 3.8.1 -- -- Child elements returned by: -- function Discriminant_Direct_Name -- function Variants --|95------------------------------------------------------------------------- --|95 function Discriminant_Direct_Name was called --|95 Corresponding_Discriminant_Simple_Name. ------------------------------------------------------------------------------ function Discriminant_Direct_Name (Variant_Part : in Asis.Record_Component) return Asis.Name; ------------------------------------------------------------------------------ -- Variant_Part - Specifies the variant_part to query -- -- Returns the discriminant_direct_name of the variant_part. -- -- Appropriate Definition_Kinds: -- A_Variant_Part -- -- Returns Expression_Kinds: -- An_Identifier -- ------------------------------------------------------------------------------ function Variants (Variant_Part : in Asis.Record_Component; Include_Pragmas : in Boolean := False) return Asis.Variant_List; ------------------------------------------------------------------------------ -- Variant_Part - Specifies the variant_part to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of variants that make up the record component, in their -- order of appearance. -- -- The only pragmas returned are those following the reserved word IS -- and preceding the reserved word WHEN of first variant, and those between -- following variants. -- -- Appropriate Definition_Kinds: -- A_Variant_Part -- -- Returns Element_Kinds: -- A_Pragma -- A_Definition -- -- Returns Definition_Kinds: -- A_Variant -- ------------------------------------------------------------------------------ -- A_Variant - 3.8.1 -- -- Child elements returned by: -- function Variant_Choices -- function Record_Components -- function Implicit_Components ------------------------------------------------------------------------------ function Variant_Choices (Variant : in Asis.Variant) return Asis.Element_List; ------------------------------------------------------------------------------ -- Variant - Specifies the variant to query -- -- Returns the discrete_choice_list elements, in their order of appearance. -- Choices are either an expression, a discrete range, or an others choice. -- -- Appropriate Definition_Kinds: -- A_Variant -- -- Returns Element_Kinds: -- An_Expression -- A_Definition -- -- Returns Definition_Kinds: -- A_Discrete_Range -- An_Others_Choice -- --|95------------------------------------------------------------------------- --|95 function Variant_Components was deleted. Reason REDUNDANT. The --|95 equivalent functionality is assumed by the function Record_Components. --|95------------------------------------------------------------------------- --|95 function Implicit_Variant_Components was deleted. Reason REDUNDANT. The --|95 equivalent functionality is assumed by the function Implicit_Components. ------------------------------------------------------------------------------ -- A_Private_Type_Definition - 7.3 - No child elements -- A_Tagged_Private_Type_Definition - 7.3 - No child elements ------------------------------------------------------------------------------ -- A_Private_Extension_Definition - 7.3 -- -- Child elements returned by: -- function Ancestor_Subtype_Indication --|95------------------------------------------------------------------------- --|95 function Ancestor_Subtype_Indication is a new query. ------------------------------------------------------------------------------ function Ancestor_Subtype_Indication (Definition : in Asis.Definition) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns the ancestor_subtype_indication following the reserved word NEW -- in the private_extension_definition. -- -- Appropriate Definition_Kinds: -- A_Private_Extension_Definition -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- ------------------------------------------------------------------------------ -- A_Task_Definition - 9.1 -- A_Protected_Definition - 9.4 -- -- Child elements returned by: -- function Visible_Part_Items -- function Private_Part_Items --|95------------------------------------------------------------------------- --|95 function Visible_Part_Items is a new query. ------------------------------------------------------------------------------ function Visible_Part_Items (Definition : in Asis.Definition; Include_Pragmas : in Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the type_definition to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of declarations, representation clauses, and pragmas -- in the visible part of the task or protected definition, in their order -- of appearance. The list does not include discriminant_specifications of -- the known_discriminant_part, if any, of the protected type or task type -- declaration. -- -- Returns a Nil_Element_List if there are no items. -- -- Appropriate Definition_Kinds: -- A_Task_Definition -- A_Protected_Definition -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause -- --|95------------------------------------------------------------------------- --|95 function Private_Part_Items is a new query. ------------------------------------------------------------------------------ function Private_Part_Items (Definition : in Asis.Definition; Include_Pragmas : in Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the task type definition to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of declarations, representation clauses, and pragmas -- in the private_part of the task or protected definition, in their order -- of appearance. -- -- Returns a Nil_Element_List if there are no items. -- -- Appropriate Definition_Kinds: -- A_Task_Definition -- A_Protected_Definition -- -- Returns Element_Kinds: -- A_Pragma -- A_Declaration -- A_Clause -- --|95------------------------------------------------------------------------- --|95 function Is_Private_Present is a new query. ------------------------------------------------------------------------------ function Is_Private_Present (Definition : in Asis.Definition) return Boolean; ------------------------------------------------------------------------------ -- Definition - Specifies the definition to query -- -- Returns True if the argument is a task_definition or a protected_definition -- that has a reserved word PRIVATE marking the beginning of a (possibly empty) -- private part. -- -- Returns False for any definition without a private part. -- Returns False for any unexpected Element. -- -- Expected Definition_Kinds: -- A_Task_Definition -- A_Protected_Definition -- ------------------------------------------------------------------------------ -- A_Formal_Type_Definition - 12.5 -- -- A_Formal_Private_Type_Definition - 12.5.1 - No child elements -- A_Formal_Tagged_Private_Type_Definition - 12.5.1 - No child elements -- -- A_Formal_Derived_Type_Definition -- Child elements returned by: -- function Subtype_Mark -- -- A_Formal_Discrete_Type_Definition - 12.5.2 - No child elements -- A_Formal_Signed_Integer_Type_Definition - 12.5.2 - No child elements -- A_Formal_Modular_Type_Definition - 12.5.2 - No child elements -- A_Formal_Floating_Point_Definition - 12.5.2 - No child elements -- A_Formal_Ordinary_Fixed_Point_Definition - 12.5.2 - No child elements -- A_Formal_Decimal_Fixed_Point_Definition - 12.5.2 - No child elements -- -- A_Formal_Unconstrained_Array_Definition - 12.5.3 -- Child elements returned by: -- function Index_Subtype_Definitions -- function Array_Component_Definition -- -- A_Formal_Constrained_Array_Definition - 12.5.3 -- Child elements returned by: -- function Discrete_Subtype_Definitions -- function Array_Component_Definition -- -- A_Formal_Access_Type_Definition - 12.5.4 -- Child elements returned by: -- function Access_To_Object_Definition -- function Access_To_Subprogram_Parameter_Profile -- function Access_To_Function_Result_Profile -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. Kind declaration in new package. ------------------------------------------------------------------------------ end Asis.Definitions; ------------------------------------------------------------------------------ package Asis.Expressions is ------------------------------------------------------------------------------ -- Asis.Expressions -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of queries that operate on An_Expression -- and An_Association elements. -- --|95------------------------------------------------------------------------- --|95 --|95 Changes to package Asis_Expressions. --|95 --|95------------------------------------------------------------------------- --|95 function Kind is called Expression_Kind and moved to Asis.Elements --|95------------------------------------------------------------------------- --|95 function Corresponding_Expression_Type was called Expression_Type and --|95 now returns a declaration rather than a definition (type_definition). ------------------------------------------------------------------------------ function Corresponding_Expression_Type (Expression : in Asis.Expression) return Asis.Declaration; ------------------------------------------------------------------------------ -- Expression - Specifies the expression to query -- -- Returns the type_declaration for the type of the expression. This query -- does not "unwind" subtypes or derived types to get to the -- Corresponding_First_Subtype or Corresponding_Parent_Subtype declarations. -- -- Returns a Nil_Element for two classes of expressions that do not have a -- Corresponding_Expression_Type: -- -- - Naming expressions that name packages, subprograms, tasks, etc. These -- expressions do have a Corresponding_Name_Definition and a -- Corresponding_Name_Declaration. -- -- - The Actual_Parameter Expression from A_Pragma_Argument_Association for a -- Pragma may or may not have a Corresponding_Expression_Type. If the -- returned declaration is non-nil then the Expression is either a) an -- ordinary expression, or b) a naming expression that names a constant or -- variable object. -- -- If the returned declaration is Nil, Corresponding_Name_Definition and -- Corresponding_Name_Declaration can be used to determine whether the -- expression is a naming expression that specifies a subprogram, package, -- task, etc. If Corresponding_Name_Definition raises Asis_Failed (with a -- Status of Value_Error), the Actual_Parameter is not a normal Ada -- expression at all and does not follow normal Ada semantic rules. -- For example, "pragma Private_Part (Open => Yes);", the "Yes" expression -- may simply be a "keyword" that is specially recognized by the vendor -- compilation system and may not actually refer to any declared object -- (Corresponding_Expression_Type = Nil_Element and -- Corresponding_Name_Declaration raises Asis_Failed). -- -- Appropriate Element_Kinds: -- An_Expression -- -- Returns Element_Kinds: -- Not_An_Element -- A_Declaration -- --|95------------------------------------------------------------------------- --|95 function Is_Universal was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Expression_Associated_Type was deleted. Reason SECONDARY. ------------------------------------------------------------------------------ --|ER An_Integer_Literal - 2.4 - No child elements --|ER A_Real_Literal - 2.4 - No child elements --|ER A_String_Literal - 2.6 - No child elements --|ER --|ER String image returned by: --|ER function Value --|95------------------------------------------------------------------------- --|95 function Is_Static is deleted. Reason ILL_DEFINED. --|95 Static_Value is called Value and works on string and numeric --|95 literals only. Former Static_Value function not well defined. --|95------------------------------------------------------------------------- --|95 function Value_Image was called Value. ------------------------------------------------------------------------------ function Value_Image (Expression : in Asis.Expression) return String; ------------------------------------------------------------------------------ -- Expression - Specifies the expression to query -- -- Returns the String image of the value of the string, integer, or real -- literal. -- -- For string literals, Value will return the quotes around the string -- literal, these quotes are doubled, just as any quote appearing embedded in -- the string literal in the program text. -- they appear in the program text. -- -- The form of numbers returned by this query may vary between vendors. -- Vendors are encouraged, but not required, to return numeric literals using -- the same based or exponent form used in the original compilation text. -- -- Appropriate Expression_Kinds: -- An_Integer_Literal -- A_Real_Literal -- A_String_Literal -- ------------------------------------------------------------------------------ --|ER An_Identifier - 4.1 - No child elements --|ER An_Operator_Symbol - 4.1 - No child elements --|ER A_Character_Literal - 4.1 - No child elements --|ER An_Enumeration_Literal - 4.1 - No child elements --|ER --|ER String image returned by: --|ER function Name --|SR --|SR Semantic elements returned by: --|SR function Corresponding_Name_Definition --|SR function Corresponding_Name_Definition_List --|SR function Corresponding_Name_Declaration --|95------------------------------------------------------------------------- --|95 function Name_Image was called Name. Its semantics have changed to only --|95 operate on An_Expression elements. --|95 The new query Asis.Declarations.Name_Image works on A_Defining_Name --|95 elements. ------------------------------------------------------------------------------ function Name_Image (Name : in Asis.Expression) return String; ------------------------------------------------------------------------------ -- Name - Specifies the name to query -- -- Returns the String image of the name. -- -- An_Operator_Symbol elements have names with embedded quotes """abs""" -- (function "abs"). -- -- A_Character_Literal elements have names with embedded apostrophes "'x'" -- (literal 'x'). -- -- An_Enumeration_Literal and An_Identifier elements have identifier names -- "Blue" (literal Blue) "Abc" (identifier Abc). -- -- Note: Implicit subtypes that may be encountered while traversing the -- semantic information embedded in implicit inherited subprogram declarations -- (RM 95 3.4 (17-22)) will have names that may not be unique in a particular -- scope. This is because these subtypes are Is_Implicit declarations that -- do not form part of the physical text of the original compilation units. -- Some applications may wish to carefully separate the names of actual -- declarations from the names of Is_Implicit declaration when creating symbol -- tables and other name-specific lookup mechanisms. -- -- The case of names returned by this query may vary between vendors. -- Vendors are encouraged, but not required, to return names in the same case -- as was used in the original compilation text. -- -- Appropriate Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Character_Literal -- An_Enumeration_Literal -- ------------------------------------------------------------------------------ function References (Name : in Asis.Element; Element_Context : in Asis.Element; Implicitly : in Boolean := False) return Asis.Name_List; ------------------------------------------------------------------------------ -- Name - Specifies the entity to query -- Element_Context - Specifies the context for the query which is limited -- to the Element and its children. -- -- If the Implicitly argument is True: -- Returns all usage references of the given entity made by both explicit -- and implicit elements within the given context. -- -- If the Implicitly argument is False: -- Returns all usage references of the given entity made only by explicit -- elements within the given context. -- -- Returned references are in their order of appearance. -- -- Appropriate Element_Kinds: -- A_Defining_Name -- -- Returns Element_Kinds: -- An_Expression -- -- May raise Asis_Failed with a Status of Obsolete_Reference_Error if the -- argument is part of an Is_Obsolete compilation unit. ------------------------------------------------------------------------------ function Is_Referenced (Name : in Asis.Element; Element_Context : in Asis.Element; Implicitly : in Boolean := False) return Boolean; ------------------------------------------------------------------------------ -- Name - Specifies the entity to query -- Element_Context - Specifies the context for the query which is limited -- to the Element and its children. -- -- If the Implicitly argument is True: -- Returns True if the Name is referenced by either implicit or explicit -- elements within the given context. -- -- If the Implicitly argument is False: -- Returns True only if the Name is referenced by explicit elements. -- -- Returns False for any unexpected Element. -- -- Expected Element_Kinds: -- A_Defining_Name -- -- May raise Asis_Failed with a Status of Obsolete_Reference_Error if the -- argument is part of an Is_Obsolete compilation unit. --|95------------------------------------------------------------------------- --|95 function Corresponding_Name_Definition was called Name_Definition and --|95 the functional semantics and appropriate elements have changed. --|95 Semantic change with attribute_references. ------------------------------------------------------------------------------ function Corresponding_Name_Definition (Reference : in Asis.Expression) return Asis.Defining_Name; ------------------------------------------------------------------------------ -- Reference - Specifies an expression to query -- -- Returns the defining_identifier, defining_character_literal, -- defining_operator_symbol, or defining_program_unit_name from the -- declaration of the referenced entity. -- -- - Record component references, return the defining_name of the -- record discriminant or component_declaration. For derived types, the -- result will be an Is_Part_Of_Implicit structural (syntactic) -- component from the declaration of the parent type definition. -- -- - References to implicit operators and inherited subprograms will return -- an Is_Part_Of_Implicit defining name for the operation. The -- Enclosing_Element of the name is an implicit declaration for the -- operation. The Enclosing_Element of the declaration is the associated -- derived_type_definition. -- -- - References to formal parameters given in calls to inherited subprograms -- will return an Is_Part_Of_Implicit defining name for the -- parameter_specification from the inherited subprogram specification. -- -- - References to visible components of instantiated generic packages will -- return a name from the expanded generic specification instance. -- -- - References, within expanded generic instances, that refer to other -- components of the same, or an enclosing, expanded generic instance, -- return a name from the appropriate expanded specification or body -- instance. -- -- Returns a Nil_Element if the reference is to an implicitly declared -- element for which the implementation does not provide declarations and -- defining_name elements. -- -- The Enclosing_Element of a non-Nil result is either a Declaration or a -- Statement. -- -- Appropriate Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Character_Literal -- An_Enumeration_Literal -- -- Returns Element_Kinds: -- Not_An_Element -- A_Defining_Name -- --|IP Implementation Permissions: --|IP --|IP Some implementations do not represent all forms of implicit --|IP declarations such that elements representing them can be easily --|IP provided. An implementation can choose whether or not to construct --|IP and provide artificial declarations for implicitly declared elements. --|IP --|OP------------------------------------------------------------------------- --|OP Should operational queries be provided for each class of implicit --|OP elements, ie. instances, inherited subprograms, predefined operators? --|OP ie. environment programmatic queries. --|OP This goes with issue of consistent commentary for implicit permissions. --|OP --|IR Implementation Requirements: --|IR -- Raises Asis_Inappropriate_Element, with a Status of Value_Error, if passed -- a reference that does not have a declaration: -- -- - a reference to an attribute_designator. Attributes are defined, but -- have no implicit or explicit declarations. -- -- - a name argument from a pragma identifier that does not actually -- reference a declared object. A contrived example of such an argument -- would be: -- -- pragma Should_I_Check ( Really => Yes ); -- -- In this example, the name Yes has no declaration. -- -- Raises Asis_Inappropriate_Element, with a Status of Data_Error, if passed -- a portion of a pragma that was "ignored" by the compiler and which does -- not have (sufficient) semantic information for a proper return result -- to be computed. eg. -- -- pragma I_Am_Ignored (Foof); -- -- The "Foof" expression would be An_Identifier but would raise this exception -- if passed to Corresponding_Name_Definition if the pragma was ignored -- or unprocessed. -- -- Raises Asis_Inappropriate_Element, with a Status of Use_Error, if passed -- a portion of a pragma that is an ambiguous reference to more than one -- entity. eg. -- -- pragma Inline ("+"); -- Inlines all "+" operators -- -- The "+" expression would be An_Operator_Symbol but would raise this -- exception if it actually referenced more than one "+" operator. In this -- case, the Corresponding_Name_Definition_List query can be used to obtain a -- list of referenced entities. -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Name_Definition_List was called --|95 Name_Definition_List and the functional semantics and appropriate --|95 elements have changed. ------------------------------------------------------------------------------ function Corresponding_Name_Definition_List (Reference : in Asis.Element) return Asis.Defining_Name_List; ------------------------------------------------------------------------------ -- Reference - Specifies an entity reference to query -- -- Exactly like Corresponding_Name_Definition except it returns a list. -- The list will almost always have a length of one. The exception to this -- is the case where an expression in a pragma may be ambiguous and reference -- more than one entity. eg. -- -- pragma Inline ("+"); -- Inlines all "+" operators -- -- The "+" expression would be An_Operator_Symbol but could reference more -- than one "+" operator. In this case, the resulting list includes all -- referenced entities. -- -- Appropriate Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Character_Literal -- An_Enumeration_Literal -- -- Returns Element_Kinds: -- A_Defining_Name -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Name_Declaration was called Name_Declaration and --|95 the functional semantics and appropriate elements have changed. ------------------------------------------------------------------------------ function Corresponding_Name_Declaration (Reference : in Asis.Expression) return Asis.Element; ------------------------------------------------------------------------------ -- Reference - Specifies the entity reference to query -- -- Returns the declaration that declared the entity named by the given -- reference. The result is exactly the same as: -- -- Result := Corresponding_Name_Definition (Reference); -- if not Is_Nil (Result) then -- Result := Enclosing_Element (Result); -- end if; -- return Result; -- -- See the comments for Corresponding_Name_Definition for details. -- The result is either a Declaration or a Statement. Statements result -- from references to statement labels, loop identifiers, and block -- identifiers. -- -- Appropriate Element_Kinds: -- An_Expression -- -- Appropriate Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Character_Literal -- An_Enumeration_Literal -- -- Returns Element_Kinds: -- A_Declaration -- A_Statement --|95------------------------------------------------------------------------- --|95 function Is_Predefined for a Reference is deleted. Reason ILL_DEFINED. --|95 Predefined types, exceptions, operators in package Standard can be --|95 checked by testing that the enclosing CU is standard. Is_Predefined --|95 becomes muddled when considering the predefined language environment. --|95 Would every element in package Ada or its children be Is_Predefined? --|95------------------------------------------------------------------------- --|95 function Is_Implicit for a Reference is deleted. Reason SECONDARY. --|95 Equivalent to Is_Part_Of_Implicit(Corresponding_Name_Definition(Ref)). --|95------------------------------------------------------------------------- --|95 function Is_Derived for a Reference is deleted. Reason SECONDARY. --|95 Equivalent to Is_Part_Of_Inherited(Corresponding_Name_Definition(Ref)). --|95------------------------------------------------------------------------- --|95 function Operator_Kind moved to Asis.Elements --|ER--------------------------------------------------------------------------- --|ER An_Explicit_Dereference - 4.1 --|CR --|CR Child elements returned by: --|CR function Prefix --|CR ------------------------------------------------------------------------------ function Prefix (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the name expression to query -- -- Returns the prefix (the construct to the left of: the rightmost unnested -- left parenthesis in function_calls and indexed_components or slices, the -- rightmost 'dot' for selected_components, or the rightmost tick for -- attribute_references). -- -- Returns the operator_symbol for infix operator function calls. The infix -- form A + B is equivalent to the prefix form "+"(A,B). -- -- Appropriate Expression_Kinds: -- An_Explicit_Dereference P.ALL -- An_Attribute_Reference Priv'Base'First -- A_Function_Call Abc(...) or Integer'Image(...) -- An_Indexed_Component An_Array(3) -- A_Selected_Component A.B.C -- A_Slice An_Array(3 .. 5) -- -- Returns Expression_Kinds: -- An_Expression -- --|ER--------------------------------------------------------------------------- --|ER An_Indexed_Component - 4.1.1 --|ER --|CR --|CR Child elements returned by: --|CR function Prefix --|CR function Index_Expressions --|CR ------------------------------------------------------------------------------ function Index_Expressions (Expression : in Asis.Expression) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Expression - Specifies an indexed_component to query -- -- Returns the list of expressions (possibly only one) within the parenthesis, -- in their order of appearance. -- -- Appropriate Expression_Kinds: -- An_Indexed_Component -- -- Returns Element_Kinds: -- An_Expression -- --|ER--------------------------------------------------------------------------- --|ER A_Slice - 4.1.2 --|CR --|CR Child elements returned by: --|CR function Prefix --|CR function Slice_Range --|CR ------------------------------------------------------------------------------ function Slice_Range (Expression : in Asis.Expression) return Asis.Discrete_Range; ------------------------------------------------------------------------------ -- Expression - Specifies the slice to query -- -- Returns the discrete range of the slice. -- -- Appropriate Expression_Kinds: -- A_Slice -- -- Returns Definition_Kinds: -- A_Discrete_Range -- --|95------------------------------------------------------------------------- --|95 function Selection_Kind was deleted. Reason REPLACED and HIERARCHY. ------------------------------------------------------------------------------ function Selector (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the selected_component to query -- -- Returns the selector (the construct to the right of the rightmost 'dot' in -- the selected_component). -- -- Appropriate Expression_Kinds: -- A_Selected_Component -- -- Returns Expression_Kinds: -- An_Identifier -- An_Operator_Symbol -- A_Character_Literal -- An_Enumeration_Literal -- --|95------------------------------------------------------------------------- --|95 function Named_Packages was deleted. Reason REPLACED. --|95 The new query Asis.Clauses.Clause_Names provides equivalent functionaliy. --|95------------------------------------------------------------------------- --|95 function Attribute_Designator_Kind moved to Asis.Elements and is now --|95 called Attribute_Kind. --|95------------------------------------------------------------------------- --|95 function Attribute_Designator_Identifier was called --|95 Attribute_Designator_Name. ------------------------------------------------------------------------------ function Attribute_Designator_Identifier (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies an attribute_reference expression to query -- -- Returns the identifier of the attribute_designator (the construct to the -- right of the rightmost tick of the attribute_reference). The Prefix of -- the attribute_reference may itself be an attribute_reference as in -- T'BASE'FIRST where the prefix is T'BASE and the attribute_designator name -- is FIRST. -- -- Attribute_designator reserved words Access, Delta, and Digits are treated -- as An_Identifier. -- -- Appropriate Expression_Kinds: -- An_Attribute_Reference -- -- Returns Expression_Kinds: -- An_Identifier -- --|95------------------------------------------------------------------------- --|95 function Attribute_Designator_Expressions was called --|95 Attribute_Designator_Arguments. ------------------------------------------------------------------------------ function Attribute_Designator_Expressions (Expression : in Asis.Expression) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Expression - Specifies an attribute expression to query -- -- Returns the static expressions associated with the optional argument of the -- attribute_designator. Expected predefined attributes are A'First(N), -- A'Last(N), A'Length(N), and A'Range(N). -- -- Returns a Nil_Element_List if there are no arguments. -- -- Appropriate Expression_Kinds: -- An_Attribute_Reference -- Appropriate Attribute_Kinds: -- A_First_Attribute -- A_Last_Attribute -- A_Length_Attribute -- A_Range_Attribute -- An_Implementation_Defined_Attribute -- An_Unknown_Attribute -- -- Returns Element_Kinds: -- An_Expression -- --|IP Implementation Permissions: --|IP --|IP This query returns a list to support implementation-defined attributes --|IP that may have more than one static_expression. --|IP --|95------------------------------------------------------------------------- --|95 function Is_Literal was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Position_Number_Image was moved to Asis.Declarations and --|95 works on A_Defining_Name elements only. --|95 function Representation_Value_Image was moved to Asis.Declarations and --|95 works on A_Defining_Name elements only. --|95 The query Corresponding_Name_Definition given A_Character_Literal or --|95 An_Enumeration_Literal elements will provide A_Defining_Name appropriate --|95 for Position_Number_Image or Representation_Value_Image. --|95------------------------------------------------------------------------- --|95 function Record_Component_Associations was called Components. ------------------------------------------------------------------------------ function Record_Component_Associations (Expression : in Asis.Expression; Normalized : in Boolean := False) return Asis.Association_List; ------------------------------------------------------------------------------ -- Expression - Specifies an aggregate expression to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of the record_component_associations of a record_aggregate -- or an extension_aggregate. -- -- Returns a Nil_Element_List if the aggregate is of the form (null record). -- -- An unnormalized list contains all needed associations ordered as they -- appear in the program text. Each unnormalized association has an optional -- list of discriminant_selector_names, and an explicit expression. -- -- A normalized list contains artificial associations representing all -- needed components in an order matching the declaration order of the -- needed components. -- -- Each normalized association represents a one on one mapping of a -- component to the explicit expression. A normalized association has one -- A_Defining_Name component that denotes the discriminant_specification or -- component_declaration, and one An_Expression component that is the -- expression. -- -- Appropriate Expression_Kinds: -- A_Record_Aggregate -- An_Extension_Aggregate -- -- Returns Association_Kinds: -- A_Record_Component_Association -- --|IR Implementation Requirements: --|IR --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. --|IR Normalized associations are never Is_Equal to unnormalized associations. --|IR --|IP Implementation Permissions: --|IP --|IP An implementation may chose to normalize its internal representation --|IP to use defining_identifiers instead of component_selector_names. --|IP --|IP If so, this query will return Is_Normalized associations even if --|IP Normalized is False, and the query --|IP Record_Component_Associations_Normalized will return True. --|IP --|95------------------------------------------------------------------------- --|95 function Extension_Aggregate_Expression is a new query. ------------------------------------------------------------------------------ function Extension_Aggregate_Expression (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies an extension_aggregate expression to query -- -- Returns the ancestor_part expression preceding the reserved word WITH in -- the extension_aggregate. -- -- Appropriate Expression_Kinds: -- An_Extension_Aggregate -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Array_Component_Associations is a new query. ------------------------------------------------------------------------------ function Array_Component_Associations (Expression : in Asis.Expression) return Asis.Association_List; ------------------------------------------------------------------------------ -- Expression - Specifies an array aggregate expression to query -- -- Returns a list of the array_component_associations in an array aggregate. -- -- Appropriate Expression_Kinds: -- A_Positional_Array_Aggregate -- A_Named_Array_Aggregate -- -- Returns Association_Kinds: -- An_Array_Component_Association -- --|AN Application Note: --|AN --|AN While positional_array_aggregates do not have --|AN array_component_associations defined by Ada syntax, ASIS treats --|AN A_Positional_Array_Aggregate as if it were A_Named_Array_Aggregate. --|AN The An_Array_Component_Association elements returned will have --|AN Array_Component_Choices that are a Nil_Element_List for all positional --|AN expressions except an others choice. --|AN --|95------------------------------------------------------------------------- --|95 function Component_Choices was deleted. Equivalent functionality is --|95 provided by two new queries Array_Component_Choices and --|95 Record_Component_Choices. --|95------------------------------------------------------------------------- --|95 function Array_Component_Choices is a new query. ------------------------------------------------------------------------------ function Array_Component_Choices (Association : in Asis.Association) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Association - Specifies the component association to query -- -- If the Association is from a named_array_aggregate: -- -- Returns the discrete_choice_list order of appearance. The choices are -- either An_Expression or A_Discrete_Range elements, or a single -- An_Others_Choice element. -- -- If the Association is from a positional_array_aggregate: -- -- Returns a single An_Others_Choice if the association is an others -- choice (others=>expression). -- -- Returns a Nil_Element_List otherwise. -- -- Appropriate Association_Kinds: -- An_Array_Component_Association -- -- Returns Element_Kinds: -- A_Definition -- An_Expression -- -- Returns Definition_Kinds: -- A_Discrete_Range -- An_Others_Choice -- --|95------------------------------------------------------------------------- --|95 function Record_Component_Choices is a new query. ------------------------------------------------------------------------------ function Record_Component_Choices (Association : in Asis.Association) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Association - Specifies the component association to query -- -- If the Association argument is from an unnormalized list: -- -- - If the Association is a named component association: -- -- Returns the component_choice_list order of appearance. The choices are -- either An_Identifier elements representing component_selector_names, or -- a single An_Others_Choice element. -- -- The Enclosing_Element of the choices is the Association argument. -- -- - If the Association is a positional component association: -- -- Returns a Nil_Element_List. -- -- If the Association argument is from a Normalized list: -- -- Returns a list containing a single choice: -- -- - A_Defining_Name element representing the defining_identifier of -- the component_declaration. -- -- - An_Others_Choice element. -- -- The Enclosing_Element of the A_Defining_Name is the -- component_declaration. The Enclosing_Element of An_Others_Choice is -- the Association argument. -- -- Normalized lists contain artificial ASIS An_Association elements that -- provide one formal A_Defining_Name => actual An_Expression pair per -- association. These artificial associations are Is_Normalized. Their -- component A_Defining_Name or An_Others_Choice elements are not -- Is_Normalized. -- -- Appropriate Association_Kinds: -- A_Record_Component_Association -- -- Returns Element_Kinds: -- A_Defining_Name -- Is_Normalized(Association) -- An_Expression -- not Is_Normalized(Association) -- Returns Expression_Kinds: -- An_Identifier -- A_Definition -- Returns Definition_Kinds: -- An_Others_Choice -- ------------------------------------------------------------------------------ function Component_Expression (Association : in Asis.Association) return Asis.Expression; ------------------------------------------------------------------------------ -- Association - Specifies the component association to query -- -- Returns the expression of the record_component_association or -- array_component_association. -- -- The Enclosing_Element of the expression is the Association argument. -- -- Normalized lists contain artificial ASIS An_Association elements that -- provide one formal A_Defining_Name => actual An_Expression pair per -- association. These artificial associations are Is_Normalized. Their -- component An_Expression elements are not Is_Normalized. -- -- Appropriate Association_Kinds: -- A_Record_Component_Association -- An_Array_Component_Association -- -- Returns Element_Kinds: -- An_Expression --|95------------------------------------------------------------------------- --|95 function Formal_Parameter was moved from Asis.Statements. ------------------------------------------------------------------------------ function Formal_Parameter (Association : in Asis.Association) return Asis.Element; ------------------------------------------------------------------------------ -- Association - Specifies the association to query -- -- If the Association argument is from an unnormalized list: -- -- - If the Association is given in named notation: -- -- Returns An_Identifier representing the formal_parameter_selector_name, -- generic_formal_parameter_selector_name, or pragma_argument_identifier. -- -- The Enclosing_Element of the An_Identifier element is the Association -- argument. -- -- - If the Association is given in positional notation: -- -- Returns a Nil_Element. -- -- If the Association argument is from a Normalized list: -- -- - Returns A_Defining_Name representing the defining_identifier of the -- parameter_specification or generic_formal_parameter_declaration. -- Pragma_argument_associations are not available in normalized form. -- -- - The Enclosing_Element of the A_Defining_Name will be the -- parameter_specification or generic_formal_parameter_declaration element. -- -- Normalized lists contain artificial ASIS An_Association elements that -- provide one formal A_Defining_Name => actual An_Expression pair per -- association. These artificial associations are Is_Normalized. Their -- component A_Defining_Name elements are not Is_Normalized. -- -- Appropriate Association_Kinds: -- A_Parameter_Association -- A_Generic_Association -- A_Pragma_Argument_Association -- -- Returns Element_Kinds: -- Not_An_Element -- A_Defining_Name -- Is_Normalized(Association) -- An_Expression -- not Is_Normalized(Association) -- Returns Expression_Kinds: -- An_Identifier -- --|95------------------------------------------------------------------------- --|95 function Actual_Parameter was moved from Asis.Statements. ------------------------------------------------------------------------------ function Actual_Parameter (Association : in Asis.Association) return Asis.Expression; ------------------------------------------------------------------------------ -- Association - Specifies the association to query -- -- If the Association argument is from an unnormalized list: -- -- Returns An_Expression representing: -- -- - the explicit_actual_parameter of a parameter_association. -- -- - the explicit_generic_actual_parameter of a generic_association. -- -- - the name or expression of a pragma_argument_association. -- -- The Enclosing_Element of An_Expression is the Association argument. -- -- If the Association argument is from a Normalized list: -- -- - If the Association is given explicitly: -- -- Returns An_Expression representing: -- -- - the explicit_actual_parameter of a parameter_association. -- -- - the explicit_generic_actual_parameter of a generic_association. -- -- The Enclosing_Element of An_Expression is the Association argument. -- -- - If the Association is given by default: -- -- Returns An_Expression representing: -- -- - the corresponding default_expression of the Is_Normalized -- A_Parameter_Association. -- -- - the corresponding default_expression or default_name of the -- Is_Normalized A_Generic_Association. -- -- - The Enclosing_Element of the An_Expression element will be the -- parameter_specification or generic_formal_parameter_declaration that -- contains the default_expression or default_name. -- -- Normalized lists contain artificial ASIS An_Association elements that -- provide one formal A_Defining_Name => actual An_Expression pair per -- association. These artificial associations are Is_Normalized. -- Artificial associations of default associations are -- Is_Defaulted_Association. Their component An_Expression elements are -- not Is_Normalized and are not Is_Defaulted_Association. -- -- Appropriate Association_Kinds: -- A_Parameter_Association -- A_Generic_Association -- A_Pragma_Argument_Association -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Discriminant_Selector_Names was called --|95 Discriminant_Simple_Names and moved from Asis.Definitions. ------------------------------------------------------------------------------ function Discriminant_Selector_Names (Association : in Asis.Discriminant_Association) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Association - Specifies the discriminant association to query -- -- If the Association argument is from an unnormalized list: -- -- - If the Association is a named discriminant_association: -- -- Returns a list of the An_Identifier discriminant_selector_names in order -- of appearance. -- -- The Enclosing_Element of the names is the Association argument. -- -- - If the Association is a positional discriminant_association: -- -- Returns a Nil_Element_List. -- -- If the Association argument is from a Normalized list: -- -- Returns a list containing a single A_Defining_Name element representing -- the defining_identifier of the discriminant_specification. -- -- The Enclosing_Element of the A_Defining_Name is the -- discriminant_specification. -- -- Normalized lists contain artificial ASIS An_Association elements that -- provide one formal A_Defining_Name => actual An_Expression pair per -- association. These artificial associations are Is_Normalized. Their -- component A_Defining_Name elements are not Is_Normalized. -- -- Appropriate Association_Kinds: -- A_Discriminant_Association -- -- Returns Element_Kinds: -- A_Defining_Name -- Is_Normalized(Association) -- An_Expression -- not Is_Normalized(Association) -- Returns Expression_Kinds: -- An_Identifier -- --|95------------------------------------------------------------------------- --|95 function Discriminant_Expression moved from Asis.Definitions. ------------------------------------------------------------------------------ function Discriminant_Expression (Association : in Asis.Discriminant_Association) return Asis.Expression; ------------------------------------------------------------------------------ -- Association - Specifies the discriminant_association to query -- -- If the Association argument is from an unnormalized list: -- -- Returns An_Expression representing the expression of the -- discriminant_association. -- -- The Enclosing_Element of An_Expression is the Association argument. -- -- If the Association argument is from a Normalized list: -- -- - If the Association is given explicitly: -- -- Returns An_Expression representing the expression of the -- discriminant_association. -- -- The Enclosing_Element of An_Expression is the Association argument. -- -- - If the Association is given by default: -- -- Returns An_Expression representing: -- -- - the corresponding default_expression of the Is_Normalized -- A_Discriminant_Association. -- -- - The Enclosing_Element of the An_Expression element will be the -- discriminant_specification that contains the default_expression. -- -- Normalized lists contain artificial ASIS An_Association elements that -- provide one formal A_Defining_Name => actual An_Expression pair per -- association. These artificial associations are Is_Normalized. -- Artificial associations of default associations are -- Is_Defaulted_Association. Their component An_Expression elements are -- not Is_Normalized and are not Is_Defaulted_Association. -- -- Appropriate Association_Kinds: -- A_Discriminant_Association -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ function Is_Normalized (Association : in Asis.Association) return Boolean; ------------------------------------------------------------------------------ -- Association - Specifies the association to query -- -- Returns True if the association is a normalized, artificially created -- association returned by the queries Discriminant_Associations, -- Generic_Actual_Part, Call_Statement_Parameters, -- Record_Component_Associations, or Function_Call_Parameters where -- Normalized => True (or the operation returns Is_Normalized associations -- even if Normalized => False). See the Implementation Permissions for -- these queries. -- -- Returns False for any unexpected Element. -- -- Expected Association_Kinds: -- A_Discriminant_Association -- A_Record_Component_Association -- A_Parameter_Association -- A_Generic_Association -- ------------------------------------------------------------------------------ function Is_Defaulted_Association (Association : in Asis.Association) return Boolean; ------------------------------------------------------------------------------ -- Association - Specifies the association to query -- -- Returns True if the association is a normalized, artificially created -- association returned by the queries Discriminant_Associations, -- Generic_Actual_Parameters, Record_Component_Associations, -- Call_Statement_Parameters, or Function_Call_Parameters where -- Normalized => True (or the operation returns default associations even if -- Normalized => False) and the association contains a default expression. -- A default expression is one that is implicitly supplied by the language -- semantics and that was not explicitly supplied (typed) by the user. -- -- Returns False for any unexpected Element. -- -- Note: Always returns False for discriminant associations. Defaulted -- discriminant associations occur only when the discriminant constraint is -- completely missing from a subtype indication. Consequently, it is not -- possible to obtain a (normalized) discriminant constraint list for such -- subtype indications. Always returns False for component associations. -- Aggregates cannot have defaulted components. -- -- Expected Association_Kinds: -- A_Discriminant_Association -- A_Record_Component_Association -- An_Array_Component_Association -- A_Parameter_Association -- A_Generic_Association -- ------------------------------------------------------------------------------ function Expression_Parenthesized (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the parenthesized expression to query -- -- Returns the expression within the parenthesis. This operation unwinds only -- one set of parenthesis at a time, so the result may itself be -- A_Parenthesized_Expression. -- -- A_Parenthesized_Expression kind corresponds only to the (expression) -- alternative in the syntax notion of primary in RM 95 4.4. For example, -- an expression of a type_conversion is A_Parenthesized_Expression only if -- it is similar to the form subtype_mark((expression)) where it has at least -- one set of its own parenthesis. -- -- Appropriate Expression_Kinds: -- A_Parenthesized_Expression -- -- Returns Element_Kinds: -- An_Expression ------------------------------------------------------------------------------ function Is_Prefix_Call (Expression : in Asis.Expression) return Boolean; ------------------------------------------------------------------------------ -- Expression - Specifies the function call expression to query -- -- Returns True if the function call is in prefix form. -- -- Returns False for any unexpected Element. -- -- EG. - Foo (A, B); -- Returns TRUE -- "<" (A, B); -- Returns TRUE -- ... A < B ... -- Returns FALSE -- -- Expected Expression_Kinds: -- A_Function_Call --|95------------------------------------------------------------------------- --|95 function Corresponding_Called_Function was called Called_Function. ------------------------------------------------------------------------------ function Corresponding_Called_Function (Expression : in Asis.Expression) return Asis.Declaration; ------------------------------------------------------------------------------ -- Expression - Specifies the function_call to query -- -- Returns the declaration of the called function. -- -- Returns a Nil_Element if the function_prefix denotes: -- -- - an attribute_reference. -- -- - a predefined operator for which the implementation does not provide an -- artificial function declaration. -- -- Appropriate Expression_Kinds: -- A_Function_Call -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Function_Declaration -- A_Function_Body_Declaration -- A_Function_Body_Stub -- A_Function_Renaming_Declaration -- A_Function_Instantiation -- A_Formal_Function_Declaration -- --|IP Implementation Permissions: --|IP --|IP An implementation can choose whether or not to construct and provide --|IP artificial implicit declarations for predefined operators. --|IP ------------------------------------------------------------------------------ function Function_Call_Parameters (Expression : in Asis.Expression; Normalized : in Boolean := False) return Asis.Association_List; ------------------------------------------------------------------------------ -- Expression - Specifies the function call expression to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of parameter_associations of the call. -- -- Returns a Nil_Element_List if there are no parameter_associations. -- -- An unnormalized list contains only explicit associations ordered as they -- appear in the program text. Each unnormalized association has an optional -- formal_parameter_selector_name and an explicit_actual_parameter component. -- -- A normalized list contains artificial associations representing all -- explicit and default associations. It has a length equal to the number of -- parameter_specifications of the formal_part of the -- parameter_and_result_profile. The order of normalized associations matches -- the order of parameter_specifications. -- -- Each normalized association represents a one on one mapping of a -- parameter_specifications to the explicit or default expression. -- A normalized association has one A_Defining_Name component that denotes the -- parameter_specification, and one An_Expression component that is either the -- explicit_actual_parameter or a default_expression. -- -- Appropriate Expression_Kinds: -- A_Function_Call -- -- Returns Element_Kinds: -- A_Parameter_Association -- --|IR Implementation Requirements: --|IR --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. --|IR Normalized associations provided by default are Is_Defaulted_Association. --|IR Normalized associations are never Is_Equal to unnormalized associations. --|IR --|IP Implementation Permissions: --|IP --|IP An implementation may choose to always include default parameters in its --|IP internal representation. --|IP --|IP An implementation may also choose to normalize its representation --|IP to use defining_identifiers rather than formal_parameter_selector_names. --|IP --|IP In either case, this query will return Is_Normalized associations even if --|IP Normalized is False, and the query Function_Call_Parameters_Normalized --|IP will return True. --|IP --|95------------------------------------------------------------------------- --|95 function Is_Parameter_Association was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Special_Operation_Kind was deleted. Reason REPLACED and --|95 HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Special_Operation_Left_Hand_Side was deleted. Reason REPLACED. --|95 The new queries Short_Circuit_Operation_Left_Expression and --|95 Membership_Test_Expression provide equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Short_Circuit_Operation_Left_Expression is a new query. ------------------------------------------------------------------------------ function Short_Circuit_Operation_Left_Expression (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the short circuit operation to query -- -- Returns the expression preceding the reserved words AND THEN or OR ELSE -- in the short circuit expression. -- -- Appropriate Expression_Kinds: -- An_And_Then_Short_Circuit -- An_Or_Else_Short_Circuit -- -- Returns Element_Kinds: -- An_Expression --|95------------------------------------------------------------------------- --|95 function Short_Circuit_Operation_Right_Expression was called --|95 Special_Operation_Right_Hand_Side. ------------------------------------------------------------------------------ function Short_Circuit_Operation_Right_Expression (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the short circuit operation to query -- -- Returns the expression following the reserved words AND THEN or OR ELSE -- in the short circuit expression. -- -- Appropriate Expression_Kinds: -- An_And_Then_Short_Circuit -- An_Or_Else_Short_Circuit -- -- Returns Element_Kinds: -- An_Expression --|95------------------------------------------------------------------------- --|95 function Membership_Test_Expression is a new query. ------------------------------------------------------------------------------ function Membership_Test_Expression (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the membership test operation to query -- -- Returns the expression on the left hand side of the membership test. -- -- Appropriate Expression_Kinds: -- An_In_Range_Membership_Test -- A_Not_In_Range_Membership_Test -- An_In_Type_Membership_Test -- A_Not_In_Type_Membership_Test -- -- Returns Element_Kinds: -- An_Expression --|95------------------------------------------------------------------------- --|95 function In_Range_Operation_Right_Hand_Side was deleted. Reason REPLACED. --|95 The new query Membership_Test_Range provides equivalent functionality. ------------------------------------------------------------------------------ function Membership_Test_Range (Expression : in Asis.Expression) return Asis.Range_Constraint; ------------------------------------------------------------------------------ -- Expression - Specifies the membership test operation to query -- -- Returns the range following the reserved words IN or NOT IN from the -- membership test. -- -- Appropriate Expression_Kinds: -- An_In_Range_Membership_Test -- A_Not_In_Range_Membership_Test -- -- Returns Constraint_Kinds: -- A_Range_Attribute_Reference -- A_Simple_Expression_Range -- --|95------------------------------------------------------------------------- --|95 function In_Type_Operation_Right_Hand_Side was deleted. Reason REPLACED. --|95 The new query Membership_Test_Subtype_Mark provides equivalent --|95 functionality. ------------------------------------------------------------------------------ function Membership_Test_Subtype_Mark (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the membership test operation to query -- -- Returns the subtype_mark expression following the reserved words IN or -- NOT IN from the membership test. -- -- Appropriate Expression_Kinds: -- An_In_Type_Membership_Test -- A_Not_In_Type_Membership_Test -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- --|95------------------------------------------------------------------------- --|95 function Converted_Or_Qualified_Subtype_Mark was called Type_Mark. ------------------------------------------------------------------------------ function Converted_Or_Qualified_Subtype_Mark (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the type conversion or qualified expression to -- query -- -- Returns the subtype_mark expression that converts or qualifies the -- expression. -- -- Appropriate Expression_Kinds: -- A_Type_Conversion -- A_Qualified_Expression -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- ------------------------------------------------------------------------------ function Converted_Or_Qualified_Expression (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the type conversion or qualified expression to -- query -- -- Returns the expression being converted or qualified. -- -- Appropriate Expression_Kinds: -- A_Type_Conversion -- A_Qualified_Expression -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Allocator_Subtype_Indication was called Allocation_Type. ------------------------------------------------------------------------------ function Allocator_Subtype_Indication (Expression : in Asis.Expression) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Expression - Specifies the allocator expression to query -- -- Returns the subtype indication for the object being allocated. -- -- Appropriate Expression_Kinds: -- An_Allocation_From_Subtype -- -- Returns Definition_Kinds: -- A_Subtype_Indication -- --|95------------------------------------------------------------------------- --|95 function Allocator_Qualified_Expression was called --|95 Qualified_Object_Expression. ------------------------------------------------------------------------------ function Allocator_Qualified_Expression (Expression : in Asis.Expression) return Asis.Expression; ------------------------------------------------------------------------------ -- Expression - Specifies the allocator expression to query -- -- Returns the qualified expression for the object being allocated. -- -- Appropriate Expression_Kinds: -- An_Allocation_From_Qualified_Expression -- -- Returns Expression_Kinds: -- A_Qualified_Expression -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. Kind declaration in new package. ------------------------------------------------------------------------------ end Asis.Expressions; ------------------------------------------------------------------------------ package Asis.Statements is ------------------------------------------------------------------------------ -- Asis.Statements -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of queries that operate on A_Statement, -- A_Path, and An_Exception_Handler elements. -- --|95------------------------------------------------------------------------- --|95 --|95 Changes to package Asis_Statements. --|95 --|95------------------------------------------------------------------------- --|95 function Is_Labeled was deleted. Reason SECONDARY --|95 Equivalent to Is_Nil(Label_Names(Stmt)). ------------------------------------------------------------------------------ function Label_Names (Statement : in Asis.Statement) return Asis.Defining_Name_List; ------------------------------------------------------------------------------ -- Statement - Specifies the statement to query -- -- Returns the label_statement_identifiers (A_Defining_Name elements) that -- define the labels attached to the statement, in their order of appearance. -- -- Returns a Nil_Element_List if there are no labels attached to the statement. -- -- The Enclosing_Element of the A_Defining_Name elements will be the statement. -- -- Appropriate Element_Kinds: -- A_Statement -- -- Returns Defining_Name_Kinds: -- A_Defining_Identifier -- --|95------------------------------------------------------------------------- --|95 function Assignment_Variable_Name was called Object_Assigned_To. ------------------------------------------------------------------------------ function Assignment_Variable_Name (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the assignment statement to query -- -- Returns the expression that names the left hand side of the assignment. -- -- Appropriate Element_Kinds: -- A_Statement -- -- Appropriate Statement_Kinds: -- An_Assignment_Statement -- -- Returns Element_Kinds: -- An_Expression ------------------------------------------------------------------------------ function Assignment_Expression (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the assignment statement to query -- -- Returns the expression from the right hand side of the assignment. -- -- Appropriate Element_Kinds: -- A_Statement -- -- Appropriate Statement_Kinds: -- An_Assignment_Statement -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function If_Statement_Arm_Kind was deleted. Reason REPLACED. --|95 The new Element_Kinds'A_Path provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function If_Statement_Arms was deleted. Reason REPLACED. --|95 The new query Statement_Alternatives provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Statement_Paths is a new query. ------------------------------------------------------------------------------ function Statement_Paths (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Path_List; ------------------------------------------------------------------------------ -- Statement - Specifies the statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the execution paths of the statement, in -- their order of appearance. -- -- The only pragmas returned are those preceding the first alternative in -- a case statement. -- -- Appropriate Statement_Kinds: -- An_If_Statement -- A_Case_Statement -- A_Selective_Accept_Statement -- A_Timed_Entry_Call_Statement -- A_Conditional_Entry_Call_Statement -- An_Asynchronous_Select_Statement -- -- Returns Element_Kinds: -- A_Path -- A_Pragma -- --|95------------------------------------------------------------------------- --|95 function Condition_Expression now operates on A_Path elements. ------------------------------------------------------------------------------ function Condition_Expression (Path : in Asis.Path) return Asis.Expression; ------------------------------------------------------------------------------ -- Path - Specifies the execution path to query -- -- Returns the condition expression for an IF path or an ELSIF path. -- -- Appropriate Path_Kinds: -- An_If_Path -- An_Elsif_Path -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Sequence_Of_Statements was called Arm_Statements and now --|95 operates on A_Path elements. ------------------------------------------------------------------------------ function Sequence_Of_Statements (Path : in Asis.Path; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Path - Specifies the execution path to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the statements and pragmas from an execution path, -- in their order of appearance. -- -- Appropriate Element_Kinds: -- A_Path -- -- Returns Element_Kinds: -- A_Statement -- A_Pragma -- ------------------------------------------------------------------------------ function Case_Expression (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the case statement to query -- -- Returns the expression of the case statement that determines which -- execution path will be taken. -- -- Appropriate Element_Kinds: -- A_Statement -- -- Appropriate Statement_Kinds: -- A_Case_Statement -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Case_Statement_Alternatives was deleted. Reason REPLACED. --|95 The new query Statement_Alternatives provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Is_When_Others was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ function Case_Statement_Alternative_Choices (Path : in Asis.Path) return Asis.Element_List; ------------------------------------------------------------------------------ -- Path - Specifies the case_statement_alternative execution path to query -- -- Returns a list of the 'WHEN | ' elements, in their -- order of appearance. -- -- Appropriate Path_Kinds: -- A_Case_Path -- -- Returns Element_Kinds: -- An_Expression -- A_Definition -- -- Returns Definition_Kinds: -- A_Discrete_Range -- An_Others_Choice -- --|95------------------------------------------------------------------------- --|95 function Case_Statement_Alternative_Statements was deleted. Reason --|95 REPLACED. The new query Sequence_Of_Statements provides equivalent --|95 functionality. --|95------------------------------------------------------------------------- --|95 function Loop_Kind was deleted. Reason HIERARCHY. --|95------------------------------------------------------------------------- --|95 function Loop_Simple_Name was deleted. --|95 function Loop_Statement_Identifier was deleted. --|95 Reason REPLACED. The new query Statement_Identifier provides --|95 equivalent functionality. --|OP------------------------------------------------------------------------- --|OP Open issue that a statement identifier is should not be Defining_Name. ------------------------------------------------------------------------------ function Statement_Identifier (Statement : in Asis.Statement) return Asis.Defining_Name; ------------------------------------------------------------------------------ -- Statement - Specifies the statement to query -- -- Returns the identifier for the loop_statement or block_statement. -- -- Returns a Nil_Element if the loop has no identifier. -- -- The Enclosing_Element of the name is the statement. -- -- Appropriate Statement_Kinds: -- A_Loop_Statement -- A_While_Loop_Statement -- A_For_Loop_Statement -- A_Block_Statement -- -- Returns Defining_Name_Kinds: -- Not_A_Defining_Name -- A_Defining_Identifier -- --|95------------------------------------------------------------------------- --|95 function Is_Name_Repeated has been expanded to expect --|95 An_Accept_Statement. This was deleted in previous drafts. ------------------------------------------------------------------------------ function Is_Name_Repeated (Statement : in Asis.Statement) return Boolean; ------------------------------------------------------------------------------ -- Statement - Specifies the statement to query -- -- Returns True if the name of the accept, loop, or block is repeated after -- the end of the statement. Always returns True for loop or block -- statements since the name is required. -- -- Returns False for any unexpected Element. -- -- Expected Statement_Kinds: -- A_Block_Statement -- A_Loop_Statement -- An_Accept_Statement -- ------------------------------------------------------------------------------ function While_Condition (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the loop statement to query -- -- Returns the condition expression associated with the while loop. -- -- Appropriate Element_Kinds: -- A_Statement -- -- Appropriate Statement_Kinds: -- A_While_Loop_Statement -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ function For_Loop_Parameter_Specification (Statement : in Asis.Statement) return Asis.Declaration; ------------------------------------------------------------------------------ -- Statement - Specifies the loop statement to query -- -- Returns the declaration of the A_Loop_Parameter_Specification. -- -- Appropriate Statement_Kinds: -- A_For_Loop_Statement -- -- Returns Declaration_Kinds: -- A_Loop_Parameter_Specification -- --|95------------------------------------------------------------------------- --|95 function Specification_Subtype_Definition was Loop_Parameter_Range --|95 and has moved to Asis.Declarations. --|95------------------------------------------------------------------------- --|95 function Is_Reverse_Loop_Parameter was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ function Loop_Statements (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Statement - Specifies the loop statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns the sequence_of_statements and any pragmas from the loop_statement, -- in their order of appearance. -- -- Appropriate Statement_Kinds: -- A_Loop_Statement -- A_While_Loop_Statement -- A_For_Loop_Statement -- -- Returns Element_Kinds: -- A_Pragma -- A_Statement -- --|95------------------------------------------------------------------------- --|95 function Block_Simple_Name was deleted. Reason REPLACED. The new --|95 query Statement_Identifier provides equivalent functionality. ------------------------------------------------------------------------------ function Is_Declare_Block (Statement : in Asis.Statement) return Boolean; ------------------------------------------------------------------------------ -- Statement - Specifies the statement to query -- -- Returns True if the statement is a block_statement and it was created with -- the use of the DECLARE reserved word. The presence or absence of any -- declarative_items is not relevant. -- -- Returns False if the DECLARE reserved word does not appear in the -- block_statement, or for any unexpected Element. -- -- Expected Statement_Kinds: -- A_Block_Statement -- --|95------------------------------------------------------------------------- --|95 function Block_Declarative_Items was called Declarative_Items. ------------------------------------------------------------------------------ function Block_Declarative_Items (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Declarative_Item_List; ------------------------------------------------------------------------------ -- Statement - Specifies the block statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the declarations, representation_clauses, pragmas, -- and use_clauses in the declarative_part of the block_statement, in their -- order of appearance. -- -- Returns a Nil_Element_List if there are no declarative items. -- -- Appropriate Statement_Kinds: -- A_Block_Statement -- -- Returns Element_Kinds: -- A_Declaration -- A_Pragma -- A_Clause -- --|95------------------------------------------------------------------------- --|95 function Block_Statements was called Block_Body_Statements. ------------------------------------------------------------------------------ function Block_Statements (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Statement - Specifies the block statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the statements and pragmas for the block_statement, in -- their order of appearance. -- -- Returns a Nil_Element_List if there are no statements or pragmas. This -- can only occur for a block_statement obtained from the obsolescent query -- Body_Block_Statement when its argument is a package_body -- that has no sequence_of_statements. -- -- Appropriate Statement_Kinds: -- A_Block_Statement -- -- Returns Element_Kinds: -- A_Pragma -- A_Statement -- --|95------------------------------------------------------------------------- --|95 function Block_Statements added Include_Pragmas parameter. ------------------------------------------------------------------------------ function Block_Exception_Handlers (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Exception_Handler_List; ------------------------------------------------------------------------------ -- Statement - Specifies the block statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns a list of the exception_handlers of the block_statement, in their -- order of appearance. -- -- The only pragmas returned are those following the reserved word EXCEPTION -- and preceding the reserved word WHEN of first exception handler. -- -- Returns a Nil_Element_List if there are no exception_handlers. -- -- Appropriate Statement_Kinds: -- A_Block_Statement -- -- Returns Element_Kinds: -- An_Exception_Handler -- A_Pragma -- ------------------------------------------------------------------------------ function Exit_Loop_Name (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the exit statement to query -- -- Returns the name of the exited loop. -- -- Returns a Nil_Element if no loop name is present. -- -- Appropriate Statement_Kinds: -- An_Exit_Statement -- -- Returns Expression_Kinds: -- Not_An_Expression -- An_Identifier -- A_Selected_Component -- ------------------------------------------------------------------------------ function Exit_Condition (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the exit statement to query -- -- Returns the WHEN condition of the exit statement. -- -- Returns a Nil_Element if no condition is present. -- -- Appropriate Statement_Kinds: -- An_Exit_Statement -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Loop_Exited was called Loop_Exited. ------------------------------------------------------------------------------ function Corresponding_Loop_Exited (Statement : in Asis.Statement) return Asis.Statement; ------------------------------------------------------------------------------ -- Statement - Specifies the exit statement to query -- -- Returns the loop statement exited by the exit statement. -- -- Appropriate Statement_Kinds: -- An_Exit_Statement -- -- Returns Element_Kinds: -- A_Statement -- ------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------ function Return_Expression (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the return statement to query -- -- Returns the expression in the return statement. -- -- Returns a Nil_Element if no expression is present. -- -- Appropriate Statement_Kinds: -- A_Return_Statement -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression -- ------------------------------------------------------------------------------ function Goto_Label (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the goto statement to query -- -- Returns the expression reference for the label, as specified by the goto -- statement. -- -- Appropriate Statement_Kinds: -- A_Goto_Statement -- -- Returns Expression_Kinds: -- An_Identifier -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Destination_Statement was called --|95 Destination_Statement. ------------------------------------------------------------------------------ function Corresponding_Destination_Statement (Statement : in Asis.Statement) return Asis.Statement; ------------------------------------------------------------------------------ -- Statement - Specifies the goto statement to query -- -- Returns the target statement specified by the goto statement. -- -- Appropriate Statement_Kinds: -- A_Goto_Statement -- -- Returns Element_Kinds: -- A_Statement -- ------------------------------------------------------------------------------ function Called_Name (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the procedure call or entry call statement to query -- -- Returns the name of the called procedure or entry. The name of an entry -- family takes the form of An_Indexed_Component. -- -- Appropriate Statement_Kinds: -- An_Entry_Call_Statement -- A_Procedure_Call_Statement -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Called_Entity was called Called_Procedure. ------------------------------------------------------------------------------ function Corresponding_Called_Entity (Statement : in Asis.Statement) return Asis.Declaration; ------------------------------------------------------------------------------ -- Statement - Specifies the procedure_call_statement or -- entry_call_statement to query -- -- Returns the declaration of the procedure or entry denoted by the call. -- -- Returns a Nil_Element if the procedure_prefix denotes an -- attribute_reference. -- -- Appropriate Statement_Kinds: -- An_Entry_Call_Statement -- A_Procedure_Call_Statement -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Procedure_Declaration -- A_Procedure_Body_Declaration -- A_Procedure_Body_Stub -- A_Procedure_Renaming_Declaration -- A_Procedure_Instantiation -- A_Formal_Procedure_Declaration -- An_Entry_Declaration -- --|95------------------------------------------------------------------------- --|95 function Call_Statement_Parameters was called Call_Parameters. ------------------------------------------------------------------------------ function Call_Statement_Parameters (Statement : in Asis.Statement; Normalized : in Boolean := False) return Asis.Association_List; ------------------------------------------------------------------------------ -- Statement - Specifies the procedure_call_statement or -- entry_call_statement to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of parameter_associations of the call. -- -- Returns a Nil_Element_List if there are no parameter_associations. -- -- An unnormalized list contains only explicit associations ordered as they -- appear in the program text. Each unnormalized association has an optional -- formal_parameter_selector_name and an explicit_actual_parameter component. -- -- A normalized list contains artificial associations representing all -- explicit and default associations. It has a length equal to the number of -- parameter_specifications of the formal_part of the -- parameter_and_result_profile. The order of normalized associations matches -- the order of parameter_specifications. -- -- Each normalized association represents a one on one mapping of a -- parameter_specifications to the explicit or default expression. -- A normalized association has one A_Defining_Name component that denotes the -- parameter_specification, and one An_Expression component that is either the -- explicit_actual_parameter or a default_expression. -- -- Appropriate Statement_Kinds: -- An_Entry_Call_Statement -- A_Procedure_Call_Statement -- -- Returns Element_Kinds: -- A_Parameter_Association -- --|IR Implementation Requirements: --|IR --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. --|IR Normalized associations provided by default are Is_Defaulted_Association. --|IR Normalized associations are never Is_Equal to unnormalized associations. --|IR --|IP Implementation Permissions: --|IP --|IP An implementation may choose to always include default parameters in its --|IP internal representation. --|IP --|IP An implementation may also choose to normalize its representation --|IP to use defining_identifiers rather than formal_parameter_selector_names. --|IP --|IP In either case, this query will return Is_Normalized associations even if --|IP Normalized is False, and the query Call_Statement_Parameters_Normalized --|IP will return True. --|IP --|95------------------------------------------------------------------------- --|95 function Formal_Parameter was moved to Asis.Expressions. --|95------------------------------------------------------------------------- --|95 function Actual_Parameter was moved to Asis.Expressions. --|95------------------------------------------------------------------------- --|95 function Accept_Entry_Index was called Family_Index. --|95 It no longer operates on An_Entry_Call_Statement elements. ------------------------------------------------------------------------------ function Accept_Entry_Index (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the accept statement to query -- -- Returns the entry index expression in the accept statement. -- -- Returns a Nil_Element if the statement has no explicit entry index, -- -- Appropriate Statement_Kinds: -- An_Accept_Statement -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression --|95------------------------------------------------------------------------- --|95 function Accept_Entry_Direct_Name was called Accept_Entry_Simple_Name. ------------------------------------------------------------------------------ function Accept_Entry_Direct_Name (Statement : in Asis.Statement) return Asis.Name; ------------------------------------------------------------------------------ -- Statement - Specifies the accept statement to query -- -- Returns the direct name of the entry. The name follows the reserved -- word ACCEPT. -- -- Appropriate Statement_Kinds: -- An_Accept_Statement -- -- Returns Expression_Kinds: -- An_Identifier ------------------------------------------------------------------------------ function Accept_Parameters (Statement : in Asis.Statement) return Asis.Parameter_Specification_List; ------------------------------------------------------------------------------ -- Statement - Specifies the accept statement to query -- -- Returns a list of parameter specifications in the formal part of the accept -- statement, in their order of appearance. -- -- Returns a Nil_Element_List if the accept_statement has no parameters. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all multiple name parameter specifications into an -- equivalent sequence of corresponding single name parameter specifications. -- See RM 95 3.3.1(7). -- -- Appropriate Statement_Kinds: -- An_Accept_Statement -- -- Returns Declaration_Kinds: -- A_Parameter_Specification -- ------------------------------------------------------------------------------ function Accept_Body_Statements (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Statement - Specifies the accept statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns the list of statements and pragmas from the body of the accept -- statement, in their order of appearance. -- -- Appropriate Statement_Kinds: -- An_Accept_Statement -- -- Returns Element_Kinds: -- A_Pragma -- A_Statement -- --|95------------------------------------------------------------------------- --|95 function Accept_Body_Exception_Handlers is a new query. ------------------------------------------------------------------------------ function Accept_Body_Exception_Handlers (Statement : in Asis.Statement; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Statement - Specifies the accept statement to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns the list of exception handlers and pragmas from the body of the -- accept statement, in their order of appearance. -- -- Appropriate Statement_Kinds: -- An_Accept_Statement -- -- Returns Element_Kinds: -- A_Pragma -- An_Exception_Handler -- --|95------------------------------------------------------------------------- --|95 function Corresponding_Entry was called Accepted_Entry. ------------------------------------------------------------------------------ function Corresponding_Entry (Statement : in Asis.Statement) return Asis.Declaration; ------------------------------------------------------------------------------ -- Statement - Specifies the accept statement to query -- -- Returns the declaration of the entry accepted in this statement. -- -- Appropriate Statement_Kinds: -- An_Accept_Statement -- -- Returns Declaration_Kinds: -- An_Entry_Declaration -- --|95------------------------------------------------------------------------- --|95 function Requeue_Entry_Name is a new query. ------------------------------------------------------------------------------ function Requeue_Entry_Name (Statement : in Asis.Statement) return Asis.Name; ------------------------------------------------------------------------------ -- Statement - Specifies the requeue statement to query -- -- Returns the entry name following the reserved word ACCEPT. The name of -- an entry family takes the form of An_Indexed_Component. -- -- Appropriate Statement_Kinds: -- A_Requeue_Statement -- A_Requeue_Statement_With_Abort -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ function Delay_Expression (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the delay statement to query -- -- Returns the expression for the duration of the delay. -- -- Appropriate Statement_Kinds: -- A_Delay_Until_Statement -- A_Delay_Relative_Statement -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Select_Statement_Arm_Kind was deleted. Reason REPLACED. --|95 The new Element_Kinds'A_Path provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Select_Statement_Arms was deleted. Reason REPLACED. --|95 The new query Statement_Paths provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Select_Alternative_Kind was deleted. Reason REPLACED. --|95 The new Element_Kinds'A_Path provides equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Arm_Select_Alternative was deleted. Reason REPLACED by --|95 new functions Statement_Paths and Sequence_Of_Statements. --|95------------------------------------------------------------------------- --|95 function Is_Guarded was deleted. Reason SECONDARY --|95 Equivalent to Is_Nil(Guard(Stmt_Path)). ------------------------------------------------------------------------------ function Guard (Path : in Asis.Path) return Asis.Expression; ------------------------------------------------------------------------------ -- Path - Specifies the select statement execution path to query -- -- Returns the conditional expression guard for the path. -- -- Returns a Nil_Element if there is no guard, or if the path is from a -- timed_entry_call, a conditional_entry_call, or an asynchronous_select -- statement where a guard is not legal. -- -- Appropriate Path_Kinds: -- A_Select_Path -- An_Or_Path -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Select_Alternative_Statements was deleted. Reason REPLACED. --|95 function Else_Statements was deleted. Reason REPLACED. --|95 function Entry_Call_Statements was deleted. Reason REPLACED. --|95 The new query Sequence_Of_Statements provides the combined equivalent --|95 functionality. --|95------------------------------------------------------------------------- --|95 function Timed_Entry_Call_Or_Statements was deleted. Reason REPLACED. --|95 The query Select_Alternative followed by the new query --|95 Sequence_Of_Statements provides equivalent functionality. ------------------------------------------------------------------------------ function Aborted_Tasks (Statement : in Asis.Statement) return Asis.Expression_List; ------------------------------------------------------------------------------ -- Statement - Specifies the abort statement to query -- -- Returns a list of the task names from the ABORT statement, in their order -- of appearance. -- -- Appropriate Statement_Kinds: -- An_Abort_Statement -- -- Returns Element_Kinds: -- An_Expression -- --|95------------------------------------------------------------------------- --|95 function Choice_Parameter_Specification is a new query. ------------------------------------------------------------------------------ function Choice_Parameter_Specification (Handler : in Asis.Exception_Handler) return Asis.Declaration; ------------------------------------------------------------------------------ -- Handler - Specifies the exception handler to query -- -- Returns the choice parameter specification following the reserved word WHEN -- in the exception handler. -- -- Returns a Nil_Element if there is no explicit choice parameter. -- -- Appropriate Element_Kinds: -- An_Exception_Handler -- -- Returns Declaration_Kinds: -- Not_A_Declaration -- A_Choice_Parameter_Specification --|95------------------------------------------------------------------------- --|95 function Is_Others_Handler was deleted. Reason HIERARCHY. ------------------------------------------------------------------------------ function Exception_Choices (Handler : in Asis.Exception_Handler) return Asis.Element_List; ------------------------------------------------------------------------------ -- Handler - Specifies the exception handler to query -- -- Returns a list of the 'WHEN | ' elements, in their -- order of appearance. Choices are either the exception name expression or -- an others choice. -- -- Appropriate Element_Kinds: -- An_Exception_Handler -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- -- Returns Definition_Kinds: -- An_Others_Choice -- ------------------------------------------------------------------------------ function Handler_Statements (Handler : in Asis.Exception_Handler; Include_Pragmas : in Boolean := False) return Asis.Statement_List; ------------------------------------------------------------------------------ -- Handler - Specifies the exception handler to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns the list of statements and pragmas from the body of the -- exception handler, in their order of appearance. -- -- Appropriate Element_Kinds: -- An_Exception_Handler -- -- Returns Element_Kinds: -- A_Pragma -- A_Statement -- ------------------------------------------------------------------------------ function Raised_Exception (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the raise statement to query -- -- Returns the expression that names the raised exception. -- -- Returns a Nil_Element if there is no explicitly named exception. -- -- Appropriate Statement_Kinds: -- A_Raise_Statement -- -- Returns Expression_Kinds: -- Not_An_Expression -- An_Identifier -- A_Selected_Component -- ------------------------------------------------------------------------------ function Qualified_Expression (Statement : in Asis.Statement) return Asis.Expression; ------------------------------------------------------------------------------ -- Statement - Specifies the code statement to query -- -- Returns the qualified aggregate expression representing the code statement. -- -- Appropriate Statement_Kinds: -- A_Code_Statement -- -- Returns Expression_Kinds: -- A_Qualified_Expression -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. Kind declaration in new package. ------------------------------------------------------------------------------ end Asis.Statements; ------------------------------------------------------------------------------ package Asis.Clauses is ------------------------------------------------------------------------------ -- -- Asis.Clauses -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of queries that operate on A_Clause -- elements. -- --|95------------------------------------------------------------------------- --|95 --|95 Changes to package Asis_Clauses. --|95 --|95------------------------------------------------------------------------- --|95 package Asis_Clauses was called Asis_Representation_Clauses. --|95------------------------------------------------------------------------- --|95 function Clause_Names is a new query. --|95------------------------------------------------------------------------- --|95 function Representation_Clause_Kind was called Kind and has moved to --|95 Asis.Elements. --|95------------------------------------------------------------------------- --|95 function Associated_Type was deleted. Reason SECONDARY. --|95------------------------------------------------------------------------- --|95 function Length_Clause_Attribute_Kind was deleted. Reason REPLACED. --|95------------------------------------------------------------------------- --|95 function Associated_Length_Clause_Representations was deleted. --|95 Reason REPLACED. --|95 function Associated_Enumeration_Type_Representation was deleted. --|95 Reason REPLACED. --|95 function Associated_Record_Type_Representation was deleted. --|95 Reason REPLACED. --|95 function Associated_Address_Representation was deleted. --|95 Reason REPLACED. --|95 The new query Asis.Declarations.Corresponding_Representation_Clauses --|95 provides the combined equivalent functionality operating on --|95 A_Declaration elements rather than A_Type_Definition or name elements. --|95------------------------------------------------------------------------- --|95 function Length_Clause_Attribute was deleted. Reason REPLACED. --|95 function Enumeration_Representation_Clause_Type_Simple_Name was deleted. --|95 Reason REPLACED. --|95 function Record_Representation_Clause_Type_Simple_Name was deleted. --|95 Reason REPLACED. --|95 function Representation_Clause_Name is a new query providing the --|95 combined equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Length_Clause_Simple_Expression was deleted. --|95 function Enumeration_Representation_Clause_Aggregate was deleted. --|95 function Representation_Clause_Expression is a new query providing the --|95 combined equivalent functionality. --|95------------------------------------------------------------------------- --|95 function Record_Representation_Clause_Alignment_Clause_Pragmas was --|95 deleted. Reason REDUNDANT. Asis.Elements.Pragmas provides equivalent --|95 functionality. --|95------------------------------------------------------------------------- --|95 function Mod_Clause_Expression was called --|95 Record_Representation_Clause_Alignment_Clause_Expression. --|95------------------------------------------------------------------------- --|95 function Component_Clause_Position was called --|95 Component_Clause_Relative_Address. --|95------------------------------------------------------------------------- --|95 package Operations was deleted. Kind declaration in new package. --|ER------------------------------------------------------------------------- --|ER A_Use_Package_Clause - 8.4 --|ER A_Use_Type_Clause - 8.4 --|ER A_With_Clause - 10.1.2 --|CR --|CR Child elements returned by: --|CR function Clause_Names --|CR ------------------------------------------------------------------------------ function Clause_Names (Clause : in Asis.Element) return Asis.Name_List; ------------------------------------------------------------------------------ -- Clause - Specifies the with_clause or use_clause to query -- -- Returns a list of the names that appear in the given clause. -- The names in the list should be in their order of appearance in the -- original clauses from the compilation text. -- -- Results of this query may vary across ASIS implementations. Some -- implementations normalize all clauses containing multiple names -- into an equivalent sequence of corresponding single clauses. -- Similarly, an implementation may keep a name only once even though that -- name may appear more than once in a clause. -- -- Appropriate Element_Kinds: -- A_Use_Package_Clause -- A_Use_Type_Clause -- A_With_Clause -- -- Returns Expression_Kinds: -- An_Identifier -- A_Selected_Component -- An_Attribute_Reference -- --|ER------------------------------------------------------------------------- --|ER A_Representation_Clause - 13.1 --|ER------------------------------------------------------------------------- --|ER An_Attribute_Definition_Clause - 13.3.1 --|ER An_Enumeration_Representation_Clause - 13.4 --|ER An_At_Clause - J.7 --|CR --|CR Child elements returned by: --|CR function Representation_Clause_Name --|CR function Representation_Clause_Expression --|CR ------------------------------------------------------------------------------ function Representation_Clause_Name (Clause : in Asis.Clause) return Asis.Name; ------------------------------------------------------------------------------ -- Clause - Specifies the representation_clause to query -- -- Returns the direct_name expression following the reserved word FOR. -- -- Appropriate Clause_Kinds: -- A_Representation_Clause -- A_Component_Clause -- -- Returns Expression_Kinds: -- An_Identifier -- An_Attribute_Reference -- ------------------------------------------------------------------------------ function Representation_Clause_Expression (Clause : in Asis.Representation_Clause) return Asis.Expression; ------------------------------------------------------------------------------ -- Clause - Specifies the representation_clause to query -- -- Returns the expression following the reserved word USE or the reserved -- words USE AT. -- -- Appropriate Representation_Clause_Kinds: -- An_Attribute_Definition_Clause -- An_Enumeration_Representation_Clause -- An_At_Clause -- -- Returns Element_Kinds: -- An_Expression -- --|ER------------------------------------------------------------------------- --|ER A_Record_Representation_Clause - 13.5.3 --|CR --|CR Child elements returned by: --|CR function Representation_Clause_Name --|CR function Mod_Clause_Expression --|CR function Component_Clauses --|CR ------------------------------------------------------------------------------ function Mod_Clause_Expression (Clause : in Asis.Representation_Clause) return Asis.Expression; ------------------------------------------------------------------------------ -- Clause - Specifies the record representation clause to query -- -- Returns the static_expression appearing after the reserved words AT MOD. -- -- Returns a Nil_Element if a mod_clause is not present. -- -- Appropriate Representation_Clause_Kinds: -- A_Record_Representation_Clause -- -- Returns Element_Kinds: -- Not_An_Element -- An_Expression -- ------------------------------------------------------------------------------ function Component_Clauses (Clause : in Asis.Representation_Clause; Include_Pragmas : in Boolean := False) return Asis.Component_Clause_List; ------------------------------------------------------------------------------ -- Clause - Specifies the record representation clause to query -- Include_Pragmas - Specifies whether pragmas are to be returned -- -- Returns the component_clauses and pragmas from the -- record_representation_clause, in their order of appearance. -- -- Returns a Nil_Element_List if the record_representation_clause has no -- component_clauses or pragmas. -- -- Appropriate Representation_Clause_Kinds: -- A_Record_Representation_Clause -- -- Returns Element_Kinds: -- A_Clause -- A_Pragma -- -- Returns Clause_Kinds: -- A_Component_Clause -- --|ER--------------------------------------------------------------------------- --|ER A_Component_Clause - 13.5.3 --|CR --|CR Child elements returned by: --|CR function Representation_Clause_Name --|CR function Component_Clause_Position --|CR function Component_Clause_Range --|CR ------------------------------------------------------------------------------ function Component_Clause_Position (Clause : in Asis.Component_Clause) return Asis.Expression; ------------------------------------------------------------------------------ -- Clause - Specifies the component_clause to query -- -- Returns the position expression for the component_clause. -- -- Appropriate Clause_Kinds: -- A_Component_Clause -- -- Returns Element_Kinds: -- An_Expression -- ------------------------------------------------------------------------------ function Component_Clause_Range (Clause : in Asis.Component_Clause) return Asis.Discrete_Range; ------------------------------------------------------------------------------ -- Clause - Specifies the component_clause to query -- -- Returns the first_bit .. last_bit range for the component_clause. -- -- Appropriate Clause_Kinds: -- A_Component_Clause -- -- Returns Discrete_Range_Kinds: -- A_Discrete_Simple_Expression_Range -- ------------------------------------------------------------------------------ end Asis.Clauses; ------------------------------------------------------------------------------ package Asis.Text is ------------------------------------------------------------------------------ -- Asis.Text -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package encapsulates a set of operations to access the text of ASIS -- Elements. It assumes no knowledge of the existence, location, or form of -- the program text. -- -- The text of a program consists of the texts of one or more compilations. -- The text of each compilation is a sequence of separate lexical elements. -- Each lexical element is either a delimiter, an identifier (which may be a -- reserved word), a numeric literal, a character literal, a string literal, -- blank space, or a comment. -- -- Each ASIS Element has a text image whose value is the series of characters -- contained by the text span of the Element. The text span covers all the -- characters from the first character of the Element through the last -- character of the Element over some range of lines. -- -- General Usage Rules: -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers from the compilation -- text. -- -- Any ASIS_Text query may raise Asis_Failed with a Status of Text_Error if -- the program text cannot be located or retrieved for any reason such as -- renaming, deletion, corruption, or moving of the text. -- ------------------------------------------------------------------------------ function First_Line_Number (Element : in Asis.Element) return Asis.Line_Number; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the first line number on which the text of the element resides. -- -- Returns 0 if not Is_Text_Avaliable(Element). -- --|AN Application Note: --|AN --|AN The line number recorded for a particular element may or may --|AN not match the "true" line number of the program text for that element --|AN if the Ada environment and the local text editors do not agree on the --|AN definition of "line". For example, the RM states that any occurance of --|AN an Ascii.Cr character is to be treated as one or more end-of-line --|AN occurances. On most Unix systems, the editors do not treat a carriage --|AN return as being an end-of-line character. --|AN --|AN Ada treats all of the following as end-of-line characters: Ascii.Cr, --|AN Ascii.Lf, Ascii.Ff, Ascii.Vt. It is up to the compilation system to --|AN determine whether sequences of these characters causes one, or more, --|AN end-of-line occurances. Be warned, if the Ada environment and the --|AN system editor (or any other line-counting program) do not use the same --|AN end-of-line conventions, then the line numbers reported by ASIS may not --|AN match those reported by those other programs. --|AN ------------------------------------------------------------------------------ function Last_Line_Number (Element : in Asis.Element) return Asis.Line_Number; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the last line number on which the text of the element resides. -- -- Returns 0 if not Is_Text_Avaliable(Element). -- ------------------------------------------------------------------------------ function Element_Span (Element : in Asis.Element) return Asis.Span; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the span of the given element. -- -- Returns a Nil_Span if not Is_Text_Available(Element). -- ------------------------------------------------------------------------------ function Compilation_Unit_Span (Element : in Asis.Element) return Asis.Span; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the span of the text comprising the enclosing compilation unit of -- the given element. -- -- Returns a Nil_Span if not Is_Text_Available(Element). -- ------------------------------------------------------------------------------ function Compilation_Span (Element : in Asis.Element) return Asis.Span; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns the span of the text comprising the compilation to which the -- element belongs. The text span may include one or more compilation units. -- -- Returns a Nil_Span if not Is_Text_Available(Element). -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Line) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the line to check -- -- Returns True if the argument is the Nil_Line. -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Line_List) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the line list to check -- -- Returns True if the argument has a 'Length of zero. -- ------------------------------------------------------------------------------ function Is_Equal (Left : in Asis.Line; Right : in Asis.Line) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first of the two lines -- Right - Specifies the second of the two lines -- -- Returns True if the two lines encompass the same text (have the same Span -- and are from the same compilation). -- ------------------------------------------------------------------------------ function Is_Identical (Left : in Asis.Line; Right : in Asis.Line) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the first of the two lines -- Right - Specifies the second of the two lines -- -- Returns True if the two lines encompass the same text (have the same Span -- and are from the same compilation) and are from the same Context. -- ------------------------------------------------------------------------------ function Length (Line : in Asis.Line) return Asis.Character_Position; ------------------------------------------------------------------------------ -- Line - Specifies the line to query -- -- Returns the length of the line. -- ------------------------------------------------------------------------------ function Lines (Element : in Asis.Element) return Asis.Line_List; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns a list of lines covering the span of the given program element. -- -- Returns a Nil_Line_List if not Is_Text_Available(Element). -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers in the compilation -- text. -- -- The first Line of the result contains text from the compilation starting at -- the First_Line/First_Column of Element's Span. The last Line of the result -- contains text from the compilation ending at the Last_Line/Last_Column of -- the Element's Span. Text before or after those limits is not reflected -- in the returned list. ------------------------------------------------------------------------------ function Lines (Element : in Asis.Element; Span : in Asis.Span) return Asis.Line_List; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- Span - Specifies the textual span to return -- -- Returns a list of lines covering the given span from the compilation -- containing the given program element. -- -- Returns a Nil_Line_List if not Is_Text_Available(Element). -- -- This operation can be used to access lines from text outside the span of an -- element, but still within the compilation. For example, lines containing -- preceding comments or lines between two elements. -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers in the compilation -- text. -- -- The first Line of the result contains text from the compilation starting at -- line Span.First_Line and column Span.First_Column. The last Line of the -- result contains text from the compilation ending at line Span.Last_Line and -- column Span.Last_Column. Text before or after those limits is not -- reflected in the returned list. -- -- Raises Asis_Inappropriate_Line_Number if the Span defines a Nil_Span or a -- line whose number is outside the range of text lines that can be accessed -- through the element. ------------------------------------------------------------------------------ function Lines (Element : in Asis.Element; First_Line : in Asis.Line_Number; Last_Line : in Asis.Line_Number) return Asis.Line_List; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- First_Line - Specifies the first line to return -- Last_Line - Specifies the last line to return -- -- Returns a list of Lines covering the full text for each of the indicated -- lines from the compilation containing the given element. This operation -- can be used to access lines from text outside the span of an element, but -- still within the compilation. -- -- Returns a Nil_Line_List if not Is_Text_Available(Element). -- -- Line lists can be indexed to obtain individual lines. The bounds of each -- list correspond to the lines with those same numbers in the compilation -- text. -- -- Raises Asis_Inappropriate_Line_Number if the Span defines a Nil_Span or a -- line whose number is outside the range of text lines that can be accessed -- through the element. -- --|95------------------------------------------------------------------------- --|95 function Delimiter_Image was called Image_Delimiter. ------------------------------------------------------------------------------ function Delimiter_Image return Asis.Asis_String; ------------------------------------------------------------------------------ -- Returns the Asis_String used as the delimiter separating individual lines of -- text within the Asis_String Image of an element. --|95------------------------------------------------------------------------- --|95 function Element_Image operating on an Element was called Image. ------------------------------------------------------------------------------ function Element_Image (Element : in Asis.Element) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns an Asis_String image of the element. The image of an element may -- span more than one line, in which case the Asis_String returned by the -- function Delimiter_Image separates the individual lines. The bounds on -- the returned string are 1..N, N is as large as necessary. -- -- Returns a Nil_Asis_String if not Is_Text_Available(Element). -- -- If an Element's Span begins at column position P, the returned string will -- be padded at the beginning with P-1 white space characters (Ascii.' ' or -- Ascii.Ht). The first character of the Element's image will thus begin at -- character P of the returned string. Due to the possible presence of -- Ascii.Ht characters, the "column" position of characters within the image -- may not be the same as their print-column positions when the image is -- displayed on a screen or printed. -- -- NOTE: The image of a large element may exceed the range of an Asis_String. -- In this case, the exception Asis_Failed will be raised with a Status of -- Capacity_Error. Use the Lines function to operate on the image of large -- elements. --|95------------------------------------------------------------------------- --|95 function Line_Image operating on an Line was called Image. ------------------------------------------------------------------------------ function Line_Image (Line : in Asis.Line) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Line - Specifies the line to query -- -- Returns an Asis_String image of the line. The image of a single lexical -- element can be sliced from the Asis_String value using the first and last -- column character positions from the Span of the Element. The bounds on the -- returned string are 1 .. Length(Line). -- -- If the Line is the first line from the Lines result for an Element, it may -- represent only a portion of a line from the original compilation. If the -- Element's Span began at character position P, the first Line of it's Lines -- result will be padded at the beginning with P-1 white space characters -- (Ascii.' ' or Ascii.Ht). The first character of the Element's image will -- thus begin at character P of the string for the first Line. Due to the -- possible presence of Ascii.Ht characters, the "column" position of -- characters within the image may not be the same as their print-column -- positions when the image is displayed or printed. -- -- Similarly, if the Line is the last line from the Lines result for an -- Element, it may represent only a portion of a line from the original -- compilation. The string image of such a Line will be shorter than the -- actual line from compilation and will contain only the initial portion of -- that line. -- ------------------------------------------------------------------------------ function Non_Comment_Image (Line : in Asis.Line) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Line - Specifies the line to query -- -- Returns an Asis_String image of a Line up to, but excluding, any comment -- appearing in that Line. -- -- The value returned is the same as that returned by the Image function, -- except that any hyphens ("--") that start a comment, and any characters -- that follow those hypens, are dropped. -- -- The bounds on the returned string are 1..N, where N is one less than the -- column of any hyphens ("--") that start a comment on the line. -- ------------------------------------------------------------------------------ function Comment_Image (Line : in Asis.Line) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Line - Specifies the line to query -- -- Returns an Asis_String image of any comment on that line, excluding any -- lexical elements preceding the comment. -- -- The value returned is the same as that returned by the Image function, -- except that any text prior to the two adjacent hyphens ("--") which start a -- comment is replace by an equal number of spaces. If the hyphens began in -- column P of the Line, they will also begin in character position P of the -- returned string. -- -- A Nil_Asis_String is returned if the line has no comment. -- -- The bounds of the string are 1..N, where N is as large as necessary. -- ------------------------------------------------------------------------------ function Is_Text_Available (Element : in Asis.Element) return Boolean; ------------------------------------------------------------------------------ -- Element - Specifies the element to query -- -- Returns True if the implementation can return a valid text image for the -- given element. -- -- Returns False for any Element that Is_Nil, Is_Part_Of_Implicit, or -- Is_Part_Of_Instance. -- -- Returns False if the text of the element cannot be located for any reason -- such as renaming, deletion, or moving of text. -- --|IR Implementation Requirements: --|IR --|IR An implementation shall make text available for all explicit elements. --|IR ------------------------------------------------------------------------------ function Debug_Image (Line : in Asis.Line) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Line - Specifies the line to convert -- -- Returns an Asis_String value containing implementation defined debug -- information associated with the line. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS vendor. They can be presumed -- to contain information useful when debugging the implementation itself. -- They are also suitable for use by the ASIS application when printing simple -- application debugging messages during application development. They are -- intended to be, to some worthwhile degree, intelligible to the user. -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. end Asis.Text; with Ada.Direct_Io; with Ada.Io_Exceptions; ------------------------------------------------------------------------------ package Asis.Ids is ------------------------------------------------------------------------------ -- Asis.Ids - ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package is part of the Optional ASIS Id Annex. -- It may or may not be present in all ASIS implementations. -- -- Support for permanent unique Element "Identifiers" (Ids). -- -- This package encapsulates a set of operations and queries that implement -- the ASIS Id abstraction. An Id is a way of identifying a particular -- Element, from a particular Compilation_Unit, from a particular Context. -- Ids may be written to files. Ids may be read from files and converted into -- an Element value with the use of a suitable open Context. -- -- More than one Id may be manipulated at one time. Limitations on the use of -- Ids will tend to be a) maximum program memory size, and b) system specific -- maximum number of open files. -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Id) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the Id to check -- -- Returns True if the Id is the Nil_Id. ------------------------------------------------------------------------------ function Is_Nil (Right : in Asis.Id_List) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the Id list to check -- -- Returns True if the Id list has a length of zero. ------------------------------------------------------------------------------ function Is_Equal (Left : in Asis.Id; Right : in Asis.Id) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the left Id to compare -- Right - Specifies the right Id to compare -- -- Returns True if Left and Right represent the same physical Id, from the -- same physical compilation unit. The two Ids would convert -- to Is_Identical Elements when converted with the same open ASIS Context. -- ------------------------------------------------------------------------------ function Is_Identical (Left : in Asis.Id; Right : in Asis.Id) return Boolean renames Is_Equal; ------------------------------------------------------------------------------ -- Same operation as Is_Equal. This name provided as a convenience. -- ------------------------------------------------------------------------------ function Create_Id (Element : in Asis.Element) return Asis.Id; ------------------------------------------------------------------------------ -- Element - Specifies any Element value whose Id is desired -- -- Returns a unique Id value corresponding to this Element, from the -- corresponding Enclosing_Compilation_Unit and the corresponding -- Enclosing_Context. The Id value will not be equal ("=") to the Id value -- for any other Element value unless the two Elements are Is_Identical. -- -- Nil_Id is returned for a Nil_Element. -- -- All Element_Kinds are appropriate. ------------------------------------------------------------------------------ function Create_Element (Id : in Asis.Id; Context : in Asis.Context) return Asis.Element; ------------------------------------------------------------------------------ -- Id - Specifies the Id to be converted to an Element -- Context - Specifies the Context containing the Element with this Id -- -- Returns the Element value corresponding to the given Id. The Id must -- correspond to an Element available from a Compilation_Unit contained by -- (referencible through) the given Context. -- -- Raises Asis_Inappropriate_Element if the Element value is not available -- though the given Context. The Status will be Value_Error and the Diagnosis -- string will attempt to indicate the reason for the failure. eg. "Unit is -- inconsistent", "No such unit", "Element is inconsistent (Unit inconsistent)", -- etc. ------------------------------------------------------------------------------ -- ASIS Id I/O Facilities ------------------------------------------------------------------------------ package Id_Io is -- This interface is a copy of the Ada.Direct_Io interface. -- The internals of this package are implementation dependent and -- the amount of space taken, in an Id file, by an ASIS Id value is -- variable. An ASIS Id value has a fixed 'Size, but, the actual -- size of the data represented by that Id value may be arbitrarily -- large. It may contain ACCESS values. type File_Type is limited private; type File_Mode is ( In_File, Inout_File, Out_File); -- Count has an ASIS implementation-defined upper bound. -- Note: An Id can take up more than one "slot" in an Id file. -- The 1st Id in a file will probably be at From => 1, but, the 2nd -- Id in a file is not necessarily at From => 2. type Count is new Integer range 0 .. Integer'Last / Asis.Id'Size; subtype Positive_Count is Count range 1 .. Count'Last; -- File management procedure Create (File : in out File_Type; Mode : in File_Mode := Inout_File; Name : in String := ""; Form : in String := ""); procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := ""); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : File_Mode); procedure Reset (File : in out File_Type); function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String; function Is_Open (File : in File_Type) return Boolean; -- Input and output operations procedure Read (File : in File_Type; Item : out Asis.Id; From : in Positive_Count); procedure Read (File : in File_Type; Item : out Asis.Id); procedure Read (File : in File_Type; Item : out Asis.Element; From : in Positive_Count; Context : in Asis.Context); procedure Read (File : in File_Type; Item : out Asis.Element; Context : in Asis.Context); procedure Write (File : in File_Type; Item : in Asis.Id; To : in Positive_Count); procedure Write (File : in File_Type; Item : in Asis.Id); procedure Write (File : in File_Type; Item : in Asis.Element; To : in Positive_Count); procedure Write (File : in File_Type; Item : in Asis.Element); procedure Set_Index (File : in File_Type; To : in Positive_Count); function Index (File : in File_Type) return Positive_Count; function Size (File : in File_Type) return Count; function End_Of_File (File : File_Type) return Boolean; -- Exceptions Status_Error : exception renames Ada.Io_Exceptions.Status_Error; Mode_Error : exception renames Ada.Io_Exceptions.Mode_Error; Name_Error : exception renames Ada.Io_Exceptions.Name_Error; Use_Error : exception renames Ada.Io_Exceptions.Use_Error; Device_Error : exception renames Ada.Io_Exceptions.Device_Error; End_Error : exception renames Ada.Io_Exceptions.End_Error; Data_Error : exception renames Ada.Io_Exceptions.Data_Error; private -- ASIS implementation dependent. package Id_Id_Io is new Ada.Direct_Io (Asis.Id_Segment); type File_Type is new Id_Id_Io.File_Type; end Id_Io; ------------------------------------------------------------------------------ -- ASIS Id_Segment I/O Facilities ------------------------------------------------------------------------------ function Create_Id_Segments (Element : in Asis.Element) return Asis.Id_Segment_List; function Create_Id_Segments (Id : in Asis.Id) return Asis.Id_Segment_List; ------------------------------------------------------------------------------ -- Element - Specifies any Element value whose Id is desired -- Id - Specifies an Id whose Id_Segment_List is desired -- -- Returns the Id_Segment_List value corresponding to this Element (or Id), -- from the corresponding Enclosing_Compilation_Unit and the corresponding -- Enclosing_Context. The meaning of equality ("=") between Id_Segment_Lists -- is implementation defined and not portable. Only use "=" between Id -- values. -- -- All Element_Kinds and all Id values are appropriate. ------------------------------------------------------------------------------ function Create_Element (List : in Asis.Id_Segment_List; Context : in Asis.Context) return Asis.Element; function Create_Id (List : in Asis.Id_Segment_List) return Asis.Id; ------------------------------------------------------------------------------ -- List - Specifies the Id_Segment_List to be converted -- Context - Specifies the Context containing the Element with this Id -- -- Returns the Id or Element value corresponding to the given Id_Segment_List. -- To obtain an Element value, the list must correspond to an Element -- available from a Compilation_Unit contained by (referencible through) the -- given Context. -- -- Raises Asis_Inappropriate_Element if the Element value is not available -- though the given Context. The Status will be Value_Error and the Diagnosis -- string will attempt to indicate the reason for the failure. eg. "Unit is -- inconsistent", "No such unit", etc. -- -- Raises Asis_Inappropriate_Element if the list cannot be converted into an -- Id value (list is too short, too long, or simply invalid). ------------------------------------------------------------------------------ generic type Positive_Count is range <>; type File_Type is limited private; with procedure Read_From (File : in File_Type; Item : out Asis.Id_Segment; From : in Positive_Count); with procedure Write_To (File : in File_Type; Item : in Asis.Id_Segment; To : in Positive_Count); with procedure Read (File : in File_Type; Item : out Asis.Id_Segment); with procedure Write (File : in File_Type; Item : in Asis.Id_Segment); package Id_Segment_Io is -- This package reads and writes Id_Segment_Lists using an I/O -- mechanism provided by the Application. It is possible to -- perform Id I/O using an instantiation of Ada.Direct_Io and this -- generic. procedure Read (File : in File_Type; Item : out Asis.Id); procedure Read (File : in File_Type; Item : out Asis.Element; Context : in Asis.Context); procedure Read (File : in File_Type; Item : out Asis.Id; From : in Positive_Count); procedure Read (File : in File_Type; Item : out Asis.Element; From : in Positive_Count; Context : in Asis.Context); procedure Write (File : in File_Type; Item : in Asis.Id); procedure Write (File : in File_Type; Item : in Asis.Element); procedure Write (File : in File_Type; Item : in Asis.Id; To : in Positive_Count); procedure Write (File : in File_Type; Item : in Asis.Element; To : in Positive_Count); end Id_Segment_Io; ------------------------------------------------------------------------------ function Debug_Image (Id : in Asis.Id) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Id - Specifies an Id to convert -- -- Returns an Asis_String value containing implementation defined debug -- information associated with the Id. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS vendor. They can be presumed -- to contain information useful when debugging the implementation itself. -- They are also suitable for use by the ASIS application when printing simple -- application debugging messages during application development. They are -- intended to be, to some worthwhile degree, intelligible to the user. -- ------------------------------------------------------------------------------ function Debug_Image (Segment : in Asis.Id_Segment) return Asis.Asis_String; ------------------------------------------------------------------------------ -- Segment - Specifies an Id_Segment to convert -- -- Returns an Asis_String value containing implementation defined debug -- information associated with the segment. -- -- The return value uses Asis.Text.Delimiter_Image to separate the lines -- of multi-line results. The return value does not end with -- Asis.Text.Delimiter_Image. -- -- These values are intended for two purposes. They are suitable for -- inclusion in problem reports sent to the ASIS vendor. They can be presumed -- to contain information useful when debugging the implementation itself. -- They are also suitable for use by the ASIS application when printing simple -- application debugging messages during application development. They are -- intended to be, to some worthwhile degree, intelligible to the user. -- --|95------------------------------------------------------------------------- --|95 package Operations was deleted. end Asis.Ids; with Ada.Io_Exceptions; with Ada.Sequential_Io; ------------------------------------------------------------------------------ package Asis_Portable_Transfer is ------------------------------------------------------------------------------ -- Asis_Portable_Transfer -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package is part of the Optional ASIS Data Decomposition Annex. -- It may or may not be present in all ASIS implementations. -- -- Support for logging and delogging of application data using ASIS. -- -- These interfaces do not make use of the normal ASIS implementation. -- This is a standalone package. It is not necessary to initialize ASIS -- before using this interface. -- -- This interface is intended to be separate from the normal ASIS -- implementation. That is, linking with this interface does not cause the -- full ASIS implementation to be linked with an application. This keeps the -- memory cost of this facility to a minimum. However, it also means that the -- normal ASIS exceptions, Status, and Diagnosis facilities are not available. -- This interface may propagate exceptions other than those defined in -- Asis.Exceptions. In particular, the I/O facilities may raise any of the -- normal Ada I/O exceptions from package Ada.Io_Exceptions. -- ------------------------------------------------------------------------------ -- Portable Data Representation - an ordered "stream" of data values -- -- The portable representation for application data is an array of data -- values. This portable data representation is guaranteed to be valid when -- written, and later read, on the same machine architecture, using the same -- vendor compiler and runtime system. Portability of the data values, across -- vendors and architectures, is not guaranteed. Some vendors may be able to -- provide data values which are portable across a larger subset of their -- supported machine architectures. -- -- Some of the problems encountered when changing architectures are: bit -- order, byte order, floating point representation, and alignment -- constraints. Some of the problems encountered when changing runtime -- systems or vendors are: type representation, optimization, record padding, -- and other I/O subsystem implementation variations. -- -- The nature of these data values is deliberately unspecified. A vendor will -- chose a data value type that is suitable for the expected uses of these -- arrays and data values. Arrays and data values have these uses: -- -- 1) Array values will be used in conjunction with the -- Asis_Data_Decomposition interface. The data value type should be -- readily decomposable, by that package, so that array and record -- components can be efficiently extracted from a data stream represented -- by this array type. The efficiency of that interface is a priority. -- -- 2) The data value type will be read and written by applications. It -- should have a size that makes efficient I/O possible. Applications can -- be expected to perform I/O in any or all of these ways: -- -- a) Ada.Sequential_Io or Ada.Direct_Io could be used to read or write -- these values. -- -- b) Individual values may be placed inside other types and those types -- may be read or written. -- -- c) The 'Address of a data value, plus the 'Size of the data value -- type, may be used to perform low level system I/O. Note: This -- requires the 'Size of the type and the 'Size of a variable of that -- type to be the same for some implementations. -- -- d) Individual values may be passed through Unchecked_Conversion in -- order to obtain a different value type, of the same 'Size, suitable -- for use with some user I/O facility. This usage is nonportable -- across vendors. -- -- 3) Array values will be read and written by applications. The data value -- type should have a size that makes efficient I/O possible. -- Applications can be expected to perform I/O in any or all of these ways: -- -- a) Ada.Sequential_Io or Ada.Direct_Io could be used to read or write a -- constrained array subtype. -- -- b) Array values may be placed inside other types and those types may -- be read and written. -- -- c) The 'Address of the first array value, plus the 'Length of the -- array times the 'Size of the values, may be used to perform low -- level system I/O. Note: This implies that the array type is -- unpacked, or, that the packed array type has no "padding" (eg. -- groups of five 6-bit values packed into 32-bit words with 2 bits -- of padding every 5 elements). -- -- d) Array values may be passed through Unchecked_Conversion in order to -- obtain an array value, with a different value type, suitable for -- use with some user I/O facility. This usage is nonportable across -- vendors. -- -- The data value type should be chosen so that the 'Address of the first -- array data value is also the 'Address of the first storage unit containing -- array data. This is especially necessary for target architectures where -- the "bit" instructions address bits in the opposite direction as that used -- by normal machine memory (or array component) indexing. A recommended -- 'Size would be System.Storage_Unit (or a multiple of that size). -- -- Vendors that do not support Unchecked_Conversion of array values, or which -- do not guarantee that Unchecked_Conversion of array values will always "do -- the right thing" (convert only the data, and not the dope vector -- information), should provide warnings in their ASIS documentation that -- detail possible consequences and workarounds. -- -- The index range for the Portable_Data type must be a numeric type whose -- range is large enough to encompass the Portable_Data representation for all -- possible runtime data values. -- -- All conversion interfaces always return Portable_Data array values with a -- 'First of one (1). -- -- The following declarations of Portable_Value and Portable_Index are -- examples only. The Portable_Value type may be implemented in any way -- whatsoever. It need not be a numeric type. ------------------------------------------------------------------------------ type Portable_Value is range -(2 ** 31) .. 2 ** 31 - 1; type Portable_Index is new Integer; subtype Portable_Positive is Portable_Index range 1 .. Portable_Index'Last; type Portable_Data is array (Portable_Positive range <>) of Portable_Value; Nil_Portable_Data : Portable_Data (0 .. -1); --|95------------------------------------------------------------------------- --|95 package Operations was deleted. ------------------------------------------------------------------------------ -- Generics that create portable data streams. ------------------------------------------------------------------------------ generic -- Ada 95 notation for a constrained subtype. -- type Constrained_Subtype (<>) is private; type Constrained_Subtype is private; package Portable_Constrained_Subtype is function Convert (Value : in Constrained_Subtype) return Portable_Data; end Portable_Constrained_Subtype; ------------------------------------------------------------------------------ -- Value - Specifies a data value which is to be converted to a portable -- data stream -- -- Instantiated with a scalar subtype, or a fully constrained composite -- subtype, this function will correctly convert values of that subtype to a -- portable data value. "Correctly" means that no information is lost. No -- guarantee is made that the result will not be larger (larger 'Size) than -- the argument. -- -- Instantiation of this generic, with arguments other than scalar types or -- fully constrained subtypes, will fail to compile or will fail to execute -- and raise Constraint_Error. ------------------------------------------------------------------------------ generic type Unconstrained_Record_Type is private; package Portable_Unconstrained_Record_Type is function Convert (Value : in Unconstrained_Record_Type) return Portable_Data; end Portable_Unconstrained_Record_Type; ------------------------------------------------------------------------------ -- Value - Specifies a record value which is to be converted to a portable -- data stream -- -- Instantiated with a record type, this function will correctly convert -- values of that type to a portable data value. "Correctly" means that no -- information is lost. No guarantee is made that the result will not be -- larger (larger 'Size) than the argument. -- -- This generic may also be instantiated with fully constrained subtypes. -- However, the Portable_Constrained_Subtype generic is likely to be a more -- efficient mechanism for these subtypes. -- -- Instantiation of this generic, with unconstrained array types, will not -- fail at compile time or at runtime. However, no guarantee is made that -- such instantiations will operate correctly; data may be lost. ------------------------------------------------------------------------------ generic type Element_Type is private; type Index_Type is (<>); type Array_Type is array (Index_Type range <>) of Element_Type; package Portable_Array_Type_1 is function Convert (Value : in Array_Type) return Portable_Data; end Portable_Array_Type_1; generic type Element_Type is private; type Index_Type_1 is (<>); type Index_Type_2 is (<>); type Array_Type is array (Index_Type_1 range <>, Index_Type_2 range <>) of Element_Type; package Portable_Array_Type_2 is function Convert (Value : in Array_Type) return Portable_Data; end Portable_Array_Type_2; generic type Element_Type is private; type Index_Type_1 is (<>); type Index_Type_2 is (<>); type Index_Type_3 is (<>); type Array_Type is array (Index_Type_1 range <>, Index_Type_2 range <>, Index_Type_3 range <>) of Element_Type; package Portable_Array_Type_3 is function Convert (Value : in Array_Type) return Portable_Data; end Portable_Array_Type_3; ------------------------------------------------------------------------------ -- Value - Specifies an array value which is to be converted to a portable -- data stream -- -- Instantiated with an unconstrained array subtype, this function will -- correctly convert values of that subtype to a portable data value. -- "Correctly" means that no information is lost. No guarantee is made that -- the result will not be larger (larger 'Size) than the argument. -- This interface will correctly capture the array index (dope vector) -- information associated with the array value. -- -- Use the Portable_Constrained_Subtype generic for statically constrained -- array subtypes. -- -- Array types with more than 3 dimensions can be converted to portable data -- streams by placing them inside a discriminated record type (where the -- discriminants are the dynamic array index constraints) and then converting -- the record value. The record will then contain the necessary array index -- (dope vector) information. -- ------------------------------------------------------------------------------ -- Packages for reading/writing sequential portable data streams. ------------------------------------------------------------------------------ package Portable_Data_Io is type File_Type is limited private; type File_Mode is ( In_File, Out_File); -- File management procedure Create (File : in out File_Type; Mode : in File_Mode := Out_File; Name : in String := ""; Form : in String := ""); procedure Open (File : in out File_Type; Mode : in File_Mode; Name : in String; Form : in String := ""); procedure Close (File : in out File_Type); procedure Delete (File : in out File_Type); procedure Reset (File : in out File_Type; Mode : in File_Mode); procedure Reset (File : in out File_Type); function Mode (File : in File_Type) return File_Mode; function Name (File : in File_Type) return String; function Form (File : in File_Type) return String; function Is_Open (File : in File_Type) return Boolean; -- Input and output operations function Read (File : in File_Type) return Portable_Value; procedure Write (File : in File_Type; Data_Stream : in Portable_Value); -- Read/Write single values. function Read (File : in File_Type) return Portable_Data; procedure Write (File : in File_Type; Data_Stream : in Portable_Data); -- Read/Write array values. generic type Data_Type is private; with function Convert (Value : in Data_Type) return Portable_Data; package Write_Data_Type is procedure Write (File : in File_Type; Value : in Data_Type); -- Convenience interface. May be more efficient, but is -- exactly equivalent to: -- -- Write (File, Convert(Value)); -- end Write_Data_Type; function End_Of_File (File : in File_Type) return Boolean; -- Exceptions Status_Error : exception renames Ada.Io_Exceptions.Status_Error; Mode_Error : exception renames Ada.Io_Exceptions.Mode_Error; Name_Error : exception renames Ada.Io_Exceptions.Name_Error; Use_Error : exception renames Ada.Io_Exceptions.Use_Error; Device_Error : exception renames Ada.Io_Exceptions.Device_Error; End_Error : exception renames Ada.Io_Exceptions.End_Error; Data_Error : exception renames Ada.Io_Exceptions.Data_Error; private package Seq_Io is new Ada.Sequential_Io (Portable_Value); type File_Type is new Seq_Io.File_Type; end Portable_Data_Io; end Asis_Portable_Transfer; with Asis_Portable_Transfer; ------------------------------------------------------------------------------ package Asis.Data_Decomposition is ------------------------------------------------------------------------------ -- Asis.Data_Decomposition -- ASIS 95 Draft Version 2.0.F -- May 1996 -- -- This package is part of the Optional ASIS Data Decomposition Annex. -- It may or may not be present in all ASIS implementations. -- -- Operations to decompose data values using the ASIS type information and a -- Portable_Data stream, representing an actual data value of that type. -- -- An application can write data, using the Asis_Portable_Transfer package to -- an external medium for later retrieval by another application. The second -- application reads that data and then uses this package to convert that data -- into useful information. Simple discrete scalar types can be converted -- directly into useful information. Composite types, such as records and -- arrays, must first be broken into their various discriminants and -- components. -- -- A data stream representing a record value can be decomposed into a group -- of discriminant and component data streams by extracting those streams from -- the record's data stream. This extraction is performed by applying any of -- the Record_Components which describe the discriminants and components of -- the record type. Each discriminant and each component of a record type is -- described by a Record_Component value. Each value encapsulates the -- information needed, by the implementation, to efficiently extract the -- associated field from a data stream representing a record value of the -- correct type. -- -- A data stream representing an array value can be decomposed into a group of -- component data streams by extracting those streams from the array's data -- stream. This extraction is performed by applying the single -- Array_Component which describes the components of the array type. One -- Array_Component value is used to describe all array components. The value -- encapsulates the information needed, by the implementation, to efficiently -- extract any of the array components. -- -- Assumptions and Limitations of this Interface: -- -- 1. The data stream is appropriate for the ASIS host machine. Eg. -- The implementation of this interface will not need to worry about -- byte flipping or reordering of bits caused by movement of data between -- machine architectures. -- -- 2. Records, arrays, and their components may be packed. -- -- 3. Records, array components, enumerations, and scalar types may have -- representation and length clauses applied to them. This includes scalar -- types used as record discriminants and array indicies. -- -- 4. This specification supports two of the three type models discussed -- below. Models A and B are supported. Model C is not supported. -- -- A. Simple "static" types contain no variants, have a single fixed 'Size, -- and all components and attributes are themselves static and/or fully -- constrained. The size and position for any component of the type can be -- determined without regard to constraints. For example: -- -- type Static_Record is -- record -- F1, F2 : Natural; -- C1 : Character; -- A1 : String (1..5); -- end record; -- -- type Static_Discriminated (X : Boolean) is -- record -- F1, F2 : Natural; -- C1 : Character; -- end record; -- -- type Static_Array is array (Integer range 1 .. 100) of Boolean; -- type Static_Enum is (One, Two, Three); -- type Static_Integer is range 1 .. 512; -- type Static_Float is digits 15 range -100.0 .. 100.0; -- type Static_Fixed is delta 0.1 range -100.0 .. 100.0; -- -- B. Simple "dynamic" types contain one or more components or attributes -- whose size, position, or value depends on the value of one or more -- constraints computed at execution time. This means that the size, -- position, or number of components within the data type cannot be -- determined without reference to actual constraint values. -- -- Records containing components, whose size depends on discriminants -- of the record, can be handled because the discriminants for a record -- value are fully specified by the data stream form of the record value. -- For example: -- -- type Dynamic_Length (Length : Natural) is -- record -- S1 : String (1 .. Length); -- end record; -- -- type Dynamic_Variant (When : Boolean) is -- record -- case When is -- when True => -- C1 : Character; -- when False => -- null; -- end case; -- end record; -- -- Arrays with an unconstrained subtype, whose 'Length, 'First, and 'Last -- depend on dynamic index constraints, can be handled because these -- attributes can be queried and stored when the data stream is written. -- For example: -- -- I : Integer := Some_Function; -- type Dynamic_Array is -- array (Integer range I .. I + 10) of Boolean; -- -- type Heap_Array is array (Integer range <>) of Boolean; -- type Access_Array is access Heap_Array; -- X : Access_Array := new Heap_Array (1 .. 100); -- -- C. Complex, externally "discriminated" records, contain one or more -- components whose size or position depends on the value of one or more -- non-static external values (values not stored within instances of the -- type) at execution time. The size for a value of the type cannot be -- determined without reference to these external values, whose runtime -- values are not known to the ASIS Context and cannot be automatically -- recorded by the Asis_Portable_Transfer generics. For example: -- -- N : Natural := Function_Call(); -- .... -- declare -- type Complex is -- record -- S1 : String (1 .. N); -- end record; -- begin -- .... -- end; -- -- -- General Usage Rules: -- -- All operations in this package will attempt to detect the use of invalid -- data streams. A data stream is "invalid" if an operation determines that -- the stream could not possibly represent a value of the expected variety. -- Possible errors are: stream is of incorrect length, stream contains bit -- patterns which are illegal, etc. The exception Asis_Inappropriate_Element -- will be raised in these cases. The Status value will be Data_Error. The -- Diagnosis string will indicate the kind of error detected. -- -- All implementations will handle arrays with a minimum of 16 dimensions, -- or the number of dimensions allowed by their compiler, whichever is -- smaller. ------------------------------------------------------------------------------ package Local_Renames is -- Renames which allow notational consistency between the ASIS package -- specifications and ASIS applications. package Asis renames Asis_Vendor_Primitives; end Local_Renames; use Local_Renames; ------------------------------------------------------------------------------ -- Record_Component -- -- Describes one discriminant or component of a record type. Implementation -- is highly vendor dependent. The "=" operator is not meaningful between -- Record_Component values unless one of them is the Nil_Record_Component -- value. -- -- A record type describes composite values which contain zero or more -- discriminant and component fields. A_Record_Type_Definition can be queried -- to obtain a list of Record_Components. Each Record_Component contains the -- information necessary to extract one discriminant or component field of the -- record. -- -- Record_Components are intended for use with data stream extraction -- operations. An extraction operation is performed using a Record_Component, -- in conjunction with a data stream representing a value of the record type. -- The record data stream contains data for all fields of the record. The -- result is an extracted data stream representing just the value of the one -- field. Record_Components are implemented so as to allow for efficient -- extraction of field values. -- -- An extracted field data stream is suitable for all uses. If the field is a -- scalar type, it can be converted directly into useful information. If the -- field is, in turn, another composite value, it can be further decomposed -- into its own component values. -- -- There are two ways to obtain the Record_Components or the Array_Component -- needed to further decompose an embedded composite field. First, if the -- type of the field is known, the type definition can be directly queried to -- obtain the Record_Components or the Array_Component that describe its -- internal structure. Second, the Record_Component used to extract the field -- can be queried to obtain the same Record_Components or the same -- Array_Component. Both methods return identical information. -- -- This kind of nested decomposition can be carried to any required level. -- -- Record_Components become invalid when the Context, from which they -- originate, is closed. All Record_Components are obtained by referencing a) -- an Element, which has an associated Context, b) another Record_Component, -- or c) an Array_Component. Ultimately, all component values originate from -- a A_Type_Definition Element; that Element determines their Context of -- origin. ------------------------------------------------------------------------------ type Record_Component is private; Nil_Record_Component : constant Record_Component; type Record_Component_List is array (Asis.List_Index range <>) of Record_Component; ------------------------------------------------------------------------------ -- Array_Component -- -- Describes the components of an array valued field for a record type. -- Implementation is highly vendor dependent. The "=" operator is not -- meaningful between Array_Component values unless one of them is the -- Nil_Array_Component value. -- -- An array type describes composite values which contain zero or more indexed -- components. An_Array_Type_Definition can be queried to obtain a single -- Array_Component. The Array_Component contains the information necessary to -- extract any arbitrary component of the array. -- -- Array_Components are intended for use with data stream extraction -- operations. An extraction operation is performed using an Array_Component, -- in conjunction with a data stream representing a value of the array type. -- The array data stream contains data for all components of the array. The -- result is an extracted data stream representing just the value of the one -- component. Array_Components are implemented so as to allow for efficient -- extraction of array component values. -- -- An extracted component data stream is suitable for all uses. If the -- component is a scalar type, it can be converted directly into useful -- information. If the component is, in turn, another composite value, it can -- be further decomposed into its own component values. -- -- There are two ways to obtain the Record_Components or the Array_Component -- needed to further decompose an embedded composite component. First, if the -- type of the component is known, the type definition can be directly queried -- to obtain the Record_Components or the Array_Component that describe its -- internal structure. Second, the Array_Component used to extract the -- component can be queried to obtain the same Record_Components or the same -- Array_Component. Both methods return identical information. -- -- This kind of nested decomposition can be carried to any required level. -- -- Array_Components become invalid when the Context, from which they -- originate, is closed. All Record_Components are obtained by referencing a) -- an Element, which has an associated Context, b) a Record_Component, or c) -- another Array_Component. Ultimately, all component values originate from a -- A_Type_Definition Element; that Element determines their Context of origin. ------------------------------------------------------------------------------ type Array_Component is private; Nil_Array_Component : constant Array_Component; type Array_Component_List is array (Asis.List_Index range <>) of Array_Component; ------------------------------------------------------------------------------ -- Dimension_Indexes - an array of index values used to access an array stream ------------------------------------------------------------------------------ type Dimension_Indexes is array (Asis.Asis_Positive range <>) of Asis.Asis_Positive; ------------------------------------------------------------------------------ -- Array_Component_Iterator - Used to iterate over successive components of an -- array. This may be more efficient than using individual index values when -- extracting array components from a data stream because it substitutes two -- subroutine calls (Next and Done) for the multiplications and divisions -- implicit in indexing an N dimensional array with a single index value. -- -- Iterators may be copied. The copies operate independently (have separate -- state). -- -- An example: -- -- declare -- Component : Array_Component := ...; -- Iter : Array_Component_Iterator; -- Array_Stream : Portable_Data (...) := ...; -- Component_Stream : Portable_Data (...); -- begin -- Iter := Array_Iterator (Component); -- while not Done (Iter) loop -- Component_Stream := Component_Data_Stream (Iter, Array_Stream); -- Next (Iter); -- end loop; -- end; ------------------------------------------------------------------------------ type Array_Component_Iterator is private; Nil_Array_Component_Iterator : constant Array_Component_Iterator; ------------------------------------------------------------------------------ -- Type_Model_Kinds -- -- Each Type_Definition fits into one of three type models. ------------------------------------------------------------------------------ type Type_Model_Kinds is ( A_Simple_Static_Model, A_Simple_Dynamic_Model, A_Complex_Dynamic_Model, Not_A_Type_Model); -- Nil arguments function Type_Model_Kind (Type_Definition : in Asis.Type_Definition) return Type_Model_Kinds; function Type_Model_Kind (Component : in Record_Component) return Type_Model_Kinds; function Type_Model_Kind (Component : in Array_Component) return Type_Model_Kinds; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the type definition to query -- Component - Specifies a record field with a record or array type -- -- Returns the model that best describes the type indicated by the argument. -- Returns Not_A_Type_Model for any unexpected argument such as a Nil value. -- -- Expected Element_Kinds: -- A_Type_Definition -- ------------------------------------------------------------------------------ function Is_Nil (Right : in Record_Component) return Boolean; function Is_Nil (Right : in Array_Component) return Boolean; ------------------------------------------------------------------------------ -- Right - Specifies the component to check -- -- Returns True if Right is a Nil (or uninitialized) component value. -- -- Returns False for all other values. -- -- All component values are appropriate. ------------------------------------------------------------------------------ function Is_Equal (Left : in Record_Component; Right : in Record_Component) return Boolean; function Is_Equal (Left : in Array_Component; Right : in Array_Component) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the left component to compare -- Right - Specifies the right component to compare -- -- Returns True if Left and Right represent the same physical component of the -- same record or array type, from the same physical compilation unit. The -- two components may or may not be from the same open ASIS Context variable. -- -- Implies: -- Is_Equal (Enclosing_Compilation_Unit (Component_Declaration (Left)), -- Enclosing_Compilation_Unit (Component_Declaration (Right))) -- = True -- -- All component values are appropriate. ------------------------------------------------------------------------------ function Is_Identical (Left : in Record_Component; Right : in Record_Component) return Boolean; function Is_Identical (Left : in Array_Component; Right : in Array_Component) return Boolean; ------------------------------------------------------------------------------ -- Left - Specifies the left component to compare -- Right - Specifies the right component to compare -- -- Returns True if Left and Right represent the same physical component of the -- same record or array type, from the same physical compilation unit and the -- same open ASIS Context variable. -- -- Implies: -- Is_Identical (Enclosing_Compilation_Unit (Component_Declaration (Left)), -- Enclosing_Compilation_Unit (Component_Declaration (Right))) -- = True -- -- All component values are appropriate. ------------------------------------------------------------------------------ function Is_Array (Component : in Record_Component) return Boolean; function Is_Array (Component : in Array_Component) return Boolean; ------------------------------------------------------------------------------ -- Component - Specifies any component -- -- Returns True if the component has an array subtype (contains an array -- value). -- -- Returns False for Nil components and any component that is not an embedded -- array. -- ------------------------------------------------------------------------------ function Is_Record (Component : in Record_Component) return Boolean; function Is_Record (Component : in Array_Component) return Boolean; ------------------------------------------------------------------------------ -- Component - Specifies any component -- -- Returns True if the component has a record subtype. -- Returns False for Nil components and any component that is not an embedded -- record. -- ------------------------------------------------------------------------------ function Done (Iterator : in Array_Component_Iterator) return Boolean; ------------------------------------------------------------------------------ -- Iterator - Specifies the iterator to query -- -- Returns True if the iterator has been advanced past the last array -- component. Returns True for a Nil_Array_Component_Iterator. -- ------------------------------------------------------------------------------ procedure Next (Iterator : in out Array_Component_Iterator); ------------------------------------------------------------------------------ -- Iterator - Specifies the iterator to advance -- -- Advances the iterator to the next array component. Use Done to test the -- iterator to see if it has passed the last component. Does nothing if the -- iterator is already past the last component. -- ------------------------------------------------------------------------------ procedure Reset (Iterator : in out Array_Component_Iterator); ------------------------------------------------------------------------------ -- Iterator - Specifies the iterator to reset -- -- Resets the iterator to the first array component. -- ------------------------------------------------------------------------------ function Array_Index (Iterator : in Array_Component_Iterator) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Iterator - Specifies the iterator to query -- -- Returns the Index value which, when used in conjunction with the -- Array_Component value used to create the Iterator, indexes the same array -- component as that presently addressed by the Iterator. -- -- Raises Asis_Inappropriate_Element if given a Nil_Array_Component_Iterator -- or one where Done(Iterator) = True. The Status value will be Data_Error. -- The Diagnosis string will indicate the kind of error detected. -- ------------------------------------------------------------------------------ function Array_Indexes (Iterator : in Array_Component_Iterator) return Dimension_Indexes; ------------------------------------------------------------------------------ -- Iterator - Specifies the iterator to query -- -- Returns the index values which, when used in conjunction with the -- Array_Component value used to create the Iterator, indexes the same array -- component as that presently addressed by the Iterator. -- -- Raises Asis_Inappropriate_Element if given a Nil_Array_Component_Iterator -- or one where Done(Iterator) = True. The Status value will be Data_Error. -- The Diagnosis string will indicate the kind of error detected. -- ------------------------------------------------------------------------------ function Discriminant_Components (Type_Definition : in Asis.Type_Definition) return Record_Component_List; function Discriminant_Components (Component : in Record_Component) return Record_Component_List; function Discriminant_Components (Component : in Array_Component) return Record_Component_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the record type definition to query -- Component - Specifies a component which has a record subtype, -- Is_Record(Component) = True -- -- Returns a list of the discriminant components for records of the indicated -- record type. -- -- The result describes the locations of the record type's discriminants, -- regardless of the static or dynamic nature of the record type. -- All return components are intended for use with a data stream representing -- a value of the indicated record type. -- -- All Is_Record(Component) = True arguments are appropriate. All return -- values are valid parameters for all query operations. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition (derived from a record type) -- A_Record_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- A_Simple_Dynamic_Model -- A_Complex_Dynamic_Model -- ------------------------------------------------------------------------------ function Record_Components (Type_Definition : in Asis.Type_Definition) return Record_Component_List; function Record_Components (Component : in Record_Component) return Record_Component_List; function Record_Components (Component : in Array_Component) return Record_Component_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the record type definition to query -- Component - Specifies a component which has a record subtype, -- Is_Record(Component) = True -- -- Returns a list of the discriminants and components for the indicated simple -- static record type. (See rule 6.A above.) -- -- The result describes the locations of the record type's discriminants and -- components. All return components are intended for use with a data stream -- representing a value of the indicated record type. -- -- All Is_Record(Component) = True values, having simple static types, are -- appropriate. All return values are valid parameters for all query -- operations. -- -- Note: If an Ada implementation uses implementation-dependent record -- components (RM 95 13.5.1 (15)), then each such component of the record -- type will be included in the result. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition (derived from a record type) -- A_Record_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- ------------------------------------------------------------------------------ function Record_Components (Type_Definition : in Asis.Type_Definition; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Record_Component_List; function Record_Components (Component : in Record_Component; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Record_Component_List; function Record_Components (Component : in Array_Component; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Record_Component_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the record type definition to query -- Component - Specifies a component which has a record subtype, -- Is_Record(Component) = True -- Data_Stream - Specifies a data stream containing, at least, the -- complete set of discriminant or index constraints for -- the type -- -- Returns a list of the discriminants and components for the indicated record -- type, using the data stream argument as a guide. The record type must be -- either a simple static, or a simple dynamic, record type. (See rules 6.A -- and 6.B above.) -- -- The result describes the locations of the record type's discriminants and -- all components of the appropriate variant parts. The contents of the list -- are determined by the discriminant values present in the data stream. -- -- A simple static type will always return the same component list (Is_Equal -- parts) regardless of the Data_Stream, because the layout of a simple static -- type does not change with changes in discriminant values. A simple dynamic -- type returns different component lists (non-Is_Equal parts) depending on -- the contents of the Data_Stream, because the contents and layout of a -- simple dynamic type changes with changes in discriminant values. All -- return components are intended for use with a data stream representing a -- value of the indicate record type. -- -- The Data_Stream must represent a fully discriminated value of the indicated -- record type. The stream may have been read from a file, it may have been -- extracted from some enclosing data stream, or it may be an artificial value -- created by the Construct_Artificial_Data_Stream operation. Only the -- discriminant portion of the Data_Stream is checked for validity, and, only -- some discriminant fields may need to be checked, depending on the -- complexity of the record type. The best approach, for any application that -- is constructing artificial Data_Streams, is to always provide appropriate -- values for all discriminant fields. It is not necessary to provide values -- for nondiscriminant fields. -- -- All Is_Record(Component) = True values are appropriate. All return values -- are valid parameters for all query operations. -- -- Note: If an Ada implementation uses implementation-dependent record -- components (RM 95 13.5.1 (15)), then each such component of the record -- type will be included in the result. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition (derived from a record type) -- A_Record_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- A_Simple_Dynamic_Model -- ------------------------------------------------------------------------------ function Array_Components (Type_Definition : in Asis.Type_Definition) return Array_Component; function Array_Components (Component : in Record_Component) return Array_Component; function Array_Components (Component : in Array_Component) return Array_Component; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the array type definition to query -- Component - Specifies a component which has an array subtype, -- Is_Array(Component) = True -- -- Returns a single component, describing all components of the indicated -- array type. The array type must be a simple static, or a simple dynamic -- array type. (See rules 6.A and 6.B above.) -- -- The result contains all information necessary to index and extract any -- component of a data stream representing a value of the indicated array -- type. -- -- All Is_Array(Component) = True values are appropriate. All return values -- are valid parameters for all query operations. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition (derived from an array type) -- An_Array_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- A_Simple_Dynamic_Model -- ------------------------------------------------------------------------------ function Array_Iterator (Component : in Array_Component) return Array_Component_Iterator; ------------------------------------------------------------------------------ -- Component - Specifies an array component to be used for iteration -- -- Returns an iterator poised to fetch the 1st component of an array. -- ------------------------------------------------------------------------------ function Component_Data_Stream (Component : in Record_Component; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Asis_Portable_Transfer.Portable_Data; function Component_Data_Stream (Component : in Array_Component; Index : in Asis.Asis_Positive; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Asis_Portable_Transfer.Portable_Data; function Component_Data_Stream (Component : in Array_Component; Indexes : in Dimension_Indexes; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Asis_Portable_Transfer.Portable_Data; function Component_Data_Stream (Iterator : in Array_Component_Iterator; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Asis_Portable_Transfer.Portable_Data; ------------------------------------------------------------------------------ -- Component - Specifies the component or discriminant to be extracted -- Index - Specifies an index, 1..Array_Length, within an array -- Indexes - Specifies a list of index values, there is one value for -- each dimension of the array type, each index N is in the -- range 1..Array_Length(Component,N); -- Iterator - Specifies the array component to extract -- Data_Stream - Specifies the data stream from which to extract the result -- -- Returns a data stream representing just the value of the chosen Component. -- The return value is sliced from the data stream. The Data_Stream must -- represent a value of the appropriate type. It may have been obtained from -- a file, extracted from another data stream, or artificially constructed -- using the Construct_Artificial_Data_Stream operation. -- -- An artificial data stream may raise Asis_Inappropriate_Element (the Status -- would be Value_Error). Only the constraint values are valid, once they -- have been properly initialized, and may be safely extracted, from an -- artificial data stream. -- -- Raises Asis_Inappropriate_Element if given a Nil_Array_Component_Iterator -- or one where Done(Iterator) = True. The Status value will be Data_Error. -- The Diagnosis string will indicate the kind of error detected. -- -- All non-Nil component values are appropriate. -- ------------------------------------------------------------------------------ function Component_Declaration (Component : in Record_Component) return Asis.Declaration; ------------------------------------------------------------------------------ -- Component - Specifies the component to be queried -- -- Returns an Asis.Declaration, which will be either A_Component_Declaration -- or A_Discriminant_Specification. These values can be used to determine the -- subtype, type, and base type of the record component. The result may be an -- explicit declaration made by the user, or, it may be an implicit -- component declaration for an implementation-defined component (RM 95 13.5.1 -- (15)). -- -- All non-Nil component values are appropriate. -- -- Returns Element_Kinds: -- A_Declaration -- -- Returns Declaration_Kinds: -- A_Component_Declaration -- A_Discriminant_Specification -- ------------------------------------------------------------------------------ function Component_Indication (Component : in Array_Component) return Asis.Subtype_Indication; ------------------------------------------------------------------------------ -- Component - Specifies the component to be queried -- -- Returns an Asis.Subtype_Indication. These values can be used to determine -- the subtype, type, and base type of the array components. -- -- All non-Nil component values are appropriate. -- -- Returns Element_Kinds: -- A_Subtype_Indication -- ------------------------------------------------------------------------------ function All_Named_Components (Type_Definition : in Asis.Type_Definition) return Asis.Defining_Name_List; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the record type definition to query -- -- Returns a list of all discriminant and component entity names defined by -- the record type. All record type definitions are appropriate for this -- operation. This query provides a means for determining whether a field, -- with a particular name, exists for some possible instance of the record -- type. This list does not include the names of implementation-defined -- components (RM 95 13.5.1 (15)); those name have the form of -- An_Attribute_Reference expression. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition (derived from a record type) -- A_Record_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- A_Simple_Dynamic_Model -- A_Complex_Dynamic_Model -- ------------------------------------------------------------------------------ function Array_Length (Component : in Record_Component) return Asis.Asis_Natural; function Array_Length (Component : in Array_Component) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Component - Specifies the component to query -- -- Returns the number of components within an array valued component. The -- array subtype may be multidimensional. The result treats the array as if -- it were unidimensional. It is the product of the 'Lengths of the -- individual array dimensions. -- -- All Is_Array(Component) = True values are appropriate. -- ------------------------------------------------------------------------------ function Array_Length (Component : in Record_Component; Dimension : in Asis.Asis_Natural) return Asis.Asis_Natural; function Array_Length (Component : in Array_Component; Dimension : in Asis.Asis_Natural) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Component - Specifies the component to query -- Dimension - Specifies the array dimension to query -- -- Returns the number of components within an array valued component. The -- array subtype may be unidimensional. The result is the 'Length(Dimension) -- of the array. -- -- All Is_Array(Component) = True values are appropriate. -- ------------------------------------------------------------------------------ function Size (Type_Definition : in Asis.Type_Definition) return Asis.Asis_Natural; function Size (Component : in Record_Component) return Asis.Asis_Natural; function Size (Component : in Array_Component) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Type_Definition - Specifies a type definition, whose 'Size is desired -- Component - Specifies a component, whose 'Size is desired -- -- Returns the minimum number of bits required to hold a simple static type, -- the number of bits allocated to hold a record field, or the number of bits -- allocated to hold each array component. -- --|AN Application Note: --|AN --|AN For components, this is the number of bits actually allocated --|AN within the composite value. It may be greater than the number --|AN of bits actually occupied by data values of this component type. --|AN Also, the actual data value, when occupying more space than is --|AN minimally required, may be preceded, followed, or surrounded by --|AN padding bits which are necessary to fully occupy the space allotted. --|AN -- All non-Nil component values are appropriate. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- ------------------------------------------------------------------------------ function Size (Type_Definition : in Asis.Type_Definition; Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the type definition to query -- Data_Stream - Specifies a data stream containing, at least, the -- complete set of discriminant or index constraints for -- the type -- -- Returns the 'Size of a value of this type, with these constraints. This is -- the minimum number of bits that is needed to hold any possible value of the -- given fully constrained subtype. Only the constraint portion of the -- Data_Stream is checked. -- -- The Data_Stream may be an actual data stream or it may be an artificial -- data stream created by the Construct_Artificial_Data_Stream operation. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Asis.Data_Decomposition.Type_Model_Kinds: -- A_Simple_Static_Model -- A_Simple_Dynamic_Model -- ------------------------------------------------------------------------------ function Position (Component : in Record_Component) return Asis.Asis_Natural; function Position (Component : in Array_Component; Index : in Asis.Asis_Positive) return Asis.Asis_Natural; function Position (Component : in Array_Component; Indexes : in Dimension_Indexes) return Asis.Asis_Natural; function Position (Iterator : in Array_Component_Iterator) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Component - Specifies the component to query -- Index - Specifies a value in the range 1..Array_Length(Component), -- the index of the component to query -- Indexes - Specifies a list of index values, there is one value for -- each dimension of the array type, each index N is in the -- range 1..Array_Length(Component,N); -- Iterator - Specifies a particular array component to query -- -- Returns the System.Storage_Unit offset, from the start of the first storage -- unit occupied by the enclosing composite type, of the first of the storage -- units occupied by the Component. The offset is measured in storage units. -- -- All non-Nil component values are appropriate. Raises -- Asis_Inappropriate_Element with a Status of Data_Error if any index is not -- in the expected range or if Done (Iterator) = True. The Status value will -- be Data_Error. The Diagnosis string will indicate the kind of error -- detected. -- ------------------------------------------------------------------------------ function First_Bit (Component : in Record_Component) return Asis.Asis_Natural; function First_Bit (Component : in Array_Component; Index : in Asis.Asis_Positive) return Asis.Asis_Natural; function First_Bit (Component : in Array_Component; Indexes : in Dimension_Indexes) return Asis.Asis_Natural; function First_Bit (Iterator : in Array_Component_Iterator) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Component - Specifies the component to query -- Index - Specifies a value in the range 1..Array_Length(Component), -- the index of the component to query -- Indexes - Specifies a list of index values, there is one value for -- each dimension of the array type, each index N is in the -- range 1..Array_Length(Component,N); -- Iterator - Specifies a particular array component to query -- -- Returns the bit offset, from the start of the first of the storage units -- occupied by the Component, of the first bit occupied by the Component. The -- offset is measured in bits. -- -- All non-Nil component values are appropriate. Raises -- Asis_Inappropriate_Element with a Status of Data_Error if any index is not -- in the expected range or if Done (Iterator) = True. The Status value will -- be Data_Error. The Diagnosis string will indicate the kind of error -- detected. -- ------------------------------------------------------------------------------ function Last_Bit (Component : in Record_Component) return Asis.Asis_Natural; function Last_Bit (Component : in Array_Component; Index : in Asis.Asis_Positive) return Asis.Asis_Natural; function Last_Bit (Component : in Array_Component; Indexes : in Dimension_Indexes) return Asis.Asis_Natural; function Last_Bit (Iterator : in Array_Component_Iterator) return Asis.Asis_Natural; ------------------------------------------------------------------------------ -- Component - Specifies the component to query -- Index - Specifies a value in the range 1..Array_Length(Component), -- the index of the component to query -- Indexes - Specifies a list of index values, there is one value for -- each dimension of the array type, each index N is in the -- range 1..Array_Length(Component,N); -- Iterator - Specifies a particular array component to query -- -- Returns the bit offset, from the start of the first of the storage units -- occupied by the Index'th Element, of the last bit occupied by the Element. -- The offset is measured in bits. -- -- All non-Nil component values are appropriate. Raises -- Asis_Inappropriate_Element with a Status of Data_Error if any index is not -- in the expected range or if Done (Iterator) = True. The Status value will -- be Data_Error. The Diagnosis string will indicate the kind of error -- detected. -- ------------------------------------------------------------------------------ -- Generic for Data Stream Conversions ------------------------------------------------------------------------------ generic -- Ada 95 notation for a constrained subtype. -- type Constrained_Subtype (<>) is private; type Constrained_Subtype is private; function Portable_Constrained_Subtype (Data_Stream : in Asis_Portable_Transfer.Portable_Data) return Constrained_Subtype; ------------------------------------------------------------------------------ -- Data_Stream - Specifies an extracted component of a record -- -- Instantiated with an appropriate scalar type, eg. System.Integer, can be -- used to convert a data stream to a value that can be directly examined. -- -- Instantiated with a record type, can be used to convert a data stream to a -- value that can be directly examined. -- -- Instantiations with constrained array subtypes may not convert array values -- if they were created using the Portable_Array_Type_1, -- Portable_Array_Type_2, or Portable_Array_Type_3 interfaces. -- -- May raise Constraint_Error if the subtype is a scalar and the converted -- value is not in the subtype's range. -- ------------------------------------------------------------------------------ function Construct_Artificial_Data_Stream (Type_Definition : in Asis.Type_Definition; Data_Stream : in Asis_Portable_Transfer.Portable_Data; Discriminant : in Record_Component; Value : in Asis_Portable_Transfer.Portable_Data) return Asis_Portable_Transfer.Portable_Data; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the record type definition for the record -- valued data stream being constructed -- Data_Stream - Specifies the data stream constructed so far; initially -- specified as the Nil_Portable_Data value -- Discriminant - Specifies the discriminant of the record type that is -- being set or changed -- Value - Specifies a data stream representing a single -- discriminant value of the appropriate type -- -- Used to artificially construct a data stream which represents the -- discriminant portion of a fully constrained value of the indicated record -- type. This operation is called once with a value for each discriminant of -- the record type (the order in which the discriminants are specified is not -- important). The return value of each call is used as the input Data_Stream -- for the next. -- -- The resulting artificial data stream may be used solely for the purpose of -- creating Record_Component values. The values of any non-discriminant -- fields will be arbitrary and quite possibly invalid. The resulting -- component values may then be used for any purpose. In particular, they may -- be used to determine First_Bit, Last_Bit, and Size values for all record -- discriminants and components. -- -- Appropriate Element_Kinds: -- A_Type_Definition -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition (derived from a record type) -- A_Record_Type_Definition -- -- Raises Asis_Inappropriate_Element, with a Status of Data_Error, if the -- discriminant Value is inappropriate for the specified Discriminant. -- ------------------------------------------------------------------------------ private type Record_Component is record A : Boolean; end record; Nil_Record_Component : constant Record_Component := (A => False); type Array_Component is record A : Boolean; end record; Nil_Array_Component : constant Array_Component := (A => False); type Array_Component_Iterator is record Component : Array_Component; Index : Asis.Asis_Natural := 0; end record; Nil_Array_Component_Iterator : constant Array_Component_Iterator := (Component => Nil_Array_Component, Index => 0); end Asis.Data_Decomposition;