[project @ 2001-04-02 16:10:32 by rrt]
[ghc-hetmet.git] / ghc / lib / std / cbits / stgio.h
index 8115b5e..9734281 100644 (file)
@@ -1,23 +1,21 @@
-/* 
- * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
+/* -----------------------------------------------------------------------------
+ * $Id: stgio.h,v 1.28 2001/04/02 16:10:33 rrt Exp $
  *
- * $Id: stgio.h,v 1.8 1998/12/02 13:27:58 simonm Exp $
+ * (c) The GRASP/AQUA Project, Glasgow University, 1994-1999
  *
  * Helper code for GHC's IO subsystem.
- */
+ *
+ * ---------------------------------------------------------------------------*/
 
 #ifndef STGIO_H
 #define STGIO_H
 
-#include "fileObject.h"
+#include "StgDLL.h"  /* for DLL_IMPORT_STDLIB */
 
-/* Decls for routines in ghc/lib/cbits/ only used there.
- * This file is used when compiling the Haskell library
- * that _ccalls_ those routines; and when compiling those
- * routines (to check consistency).
- */
+#include "stgerror.h"
+#include "fileObject.h"
 
-#include "error.h"
+/* Function prototypes for the I/O subsytem... */
 
 /* closeFile.c */
 StgAddr allocMemory__ (StgInt);
@@ -25,25 +23,6 @@ StgAddr allocMemory__ (StgInt);
 /* closeFile.c */
 StgInt closeFile (StgForeignPtr,StgInt);
 
-/* createDirectory.c */
-StgInt createDirectory (StgByteArray);
-
-/* directoryAux.c */
-StgAddr openDir__         (StgByteArray);
-StgAddr readDir__         (StgAddr);
-StgAddr get_dirent_d_name (StgAddr);
-StgWord get_stat_st_mode  (StgAddr);
-StgInt64 get_stat_st_mtime(StgAddr);
-void     set_stat_st_mtime(StgByteArray, StgByteArray);
-StgInt  sizeof_stat       (void);
-StgInt  prim_stat         (StgAddr,StgAddr);
-StgInt  const_F_OK        (void);
-StgWord const_S_IRUSR    (void);
-StgWord const_S_IWUSR    (void);
-StgWord const_S_IXUSR    (void);
-StgInt  prim_S_ISDIR     (StgWord);
-StgInt  prim_S_ISREG     (StgWord);
-
 /* echoAux.c */
 StgInt setTerminalEcho (StgForeignPtr, StgInt);
 StgInt getTerminalEcho (StgForeignPtr);
@@ -57,9 +36,9 @@ int   _setenv         (char *);
 int    delenv          (char *);
 
 /* errno.c */
-extern int ghc_errno;
-extern int ghc_errtype;
-extern char* ghc_errstr;
+DLL_IMPORT_STDLIB extern       int ghc_errno;
+DLL_IMPORT_STDLIB extern       int ghc_errtype;
+DLL_IMPORT_STDLIB extern       char* ghc_errstr;
 
 void   cvtErrno(void);
 void   stdErrno(void);
@@ -104,7 +83,7 @@ StgInt  fill_up_line_buffer(IOFileObject*);
 
 /* filePosn.c */
 StgInt getFilePosn (StgForeignPtr);
-StgInt setFilePosn (StgForeignPtr, StgInt);
+StgInt setFilePosn (StgForeignPtr, StgInt, StgByteArray);
 
 /* filePutc.c */
 StgInt filePutc    (StgForeignPtr, StgChar);
@@ -117,12 +96,12 @@ StgInt     fileSize_int64 (StgForeignPtr, StgByteArray);
 StgInt flushFile   (StgForeignPtr);
 StgInt flushBuffer (StgForeignPtr);
 StgInt flushReadBuffer (StgForeignPtr);
+void   flushConnectedBuf (StgForeignPtr);
 
 /* freeFile.c */
-void freeStdFile (StgForeignPtr);
-void freeFile (StgForeignPtr);
-void freeStdFileObject (StgForeignPtr);
-void freeFileObject (StgForeignPtr);
+void freeStdFile (StgAddr);
+void freeStdFileObject (StgAddr);
+void freeFileObject (StgAddr);
 
 StgAddr ref_freeStdFileObject (void);
 StgAddr ref_freeFileObject    (void);
@@ -130,22 +109,12 @@ StgAddr ref_freeFileObject    (void);
 /* getBufferMode.c */
 StgInt getBufferMode (StgForeignPtr);
 
-/* getClockTime.c */
-StgInt getClockTime (StgByteArray, StgByteArray);
-StgInt  prim_getClockTime(StgByteArray, StgByteArray);
-
 /* getCPUTime.c */
-StgByteArray getCPUTime (StgByteArray);
+StgInt getCPUTime (StgByteArray);
 StgInt clockTicks(void);
 
-/* getCurrentDirectory.c */
-StgAddr getCurrentDirectory(void);
-
-/* getDirectoryContents.c */
-StgAddr getDirectoryContents (StgByteArray);
-
 /* getLock.c */
