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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| steps | integer | in | how many steps are done | |
| size | integer | in | how many there are | |
| width | integer | in | the width of the bar | |
| filled | integer | out | how much of the bar is filled | |
| unfilled | integer | out | how much of it is not | |
| percent | integer | out | 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