2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: filePosn.c,v 1.3 1998/12/02 13:27:27 simonm Exp $
6 * hGetPosn and hSetPosn Runtime Support
16 IOFileObject* fo = (IOFileObject*)ptr;
19 while ( (posn = lseek(fo->fd, 0, SEEK_CUR)) == -1) {
26 if (fo->flags & FILEOBJ_WRITE) {
28 } else if (fo->flags & FILEOBJ_READ) {
29 posn -= (fo->bufWPtr - fo->bufRPtr);
34 /* The following is only called with a position that we've already visited
35 (this is ensured by making the Haskell file posn. type abstract.)
38 setFilePosn(ptr, posn)
42 IOFileObject* fo = (IOFileObject*)ptr;
45 rc = flushBuffer(ptr);
46 if (rc < 0) return rc;
48 while (lseek(fo->fd, posn, SEEK_SET) == -1) {
55 FILEOBJ_CLEAR_EOF(fo);