c_f_string Subroutine

private subroutine c_f_string(cs, fs, borne_s)


Arguments

Type IntentOptional AttributesName
character(kind=C_CHAR), intent(in), dimension(:):: cs

C string

character(len=*), intent(out) :: fs

Fortran string

integer(kind=I4), intent(out) :: borne_s

resulting Fortran string length


Calls

proc~~c_f_string~~CallsGraph proc~c_f_string c_f_string proc~empty empty proc~c_f_string->proc~empty

Called by

proc~~c_f_string~~CalledByGraph proc~c_f_string c_f_string proc~surf2scal surf2scal proc~surf2scal->proc~c_f_string proc~trans_surf_txt trans_surf_txt proc~trans_surf_txt->proc~c_f_string proc~write_surf write_surf proc~write_surf->proc~surf2scal proc~open_surffile open_surffile proc~open_surffile->proc~surf2scal proc~save_ms_field save_ms_field proc~save_ms_field->proc~write_surf proc~save_fe_field save_fe_field proc~save_fe_field->proc~write_surf proc~solve_ms_prob solve_ms_prob proc~solve_ms_prob->proc~save_ms_field proc~solve_fe_prob solve_fe_prob proc~solve_fe_prob->proc~save_fe_field proc~test_rough_fe test_rough_fe proc~test_rough_fe->proc~solve_fe_prob proc~test_bearing_x_fe test_bearing_x_fe proc~test_bearing_x_fe->proc~solve_fe_prob proc~test_pocket_fe test_pocket_fe proc~test_pocket_fe->proc~solve_fe_prob proc~test_bearing_y_fe test_bearing_y_fe proc~test_bearing_y_fe->proc~solve_fe_prob proc~test_rough_ms test_rough_ms proc~test_rough_ms->proc~solve_ms_prob proc~test_slider_fe test_slider_fe proc~test_slider_fe->proc~solve_fe_prob proc~test_slider_ms test_slider_ms proc~test_slider_ms->proc~solve_ms_prob proc~run_test run_test proc~run_test->proc~test_rough_fe proc~run_test->proc~test_bearing_x_fe proc~run_test->proc~test_pocket_fe proc~run_test->proc~test_bearing_y_fe proc~run_test->proc~test_rough_ms proc~run_test->proc~test_slider_fe proc~run_test->proc~test_slider_ms program~main main program~main->proc~run_test

Contents

Source Code


Source Code

   subroutine c_f_string(cs, fs, borne_s)
   implicit none
   character(kind=C_CHAR), dimension(:), intent(in) :: cs   !! *C string*
   character(len=*), intent(out) :: fs                      !! *Fortran string*
   integer(kind=I4), intent(out) :: borne_s                 !! *resulting Fortran string length*
      integer(kind=I4) :: i, ucs
      ucs = size(cs) ! vector length
      borne_s = ucs  ! resulting string default length
      i = 1
      do
         if (i>ucs) exit
         if (cs(i)==C_NULL_CHAR) then  ! fin de chaîne c rencontrée ; s'il n'y a pas de null_char
            borne_s = i-1              ! c'est qu'on utilise tout le vecteur
            exit
         endif
         i = i + 1
      enddo
      call empty(fs)
      do i = 1, borne_s ! the C string is translated into fortran
         fs(i:i) = cs(i)
      enddo
   return
   endsubroutine c_f_string