-
Notifications
You must be signed in to change notification settings - Fork 0
/
strtoi.src
28 lines (28 loc) · 878 Bytes
/
strtoi.src
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
#include "zeus2d.def"
c=======================================================================
c//////////////////////// FUNCTION STRTOI \\\\\\\\\\\\\\\\\\\\\\\\\\\\
c
integer function strtoi(string,istrt,iend)
c
c CONVERTS A SEGMENT OF A CHARACTER*8 STRING INTO AN INTEGER NUMBER
c
c-----------------------------------------------------------------------
implicit NONE
c
character*8 string
integer istrt,iend,asciic(48:57),ishift,ival,i
data asciic / 0,1,2,3,4,5,6,7,8,9 /
save asciic
c\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////
c=======================================================================
c
ishift = 1
ival = 0
do 10 i=iend,istrt,-1
ival = ival + ishift*asciic(ichar(string(i:i)))
ishift = ishift*10
10 continue
strtoi = ival
c
return
end