Actual source code: zstringvf.c

      1: #include <petsc/private/ftnimpl.h>
      2: #include <petscviewer.h>

      4: #if defined(PETSC_HAVE_FORTRAN_CAPS)
      5:   #define petscviewerstringopen_          PETSCVIEWERSTRINGOPEN
      6:   #define petscviewerstringsetstring_     PETSCVIEWERSTRINGSETSTRING
      7:   #define petscviewerstringgetstringread_ PETSCVIEWERSTRINGGETSTRINGREAD
      8: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
      9:   #define petscviewerstringopen_          petscviewerstringopen
     10:   #define petscviewerstringsetstring_     petscviewerstringsetstring
     11:   #define petscviewerstringgetstringread_ petscviewerstringgetstringread
     12: #endif

     14: PETSC_EXTERN void petscviewerstringopen_(MPI_Comm *comm, char *name, PetscViewer *str, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len1)
     15: {
     16:   PETSC_FORTRAN_OBJECT_CREATE(str);
     17:   *ierr = PetscViewerStringOpen(MPI_Comm_f2c(*(MPI_Fint *)&*comm), name, len1, str);
     18: }

     20: PETSC_EXTERN void petscviewerstringsetstring_(PetscViewer *str, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len1)
     21: {
     22:   PetscViewer v_a = PetscPatchDefaultViewers(str);
     23:   *ierr           = PetscViewerStringSetString(v_a, name, len1);
     24: }

     26: PETSC_EXTERN void petscviewerstringgetstringread_(PetscViewer *a, char b[], PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T l_b)
     27: {
     28:   size_t      len;
     29:   char       *c_b = PETSC_NULLPTR;
     30:   PetscViewer v_a = PetscPatchDefaultViewers(a);
     31:   *ierr           = PetscViewerStringGetStringRead(v_a, (const char **)&c_b, &len);
     32:   if (*ierr) return;
     33:   *ierr = PetscStrncpy((char *)b, c_b, l_b);
     34:   if (*ierr) return;
     35: }