aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/nsppkern/writeb.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/nsppkern/writeb.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/nsppkern/writeb.x')
-rw-r--r--sys/gio/nsppkern/writeb.x40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/gio/nsppkern/writeb.x b/sys/gio/nsppkern/writeb.x
new file mode 100644
index 00000000..dfcd82bb
--- /dev/null
+++ b/sys/gio/nsppkern/writeb.x
@@ -0,0 +1,40 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include <error.h>
+include "gkt.h"
+
+.help writeb
+.nf ___________________________________________________________________________
+WRITEB -- Write an NCAR metacode record. Always write a full record
+regardless of the buffer length; any data beyond buflen is undefined.
+If the buffer length is passed as zero, the metafile standard wants us to
+write a full (zeroed) record and backspace over it, to signify end of
+metafile if the physical metafile is subsequently closed. Instead of
+writing the EOF record here, we leave that to the FIO close routine
+for the graphics device.
+.endhelp ______________________________________________________________________
+
+procedure writeb (metacode_buffer, buflen, mbunit)
+
+int metacode_buffer # LOC pointer to metacode buffer
+int buflen # number of words of metacode data
+int mbunit # FIO file descriptor !! from nspp common !!
+
+int dummy[1], offset
+int loci()
+include "gkt.com"
+
+begin
+ if (buflen <= 0)
+ return
+
+ # Standard NCAR pointer technique for accessing integer arrays. This
+ # assumes alignment of integer variables. Convert to use IRAF
+ # pointers if this causes problems.
+
+ offset = metacode_buffer - loci (dummy) + 1
+
+ iferr (call write (mbunit, dummy[offset], SZ_MFRECORD))
+ call erract (EA_FATAL)
+end