From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/xtools/ranges/rgunion.x | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pkg/xtools/ranges/rgunion.x (limited to 'pkg/xtools/ranges/rgunion.x') diff --git a/pkg/xtools/ranges/rgunion.x b/pkg/xtools/ranges/rgunion.x new file mode 100644 index 00000000..5b9dfa6f --- /dev/null +++ b/pkg/xtools/ranges/rgunion.x @@ -0,0 +1,48 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include + +# RG_UNION -- Find the union of two sets of ranges. + +pointer procedure rg_union (rg1, rg2) + +pointer rg1 # First set of ranges +pointer rg2 # Second set of ranges + +pointer rg3 # Pointer to union + +int i, j + +begin + # Error check the range pointers. + + if ((rg1 == NULL) || (rg2 == NULL)) + call error (0, "Range descriptor(s) undefined") + + # Allocate the range points array. + + i = RG_NRGS(rg1) + RG_NRGS(rg2) + call malloc (rg3, LEN_RG + 2 * max (1, i), TY_STRUCT) + + # Set the ranges. + + RG_NRGS(rg3) = i + RG_NPTS(rg3) = RG_NPTS(rg1) + RG_NPTS(rg2) + + j = 1 + do i = 1, RG_NRGS(rg1) { + RG_X1(rg3, j) = RG_X1(rg1, i) + RG_X2(rg3, j) = RG_X2(rg1, i) + j = j + 1 + } + do i = 1, RG_NRGS(rg2) { + RG_X1(rg3, j) = RG_X1(rg2, i) + RG_X2(rg3, j) = RG_X2(rg2, i) + j = j + 1 + } + + call rgorder (rg3) + call rgmerge (rg3) + + return (rg3) +end -- cgit