File: optional_02.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (57 lines) | stat: -rw-r--r-- 1,815 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
program optional_02
implicit none

type :: file_scope_flag
    character(len=:), allocatable :: file_name
    character(len=:), allocatable :: flags
end type file_scope_flag

type :: profile_config_t
    character(len=:), allocatable :: profile_name
    character(len=:), allocatable :: compiler
    integer :: os_type
    character(len=:), allocatable :: flags
    character(len=:), allocatable :: c_flags
    character(len=:), allocatable :: cxx_flags
    character(len=:), allocatable :: link_time_flags
    type(file_scope_flag), allocatable :: file_scope_flags(:)
    logical :: is_built_in
end type profile_config_t

type :: error_t
    character(len=:), allocatable :: message
end type error_t

integer, parameter :: OS_ALL = -1

contains

function new_profile(profile_name, compiler, os_type, flags, c_flags, cxx_flags, &
                     link_time_flags, file_scope_flags, is_built_in) result(profile)

character(len=*), intent(in) :: profile_name
character(len=*), intent(in) :: compiler
integer, intent(in) :: os_type
character(len=*), optional, intent(in) :: flags
character(len=*), optional, intent(in) :: c_flags
character(len=*), optional, intent(in) :: cxx_flags
character(len=*), optional, intent(in) :: link_time_flags
type(file_scope_flag), optional, intent(in) :: file_scope_flags(:)
logical, optional, intent(in) :: is_built_in
type(profile_config_t) :: profile

end function new_profile

function get_default_profiles(error) result(default_profiles)

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

default_profiles = [new_profile('release', &
    & 'caf', &
    & OS_ALL, &
    & flags=' -O3 -Wimplicit-interface -fPIC -fmax-errors=1 -funroll-loops', &
    & is_built_in=.true.)]
end function get_default_profiles

end program