20 character(len=128) :: line
21 character(len=:),
allocatable :: k, v, fname
22 integer :: iostat, eq_location, funit, dict_size
24 if (command_argument_count() < 1)
then
25 stop
'missing argument for parameter file'
28 call get_command_argument(1, line)
29 fname = trim(adjustl(line))
31 if (command_argument_count() < 2)
then
34 call get_command_argument(2, line)
35 read(line, *) dict_size
38 call b%init(dict_size)
40 open(file=fname, newunit=funit)
42 read(funit,
'(a)', iostat=iostat) line
43 if (iostat < 0)
exit read_loop
44 if (iostat > 0) cycle read_loop
45 eq_location = index(line,
'=')
46 if (eq_location == 0) cycle read_loop
48 k = trim(adjustl(line(1:eq_location-1)))
49 v = trim(adjustl(line(eq_location+1:)))
52 write(*,*)
'empty key while reading data'
56 write(*,*)
'empty value while reading data'
76 s = d%buckets(i)%current_idx
79 write(*,
'(a)', advance=
'no') d%buckets(i)%entries(j)%key
80 write(*,
'(a)', advance=
'no')
' = '
81 write(*,
'(a)', advance=
'no') d%buckets(i)%entries(j)%value
The dictionary contains dict_size buckets (defined at run time)
program use_ssdm
Read a "equal sign" separated input file.
Dictionary type that uses strings for the keys and values.