[project @ 1996-01-08 20:28:12 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)
40   I_ request_size;    /* in bytes */
41 {
42     fprintf(stderr, "malloc: failed on request for %lu bytes\n", request_size);
43 }
44 #endif /* 0 */
45
46 void
47 PatErrorHdrHook (where)
48   FILE *where;
49 {
50     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: ");
51 }
52
53 void
54 PreTraceHook (where)
55   FILE *where;
56 {
57     fprintf(where, "\n"); /* not "Trace On" */
58 }
59
60 void
61 PostTraceHook (where)
62   FILE *where;
63 {
64     fprintf(where, "\n"); /* not "Trace Off" */
65 }