aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/fitsio/ftc2ii.f
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/tbtables/fitsio/ftc2ii.f
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/tbtables/fitsio/ftc2ii.f')
-rw-r--r--pkg/tbtables/fitsio/ftc2ii.f37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkg/tbtables/fitsio/ftc2ii.f b/pkg/tbtables/fitsio/ftc2ii.f
new file mode 100644
index 00000000..350d51ee
--- /dev/null
+++ b/pkg/tbtables/fitsio/ftc2ii.f
@@ -0,0 +1,37 @@
+C----------------------------------------------------------------------
+ subroutine ftc2ii(cval,ival,status)
+C convert a character string to an integer
+C (assumes that the input string is left justified)
+
+ integer ival,status,nleng
+ character*(*) cval
+ character*8 iform
+
+ if (status .gt. 0)return
+
+ if (cval .eq. ' ')go to 900
+
+C find length of the input integer character string
+ nleng=index(cval,' ')-1
+ if (nleng .eq. -1)nleng=len(cval)
+
+C construct the format statement to read the character string
+ if (nleng .le. 9)then
+ write(iform,1000)nleng
+1000 format('(I',I1,')')
+ else
+ write(iform,1001)nleng
+1001 format('(I',I2,')')
+ end if
+
+ read(cval,iform,err=900)ival
+ return
+
+900 continue
+C work around for bug in the DEC Alpha VMS compiler
+ if (cval(1:nleng) .eq. '-2147483648')then
+ ival=-2147483647 - 1
+ else
+ status=407
+ end if
+ end