fdoc

subroutinebar_textpure

pure subroutine bar_text(steps, size, width, filled, unfilled, percent)

The bar for steps of size steps, width characters wide, with its filled and empty parts.

Arguments

NameTypeIntentAttributesDescription
stepsintegerin

how many steps are done

sizeintegerin

how many there are

widthintegerin

the width of the bar

filledintegerout

how much of the bar is filled

unfilledintegerout

how much of it is not

percentintegerout

the percentage done

Source

Show the code
pure subroutine bar_text(steps, size, width, filled, unfilled, percent)
    integer, intent(in) :: steps        !! how many steps are done
    integer, intent(in) :: size         !! how many there are
    integer, intent(in) :: width        !! the width of the bar
    integer, intent(out) :: filled      !! how much of the bar is filled
    integer, intent(out) :: unfilled    !! how much of it is not
    integer, intent(out) :: percent     !! the percentage done

    filled = width
    percent = 100
    if (size > 0) then
        filled = int(min(1.0, real(steps)/real(size))*width)
        percent = int(min(1.0, real(steps)/real(size))*100)
    end if
    unfilled = width - filled
end subroutine bar_text

Graphs

Called by