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 /sys/mwcs/mwctfree.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/mwcs/mwctfree.x')
-rw-r--r-- | sys/mwcs/mwctfree.x | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/mwcs/mwctfree.x b/sys/mwcs/mwctfree.x new file mode 100644 index 00000000..e495320b --- /dev/null +++ b/sys/mwcs/mwctfree.x @@ -0,0 +1,44 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "mwcs.h" + +# MW_CTFREE -- Free a CTRAN (coordinate transformation) descriptor. We keep +# track of all allocated CTRAN descriptors in the parent MWCS descriptor, and +# NULL the saved entry for a descriptor when it is freed, thus guaranteeing +# that a descriptor will be freed only once. + +procedure mw_ctfree (ct) + +pointer ct #U pointer to CTRAN descriptor + +int fn, i, j +pointer mw, fc +include "mwcs.com" + +begin + if (ct != NULL) { + mw = CT_MW(ct) + if (mw != NULL) + do i = 1, MAX_CTRAN + if (MI_CTRAN(mw,i) == ct) { + # Free private storage for any input WCS functions. + do j = 1, CT_NCALLI(ct) { + fc = CT_FCI(ct,j) + fn = WF_FN(FC_WF(fc)) + if (FN_DESTROY(fn) != NULL) + call zcall1 (FN_DESTROY(fn), fc) + } + # Free private storage for any output WCS functions. + do j = 1, CT_NCALLO(ct) { + fc = CT_FCO(ct,j) + fn = WF_FN(FC_WF(fc)) + if (FN_DESTROY(fn) != NULL) + call zcall1 (FN_DESTROY(fn), fc) + } + # Free the main CTRAN descriptor. + call mfree (ct, TY_STRUCT) + MI_CTRAN(mw,i) = NULL + break + } + } +end |