From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/gio/stdgraph/stgclose.x | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sys/gio/stdgraph/stgclose.x (limited to 'sys/gio/stdgraph/stgclose.x') 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 -- cgit