4 integer,
parameter :: dp = kind(0.0d0)
10 print *,
"Testing m_config.f90 (test 2)"
11 print *,
"This program reads its arguments as configuration files"
12 print *,
"Try running it like this:"
13 print *,
"./example_2"
14 print *,
"./example_2 example_2_input.cfg -array%int='13 37'"
19 call cfg_add(my_cfg,
"scalar%real", 1.0_dp,
"my_real")
20 call cfg_add(my_cfg,
"scalar%logic", .true.,
"my_logic")
22 print *,
"Using CFG_add_get you can immediately get the value"
23 print *,
"that previously has been read in, for example:"
25 call cfg_add_get(my_cfg,
"scalar%int", my_int,
"my_int")
26 print *,
"scalar%int: ", my_int
29 call cfg_add(my_cfg,
"scalar%string",
"a string",
"my_string")
30 call cfg_add(my_cfg,
"array%real", [1.0_dp, 2.0_dp],
"my_reals", dynamic_size=.true.)
31 call cfg_add(my_cfg,
"array%logic", [.true., .true.],
"my_logics", dynamic_size=.true.)
32 call cfg_add(my_cfg,
"array%int", [1, 2],
"my_ints", dynamic_size=.true.)
33 call cfg_add(my_cfg,
"array%string", [
"A",
"B"],
"my_strings", dynamic_size=.true.)
35 call cfg_write(my_cfg,
"stdout", custom_first=.true.)
36 call cfg_write(my_cfg,
"example_2_output.cfg")
Interface to get variables from the configuration.
Interface to add variables to the configuration.
Module that allows working with a configuration file.
subroutine, public cfg_write(cfg_in, filename, hide_unused, custom_first)
This routine writes the current configuration to a file with descriptions.
subroutine, public cfg_write_markdown(cfg_in, filename, hide_unused)
This routine writes the current configuration to a markdown file.
subroutine, public cfg_update_from_arguments(cfg, ignore_unknown)
Read command line arguments. Both files and variables can be specified, for example as: ....
The configuration that contains all the variables.