diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/qpoe/gen/qpputc.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/qpoe/gen/qpputc.x')
-rw-r--r-- | sys/qpoe/gen/qpputc.x | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/sys/qpoe/gen/qpputc.x b/sys/qpoe/gen/qpputc.x new file mode 100644 index 00000000..4415a177 --- /dev/null +++ b/sys/qpoe/gen/qpputc.x @@ -0,0 +1,74 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <syserr.h> +include "../qpoe.h" + +# QP_PUT -- Set the value of the named header parameter. Automatic type +# conversion is performed where possible. While only scalar values can be +# set by this function, the scalar may be an element of a one-dimensional +# array, e.g., "param[N]". + +procedure qp_putc (qp, param, value) + +pointer qp #I QPOE descriptor +char param[ARB] #I parameter name +char value #I scalar parameter value + +pointer pp +bool indef +int dtype +int qp_putparam() +errchk qp_putparam, syserrs + +begin + # Lookup the parameter and get a pointer to the value buffer. + dtype = qp_putparam (qp, param, pp) + if (pp == NULL) + call syserrs (SYS_QPNOVAL, param) + + if (QP_DEBUG(qp) > 1) { + call eprintf ("qp_put: `%s', TYP=(%d->%d), new value %g\n") + call pargstr (param) + call pargi (TY_CHAR) + call pargi (dtype) + call pargc (value) + } + + indef = IS_INDEF(value) + + # Set the parameter value. + switch (dtype) { + case TY_CHAR: + Memc[pp] = value + case TY_SHORT: + if (indef) + Mems[pp] = INDEFS + else + Mems[pp] = value + case TY_INT: + if (indef) + Memi[pp] = INDEFI + else + Memi[pp] = value + case TY_LONG: + if (indef) + Meml[pp] = INDEFL + else + Meml[pp] = value + case TY_REAL: + if (indef) + Memr[pp] = INDEFR + else + Memr[pp] = value + case TY_DOUBLE: + if (indef) + Memd[pp] = INDEFD + else + Memd[pp] = value + default: + call syserrs (SYS_QPBADCONV, param) + } + + # Update the parameter in the datafile. + call qp_flushpar (qp) +end |