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 /noao/onedspec/smw/smwclose.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/onedspec/smw/smwclose.x')
-rw-r--r-- | noao/onedspec/smw/smwclose.x | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/noao/onedspec/smw/smwclose.x b/noao/onedspec/smw/smwclose.x new file mode 100644 index 00000000..339ebd98 --- /dev/null +++ b/noao/onedspec/smw/smwclose.x @@ -0,0 +1,46 @@ +include <smw.h> + + +# SMW_CLOSE -- Close the SMW data structure. +# This includes closing the MWCS pointers. + +procedure smw_close (smw) + +pointer smw # SMW pointer + +int i +pointer apids + +begin + if (smw == NULL) + return + + switch (SMW_FORMAT(smw)) { + case SMW_ND: + call mfree (SMW_APID(smw), TY_CHAR) + call mw_close (SMW_MW(smw,0)) + case SMW_ES: + call mfree (SMW_APS(smw), TY_INT) + call mfree (SMW_BEAMS(smw), TY_INT) + call mfree (SMW_APLOW(smw), TY_REAL) + call mfree (SMW_APHIGH(smw), TY_REAL) + call mfree (SMW_APID(smw), TY_CHAR) + apids = SMW_APIDS(smw) - 1 + do i = 1, SMW_NSPEC(smw) + call mfree (Memi[apids+i], TY_CHAR) + call mfree (SMW_APIDS(smw), TY_POINTER) + call mw_close (SMW_MW(smw,0)) + case SMW_MS: + call mfree (SMW_APS(smw), TY_INT) + call mfree (SMW_BEAMS(smw), TY_INT) + call mfree (SMW_APLOW(smw), TY_REAL) + call mfree (SMW_APHIGH(smw), TY_REAL) + call mfree (SMW_APID(smw), TY_CHAR) + apids = SMW_APIDS(smw) - 1 + do i = 1, SMW_NSPEC(smw) + call mfree (Memi[apids+i], TY_CHAR) + do i = 0, SMW_NMW(smw)-1 + call mw_close (SMW_MW(smw,i)) + } + call mfree (smw, TY_STRUCT) +end |