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/mwcs/mwswattrs.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/mwcs/mwswattrs.x')
-rw-r--r-- | sys/mwcs/mwswattrs.x | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/sys/mwcs/mwswattrs.x b/sys/mwcs/mwswattrs.x new file mode 100644 index 00000000..14fc72bd --- /dev/null +++ b/sys/mwcs/mwswattrs.x @@ -0,0 +1,57 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <syserr.h> +include "mwcs.h" + +# MW_SWATTRS -- Set the string value of the named WCS attribute for axis N. +# The attribute is created if not already defined. If axis N=0 is specified, +# the attribute pertains to the entire WCS, not just one axis. + +procedure mw_swattrs (mw, axis, attribute, valstr) + +pointer mw #I pointer to MWCS descriptor +int axis #I axis to which attribute belongs +char attribute[ARB] #I attribute name +char valstr[ARB] #I attribute value + +pointer wp, ap +int atno, i +bool streq() +int mw_refstr() +errchk syserrs, mw_refstr + +begin + # Get current WCS. + wp = MI_WCS(mw) + if (wp == NULL) + call syserrs (SYS_MWNOWCS, "mw_swattrs") + + # Lookup the named attribute and replace the pointer to the value + # string if found. Otherwise, add a new attribute. + + atno = 0 + do i = 1, WCS_NWATTR(wp) { + ap = WCS_WATTR(wp,i) + if (AT_AXIS(ap) == axis) + if (streq (S(mw,AT_NAME(ap)), attribute)) { + atno = i + break + } + } + + # Add a new attribute? + if (atno == 0) { + atno = WCS_NWATTR(wp) + 1 + if (atno > MAX_WATTR) + call syserrs (SYS_MWATOVFL, attribute) + else { + WCS_NWATTR(wp) = atno + ap = WCS_WATTR(wp,atno) + AT_AXIS(ap) = axis + AT_NAME(ap) = mw_refstr (mw, attribute) + } + } + + # Store the value string. + AT_VALUE(ap) = mw_refstr (mw, valstr) +end |