summaryrefslogtreecommitdiffstats
path: root/final_project/work/prhello-const.c
blob: 4d5f3f532d2fb4d628f05fe559b0cba8602004cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* -*-C-*- */

/* Prefix */
#include <gtk/gtk.h>
/* End Prefix */

void
grovel_basics (FILE * out)
{
  fprintf (out, "   ((sizeof char) . %d)\n", sizeof (char));
  fprintf (out, "   ((sizeof uchar) . %d)\n", sizeof (unsigned char));
  fprintf (out, "   ((sizeof short) . %d)\n", sizeof (short));
  fprintf (out, "   ((sizeof ushort) . %d)\n", sizeof (unsigned short));
  fprintf (out, "   ((sizeof int) . %d)\n", sizeof (int));
  fprintf (out, "   ((sizeof uint) . %d)\n", sizeof (unsigned int));
  fprintf (out, "   ((sizeof long) . %d)\n", sizeof (long));
  fprintf (out, "   ((sizeof ulong) . %d)\n", sizeof (unsigned long));
  fprintf (out, "   ((sizeof float) . %d)\n", sizeof (float));
  fprintf (out, "   ((sizeof double) . %d)\n", sizeof (double));
  fprintf (out, "   ((sizeof *) . %d)\n", sizeof (void*));
}

void
grovel_enums (FILE * out)
{
  fprintf (out, "   (|GTK_WINDOW_POPUP| . %ld)\n", ((long)GTK_WINDOW_POPUP));
  fprintf (out, "   (|GTK_WINDOW_TOPLEVEL| . %ld)\n", ((long)GTK_WINDOW_TOPLEVEL));
}

int
main (void)
{
  FILE * out = fopen ("prhello-const.scm", "w");
  if (out == NULL) {
    perror ("could not open prhello-const.scm");
    return 1;
  }
  fprintf (out, "'( ;; prhello constants\n");
  fprintf (out, "  ( ;; enum member values\n");
  grovel_enums(out);
  fprintf (out, "   )\n");
  fprintf (out, "  ( ;; struct values\n");
  grovel_basics(out);
  fprintf (out, "   ))\n");
  if (fclose (out)) {
    perror ("could not close prhello-const.scm");
    return 1;
  }
  return 0;
}