subroutinerank_labelprivate
subroutine rank_label(text, rank, in_columns, tied, relative, offset, label)
The text of type text with its rank. A rank in columns is left out, and a tied one is relative.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the type | |
| rank | integer | in | the rank | |
| in_columns | logical | in | true if the columns of the table show the rank | |
| tied | logical | in | true if it is a fixed distance from the columns | |
| relative | character(len=*) | in | the rank of the columns, as text | |
| offset | integer | in | that distance | |
| label | character(len=:) | out | allocatable | the result |
Calls
Source
Show the code
subroutine rank_label(text, rank, in_columns, tied, relative, offset, label)
character(len=*), intent(in) :: text !! the type
integer, intent(in) :: rank !! the rank
logical, intent(in) :: in_columns !! true if the columns of the table show the rank
logical, intent(in) :: tied !! true if it is a fixed distance from the columns
character(len=*), intent(in) :: relative !! the rank of the columns, as text
integer, intent(in) :: offset !! that distance
character(len=:), allocatable, intent(out) :: label !! the result
type(buffer_t) :: b
call add(b, text)
if (rank == ANY_RANK) then
call add(b, ', any rank')
else if (in_columns) then
continue
else if (tied) then
call add(b, ', '//relative)
if (offset > 0) call add(b, ' + '//trim(int_text(offset)))
if (offset < 0) call add(b, ' - '//trim(int_text(-offset)))
else if (rank > 0) then
call add(b, ', rank '//trim(int_text(rank)))
end if
call take(b, label)
end subroutine rank_label