flibs/m_vstrplatform(n) 1.0 "flibs"

NAME

flibs/m_vstrplatform - Platform-dependent routines and features

TABLE OF CONTENTS

    TABLE OF CONTENTS
    SYNOPSIS
    DESCRIPTION
    OVERVIEW
        Dynamic or static buffer
        Pre-processing
    ROUTINES
    COPYRIGHT

SYNOPSIS

vstrplatform_system (command ?, status?)
vstrplatform_osstring() result ( currentos )
vstrplatform_platformstring() result ( currentplatform )
vstrplatform_getenvvar(envvar) result ( value )
vstrplatform_getenvvar(envvar) result ( value )
vstrplatform_cd ( dirname ?, status?)
vstrplatform_cd ( dirname ?, status?)
platform_stat ( filename , statarray ?, status?)
platform_stat ( filename , statarray ?, status?)

DESCRIPTION

The m_vstrplatform module provides several routines, which take dynamic strings arguments, to interact with the operating system.

OVERVIEW

The goal of this module is to provide system access with commands which take dynamic strings as arguments. It is based on m_platform, which takes character-based arguments. In the following example, extracted from the m_vfile module included in flibs, one sets the current working directory by using vstrplatform_cd on a dynamic string variable.

 
    type ( t_vstring ) :: dirname
    integer :: status
    call vstrplatform_cd ( dirname , status )

This is a sketch of available routines :

Dynamic or static buffer

The internal algorithms provided by m_vstrplatform are based on basic fortran character strings. In several situations, the dynamic vstring has to be converted into a basic fortran character buffer string, which size has to be given explicitely in the source code, with the len = <something> statement (in the character ( len = <something>)).

The second solution is more efficient, because the strings are not oversized or undersized, depending on the real number of characters in the dynamic string. But the feature may not be provided by the compiler at hand. For example, problems with the dynamic length character string have been experienced with Intel Fortran 8.

Pre-processing

The following preprocessing macro may be defined :

ROUTINES

The module contains the following routines.

vstrplatform_system (command ?, status?)
type ( t_vstring ) :: command
integer, intent (out), optional :: status
Run an external command, optionally retrieving the status of that command. Under Windows the "call system" may generate the display of a console. If status is supplied, it contains 0 on success or nonzero error code upon return.

vstrplatform_osstring() result ( currentos )
type ( t_vstring ) :: currentos
Returns a string containing the current operating system running on the current machine, one of "Windows 95", "Windows NT", "MacOS", "SunOS", "Linux" or "Unix".

vstrplatform_platformstring() result ( currentplatform )
type ( t_vstring ) :: currentplatform
Returns a string containing the current platform running on the current machine, one of "Windows", "Mac", "Unix".

vstrplatform_getenvvar(envvar) result ( value )
type ( t_vstring ), intent(in) :: envvar
type ( t_vstring ) :: value
Returns the value of the environment variable envvar.

vstrplatform_getenvvar(envvar) result ( value )
character(len=*), intent(in) :: envvar
type ( t_vstring ) :: value
Same as previous with character(len=*) dirname.

vstrplatform_cd ( dirname ?, status?)
type(t_vstring), intent(in) :: dirname
integer, intent(out) , optional :: status
Change working directory to dirname. If status is supplied, it contains 0 on success or nonzero error code upon return

vstrplatform_cd ( dirname ?, status?)
character(len=*), intent(in) :: dirname
integer, intent(out) , optional :: status
Same as previous with character(len=*) dirname.

platform_stat ( filename , statarray ?, status?)
type(t_vstring), intent(in) :: filename
integer, dimension (1:13) , intent(out) :: filename
integer, intent(out) , optional :: status
Get status of the file filename and fills the array statarray with the following content.

If status is supplied, it contains 0 on success or nonzero error code upon return

platform_stat ( filename , statarray ?, status?)
character(len=*), intent(in) :: filename
integer, dimension (1:13) , intent(out) :: filename
integer, intent(out) , optional :: status
Same as previous with character(len=*) dirname.

COPYRIGHT

Copyright © 2008 Arjen Markus <arjenmarkus@sourceforge.net>
Copyright © 2008 Michael Baudin <michael.baudin@gmail.com>