File: itoc.f

package info (click to toggle)
iraf 2.17-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 95,288 kB
  • sloc: ansic: 228,894; fortran: 75,606; lisp: 18,369; xml: 8,401; sh: 6,111; yacc: 5,648; lex: 596; makefile: 575; asm: 153; csh: 95; sed: 4
file content (35 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (7)
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
      integer function itoc (int, str, size)
      integer int, size
      integer str (100)
      integer mod
      integer d, i, intval, j, k
      integer digits (11)
      data digits (1) /48/, digits (2) /49/, digits (3) /50/, digits (4)
     * /51/, digits (5) /52/, digits (6) /53/, digits (7) /54/, digits (
     *8) /55/, digits (9) /56/, digits (10) /57/, digits (11) /-2/
      intval = iabs (int)
      str (1) = -2
      i = 1
23000 continue
      i = i + 1
      d = mod (intval, 10)
      str (i) = digits (d+1)
      intval = intval / 10
23001 if (.not.(intval .eq. 0 .or. i .ge. size))goto 23000
23002 continue
      if (.not.(int .lt. 0 .and. i .lt. size))goto 23003
      i = i + 1
      str (i) = 45
23003 continue
      itoc = i - 1
      j = 1
23005 if (.not.(j .lt. i))goto 23007
      k = str (i)
      str (i) = str (j)
      str (j) = k
      i = i - 1
23006 j = j + 1
      goto 23005
23007 continue
      return
      end