aboutsummaryrefslogtreecommitdiff
path: root/noao/twodspec/apextract/apselect.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 /noao/twodspec/apextract/apselect.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
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