separate (Tracker.Report_Generator.Work_Units_Per_Ss)


procedure Calc_Size is
    ----------------------------------------------------------------------
    --|
    --|  NAME:  CALC_SIZE
    --|
    --|  OVERVIEW:
    --|    This procedure calculates the total size of a given subsystem
    --|    and the earliest and most recent verification date.
    --|
    --|  EXCEPTIONS HANDLED:
    --|    none
    --|
    --|  HISTORY:
    --|    written by   Bonnie Burkhardt   March 1985
    --|
    ----------------------------------------------------------------------

    use El_List_Pkg;

    End_List : Boolean := False;
    Ele_Ptr : Element_Pointer;

begin
    Ss_Orig_Size := 0;
    Ss_Cur_Size := 0;
    Ss_Eq_Size := 0;

    -- compute the totals for each subsystem
    Start_Walk (Ss_Ptr.Element_List);

    loop
        Walk (Ss_Ptr.Element_List, Ele_Ptr, End_List);
        exit when End_List;

        Ss_Orig_Size := Ss_Orig_Size + Ele_Ptr.Original_Size;
        Ss_Cur_Size := Ss_Cur_Size + Ele_Ptr.Current_Size;
        Ss_Eq_Size := Ss_Eq_Size + Ele_Ptr.Current_Size -
                         Ele_Ptr.Size_Done_At_Start;

        if (New_Date = Null_Date) or
           (Ele_Ptr.Date_Size_Verified > New_Date) then
            New_Date := Ele_Ptr.Date_Size_Verified;
        end if;

        if (Old_Date = Null_Date) or
           (Ele_Ptr.Date_Size_Verified < Old_Date) then
            Old_Date := Ele_Ptr.Date_Size_Verified;
        end if;
    end loop;

    -- update the grand total sizes
    Tot_Orig_Size := Tot_Orig_Size + Ss_Orig_Size;
    Tot_Cur_Size := Tot_Cur_Size + Ss_Cur_Size;
    Tot_Eq_Size := Tot_Eq_Size + Ss_Eq_Size;

    -- update the grand total oldest and most recent verification date
    if (New_Tot_Date = Null_Date) or (New_Date > New_Tot_Date) then
        New_Tot_Date := New_Date;
    end if;

    if (Old_Tot_Date = Null_Date) or (Old_Date < Old_Tot_Date) then
        Old_Tot_Date := Old_Date;
    end if;
end Calc_Size;