From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/tbtables/fitsio/ftc2r.f | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 pkg/tbtables/fitsio/ftc2r.f (limited to 'pkg/tbtables/fitsio/ftc2r.f') diff --git a/pkg/tbtables/fitsio/ftc2r.f b/pkg/tbtables/fitsio/ftc2r.f new file mode 100644 index 00000000..71909d70 --- /dev/null +++ b/pkg/tbtables/fitsio/ftc2r.f @@ -0,0 +1,40 @@ +C---------------------------------------------------------------------- + subroutine ftc2r(cval,rval,status) +C convert a character string to a real value +C perform datatype conversion, if required + + character*(*) cval + real rval + integer ival,status + character*1 dtype + logical lval + character*16 sval + 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. 'F')then +C convert from double to single precision + rval=dval + else if (dtype .eq. 'I')then +C convert from integer to real + rval=ival + else if (dtype .eq. 'L')then +C need to convert from logical to real + if (lval)then + rval=1. + else + rval=0. + end if + else if (dtype .eq. 'C')then +C can't convert a string to a real, so return error + rval=0 + status=405 + sval=cval + call ftpmsg('Error in FTC2R evaluating this string '// + & 'as a real value: '//sval) + end if + end -- cgit