Debian Codegraph @

packages/seacas/applications/algebra/ag_cnvnum.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 SUBROUTINE CNVNUM (NUMSTR, NUM, IERR)
9 C=======================================================================
10
11 C --*** CNVNUM *** (ALGEBRA) Convert an integer string to a number
12 C -- Written by Amy Gilkey - revised 02/28/86
13 C --
14 C --CNVNUM converts an integer string into a number.
15 C --
16 C --Parameters:
17 C -- NUMSTR - IN - the integer string (<= 10 digits)
18 C -- NUM - OUT - the number
19 C -- IERR - OUT - 0 iff no error occurred
20
21 CHARACTER*(*) NUMSTR
22 CHARACTER*10 INTSTR
23
24 IERR = 0
25
26 L = INDEX (NUMSTR, ' ') - 1
27 IF (L .LT. 0) L = LEN(NUMSTR)
28 IF ((L .LE. 0) .OR. (L .GT. 10)) THEN
29 IERR = 1
30 GOTO 100
31 END IF
32 INTSTR = ' '
33 INTSTR(10-L+1:) = NUMSTR(:L)
34
35 READ (INTSTR, '(I10)', IOSTAT=IERR) NUM
36
37 100 CONTINUE
38 RETURN
39 END