From 6aba40db1385007e0bf4e9c2b9b4afe8bb105593 Mon Sep 17 00:00:00 2001 From: Laurence Kedward Date: Sun, 28 Nov 2021 11:24:41 +0000 Subject: Apply suggestion: don't use TBP for new constructors --- src/fpm_backend_console.f90 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/fpm_backend_console.f90') diff --git a/src/fpm_backend_console.f90 b/src/fpm_backend_console.f90 index 4422037..73bcd5d 100644 --- a/src/fpm_backend_console.f90 +++ b/src/fpm_backend_console.f90 @@ -30,22 +30,25 @@ type console_t !> Escape code for moving down one line character(:), allocatable :: LINE_DOWN contains - !> Initialise the console object - procedure :: init => console_init !> Write a single line to the console procedure :: write_line => console_write_line !> Update a previously-written console line procedure :: update_line => console_update_line end type console_t +!> Constructor for console_t +interface console_t + procedure :: new_console +end interface console_t + contains -!> Initialise the console object -subroutine console_init(console,plain_mode) - !> Console object to initialise - class(console_t), intent(out), target :: console +!> Initialise a new console object +function new_console(plain_mode) result(console) !> 'Plain' output (no escape codes) logical, intent(in), optional :: plain_mode + !> Console object to initialise + type(console_t) :: console if (present(plain_mode)) then console%plain_mode = plain_mode @@ -61,12 +64,12 @@ subroutine console_init(console,plain_mode) console%LINE_DOWN = ESC//"[1B" end if -end subroutine console_init +end function new_console !> Write a single line to the standard output subroutine console_write_line(console,str,line,advance) !> Console object - class(console_t), intent(inout), target :: console + class(console_t), intent(inout) :: console !> String to write character(*), intent(in) :: str !> Integer needed to later update console line -- cgit v1.2.3