[project @ 1998-08-14 10:50:30 by sof]
authorsof <unknown>
Fri, 14 Aug 1998 10:50:32 +0000 (10:50 +0000)
committersof <unknown>
Fri, 14 Aug 1998 10:50:32 +0000 (10:50 +0000)
Hooks now take a file descriptor, not a FILE

ghc/runtime/hooks/ErrorHdr.lc
ghc/runtime/hooks/IOErrorHdr.lc
ghc/runtime/hooks/PatErrorHdr.lc
ghc/runtime/hooks/TraceHooks.lc

index 3c04fec..9e32f4b 100644 (file)
@@ -2,10 +2,9 @@
 #include "rtsdefs.h"
 
 void
-ErrorHdrHook (FILE *where)
+ErrorHdrHook (StgInt fd)
 {
-    fflush( stdout );                  /* Flush out any pending output */
-
-    fprintf(where, "\nFail: ");
+    const char msg[]="\nFail: ";
+    write(fd,msg,sizeof(msg)-1);
 }
 \end{code}
index 73676f5..1c8e545 100644 (file)
@@ -2,10 +2,9 @@
 #include "rtsdefs.h"
 
 void
-IOErrorHdrHook (FILE *where)
+IOErrorHdrHook (StgInt fd)
 {
-    fflush( stdout );                  /* Flush out any pending output */
-
-    fprintf(where, "\nI/O error: ");
+    const char msg[]="\nI/O error: ";
+    write(fd, msg, sizeof(msg)-1);
 }
 \end{code}
index 2382049..11c4632 100644 (file)
@@ -2,10 +2,9 @@
 #include "rtsdefs.h"
 
 void
-PatErrorHdrHook (FILE *where)
+PatErrorHdrHook (StgInt fd)
 {
-    fflush( stdout );                  /* Flush out any pending output */
-
-    fprintf(where, "\nFail: ");
+    const char msg[]="\nFail: ";
+    write(fd,msg,sizeof(msg)-1);
 }
 \end{code}
index 67b7ea3..fc0e60e 100644 (file)
@@ -2,14 +2,21 @@
 #include "rtsdefs.h"
 
 void
-PreTraceHook (FILE *where)
+PreTraceHook (StgInt fd)
 {
-    fprintf(where, "Trace On:\n");
+/* By default, a trace msg doesn't have a header (nor a footer) */
+#if 0
+    const char msg[]="Trace On:\n";
+    write(fd,msg,sizeof(msg)-1);
+#endif
 }
 
 void
-PostTraceHook (FILE *where)
+PostTraceHook (StgInt fd)
 {
-    fprintf(where, "\nTrace Off.\n");
+#if 0
+    const char msg[]="\nTrace Off.\n";
+    write(fd,msg,sizeof(msg)-1);
+#endif
 }
 \end{code}