From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/qpoe/qpsavewcs.x | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 sys/qpoe/qpsavewcs.x (limited to 'sys/qpoe/qpsavewcs.x') diff --git a/sys/qpoe/qpsavewcs.x b/sys/qpoe/qpsavewcs.x new file mode 100644 index 00000000..35293d62 --- /dev/null +++ b/sys/qpoe/qpsavewcs.x @@ -0,0 +1,35 @@ +include "qpoe.h" + +# QP_SAVEWCS -- Save the given WCS in the QPOE header, as a variable length +# binary array (machine independent) in the default WCS parameter QPWCS. + +procedure qp_savewcs (qp, mw) + +pointer qp #I QPOE descriptor +pointer mw #I MWCS descriptor + +pointer bp +int buflen, nchars +int mw_save(), qp_accessf() +errchk mw_save, qp_accessf, qp_addf, qp_write +string s_opaque "opaque" +string s_qpwcs QPWCS + +begin + bp = NULL + buflen = 0 + + # Encode the WCS as a machine independent binary array. + nchars = mw_save (mw, bp, buflen) + + # Save it in the QPOE header. + if (nchars > 0) { + if (qp_accessf (qp, s_qpwcs) == NO) + call qp_addf (qp, s_qpwcs, + s_opaque, 0, "World coordinate system", SF_INHERIT) + call qp_write (qp, s_qpwcs, Memc[bp], nchars, 1, s_opaque) + } + + if (bp != NULL) + call mfree (bp, TY_CHAR) +end -- cgit