]> pd.if.org Git - pdclib/blob - internals/_PDCLIB_aux.h
a4e7a621e3565ec5457deeea061b273be519491f
[pdclib] / internals / _PDCLIB_aux.h
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* Auxiliary PDCLib code <_PDCLIB_aux.h>
6
7    This file is part of the Public Domain C Library (PDCLib).
8    Permission is granted to use, modify, and / or redistribute at will.
9 */
10
11 /* -------------------------------------------------------------------------- */
12 /* Standard Version                                                           */
13 /* -------------------------------------------------------------------------- */
14
15 /* Many a compiler gets this wrong, so you might have to hardcode it instead. */
16
17 #if __STDC__ != 1
18 #error Compiler does not define _ _STDC_ _ to 1 (not standard-compliant)!
19 #endif
20
21 #ifndef __STDC_VERSION__
22 #define _PDCLIB_C_VERSION 90
23 #define _PDCLIB_restrict
24 #define _PDCLIB_inline
25 #elif __STDC_VERSION__ == 199409L
26 #define _PDCLIB_C_VERSION 95
27 #define _PDCLIB_restrict
28 #define _PDCLIB_inline
29 #elif __STDC_VERSION__ == 199901L
30 #define _PDCLIB_C_VERSION 99
31 #define _PDCLIB_restrict restrict
32 #define _PDCLIB_inline inline
33 #else
34 #error Unsupported _ _STDC_VERSION_ _ (__STDC_VERSION__) (supported: ISO/IEC 9899:1990, 9899/AMD1:1995, and 9899:1999).
35 #endif
36
37 #ifndef __STDC_HOSTED__
38 #error Compiler does not define _ _STDC_HOSTED_ _ (not standard-compliant)!
39 #elif __STDC_HOSTED__ == 0
40 #define _PDCLIB_HOSTED 0
41 #elif __STDC_HOSTED__ == 1
42 #define _PDCLIB_HOSTED 1
43 #else
44 #error Compiler does not define _ _STDC_HOSTED_ _ to 0 or 1 (not standard-compliant)!
45 #endif
46
47 #if _PDCLIB_C_VERSION != 99
48 #error PDCLib might not be fully conforming to either C89 or C95 prior to v2.x.
49 #endif
50
51 /* -------------------------------------------------------------------------- */
52 /* Helper macros:                                                             */
53 /* _PDCLIB_cc( x, y ) concatenates two preprocessor tokens without extending  */
54 /* _PDCLIB_concat( x, y ) concatenates two preprocessor tokens with extending */
55 /* -------------------------------------------------------------------------- */
56
57 #define _PDCLIB_cc( x, y )     x ## y
58 #define _PDCLIB_concat( x, y ) _PDCLIB_cc( x, y )
59
60 #define _PDCLIB_symbol2value( x ) #x
61 #define _PDCLIB_symbol2string( x ) _PDCLIB_symbol2value( x )
62 #define _PDCLIB_symbol2identity( x ) x
63
64 /* -------------------------------------------------------------------------- */
65 /* Internal data types                                                        */
66 /* -------------------------------------------------------------------------- */
67
68 /* Structure required by both atexit() and exit() for handling atexit functions */
69 struct _PDCLIB_exitfunc_t
70 {
71     struct _PDCLIB_exitfunc_t * next;
72     void (*func)( void );
73 };