aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/stdgraph/stgctrl.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/gio/stdgraph/stgctrl.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/gio/stdgraph/stgctrl.x')
-rw-r--r--sys/gio/stdgraph/stgctrl.x82
1 files changed, 82 insertions, 0 deletions
diff --git a/sys/gio/stdgraph/stgctrl.x b/sys/gio/stdgraph/stgctrl.x
new file mode 100644
index 00000000..6689de8a
--- /dev/null
+++ b/sys/gio/stdgraph/stgctrl.x
@@ -0,0 +1,82 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include "stdgraph.h"
+
+define SZ_PROGRAM 256
+
+# STG_CTRL -- Fetch an encoder format string from the graphcap entry and
+# use it to encode zero, one, or two integer arguments into a control string.
+# Put the control string to the output device.
+
+procedure stg_ctrl (cap)
+
+char cap[ARB] # name of device capability to be encoded
+pointer sp, prog
+int stg_encode(), ttygets()
+include "stdgraph.com"
+
+begin
+ call smark (sp)
+ call salloc (prog, SZ_PROGRAM, TY_CHAR)
+
+ # Fetch the program from the graphcap file. Zero is returned if the
+ # device does not have the named capability, in which case the function
+ # is inapplicable and should be ignored.
+
+ if (ttygets (g_tty, cap, Memc[prog], SZ_PROGRAM) > 0) {
+ # Encode the output string and write the encoded string to the
+ # output file.
+ g_reg[E_IOP] = 1
+ if (stg_encode (Memc[prog], g_mem, g_reg) == OK) {
+ g_mem[g_reg[E_IOP]] = EOS
+ call ttyputs (g_out, g_tty, g_mem, 1)
+ }
+ }
+
+ call sfree (sp)
+end
+
+
+# STG_CTRL1 -- Encode one integer argument.
+
+procedure stg_ctrl1 (cap, arg1)
+
+char cap[ARB] # device capability
+int arg1
+include "stdgraph.com"
+
+begin
+ g_reg[1] = arg1
+ call stg_ctrl (cap)
+end
+
+
+# STG_CTRL2 -- Encode two integer arguments.
+
+procedure stg_ctrl2 (cap, arg1, arg2)
+
+char cap[ARB] # device capability
+int arg1, arg2
+include "stdgraph.com"
+
+begin
+ g_reg[1] = arg1
+ g_reg[2] = arg2
+ call stg_ctrl (cap)
+end
+
+
+# STG_CTRL3 -- Encode three integer arguments.
+
+procedure stg_ctrl3 (cap, arg1, arg2, arg3)
+
+char cap[ARB] # device capability
+int arg1, arg2, arg3
+include "stdgraph.com"
+
+begin
+ g_reg[1] = arg1
+ g_reg[2] = arg2
+ g_reg[3] = arg3
+ call stg_ctrl (cap)
+end