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
9 * This software is part of the SBCL system. See the README file for
12 * While most of SBCL is derived from the CMU CL system, many
13 * utilities for the build process (like this one) were written from
14 * scratch after the fork from CMU CL.
16 * This software is in the public domain and is provided with
17 * absolutely no warranty. See the COPYING and CREDITS files for
22 #include <sys/types.h>
23 #include <sys/times.h>
28 #define DEFTYPE(lispname,cname) { cname foo; \
29 printf("(def-alien-type "##lispname##" (%s %d))\n", (((foo=-1)<0) ? "sb!alien:signed" : "unsigned"), (8 * (sizeof foo))); }
32 defconstant(char* lisp_name, long unix_number)
34 printf("(defconstant %s %ld) ; #x%lx\n",
35 lisp_name, unix_number, unix_number);
39 main(int argc, char *argv[])
41 /* don't need no steenking command line arguments */
43 fprintf(stderr, "argh! command line argument(s)\n");
47 /* don't need no steenking hand-editing */
49 ";;;; This is an automatically generated file, please do not hand-edit it.
50 ;;;; See the program \"grovel_headers.c\".
54 printf("(in-package \"SB!UNIX\")\n\n");
56 printf(";;; types, types, types\n");
57 DEFTYPE("dev-t", dev_t);
58 DEFTYPE("ino-t", ino_t);
59 DEFTYPE("mode-t", mode_t);
60 DEFTYPE("nlink-t", nlink_t);
61 DEFTYPE("uid-t", uid_t);
62 DEFTYPE("gid-t", gid_t);
63 DEFTYPE("clock-t", clock_t);
64 DEFTYPE("off-t", off_t);
65 DEFTYPE("time-t", time_t);
68 printf(";;; fcntl.h (or unistd.h on OpenBSD)\n");
69 defconstant("r_ok", R_OK);
70 defconstant("w_ok", W_OK);
71 defconstant("x_ok", X_OK);
72 defconstant("f_ok", F_OK);
75 printf(";;; fcntlbits.h\n");
76 defconstant("o_rdonly", O_RDONLY);
77 defconstant("o_wronly", O_WRONLY);
78 defconstant("o_rdwr", O_RDWR);
79 defconstant("o_accmode", O_ACCMODE);
80 defconstant("o_creat", O_CREAT);
81 defconstant("o_excl", O_EXCL);
82 defconstant("o_noctty", O_NOCTTY);
83 defconstant("o_trunc", O_TRUNC);
84 defconstant("o_append", O_APPEND);
86 defconstant( "s-ifmt", S_IFMT);
87 defconstant( "s-ififo", S_IFIFO);
88 defconstant( "s-ifchr", S_IFCHR);
89 defconstant( "s-ifdir", S_IFDIR);
90 defconstant( "s-ifblk", S_IFBLK);
91 defconstant( "s-ifreg", S_IFREG);
94 defconstant( "s-iflnk", S_IFLNK);
95 defconstant( "s-ifsock", S_IFSOCK);