rename Subroutine

public subroutine rename(p, finished)

Arguments

Type IntentOptional AttributesName
type(json_value), intent(in), pointer:: p
logical, intent(out) :: finished

Description

change all "name" variable values to "Fred"

Calls

proc~~rename~~CallsGraph proc~rename rename proc~json_info json_info proc~rename->proc~json_info interface~json_update json_update proc~rename->interface~json_update interface~json_get json_get proc~rename->interface~json_get proc~json_count json_count proc~json_info->proc~json_count proc~json_update_logical json_update_logical interface~json_update->proc~json_update_logical proc~json_update_string json_update_string interface~json_update->proc~json_update_string proc~json_update_integer json_update_integer interface~json_update->proc~json_update_integer proc~json_update_double json_update_double interface~json_update->proc~json_update_double proc~json_get_string json_get_string interface~json_get->proc~json_get_string proc~json_get_double_vec_with_path json_get_double_vec_with_path interface~json_get->proc~json_get_double_vec_with_path proc~json_get_logical json_get_logical interface~json_get->proc~json_get_logical proc~json_get_integer_vec_with_path json_get_integer_vec_with_path interface~json_get->proc~json_get_integer_vec_with_path proc~json_get_logical_vec_with_path json_get_logical_vec_with_path interface~json_get->proc~json_get_logical_vec_with_path proc~json_get_array json_get_array interface~json_get->proc~json_get_array proc~json_get_double json_get_double interface~json_get->proc~json_get_double proc~json_get_string_vec_with_path json_get_string_vec_with_path interface~json_get->proc~json_get_string_vec_with_path proc~json_get_by_path json_get_by_path interface~json_get->proc~json_get_by_path proc~json_get_integer json_get_integer interface~json_get->proc~json_get_integer proc~json_get_double_with_path json_get_double_with_path interface~json_get->proc~json_get_double_with_path proc~json_get_logical_with_path json_get_logical_with_path interface~json_get->proc~json_get_logical_with_path proc~json_get_integer_with_path json_get_integer_with_path interface~json_get->proc~json_get_integer_with_path proc~json_get_logical_vec json_get_logical_vec interface~json_get->proc~json_get_logical_vec proc~json_get_string_with_path json_get_string_with_path interface~json_get->proc~json_get_string_with_path proc~json_get_string_vec json_get_string_vec interface~json_get->proc~json_get_string_vec proc~json_get_integer_vec json_get_integer_vec interface~json_get->proc~json_get_integer_vec proc~json_get_array_with_path json_get_array_with_path interface~json_get->proc~json_get_array_with_path proc~json_get_double_vec json_get_double_vec interface~json_get->proc~json_get_double_vec proc~json_update_logical->proc~json_info proc~json_update_logical->interface~json_get interface~throw_exception throw_exception proc~json_update_logical->interface~throw_exception interface~json_add json_add proc~json_update_logical->interface~json_add proc~to_logical to_logical proc~json_update_logical->proc~to_logical proc~json_update_string->proc~json_info proc~json_update_string->interface~json_get proc~json_update_string->interface~throw_exception proc~json_update_string->interface~json_add proc~to_string to_string proc~json_update_string->proc~to_string proc~json_update_integer->proc~json_info proc~json_update_integer->interface~json_get proc~json_update_integer->interface~throw_exception proc~json_update_integer->interface~json_add proc~to_integer to_integer proc~json_update_integer->proc~to_integer proc~json_update_double->proc~json_info proc~json_update_double->interface~json_get proc~json_update_double->interface~throw_exception proc~json_update_double->interface~json_add proc~to_double to_double proc~json_update_double->proc~to_double proc~json_throw_exception json_throw_exception interface~throw_exception->proc~json_throw_exception proc~json_value_add_logical json_value_add_logical interface~json_add->proc~json_value_add_logical proc~json_value_add_double json_value_add_double interface~json_add->proc~json_value_add_double proc~json_value_add_member json_value_add_member interface~json_add->proc~json_value_add_member proc~json_value_add_integer json_value_add_integer interface~json_add->proc~json_value_add_integer proc~json_value_add_double_vec json_value_add_double_vec interface~json_add->proc~json_value_add_double_vec proc~json_value_add_logical_vec json_value_add_logical_vec interface~json_add->proc~json_value_add_logical_vec proc~json_value_add_integer_vec json_value_add_integer_vec interface~json_add->proc~json_value_add_integer_vec proc~json_value_add_string_vec json_value_add_string_vec interface~json_add->proc~json_value_add_string_vec proc~json_value_add_string json_value_add_string interface~json_add->proc~json_value_add_string proc~destroy_json_data destroy_json_data proc~to_logical->proc~destroy_json_data proc~json_value_add_logical->interface~json_add proc~json_value_add_logical->proc~to_logical proc~json_value_create json_value_create proc~json_value_add_logical->proc~json_value_create proc~json_value_add_double->interface~json_add proc~json_value_add_double->proc~json_value_create proc~json_value_add_double->proc~to_double proc~json_value_add_integer->interface~json_add proc~json_value_add_integer->proc~json_value_create proc~json_value_add_integer->proc~to_integer proc~json_value_add_double_vec->interface~json_add proc~json_value_add_double_vec->proc~json_value_create proc~to_array to_array proc~json_value_add_double_vec->proc~to_array proc~json_value_add_logical_vec->interface~json_add proc~json_value_add_logical_vec->proc~json_value_create proc~json_value_add_logical_vec->proc~to_array proc~json_value_add_integer_vec->interface~json_add proc~json_value_add_integer_vec->proc~json_value_create proc~json_value_add_integer_vec->proc~to_array proc~json_value_add_string_vec->interface~json_add proc~json_value_add_string_vec->proc~json_value_create proc~json_value_add_string_vec->proc~to_array proc~json_value_add_string->interface~json_add proc~json_value_add_string->proc~json_value_create proc~escape_string escape_string proc~json_value_add_string->proc~escape_string proc~json_value_add_string->proc~to_string proc~to_double->proc~destroy_json_data proc~to_integer->proc~destroy_json_data proc~to_array->proc~destroy_json_data proc~to_string->proc~destroy_json_data proc~json_get_string->interface~throw_exception proc~unescape_string unescape_string proc~json_get_string->proc~unescape_string proc~json_get_double_vec_with_path->interface~json_get proc~json_get_logical->interface~throw_exception proc~json_get_integer_vec_with_path->interface~json_get proc~json_get_logical_vec_with_path->interface~json_get proc~json_get_array->proc~json_count proc~json_get_array->interface~throw_exception proc~json_get_double->interface~throw_exception proc~json_get_string_vec_with_path->interface~json_get proc~json_get_by_path->interface~throw_exception interface~json_get_child json_get_child proc~json_get_by_path->interface~json_get_child proc~json_clear_exceptions json_clear_exceptions proc~json_get_by_path->proc~json_clear_exceptions proc~string_to_integer string_to_integer proc~json_get_by_path->proc~string_to_integer proc~json_get_integer->interface~throw_exception proc~json_get_double_with_path->interface~throw_exception proc~json_get_double_with_path->proc~json_get_double proc~json_get_double_with_path->proc~json_get_by_path proc~json_get_double_with_path->proc~json_clear_exceptions proc~json_get_logical_with_path->interface~throw_exception proc~json_get_logical_with_path->proc~json_get_logical proc~json_get_logical_with_path->proc~json_get_by_path proc~json_get_logical_with_path->proc~json_clear_exceptions proc~json_get_integer_with_path->interface~throw_exception proc~json_get_integer_with_path->proc~json_get_by_path proc~json_get_integer_with_path->proc~json_get_integer proc~json_get_integer_with_path->proc~json_clear_exceptions proc~json_get_logical_vec->interface~json_get proc~json_get_string_with_path->interface~throw_exception proc~json_get_string_with_path->proc~json_get_string proc~json_get_string_with_path->proc~json_get_by_path proc~json_get_string_with_path->proc~json_clear_exceptions proc~json_get_string_vec->interface~json_get proc~json_get_integer_vec->interface~json_get proc~json_get_array_with_path->interface~throw_exception proc~json_get_array_with_path->proc~json_get_array proc~json_get_array_with_path->proc~json_get_by_path proc~json_get_array_with_path->proc~json_clear_exceptions proc~json_get_double_vec->interface~json_get proc~unescape_string->interface~throw_exception interface~to_unicode to_unicode proc~unescape_string->interface~to_unicode proc~to_uni to_uni interface~to_unicode->proc~to_uni proc~to_uni_vec to_uni_vec interface~to_unicode->proc~to_uni_vec proc~json_value_get_by_index json_value_get_by_index interface~json_get_child->proc~json_value_get_by_index proc~json_value_get_by_name_chars json_value_get_by_name_chars interface~json_get_child->proc~json_value_get_by_name_chars proc~string_to_integer->interface~throw_exception proc~json_value_get_by_index->interface~throw_exception proc~json_value_get_by_name_chars->proc~json_count proc~json_value_get_by_name_chars->interface~throw_exception
Help

Variables

TypeVisibility AttributesNameInitial
integer, public :: var_type
character(kind=CK,len=:), public, allocatable:: str
logical, public :: found

Source Code

    subroutine rename(p,finished)  !! change all "name" variable values to "Fred"
    
    implicit none
    
    type(json_value),pointer,intent(in) :: p
    logical,intent(out) :: finished
    
    integer :: var_type
    character(kind=CK,len=:),allocatable :: str
    logical :: found
    
    !get info about this variable:
    call json_info(p,var_type=var_type,name=str)
    
    !it must be a string named "name":
    if (var_type==json_string .and. str=='name') then
        call json_get(p,'@',str)             ! get original name
        call json_update(p,'@','Fred',found) !change it
        write(error_unit,'(A)') str//' name changed'
        icount = icount + 1
    end if
    
    !cleanup:
    if (allocated(str)) deallocate(str)
    
    !always false, since we want to traverse all nodes:
    finished = .false.
   
    end subroutine rename