2 * Rummage through the system header files using the C compiler itself
3 * as a parser, extracting stuff like preprocessor constants and the
4 * sizes and signedness of basic system types, and write it out as
10 #include <sys/times.h>
14 #define DEFTYPE(lispname,cname) { cname foo; \
15 printf("(def-alien-type "##lispname##" (%s %d))\n", (((foo=-1)<0) ? "sb!alien:signed" : "unsigned"), (8 * (sizeof foo))); }
18 defconstant(char* lisp_name, long unix_number)
20 printf("(defconstant %s %ld) ; #x%lx\n",
21 lisp_name, unix_number, unix_number);
25 main(int argc, char *argv[])
27 /* don't need no steenking command line arguments */
29 fprintf(stderr, "argh! command line argument(s)\n");
33 /* don't need no steenking hand-editing */
35 ";;;; This is an automatically generated file, please do not hand-edit it.
36 ;;;; See the program \"grovel_headers.c\".
40 printf("(in-package \"SB!UNIX\")\n\n");
42 printf(";;; types, types, types\n");
43 DEFTYPE("dev-t", dev_t);
44 DEFTYPE("ino-t", ino_t);
45 DEFTYPE("mode-t", mode_t);
46 DEFTYPE("nlink-t", nlink_t);
47 DEFTYPE("uid-t", uid_t);
48 DEFTYPE("gid-t", gid_t);
49 DEFTYPE("clock-t", clock_t);
50 DEFTYPE("off-t", off_t);
51 DEFTYPE("time-t", time_t);
54 printf(";;; fcntl.h\n");
55 defconstant("r_ok", R_OK);
56 defconstant("w_ok", W_OK);
57 defconstant("x_ok", X_OK);
58 defconstant("f_ok", F_OK);
61 printf(";;; fcntlbits.h\n");
62 defconstant("o_rdonly", O_RDONLY);
63 defconstant("o_wronly", O_WRONLY);
64 defconstant("o_rdwr", O_RDWR);
65 defconstant("o_accmode", O_ACCMODE);
66 defconstant("o_creat", O_CREAT);
67 defconstant("o_excl", O_EXCL);
68 defconstant("o_noctty", O_NOCTTY);
69 defconstant("o_trunc", O_TRUNC);
70 defconstant("o_append", O_APPEND);
72 defconstant( "s-ifmt", S_IFMT);
73 defconstant( "s-ififo", S_IFIFO);
74 defconstant( "s-ifchr", S_IFCHR);
75 defconstant( "s-ifdir", S_IFDIR);
76 defconstant( "s-ifblk", S_IFBLK);
77 defconstant( "s-ifreg", S_IFREG);
80 defconstant( "s-iflnk", S_IFLNK);
81 defconstant( "s-ifsock", S_IFSOCK);