push_char Subroutine

private subroutine push_char(json, c)

Core routine.

See also

History

  • Jacob Williams : 5/3/2015 : replaced original version of this routine.

Type Bound

json_core

Arguments

Type IntentOptional Attributes Name
class(json_core), intent(inout) :: json
character(kind=CK, len=1), intent(in) :: c

to character to push


Calls

proc~~push_char~~CallsGraph proc~push_char json_value_module::json_core%push_char none~throw_exception json_value_module::json_core%throw_exception proc~push_char->none~throw_exception proc~integer_to_string json_string_utilities::integer_to_string proc~push_char->proc~integer_to_string proc~json_throw_exception json_value_module::json_core%json_throw_exception none~throw_exception->proc~json_throw_exception proc~wrap_json_throw_exception json_value_module::json_core%wrap_json_throw_exception none~throw_exception->proc~wrap_json_throw_exception proc~wrap_json_throw_exception->none~throw_exception interface~to_unicode json_string_utilities::to_unicode proc~wrap_json_throw_exception->interface~to_unicode proc~to_uni json_string_utilities::to_uni interface~to_unicode->proc~to_uni proc~to_uni_vec json_string_utilities::to_uni_vec interface~to_unicode->proc~to_uni_vec

Called by

proc~~push_char~~CalledByGraph proc~push_char json_value_module::json_core%push_char proc~parse_number json_value_module::json_core%parse_number proc~parse_number->proc~push_char proc~parse_value json_value_module::json_core%parse_value proc~parse_value->proc~push_char proc~parse_value->proc~parse_number proc~parse_array json_value_module::json_core%parse_array proc~parse_value->proc~parse_array proc~parse_object json_value_module::json_core%parse_object proc~parse_value->proc~parse_object proc~json_parse_file json_value_module::json_core%json_parse_file proc~json_parse_file->proc~parse_value proc~json_parse_string json_value_module::json_core%json_parse_string proc~json_parse_string->proc~parse_value proc~parse_array->proc~parse_value proc~parse_object->proc~parse_value proc~parse_object->proc~parse_object none~deserialize json_value_module::json_core%deserialize none~deserialize->proc~json_parse_string proc~wrap_json_parse_string json_value_module::json_core%wrap_json_parse_string none~deserialize->proc~wrap_json_parse_string none~load json_value_module::json_core%load none~load->proc~json_parse_file proc~json_file_load json_file_module::json_file%json_file_load proc~json_file_load->none~load proc~json_file_load_from_string json_file_module::json_file%json_file_load_from_string proc~json_file_load_from_string->none~deserialize proc~wrap_json_parse_string->none~deserialize none~deserialize~2 json_file_module::json_file%deserialize none~deserialize~2->proc~json_file_load_from_string proc~wrap_json_file_load_from_string json_file_module::json_file%wrap_json_file_load_from_string none~deserialize~2->proc~wrap_json_file_load_from_string proc~assign_string_to_json_file json_file_module::json_file%assign_string_to_json_file proc~assign_string_to_json_file->none~deserialize~2 proc~initialize_json_file_from_string json_file_module::initialize_json_file_from_string proc~initialize_json_file_from_string->none~deserialize~2 proc~initialize_json_file_from_string_v2 json_file_module::initialize_json_file_from_string_v2 proc~initialize_json_file_from_string_v2->none~deserialize~2 proc~wrap_json_file_load_from_string->none~deserialize~2 interface~json_file json_file_module::json_file interface~json_file->proc~initialize_json_file_from_string interface~json_file->proc~initialize_json_file_from_string_v2 proc~wrap_initialize_json_file_from_string json_file_module::wrap_initialize_json_file_from_string interface~json_file->proc~wrap_initialize_json_file_from_string proc~wrap_initialize_json_file_from_string_v2 json_file_module::wrap_initialize_json_file_from_string_v2 interface~json_file->proc~wrap_initialize_json_file_from_string_v2 proc~wrap_assign_string_to_json_file json_file_module::json_file%wrap_assign_string_to_json_file proc~wrap_assign_string_to_json_file->proc~assign_string_to_json_file proc~wrap_initialize_json_file_from_string->proc~initialize_json_file_from_string proc~wrap_initialize_json_file_from_string_v2->proc~initialize_json_file_from_string_v2

Source Code

    subroutine push_char(json,c)

    implicit none

    class(json_core),intent(inout)      :: json
    character(kind=CK,len=1),intent(in) :: c     !! to character to push

    character(kind=CK,len=max_numeric_str_len) :: istr  !! for error printing

    if (.not. json%exception_thrown) then

        if (use_unformatted_stream) then

            !in this case, c is ignored, and we just
            !decrement the stream position counter:
            json%ipos = json%ipos - 1
            json%ichunk = json%ichunk - 1

        else

            json%pushed_index = json%pushed_index + 1

            if (json%pushed_index>0 .and. json%pushed_index<=len(json%pushed_char)) then
                json%pushed_char(json%pushed_index:json%pushed_index) = c
            else
                call integer_to_string(json%pushed_index,int_fmt,istr)
                call json%throw_exception('Error in push_char: '//&
                                          'invalid valid of pushed_index: '//trim(istr))
            end if

        end if

        !character count in the current line
        json%char_count = json%char_count - 1

    end if

    end subroutine push_char