From 70f1c6f7c9d515ef426da68973511f46de57005a Mon Sep 17 00:00:00 2001 From: solar Date: Wed, 3 Dec 2003 04:44:55 +0000 Subject: [PATCH] Started introducting "personality". --- includes/complex.h | 5 ++++- includes/errno.h | 2 ++ includes/fenv.h | 2 ++ includes/float.h | 2 ++ includes/inttypes.h | 2 ++ includes/limits.h | 49 +++++++++++++++++++++++++++------------------ includes/math.h | 42 ++++++++++++++++++++------------------ includes/setjmp.h | 11 +++++----- includes/signal.h | 22 +++++++++++--------- includes/stdarg.h | 2 +- includes/stddef.h | 10 +++++---- includes/stdint.h | 4 ++++ includes/stdio.h | 8 +++++--- includes/stdlib.h | 8 ++++++-- includes/string.h | 4 +++- includes/tgmath.h | 2 ++ includes/time.h | 12 ++++++----- includes/wchar.h | 18 +++++++++-------- includes/wctype.h | 8 +++++--- 19 files changed, 130 insertions(+), 83 deletions(-) diff --git a/includes/complex.h b/includes/complex.h index d4cc9ea..6e7ac5e 100644 --- a/includes/complex.h +++ b/includes/complex.h @@ -10,6 +10,8 @@ #ifndef __COMPLEX_H #define __COMPLEX_H __COMPLEX_H +#include "personality.h" + // ---------------------------------------------------------------------------- // DEFINES @@ -19,8 +21,9 @@ #define _Complex_I ( const float _Complex ) { 0, 1 } -// TODO: imaginary is only defined if implementation supports _Imaginary. +#ifdef __PERSONALITY_SUPPORTS_IMAGINARY #define imaginary _Imaginary +#endif // __PERSONALITY_SUPPORTS_IMAGINARY #ifdef imaginary #define _Imaginary_I ( ( const float _Imaginary ) 1 ) diff --git a/includes/errno.h b/includes/errno.h index 0569284..e85d302 100644 --- a/includes/errno.h +++ b/includes/errno.h @@ -10,6 +10,8 @@ #ifndef __ERRNO_H #define __ERRNO_H __ERRNO_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // DECLARATIONS diff --git a/includes/fenv.h b/includes/fenv.h index 33e8bea..b6c11a0 100644 --- a/includes/fenv.h +++ b/includes/fenv.h @@ -10,6 +10,8 @@ #ifndef __FENV_H #define __FENV_H __FENV_H +// TODO: Documentation, checking for personality + // ---------------------------------------------------------------------------- // MACROS diff --git a/includes/float.h b/includes/float.h index a23f324..2a5a836 100644 --- a/includes/float.h +++ b/includes/float.h @@ -10,6 +10,8 @@ #ifndef __FLOAT_H #define __FLOAT_H __FLOAT_H +// This file is part of the platform personality (see personality.txt). + #define FLT_RADIX // TODO #define FLT_ROUNDS // TODO #define FLT_EVAL_METHOD // TODO diff --git a/includes/inttypes.h b/includes/inttypes.h index 4f9f9ce..2b4eafe 100644 --- a/includes/inttypes.h +++ b/includes/inttypes.h @@ -10,6 +10,8 @@ #ifndef __INTTYPES_H #define __INTTYPES_H __INTTYPES_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // TYPEDEFS diff --git a/includes/limits.h b/includes/limits.h index 302eb3a..7d14a93 100644 --- a/includes/limits.h +++ b/includes/limits.h @@ -10,35 +10,46 @@ #ifndef __LIMITS_H #define __LIMITS_H __LIMITS_H +// ISO/IEC 9899:1999, ยง5.2.4.2.1 +// The values given below shall be replaced by constant expressions suitable +// for use in #if preprocessing directives. Moreover, except for CHAR_BIT and +// MB_LEN_MAX, the following shall be replaced by expressions that have the +// same type as would an expression that is an object of the corresponding type +// converted according to the integer promotions. Their implementation-defined +// values shall be equal or greater in magnitude (absolute value) to those +// shown, with the same sign. + +// This file is part of the platform personality (see personality.txt). + // Limits of type 'char' -#define CHAR_BIT // TODO -#define CHAR_MAX // TODO -#define CHAR_MIN // TODO -#define SCHAR_MAX // TODO -#define SCHAR_MIN // TODO -#define UCHAR_MAX // TODO +#define CHAR_BIT // 8 +#define CHAR_MAX // SCHAR_MAX / UCHAR_MAX +#define CHAR_MIN // SCHAR_MIN / 0 +#define SCHAR_MAX // +127 +#define SCHAR_MIN // -127 +#define UCHAR_MAX // 255 (2^CHAR_BIT - 1) // Multibyte characters -#define MB_LEN_MAX // TODO +#define MB_LEN_MAX // 1 // Limits of type 'short int' -#define SHRT_MAX // TODO -#define SHRT_MIN // TODO -#define USHRT_MAX // TODO +#define SHRT_MAX // +32767 +#define SHRT_MIN // -32767 +#define USHRT_MAX // 65535 // Limits of type 'int' -#define INT_MAX // TODO -#define INT_MIN // TODO -#define UINT_MAX // TODO +#define INT_MAX // +32767 +#define INT_MIN // -32767 +#define UINT_MAX // 65535 // Limits of type 'long int' -#define LONG_MAX // TODO -#define LONG_MIN // TODO -#define ULONG_MAX // TODO +#define LONG_MAX // +2147483647 +#define LONG_MIN // -2147483647 +#define ULONG_MAX // 4294967295 // Limits of type 'long long int' -#define LLONG_MAX // TODO -#define LLONG_MIN // TODO -#define ULLONG_MAX // TODO +#define LLONG_MAX // +9223372036854775807 +#define LLONG_MIN // -9223372036854775807 +#define ULLONG_MAX // 18446744073709551615 #endif // __LIMITS_H diff --git a/includes/math.h b/includes/math.h index a3252b2..ee4dff7 100644 --- a/includes/math.h +++ b/includes/math.h @@ -10,38 +10,40 @@ #ifndef __MATH_H #define __MATH_H __MATH_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // DEFINES -#define HUGE_VAL // TODO -#define HUGE_VALF // TODO -#define HUGE_VALL // TODO +#define HUGE_VAL // TODO - personality? +#define HUGE_VALF // TODO - personality? +#define HUGE_VALL // TODO - personality? -#define INFINITY // TODO -#define NAN // TODO +#define INFINITY // TODO - personality? +#define NAN // TODO - personality? -#define FP_FAST_FMA // TODO -#define FP_FAST_FMAF // TODO -#define FP_FAST_FMAL // TODO +#define FP_FAST_FMA // TODO - personality? +#define FP_FAST_FMAF // TODO - personality? +#define FP_FAST_FMAL // TODO - personality? -#define FP_INFINITE // TODO -#define FP_NAN // TODO -#define FP_NORMAL // TODO -#define FP_SUBNORMAL // TODO -#define FP_ZERO // TODO +#define FP_INFINITE // TODO - personality? +#define FP_NAN // TODO - personality? +#define FP_NORMAL // TODO - personality? +#define FP_SUBNORMAL // TODO - personality? +#define FP_ZERO // TODO - personality? -#define FP_ILOGB0 // TODO -#define FP_ILOGBNAN // TODO +#define FP_ILOGB0 // TODO - personality? +#define FP_ILOGBNAN // TODO - personality? -#define MATH_ERRNO 1 -#define MATH_ERREXCEPT 2 -#define math_errhandling // TODO +#define MATH_ERRNO 1 // personality? +#define MATH_ERREXCEPT 2 // personality? +#define math_errhandling // TODO - personality? // -------------------------------------------------------------------------- // TYPEDEFS -typedef double_t; // TODO -typedef float_t; // TODO +typedef double_t; // TODO - personality? +typedef float_t; // TODO - personality? // -------------------------------------------------------------------------- // MACROS diff --git a/includes/setjmp.h b/includes/setjmp.h index dda36ea..cb938a9 100644 --- a/includes/setjmp.h +++ b/includes/setjmp.h @@ -10,18 +10,17 @@ #ifndef __SETJMP_H #define __SETJMP_H __SETJMP_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // TYPEDEFS -struct jmp_buf[1]; +struct jmp_buf[1]; // TODO // ---------------------------------------------------------------------------- // FUNCTIONS -// TODO -int setjmp(jmp_buf env); - -// TODO -void longjmp(jmp_buf env, int val); +int setjmp( jmp_buf env ); +void longjmp( jmp_buf env, int val ); #endif // __SETJMP_H diff --git a/includes/signal.h b/includes/signal.h index bfc9888..3f51685 100644 --- a/includes/signal.h +++ b/includes/signal.h @@ -10,23 +10,25 @@ #ifndef __SIGNAL_H #define __SIGNAL_H __SIGNAL_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // MACROS -#define SIGABRT // TODO -#define SIGFPE // TODO -#define SIGILL // TODO -#define SIGINT // TODO -#define SIGSEGV // TODO -#define SIGTERM // TODO -#define SIG_DFL // TODO -#define SIG_ERR // TODO -#define SIG_IGN // TODO +#define SIGABRT // TODO - personality? +#define SIGFPE // TODO - personality? +#define SIGILL // TODO - personality? +#define SIGINT // TODO - personality? +#define SIGSEGV // TODO - personality? +#define SIGTERM // TODO - personality? +#define SIG_DFL // TODO - personality? +#define SIG_ERR // TODO - personality? +#define SIG_IGN // TODO - personality? // ---------------------------------------------------------------------------- // TYPEDEFS -typedef sig_atomic_t; // TODO +typedef sig_atomic_t; // TODO - personality? // ---------------------------------------------------------------------------- // FUNCTIONS diff --git a/includes/stdarg.h b/includes/stdarg.h index 4c40142..5d22705 100644 --- a/includes/stdarg.h +++ b/includes/stdarg.h @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------- // TYPEDEFS -typedef do-type va_list; +typedef do-type va_list; // TODO // ---------------------------------------------------------------------------- // MACROS diff --git a/includes/stddef.h b/includes/stddef.h index 32bfb32..1c138c7 100644 --- a/includes/stddef.h +++ b/includes/stddef.h @@ -10,20 +10,22 @@ #ifndef __STDDEF_H #define __STDDEF_H __STDDEF_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // MACROS #define NULL 0 -#define offsetof( s-type, mbr ) // TODO +#define offsetof( s-type, mbr ) // TODO - personality? // ---------------------------------------------------------------------------- // TYPEDEFS -typedef ptrdiff_t; // TODO -typedef size_t; // TODO +typedef ptrdiff_t; // TODO - personality? +typedef size_t; // TODO - personality? #ifndef __cplusplus -typedef wchar_t; +typedef wchar_t; // TODO - personality? #endif // __cplusplus #endif // __STDDEF_H diff --git a/includes/stdint.h b/includes/stdint.h index ef21b9c..4b2a757 100644 --- a/includes/stdint.h +++ b/includes/stdint.h @@ -10,6 +10,10 @@ #ifndef __STDINT_H #define __STDINT_H __STDINT_H +// This file is part of the platform personality (see personality.txt). + +// TODO: Documentation + // ---------------------------------------------------------------------------- // TYPEDEFS diff --git a/includes/stdio.h b/includes/stdio.h index 5469de0..a4049eb 100644 --- a/includes/stdio.h +++ b/includes/stdio.h @@ -10,6 +10,8 @@ #ifndef __STDIO_H #define __STDIO_H __STDIO_H +// TODO: Documentation, checking macros for personality + // ---------------------------------------------------------------------------- // MACROS @@ -34,9 +36,9 @@ // ---------------------------------------------------------------------------- // TYPEDEFS -typedef FILE; // TODO -typedef fpos_t; // TODO -typedef size_t; // TODO +typedef FILE; // TODO - personality? +typedef fpos_t; // TODO - personality? +typedef size_t; // TODO - personality? // ---------------------------------------------------------------------------- // FUNCTIONS diff --git a/includes/stdlib.h b/includes/stdlib.h index c0efa68..610f71c 100644 --- a/includes/stdlib.h +++ b/includes/stdlib.h @@ -10,6 +10,8 @@ #ifndef __STDLIB_H #define __STDLIB_H __STDLIB_H +// TODO: Documentation, C++ handling + // ---------------------------------------------------------------------------- // MACROS @@ -39,10 +41,10 @@ typedef struct long long remainder; } lldiv_t; -typedef size_t; // TODO +typedef size_t; // TODO - personality? #ifndef __cplusplus -typedef wchar_t; // TODO +typedef wchar_t; // TODO - personality? #endif // __cplusplus // ---------------------------------------------------------------------------- @@ -115,4 +117,6 @@ __cppwrapper( int atexit( void (*func) ( void ) ) { /* TODO */ }; ) __cppwrapper( void * bsearch( const void * key, const void * base, size_t nelem, size_t size, int (*cmp) ( const void * ck, const void * ce) ) { /* TODO */ }; ) __cppwrapper( void qsort( void * base, size_t nelem, size_t size, int (*cmp) ( const void * e1, const void * e2) ) { /* TODO */ }; ) +#undef __cppwrapper + #endif // __STDLIB_H diff --git a/includes/string.h b/includes/string.h index 2fa5284..c6ebcd3 100644 --- a/includes/string.h +++ b/includes/string.h @@ -10,6 +10,8 @@ #ifndef __STRING_H #define __STRING_H __STRING_H +// TODO: Documentation, C++ handling + // ---------------------------------------------------------------------------- // MACROS @@ -18,7 +20,7 @@ // ---------------------------------------------------------------------------- // TYPEDEFS -typedef size_t; +typedef size_t; // TODO - personality? // ---------------------------------------------------------------------------- // FUNCTIONS diff --git a/includes/tgmath.h b/includes/tgmath.h index 503107d..dc3125d 100644 --- a/includes/tgmath.h +++ b/includes/tgmath.h @@ -10,6 +10,8 @@ #ifndef __TGMATH_H #define __TGMATH_H __TGMATH_H +// TODO: Generics support, C++ handling + #include #include diff --git a/includes/time.h b/includes/time.h index db2eb7c..bc5742c 100644 --- a/includes/time.h +++ b/includes/time.h @@ -10,19 +10,21 @@ #ifndef __TIME_H #define __TIME_H __TIME_H +// TODO: Documentation. + // ---------------------------------------------------------------------------- // MACROS -#define CLOCKS_PER_SEC // TODO +#define CLOCKS_PER_SEC // TODO - personality? #define NULL 0 // ---------------------------------------------------------------------------- // TYPES -typedef clock_t; -typedef size_t; -typedef time_t; -struct tm; +typedef clock_t; // TODO - personality? +typedef size_t; // TODO - personality? +typedef time_t; // TODO - personality? +struct tm; // TODO - personality? // ---------------------------------------------------------------------------- // FUNCTIONS diff --git a/includes/wchar.h b/includes/wchar.h index 4ac64c5..300b0f0 100644 --- a/includes/wchar.h +++ b/includes/wchar.h @@ -10,24 +10,26 @@ #ifndef __WCHAR_H #define __WCHAR_H __WCHAR_H +// TODO: Documentation, C++ handling + // ---------------------------------------------------------------------------- // MACROS #define NULL 0 -#define WCHAR_MAX // TODO -#define WCHAR_MIN // TODO -#define WEOF // TODO +#define WCHAR_MAX // TODO - personality? +#define WCHAR_MIN // TODO - personality? +#define WEOF // TODO - personality? // ---------------------------------------------------------------------------- // TYPEDEFS -typedef mbstate_t; -typedef size_t; -typedef wint_t; -struct tm; +typedef mbstate_t; // TODO - personality? +typedef size_t; // TODO - personality? +typedef wint_t; // TODO - personality? +struct tm; // TODO - personality? #ifndef __cplusplus -typedef wchar_t; +typedef wchar_t; // TODO - personality? #endif // __cplusplus // ---------------------------------------------------------------------------- diff --git a/includes/wctype.h b/includes/wctype.h index 32485b9..1c50bfc 100644 --- a/includes/wctype.h +++ b/includes/wctype.h @@ -10,12 +10,14 @@ #ifndef __WCTYPE_H #define __WCTYPE_H __WCTYPE_H +// TODO: Documentation + // ---------------------------------------------------------------------------- // TYPEDEFS -typedef wctrans_t; -typedef wctype_t; -typedef wint_t; +typedef wctrans_t; // TODO - personality? +typedef wctype_t; // TODO - personality? +typedef wint_t; // TODO - personality? // ---------------------------------------------------------------------------- // FUNCTIONS -- 2.40.0