[project @ 1998-11-26 09:17:22 by sof]
[ghc-hetmet.git] / ghc / lib / std / cbits / fileEOF.lc
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
3 %
4 \subsection[fileEOF.lc]{hIsEOF Runtime Support}
5
6 \begin{code}
7
8 #include "rtsdefs.h"
9 #include "stgio.h"
10
11 StgInt
12 fileEOF(ptr)
13 StgForeignObj ptr;
14 {
15     IOFileObject* fo = (IOFileObject*)ptr;
16
17     if ( FILEOBJ_IS_EOF(fo) )
18        return 1;
19
20     if (fileLookAhead(ptr) != EOF)
21         return 0;
22     else if (ghc_errtype == ERR_EOF)
23         return 1;
24     else
25         return -1;
26 }
27
28 \end{code}