From 37ba9d7cf61d6b9ddbfe59a4456311fda62ef101 Mon Sep 17 00:00:00 2001 From: Laurence Kedward Date: Fri, 26 Nov 2021 17:32:07 +0000 Subject: Simplify implementation and cleanup plain mode output --- src/fpm_backend_console.f90 | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/fpm_backend_console.f90') diff --git a/src/fpm_backend_console.f90 b/src/fpm_backend_console.f90 index 4db0cdc..7daff14 100644 --- a/src/fpm_backend_console.f90 +++ b/src/fpm_backend_console.f90 @@ -41,20 +41,36 @@ subroutine console_init(console,plain_mode) end subroutine console_init -function console_write_line(console,str) result(line) +subroutine console_write_line(console,str,line,advance) class(console_t), intent(inout), target :: console character(*), intent(in) :: str - integer :: line + integer, intent(out), optional :: line + logical, intent(in), optional :: advance + + character(3) :: adv + + adv = "yes" + if (present(advance)) then + if (.not.advance) then + adv = "no" + end if + end if !$omp critical - line = console%n_line - write(stdout,*) console%LINE_RESET//str + if (present(line)) then + line = console%n_line + end if + + write(stdout,'(A)',advance=trim(adv)) console%LINE_RESET//str + + if (adv=="yes") then + console%n_line = console%n_line + 1 + end if - console%n_line = console%n_line + 1 !$omp end critical -end function console_write_line +end subroutine console_write_line subroutine console_update_line(console,line_no,str) class(console_t), intent(in) :: console -- cgit v1.2.3