From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- pkg/tbtables/fitsio/ftc2i.f | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 pkg/tbtables/fitsio/ftc2i.f (limited to 'pkg/tbtables/fitsio/ftc2i.f') diff --git a/pkg/tbtables/fitsio/ftc2i.f b/pkg/tbtables/fitsio/ftc2i.f new file mode 100644 index 00000000..f63493ec --- /dev/null +++ b/pkg/tbtables/fitsio/ftc2i.f @@ -0,0 +1,37 @@ +C---------------------------------------------------------------------- + subroutine ftc2i(cval,ival,status) +C convert a character string to an integer +C perform datatype conversion, if required + + integer ival,status + character*(*) cval + character*1 dtype + logical lval + character sval*16 + double precision dval + +C convert string to its intrinsic data type + call ftc2x(cval,dtype,ival,lval,sval,dval,status) + if (status .gt. 0)return + + if (dtype .eq. 'I')then +C no datatype conversion required, so just return + else if (dtype .eq. 'F')then +C need to convert from floating point to integer + ival=dval + else if (dtype .eq. 'L')then +C need to convert from logical to integer + if (lval)then + ival=1 + else + ival=0 + end if + else if (dtype .eq. 'C')then +C can't convert a string to an integer, so return error + ival=0 + status=403 + sval=cval + call ftpmsg('Error in FTC2I evaluating this string as an ' + & //'integer: '//sval) + end if + end -- cgit