fdoc

subroutineinternprivate

subroutine intern(c, name, id)

The number of name name, added if it is new.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

namecharacter(len=*)in

the name

idintegerout

its number

Calls

Source

Show the code
subroutine intern(c, name, id)
    type(fypp_t), intent(inout) :: c            !! the state
    character(len=*), intent(in) :: name        !! the name
    integer, intent(out) :: id                  !! its number
    type(string_t), allocatable :: grown(:)
    integer :: k

    id = find_name(c, name)
    if (id > 0) return
    if (c%num_names == size(c%names)) then
        allocate (grown(2*c%num_names))
        do k = 1, c%num_names
            call move_alloc(c%names(k)%s, grown(k)%s)
        end do
        call move_alloc(grown, c%names)
    end if
    c%num_names = c%num_names + 1
    c%names(c%num_names)%s = name
    id = c%num_names
end subroutine intern

Graphs

Calls

Called by