aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/gki/gkiwesc.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/gio/gki/gkiwesc.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/gki/gkiwesc.x')
-rw-r--r--sys/gio/gki/gkiwesc.x59
1 files changed, 59 insertions, 0 deletions
diff --git a/sys/gio/gki/gkiwesc.x b/sys/gio/gki/gkiwesc.x
new file mode 100644
index 00000000..bd4c8571
--- /dev/null
+++ b/sys/gio/gki/gkiwesc.x
@@ -0,0 +1,59 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <config.h>
+include <gki.h>
+
+# GKI_WESCAPE -- Write a GKI escape instruction, used to pass device
+# dependent instructions on to a graphics kernel. This version of gki_escape
+# is used in cases where the escape instruction consists of the escape header
+# followed by a block of data, and it is inconvenient to have to combine the
+# header and the data into one array.
+#
+# BOI GKI_ESCAPE L FN N DC
+#
+# L(i) 5 + N
+# FN(i) escape function code
+# N(i) number of escape data words
+# DC(i) escape data words
+
+procedure gki_wescape (fd, fn, hdr, hdrlen, data, datalen)
+
+int fd #I output file
+int fn #I escape function code
+short hdr[ARB] #I escape instruction header
+int hdrlen #I header length, shorts
+short data[ARB] #I escape instruction data
+int datalen #I data length, shorts
+
+pointer sp, buf
+int epa, nwords
+short gki[GKI_ESCAPE_LEN]
+data gki[1] /BOI/, gki[2] /GKI_ESCAPE/
+include "gki.com"
+
+begin
+ nwords = hdrlen + datalen
+
+ if (IS_INLINE(fd)) {
+ call smark (sp)
+ call salloc (buf, nwords, TY_SHORT)
+
+ call amovs (hdr, Mems[buf], hdrlen)
+ call amovs (data, Mems[buf+hdrlen], datalen)
+
+ epa = gk_dd[GKI_ESCAPE]
+ if (epa != 0)
+ call zcall3 (epa, fn, Mems[buf], nwords)
+
+ call sfree (sp)
+
+ } else {
+ gki[GKI_ESCAPE_L] = GKI_ESCAPE_LEN + nwords
+ gki[GKI_ESCAPE_N] = nwords
+ gki[GKI_ESCAPE_FN] = fn
+
+ call write (gk_fd[fd], gki, GKI_ESCAPE_LEN * SZ_SHORT)
+ call write (gk_fd[fd], hdr, hdrlen * SZ_SHORT)
+ call write (gk_fd[fd], data, datalen * SZ_SHORT)
+ }
+end