aboutsummaryrefslogtreecommitdiff
path: root/sys/fmio/fmlfard.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/fmio/fmlfard.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/fmio/fmlfard.x')
-rw-r--r--sys/fmio/fmlfard.x29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/fmio/fmlfard.x b/sys/fmio/fmlfard.x
new file mode 100644
index 00000000..2e463f72
--- /dev/null
+++ b/sys/fmio/fmlfard.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+include "fmio.h"
+
+# FM_LFAREAD -- Asynchronous blocked read from an lfile. The differences
+# between text and binary lfiles are not visible above this level; both
+# appear as binary files to FIO.
+
+procedure fm_lfaread (lf, buf, maxbytes, offset)
+
+pointer lf #I lfile descriptor
+char buf[ARB] #O output data buffer
+int maxbytes #I max bytes to read
+long offset #I lfile offset
+
+int status, nb
+
+begin
+ # If reading text data, unpack the text data in place.
+ if (and (LF_FLAGS(lf), LFF_TEXTFILE) != 0) {
+ nb = (maxbytes + SZB_CHAR-1) / SZB_CHAR
+ call fm_lfbinread (lf, buf, nb, (offset-1) / SZB_CHAR + 1)
+ call fm_lfbinwait (lf, status)
+ if (status > 0)
+ call chrupk (buf, 1, buf, 1, min(maxbytes,status))
+ } else
+ call fm_lfbinread (lf, buf, maxbytes, offset)
+end