aboutsummaryrefslogtreecommitdiff
path: root/sys/fmtio/ctor.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/fmtio/ctor.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fmtio/ctor.x')
-rw-r--r--sys/fmtio/ctor.x34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/fmtio/ctor.x b/sys/fmtio/ctor.x
new file mode 100644
index 00000000..a8fd16f1
--- /dev/null
+++ b/sys/fmtio/ctor.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+
+# CTOR -- Character to real. The number of characters converted to produce
+# the output number is returned as the function value (0 is returned if the
+# input cannot be interpreted as a number).
+
+int procedure ctor (str, ip, rval)
+
+char str[ARB] # input string to be decoded
+int ip # first character to be used in string
+real rval # decoded real value (output)
+
+double dval
+int nchars, expon
+int ctod()
+
+begin
+ nchars = ctod (str, ip, dval)
+ if (abs(dval) > EPSILOND)
+ expon = int (log10 (abs(dval)))
+ else
+ expon = 0
+
+ if (IS_INDEFD(dval))
+ rval = INDEFR
+ else if (expon > MAX_EXPONENTR)
+ return (0)
+ else
+ rval = dval
+
+ return (nchars)
+end