[project @ 2001-02-19 16:07:48 by rrt]
[ghc-hetmet.git] / ghc / lib / std / cbits / fileObject.h
index f41e8fd..def099d 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef FILEOBJECT_H
 #define FILEOBJECT_H
 
-/* a good idea? */
-#include <stdio.h>
-
 /*
   IOFileObjects are used as part of the IO.Handle
   implementation, ensuring that when handles are
@@ -16,6 +13,7 @@
 typedef struct _IOFileObject {
    int     fd;
    void*   buf;
+
    int     bufWPtr;  /* points to next position to write,
                          bufRPtr >= bufWPtr <= bufSize.
                          
@@ -31,19 +29,19 @@ typedef struct _IOFileObject {
 
                        bufRPtr == -1 => buffer is empty.
                     */
-   int     bufSize;
+   int     bufSize;  /* the size of the buffer, i.e. the number of bytes
+                        malloced */
    int     flags;
    struct _IOFileObject*   connectedTo;
+
 } IOFileObject;
 
-#define FILEOBJ_FLUSH    1
 #define FILEOBJ_LB       2
 #define FILEOBJ_BB       4
 #define FILEOBJ_EOF      8
 #define FILEOBJ_READ    16
 #define FILEOBJ_WRITE   32
 #define FILEOBJ_STD     64
-#define FILEOBJ_NONBLOCKING_IO 128
 /* The next two flags are used for RW file objects only.
    They indicate whether the last operation was a read or a write.
    (Need this info to determine whether a RW file object's
@@ -52,6 +50,12 @@ typedef struct _IOFileObject {
 */
 #define FILEOBJ_RW_READ 256
 #define FILEOBJ_RW_WRITE 512
+/* 
+ * Under Win32, a file fd is not the same as a socket fd, so
+ * we need to use separate r/w calls.
+ */ 
+#define FILEOBJ_WINSOCK  1024
+#define FILEOBJ_BINARY   2048
 
 #define FILEOBJ_IS_EOF(x)     ((x)->flags & FILEOBJ_EOF)
 #define FILEOBJ_SET_EOF(x)    ((x)->flags |= FILEOBJ_EOF)