2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
4 \subsection[filePosn.lc]{hGetPosn and hSetPosn Runtime Support}
15 IOFileObject* fo = (IOFileObject*)ptr;
18 while ( (posn = lseek(fo->fd, 0, SEEK_CUR)) == -1) {
25 if (fo->flags & FILEOBJ_WRITE) {
27 } else if (fo->flags & FILEOBJ_READ) {
28 posn -= (fo->bufWPtr - fo->bufRPtr);
33 /* The following is only called with a position that we've already visited
34 (this is ensured by making the Haskell file posn. type abstract.)
37 setFilePosn(ptr, posn)
41 IOFileObject* fo = (IOFileObject*)ptr;
44 rc = flushBuffer(ptr);
45 if (rc < 0) return rc;
47 while (lseek(fo->fd, posn, SEEK_SET) == -1) {
54 FILEOBJ_CLEAR_EOF(fo);