00001 /* The <ansi.h> header attempts to decide whether the compiler has enough 00002 * conformance to Standard C for Minix to take advantage of. If so, the 00003 * symbol _ANSI is defined (as 31459). Otherwise _ANSI is not defined 00004 * here, but it may be defined by applications that want to bend the rules. 00005 * The magic number in the definition is to inhibit unnecessary bending 00006 * of the rules. (For consistency with the new '#ifdef _ANSI" tests in 00007 * the headers, _ANSI should really be defined as nothing, but that would 00008 * break many library routines that use "#if _ANSI".) 00009 00010 * If _ANSI ends up being defined, a macro 00011 * 00012 * _PROTOTYPE(function, params) 00013 * 00014 * is defined. This macro expands in different ways, generating either 00015 * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie) 00016 * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc 00017 * in such a way that they are portable over both ANSI and K&R compilers. 00018 * The appropriate macros are defined here. 00019 */ 00020 00021 #ifndef _ANSI_H 00022 #define _ANSI_H 00023 00024 #if __STDC__ == 1 00025 #define _ANSI 31459 /* compiler claims full ANSI conformance */ 00026 #endif 00027 00028 #ifdef __GNUC__ 00029 #define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */ 00030 #endif 00031 00032 #ifdef _ANSI 00033 00034 /* Keep everything for ANSI prototypes. */ 00035 #define _PROTOTYPE(function, params) function params 00036 #define _ARGS(params) params 00037 00038 #define _VOIDSTAR void * 00039 #define _VOID void 00040 #define _CONST const 00041 #define _VOLATILE volatile 00042 #define _SIZET size_t 00043 00044 #else 00045 00046 /* Throw away the parameters for K&R prototypes. */ 00047 #define _PROTOTYPE(function, params) function() 00048 #define _ARGS(params) () 00049 00050 #define _VOIDSTAR void * 00051 #define _VOID void 00052 #define _CONST 00053 #define _VOLATILE 00054 #define _SIZET int 00055 00056 #endif /* _ANSI */ 00057 00058 /* This should be defined as restrict when a C99 compiler is used. */ 00059 #define _RESTRICT 00060 00061 /* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies 00062 * _POSIX_SOURCE. (Seems wrong to put this here in ANSI space.) 00063 */ 00064 #if defined(_MINIX) || _POSIX_C_SOURCE > 0 || defined(_POSIX2_SOURCE) 00065 #undef _POSIX_SOURCE 00066 #define _POSIX_SOURCE 1 00067 #endif 00068 00069 #endif /* ANSI_H */
1.4.6