diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/fio/ffilbf.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/fio/ffilbf.x')
-rw-r--r-- | sys/fio/ffilbf.x | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/fio/ffilbf.x b/sys/fio/ffilbf.x new file mode 100644 index 00000000..8948ce89 --- /dev/null +++ b/sys/fio/ffilbf.x @@ -0,0 +1,37 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <config.h> +include <fio.h> + +# FFILBF -- Called by FFAULT to fill the file buffer for a binary file. + +procedure ffilbf (fd, bp, bufsize, buffer_offset) + +int fd, bufsize +pointer bp +bool at_eof, stream_dev +long buffer_offset +errchk fwatio +include <fio.com> + +begin + fp = fiodes[fd] + + if (FBUFMODE(fp) != INACTIVE) + call fwatio (fd) + + # If streaming device, read unconditionally, otherwise if + # positioned at EOF, initialize buffer pointers and return, + # else initiate read to fill buffer from file and return. + + stream_dev = (FBLKSIZE(fp) == 0) + at_eof = (FILSIZE(fp) >= 0 && buffer_offset > FILSIZE(fp)) + + if (!stream_dev && at_eof) { + itop[fd] = bufptr[fd] + otop[fd] = bufptr[fd] + } else { + call aread (fd, Memc[bp], bufsize, buffer_offset) + FBUFMODE(fp) = READ_IN_PROGRESS + } +end |