X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tools-for-build%2Fgrovel-headers.c;h=a7600d9cc9dcc4e2c6f8bb97416e8da560134046;hb=51a1a3d4e4f174066958f40983c14abfb7116216;hp=a4943801bf978e460f3f56c8531c53da2781f2e4;hpb=074ba0606c687dbca4afc99e8e72e6f1a4486d24;p=sbcl.git diff --git a/tools-for-build/grovel-headers.c b/tools-for-build/grovel-headers.c index a494380..a7600d9 100644 --- a/tools-for-build/grovel-headers.c +++ b/tools-for-build/grovel-headers.c @@ -12,7 +12,7 @@ * While most of SBCL is derived from the CMU CL system, many * utilities for the build process (like this one) were written from * scratch after the fork from CMU CL. - * + * * This software is in the public domain and is provided with * absolutely no warranty. See the COPYING and CREDITS files for * more information. @@ -20,11 +20,25 @@ #include #include -#include +#ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN + #include + #include +#else + #include + #include + #include + #include + #ifdef __APPLE_CC__ + #include "../src/runtime/ppc-darwin-dlshim.h" + #include "../src/runtime/ppc-darwin-langinfo.h" + #else + #include + #include + #endif +#endif + #include -#include -#include -#include #include #include #include @@ -39,19 +53,26 @@ void defconstant(char* lisp_name, long unix_number) { printf("(defconstant %s %ld) ; #x%lx\n", - lisp_name, unix_number, unix_number); + lisp_name, unix_number, unix_number); } -#define DEFERRNO(name) defconstant(#name, name) -#define DEFSIGNAL(name) defconstant(#name, name) +void deferrno(char* lisp_name, long unix_number) +{ + defconstant(lisp_name, unix_number); +} + +void defsignal(char* lisp_name, long unix_number) +{ + defconstant(lisp_name, unix_number); +} int main(int argc, char *argv[]) { /* don't need no steenking command line arguments */ if (1 != argc) { - fprintf(stderr, "argh! command line argument(s)\n"); - exit(1); + fprintf(stderr, "argh! command line argument(s)\n"); + exit(1); } /* don't need no steenking hand-editing */ @@ -60,9 +81,24 @@ main(int argc, char *argv[]) ;;;; See the program \"grovel-headers.c\".\n\ \n\ "); +#ifdef _WIN32 + printf("(in-package \"SB!WIN32\")\n\n"); + + defconstant ("input-record-size", sizeof (INPUT_RECORD)); +#else + printf("(in-package \"SB!ALIEN\")\n\n"); + + printf (";;;flags for dlopen()\n"); + + defconstant ("rtld-lazy", RTLD_LAZY); + defconstant ("rtld-now", RTLD_NOW); + defconstant ("rtld-global", RTLD_GLOBAL); printf("(in-package \"SB!UNIX\")\n\n"); + printf(";;; langinfo\n"); + defconstant("codeset", CODESET); + printf(";;; types, types, types\n"); DEFTYPE("clock-t", clock_t); DEFTYPE("dev-t", dev_t); @@ -101,18 +137,18 @@ main(int argc, char *argv[]) defconstant("s-ifblk", S_IFBLK); defconstant("s-ifreg", S_IFREG); printf("\n"); - + defconstant("s-iflnk", S_IFLNK); defconstant("s-ifsock", S_IFSOCK); printf("\n"); printf(";;; error numbers\n"); - DEFERRNO(ENOENT); - DEFERRNO(EINTR); - DEFERRNO(EIO); - DEFERRNO(EEXIST); - DEFERRNO(ESPIPE); - DEFERRNO(EWOULDBLOCK); + deferrno("enoent", ENOENT); + deferrno("eintr", EINTR); + deferrno("eio", EIO); + deferrno("eexist", EEXIST); + deferrno("espipe", ESPIPE); + deferrno("ewouldblock", EWOULDBLOCK); printf("\n"); printf(";;; for wait3(2) in run-program.lisp\n"); @@ -156,48 +192,48 @@ main(int argc, char *argv[]) printf("\n"); printf(";;; signals\n"); - DEFSIGNAL(SIGALRM); - DEFSIGNAL(SIGBUS); - DEFSIGNAL(SIGCHLD); - DEFSIGNAL(SIGCONT); -/* FIXME: Maybe #ifdef SIGEMT would be a smarter conditional? */ -#if (!(defined LISP_FEATURE_LINUX) || !((defined LISP_FEATURE_PPC) || (defined LISP_FEATURE_X86))) - DEFSIGNAL(SIGEMT); + defsignal("sigalrm", SIGALRM); + defsignal("sigbus", SIGBUS); + defsignal("sigchld", SIGCHLD); + defsignal("sigcont", SIGCONT); +#ifdef SIGEMT + defsignal("sigemt", SIGEMT); #endif - DEFSIGNAL(SIGFPE); - DEFSIGNAL(SIGHUP); - DEFSIGNAL(SIGILL); - DEFSIGNAL(SIGINT); - DEFSIGNAL(SIGIO); - DEFSIGNAL(SIGIOT); - DEFSIGNAL(SIGKILL); - DEFSIGNAL(SIGPIPE); - DEFSIGNAL(SIGPROF); - DEFSIGNAL(SIGQUIT); - DEFSIGNAL(SIGSEGV); + defsignal("sigfpe", SIGFPE); + defsignal("sighup", SIGHUP); + defsignal("sigill", SIGILL); + defsignal("sigint", SIGINT); + defsignal("sigio", SIGIO); + defsignal("sigiot", SIGIOT); + defsignal("sigkill", SIGKILL); + defsignal("sigpipe", SIGPIPE); + defsignal("sigprof", SIGPROF); + defsignal("sigquit", SIGQUIT); + defsignal("sigsegv", SIGSEGV); #if ((defined LISP_FEATURE_LINUX) && (defined LISP_FEATURE_X86)) - DEFSIGNAL(SIGSTKFLT); + defsignal("sigstkflt", SIGSTKFLT); #endif - DEFSIGNAL(SIGSTOP); -#if (!((defined LISP_FEATURE_LINUX) && (defined LISP_FEATURE_X86))) - DEFSIGNAL(SIGSYS); + defsignal("sigstop", SIGSTOP); +#if (!((defined LISP_FEATURE_LINUX) && (defined LISP_FEATURE_X86))) + defsignal("sigsys", SIGSYS); #endif - DEFSIGNAL(SIGTERM); - DEFSIGNAL(SIGTRAP); - DEFSIGNAL(SIGTSTP); - DEFSIGNAL(SIGTTIN); - DEFSIGNAL(SIGTTOU); - DEFSIGNAL(SIGURG); - DEFSIGNAL(SIGUSR1); - DEFSIGNAL(SIGUSR2); - DEFSIGNAL(SIGVTALRM); + defsignal("sigterm", SIGTERM); + defsignal("sigtrap", SIGTRAP); + defsignal("sigtstp", SIGTSTP); + defsignal("sigttin", SIGTTIN); + defsignal("sigttou", SIGTTOU); + defsignal("sigurg", SIGURG); + defsignal("sigusr1", SIGUSR1); + defsignal("sigusr2", SIGUSR2); + defsignal("sigvtalrm", SIGVTALRM); #ifdef LISP_FEATURE_SUNOS - DEFSIGNAL(SIGWAITING); + defsignal("sigwaiting", SIGWAITING); #endif - DEFSIGNAL(SIGWINCH); + defsignal("sigwinch", SIGWINCH); #ifndef LISP_FEATURE_HPUX - DEFSIGNAL(SIGXCPU); - DEFSIGNAL(SIGXFSZ); + defsignal("sigxcpu", SIGXCPU); + defsignal("sigxfsz", SIGXFSZ); #endif +#endif // _WIN32 return 0; }