diff options
Diffstat (limited to 'final_project/work/prhello-const.c')
-rw-r--r-- | final_project/work/prhello-const.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/final_project/work/prhello-const.c b/final_project/work/prhello-const.c new file mode 100644 index 0000000..4d5f3f5 --- /dev/null +++ b/final_project/work/prhello-const.c @@ -0,0 +1,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; +} |