diff options
author | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-11-28 11:24:41 +0000 |
---|---|---|
committer | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-11-29 11:56:02 +0000 |
commit | 6aba40db1385007e0bf4e9c2b9b4afe8bb105593 (patch) | |
tree | 54836c2be079d9ace9719f10251fc1c00a301cd7 /src/fpm_backend_console.f90 | |
parent | 4556e7a4435c6ef2da8782c033229e06e91b6a4e (diff) | |
download | fpm-6aba40db1385007e0bf4e9c2b9b4afe8bb105593.tar.gz fpm-6aba40db1385007e0bf4e9c2b9b4afe8bb105593.zip |
Apply suggestion: don't use TBP for new constructors
Diffstat (limited to 'src/fpm_backend_console.f90')
-rw-r--r-- | src/fpm_backend_console.f90 | 19 |
1 files changed, 11 insertions, 8 deletions
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
|