aboutsummaryrefslogtreecommitdiff
path: root/sys/mwcs/mwgwattrs.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/mwcs/mwgwattrs.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mwcs/mwgwattrs.x')
-rw-r--r--sys/mwcs/mwgwattrs.x58
1 files changed, 58 insertions, 0 deletions
diff --git a/sys/mwcs/mwgwattrs.x b/sys/mwcs/mwgwattrs.x
new file mode 100644
index 00000000..3a5fbf80
--- /dev/null
+++ b/sys/mwcs/mwgwattrs.x
@@ -0,0 +1,58 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include "mwcs.h"
+
+# MW_GWATTRS -- Get the string value of the named WCS attribute for axis N.
+# If the attribute name is a number N, attribute number N is returned instead,
+# allowing the attributes to be listed without knowing their names.
+
+procedure mw_gwattrs (mw, axis, attribute, valstr, maxch)
+
+pointer mw #I pointer to MWCS descriptor
+int axis #I axis to which attribute belongs
+char attribute[SZ_ATNAME] #U attribute name
+char valstr[ARB] #O attribute value
+int maxch #I max chars to output value string
+
+pointer wp, ap
+int item, atno, i
+
+int ctoi()
+bool streq()
+errchk syserrs
+
+begin
+ # Get current WCS.
+ wp = MI_WCS(mw)
+ if (wp == NULL)
+ call syserrs (SYS_MWNOWCS, "mw_gwattrs")
+
+ # Get attribute number if number was given.
+ i = 1
+ if (ctoi (attribute, i, atno) == 0)
+ atno = 0
+
+ # Lookup the named or numbered attribute and output the value
+ # string if found.
+
+ item = 0
+ do i = 1, WCS_NWATTR(wp) {
+ ap = WCS_WATTR(wp,i)
+ if (AT_AXIS(ap) == axis) {
+ item = item + 1
+ if (atno > 0) {
+ if (atno == item) {
+ call strcpy (S(mw,AT_NAME(ap)), attribute, SZ_ATNAME)
+ call strcpy (S(mw,AT_VALUE(ap)), valstr, maxch)
+ return
+ }
+ } else if (streq (S(mw,AT_NAME(ap)), attribute)) {
+ call strcpy (S(mw,AT_VALUE(ap)), valstr, maxch)
+ return
+ }
+ }
+ }
+
+ call syserrs (SYS_MWWATTRNF, attribute)
+end