X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2Fstgdefs.h;h=7170d42490524ffde46e6a85b1f391b89d3c81bc;hb=cb6085ec18ece0ad37cebb3cd9ac22ee65b59c29;hp=d6d7f660296c9413f12466014b37c5823cccbfdc;hpb=a7e6cdbfc4f27c2e0ab9c12ebe6431c246c74c6d;p=ghc-hetmet.git diff --git a/ghc/includes/stgdefs.h b/ghc/includes/stgdefs.h index d6d7f66..7170d42 100644 --- a/ghc/includes/stgdefs.h +++ b/ghc/includes/stgdefs.h @@ -5,7 +5,7 @@ #define STGDEFS_H /* machine/compiler/system dependencies :-( Must be first! */ -#include "platform.h" /* generated by configure */ +/* OLD: #include "platform.h" generated by configure */ #include "config.h" /* generated by configure */ #include "error.h" #include "StgMachDeps.h" @@ -33,17 +33,51 @@ void _stgAssert PROTO((char *, unsigned int)); #define NON_POSIX_SOURCE #endif +/* If _NEXT_SOURCE is defined, certain header files make more + * constants visible to us. + * Perhaps it would have been wise, also to define NON_POSIX_SOURCE. + * Things seemed to work better without it however, so I have not + * done it. Nevertheless we do the signal stuff in a NON_POSIX way, + * see StgMacros.lh. + * CaS + */ +#ifdef nextstep3_TARGET_OS +#define _NEXT_SOURCE +#endif + +#ifdef aix_TARGET_OS +/* for fd_set */ +#include +#endif + #ifdef NON_POSIX_SOURCE #undef _POSIX_SOURCE #undef _POSIX_C_SOURCE #else +# ifndef aix_TARGET_OS +/* already defined on aix */ #define _POSIX_SOURCE 1 +# endif +#ifndef irix_TARGET_OS #define _POSIX_C_SOURCE 199301L -/* Alphas set _POSIX_VERSION (unistd.h) */ -/* ditto _POSIX2_C_VERSION - _POSIX2_VERSION - _POSIX_4SOURCE +#else +/* defines contributed by Tomasz Cholewo + ( this is with gcc-2.7.2 for irix-6.{2.3} ) .. hopefully they will not + upset anything under irix5 .. + */ +#define _POSIX_C_SOURCE 199309L +#define __EXTENSIONS__ +#endif +/* Bogus use of non-existent variable POSIX_C_SOURCE in the supplied header files + for gcc-2.7.1 on Solaris forces us to define it: (this strikes when using st_atime + and friends in ) */ + +#if (__GNUC__ == 2) && (__GNUC_MINOR__ == 7) +/* sigh, not possible to get at bugfix release number (fixed in 2.7.2) */ +#define POSIX_C_SOURCE _POSIX_C_SOURCE +#endif + #include #include #endif @@ -62,47 +96,29 @@ void _stgAssert PROTO((char *, unsigned int)); GCC is schizophrenic about whether it adds these into its own headers for you; so we have no choice but to throw them in. */ -extern int fclose PROTO((FILE *)); -extern int fflush PROTO((FILE *)); -extern int fgetc PROTO((FILE *)); -/* extern int fgetpos PROTO((FILE *, fpos_t *)); */ -extern int fprintf PROTO((FILE *, const char *, ...)); -extern int fputc PROTO((int, FILE *)); -extern int fputs PROTO((const char *, FILE *)); -extern size_t fread PROTO((void *, size_t, size_t, FILE *)); -extern int fscanf PROTO((FILE *, const char *, ...)); -extern int fseek PROTO((FILE *, long int, int)); -/* extern int fsetpos PROTO((FILE *, const fpos_t *)); */ -extern size_t fwrite PROTO((const void *, size_t, size_t, FILE *)); -extern void perror PROTO((const char *)); -extern int printf PROTO((const char *, ...)); -extern int puts PROTO((const char *)); -extern int remove PROTO((const char *)); -extern int rename PROTO((const char *, const char *)); -extern void rewind PROTO((FILE *)); -extern int scanf PROTO((const char *, ...)); -extern void setbuf PROTO((FILE *, char *)); -extern int setvbuf PROTO((FILE *, char *, int, size_t)); -extern int sscanf PROTO((const char *, const char *, ...)); +int fclose PROTO((FILE *)); +int fflush PROTO((FILE *)); +int fgetc PROTO((FILE *)); +int fprintf PROTO((FILE *, const char *, ...)); +int fputc PROTO((int, FILE *)); +int fputs PROTO((const char *, FILE *)); +size_t fread PROTO((void *, size_t, size_t, FILE *)); +int fscanf PROTO((FILE *, const char *, ...)); +int fseek PROTO((FILE *, long int, int)); +size_t fwrite PROTO((const void *, size_t, size_t, FILE *)); +void perror PROTO((const char *)); +int printf PROTO((const char *, ...)); +int puts PROTO((const char *)); +int remove PROTO((const char *)); +int rename PROTO((const char *, const char *)); +void rewind PROTO((FILE *)); +int scanf PROTO((const char *, ...)); +void setbuf PROTO((FILE *, char *)); +int setvbuf PROTO((FILE *, char *, int, size_t)); +int sscanf PROTO((const char *, const char *, ...)); /* end of hack */ #endif /* STDC_HEADERS */ -/* - * threadWaitWrite# uses FD_SETSIZE to distinguish - * between read file descriptors and write fd's. - * Hence we need to include , but - * is this the best place to do it? - * (the following has been moved from libposix.h) - */ - -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ - -#ifndef FD_SETSIZE -#define FD_SETSIZE 1024 -#endif - #if ! defined(EXIT_SUCCESS) || ! defined(EXIT_FAILURE) /* "stdlib.h" should have defined these; but at least on SunOS 4.1.3, this is not so. @@ -195,20 +211,22 @@ char * time_str(STG_NO_ARGS); #endif /* declarations for runtime-system entry points */ -extern void miniInterpret PROTO((StgFunPtr)); -extern void miniInterpret_debug PROTO(( StgFunPtr, void(*)(STG_NO_ARGS) )); -extern void miniInterpretEnd(STG_NO_ARGS); - -extern StgFunPtr evaluateMain(STG_NO_ARGS); -extern StgFunPtr returnMain(STG_NO_ARGS); -extern StgFunPtr impossible_jump_after_switch(STG_NO_ARGS); +void miniInterpret PROTO((StgFunPtr)); +void miniInterpret_debug PROTO(( StgFunPtr, void(*)(STG_NO_ARGS) )); +void miniInterpretEnd(STG_NO_ARGS); + +/* UNUSED -- SOF 9/97 +StgFunPtr evaluateMain(STG_NO_ARGS); +StgFunPtr returnMain(STG_NO_ARGS); +StgFunPtr impossible_jump_after_switch(STG_NO_ARGS); +*/ /* hooks: user might write some of their own */ void ErrorHdrHook PROTO((FILE *)); -void OutOfHeapHook PROTO((W_)); +void OutOfHeapHook PROTO((W_, W_)); void StackOverflowHook PROTO((I_)); #ifdef CONCURRENT -void NoRunnableThreadsHook (STG_NO_ARGS); +int NoRunnableThreadsHook (STG_NO_ARGS); #endif void MallocFailHook PROTO((I_, char *)); void PatErrorHdrHook PROTO((FILE *)); @@ -252,4 +270,25 @@ char *stgMallocWords PROTO((I_, char *)); /* Saving and restoring registers */ #include "StgRegs.h" + +/* + * threadWaitWrite# uses FD_SETSIZE to distinguish + * between read file descriptors and write fd's. + * Hence we need to include , but + * is this the best place to do it? + * (the following has been moved from libposix.h) + */ + +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ + +#ifndef FD_SETSIZE +# ifdef __FD_SETSIZE +# define FD_SETSIZE __FD_SETSIZE +# else /* cop out */ +# define FD_SETSIZE 1024 +# endif +#endif + #endif /* ! STGDEFS_H */