1*6dd63270SBarry Smith #include <petsc/private/ftnimpl.h> 2665c2dedSJed Brown #include <petscviewer.h> 35c6c1daeSBarry Smith 45c6c1daeSBarry Smith #if defined(PETSC_HAVE_FORTRAN_CAPS) 55c6c1daeSBarry Smith #define petscviewerstringopen_ PETSCVIEWERSTRINGOPEN 6ce78bad3SBarry Smith #define petscviewerstringsetstring_ PETSCVIEWERSTRINGSETSTRING 7ce78bad3SBarry Smith #define petscviewerstringgetstringread_ PETSCVIEWERSTRINGGETSTRINGREAD 85c6c1daeSBarry Smith #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE) 95c6c1daeSBarry Smith #define petscviewerstringopen_ petscviewerstringopen 10ce78bad3SBarry Smith #define petscviewerstringsetstring_ petscviewerstringsetstring 11ce78bad3SBarry Smith #define petscviewerstringgetstringread_ petscviewerstringgetstringread 125c6c1daeSBarry Smith #endif 135c6c1daeSBarry Smith 14ce78bad3SBarry Smith PETSC_EXTERN void petscviewerstringopen_(MPI_Comm *comm, char *name, PetscViewer *str, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len1) 155c6c1daeSBarry Smith { 16ce78bad3SBarry Smith PETSC_FORTRAN_OBJECT_CREATE(str); 17ce78bad3SBarry Smith *ierr = PetscViewerStringOpen(MPI_Comm_f2c(*(MPI_Fint *)&*comm), name, len1, str); 18ce78bad3SBarry Smith } 19ce78bad3SBarry Smith 20ce78bad3SBarry Smith PETSC_EXTERN void petscviewerstringsetstring_(PetscViewer *str, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len1) 21ce78bad3SBarry Smith { 22ce78bad3SBarry Smith PetscViewer v_a = PetscPatchDefaultViewers(str); 23ce78bad3SBarry Smith *ierr = PetscViewerStringSetString(v_a, name, len1); 24ce78bad3SBarry Smith } 25ce78bad3SBarry Smith 26ce78bad3SBarry Smith PETSC_EXTERN void petscviewerstringgetstringread_(PetscViewer *a, char b[], PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T l_b) 27ce78bad3SBarry Smith { 28ce78bad3SBarry Smith size_t len; 29ce78bad3SBarry Smith char *c_b = PETSC_NULLPTR; 30ce78bad3SBarry Smith PetscViewer v_a = PetscPatchDefaultViewers(a); 31ce78bad3SBarry Smith *ierr = PetscViewerStringGetStringRead(v_a, (const char **)&c_b, &len); 32ce78bad3SBarry Smith if (*ierr) return; 33ce78bad3SBarry Smith *ierr = PetscStrncpy((char *)b, c_b, l_b); 34ce78bad3SBarry Smith if (*ierr) return; 355c6c1daeSBarry Smith } 36