alsa-seq-0.6: src/Sound/ALSA/Sequencer/Marshal/Template.h
#include <stdio.h>
#define hsc_alignment(t) \
printf("(%ld)", (unsigned long)offsetof(struct {char x__; t (y__); }, y__));
#define hsc_inttype(t) \
printf ("%s%lu", \
(t)(-1) < (t)0 ? "Int.Int" : "Word.Word", \
(unsigned long)sizeof (t) * 8); \
#define hsc_intfieldtype(r,f) \
{ \
r x, y; \
x.f = -1; \
y.f = 0; \
printf ("%s%lu", \
x.f < y.f ? "Int.Int" : "Word.Word", \
(unsigned long)sizeof (x.f) * 8); \
}
#define hsc_newinttype(nm,t) \
printf ("newtype "nm" = "nm" { un"nm" :: "); \
hsc_inttype(t); \
printf (" }\n"); \
printf (" deriving (Show, Eq, Ord, Ix, Storable)\n");
#define hsc_newintfieldtype(nm,r,f) \
printf ("newtype "nm" = "nm" { un"nm" :: "); \
hsc_intfieldtype(r,f); \
printf (" }\n"); \
printf (" deriving (Show, Eq, Ord, Ix, Storable)\n");