separate (Compilation_Unit.Produce_Metrics)
task body Mccabe_State_Machine is
    --=============================================================
    -- This task body gives the user the ability to either modify =
    -- or find out the present state of McCabe's abstract         =
    -- state machine. Accept statements are provided to change the=
    -- present state by adding a delta value (the delta value     =
    -- supplied an a paramenter can be positive or negative) to   =
    -- the object stored in the body. A user may find out the     =
    -- present state of the machine with a rendezvous with the    =
    -- Get_Cyclomatic_Complexity accept statement.                =
    --                                                            =
    --  written by GER with help from Brad and JM                 =
    --=============================================================

    Current_Pi_Count : Mccabe_Predicates.Count := 0;
    -- McCabe's current count of decision points

    Current_Cyclomatic_Complexity_Count : Mccabe_Vg.Number := 1;
    -- McCabe's current count of v(G) for this compilation unit

    Delta_Pi : Integer; --**
    -- The delta value to add to the present state of McCabe's
    -- cyclomatic complexity number

begin
    -- McCabe_State_Machine

    Calculate_And_Get:
        loop

            select
                -- Modify the present value of PI

                accept Change_Pi (The_Amount_To_Change : in Integer := 1) do
                    Delta_Pi := The_Amount_To_Change;
                end Change_Pi;

                Mccabe_Predicates.Change
                   (Pi => Current_Pi_Count, With_Delta => Delta_Pi);

            or
                -- Calculate McCabe's cyclomatic complexity

                accept Calculate_Vg;

                Mccabe_Vg.Of_Any_Program_Unit
                   (Pi => Current_Pi_Count,
                    Vg => Current_Cyclomatic_Complexity_Count);

            or
                -- Return the present value of PI

                accept Get_Pi (Pi : out Mccabe_Predicates.Count) do
                    Pi := Current_Pi_Count;
                end Get_Pi;

            or
                -- Return the present value of the cyclomatic complexity

                accept Get_Cyclomatic_Complexity
                          (Cyclomatic_Complexity : out Mccabe_Vg.Number) do
                    Cyclomatic_Complexity :=
                       Current_Cyclomatic_Complexity_Count;
                end Get_Cyclomatic_Complexity;

            or
                -- Terminate this task

                terminate;

            end select;

        end loop Calculate_And_Get;

end Mccabe_State_Machine;