add_digits Subroutine

private pure subroutine add_digits(me, i, negative)

Append the decimal digits of an integer.

Arguments

Type IntentOptional Attributes Name
class(text_buffer), intent(inout) :: me
integer(kind=int64), intent(in) :: i
logical, intent(in) :: negative

Calls

proc~~add_digits~~CallsGraph proc~add_digits add_digits proc~add_str text_buffer%add_str proc~add_digits->proc~add_str proc~reserve text_buffer%reserve proc~add_str->proc~reserve

Called by

proc~~add_digits~~CalledByGraph proc~add_digits add_digits proc~add_int text_buffer%add_int proc~add_int->proc~add_digits proc~add_real text_buffer%add_real proc~add_real->proc~add_digits proc~add_real_list text_buffer%add_real_list proc~add_real_list->proc~add_real proc~segment_trajectory_json segment_trajectory_json proc~segment_trajectory_json->proc~add_int proc~add_real_array text_buffer%add_real_array proc~segment_trajectory_json->proc~add_real_array proc~add_real_array->proc~add_real_list proc~export_trajectory_json_file mission_type%export_trajectory_json_file proc~export_trajectory_json_file->proc~segment_trajectory_json proc~write_json_real_array write_json_real_array proc~write_json_real_array->proc~add_real_list proc~generate_eclipse_data mission_type%generate_eclipse_data proc~generate_eclipse_data->proc~write_json_real_array proc~halo_solver_main halo_solver_main proc~halo_solver_main->proc~export_trajectory_json_file proc~halo_solver_main->proc~generate_eclipse_data

Source Code

    pure subroutine add_digits(me, i, negative)

    class(text_buffer),intent(inout) :: me
    integer(int64),intent(in) :: i
    logical,intent(in) :: negative

    character(len=20) :: str
    integer(int64) :: j
    integer :: k

    j = abs(i)
    k = len(str) + 1
    do
        k = k - 1
        str(k:k) = achar(iachar('0') + int(mod(j, 10_int64)))
        j = j / 10_int64
        if (j == 0) exit
    end do
    if (negative) call me%add_str('-')
    call me%add_str(str(k:))

    end subroutine add_digits