stdio_m Module

This file renames the ISO input/output units to the standard UNIX names, defines the ANSI escape codes for colored output, and defines a number of auxiliary subroutines for e.g. writing out error and warning messages.



Variables

Type Visibility Attributes Name Initial
integer, public :: stdin = input_unit
integer, public :: stdout = output_unit
integer, public :: stderr = error_unit
character(len=*), public, parameter :: color_none = ''
character(len=*), public, parameter :: color_red = ''
character(len=*), public, parameter :: color_green = ''
character(len=*), public, parameter :: color_yellow = ''
character(len=*), public, parameter :: color_blue = ''
character(len=*), public, parameter :: color_purple = ''
character(len=*), public, parameter :: color_cyan = ''
character(len=*), public, parameter :: color_white = ''

Interfaces

public interface dump

  • public subroutine dump_arrays(filename, arrays, header)

    Dump numerical arrays to an output file.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: filename
    real(kind=real64), intent(in), dimension(:) :: arrays
    character(len=*), intent(in), dimension(:) :: header
  • public subroutine dump_scalar(filename, scalar)

    Dump a numerical result to an output file.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: filename
    real(kind=real64), intent(in) :: scalar

Functions

public function input(file) result(unit)

Open an input file for reading.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file

Return Value integer

public function output(file) result(unit)

Open an output file for writing.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file

Return Value integer


Subroutines

public subroutine message(msg)

Provides a way to report a status message.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: msg

public subroutine warning(msg)

Provides a way to report a warning message.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: msg

public subroutine error(msg)

Provides a way to report an error message and halt the program.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: msg

public subroutine status_head(title)

Provides a way to write boxed status messages to standard out; in particular, this routine writes out a boxed title with a timestamp.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: title

public subroutine status_body(title, value)

Provides a way to write boxed status messages to standard out; in particular, this routine writes out the name and value of a variable.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: title
class(*), intent(in) :: value

public subroutine status_foot()

Provides a way to write boxed status messages to standard out; in particular, this routine writes out the bottom edge of such a box.

Arguments

None

public subroutine status_box(title)

Provides a way to write boxed status messages to standard out.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: title

public subroutine dump_arrays(filename, arrays, header)

Dump numerical arrays to an output file.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
real(kind=real64), intent(in), dimension(:) :: arrays
character(len=*), intent(in), dimension(:) :: header

public subroutine dump_scalar(filename, scalar)

Dump a numerical result to an output file.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
real(kind=real64), intent(in) :: scalar