DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T V

⟦f394d0aad⟧ TextFile

    Length: 69489 (0x10f71)
    Types: TextFile
    Names: »V«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦12c68c704⟧ 
                └─⟦this⟧ 
└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS 
    └─ ⟦91c658230⟧ »DATA« 
        └─⟦458657fb6⟧ 
            └─⟦220843204⟧ 
                └─⟦this⟧ 

TextFile

with System;
with Universal;

package Diana is

    pragma Subsystem (Ada_Management);
    pragma Module_Name (4, 1110);

    -- Outline of Diana package

    --    NODE_NAME type
    --    TREE type
    --    Lexical types and operations
    --    List types and primitive operations
    --    Constructors and generalized selectors for tree nodes
    --    VALUE type and primitive operations
    --    Selectors for structural attributes
    --    Selectors for semantic attributes
    --    Selectors for code attributes
    --    Procedures for setting structural attributes
    --    Procedures for setting semantic attributes
    --    Procedures for setting code attributes

    --    PERMANENT_ATTRIBUTES, mechanism for extensible user-defined attributes
    --    TEMPORARY_ATTRIBUTES
    --    STANDARD_PACKAGE, providing access to the tree for Standard
    --    EDIT_UTILITIES for traversing and manipulating trees
    --    LIST_UTILITIES for more powerful list operations
    --    ID_UTILITIES for computing id lists and other id operations
    --    SYMBOLIC_IO for dumping diana tree in symbolic form
    --    TRAVERSAL provides generics for traversing trees
    --    ATTR_NAMES
    --    PRAGMA_NAMES
    --    OPERATOR_NAMES
    --    CHECK_NAMES
    --    EXCEPTION_NAMES

    --  constraint_error  : exception;
    -- indicates attempt to apply incorrect selector to a node.

    Illegal_Structure : exception;
    -- Indicates attempt to introduce structural sharing

    ---------------------------------------------------------------------------

    type Node_Name is (Dn_Void, Dn_Aggregate, Dn_Deferred_Constant,
                       Dn_Allocator, Dn_Binary, Dn_Conversion, Dn_Membership,
                       Dn_Null_Access, Dn_Numeric_Literal, Dn_Parenthesized,
                       Dn_Qualified, Dn_String_Literal, Dn_Used_Char, Dn_All,
                       Dn_Attribute, Dn_Attribute_Call, Dn_Function_Call,
                       Dn_Indexed, Dn_Selected, Dn_Slice, Dn_Used_Op,
                       Dn_Used_Bltn_Op, Dn_Used_Object_Id, Dn_Used_Name_Id,
                       Dn_Used_Bltn_Id, Dn_Attr_Id, Dn_Pragma_Id,
                       Dn_Argument_Id, Dn_Comp_Id, Dn_Const_Id, Dn_Dscrmt_Id,
                       Dn_Entry_Id, Dn_Exception_Id, Dn_Function_Id,
                       Dn_Generic_Id, Dn_In_Id, Dn_In_Out_Id, Dn_Out_Id,
                       Dn_Iteration_Id, Dn_Label_Id, Dn_Number_Id,
                       Dn_Package_Id, Dn_Private_Type_Id, Dn_L_Private_Type_Id,
                       Dn_Proc_Id, Dn_Subtype_Id, Dn_Task_Body_Id, Dn_Type_Id,
                       Dn_Var_Id, Dn_Enum_Id, Dn_Def_Char, Dn_Def_Op, Dn_Box,
                       Dn_No_Default, Dn_Instantiation, Dn_Exception,
                       Dn_Constant, Dn_Var, Dn_Number, Dn_Type, Dn_Subtype,
                       Dn_Subprogram_Decl, Dn_Package_Decl, Dn_Task_Decl,
                       Dn_Pragma, Dn_Generic, Dn_Address, Dn_Record_Rep,
                       Dn_Simple_Rep, Dn_Use, Dn_Task_Body, Dn_Package_Body,
                       Dn_Subprogram_Body, Dn_Subunit, Dn_Loop, Dn_Abort,
                       Dn_Accept, Dn_Assign, Dn_Block, Dn_Case, Dn_Code,
                       Dn_Cond_Entry, Dn_Delay, Dn_Entry_Call, Dn_Exit, Dn_Goto,
                       Dn_If, Dn_Labeled, Dn_Named_Stm, Dn_Named_Stm_Id,
                       Dn_Null_Stm, Dn_Procedure_Call, Dn_Raise, Dn_Return,
                       Dn_Select, Dn_Terminate, Dn_Timed_Entry, Dn_Range,
                       Dn_Dscrmt_Aggregate, Dn_Dscrt_Range_S, Dn_Fixed,
                       Dn_Float, Dn_Constrained, Dn_Formal_Dscrt,
                       Dn_Formal_Fixed, Dn_Formal_Float, Dn_Formal_Integer,
                       Dn_Access, Dn_Array, Dn_Derived, Dn_Enum_Literal_S,
                       Dn_Integer, Dn_L_Private, Dn_Private, Dn_Record,
                       Dn_Task_Spec, Dn_Universal_Integer, Dn_Universal_Fixed,
                       Dn_Universal_Real, Dn_Stub, Dn_Pseudo_Stub, Dn_Entry,
                       Dn_Function, Dn_Procedure, Dn_Package_Spec,
                       Dn_Out, Dn_In, Dn_In_Out, Dn_Rename, Dn_For,
                       Dn_Reverse, Dn_While, Dn_Context, Dn_With, Dn_In_Op,
                       Dn_Not_In, Dn_Index, Dn_Alternative_S, Dn_Choice_S,
                       Dn_Comp_Rep_S, Dn_Decl_S, Dn_Exp_S, Dn_Generic_Assoc_S,
                       Dn_Generic_Param_S, Dn_Id_S, Dn_Item_S, Dn_Name_S,
                       Dn_Param_Assoc_S, Dn_Param_S, Dn_Pragma_S,
                       Dn_Select_Clause_S, Dn_Stm_S, Dn_Variant_S,
                       Dn_Dscrmt_Var_S, Dn_Variant, Dn_Dscrmt_Var,
                       Dn_And_Then, Dn_Or_Else, Dn_Select_Clause,
                       Dn_Alternative, Dn_Comp_Rep, Dn_Cond_Clause,
                       Dn_Inner_Record, Dn_Compilation, Dn_Others, Dn_Null_Comp,
                       Dn_Variant_Part, Dn_Named, Dn_Comp_Unit, Dn_Assoc,
                       Dn_Alignment, Dn_Nonterminal, Dn_Foo1, Dn_Foo2);

    ---------------------------------------------------------------------------

    -- basic node type

    type Tree is private;

    pragma Cache_Register (Tree, 12);

    function Get_Segment (T : Tree) return System.Segment;

    function Get_Offset (T : Tree) return System.Bit_Offset;

    function Empty return Tree;  -- returns a constant void node

    function Is_Empty (T : Tree) return Boolean;

    function Kind (T : Tree) return Node_Name;

    function Is_Id_Node (Name : Node_Name) return Boolean;

    function Is_Id_Node (T : Tree) return Boolean;

    function Hash (T : Tree) return Integer;

    function Hash (T : Tree) return Long_Integer;

    pragma Consume_Offset;

    ---------------------------------------------------------------------------

    -- Types introduced to allow implementation of user-defined attributes
    -- to be visible in the body of diana.

    type Attr_Name is private;

    function Equal (X, Y : Attr_Name) return Boolean;

    pragma Consume_Offset;

    function Get_Segment (A : Attr_Name) return System.Segment;

    function Get_Offset (A : Attr_Name) return System.Bit_Offset;

    type Attr_List is private;

    pragma Cache_Register (Attr_List, 18);

    pragma Consume_Offset;

    function Get_Segment (A : Attr_List) return System.Segment;

    function Get_Offset (A : Attr_List) return System.Bit_Offset;

    ---------------------------------------------------------------------------

    -- Lexical types and operations

    type Symbol_Rep is private;

    pragma Cache_Register (Symbol_Rep, 13);

    pragma Consume_Offset;

    function Get_Segment (S : Symbol_Rep) return System.Segment;

    function Get_Offset (S : Symbol_Rep) return System.Bit_Offset;

    function Null_Text return Symbol_Rep;

    function Equal (X, Y : Symbol_Rep) return Boolean;

    function Lx_Symrep (T : Tree) return Symbol_Rep;

    function Id (T : Tree) return Symbol_Rep renames Lx_Symrep;

    procedure Lx_Symrep (T : Tree; V : Symbol_Rep);

    procedure Lx_Symrep (T : Tree; V : String);

    function Image (Symbol : Symbol_Rep) return String;

    function Symrep (Image : String) return Symbol_Rep;

    pragma Consume_Offset (2);

    function Length (Symbol : Symbol_Rep) return Natural;

    function Ith (Symbol : Symbol_Rep; Position : Natural) return Character;

    function Hash (Symbol : Symbol_Rep) return Integer;

    ---------------------------------------------------------------------------

    type Number_Rep is private;

    pragma Consume_Offset;

    function Get_Segment (N : Number_Rep) return System.Segment;

    function Get_Offset (N : Number_Rep) return System.Bit_Offset;

    function Equal (X, Y : Number_Rep) return Boolean;

    function Lx_Numrep (T : Tree) return Number_Rep;

    procedure Lx_Numrep (T : Tree; V : Number_Rep);

    function Image (Number : Number_Rep) return String;

    function Numrep (Image : String) return Number_Rep;

    pragma Consume_Offset (2);

    function Length (Number : Number_Rep) return Natural;

    function Ith (Number : Number_Rep; Position : Natural) return Character;

    procedure Lx_Prefix (T : Tree; V : Boolean);

    function Lx_Prefix (T : Tree) return Boolean;

    procedure Lx_Default (T : Tree; V : Boolean);

    function Lx_Default (T : Tree) return Boolean;

    procedure Lx_Separate (T : Tree; V : Boolean);

    function Lx_Separate (T : Tree) return Boolean;

    ---------------------------------------------------------------------------

    type Comment is private;

    function Get_Segment (C : Comment) return System.Segment;
    function Get_Offset  (C : Comment) return System.Bit_Offset;

    function Make (Text                : String;
                   Start_Column        : Natural;
                   Trailing_Page_Marks : Natural := 0;
                   Trailing_Line_Marks : Natural := 0) return Comment;

    function Text                (C : Comment) return String;
    function Start_Column        (C : Comment) return Natural;
    function Trailing_Page_Marks (C : Comment) return Natural;
    function Trailing_Line_Marks (C : Comment) return Natural;

    procedure Text                (C : Comment; Value : String);
    procedure Start_Column        (C : Comment; Value : Natural);
    procedure Trailing_Page_Marks (C : Comment; Value : Natural);
    procedure Trailing_Line_Marks (C : Comment; Value : Natural);

    ---------------------------------------------------------------------------

    -- Structural list type

    type Seq_Type is private;

    pragma Cache_Register (Seq_Type, 14);

    function Get_Segment (S : Seq_Type) return System.Segment;

    function Get_Offset (S : Seq_Type) return System.Bit_Offset;

    function Hash (S : Seq_Type) return Integer;

    function Make return Seq_Type;

    function Is_Empty (S : Seq_Type) return Boolean;

    function Head (L : Seq_Type) return Tree;

    function Tail (L : Seq_Type) return Seq_Type;

    function Cons (T : Tree; L : Seq_Type) return Seq_Type;

    procedure Replace_Head (L : in out Seq_Type; T : Tree);

    procedure Replace_Tail (L1 : Seq_Type; L2 : Seq_Type);

    pragma Consume_Offset;

    ---------------------------------------------------------------------------

    -- Non-structural list type

    type Sequence is private;

    pragma Cache_Register (Sequence, 15);

    function Get_Segment (S : Sequence) return System.Segment;

    function Get_Offset (S : Sequence) return System.Bit_Offset;

    function Hash (S : Sequence) return Integer;

    function Make return Sequence;

    function Is_Empty (L : Sequence) return Boolean;

    function Head (L : Sequence) return Tree;

    function Tail (L : Sequence) return Sequence;

    function Cons (T : Tree; L : Sequence) return Sequence;

    function Cons (T : Tree; L : Sequence; In_Segment : System.Segment)
                  return Sequence;

    procedure Replace_Head (L : Sequence; T : Tree);

    procedure Replace_Tail (L1 : Sequence; L2 : Sequence);

    pragma Consume_Offset;

    ---------------------------------------------------------------------------

    -- list type which is not allocated in diana heap

    type Temp_Seq is private;

    pragma Cache_Register (Temp_Seq, 17);

    function Get_Segment (S : Temp_Seq) return System.Segment;

    function Get_Offset (S : Temp_Seq) return System.Bit_Offset;

    function Hash (S : Temp_Seq) return Integer;

    function Make return Temp_Seq;

    function Is_Empty (L : Temp_Seq) return Boolean;

    function Head (L : Temp_Seq) return Tree;

    function Tail (L : Temp_Seq) return Temp_Seq;

    function Cons (T : Tree; L : Temp_Seq) return Temp_Seq;

    function Cons (T : Tree; L : Temp_Seq; In_Segment : System.Segment)
                  return Temp_Seq;

    procedure Replace_Head (L : Temp_Seq; T : Tree);

    procedure Replace_Tail (L1 : Temp_Seq; L2 : Temp_Seq);

    ---------------------------------------------------------------------------

    -- constructor functions for diana nodes

    function Make (C : Node_Name) return Tree;

    function Make (C : Node_Name; V : Symbol_Rep) return Tree;

    function Make (C : Node_Name; V : String) return Tree;

    function Make (C : Node_Name; V : Boolean) return Tree;

    function Make (C : Node_Name; T1 : Tree) return Tree;

    function Make (C : Node_Name; T1, T2 : Tree) return Tree;

    function Make (C : Node_Name; T1, T2, T3 : Tree) return Tree;

    function Make (C : Node_Name; L : Seq_Type) return Tree;

    function Make (L : Sequence) return Tree;  -- returns dn_exp_s

    function Make (C : Node_Name; In_Segment : System.Segment) return Tree;

    ---------------------------------------------------------------------------

    type Arities is (Nullary, Unary, Binary, Ternary, Arbitrary);

    function Arity (T : Tree) return Arities;

    function Arity (N : Node_Name) return Arities;

    -- general selectors for subnodes

    function Child1  (T : Tree) return Tree;
    function Child2  (T : Tree) return Tree;
    function Child3  (T : Tree) return Tree;
    function List    (T : Tree) return Seq_Type;
    function As_List (T : Tree) return Seq_Type renames List;

    function Son1 (T : Tree) return Tree renames Child1;
    function Son2 (T : Tree) return Tree renames Child2;
    function Son3 (T : Tree) return Tree renames Child3;

    -- changing subnodes

    procedure Child1  (T : Tree; V : Tree);
    procedure Child2  (T : Tree; V : Tree);
    procedure Child3  (T : Tree; V : Tree);
    procedure List    (T : Tree; V : Seq_Type);
    procedure As_List (T : Tree; V : Seq_Type) renames List;

    procedure Son1 (T : Tree; V : Tree) renames Child1;
    procedure Son2 (T : Tree; V : Tree) renames Child2;
    procedure Son3 (T : Tree; V : Tree) renames Child3;

    ---------------------------------------------------------------------------

    -- Implementation defined Value type

    type Value_Kind is (Integer_Valued, Float_Valued, No_Value, Uninitialized);

    type Value is private;

    function Equal (V1, V2 : Value) return Boolean;

    function Kind (V : Value) return Value_Kind;

    function Make return Value;  -- returns value'(kind=>no_value);

    function Make (I : Integer) return Value;

    function Make (F : Float) return Value;

    function Make (I : Universal.Integer) return Value;

    function Make (F : Universal.Float) return Value;

    function Make (F : Universal.Real) return Value;


    function Integer_Value (V : Value) return Universal.Integer;

    function Float_Value (V : Value) return Universal.Float;

    function Float_Value (V : Value) return Universal.Real;


    procedure Integer_Value (V : in out Value; I : Universal.Integer);

    procedure Float_Value (V : in out Value; F : Universal.Float);

    procedure Float_Value (V : in out Value; F : Universal.Real);


    function Is_Integer (V : Value) return Boolean;

    function Is_Float (V : Value) return Boolean;

    function Is_No_Value (V : Value) return Boolean;


    function Make (I : Integer) return Tree;

    function Make (F : Float) return Tree;

    function Make (I : Universal.Integer) return Tree;

    function Make (F : Universal.Float) return Tree;

    function Make (F : Universal.Real) return Tree;
    -- construct dn_numeric_literal with appropriate value


    function Is_Integer (T : Tree) return Boolean;

    function Is_Float (T : Tree) return Boolean;


    function Integer_Value (T : Tree) return Universal.Integer;

    function Float_Value (T : Tree) return Universal.Float;

    function Float_Value (T : Tree) return Universal.Real;

    ---------------------------------------------------------------------------

    -- selector functions for structural attributes

    function As_Actual           (T : Tree) return Tree;
    function As_Alignment        (T : Tree) return Tree;
    function As_Alternative_S    (T : Tree) return Tree;
    function As_Binary_Op        (T : Tree) return Tree;
    function As_Block_Stub       (T : Tree) return Tree;
    function As_Choice_S         (T : Tree) return Tree;
    function As_Comp_Rep_S       (T : Tree) return Tree;
    function As_Constrained      (T : Tree) return Tree;
    function As_Constraint       (T : Tree) return Tree;
    function As_Context          (T : Tree) return Tree;
    function As_Decl_S           (T : Tree) return Tree;
    function As_Decl_S1          (T : Tree) return Tree;
    function As_Decl_S2          (T : Tree) return Tree;
    function As_Designator       (T : Tree) return Tree;
    function As_Designator_Char  (T : Tree) return Tree;
    function As_Dscrt_Range      (T : Tree) return Tree;
    function As_Dscrt_Range_S    (T : Tree) return Tree;
    function As_Dscrt_Range_Void (T : Tree) return Tree;
    function As_Exception_Def    (T : Tree) return Tree;
    function As_Exp              (T : Tree) return Tree;
    function As_Exp1             (T : Tree) return Tree;
    function As_Exp2             (T : Tree) return Tree;
    function As_Exp_Constrained  (T : Tree) return Tree;
    function As_Exp_S            (T : Tree) return Tree;
    function As_Exp_Void         (T : Tree) return Tree;
    function As_Generic_Assoc_S  (T : Tree) return Tree;
    function As_Generic_Header   (T : Tree) return Tree;
    function As_Generic_Param_S  (T : Tree) return Tree;
    function As_Header           (T : Tree) return Tree;
    function As_Id               (T : Tree) return Tree;
    function As_Id_S             (T : Tree) return Tree;
    function As_Item_S           (T : Tree) return Tree;
    function As_Iteration        (T : Tree) return Tree;
    function As_Membership_Op    (T : Tree) return Tree;
    function As_Name             (T : Tree) return Tree;
    function As_Name_S           (T : Tree) return Tree;
    function As_Name_Void        (T : Tree) return Tree;
    function As_Object_Def       (T : Tree) return Tree;
    function As_Package_Def      (T : Tree) return Tree;
    function As_Param_Assoc_S    (T : Tree) return Tree;
    function As_Param_S          (T : Tree) return Tree;
    function As_Pragma_S         (T : Tree) return Tree;
    function As_Range            (T : Tree) return Tree;
    function As_Range_Void       (T : Tree) return Tree;
    function As_Record           (T : Tree) return Tree;
    function As_Select_Clause_S  (T : Tree) return Tree;
    function As_Stm              (T : Tree) return Tree;
    function As_Stm_S            (T : Tree) return Tree;
    function As_Stm_S1           (T : Tree) return Tree;
    function As_Stm_S2           (T : Tree) return Tree;
    function As_Subprogram_Def   (T : Tree) return Tree;
    function As_Subunit_Body     (T : Tree) return Tree;
    function As_Task_Def         (T : Tree) return Tree;
    function As_Type_Range       (T : Tree) return Tree;
    function As_Type_Spec        (T : Tree) return Tree;
    function As_Unit_Body        (T : Tree) return Tree;
    function As_Variant_S        (T : Tree) return Tree;
    function As_Dscrmt_Var_S     (T : Tree) return Tree;
    function As_Parent           (T : Tree) return Tree;

    ---------------------------------------------------------------------------

    -- selectors for semantic attributes

    function Sm_List               (Exp_S : Tree) return Sequence;
    function Sm_Bits               (T : Tree)     return Integer;
    function Sm_Pos                (T : Tree)     return Integer;
    function Sm_Rep                (T : Tree)     return Integer;
    function Sm_Controlled         (T : Tree)     return Boolean;
    function Sm_Packing            (T : Tree)     return Boolean;
    function Sm_Actual_Delta       (T : Tree)     return Universal.Float;
    function Sm_Actual_Delta       (T : Tree)     return Universal.Real;
    function Sm_Value              (T : Tree)     return Value;
    function Sm_Address            (T : Tree)     return Tree;
    function Sm_Base_Type          (T : Tree)     return Tree;
    function Sm_Body               (T : Tree)     return Tree;
    function Sm_Constraint         (T : Tree)     return Tree;
    function Sm_Defn               (T : Tree)     return Tree;
    function Sm_Discriminants      (T : Tree)     return Tree;
    function Sm_Exp_Type           (T : Tree)     return Tree;
    function Sm_Exception_Def      (T : Tree)     return Tree;
    function Sm_Generic_Param_S    (T : Tree)     return Tree;
    function Sm_Init_Exp           (T : Tree)     return Tree;
    function Sm_Location           (T : Tree)     return Tree;
    function Sm_Obj_Def            (T : Tree)     return Tree;
    function Sm_Obj_Type           (T : Tree)     return Tree;
    function Sm_Size               (T : Tree)     return Tree;
    function Sm_Spec               (T : Tree)     return Tree;
    function Sm_Stm                (T : Tree)     return Tree;
    function Sm_Storage_Size       (T : Tree)     return Tree;
    function Sm_Type_Spec          (T : Tree)     return Tree;
    function Sm_Type_Struct        (T : Tree)     return Tree;
    function Sm_Comp_Spec          (T : Tree)     return Tree;
    function Sm_Decl_S             (T : Tree)     return Tree;
    function Sm_First              (T : Tree)     return Tree;
    function Sm_Normalized_Param_S (T : Tree)     return Tree;
    function Sm_Stub               (T : Tree)     return Tree;
    function Sm_Record_Spec        (T : Tree)     return Tree;
    function Sm_Normalized_Comp_S  (T : Tree)     return Tree;

    function Sm_Parent (T : Tree) return Tree;

    function Sm_Ops (T : Tree) return Sequence;

    -- selectors for code attributes

    function Cd_Impl_Size (T : Tree) return Integer;

    ---------------------------------------------------------------------------

    -- procedures for setting structural attributes

    procedure As_Actual           (T : Tree; V : Tree);
    procedure As_Alignment        (T : Tree; V : Tree);
    procedure As_Alternative_S    (T : Tree; V : Tree);
    procedure As_Binary_Op        (T : Tree; V : Tree);
    procedure As_Block_Stub       (T : Tree; V : Tree);
    procedure As_Choice_S         (T : Tree; V : Tree);
    procedure As_Comp_Rep_S       (T : Tree; V : Tree);
    procedure As_Constrained      (T : Tree; V : Tree);
    procedure As_Constraint       (T : Tree; V : Tree);
    procedure As_Context          (T : Tree; V : Tree);
    procedure As_Decl_S           (T : Tree; V : Tree);
    procedure As_Decl_S1          (T : Tree; V : Tree);
    procedure As_Decl_S2          (T : Tree; V : Tree);
    procedure As_Designator       (T : Tree; V : Tree);
    procedure As_Designator_Char  (T : Tree; V : Tree);
    procedure As_Dscrt_Range      (T : Tree; V : Tree);
    procedure As_Dscrt_Range_S    (T : Tree; V : Tree);
    procedure As_Dscrt_Range_Void (T : Tree; V : Tree);
    procedure As_Exception_Def    (T : Tree; V : Tree);
    procedure As_Exp              (T : Tree; V : Tree);
    procedure As_Exp1             (T : Tree; V : Tree);
    procedure As_Exp2             (T : Tree; V : Tree);
    procedure As_Exp_Constrained  (T : Tree; V : Tree);
    procedure As_Exp_S            (T : Tree; V : Tree);
    procedure As_Exp_Void         (T : Tree; V : Tree);
    procedure As_Generic_Assoc_S  (T : Tree; V : Tree);
    procedure As_Generic_Header   (T : Tree; V : Tree);
    procedure As_Generic_Param_S  (T : Tree; V : Tree);
    procedure As_Header           (T : Tree; V : Tree);
    procedure As_Id               (T : Tree; V : Tree);
    procedure As_Id_S             (T : Tree; V : Tree);
    procedure As_Item_S           (T : Tree; V : Tree);
    procedure As_Iteration        (T : Tree; V : Tree);
    procedure As_Membership_Op    (T : Tree; V : Tree);
    procedure As_Name             (T : Tree; V : Tree);
    procedure As_Name_S           (T : Tree; V : Tree);
    procedure As_Name_Void        (T : Tree; V : Tree);
    procedure As_Object_Def       (T : Tree; V : Tree);
    procedure As_Package_Def      (T : Tree; V : Tree);
    procedure As_Param_Assoc_S    (T : Tree; V : Tree);
    procedure As_Param_S          (T : Tree; V : Tree);
    procedure As_Pragma_S         (T : Tree; V : Tree);
    procedure As_Range            (T : Tree; V : Tree);
    procedure As_Range_Void       (T : Tree; V : Tree);
    procedure As_Record           (T : Tree; V : Tree);
    procedure As_Select_Clause_S  (T : Tree; V : Tree);
    procedure As_Stm              (T : Tree; V : Tree);
    procedure As_Stm_S            (T : Tree; V : Tree);
    procedure As_Stm_S1           (T : Tree; V : Tree);
    procedure As_Stm_S2           (T : Tree; V : Tree);
    procedure As_Subprogram_Def   (T : Tree; V : Tree);
    procedure As_Subunit_Body     (T : Tree; V : Tree);
    procedure As_Task_Def         (T : Tree; V : Tree);
    procedure As_Type_Range       (T : Tree; V : Tree);
    procedure As_Type_Spec        (T : Tree; V : Tree);
    procedure As_Unit_Body        (T : Tree; V : Tree);
    procedure As_Variant_S        (T : Tree; V : Tree);
    procedure As_Dscrmt_Var_S     (T : Tree; V : Tree);

    ---------------------------------------------------------------------------

    -- procedures for setting semantic attributes

    procedure Sm_Bits               (T : Tree; V : Integer);
    procedure Sm_Pos                (T : Tree; V : Integer);
    procedure Sm_Rep                (T : Tree; V : Integer);
    procedure Sm_Controlled         (T : Tree; V : Boolean);
    procedure Sm_Packing            (T : Tree; V : Boolean);
    procedure Sm_Actual_Delta       (T : Tree; V : Universal.Float);
    procedure Sm_Actual_Delta       (T : Tree; V : Universal.Real);
    procedure Sm_Value              (T : Tree; V : Value);
    procedure Sm_Address            (T : Tree; V : Tree);
    procedure Sm_Base_Type          (T : Tree; V : Tree);
    procedure Sm_Body               (T : Tree; V : Tree);
    procedure Sm_Constraint         (T : Tree; V : Tree);
    procedure Sm_Defn               (T : Tree; V : Tree);
    procedure Sm_Discriminants      (T : Tree; V : Tree);
    procedure Sm_Exp_Type           (T : Tree; V : Tree);
    procedure Sm_Exception_Def      (T : Tree; V : Tree);
    procedure Sm_Generic_Param_S    (T : Tree; V : Tree);
    procedure Sm_Init_Exp           (T : Tree; V : Tree);
    procedure Sm_Location           (T : Tree; V : Tree);
    procedure Sm_Obj_Def            (T : Tree; V : Tree);
    procedure Sm_Obj_Type           (T : Tree; V : Tree);
    procedure Sm_Size               (T : Tree; V : Tree);
    procedure Sm_Spec               (T : Tree; V : Tree);
    procedure Sm_Stm                (T : Tree; V : Tree);
    procedure Sm_Storage_Size       (T : Tree; V : Tree);
    procedure Sm_Type_Spec          (T : Tree; V : Tree);
    procedure Sm_Type_Struct        (T : Tree; V : Tree);
    procedure Sm_Comp_Spec          (T : Tree; V : Tree);
    procedure Sm_Decl_S             (T : Tree; V : Tree);
    procedure Sm_First              (T : Tree; V : Tree);
    procedure Sm_Normalized_Param_S (T : Tree; V : Tree);
    procedure Sm_Stub               (T : Tree; V : Tree);
    procedure Sm_Record_Spec        (T : Tree; V : Tree);
    procedure Sm_Normalized_Comp_S  (T : Tree; V : Tree);

    procedure Sm_Parent (T : Tree; V : Tree);

    procedure Sm_Ops (T : Tree; S : Sequence);


    -- procedures for setting code attributes

    procedure Cd_Impl_Size (T : Tree; V : Integer);

    ---------------------------------------------------------------------------

    package Id_Table is
        -- ID_TABLE provides a mapping between DIANA.SYMBOL_REPS and
        -- DEF_IDs having that symbol representation in the context
        -- associated with the ID_TABLE.

        -- For the purpose of semantic analysis, id tables are attached
        -- to the following list headers and provide efficient random access
        -- (via symbol rep) to the declarations therein.

        -- Node      Contents

        -- DECL_S      package visible and private specs
        --    and task specs
        -- ITEM_S      decls (including labels and statement ids)
        --           within blocks (including
        --    program unit bodies)
        --      RECORD      all discriminants and fields of record
        --      PARAM_S      parameters
        -- GENERIC_PARAM_S     generic parameters
        -- DSCRMT_VAR_S     discriminant vars of private type

        type Id_Map is private;
        Null_Table : constant Id_Map;

        procedure Create (Mumble_S : Diana.Tree);
        procedure Create (Mumble_S : Diana.Tree; Of_Size : Integer);

        procedure Enter (Mumble_S : Diana.Tree; Defn : Diana.Tree);
        procedure Enter (Mumble_S : Diana.Tree; Defns : Diana.Sequence);
        procedure Enter (Mumble_S : Diana.Tree; Defns : Diana.Seq_Type);
        -- DEFN(S) is a (list of) def id(s).

        procedure Enter_New (Mumble_S : Diana.Tree; Defn : Diana.Tree);
        -- enter an id from an incrementally inserted decl


        procedure Remove (Mumble_S, Defn_Or_Decl : Diana.Tree);
        -- DEFN(S) is a (list of) def id(s).

        procedure Remove (Decl : Diana.Tree);
        -- Decl must be rooted on the list of a decl_s, item_s, param_s,
        -- generic_param_s, or record.

        function Identify (Mumble_S  : Diana.Tree;
                           Symbol    : Diana.Symbol_Rep;
                           Stop_Decl : Diana.Tree) return Diana.Sequence;

        function Identify (Mumble_S : Diana.Tree; Symbol : Diana.Symbol_Rep)
                          return Diana.Sequence;

        function Identify (Mumble_S  : Diana.Tree;
                           Symbol    : Diana.Symbol_Rep;
                           Stop_Decl : Diana.Tree) return Diana.Tree;

        function Identify (Mumble_S : Diana.Tree; Symbol : Diana.Symbol_Rep)
                          return Diana.Tree;

        function Identify (Mumble_S  : Diana.Tree;
                           Name      : String;
                           Stop_Decl : Diana.Tree) return Diana.Sequence;

        -- IDENTIFY returns the DEFN_IDs associated with the given SYMBOL from
        -- the given table.
        -- The form returning a single node, returns an arbitrary node
        -- associated with the symbol and should be used only when one can
        -- guarantee that at most one association could exist.
        -- A null value is returned if no association exists.
        -- If a STOP_DECL is given, only those associations that were
        -- established "before" the given STOP_DECL are retrieved.
        -- The ordering of ids in the table is the order of declaration
        -- in the underlying MUMBLE_S (or ITEM_S).

        function Identify_Wild (Mumble_S  : Diana.Tree;
                                Symbol    : Diana.Symbol_Rep;
                                Seen      : Diana.Temp_Seq;
                                Stop_Decl : Diana.Tree := Diana.Empty)
                               return Diana.Temp_Seq;


        function All_Ids (Mumble_S, Stop_Decl : Diana.Tree)
                         return Diana.Temp_Seq;
        function All_Ids (Mumble_S : Diana.Tree) return Diana.Temp_Seq;


        function Copy (Table : Id_Map) return Id_Map;

        generic
            with function Translate (Def_Id : Diana.Tree) return Diana.Tree;
        procedure Convert (Table : Id_Map);

        function All_Ids (Mumble_S, Stop_Decl : Diana.Tree)
                         return Diana.Sequence;
        function All_Ids (Mumble_S : Diana.Tree) return Diana.Sequence;

        function Header_Size    (M : Id_Map) return Integer;
        function Links_Size     (M : Id_Map) return Integer;
        function Total_Size     (M : Id_Map) return Integer;
        function Sequence_Nodes (M : Id_Map) return Integer;

        type Local_Id_Table is private;

        function Xlate (T : Local_Id_Table) return Id_Map;
        function Xlate (T : Id_Map)         return Local_Id_Table;

        generic
            with function Translate (Def_Id : Diana.Tree) return Diana.Tree;
        procedure Convert_Table (Old_Table, New_Table : Id_Map);
    private
        type Id_Map_Head;
        type Id_Map is access Id_Map_Head;
        pragma Segmented_Heap (Id_Map);

        type Local_Id_Table is new Id_Map;
        pragma Short_Pointer (Local_Id_Table);

        Null_Table : constant Id_Map := null;
        for Local_Id_Table'Size use 26;
    end Id_Table;

    ---------------------------------------------------------------------------

    package Permanent_Attributes is

        -- This is the low-level package for user-defined attributes.
        -- Usage of this package should be limited to small packages
        -- defining abstract user-defined attributes.  Implementation
        -- of the abstract user-defined attributes must be in terms of
        -- the limited set of types provided here.  More complex user-defined
        -- attributes (which are not directly representable as integers, trees,
        -- lists, etc.) may be implemented by using one of the simple types
        -- provided here for a key and having the package which encapsulates the
        -- the implementation of the user defined attribute do a mapping from
        -- the low-level type to a more appropriate type.  Note that in
        -- this case the Ada Object Manager is only storing the handle or key
        -- that is stored on the attribute list;  the implementation
        -- of the user defined attribute must provide storage facilities if
        -- the attribute is to be a permanent attribute.

        -- WARNING!!! Failure to follow these instructions may result in
        -- maintenance problems.  This package is exporting low-level
        -- unencapsulated operations that are subject to change.  Scattering
        -- usage of this package through millions of lines of code is strongly
        -- discouraged.  Proper encapsulation of the definition of all
        -- user-defined attributes will minimize the impact of such changes,
        -- and may result in the Diana-hackers actually doing the maintenance
        -- for you.

        type Attr_Sort is (Tree_Attr, Sequence_Attr, Symbol_Rep_Attr,
                           Integer_Attr, Float_Attr, Boolean_Attr,
                           Short_Integer_Attr, Byte_Attr,
                           Universal_Integer_Attr, Universal_Real_Attr,
                           Comment_Attr, List_Attr, Id_Table_Attr);

        subtype Name is Attr_Name;

        function Equal (X, Y : Name) return Boolean renames Diana.Equal;

        function Hash (Attr : Attr_Name) return Integer;

        function Permanent_Attr_Name  (Image : String) return Name;
        function Predefined_Attr_Name (Image : String) return Name;

        type Attr_Class is (Predefined, Permanent);

        function Class (Attr : Attr_Name) return Attr_Class;

        function Image  (Attr : Name) return String;
        function Symbol (Attr : Name) return Symbol_Rep;

        subtype List is Attr_List;

        function Attrs (Node : Tree) return List;
        function Hash  (L : List)    return Integer;

        subtype Id_Table is Diana.Id_Table.Id_Map;

        type Short_Integer is range -(2 ** 15 - 1) .. 2 ** 15 - 1;

        type Byte is range 0 .. 2 ** 8 - 1;

        function Get (Node : Tree; Attr : Name) return Tree;
        function Get (Node : Tree; Attr : Name) return Sequence;
        function Get (Node : Tree; Attr : Name) return Symbol_Rep;
        function Get (Node : Tree; Attr : Name) return Boolean;
        function Get (Node : Tree; Attr : Name) return Integer;
        function Get (Node : Tree; Attr : Name) return Float;
        function Get (Node : Tree; Attr : Name) return Short_Integer;
        function Get (Node : Tree; Attr : Name) return Byte;
        function Get (Node : Tree; Attr : Name) return Universal.Integer;
        function Get (Node : Tree; Attr : Name) return Universal.Real;
        function Get (Node : Tree; Attr : Name) return Comment;
        function Get (Node : Tree; Attr : Name) return List;
        function Get (Node : Tree; Attr : Name) return Id_Table;

        procedure Add (Node : Tree; Attr : Name; V : Tree);
        procedure Add (Node : Tree; Attr : Name; V : Sequence);
        procedure Add (Node : Tree; Attr : Name; V : Symbol_Rep);
        procedure Add (Node : Tree; Attr : Name; V : Boolean);
        procedure Add (Node : Tree; Attr : Name; V : Float);
        procedure Add (Node : Tree; Attr : Name; V : Integer);
        procedure Add (Node : Tree; Attr : Name; V : Short_Integer);
        procedure Add (Node : Tree; Attr : Name; V : Byte);
        procedure Add (Node : Tree; Attr : Name; V : Universal.Integer);
        procedure Add (Node : Tree; Attr : Name; V : Universal.Real);
        procedure Add (Node : Tree; Attr : Name; V : Comment);
        procedure Add (Node : Tree; Attr : Name; V : List);
        procedure Add (Node : Tree; Attr : Name; V : Id_Table);

        function  Has    (Node : Tree; Attr : Name) return Boolean;
        procedure Remove (Node : Tree; Attr : Name);

        function Nil                     return List;
        function Is_Empty (Attrs : List) return Boolean;

        function Cons (Head : Tree; Attrs : List)              return List;
        function Cons (Head : Sequence; Attrs : List)          return List;
        function Cons (Head : Symbol_Rep; Attrs : List)        return List;
        function Cons (Head : Boolean; Attrs : List)           return List;
        function Cons (Head : Float; Attrs : List)             return List;
        function Cons (Head : Integer; Attrs : List)           return List;
        function Cons (Head : Short_Integer; Attrs : List)     return List;
        function Cons (Head : Byte; Attrs : List)              return List;
        function Cons (Head : Universal.Integer; Attrs : List) return List;
        function Cons (Head : Universal.Real; Attrs : List)    return List;
        function Cons (Head : Comment; Attrs : List)           return List;
        function Cons (Head : Id_Table; Attrs : List)          return List;
        function Cons (Head : List; Attrs : List)              return List;

        function Kind     (Attrs : List) return Attr_Sort;
        function Get_Name (Attrs : List) return Name;
        -- returns the kind/name of the first element of the list.

        function Head (Attrs : List) return Tree;
        function Head (Attrs : List) return Sequence;
        function Head (Attrs : List) return Symbol_Rep;
        function Head (Attrs : List) return Boolean;
        function Head (Attrs : List) return Float;
        function Head (Attrs : List) return Integer;
        function Head (Attrs : List) return Short_Integer;
        function Head (Attrs : List) return Byte;
        function Head (Attrs : List) return Universal.Integer;
        function Head (Attrs : List) return Universal.Real;
        function Head (Attrs : List) return Id_Table;
        function Head (Attrs : List) return Comment;
        function Head (Attrs : List) return List;

        function Tail (Attrs : List) return List;

        procedure Replace_Head (Attrs : in out List; V : Tree);
        procedure Replace_Head (Attrs : in out List; V : Sequence);
        procedure Replace_Head (Attrs : in out List; V : Symbol_Rep);
        procedure Replace_Head (Attrs : in out List; V : Boolean);
        procedure Replace_Head (Attrs : in out List; V : Float);
        procedure Replace_Head (Attrs : in out List; V : Integer);
        procedure Replace_Head (Attrs : in out List; V : Short_Integer);
        procedure Replace_Head (Attrs : in out List; V : Byte);
        procedure Replace_Head (Attrs : in out List; V : Universal.Integer);
        procedure Replace_Head (Attrs : in out List; V : Universal.Real);
        procedure Replace_Head (Attrs : in out List; V : Id_Table);
        procedure Replace_Head (Attrs : in out List; V : Comment);
        procedure Replace_Head (Attrs : in out List; V : List);

        procedure Replace_Tail (L1, L2 : List);
    end Permanent_Attributes;

    ---------------------------------------------------------------------------

    package Edit_Utilities is

        function Copy (T : Tree) return Tree;
        -- copy a node including all its attributes and subtrees.

        function Copy (L : Seq_Type) return Seq_Type;
        -- copy a list - will copy all trees in the list.

        procedure Remove (T : Tree; Detach : Boolean := True);
        -- remove a tree from its parent.
        -- If DETACH is false, then the pointers in T will not be
        -- reset, and the resulting list structure will be illegal
        -- due to sharing.  Any further operations on T are likely
        -- to fail in unpleasant ways.

        procedure Remove (L : Seq_Type);
        -- remove a tree from its parent.

        procedure Exchange (T1, T2 : Tree);
        -- replaces T1 by T2 and T2 by T1, updating backpointers and parents.


        function Copy (S : Seq_Type) return Sequence;
        -- convert from a seq_type to a sequence

        function Copy (S : Temp_Seq) return Sequence;
        -- convert from a temp_seq to a sequence

        function Copy (S : Sequence) return Temp_Seq;
        -- convert from a sequence to a temp_seq

        function Copy (S : Sequence; In_Segment : System.Segment)
                      return Temp_Seq;
        -- convert from a sequence to a temp_seq

        procedure Move_Attributes (From : Tree; To : Tree);
        procedure Move_Attr_List  (From, To : Tree);

        procedure Change_Node_Name (T : in out Tree; New_Name : Node_Name);

        procedure Change_Node (From       : Tree;
                               To         : Tree;
                               Move_Attrs : Boolean := True;
                               Detach     : Boolean := True);

        function Root (Node : Tree) return Tree;

        procedure Set_Back_Pointer (Child : Tree; Parent : Tree);

        function Invert (L : Seq_Type) return Seq_Type;
        -- reverse a seq_type in-place returning head of reversed list

        function Duplicate (T : Tree) return Tree;
        -- used be tree compaction to copy a tree and its attributes.
    end Edit_Utilities;

    ---------------------------------------------------------------------------

    package List_Utilities is

        type List_Arity is (Zero, One, Many);

        -- operations on DIANA.SEQ_TYPE

        function List (N1 : Tree)                 return Seq_Type;
        function List (N1, N2 : Tree)             return Seq_Type;
        function List (N1, N2, N3 : Tree)         return Seq_Type;
        function List (N1, N2, N3, N4 : Tree)     return Seq_Type;
        function List (N1, N2, N3, N4, N5 : Tree) return Seq_Type;

        function Length        (L : Seq_Type) return Integer;
        function Length_Is_One (L : Seq_Type) return Boolean;
        function Arity         (L : Seq_Type) return List_Arity;

        function Is_Member (N : Tree; L : Seq_Type) return Boolean;
        -- test if node is a member of a list

        function Id_Is_Member
                    (Id_Node : Tree; Id_List : Seq_Type) return Boolean;
        -- test if an id with name of ID_NODE occurs on ID_LIST

        function Nconc (L1, L2 : Seq_Type) return Seq_Type;
        -- lisp nconc, L2 is attached to LAST (L1), L1 returned
        -- is_empty (L1) => return L2;

        function Jth (L : Seq_Type; J : Integer) return Tree;
        -- returns J'th member of L
        -- in J > 0 and LENGTH (L) >= J

        function Last (L : Seq_Type) return Seq_Type;
        -- returns list part of last member of L
        -- is_empty (L) => return make

        function Pos (N : Tree; L : Seq_Type) return Integer;
        -- position of N within L counting from 0
        -- N not in L => return -1

        procedure Nconc (L : in out Seq_Type; T : Tree);
        -- equivalent to L := NCONC (L, CONS (T, make))

        function Get_Seq_Type (List_Element : Tree) return Seq_Type;
        --| pre-condition: arity (as_parent (list_element)) = arbitrary.

        procedure Insert (Parent : Tree; Node : Tree; Position : Natural);
        -- Inserts NODE after the POSITION'th element in the AS_LIST of
        -- PARENT.  (POSITION = 0) => NODE is new head of list.


        -- operations on DIANA.SEQUENCE.

        function List (N1 : Tree)                 return Sequence;
        function List (N1, N2 : Tree)             return Sequence;
        function List (N1, N2, N3 : Tree)         return Sequence;
        function List (N1, N2, N3, N4 : Tree)     return Sequence;
        function List (N1, N2, N3, N4, N5 : Tree) return Sequence;

        function Length        (L : Sequence) return Integer;
        function Length_Is_One (L : Sequence) return Boolean;
        function Arity         (L : Sequence) return List_Arity;

        function Is_Member (N : Tree; L : Sequence) return Boolean;
        -- test if N occurs on list L

        function Id_Is_Member
                    (Id_Node : Tree; Id_List : Sequence) return Boolean;
        -- test if an id with name of ID_NODE occurs on ID_LIST

        function Append (L1, L2 : Sequence) return Sequence;
        -- lisp append, L1 is copied, L2 is attached to copy which is returned

        function Nconc (L1, L2 : Sequence) return Sequence;
        -- lisp nconc, L2 is attached to LAST (L1), L1 returned
        -- is_empty (L1) => return L2;

        function Concat (L1, L2 : Sequence) return Sequence;
        -- L1 and L2 are copied then nconc'ed

        function Invert (L : Sequence) return Sequence;
        -- lisp reverse, makes new copy of list (reverse is a keyword)

        function Jth (L : Sequence; J : Integer) return Tree;
        -- returns J'th member of L
        -- in J > 0 and LENGTH (L) >= J

        function Last (L : Sequence) return Sequence;
        -- returns list part of last member of L
        -- is_empty (L) => return make

        function Pos (N : Tree; L : Sequence) return Integer;
        -- position of N within L counting from 0
        -- N not in L => return -1

        procedure Nconc (L : in out Sequence; T : Tree);
        -- equivalent to L := NCONC (L, CONS (T, make))


        -- operations on DIANA.TEMP_SEQ

        function List (N1 : Tree)                 return Temp_Seq;
        function List (N1, N2 : Tree)             return Temp_Seq;
        function List (N1, N2, N3 : Tree)         return Temp_Seq;
        function List (N1, N2, N3, N4 : Tree)     return Temp_Seq;
        function List (N1, N2, N3, N4, N5 : Tree) return Temp_Seq;

        function Length        (L : Temp_Seq) return Integer;
        function Length_Is_One (L : Temp_Seq) return Boolean;
        function Arity         (L : Temp_Seq) return List_Arity;

        function Is_Member (N : Tree; L : Temp_Seq) return Boolean;
        -- test if N occurs on list L

        function Id_Is_Member
                    (Id_Node : Tree; Id_List : Temp_Seq) return Boolean;
        -- test if an id with name of ID_NODE occurs on ID_LIST

        function Append (L1, L2 : Temp_Seq)            return Temp_Seq;
        function Append (L1 : Sequence; L2 : Temp_Seq) return Temp_Seq;
        -- lisp append, L1 is copied, L2 is attached to copy which is returned

        function Nconc (L1, L2 : Temp_Seq) return Temp_Seq;
        -- lisp nconc, L2 is attached to LAST (L1), L1 returned
        -- is_empty (L1) => return L2;

        function Concat (L1, L2 : Temp_Seq) return Temp_Seq;
        -- L1 and L2 are copied then nconc'ed

        function Invert (L : Temp_Seq) return Temp_Seq;
        -- lisp reverse, makes new copy of list (reverse is a keyword)

        function Jth (L : Temp_Seq; J : Integer) return Tree;
        -- returns J'th member of L
        -- in J > 0 and LENGTH (L) >= J

        function Last (L : Temp_Seq) return Temp_Seq;
        -- returns list part of last member of L
        -- is_empty (L) => return make

        function Pos (N : Tree; L : Temp_Seq) return Integer;
        -- position of N within L counting from 0
        -- N not in L => return -1

        procedure Nconc (L : in out Temp_Seq; T : Tree);
        -- equivalent to L := NCONC (L, CONS (T, make))


        procedure Insert (Parent : Tree; Node : Tree; After : Diana.Tree);
        -- Inserts NODE after AFTER in the AS_LIST of PARENT.
        -- is_empty (AFTER) => node is new head of list.
    end List_Utilities;

    ---------------------------------------------------------------------------

    package Id_Utilities is

        procedure Set_Trace;
        procedure Reset_Trace;

        function Comp_Unit_Id (Comp_Unit : Tree) return Tree;
        -- Returns the Id for a comp unit.

        function Unit_Id (Unit : Tree) return Tree;
        -- Returns the Id or Designator as appropriate for
        -- a given program unit item.

        function Get_Id (Decl_Node : Diana.Tree) return Diana.Tree;
        -- get the id out of anything that has a single id

        function Is_Predefined (Id_Node : Tree) return Boolean;

        function Get_Defn (Name : Tree) return Tree;
        -- Given a using occurence or selected, returns the defining occurence.

        function Enclosing_Declaration (Id : Tree) return Tree;
        -- Finds the nearest enclosing declaration (item).

        function First_Def_Id
                    (Item : Tree; Iterate : Boolean := True) return Tree;
        function Next_Def_Id (Def_Id : Tree)                 return Tree;
        -- These two functions allow traversal of the entities in a
        -- Decl_s or Item_s.  Each Def_id will be visited to account for
        -- multiple object declarations (x,y:t).  This only visits the
        -- def_ids for the explicit declarations at the top level.
        -- Does not go inside enumaration type declarations, visit
        -- implicit operators, visit parameters or record fields, etc.
        -- The optional iterate parameter causes first_def_id to
        -- search down the Item_s if Item is a use clause or some
        -- item which does not have an id.

        function First (Id : Diana.Tree) return Diana.Tree;
        -- Given a defining occurence, returns the first occurence.

        function Flatten (Name : Diana.Tree) return Diana.Sequence;

        function Fully_Qualified_Name
                    (Def_Id : Diana.Tree) return Diana.Sequence;


        -- The following functions retrieve all visible entities.

        function All_Ids_Of
                    (Decl_List : Tree; Until_Stub : Symbol_Rep := Null_Text)
                    return Sequence;

        function All_Ids_Of
                    (Decl_List : Tree; Until_Decl : Tree) return Sequence;

        function All_Ids_In_Visible_Part (Package_Spec : Tree) return Sequence;
        function All_Ids_In_Private_Part (Package_Spec : Tree) return Sequence;

        function All_Ids_In_Task_Spec (Task_Spec : Tree) return Sequence;

        function All_Param_Ids_Of (Params : Tree)         return Sequence;
        function All_Field_Ids_Of (Component_List : Tree) return Sequence;

        function All_Label_Ids_Of     (Block_Node : Tree) return Sequence;
        function All_Named_Stm_Ids_Of (Block_Node : Tree) return Sequence;

        function All_Ids_In_Block (Block_Node : Tree; Is_Unit : Boolean := True)
                                  return Sequence;
    end Id_Utilities;

    ---------------------------------------------------------------------------

    generic
        with procedure Put (S : String);
        with procedure New_Line;
        with procedure Print_Other_Attrs
                          (Node : Diana.Tree; Indentation : Integer);
    package Symbolic_Io is
        procedure Output (List            : Diana.Sequence;
                          With_Attributes : Boolean := True);

        procedure Output (Node : Diana.Tree; With_Attributes : Boolean := True);
    end Symbolic_Io;

    ---------------------------------------------------------------------------

    package Attr_Names is
        function Attr_Address           return Symbol_Rep;
        function Attr_Base              return Symbol_Rep;
        function Attr_Size              return Symbol_Rep;
        function Attr_First             return Symbol_Rep;
        function Attr_Last              return Symbol_Rep;
        function Attr_Image             return Symbol_Rep;
        function Attr_Value             return Symbol_Rep;
        function Attr_Pos               return Symbol_Rep;
        function Attr_Val               return Symbol_Rep;
        function Attr_Pred              return Symbol_Rep;
        function Attr_Succ              return Symbol_Rep;
        function Attr_Delta             return Symbol_Rep;
        function Attr_Machine_Rounds    return Symbol_Rep;
        function Attr_Digits            return Symbol_Rep;
        function Attr_Mantissa          return Symbol_Rep;
        function Attr_Emax              return Symbol_Rep;
        function Attr_Small             return Symbol_Rep;
        function Attr_Large             return Symbol_Rep;
        function Attr_Epsilon           return Symbol_Rep;
        function Attr_Machine_Radix     return Symbol_Rep;
        function Attr_Machine_Emax      return Symbol_Rep;
        function Attr_Machine_Emin      return Symbol_Rep;
        function Attr_Length            return Symbol_Rep;
        function Attr_Range             return Symbol_Rep;
        function Attr_Constrained       return Symbol_Rep;
        function Attr_Position          return Symbol_Rep;
        function Attr_First_Bit         return Symbol_Rep;
        function Attr_Last_Bit          return Symbol_Rep;
        function Attr_Storage_Size      return Symbol_Rep;
        function Attr_Terminated        return Symbol_Rep;
        function Attr_Count             return Symbol_Rep;
        function Attr_Machine_Mantissa  return Symbol_Rep;
        function Attr_Machine_Overflows return Symbol_Rep;
        function Attr_Aft               return Symbol_Rep;
        function Attr_Callable          return Symbol_Rep;
        function Attr_Fore              return Symbol_Rep;
        function Attr_Safe_Emax         return Symbol_Rep;
        function Attr_Safe_Large        return Symbol_Rep;
        function Attr_Safe_Small        return Symbol_Rep;
        function Attr_Width             return Symbol_Rep;
    end Attr_Names;


    package Pragma_Names is
        function Priority     return Symbol_Rep;
        function Memory_Size  return Symbol_Rep;
        function Suppress     return Symbol_Rep;
        function Inline       return Symbol_Rep;
        function List         return Symbol_Rep;
        function Pack         return Symbol_Rep;
        function Storage_Unit return Symbol_Rep;
        function Optimize     return Symbol_Rep;
        function Interface    return Symbol_Rep;
        function System_Name  return Symbol_Rep;
        function Controlled   return Symbol_Rep;
        function Elaborate    return Symbol_Rep;
        function Page         return Symbol_Rep;
        function Shared       return Symbol_Rep;
    end Pragma_Names;


    package Operator_Names is
        function Abs_Op    return Symbol_Rep;
        function Plus_Op   return Symbol_Rep;
        function Minus_Op  return Symbol_Rep;
        function Times_Op  return Symbol_Rep;
        function Divide_Op return Symbol_Rep;
        function Mod_Op    return Symbol_Rep;
        function Rem_Op    return Symbol_Rep;
        function Exp_Op    return Symbol_Rep;

        function And_Op return Symbol_Rep;
        function Or_Op  return Symbol_Rep;
        function Xor_Op return Symbol_Rep;
        function Not_Op return Symbol_Rep;

        function Eq_Op return Symbol_Rep;
        function Ne_Op return Symbol_Rep;
        function Lt_Op return Symbol_Rep;
        function Gt_Op return Symbol_Rep;
        function Ge_Op return Symbol_Rep;
        function Le_Op return Symbol_Rep;

        function Concat_Op return Symbol_Rep;

        function Operators (Index : Positive) return Symbol_Rep;
    end Operator_Names;


    package Check_Names is
        function Access_Check       return Symbol_Rep;
        function Discriminant_Check return Symbol_Rep;
        function Index_Check        return Symbol_Rep;
        function Length_Check       return Symbol_Rep;
        function Range_Check        return Symbol_Rep;
        function Division_Check     return Symbol_Rep;
        function Overflow_Check     return Symbol_Rep;
        function Elaboration_Check  return Symbol_Rep;
        function Storage_Check      return Symbol_Rep;
    end Check_Names;


    package Exception_Names is
        function Constraint_Err return Symbol_Rep;
        function Numeric_Err    return Symbol_Rep;
        function Storage_Err    return Symbol_Rep;
        function Tasking_Err    return Symbol_Rep;
        function Program_Err    return Symbol_Rep;
    end Exception_Names;

    ---------------------------------------------------------------------------

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Tree;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Seq_Type;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Sequence;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Symbol_Rep;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Number_Rep;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Comment;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Attr_Name;

    function Convert (Segment : System.Segment; Offset : System.Bit_Offset)
                     return Attr_List;

    function Convert (Node : Tree) return System.Address;

    ---------------------------------------------------------------------------

    function Node_Size (T : Diana.Tree)     return Integer;
    function Node_Size (S : Diana.Seq_Type) return Integer;
    function Node_Size (S : Diana.Sequence) return Integer;
    function Node_Size (S : Diana.Temp_Seq) return Integer;
    function Node_Size (L : Attr_List)      return Integer;

    function Size (S : Diana.Symbol_Rep) return Integer;
    function Size (S : Diana.Number_Rep) return Integer;

    function Size (S : Diana.Sequence) return Integer;
    function Size (S : Diana.Temp_Seq) return Integer;

    function Hash (S : Diana.Seq_Type) return Long_Integer;
    function Hash (S : Diana.Sequence) return Long_Integer;
    function Hash (S : Diana.Temp_Seq) return Long_Integer;

    ---------------------------------------------------------------------------

    -- Operator type

    type Operator is
       (No_Operation, Boolean_Eq, Boolean_Ne,
        Boolean_Lt, Boolean_Le, Boolean_Gt, Boolean_Ge,

        Boolean_And, Boolean_Or, Boolean_Xor, Boolean_Not,

        Other_Boolean_Eq, Other_Boolean_Ne, Other_Boolean_Lt,
        Other_Boolean_Le, Other_Boolean_Gt, Other_Boolean_Ge,

        Other_Boolean_And, Other_Boolean_Or,
        Other_Boolean_Xor, Other_Boolean_Not,

        Integer_Eq, Integer_Ne, Integer_Lt, Integer_Le, Integer_Gt, Integer_Ge,

        Integer_Plus, Integer_Neg, Integer_Abs,

        Integer_Add, Integer_Sub, Integer_Mul,
        Integer_Div, Integer_Mod, Integer_Rem,

        Integer_Exp,

        Short_Integer_Eq, Short_Integer_Ne, Short_Integer_Lt,
        Short_Integer_Le, Short_Integer_Gt, Short_Integer_Ge,

        Short_Integer_Plus, Short_Integer_Neg, Short_Integer_Abs,

        Short_Integer_Add, Short_Integer_Sub, Short_Integer_Mul,
        Short_Integer_Div, Short_Integer_Mod, Short_Integer_Rem,

        Short_Integer_Exp,

        Short_Short_Integer_Eq, Short_Short_Integer_Ne, Short_Short_Integer_Lt,
        Short_Short_Integer_Le, Short_Short_Integer_Gt, Short_Short_Integer_Ge,

        Short_Short_Integer_Plus,
        Short_Short_Integer_Neg, Short_Short_Integer_Abs,

        Short_Short_Integer_Add, Short_Short_Integer_Sub,
        Short_Short_Integer_Mul, Short_Short_Integer_Div,
        Short_Short_Integer_Mod, Short_Short_Integer_Rem,

        Short_Short_Integer_Exp,

        Long_Integer_Eq, Long_Integer_Ne, Long_Integer_Lt,
        Long_Integer_Le, Long_Integer_Gt, Long_Integer_Ge,

        Long_Integer_Plus, Long_Integer_Neg, Long_Integer_Abs,

        Long_Integer_Add, Long_Integer_Sub, Long_Integer_Mul,
        Long_Integer_Div, Long_Integer_Mod, Long_Integer_Rem,

        Long_Integer_Exp,

        Long_Long_Integer_Eq, Long_Long_Integer_Ne, Long_Long_Integer_Lt,
        Long_Long_Integer_Le, Long_Long_Integer_Gt, Long_Long_Integer_Ge,

        Long_Long_Integer_Plus, Long_Long_Integer_Neg, Long_Long_Integer_Abs,

        Long_Long_Integer_Add, Long_Long_Integer_Sub, Long_Long_Integer_Mul,
        Long_Long_Integer_Div, Long_Long_Integer_Mod, Long_Long_Integer_Rem,

        Long_Long_Integer_Exp,

        Formal_Integer_Eq, Formal_Integer_Ne, Formal_Integer_Lt,
        Formal_Integer_Le, Formal_Integer_Gt, Formal_Integer_Ge,

        Formal_Integer_Plus, Formal_Integer_Neg, Formal_Integer_Abs,

        Formal_Integer_Add, Formal_Integer_Sub, Formal_Integer_Mul,
        Formal_Integer_Div, Formal_Integer_Mod, Formal_Integer_Rem,

        Formal_Integer_Exp,

        Universal_Integer_Eq, Universal_Integer_Ne, Universal_Integer_Lt,
        Universal_Integer_Le, Universal_Integer_Gt, Universal_Integer_Ge,

        Universal_Integer_Plus, Universal_Integer_Neg, Universal_Integer_Abs,

        Universal_Integer_Add, Universal_Integer_Sub, Universal_Integer_Mul,
        Universal_Integer_Div, Universal_Integer_Mod, Universal_Integer_Rem,

        Universal_Integer_Exp,

        Other_Integer_Eq, Other_Integer_Ne, Other_Integer_Lt,
        Other_Integer_Le, Other_Integer_Gt, Other_Integer_Ge,

        Other_Integer_Plus, Other_Integer_Neg, Other_Integer_Abs,

        Other_Integer_Add, Other_Integer_Sub, Other_Integer_Mul,
        Other_Integer_Div, Other_Integer_Mod, Other_Integer_Rem,

        Other_Integer_Exp,

        Float_Eq, Float_Ne, Float_Lt, Float_Le, Float_Gt, Float_Ge,

        Float_Plus, Float_Neg, Float_Abs,

        Float_Add, Float_Sub, Float_Mul, Float_Div,

        Float_Exp,

        Short_Float_Eq, Short_Float_Ne, Short_Float_Lt,
        Short_Float_Le, Short_Float_Gt, Short_Float_Ge,

        Short_Float_Plus, Short_Float_Neg, Short_Float_Abs,

        Short_Float_Add, Short_Float_Sub, Short_Float_Mul, Short_Float_Div,

        Short_Float_Exp,

        Short_Short_Float_Eq, Short_Short_Float_Ne, Short_Short_Float_Lt,
        Short_Short_Float_Le, Short_Short_Float_Gt, Short_Short_Float_Ge,

        Short_Short_Float_Plus, Short_Short_Float_Neg, Short_Short_Float_Abs,

        Short_Short_Float_Add, Short_Short_Float_Sub,
        Short_Short_Float_Mul, Short_Short_Float_Div,

        Short_Short_Float_Exp,

        Long_Float_Eq, Long_Float_Ne, Long_Float_Lt,
        Long_Float_Le, Long_Float_Gt, Long_Float_Ge,

        Long_Float_Plus, Long_Float_Neg, Long_Float_Abs,

        Long_Float_Add, Long_Float_Sub, Long_Float_Mul, Long_Float_Div,

        Long_Float_Exp,

        Long_Long_Float_Eq, Long_Long_Float_Ne, Long_Long_Float_Lt,
        Long_Long_Float_Le, Long_Long_Float_Gt, Long_Long_Float_Ge,

        Long_Long_Float_Plus, Long_Long_Float_Neg, Long_Long_Float_Abs,

        Long_Long_Float_Add, Long_Long_Float_Sub,
        Long_Long_Float_Mul, Long_Long_Float_Div,

        Long_Long_Float_Exp,

        Formal_Float_Eq, Formal_Float_Ne, Formal_Float_Lt,
        Formal_Float_Le, Formal_Float_Gt, Formal_Float_Ge,

        Formal_Float_Plus, Formal_Float_Neg, Formal_Float_Abs,

        Formal_Float_Add, Formal_Float_Sub, Formal_Float_Mul, Formal_Float_Div,

        Formal_Float_Exp,

        Universal_Real_Eq, Universal_Real_Ne, Universal_Real_Lt,
        Universal_Real_Le, Universal_Real_Gt, Universal_Real_Ge,

        Universal_Real_Plus, Universal_Real_Neg, Universal_Real_Abs,

        Universal_Real_Add, Universal_Real_Sub,
        Universal_Real_Mul, Universal_Real_Div,

        Universal_Real_Exp,

        Universal_Integer_Real_Mul, Universal_Real_Integer_Mul,
        Universal_Real_Integer_Div,

        Universal_Fixed_Mul, Universal_Fixed_Div,

        Duration_Eq, Duration_Ne, Duration_Lt,
        Duration_Le, Duration_Gt, Duration_Ge,

        Duration_Plus, Duration_Neg, Duration_Abs,

        Duration_Add, Duration_Sub, Duration_Integer_Mul,
        Integer_Duration_Mul, Duration_Integer_Div,

        Formal_Fixed_Eq, Formal_Fixed_Ne, Formal_Fixed_Lt,
        Formal_Fixed_Le, Formal_Fixed_Gt, Formal_Fixed_Ge,

        Formal_Fixed_Plus, Formal_Fixed_Neg, Formal_Fixed_Abs,

        Formal_Fixed_Add, Formal_Fixed_Sub, Formal_Fixed_Integer_Mul,
        Integer_Formal_Fixed_Mul, Formal_Fixed_Integer_Div,

        Other_Fixed_Eq, Other_Fixed_Ne, Other_Fixed_Lt,
        Other_Fixed_Le, Other_Fixed_Gt, Other_Fixed_Ge,

        Other_Fixed_Plus, Other_Fixed_Neg, Other_Fixed_Abs,

        Other_Fixed_Add, Other_Fixed_Sub, Other_Fixed_Integer_Mul,
        Integer_Other_Fixed_Mul, Other_Fixed_Integer_Div,

        Character_Eq, Character_Ne, Character_Lt,
        Character_Le, Character_Gt, Character_Ge,

        Enumeration_Eq, Enumeration_Ne, Enumeration_Lt,
        Enumeration_Le, Enumeration_Gt, Enumeration_Ge,

        Formal_Discrete_Eq, Formal_Discrete_Ne, Formal_Discrete_Lt,
        Formal_Discrete_Le, Formal_Discrete_Gt, Formal_Discrete_Ge,

        String_Eq, String_Ne, String_Lt, String_Le, String_Gt, String_Ge,

        String_String_Cat, String_Character_Cat,
        Character_String_Cat, Character_Character_Cat,

        One_Dim_Array_Eq, One_Dim_Array_Ne,
        One_Dim_Discrete_Array_Lt, One_Dim_Discrete_Array_Le,
        One_Dim_Discrete_Array_Gt, One_Dim_Discrete_Array_Ge,

        One_Dim_Boolean_Array_Not, One_Dim_Boolean_Array_And,
        One_Dim_Boolean_Array_Or, One_Dim_Boolean_Array_Xor,

        One_Dim_Array_Array_Cat, One_Dim_Array_Element_Cat,
        One_Dim_Element_Array_Cat, One_Dim_Element_Element_Cat,

        Multi_Dim_Array_Eq, Multi_Dim_Array_Ne,

        One_Dim_Formal_Array_Eq, One_Dim_Formal_Array_Ne,
        One_Dim_Discrete_Formal_Array_Lt, One_Dim_Discrete_Formal_Array_Le,
        One_Dim_Discrete_Formal_Array_Gt, One_Dim_Discrete_Formal_Array_Ge,

        One_Dim_Boolean_Formal_Array_Not, One_Dim_Boolean_Formal_Array_And,
        One_Dim_Boolean_Formal_Array_Or, One_Dim_Boolean_Formal_Array_Xor,

        One_Dim_Formal_Array_Array_Cat, One_Dim_Formal_Array_Element_Cat,
        One_Dim_Formal_Element_Array_Cat, One_Dim_Formal_Element_Element_Cat,

        Multi_Dim_Formal_Array_Eq, Multi_Dim_Formal_Array_Ne,

        Record_Eq, Record_Ne,

        Access_Eq, Access_Ne,

        Formal_Access_Eq, Formal_Access_Ne,

        Private_Eq, Private_Ne,

        Formal_Private_Eq, Formal_Private_Ne);

    procedure Sm_Operator (T : Tree; V : Operator);

    function Sm_Operator (T : Tree) return Operator;

    procedure Sm_Operator_Value (T : Tree; V : Operator);

    function Sm_Operator_Value (T : Tree) return Operator;

    ---------------------------------------------------------------------------

    -- Line Count attribute for pretty printer.

    type Line_Count is new Integer range 0 .. 2 ** 24 - 1;

    function Lx_Line_Count (T : Tree) return Line_Count;

    procedure Lx_Line_Count (T : Tree; V : Line_Count);

    -- Predicates to facilitate efficient traversal of structural
    -- lists.

    function Is_In_List (T : Diana.Tree) return Boolean;

    -- returns true iff T is a member of a structural list, i.e.
    -- iff T = Diana.Head (S) for some seq_type value S.

    function Is_At_Lists_End (T : Diana.Tree) return Boolean;

    ---------------------------------------------------------------------------

    package Id_Table_Attrs is
        function  Has_Sm_Seqnum (Id : Diana.Tree) return Boolean;
        procedure Sm_Seqnum     (Id : Diana.Tree; Seqnum : Integer);
        function  Sm_Seqnum     (Id : Diana.Tree) return Integer;

        procedure Sm_Id_Table (Decl_Regn : Diana.Tree; Value : Id_Table.Id_Map);
        function  Sm_Id_Table (Decl_Regn : Diana.Tree) return Id_Table.Id_Map;
        function  Has_Sm_Id_Table (Decl_Regn : Diana.Tree) return Boolean;
    end Id_Table_Attrs;

    ---------------------------------------------------------------------------

    type Decl_Number is range 0 .. 4095;

    type Decl_Number_Mask_Array is array (Decl_Number) of Boolean;

    type Decl_Number_Mask is access Decl_Number_Mask_Array;
    pragma Segmented_Heap (Decl_Number_Mask);

    ---------------------------------------------------------------------------

    type Tree_Vector is array (Positive range <>) of Diana.Tree;

    function Is_Comment (Node : Diana.Tree) return Boolean;

    type Declaration_Number is new Natural;

    type Declaration_Number_Mask_Array is
       array (Declaration_Number range <>) of Boolean;

    type Declaration_Number_Mask is access Declaration_Number_Mask_Array;
    pragma Segmented_Heap (Declaration_Number_Mask);


    function Has_Lx_Line_Count (T : Diana.Tree) return Boolean;
end Diana;

pragma Cache_Register (Diana, 11);