1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
SUBROUTINE sla__IDCHF (STRING, NPTR, NVEC, NDIGIT, DIGIT)
*+
* - - - - - -
* I D C H F
* - - - - - -
*
* Internal routine used by DFLTIN
*
* Identify next character in string
*
* Given:
* STRING char string
* NPTR int pointer to character to be identified
*
* Returned:
* NPTR int incremented unless end of field
* NVEC int vector for identified character
* NDIGIT int 0-9 if character was a numeral
* DIGIT double equivalent of NDIGIT
*
* NVEC takes the following values:
*
* 1 0-9
* 2 space or TAB !!! n.b. ASCII TAB assumed !!!
* 3 D,d,E or e
* 4 .
* 5 +
* 6 -
* 7 ,
* 8 else
* 9 outside field
*
* If the character is not 0-9, NDIGIT and DIGIT are either not
* altered or are set to arbitrary values.
*
* P.T.Wallace Starlink 22 December 1992
*
* Copyright (C) 1995 Rutherford Appleton Laboratory
*-
IMPLICIT NONE
CHARACTER*(*) STRING
INTEGER NPTR,NVEC,NDIGIT
DOUBLE PRECISION DIGIT
CHARACTER K
INTEGER NCHAR
* Character/vector tables
INTEGER NCREC
PARAMETER (NCREC=19)
CHARACTER KCTAB(NCREC)
INTEGER KVTAB(NCREC)
DATA KCTAB/'0','1','2','3','4','5','6','7','8','9',
: ' ','D','d','E','e','.','+','-',','/
DATA KVTAB/10*1,2,4*3,4,5,6,7/
* Handle pointer outside field
IF (NPTR.LT.1.OR.NPTR.GT.LEN(STRING)) THEN
NVEC=9
ELSE
* Not end of field: identify the character
K=STRING(NPTR:NPTR)
DO NCHAR=1,NCREC
IF (K.EQ.KCTAB(NCHAR)) THEN
* Recognized
NVEC=KVTAB(NCHAR)
NDIGIT=NCHAR-1
DIGIT=DBLE(NDIGIT)
GO TO 2300
END IF
END DO
* Not recognized: check for TAB !!! n.b. ASCII assumed !!!
IF (K.EQ.CHAR(9)) THEN
* TAB: treat as space
NVEC=2
ELSE
* Unrecognized
NVEC=8
END IF
* Increment pointer
2300 CONTINUE
NPTR=NPTR+1
END IF
END
|