diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/gio/stdgraph/stgclose.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/stdgraph/stgclose.x')
-rw-r--r-- | sys/gio/stdgraph/stgclose.x | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/gio/stdgraph/stgclose.x b/sys/gio/stdgraph/stgclose.x new file mode 100644 index 00000000..3d7eb70b --- /dev/null +++ b/sys/gio/stdgraph/stgclose.x @@ -0,0 +1,47 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "stdgraph.h" + +# STG_CLOSE -- Close the STDGRAPH kernel. Free all storage associated with the +# stdgraph descriptor. Note that the stdgraph kernel may be multiply opened +# (connected to two or more graphics steams, e.g., both STDGRAPH and STDIMAGE), +# hence we do not physically close down until the last stream is closed. + +procedure stg_close() + +include "stdgraph.com" + +begin + g_nopen = g_nopen - 1 + + if (g_nopen <= 0) { + call stg_deactivatews (0) + call flush (g_out) + call mfree (SG_SBUF(g_sg), TY_CHAR) + call mfree (g_sg, TY_STRUCT) + + if (g_tty != NULL) { + call ttycdes (g_tty) + g_tty = NULL + } + + if (g_term != NULL) { + call ttycdes (g_term) + g_term = NULL + } + + if (g_pbtty != NULL) { + call ttycdes (g_pbtty) + g_pbtty = NULL + } + + if (g_msgbuf != NULL) { + call mfree (g_msgbuf, TY_CHAR) + g_msgbuf = NULL + g_msgbuflen = 0 + g_msglen = 0 + } + + g_nopen = 0 + } +end |