fpm_environment Module

This module contains procedures that interact with the programming environment.

  • [get_os_type] – Determine the OS type
  • [get_env] – return the value of an environment variable


Contents


Variables

TypeVisibility AttributesNameInitial
integer, public, parameter:: OS_CYGWIN =4
integer, public, parameter:: OS_FREEBSD =6
integer, public, parameter:: OS_LINUX =1
integer, public, parameter:: OS_MACOS =2
integer, public, parameter:: OS_OPENBSD =7
integer, public, parameter:: OS_SOLARIS =5
integer, public, parameter:: OS_UNKNOWN =0
integer, public, parameter:: OS_WINDOWS =3

Functions

public function get_command_arguments_quoted() result(args)

Arguments

None

Return Value character(len=:), allocatable

public function get_env(NAME, DEFAULT) result(VALUE)

get named environment variable value. It it is blank or not set return the optional default value !print , NAME, ” is not defined in the environment. Strange…” !print , “This processor doesn’t support environment variables. Boooh!”

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: NAME

name of environment variable to get the value of

character(len=*), intent(in), optional :: DEFAULT

default value to return if the requested value is undefined or blank

Return Value character(len=:), allocatable

the returned value

public function get_os_type() result(r)

Determine the OS type

Read more…

Arguments

None

Return Value integer

public function os_is_unix(os) result(unix)

Compare the output of get_os_type or the optional passed INTEGER value to the value for OS_WINDOWS and return .TRUE. if they match and .FALSE. otherwise

Arguments

Type IntentOptional AttributesName
integer, intent(in), optional :: os

Return Value logical

public function separator() result(sep)

sample usage

Read more…

Arguments

None

Return Value character(len=1)

ifort_bug*!character(len=1),save :: sep_cache=’ ‘


Subroutines

public subroutine run(cmd, echo, exitstat)

echo command string and pass it to the system for execution

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: cmd
logical, intent(in), optional :: echo
integer, intent(out), optional :: exitstat