with String_Pkg;
use String_Pkg;
with Type_Definitions;
use Type_Definitions;

package Create_Breakpoint is

    --| Overview
    --|
    --| This package is used to insert calls into the source.  It maintains
    --| a scope stack to maintain the current scope.  The create procedures
    --| are used to do the actual insertion of code.  The other procedures
    --| are used to tell this package when programs are started and ended

    Breakpoint_Printed_Last : Boolean;  -- Used to prevent two consecutive
    -- breakpoints

    Breakpoint_Number_For_Printing : String (1 .. 6) := "      ";
    -- breakpoint number in string
    -- format for printing in
    -- listing file

    procedure New_Compilation_Unit (Unit_Name : in Current_Unit_Name;
                                    Type_Of_Unit : in Program_Unit_Type);

    --| Effects
    --|
    --| This procedure is used to define a new compilation unit.
    --| Each time a new compilation unit is entered, this procedure
    --| is called.  Any information about a previous compilation unit
    --| is cleared and the new compilation unit becomes the current
    --| compilation unit.

    procedure Start_Program_Unit (Unit_Name : in Current_Unit_Name;
                                  Type_Of_Unit : in Program_Unit_Type);

    --| Effects
    --|
    --| This procedure is used to define a new program unit.  Each time a new
    --| program unit is entered, this procedure is called.  The procedure
    --| name and type are used in constructing entering/exiting units and
    --| breakpoints.  The procedure is also added to the list of procedures
    --| for the current compilation unit.

    procedure Create_Entering_Unit;

    --| Effects
    --|
    --| This procedure is called whenever an entering_unit procedure
    --| call needs to be added to the instrumented source.  The information
    --| about the current compilation unit and current program unit are used
    --| to construct the Entering_Unit procedure call.

    procedure Create_Exiting_Unit;

    --| Effects
    --|
    --| This procedure creates an exiting unit call for the current program
    --| unit.  This unit will be called before each return statement, at
    --| the end of the program unit, and at the end of each exception
    --| handler.

    procedure End_Program_Unit;

    --| Effects
    --|
    --| This procedure tells when a program unit has ended.  The current
    --| unit is set to the enclosing scope (if there is one).  All future
    --| calls to the create procedures will use this new unit.

    procedure Create_Breakpoint (Type_Of_Breakpoint : in Breakpoint_Types;
                                 Putvars_To_Call : in Ada_Name);

    --| Effects
    --|
    --| This procedure is called each time a breakpoint needs to be added.
    --| This procedure may be called at the same point in the source, so a
    --| flag is maintained to tell when the last line output was a breakpoint.
    --| If it was, then another breakpoint is added.  This flag is reset in
    --| Source_Instrumenter_Utilities each time a new line of user code
    --| is output.

    procedure Create_Unit_Information;

    --| Effects
    --|
    --| This procedure is called when a Unit_Information procedure call
    --| needs to be added to the source.  This procedure uses the current
    --| compilation unit and the list of procedures defined for that unit.

    --| Requires
    --|
    --| This procedure must be the last one called for a compilation unit.

    function Get_Program_Unit return String_Type;

    --| Effects
    --|
    --| This procedure return a String_type containing the current
    --| Program unit identifier.  This can be used for printing the
    --| Current Program unit for calls to the RTM

end Create_Breakpoint;