-int     lockFile    (int, int);
+int     lockFile    (int, int, int);
 int     unlockFile  (int);
 StgInt getLock     (StgInt, StgInt);
 
@@ -153,9 +122,9 @@ StgInt      getLock     (StgInt, StgInt);
 StgInt inputReady  (StgForeignPtr, StgInt);
 
 /* openFile.c */
-IOFileObject* openFile    (StgByteArray, StgInt, StgInt, StgInt);
+IOFileObject* openFile    (StgByteArray, StgInt, StgInt);
 IOFileObject* openFd      (StgInt, StgInt, StgInt);
-IOFileObject* openStdFile (StgInt, StgInt, StgInt);
+IOFileObject* openStdFile (StgInt, StgInt);
 
 /* progargs.c */
 StgAddr get_prog_argv(void);
@@ -163,27 +132,18 @@ StgInt  get_prog_argc(void);
 
 /* readFile.c */
 StgInt readBlock (StgForeignPtr);
-StgInt readChunk (StgForeignPtr,StgAddr,StgInt);
+StgInt readChunk (StgForeignPtr,StgAddr,StgInt,StgInt);
 StgInt readLine  (StgForeignPtr);
 StgInt readChar  (StgForeignPtr);
 
-/* removeDirectory.c */
-StgInt removeDirectory (StgByteArray);
-
-/* removeFile.c */
-StgInt removeFile (StgByteArray);
-
-/* renameDirectory.c */
-StgInt renameDirectory (StgByteArray, StgByteArray);
-
-/* renameFile.c */
-StgInt renameFile (StgByteArray, StgByteArray);
-
 /* seekFile.c */
 StgInt seekFile  (StgForeignPtr, StgInt, StgInt, StgByteArray);
 StgInt seekFile_int64 (StgForeignPtr, StgInt, StgInt64);
 StgInt seekFileP (StgForeignPtr);
 
+/* setBinaryMode.c */
+StgInt setBinaryMode__ (StgForeignPtr, StgInt);
+
 /* setBuffering.c */
 StgInt setBuffering (StgForeignPtr, StgInt);
 StgInt  const_BUFSIZ (void);
@@ -192,47 +152,27 @@ StgInt  const_BUFSIZ (void);
 StgInt setCurrentDirectory (StgByteArray);
 
 /* showTime.c */
-StgAddr showTime (StgInt, StgByteArray, StgByteArray);
+StgInt showTime (StgInt, StgByteArray, StgInt, StgByteArray);
 
 /* system.c */
 StgInt systemCmd (StgByteArray);
 
-/* timezone.c */
-StgInt get_tm_sec   ( StgAddr );
-StgInt get_tm_min   ( StgAddr );
-StgInt get_tm_hour  ( StgAddr );
-StgInt get_tm_mday  ( StgAddr );
-StgInt get_tm_mon   ( StgAddr );
-StgInt get_tm_year  ( StgAddr );
-StgInt get_tm_wday  ( StgAddr );
-StgInt get_tm_yday  ( StgAddr );
-StgInt get_tm_isdst ( StgAddr );
-StgAddr prim_ZONE    ( StgAddr );
-StgInt prim_GMTOFF  ( StgAddr );
-StgInt prim_SETZONE ( StgAddr, StgAddr );
-StgInt sizeof_word      ( void ); 
-StgInt sizeof_struct_tm        ( void );
-StgInt sizeof_time_t    ( void );
-
-/* toLocalTime.c */
-StgAddr toLocalTime (StgInt, StgByteArray, StgByteArray);
-StgInt prim_toLocalTime ( StgInt64,StgByteArray );
-
-/* toUTCTime.c */
-StgAddr toUTCTime (StgInt, StgByteArray, StgByteArray);
-StgInt prim_toUTCTime ( StgInt64,StgByteArray );
-
-/* toClockSec.c */
-StgAddr toClockSec (StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgByteArray);
-StgInt prim_toClockSec(StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgInt, StgByteArray);
-
 /* writeError.c */
+StgAddr addrOf_ErrorHdrHook(void);
 void    writeErrString__ (StgAddr, StgByteArray, StgInt);
+
 /* writeFile.c */
-StgInt writeBuf  (StgForeignPtr, StgAddr, StgInt);
-StgInt writeBufBA  (StgForeignPtr, StgByteArray, StgInt);
+StgInt writeBuf  (StgForeignPtr, StgAddr, StgInt, StgInt);
+StgInt writeBufBA  (StgForeignPtr, StgByteArray, StgInt, StgInt);
 StgInt writeFileObject (StgForeignPtr, StgInt);
 StgInt writeBuffer (StgForeignPtr, StgInt);
+StgInt  write_ (StgForeignPtr ptr, StgAddr buf, StgInt len);
+
+/* tcSetAttr.c */
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+int tcSetAttr (int fd, int options, const struct termios *tp);
+#endif
 
 #endif /* ! STGIO_H */