This subroutine takes care of the proper linebreaking in Lua-Tables.
It takes care of a proper line-continuation, depending on the optional advance_previous flag and increases the count of elements in the current table. The default is to put each entry on a new line, if it should be on the same line advance_previous = .false. has to be set.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(aot_out_type), | intent(inout) | :: | put_conf | |||
logical, | intent(in), | optional | :: | advance_previous |
subroutine aot_out_breakline(put_conf, advance_previous) type(aot_out_type), intent(inout) :: put_conf logical, optional, intent(in) :: advance_previous character(len=put_conf%indent) :: indent character :: sep logical :: loc_adv_prev indent = '' if (present(advance_previous)) then loc_adv_prev = advance_previous else loc_adv_prev = .true. end if lev_if: if (put_conf%level > 0) then if (put_conf%stack(put_conf%level) > 0) then ! Use the separator to close the previous entry. sep = ',' else ! First entry, nothing to separate yet. sep = '' end if if (loc_adv_prev) then write(put_conf%outunit, fmt='(a)') trim(sep) write(put_conf%outunit, fmt='(a)', advance='no') indent else write(put_conf%outunit, fmt='(a)', advance='no') trim(sep)//" " end if put_conf%stack(put_conf%level) = put_conf%stack(put_conf%level) + 1 else if (put_conf%level .eq. 0)then write(put_conf%outunit, fmt='(a)', advance='no') " " end if lev_if end subroutine aot_out_breakline