PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
strutil.f90
Go to the documentation of this file.
1 ! Copyright (C) 2004-2014 Alan W. Irwin
2 !
3 ! This file is part of PLplot.
4 !
5 ! PLplot is free software; you can redistribute it and/or modify
6 ! it under the terms of the GNU Library General Public License as published
7 ! by the Free Software Foundation; either version 2 of the License, or
8 ! (at your option) any later version.
9 !
10 ! PLplot is distributed in the hope that it will be useful,
11 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ! GNU Library General Public License for more details.
14 !
15 ! You should have received a copy of the GNU Library General Public License
16 ! along with PLplot; if not, write to the Free Software
17 ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
20 
21  implicit none
22 
23 contains
24 
25 !--------------------------------------------------------------------------
26 ! plstrf2c()
27 !
28 ! Converts Fortran string to C format
29 !--------------------------------------------------------------------------
30 
31 subroutine plstrf2c(string1, string2)
32 
33  character(len=*) :: string1, string2
34 
35  integer :: limit
36 
37  string2 = string1
38 ! limit = min(len(string2), len(string1))
39  limit = len_trim(string2)
40  string2(limit+1:limit+1) = char(0)
41 end subroutine plstrf2c
42 
43 
44 !--------------------------------------------------------------------------
45 ! plstrc2f()
46 !
47 ! Converts C string to Fortran conventions
48 !--------------------------------------------------------------------------
49 
50 subroutine plstrc2f(string1, string2)
51 
52  character(len=*) :: string1, string2
53 
54  integer :: limit
55 
56  string2 = string1
57 
58  limit = index( string2, achar(0) )
59  if ( limit > 0 ) then
60  string2(limit:) = ' '
61  endif
62 
63 end subroutine plstrc2f
64 
65 end module plplot_strutils