diff --git a/clib/h/assert b/clib/h/assert index 966df43666dd8fb67310f8ac714fe3032902dd06..30f6536ea40f7b9ec0d4469bc39eb1409db604ee 100644 --- a/clib/h/assert +++ b/clib/h/assert @@ -14,10 +14,10 @@ */ #pragma force_top_level -/* assert.h: ISO 'C' (9899:1999) library header, section 7.2 */ +/* assert.h: ISO 'C' (9899:2018) library header, section 7.2 */ /* Copyright (C) Codemist Ltd. */ /* Copyright (C) Acorn Computers Ltd. 1991, 1992 */ -/* version 2.01 */ +/* version 2.02 */ /* * The assert macro puts diagnostics into programs. When it is executed, @@ -44,6 +44,9 @@ #else extern void __assert(const char *, const char *, int); extern void __assert2(const char *, const char *, const char *, int); +# if __STDC_VERSION__ >= 201112 +# define static_assert _Static_assert +# endif #endif #else # undef assert diff --git a/clib/h/complex b/clib/h/complex index 23295d6338b5aedf0c402588fa40a251e800b43c..23363f37d9fecbb0cd533ab58bc825b76327af86 100644 --- a/clib/h/complex +++ b/clib/h/complex @@ -15,9 +15,9 @@ #pragma force_top_level #pragma include_only_once -/* complex.h: ISO 'C' (9899:1999) library header, sections 7.3 and G.6 */ +/* complex.h: ISO 'C' (9899:2018) library header, sections 7.3 and G.6 */ /* Copyright (C) Acorn Computers Ltd. 2005 */ -/* version 1.00 */ +/* version 1.01 */ /* * The header <complex.h> defines macros and declares functions that support @@ -207,6 +207,11 @@ long double cimagl(long double complex /*z*/); #define cimagl(z) ((void) sizeof cimagl(z), (long double _Imaginary)(z)/_Imaginary_I) /* computes the imaginary part of z. */ /* Returns: the imaginary part value (as a real) */ +#define CMPLX(x,y) (double _Complex)((double)(x) + ___i * (double)(y)) +#define CMPLXF(x,y) (float _Complex)((float)(x) + ___i * (float)(y)) +#define CMPLXL(x,y) (long double _Complex)((long double)(x) + ___i * (long double)(y)) + /* an expression suitable for use as an initialiser for an object with */ + /* static or thread storage duration, with the complex value x + iy */ double complex conj(double complex /*z*/); float complex conjf(float complex /*z*/); long double complex conjl(long double complex /*z*/); diff --git a/clib/h/float b/clib/h/float index a764343968853c649a89680f38d92a691b72325e..72e88dc674cc8558f1f1bf4b90ac680f7a4a71ed 100644 --- a/clib/h/float +++ b/clib/h/float @@ -15,10 +15,10 @@ #pragma force_top_level #pragma include_only_once -/* float.h: ISO 'C' (9899 Dec 99) library header, section 5.2.4.2.2 */ +/* float.h: ISO 'C' (9899:2018) library header, section 5.2.4.2.2 */ /* Copyright (C) Codemist Ltd, 1988 */ /* Copyright (C) Acorn Computers Ltd. 1991, 1992 */ -/* version 3.00 */ +/* version 3.01 */ #ifndef __float_h #define __float_h @@ -54,15 +54,31 @@ * ? : all other negative values are implementation defined. */ +#define FLT_HAS_SUBNORM 1 +#define DBL_HAS_SUBNORM 1 +#define LDBL_HAS_SUBNORM 1 + /* + * The implementation's handling of subnormal numbers: + * -1 : indeterminable. + * 0 : absent (type does not support subnormal numbers) + * 1 : present (type does support subnormal numbers) + */ + #define FLT_MANT_DIG 24 #define DBL_MANT_DIG 53 #define LDBL_MANT_DIG 53 /* number of base-FLT_RADIX digits in the floating point mantissa */ -#define DECIMAL_DIG 17 +#define FLT_DECIMAL_DIG 9 +#define DBL_DECIMAL_DIG 17 +#define LDBL_DECIMAL_DIG 17 /* number of decimal digits required to hold a floating-point number */ /* accurately. */ +#define DECIMAL_DIG 17 + /* number of decimal digits required to hold a floating-point number */ + /* accurately in the widest supported type. */ + #define FLT_DIG 6 #define DBL_DIG 15 #define LDBL_DIG 15 @@ -107,6 +123,11 @@ #define LDBL_MIN 2.22507385850720138e-308L /* minimum normalised positive floating-point number. */ +#define FLT_TRUE_MIN 1.40129846e-45F +#define DBL_TRUE_MIN 4.94065645841246544e-324 +#define LDBL_TRUE_MIN 4.94065645841246544e-324L + /* minimum positive floating-point number. */ + #endif /* end of float.h */ diff --git a/clib/h/stdio b/clib/h/stdio index e3febb3d335700f6beb8ce63cad7e183a3d010d1..cecafb5b39e754c84c65385e08cccd8c9e41f1d6 100644 --- a/clib/h/stdio +++ b/clib/h/stdio @@ -15,10 +15,10 @@ #pragma force_top_level #pragma include_only_once -/* stdio.h: ISO 'C' (9899:1999) library header, section 7.19 */ +/* stdio.h: ISO 'C' (9899:2018) library header, section 7.21 */ /* Copyright (C) Codemist Ltd. */ /* Copyright (C) Acorn Computers Ltd., 1990, 1992 */ -/* version 3.03 */ +/* version 3.04 */ /* * stdio.h declares three types, several macros, and many functions for @@ -620,6 +620,7 @@ int (getchar)(void); * set and getchar returns EOF. If a read error occurs, the error * indicator is set and getchar returns EOF. */ +#if __STDC_VERSION__ < 201112 char *gets(char * /*s*/); /* * reads characters from the input stream pointed to by stdin into the array @@ -632,6 +633,7 @@ char *gets(char * /*s*/); * during the operation, the array contents are indeterminate and a * null pointer is returned. */ +#endif int __flsbuf(int /*c*/, FILE * /*stream*/); /* * SYSTEM USE ONLY, called by putc to flush buffer and or sort out flags. diff --git a/clib/h/wchar b/clib/h/wchar index 9c1ee6bcade7ec5ea84f93621ae0f1bccb7ff900..83488f034a9267277e1c2acfa15a0c349a7919a8 100644 --- a/clib/h/wchar +++ b/clib/h/wchar @@ -36,17 +36,20 @@ typedef unsigned int size_t; /* from <stddef.h> */ #endif -typedef struct __mbstate_t_struct -{ - wchar_t __c; // current character? - int __n; // pending bytes? - wchar_t __min; -} mbstate_t; +#ifndef __mbstate_t +# define __mbstate_t 1 + typedef struct __mbstate_struct + { + wchar_t __c; /* current character? */ + int __n; /* pending bytes? */ + wchar_t __min; + } mbstate_t; /* * an object type other than an array type that can hold the conversion * state information necessary to convert between sequences of multibyte * characters and wide characters */ +#endif typedef int wint_t; /* @@ -58,6 +61,7 @@ typedef int wint_t; struct tm; /* see <time.h> */ struct __FILE_struct; /* see <stdio.h> */ +typedef char *__va_listwc[1]; /* keep in step with <stdarg.h> */ #ifndef NULL # define NULL 0 /* see <stddef.h> */ @@ -185,7 +189,7 @@ int swscanf(const wchar_t * restrict /*s*/, */ #pragma -v0 /* back to default */ int vfwprintf(struct __FILE_struct * restrict /*stream*/, - const wchar_t * restrict /*format*/, __valist /*arg*/); + const wchar_t * restrict /*format*/, __va_listwc /*arg*/); /* * is equivalent to fwprintf, with the variable argument list replaced by * arg, which shall have been initialised by the va_start macro (and possibly @@ -195,7 +199,7 @@ int vfwprintf(struct __FILE_struct * restrict /*stream*/, * an output or encoding error occurred. */ int vfwscanf(struct __FILE_struct * restrict /*stream*/, - const wchar_t * restrict /*format*/, __valist /*arg*/); + const wchar_t * restrict /*format*/, __va_listwc /*arg*/); /* * is equivalent to fwscanf, with the variable argument list replaced by * arg, which shall have been initialised by the va_start macro (and possibly @@ -206,7 +210,7 @@ int vfwscanf(struct __FILE_struct * restrict /*stream*/, * of input items assigned, which can be fewer than provided for, * or even zero, in the event of an early matching failure. */ -int vwprintf(const wchar_t * restrict /*format*/, __valist /*arg*/); +int vwprintf(const wchar_t * restrict /*format*/, __va_listwc /*arg*/); /* * is equivalent to wprintf, with the variable argument list replaced by arg, * which shall have been initialised by the va_start macro (and possibly @@ -215,7 +219,7 @@ int vwprintf(const wchar_t * restrict /*format*/, __valist /*arg*/); * Returns: the number of wide characters transmitted, or a negative value if * an output or encoding error occurred. */ -int vwscanf(const wchar_t * restrict /*format*/, __valist /*arg*/); +int vwscanf(const wchar_t * restrict /*format*/, __va_listwc /*arg*/); /* * is equivalent to wscanf, with the variable argument list replaced by arg, * which shall have been initialised by the va_start macro (and possibly @@ -227,7 +231,7 @@ int vwscanf(const wchar_t * restrict /*format*/, __valist /*arg*/); * even zero, in the event of an early matching failure. */ int vswprintf(wchar_t * restrict /*s*/, size_t n, - const wchar_t * restrict /*format*/, __valist /*arg*/); + const wchar_t * restrict /*format*/, __va_listwc /*arg*/); /* * is equivalent to swprintf, with the variable argument list replaced by * arg, which shall have been initialised by the va_start macro (and possibly @@ -239,7 +243,7 @@ int vswprintf(wchar_t * restrict /*s*/, size_t n, * requested to be generated. */ int vswscanf(const wchar_t * restrict /*s*/, - const wchar_t * restrict /*format*/, __valist /*arg*/); + const wchar_t * restrict /*format*/, __va_listwc /*arg*/); /* * is equivalent to swscanf, with the variable argument list replaced by arg, * which shall have been initialised by the va_start macro (and possibly