append_char Subroutine

private recursive subroutine append_char(str, c)

Arguments

Type IntentOptional AttributesName
type(fson_string), pointer:: str
character, intent(in) :: c

Contents

Source Code


Source Code

  recursive subroutine append_char(str, c)
    type(fson_string), pointer :: str
    character, intent(in) :: c

    if (str % index >= BLOCK_SIZE) then
       !set down the chain
       call allocate_block(str)
       call append_char(str % next, c)

    else
       ! set local
       str % index = str % index + 1
       str % chars(str % index:str % index) = c
    end if

  end subroutine append_char