DSO_Utilities.F90 Source File


This file depends on

sourcefile~~dso_utilities.f90~~EfferentGraph sourcefile~dso_utilities.f90 DSO_Utilities.F90 sourcefile~filesystemutilities.f90 FileSystemUtilities.F90 sourcefile~dso_utilities.f90->sourcefile~filesystemutilities.f90

Files dependent on this one

sourcefile~~dso_utilities.f90~~AfferentGraph sourcefile~dso_utilities.f90 DSO_Utilities.F90 sourcefile~maplframework.f90 MaplFramework.F90 sourcefile~maplframework.f90->sourcefile~dso_utilities.f90 sourcefile~maplshared.f90 MaplShared.F90 sourcefile~maplshared.f90->sourcefile~dso_utilities.f90 sourcefile~test_dso_utilities.pf test_DSO_Utilities.pf sourcefile~test_dso_utilities.pf->sourcefile~dso_utilities.f90 sourcefile~usersetservices.f90 UserSetServices.F90 sourcefile~usersetservices.f90->sourcefile~dso_utilities.f90 sourcefile~childspec.f90 ChildSpec.F90 sourcefile~childspec.f90->sourcefile~usersetservices.f90 sourcefile~componentdriver.f90 ComponentDriver.F90 sourcefile~componentdriver.f90->sourcefile~maplshared.f90 sourcefile~componentspecparser.f90 ComponentSpecParser.F90 sourcefile~componentspecparser.f90->sourcefile~usersetservices.f90 sourcefile~extdataroot_gridcomp.f90 ExtDataRoot_GridComp.F90 sourcefile~extdataroot_gridcomp.f90->sourcefile~maplshared.f90 sourcefile~fieldunits.f90 FieldUnits.F90 sourcefile~fieldunits.f90->sourcefile~maplshared.f90 sourcefile~generic3g.f90 Generic3g.F90 sourcefile~generic3g.f90->sourcefile~usersetservices.f90 sourcefile~genericgridcomp.f90 GenericGridComp.F90 sourcefile~genericgridcomp.f90->sourcefile~usersetservices.f90 sourcefile~mapl3g.f90 mapl3g.F90 sourcefile~mapl3g.f90->sourcefile~maplframework.f90 sourcefile~mapl_generic.f90 MAPL_Generic.F90 sourcefile~mapl_generic.f90->sourcefile~usersetservices.f90 sourcefile~mapl_generic.f90~2 MAPL_Generic.F90 sourcefile~mapl_generic.f90~2->sourcefile~maplshared.f90 sourcefile~outermetacomponent.f90 OuterMetaComponent.F90 sourcefile~outermetacomponent.f90->sourcefile~usersetservices.f90 sourcefile~protoextdatagc.f90 ProtoExtDataGC.F90 sourcefile~protoextdatagc.f90->sourcefile~usersetservices.f90 sourcefile~simpleparentgridcomp.f90 SimpleParentGridComp.F90 sourcefile~simpleparentgridcomp.f90->sourcefile~usersetservices.f90 sourcefile~test_componentspecparser.pf Test_ComponentSpecParser.pf sourcefile~test_componentspecparser.pf->sourcefile~usersetservices.f90 sourcefile~test_genericgridcomp.pf Test_GenericGridComp.pf sourcefile~test_genericgridcomp.pf->sourcefile~usersetservices.f90 sourcefile~test_runchild.pf Test_RunChild.pf sourcefile~test_runchild.pf->sourcefile~usersetservices.f90 sourcefile~test_scenarios.pf Test_Scenarios.pf sourcefile~test_scenarios.pf->sourcefile~usersetservices.f90 sourcefile~test_simpleleafgridcomp.pf Test_SimpleLeafGridComp.pf sourcefile~test_simpleleafgridcomp.pf->sourcefile~usersetservices.f90 sourcefile~test_simpleparentgridcomp.pf Test_SimpleParentGridComp.pf sourcefile~test_simpleparentgridcomp.pf->sourcefile~usersetservices.f90

Source Code

module mapl_DSO_Utilities
   use mapl_FileSystemUtilities
   implicit none

   public :: is_valid_dso_name
   public :: is_valid_dso_extension
   public :: is_supported_dso_name
   public :: is_supported_dso_extension
   public :: adjust_dso_name

   public :: SYSTEM_DSO_EXTENSION

   ! NOTE: SYSTEM_DSO_SUFFIX is a preprocessor macro set by CMake
   character(*), parameter :: SYSTEM_DSO_EXTENSION = SYSTEM_DSO_SUFFIX

contains

   pure logical function is_valid_dso_name(name)
      character(*), intent(in) :: name
      is_valid_dso_name = is_valid_dso_extension(get_file_extension(name))
   end function is_valid_dso_name

   ! An empty extension is valid, as we can supply the system-specific one.
   pure logical function is_valid_dso_extension(extension)
      character(len=*), intent(in) :: extension
      is_valid_dso_extension = (extension == '' .or. extension == SYSTEM_DSO_EXTENSION)
   end function is_valid_dso_extension

   ! We allow users to specify a DSO extensions that is only valid on
   ! some other OS.  This allows things to work on say OSX if the user
   ! puts a Linux DSO in a resource file.
   pure logical function is_supported_dso_name(name)
      character(len=*), intent(in) :: name
      is_supported_dso_name = is_supported_dso_extension(get_file_extension(name))
   end function is_supported_dso_name

   ! We allow users to specify a DSO extensions that is only valid on
   ! some other OS.  This allows things to work on say OSX if the user
   ! puts a Linux DSO in a resource file.
   pure logical function is_supported_dso_extension(extension)
      character(len=*), intent(in) :: extension
      character(len=6), dimension(*), parameter :: SUPPORTED_DSO_EXTENSIONS = [character(len=6) :: '.so','.dylib','.dll', '']
      is_supported_dso_extension = any(extension == SUPPORTED_DSO_EXTENSIONS)
   end function is_supported_dso_extension

   ! We allow users to specify DSO file names with or without the
   ! suffix.  This function creates the full name appropriate to a
   ! given system.
   pure function adjust_dso_name(guess)
      character(:), allocatable :: adjust_dso_name
      character(*), intent(in) :: guess

      adjust_dso_name = get_file_basename(guess) // SYSTEM_DSO_EXTENSION

  end function adjust_dso_name

end module mapl_DSO_Utilities