• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

strutil.f90

Go to the documentation of this file.
00001 ! $Id: strutil.f90 11680 2011-03-27 17:57:51Z airwin $
00002 !
00003 ! Copyright (C) 2004  Alan W. Irwin
00004 !
00005 ! This file is part of PLplot.
00006 !
00007 ! PLplot is free software; you can redistribute it and/or modify
00008 ! it under the terms of the GNU Library General Public License as published
00009 ! by the Free Software Foundation; either version 2 of the License, or
00010 ! (at your option) any later version.
00011 !
00012 ! PLplot is distributed in the hope that it will be useful,
00013 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 ! GNU Library General Public License for more details.
00016 !
00017 ! You should have received a copy of the GNU Library General Public License
00018 ! along with PLplot; if not, write to the Free Software
00019 ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020 
00021       subroutine plstrf2c(string1, string2, maxlen)
00022 
00023       integer*4 maxlen
00024       character*(*) string1, string2
00025 
00026       integer*4 limit, islen
00027       external islen
00028 
00029       limit = min0(islen(string1),maxlen-1)
00030       do 100 i = 1,limit
00031          string2(i:i) = string1(i:i)
00032  100  continue
00033       string2(limit+1:limit+1) = char(0)
00034 
00035       return
00036       end subroutine plstrf2c
00037 
00038 
00039       subroutine plstrc2f(string1, string2)
00040 
00041       character*(*) string1, string2
00042 
00043       integer*4 limit
00044       character*300 stringbuf
00045 
00046       limit = 1
00047  10   if (ichar(string1(limit:limit)) .eq. 0) goto 20
00048       stringbuf(limit:limit) = string1(limit:limit)
00049       limit = limit + 1
00050       goto 10
00051 
00052  20   if(limit.gt.1) then
00053         string2 = stringbuf(1:limit-1)
00054       else
00055         string2 = ''
00056       endif
00057 
00058       return
00059       end subroutine plstrc2f
00060 
00061 
00062       integer function islen(string)
00063       character*(*) string
00064       integer i
00065 
00066       do 100 i = len(string),1,-1
00067          if (string(i:i) .ne. ' ') then
00068             islen = i
00069             return
00070          endif
00071  100  continue
00072 
00073       if(len(string).eq.0) then
00074 !        If string is length 0, return length 0
00075         islen = 0
00076       else
00077 !        If string is blank, return length of 1
00078         islen = 1
00079       endif
00080       return
00081       end function islen

Generated on Wed Oct 12 2011 20:42:23 for PLplot by  doxygen 1.7.1