% % (c) The GRASP/AQUA Project, Glasgow University, 1994 % \subsection[fileEOF.lc]{hIsEOF Runtime Support} \begin{code} #include "rtsdefs.h" #include "stgio.h" StgInt fileEOF(ptr) StgForeignObj ptr; { IOFileObject* fo = (IOFileObject*)ptr; if ( FILEOBJ_IS_EOF(fo) ) return 1; if (fileLookAhead(ptr) != EOF) return 0; else if (ghc_errtype == ERR_EOF) return 1; else return -1; } \end{code}