platform_config_t Derived Type

type, public, extends(serializable_t) :: platform_config_t

Serializable platform configuration (compiler + OS only)


Components

Type Visibility Attributes Name Initial
integer(kind=compiler_enum), public :: compiler = id_all
integer, public :: os_type = OS_ALL

Constructor

public interface platform_config_t

  • private function new_platform(compiler, os_type)

    Initialize a new platform config from compiler name Automatically selects correct Intel compiler version based on OS

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: compiler
    integer, intent(in) :: os_type

    Return Value type(platform_config_t)

  • private function new_platform_id(compiler_id, os_type)

    Initialize a new platform config from compiler enum ID
    Automatically selects correct Intel compiler version based on OS

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=compiler_enum), intent(in) :: compiler_id
    integer, intent(in) :: os_type

    Return Value type(platform_config_t)


Type-Bound Procedures

procedure, public, non_overridable :: any_compiler

Properties

  • private elemental function any_compiler(self)

    Whether the configuration is generic

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value logical

procedure, public, non_overridable :: any_os

  • private elemental function any_os(self)

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value logical

procedure, public, non_overridable :: any_platform

  • private elemental function any_platform(self)

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value logical

procedure, public :: compiler_name => platform_compiler_name

Get compiler name as string

  • private function platform_compiler_name(self) result(name)

    Get compiler name as string

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value character(len=:), allocatable

generic, public :: dump => dump_to_toml, dump_to_file, dump_to_unit

  • private subroutine srcfile_dump_to_toml(self, table, error)

    Dump dependency to toml table

    Arguments

    Type IntentOptional Attributes Name
    class(srcfile_t), intent(inout) :: self

    Instance of the serializable object

    type(toml_table), intent(inout) :: table

    Data structure

    type(error_t), intent(out), allocatable :: error

    Error handling

  • private subroutine dump_to_file(self, file, error, json)

    Write serializable object to file

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    character(len=*), intent(in) :: file

    File name

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format

  • private subroutine dump_to_unit(self, unit, error, json)

    Write serializable object to a formatted Fortran unit

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    integer, intent(in) :: unit

    Formatted unit

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format requested?

procedure, public :: dump_to_toml

  • private subroutine dump_to_toml(self, table, error)

    Dump to TOML table

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(inout) :: self
    type(toml_table), intent(inout) :: table
    type(error_t), intent(out), allocatable :: error

procedure, public :: info

Print information

  • private subroutine info(self, unit, verbosity)

    Write information on instance (similar style to profile_config_t%info)

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self
    integer, intent(in) :: unit
    integer, intent(in), optional :: verbosity

procedure, public :: is_valid => platform_is_valid

Validation

  • private function platform_is_valid(self) result(valid)

    Check if a platform configuration is valid (no unknowns, compatible compiler+OS)

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value logical

generic, public :: load => load_from_toml, load_from_file, load_from_unit

  • private subroutine srcfile_load_from_toml(self, table, error)

    Read dependency from toml table (no checks made at this stage)

    Arguments

    Type IntentOptional Attributes Name
    class(srcfile_t), intent(inout) :: self

    Instance of the serializable object

    type(toml_table), intent(inout) :: table

    Data structure

    type(error_t), intent(out), allocatable :: error

    Error handling

  • private subroutine load_from_file(self, file, error, json)

    Read dependency tree from file

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    character(len=*), intent(in) :: file

    File name

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format

  • private subroutine load_from_unit(self, unit, error, json)

    Read dependency tree from file init JSON interpreter Read object from TOML table

    use default TOML parser

    Read object from TOML table

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self

    Instance of the dependency tree

    integer, intent(in) :: unit

    File name

    type(error_t), intent(out), allocatable :: error

    Error handling

    logical, intent(in), optional :: json

    Optional JSON format

procedure, public :: load_from_toml

  • private subroutine load_from_toml(self, table, error)

    Load from TOML table

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(inout) :: self
    type(toml_table), intent(inout) :: table
    type(error_t), intent(out), allocatable :: error

procedure, public :: matches => platform_is_suitable

Return .true. if THIS platform selector is compatible with CURRENT (wildcards allowed)

  • private function platform_is_suitable(self, target) result(ok)

    Return .true. if SELF is suitable for a given target platform

    Rules: - compiler matches if SELF%compiler == id_all OR == target%compiler - os matches if SELF%os_type == OS_ALL OR == target%os_type - id_unknown / OS_UNKNOWN in SELF are treated as “no match” (conservative) - Intel compilers must match OS (ifort unix/windows versions use different flags)

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self
    type(platform_config_t), intent(in) :: target

    Return Value logical

procedure, public :: name => platform_config_name

Get configuration name as it appears in the manifest

  • private function platform_config_name(self) result(name)

    Get configuration name

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value character(len=:), allocatable

generic, public :: operator(==) => serializable_is_same

  • private function srcfile_is_same(this, that)

    Check that two source files are equal All checks passed!

    Arguments

    Type IntentOptional Attributes Name
    class(srcfile_t), intent(in) :: this
    class(serializable_t), intent(in) :: that

    Return Value logical

procedure, public :: os_name => platform_os_name

Get OS name as string

  • private function platform_os_name(self) result(name)

    Get OS name as string

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: self

    Return Value character(len=:), allocatable

procedure, public :: serializable_is_same => platform_is_same

  • private function platform_is_same(this, that)

    Compare two platform_config_t (semantic equality)

    Arguments

    Type IntentOptional Attributes Name
    class(platform_config_t), intent(in) :: this
    class(serializable_t), intent(in) :: that

    Return Value logical

procedure, public, non_overridable :: test_serialization

Test load/write roundtrip

  • private subroutine test_serialization(self, message, error)

    Test serialization of a serializable object Dump to scratch file Load from scratch file Check same

    Arguments

    Type IntentOptional Attributes Name
    class(serializable_t), intent(inout) :: self
    character(len=*), intent(in) :: message
    type(error_t), intent(out), allocatable :: error

Source Code

    type, extends(serializable_t) :: platform_config_t
        
        integer(compiler_enum) :: compiler = id_all
        integer                :: os_type  = OS_ALL
        
    contains
    
        procedure :: serializable_is_same => platform_is_same
        procedure :: dump_to_toml
        procedure :: load_from_toml
                
        !> Print information
        procedure :: info
        
        !> Return .true. if THIS platform selector is compatible with CURRENT (wildcards allowed)
        procedure :: matches => platform_is_suitable        
        
        !> Get compiler name as string
        procedure :: compiler_name => platform_compiler_name
        
        !> Get OS name as string  
        procedure :: os_name => platform_os_name
        
        !> Get configuration name as it appears in the manifest
        procedure :: name => platform_config_name
        
        !> Validation
        procedure :: is_valid => platform_is_valid
        
        !> Properties
        procedure, non_overridable :: any_compiler
        procedure, non_overridable :: any_os
        procedure, non_overridable :: any_platform
        
    end type platform_config_t