1 #if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ < 409
11 #define offsetof(t, f) ((size_t) &((t *)0)->f)
15 #define hsc_line(line, file) \
16 printf ("# %d \"%s\"\n", line, file);
18 #define hsc_line(line, file) \
19 printf ("{-# LINE %d \"%s\" #-}\n", line, file);
22 #define hsc_const(x) \
24 printf ("%ld", (long)(x)); \
26 printf ("%lu", (unsigned long)(x));
28 #define hsc_const_str(x) \
30 const char *s = (x); \
34 if (*s == '"' || *s == '\\') \
35 printf ("\\%c", *s); \
36 else if (*s >= 0x20 && *s <= 0x7E) \
41 s[1] >= '0' && s[1] <= '9' ? "\\&" : ""); \
48 if ((t)(int)(t)1.4 == (t)1.4) \
50 (t)(-1) < (t)0 ? "Int" : "Word", \
54 sizeof (t) > sizeof (double) ? "LDouble" : \
55 sizeof (t) == sizeof (double) ? "Double" : \
58 #define hsc_peek(t, f) \
59 printf ("(\\hsc_ptr -> peekByteOff hsc_ptr %ld)", (long) offsetof (t, f));
61 #define hsc_poke(t, f) \
62 printf ("(\\hsc_ptr -> pokeByteOff hsc_ptr %ld)", (long) offsetof (t, f));
64 #define hsc_ptr(t, f) \
65 printf ("(\\hsc_ptr -> hsc_ptr `plusPtr` %ld)", (long) offsetof (t, f));