@@ -21,7 +21,7 @@ This document discusses the hash maps in the Fortran Standard Library.
2121
2222The Fortran Standard Library is distributed under the MIT License.
2323However components of the library should be evaluated as to whether
24- they are compatible with the MTI License.
24+ they are compatible with the MIT License.
2525The current hash maps were inspired by an
2626[ implementation] ( http://chasewoerner.org/src/hasht/ ) of David
2727Chase. While the code has been greatly modified from his
@@ -229,14 +229,14 @@ is an `intent(out)` argument.
229229``` fortran
230230 program demo_copy_key
231231 use stdlib_hashmap_wrappers, only: &
232- copy_key, operator(==), key_type
232+ copy_key, operator(==), key_type, set
233233 use iso_fortran_env, only: int8
234234 implicit none
235235 integer(int8) :: i, value(15)
236236 type(key_type) :: old_key, new_key
237237 value = [(i, i = 1, 15)]
238- call set( key_out , value )
239- call copy_key( key_out , new_key )
238+ call set( old_key , value )
239+ call copy_key( old_key , new_key )
240240 print *, "old_key == new_key = ", old_key == new_key
241241 end program demo_copy_key
242242```
@@ -276,7 +276,7 @@ is an `intent(out)` argument.
276276 use iso_fortran_env, only: int8
277277 implicit none
278278 type(other_type) :: other_in, other_out
279- integer(int_8 ) :: i
279+ integer(int8 ) :: i
280280 class(*), allocatable :: dummy
281281 type dummy_type
282282 integer(int8) :: value(15)
@@ -287,8 +287,8 @@ is an `intent(out)` argument.
287287 end do
288288 allocate(other_in % value, source=dummy_val)
289289 call copy_other( other_in, other_out )
290- select type(other_out)
291- type (dummy_type)
290+ select type(other_out) !there is an issue here, please check.
291+ typeis (dummy_type)
292292 print *, "other_in == other_out = ", &
293293 all( dummy_val % value == other_out % value )
294294 end select
@@ -507,19 +507,19 @@ is an `intent(out)` argument.
507507``` fortran
508508 program demo_free_other
509509 use stdlib_hashmap_wrappers, only: &
510- copy_other, free_other, other_type, set
510+ copy_other, free_other, other_type
511511 use iso_fortran_env, only: int8
512512 implicit none
513513 type dummy_type
514514 integer(int8) :: value(15)
515515 end type dummy_type
516- typer (dummy_type) :: dummy_val
516+ type (dummy_type) :: dummy_val
517517 type(other_type), allocatable :: other_in, other_out
518- integer(int_8 ) :: i
518+ integer(int8 ) :: i
519519 do i=1, 15
520520 dummy_val % value(i) = i
521521 end do
522- allocate(other_in, source=dummy_val)
522+ allocate(other_in % value , source=dummy_val)
523523 call copy_other( other_in, other_out )
524524 call free_other( other_out )
525525 end program demo_free_other
@@ -573,7 +573,7 @@ an allocatable of `class(*)`. It is an `intent(out)` argument.
573573 implicit none
574574 integer(int8), allocatable :: value(:), result(:)
575575 type(key_type) :: key
576- integer(int_8 ) :: i
576+ integer(int8 ) :: i
577577 allocate( value(1:15) )
578578 do i=1, 15
579579 value(i) = i
@@ -585,7 +585,7 @@ an allocatable of `class(*)`. It is an `intent(out)` argument.
585585```
586586
587587
588- #### ` hasher_fun ` - serves aa a function prototype.
588+ #### ` hasher_fun ` - serves as a function prototype.
589589
590590##### Status
591591
@@ -933,7 +933,7 @@ value to an `int8` vector.
933933 implicit none
934934 integer(int8), allocatable :: value(:), result(:)
935935 type(key_type) :: key
936- integer(int_8 ) :: i
936+ integer(int8 ) :: i
937937 allocate( value(1:15) )
938938 do i=1, 15
939939 value(i) = i
@@ -1392,7 +1392,7 @@ The result will be the number of procedure calls on the hash map.
13921392 use stdlib_hashmap_wrappers, only: fnv_1_hasher
13931393 implicit none
13941394 type(chaining_hashmap_type) :: map
1395- type (int_calls) :: initial_calls
1395+ integer (int_calls) :: initial_calls
13961396 call map % init( fnv_1_hasher )
13971397 initial_calls = map % calls()
13981398 print *, "INITIAL_CALLS = ", initial_calls
@@ -1518,9 +1518,9 @@ undefined.
15181518 end if
15191519 call get( other, data )
15201520 select type( data )
1521- type (dummy_type)
1521+ typeis (dummy_type)
15221522 print *, 'Other data % value = ', data % value
1523- type default
1523+ class default
15241524 print *, 'Invalid data type in other'
15251525 end select
15261526 end program demo_get_other_data
@@ -1587,11 +1587,11 @@ has the value `alloc_fault`.
15871587
15881588``` fortran
15891589 program demo_init
1590- use stdlib_hashmaps, only: chaining_map_type
1590+ use stdlib_hashmaps, only: chaining_hashmap_type
15911591 use stdlib_hashmap_wrappers, only: fnv_1_hasher
1592- type(fnv_1a_type) :: fnv_1
1593- type(chaining_map_type ) :: map
1594- call map % init( fnv_1a , slots_bits=10 )
1592+ implicit none
1593+ type(chaining_hashmap_type ) :: map
1594+ call map % init( fnv_1_hasher , slots_bits=10 )
15951595 end program demo_init
15961596```
15971597
@@ -1748,7 +1748,7 @@ is ignored.
17481748 program demo_map_entry
17491749 use, intrinsic:: iso_fortran_env, only: int8
17501750 use stdlib_hashmaps, only: chaining_hashmap_type
1751- use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type
1751+ use stdlib_hashmap_wrappers, only: fnv_1_hasher, key_type, other_type, set
17521752 type(chaining_hashmap_type) :: map
17531753 type(key_type) :: key
17541754 logical :: conflict
@@ -1806,7 +1806,7 @@ rehashing.
18061806 type(chaining_hashmap_type) :: map
18071807 real :: nprobes
18081808 call map % init( fnv_1_hasher )
1809- nprobes = map % probes ()
1809+ nprobes = map % map_probes ()
18101810 print *, "Initial probes = ", nprobes
18111811 end program demo_probes
18121812```
@@ -1855,7 +1855,7 @@ The result is the number of slots in `map`.
18551855 call map % init( fnv_1_hasher )
18561856 initial_slots = map % num_slots ()
18571857 print *, "Initial slots = ", initial_slots
1858- end program num_slots
1858+ end program demo_num_slots
18591859```
18601860
18611861
@@ -1891,10 +1891,12 @@ It is the hash method to be used by `map`.
18911891
18921892``` fortran
18931893 program demo_rehash
1894+ use stdlib_kinds, only: int8
18941895 use stdlib_hashmaps, only: open_hashmap_type
1895- use stdlib_hasmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,&
1896- key_type, other_type
1897- type(openn_hashmap_type) :: map
1896+ use stdlib_hashmap_wrappers, only: fnv_1_hasher, fnv_1a_hasher,&
1897+ key_type, other_type, set
1898+ implicit none
1899+ type(open_hashmap_type) :: map
18981900 type(key_type) :: key
18991901 type(other_type) :: other
19001902 class(*), allocatable :: dummy
@@ -2009,20 +2011,23 @@ not exist and nothing was done.
20092011
20102012``` fortran
20112013 program demo_set_other_data
2014+ use stdlib_kinds, only: int8
20122015 use stdlib_hashmaps, only: open_hashmap_type
20132016 use stdlib_hashmap_wrappers, only: fnv_1_hasher, &
20142017 fnv_1a_hasher, key_type, other_type, set
2018+ implicit none
2019+ logical :: exists
20152020 type(open_hashmap_type) :: map
20162021 type(key_type) :: key
20172022 type(other_type) :: other
20182023 class(*), allocatable :: dummy
20192024 call map % init( fnv_1_hasher, slots_bits=10 )
2020- allocate( dummy, source='A value` )
2025+ allocate( dummy, source='A value' )
20212026 call set( key, [ 5_int8, 7_int8, 4_int8, 13_int8 ] )
20222027 call set( other, dummy )
20232028 call map % map_entry( key, other )
20242029 deallocate( dummy )
2025- allocate( dummy, source='Another value` )
2030+ allocate( dummy, source='Another value' )
20262031 call set( other, dummy )
20272032 call map % set_other_data( key, other, exists )
20282033 print *, 'The entry to have its other data replaced exists = ', exists
0 commit comments