aboutsummaryrefslogtreecommitdiff
path: root/noao/twodspec/apextract/apselect.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/twodspec/apextract/apselect.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/twodspec/apextract/apselect.x')
-rw-r--r--noao/twodspec/apextract/apselect.x40
1 files changed, 40 insertions, 0 deletions
diff --git a/noao/twodspec/apextract/apselect.x b/noao/twodspec/apextract/apselect.x
new file mode 100644
index 00000000..47730f47
--- /dev/null
+++ b/noao/twodspec/apextract/apselect.x
@@ -0,0 +1,40 @@
+include "apertures.h"
+
+define NRANGES 100
+
+
+# AP_SELECT -- Select apertures.
+# The AP_SELECT field of the aperture structure is set.
+
+procedure ap_select (apertures, aps, naps)
+
+char apertures[ARB] #I Aperture selection string
+pointer aps[ARB] #U Aperture pointers
+int naps #I Number of apertures
+
+pointer sp, ranges
+int i, decode_ranges()
+bool is_in_range()
+
+begin
+ # Check if apertures are defined.
+ if (naps < 1)
+ return
+
+ call smark (sp)
+ call salloc (ranges, 3*NRANGES, TY_INT)
+
+ # Decode aperture string.
+ if (decode_ranges (apertures, Memi[ranges], NRANGES, i) == ERR)
+ call error (0, "Bad aperture list")
+
+ # Select apertures.
+ do i = 1, naps {
+ if (is_in_range (Memi[ranges], AP_ID(aps[i])))
+ AP_SELECT(aps[i]) = YES
+ else
+ AP_SELECT(aps[i]) = NO
+ }
+
+ call sfree (sp)
+end