aboutsummaryrefslogtreecommitdiff
path: root/sys/mwcs/mwclose.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 /sys/mwcs/mwclose.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mwcs/mwclose.x')
-rw-r--r--sys/mwcs/mwclose.x36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/mwcs/mwclose.x b/sys/mwcs/mwclose.x
new file mode 100644
index 00000000..441a78c2
--- /dev/null
+++ b/sys/mwcs/mwclose.x
@@ -0,0 +1,36 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <error.h>
+include "mwcs.h"
+
+# MW_CLOSE -- Close a MWCS descriptor and deallocate all resources used
+# by the descriptor. Any CTRAN descriptors which have been opened on
+# the MWCS are automatically closed if not already manually closed by
+# the application.
+
+procedure mw_close (mw)
+
+pointer mw #U pointer to MWCS descriptor
+
+int i
+pointer ct
+
+begin
+ # Free any still allocated CTRAN descriptors.
+ do i = 1, MAX_CTRAN {
+ ct = MI_CTRAN(mw,i)
+ if (ct != NULL)
+ iferr (call mw_ctfree (ct))
+ call erract (EA_WARN)
+ }
+
+ # Free the string and data buffers.
+ if (MI_SBUF(mw) != NULL)
+ call mfree (MI_SBUF(mw), TY_CHAR)
+ if (MI_DBUF(mw) != NULL)
+ call mfree (MI_DBUF(mw), TY_DOUBLE)
+
+ # Free the main descriptor.
+ call mfree (mw, TY_STRUCT)
+end