[project @ 1998-08-14 12:07:18 by sof]
[ghc-hetmet.git] / ghc / compiler / parser / hschooks.c
index 7fb06bb..5f848fe 100644 (file)
@@ -5,15 +5,26 @@ in instead of the defaults.
 */
 #include <stdio.h>
 
+/* Included so as to bring the right prototypes into scope */
+#include "rtsdefs.h"
+
 #define W_ unsigned long int
 #define I_ long int
 
+#if __GLASGOW_HASKELL__ >= 303
+void
+ErrorHdrHook (long fd)
+{
+    char msg[]="\n";
+    write(fd,msg,1);
+}
+#else
 void
 ErrorHdrHook (FILE *where)
 {
     fprintf(where, "\n"); /* no "Fail: " */
 }
-
+#endif
 
 void
 OutOfHeapHook (W_ request_size, W_ heap_size)  /* both in bytes */
@@ -29,6 +40,31 @@ StackOverflowHook (I_ stack_size)    /* in bytes */
     fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
 }
 
+#if __GLASGOW_HASKELL__ >= 303
+void
+PatErrorHdrHook (long fd)
+{
+    const char msg[]="\n*** Pattern-matching error within GHC!\n\nThis is a compiler bug; please report it to glasgow-haskell-bugs@dcs.gla.ac.uk.\n\nFail:";
+    write(fd,msg,sizeof(msg)-1);
+}
+
+void
+PreTraceHook (long fd)
+{
+    const char msg[]="\n";
+    write(fd,msg,sizeof(msg)-1);
+}
+
+void
+PostTraceHook (long fd)
+{
+#if 0
+    const char msg[]="\n";
+    write(fd,msg,sizeof(msg)-1);
+#endif
+}
+
+#else
 void
 PatErrorHdrHook (FILE *where)
 {
@@ -46,3 +82,4 @@ PostTraceHook (FILE *where)
 {
     fprintf(where, "\n"); /* not "Trace Off" */
 }
+#endif