DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦dca7083fe⟧ TextFile

    Length: 8565 (0x2175)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦e491ec7eb⟧ 
            └─⟦this⟧ 

TextFile


 @node !Commands.Ada.Expand_Names

 procedure Expand_Names (Name             : String  := "<SELECTION>";
                         Prefix_Standard  : Boolean := False;
                         Prefix_Unit      : Boolean := False;
                         Expand_Operators : Boolean := False);

 DESCRIPTION

 Expands names within the designated Ada fragment, making explicit the
 effect of use clauses on those names; thus, the Expand_Names procedure
 identifies any simple name that is made visible through a use clause and
 replaces each such name with the appropriate qualified name.

 By default, this procedure does not expand:

 *  Names from package Standard (for example, Integer)

 *  Names declared in the current compilation unit

 *  Operators (for example, "=" and "+").

 However, you can request expansion in each of these cases by setting the
 appropriate parameter (Prefix_Standard, Prefix_Unit, or Expand_Operator) to
 true.

 PARAMETERS

 Name : String := "<SELECTION>";

 Specifies the Ada fragment within which names are to be expanded. The Name
 parameter can be the name of a single Ada unit. The default value,
 "<SELECTION>", permits you to designate a substructure within an Ada unit
 by highlighting it (provided that the cursor is in the highlighted area).
 For example, within a package, you can expand only the names in a given
 subprogram by selecting just that subprogram.

 Prefix_Standard : Boolean := False;

 Specifies whether to expand identifiers declared in package Standard. When
 false (the default), such identifiers are not expanded. When true, the name
 Standard is prepended to each such identifier.

 Prefix_Unit : Boolean := False;

 Specifies whether to expand identifiers declared in the current Ada unit.
 When false (the default), such identifiers are not expanded. When true, the
 name of the current unit is prepended to each such identifier.

 Expand_Operators : Boolean := False;

 Specifies whether to expand operators, regardless of where they are
 declared. When false (the default), operators are not expanded. When true,
 the name of the defining unit is prepended to each operator. Note that
 operators declared in package Standard are expanded only if both the
 Prefix_Standard and Expand_Operators parameters are true.

 EXAMPLES

 Example 1.  Assume that each of two packages, First and Second, contains a
 procedure P with different parameter profiles, as shown below:

    package First is
        procedure P (X : Boolean);
    end First;
  
    package Second is
        procedure P (X : Integer);
    end Second;

 Assume that procedure Test calls procedure P from each package, as shown
 below:

    with First, Second;
    use First, Second;
    procedure Test is
    begin
        P (True);
        P (3);
    end Test;

 Selecting procedure Test and entering the Ada.Expand_Names procedure
 resolves each simple name P, replacing it with its expanded name:

    with First, Second;
    use First, Second;
    procedure Test is
    begin
        First.P (True);
        Second.P (3);
    end Test;

 Example 2.  Now assume that packages First and Second are declared inside
 procedure Test, as shown below:

    procedure Test is
        package First is
            procedure P (X : Boolean);
        end First;
  
        package Second is
            procedure P (X : Integer);
        end Second;

        use First, Second;
    begin
        P (True);
        P (3);
    end Test;

 You can expand the names of objects that are declared in the unit Test by
 selecting Test and entering the following command:

    Ada.Expand_Names (Name => "<SELECTION>",
                      Prefix_Standard => False,
                      Prefix_Unit => True,
                      Expand_Operators => False);

 As a result, the procedure appears as follows:

    procedure Test is
        package First is
            procedure P (X : Boolean);
        end First;
  
        package Second is
            procedure P (X : Integer);
        end Second;
  
        use Test.First, Test.Second;
    begin
        Test.First.P (True);
        Test.Second.P (3);
    end Test;
  
 Example 3.  Now consider the following procedure, which uses a type
 (Integer) and an operator (+) defined in package Standard:

    procedure My_Plus (X, Y : Integer) is
        Sum : Integer;
    begin
        Sum := X + Y;
    end My_Plus;

 The following command expands the names of both the type and the operator:

    Ada.Expand_Names (Name => "<SELECTION>",
                      Prefix_Standard => True,
                      Prefix_Unit => False,
                      Expand_Operators => True);
  
 As a result, the procedure appears as follows:

    procedure My_Plus (X, Y : Standard.Integer) is
        Sum : Standard.Integer;
    begin
        Sum := Standard."+" (X, Y);
    end My_Plus;

 Note that if the My_Plus procedure contained any names made visible
 through use clauses, they would have expanded also.

 @node !Commands.Command.Make_Procedure

 procedure Make_Procedure (Name    : String := ">>Simple Procedure Name<<";
                           Context : String := "$");

 DESCRIPTION

 Creates an Ada procedure whose body is the contents of the Command window
 designated by the cursor.

 The new procedure is given the specified name and is created in the
 specified library. The Make_Procedure command is especially useful when you
 have developed a test program in a Command window and you want to make
 that program a permanent Ada unit in a library.

 The Make_Procedure command opens an insertion window, builds the new
 procedure in it, and leaves the cursor in the new window. The new
 procedure is left in the source state, allowing you to make further
 modifications before installing it.

 When the new procedure is created, any necessary with clauses are added to
 it so that unqualified names will semanticize correctly.  Furthermore, a
 Links.Add operation automatically adds any links necessary to support the
 inserted with clauses.

 Because the Make_Procedure command is sensitive to the cursor's position,
 you can use the command interactively but not in a program.

 PARAMETERS

 Name : String := ">>Simple Procedure Name<<";

 Specifies the name to be given to the newly created procedure. The default
 parameter placeholder ">>Simple Procedure Name<<" must be replaced by a
 valid simple Ada name or an error will result.

 Context : String := "$";

 Specifies the context in which to create the new procedure.  The default is
 to create the procedure in the current library (the nearest library that
 is or encloses the current context).

 EXAMPLES

 Assume that you are viewing a package named Complex, which contains
 functions for constructing and operating on complex numbers. Assume
 further that you are testing various functions in the package by entering
 the following test program, which you have written in a Command window
 under the package (the expanded Command window is shown):

    declare
        use Editor, Ada, Common, Debug;
        Num : Complex.Number := Complex.Make (1.0, 2.0);
    begin
        Num := Complex.Plus (Num, Num);
        Io.Put ("The real part is ");
        Io.Put (Complex.Real_Part (Num));
        Io.Put ("The imaginary part is ");
        Io.Put (Complex.Imag_Part (Num));

 You now decide to save this program so you can retest at a later date. To
 do this, put the cursor in the Command window containing the test program
 and create a second Command window beneath it. Then enter a command such
 as the following in the new Command window:

    Command.Make_Procedure (Name => Plus_Test);

 As a result of this command, an Ada procedure named Plus_Test is created
 in the same library that contains package Complex. As shown below, a with
 clause is added for package Complex and for each package referenced in the
 use clause. The comments to the right of the with clauses indicate the
 units to which links have automatically been created.

    with Editor;                -- !COMMANDS.EDITOR
    with Library;               -- !COMMANDS.LIBRARY
    with Common;                -- !COMMANDS.COMMON
    with Complex;               -- !PROGRAMS.UTILITIES.COMPLEX

    procedure Plus_Test is
        use Editor, Library, Common, Debug;
        Num : Complex.Number := Complex.Make (1.0, 2.0);
    begin
        Num := Complex.Plus (Num, Num);
        Io.Put ("The real part is ");
        Io.Put (Complex.Real_Part (Num));
        Io.Put ("The imaginary part is ");
        Io.Put (Complex.Imag_Part (Num));
    end Plus_Test