1      block data inp_data
2C$Id$
3      implicit none
4#include "inpP.fh"
5c
6      data iread   /5/
7      data iwrite  /6/
8      data jrec    /-1/
9      data jump    /0/
10      data oswit   /.false. /
11      data nerr    /999/
12      data nline   /0/
13      data noline  /0/
14      data ierrpos /-1/
15      data errmsg  /' '/
16      data input_line /0/
17      data xblnk /' '/
18#if defined(SGITFP) || defined(SGI_N32) || defined(CRAY) || defined(HPUX) || defined(WIN32) || defined(PSCALE) || defined(__FLANG) || ( __GNUC__ >= 4)
19      data xtab  /'	'/      ! Tab ... no backslash necessary
20#elif (defined(LINUX) || defined(MACX)) && !defined(PGLINUX) && !defined(XLFLINUX) &&!( __GNUC__ >= 4)
21      data xtab  /9/            ! Tab ... g77 has trouble with escape sequence
22#else
23      data xtab  /'\	'/      ! Tab ... note backslash for cpp
24#endif
25      data xsplit/';'/
26      data xcomm /'#'/
27      data xback /'\\'/         ! Backslash ... note backslash for cpp
28      data xquote/'"'/
29c
30      data save_level /0/            ! Depth of nesting in save/restore
31      data include_level /0/
32c
33      end
34c
35C> \brief Returns the length of the contents of a string
36C>
37C> In Fortran the length of a string is determined by the amount of
38C> memory allocated for it. Often one just wants to know how long the
39C> value of the string is without any trailing spaces. Which is what
40C> this function returns.
41C>
42C> \return The length of the value of a string without any trailing
43C> spaces
44c
45      integer function inp_strlen(a)
46      implicit none
47#include "inpP.fh"
48      character*(*) a !< [Input] The string
49      integer i
50      logical ois_ws
51      intrinsic len
52      character*1 xtest
53      ois_ws(xtest) = (xtest.eq.xblnk .or. xtest.eq.xtab)
54c
55      do i = len(a),1,-1
56         if (.not. ois_ws(a(i:i))) goto 10
57      enddo
58c
59 10   inp_strlen = i
60c
61      end
62