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