M_CLI2
M_CLI2 module (Fortran)
Private Member Functions | List of all members
m_cli2::str Interface Reference

Private Member Functions

character(len=:) function, allocatable msg_scalar (generic0, generic1, generic2, generic3, generic4, generic5, generic6, generic7, generic8, generic9, generica, genericb, genericc, genericd, generice, genericf, genericg, generich, generici, genericj, sep)
 
character(len=:) function, allocatable msg_one (generic0, generic1, generic2, generic3, generic4, generic5, generic6, generic7, generic8, generic9, sep)
 

Member Function/Subroutine Documentation

◆ msg_one()

character(len=:) function, allocatable m_cli2::str::msg_one ( class(*), dimension(:), intent(in)  generic0,
class(*), dimension(:), intent(in), optional  generic1,
class(*), dimension(:), intent(in), optional  generic2,
class(*), dimension(:), intent(in), optional  generic3,
class(*), dimension(:), intent(in), optional  generic4,
class(*), dimension(:), intent(in), optional  generic5,
class(*), dimension(:), intent(in), optional  generic6,
class(*), dimension(:), intent(in), optional  generic7,
class(*), dimension(:), intent(in), optional  generic8,
class(*), dimension(:), intent(in), optional  generic9,
character(len=*), intent(in), optional  sep 
)
private

◆ msg_scalar()

character(len=:) function, allocatable m_cli2::str::msg_scalar ( class(*), intent(in), optional  generic0,
class(*), intent(in), optional  generic1,
class(*), intent(in), optional  generic2,
class(*), intent(in), optional  generic3,
class(*), intent(in), optional  generic4,
class(*), intent(in), optional  generic5,
class(*), intent(in), optional  generic6,
class(*), intent(in), optional  generic7,
class(*), intent(in), optional  generic8,
class(*), intent(in), optional  generic9,
class(*), intent(in), optional  generica,
class(*), intent(in), optional  genericb,
class(*), intent(in), optional  genericc,
class(*), intent(in), optional  genericd,
class(*), intent(in), optional  generice,
class(*), intent(in), optional  genericf,
class(*), intent(in), optional  genericg,
class(*), intent(in), optional  generich,
class(*), intent(in), optional  generici,
class(*), intent(in), optional  genericj,
character(len=*), intent(in), optional  sep 
)
private

NAME

str(3f) - [M_CLI2] converts any standard scalar type to a string (LICENSE:PD)

SYNOPSIS

function str(g0,g1,g2,g3,g4,g5,g6,g7,g8,g9,ga,gb,gc,gd,ge,gf,gg,gh,gi,gj,sep)

 class(*),intent(in),optional  :: g0,g1,g2,g3,g4,g5,g6,g7,g8,g9
 class(*),intent(in),optional  :: ga,gb,gc,gd,ge,gf,gg,gh,gi,gj
 character(len=*),intent(in),optional :: sep
 character,len=(:),allocatable :: str

DESCRIPTION

str(3f) builds a space-separated string from up to twenty scalar values.

OPTIONS

g[0-9a-j] optional value to print the value of after the message. May be of type INTEGER, LOGICAL, REAL, DOUBLEPRECISION, COMPLEX, or CHARACTER.

Optionally, all the generic values can be single-dimensioned arrays. Currently, mixing scalar arguments and array arguments is not supported.

sep separator to place between values. Defaults to a space.

RETURNS

str description to print

EXAMPLES

Sample program:

  program demo_msg
  use M_CLI2, only : str
  implicit none
  character(len=:),allocatable :: pr
  character(len=:),allocatable :: frmt
  integer                      :: biggest

  pr=str('HUGE(3f) integers',huge(0),'and real',huge(0.0),'and double',huge(0.0d0))
  write(*,'(a)')pr
  pr=str('real            :',huge(0.0),0.0,12345.6789,tiny(0.0) )
  write(*,'(a)')pr
  pr=str('doubleprecision :',huge(0.0d0),0.0d0,12345.6789d0,tiny(0.0d0) )
  write(*,'(a)')pr
  pr=str('complex         :',cmplx(huge(0.0),tiny(0.0)) )
  write(*,'(a)')pr

  ! create a format on the fly
  biggest=huge(0)
  frmt=str('(*(i',int(log10(real(biggest))),':,1x))',sep=' ')
  write(*,*)'format=',frmt

  ! although it will often work, using str(3f) in an I/O statement is not recommended
  ! because if an error occurs str(3f) will try to write while part of an I/O statement
  ! which not all compilers can handle and is currently non-standard
  write(*,*)str('program will now stop')

  end program demo_msg

Output

HUGE(3f) integers 2147483647 and real 3.40282347E+38 and double 1.7976931348623157E+308 real : 3.40282347E+38 0.00000000 12345.6787 1.17549435E-38 doubleprecision : 1.7976931348623157E+308 0.0000000000000000 12345.678900000001 2.2250738585072014E-308 complex : (3.40282347E+38,1.17549435E-38) format=(*(i9:,1x)) program will now stop

AUTHOR

John S. Urban

LICENSE

Public Domain


The documentation for this interface was generated from the following file: