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 - metrics - download
Index: T V

⟦fb4bb4af9⟧ TextFile

    Length: 16444 (0x403c)
    Types: TextFile
    Names: »V«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

with Parserdeclarations;
with Lists;
with User_Interface;
use User_Interface;
package Source_Instrumenter_Utilities is
    --| Utilities for Source Instrumenter


    --| Overview

    --| This package contains all the utility subprograms for the source
    --| instrumenter called from Parser.Parse and Parser.Apply_Actions.  Each
    --| utility is described in detail below in its specification.

    package Pd renames Parserdeclarations;

    package Comment_Lists is new Lists (Pd.Parsestackelement);

    Comment_Buffer : Comment_Lists.List;
    --| List of comments in between two tokens

    type Pop_To_Where is (To_Output, To_Nowhere);
    --| Used in popping closing identifiers/designators

    type Add_Breakpoint_Type is
       (Every_Statement, Decision_Point, Always, Ambiguous);

    type Resolve_Breakpoint_Type is
       (Simple_Statement, Loop_No_Identifier, Loop_With_Identifier,
        Block_No_Identifier, Block_With_Identifier);
    type Scope_Type is (Package_Specification, Package_Body,
                        Task_Body, Subprogram_Body, A_Block);

    type Identifier_Mode is (Read_Only, Write_Only, Read_Write, None);

    type Identifier_List_Type is
       (Object_List, Record_Field_List, Discriminant_List, Parameter_List,
        Renaming_List, Exception_List, Generic_Object_List);

    type Type_Class is (Derived_Type, Enumeration_Type,
                        Integer_Type, Float_Type, Fixed_Type,
                        Access_Type, Array_Type, Record_Type,
                        Limited_Private_Type, Private_Type, Task_Type);

    Do_Type_Tracing : Boolean;
    Current_Trace_Mode : Trace_Modes;


    -----------------------------------------------------------------
    --| Procedures for output formatting
    -----------------------------------------------------------------

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

    procedure Initialize;  --| Initializes the utilities

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

    procedure Put ( --| Puts the token in the buffer or in the output file
                   Next_Token : in out Pd.Parsestackelement);
    --| Token that was just pushed on parse stack

    --| Effects

    --| Put examines the Buffering flag in
    --| Pretty_Printer_Declarations to see whether buffering is turned on.
    --| If buffering is turned on, the token is placed in the buffer; if not,
    --| Print_Token is called to print the token.

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

    procedure Put_Space (Spaces : in Natural := 1);
    --| Puts a space in the output file.

    --| Effects

    --| Paginated Output is used to put a space in the output file.  The
    --| current column information is also updated.

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

    procedure Print_Comments (Buffer : in out Comment_Lists.List);
    --| Outputs buffered comments

    --| Effects

    --| If comment formatting is off, comments are output at the same
    --| line and column position as they appeared in the source.  If this
    --| is not possible, the comment is positioned at the next line and the
    --| source column.  If comment formatting is on, comments in the
    --| declarative parts are printed alongside declarations; comments in
    --| the body are preceded by a blank line and indented to the level of
    --| the source if possible.  If a comment cannot be indented to the level
    --| of the source, it is handled the same way as comments with comment
    --| formatting off.

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

    procedure New_Line;  --| Requests a new line in the buffer or output

    --| Effects

    --| New_Line examines the Buffering flag in Pretty_Printer_Declarations
    --| to see whether buffering is turned on, and requests a new line
    --| in the buffer or the output.

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

    procedure Start_Buffering_Colon_Declarations;
    --| Starts buffering colon declarations

    --| Effects

    --| Starts buffering the colon declarations or other constructs
    --| containing colons.

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

    procedure Print_Colon_Declarations_Buffer;
    --| Writes the colon declarations buffer to the output file

    --| Effects

    --| Writes the contents of the buffer to the output file,
    --| after lining up the colons.

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

    procedure Increase_Indent;  --| Increases indent

    --| Effects

    --| Requests an increase of the indent by PPD.Indentation_Level.

    --| Requires

    --| It is expected that New_Line will be called with each call to
    --| Increase_Indent, in order to keep the Current_Column information
    --| up to date.

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

    procedure Decrease_Indent;  --| Decreases indent

    --| Effects

    --| Requests a decrease of the indent by PPD.Indentation_Level.

    --| Requires

    --| It is expected that New_Line will have been called before each call to
    --| Increase_Indent, in order to keep the Current_Column information
    --| up to date.

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

    procedure Change_Indent;  --| Changes the indent

    --| Effects

    --| Requests a change in  the indent by an amount other than
    --| PPD.Indentation_Level.  Indent is changed to the current column.
    --| This procedure is used to line up parameter lists or discriminant
    --| specification lists.

    --| Requires

    --| This pair of procedures (Change_Indent, Resume_Normal_Indentation)
    --| are expected to be called without any intervening Increase_Indent
    --| or Decrease_Indent calls.

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

    procedure Resume_Normal_Indentation;  --| Changes the indent back

    --| Effects

    --| Changes the indent back to what it was before Change_Indent was
    --| called.

    --| Requires

    --| This pair of procedures (Change_Indent, Resume_Normal_Indentation)
    --| are expected to be called without any intervening Increase_Indent
    --| or Decrease_Indent calls.

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

    procedure Pop_Identifier (Where : in Pop_To_Where := To_Nowhere);

    --| Effects

    --| Pops an identifier off the stack of identifiers/designators.  Stack is
    --| used for keeping track of beginning and closing identifiers/designators
    --| so that default closing identifiers/designators can be output.

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

    procedure Push_Identifier;

    --| Effects

    --| Pushes an identifier/designator on the identifier stack, which is used
    --| for keeping track of beginning and closing identifiers/designators, so
    --| that default closing identifiers can be filled in.

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

    procedure Push_Empty_Token;

    --| Effects

    --| Pushes the empty token on the stack of beginning/closing
    --| identifiers/designators.  This procedure exists to handle loop and
    --| block identifiers which are optional at both the beginning and end
    --| of the block.  If the identifier is left off, the empty
    --| empty token is pushed as the loop or block identifer in order
    --| to synchronize the stack when it is automatically popped at
    --| the end of a loop or block.

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

    procedure Insert_In_Token;

    --| Effects

    --| Inserts the token "in" into the output.  Called when subprogram
    --| specification with default parameters is found in the source.

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

    procedure Switch_Comment_Context;

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


    -----------------------------------------------------------------
    --| Procedures for source instrumenting
    -----------------------------------------------------------------


    procedure Use_Package_Name;

    --| Effects

    --| The current expanded name is the package name in the
    --| use clause.  Turn off the Saving_Expanded_Name flag.

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

    procedure With_Library_Unit;

    --| Effects

    --| The current saved token is the name of a library unit
    --| in a with clause.  If Type_Tracing is on, then add its
    --| name to the with_list.

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

    procedure Start_Saving_Expanded_Name;

    --| Effects

    --| Turn on the Saving_Expanded_Name flag to start saving
    --| tokens for an expanded name.

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

    procedure Save_Separate_Name;

    --| Effects

    --| The current expanded name is the name of the parent unit.
    --| Turn off the Saving_Expanded_Name flag.

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

    procedure Save_Generic_Name;

    --| Effects

    --| The current expanded name is the generic unit name.
    --| Turn off the Saving_Expanded_Name flag.

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

    procedure Subprogram_Type (Intype : in String);

    --| Effects

    --| This is called by apply_actions when it is known whether
    --| the current subprogram is a procedure or function.

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

    procedure Start_Begin_End_Block;

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

    procedure End_Block_Sequence_Of_Statements;

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

    procedure Add_Breakpoint (Type_Of_Breakpoint : in Add_Breakpoint_Type);

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

    procedure Resolve_Breakpoint (Resolve_Type : in Resolve_Breakpoint_Type);

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

    procedure Start_Loop;

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

    procedure Start_Delay_Expression;

    --| Effects

    --| Start the "Starting_Delay" function call to inform the
    --| profiler tool that the currently executing unit is
    --| about to delay for the given amount of time.

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

    procedure End_Delay_Expression;

    --| Effects

    --| End the "Starting_Delay" function call.

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

    procedure Add_Package_Body_Begin;

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

    procedure Start_Exception_Branch;

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

    procedure End_Exception_Sequence_Of_Statements;

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

    procedure Add_Others_Handler;

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

    procedure End_Block_Statement;

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

    procedure Add_Exception_Handler;

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

    procedure End_Compilation_Unit;

    --| Effects

    --| Finish processing the current compilation unit, and reset
    --| local variables in case more compilation units follow.

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

    procedure Increment_Scope (Type_Of_Scope : in Scope_Type);

    --| Effects

    --| This is called following the "is" of a program unit
    --| declaration.  Stack any information from the outer scope.
    --| If the new scope is a package specification, and
    --| Type_Tracing is on, then initialize the buffer files
    --| which will containg the information for tracing the
    --| types and variables declared in the package.

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

    procedure Decrement_Scope;

    --| Effects

    --| This is called following the "end [identifier];" of
    --| a program unit declaration.  If the program unit was
    --| a package specification, and Type_Tracing is on, then
    --| close the tracing packages.
    --| Pop any stacked information from the enclosing scope.

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

    procedure Start_Declarative_Part;

    --| Effects

    --| This is called at the start of a declarative part for
    --| a body.  If Type_Tracing is on, and then add the
    --| procedure declaration for tracing local variables.
    --| If the unit is a package body, then retrieve the
    --| declarations for tracing the private part of its
    --| specification.

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

    procedure End_Declarative_Part;

    --| Effects

    --| If Type_Tracing is on, then copy the subprogram bodies
    --| for type tracing into the instrumented source.  They were
    --| buffered until the end of the declarative part because
    --| bodies cannot be added until the "later declarative"
    --| part.  Procedure declarations for all of the bodies will
    --| have already been written to the instrumented source.

    -----------------------------------------------------------------
    procedure Add_Identifier_To_List;

    --| Effects

    --| If Type_Tracing is on, then add the current identifier
    --| to the identifier list.

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

    procedure Set_Identifier_Mode (Mode : in Identifier_Mode);

    --| Effects

    --| This procedure is called when the mode of current
    --| identifier list is known.  The type of the list is
    --| not known yet, so save the mode.
    --| The modes are:
    --|   READ_ONLY  :  IN parameters and constants
    --|   WRITE_ONLY : OUT parameters
    --|   READ_WRITE : IN OUT parameters and variables
    --|   NONE       : task type varaibles, exception identifiers

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

    procedure Process_Identifier_List (List_Type : in Identifier_List_Type);

    --| Effects

    --| This is called at the end of the current identifier list.
    --| Update the mode and type for all identifiers in the list,
    --| and save the list for later processing, depending on the
    --| List_Type.

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

    procedure Save_Type_Identifier;

    --| Effects

    --| The current identifier is the name of the type in
    --| a type declaration.  Save it for later use.

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

    procedure Start_Trace_Procedure (Type_Kind : in Type_Class);

    --| Effects

    --| If type tracing is on, then start generating a
    --| procedure to trace the current type declaration.

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

    procedure End_Type_Declaration;

    --| Effects

    --| Finish the procedure to trace the current type
    --| declaration, and add the corresponding procedure
    --| declaration to the instrumented source.

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

    procedure Start_Anonymous_Array_Definition;

    --| Effects

    --| These procedures are currently not implemented, and just
    --| discard the current identifier list.  It is intended that
    --| they will create a named type so a tracing procedure
    --| can be generated to trace the anonymous variables.

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

    procedure End_Typemark;

    --| Effects

    --| The current expanded name is a typemark name, (before
    --| any constraints which may follow).  Turn off the
    --| Saving_Expanded_Name flag.

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

    procedure Start_Private_Part;

    --| Effects

    --| If Type_Tracing is on, then initialize the private
    --| type tracing files.


end Source_Instrumenter_Utilities;