[project @ 1996-01-11 14:06:51 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / hschooks.c
1 /*
2 These routines customise the error messages
3 for various bits of the RTS.  They are linked
4 in instead of the defaults.
5 */
6 #include <stdio.h>
7
8 #define W_ unsigned long int
9 #define I_ long int
10
11 void
12 ErrorHdrHook (where)
13   FILE *where;
14 {
15     fprintf(where, "\n"); /* no "Fail: " */
16 }
17
18
19 void
20 OutOfHeapHook (request_size, heap_size)
21   W_ request_size; /* in bytes */
22   W_ heap_size;    /* in bytes */
23 {
24     fprintf(stderr, "GHC's heap exhausted;\nwhile trying to allocate %lu bytes in a %lu-byte heap;\nuse the `-H<size>' option to increase the total heap size.\n",
25         request_size,
26         heap_size);
27 }
28
29 void
30 StackOverflowHook (stack_size)
31   I_ stack_size;    /* in bytes */
32 {
33     fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
34 }
35
36 #if 0
37 /* nothing to add here, really */
38 void
39 MallocFailHook (request_size, msg)
40   I_ request_size;    /* in bytes */
41   char *msg;
42 {
43     fprintf(stderr, "malloc: failed on request for %lu bytes\n", request_size);
44 }
45 #endif /* 0 */
46
47 void
48 PatErrorHdrHook (where)
49   FILE *where;
50 {
51     fprintf(where, "\n*** Pattern-matching error within GHC!\n\nThis is a compiler bug; please report it to glasgow-haskell-bugs@dcs.glasgow.ac.uk.\n\nFail: ");
52 }
53
54 void
55 PreTraceHook (where)
56   FILE *where;
57 {
58     fprintf(where, "\n"); /* not "Trace On" */
59 }
60
61 void
62 PostTraceHook (where)
63   FILE *where;
64 {
65     fprintf(where, "\n"); /* not "Trace Off" */
66 }