mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added isunordered(), isgreater(), isgreaterequal(), isless(),
islessequal() and islessgreater() to <math.h> for C99. - The wchar_t type is now an 'unsigned short' integer (16 bits wide). - Added PTRDIFF_MIN/PTRDIFF_MAX, WCHAR_MIN/WCHAR_MAX and WINT_MIN/WINT_MAX to <stdint.h> for C99. - Added imaxdiv() and imaxabs() for C99. - Added strtoimax() and strtoumax() for C99. - Added nextafter() and nextafterf() for C99. - Added copysign() and copysignf() for C99. - Unless I missed something, clib2 should now be functionally complete with regard to C99, except for the floating point operations covered. These are a major challenge all by themselves, and I wonder both whether they are worth the effort and how one could implement them correctly. - fflush() now consistently supports a NULL parameter, causing all streams to be flushed for which this behaviour is defined. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14943 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.53 2005-05-11 20:15:24 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.54 2005-05-12 13:21:41 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -156,6 +156,10 @@ C_LIB = \
|
||||
fcntl_write.o \
|
||||
ftw_ftw.o \
|
||||
ftw_nftw.o \
|
||||
inttypes_imaxdiv.o \
|
||||
inttypes_imaxabs.o \
|
||||
inttypes_strtoimax.o \
|
||||
inttypes_strtoumax.o \
|
||||
libgen_basename.o \
|
||||
libgen_dirname.o \
|
||||
locale_init_exit.o \
|
||||
@ -522,6 +526,8 @@ MATH_LIB = \
|
||||
math_ceil.o \
|
||||
math_cos.o \
|
||||
math_cosh.o \
|
||||
math_copysign.o \
|
||||
math_copysignf.o \
|
||||
math_exp.o \
|
||||
math_fabs.o \
|
||||
math_fabsf.o \
|
||||
@ -529,6 +535,7 @@ MATH_LIB = \
|
||||
math_fmod.o \
|
||||
math_fpclassify.o \
|
||||
math_isfinite.o \
|
||||
math_isunordered.o \
|
||||
math_signbit.o \
|
||||
math_frexp.o \
|
||||
math_huge_val.o \
|
||||
@ -542,6 +549,8 @@ MATH_LIB = \
|
||||
math_modf.o \
|
||||
math_nan.o \
|
||||
math_nanf.o \
|
||||
math_nextafter.o \
|
||||
math_nextafterf.o \
|
||||
math_pow.o \
|
||||
math_rint.o \
|
||||
math_rintf.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.56 2005-05-11 20:15:25 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.57 2005-05-12 13:21:43 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -154,6 +154,10 @@ C_LIB = \
|
||||
fcntl_write.o \
|
||||
ftw_ftw.o \
|
||||
ftw_nftw.o \
|
||||
inttypes_imaxdiv.o \
|
||||
inttypes_imaxabs.o \
|
||||
inttypes_strtoimax.o \
|
||||
inttypes_strtoumax.o \
|
||||
libgen_basename.o \
|
||||
libgen_dirname.o \
|
||||
locale_init_exit.o \
|
||||
@ -522,6 +526,8 @@ MATH_LIB = \
|
||||
math_ceil.o \
|
||||
math_cos.o \
|
||||
math_cosh.o \
|
||||
math_copysign.o \
|
||||
math_copysignf.o \
|
||||
math_exp.o \
|
||||
math_fabs.o \
|
||||
math_fabsf.o \
|
||||
@ -529,6 +535,7 @@ MATH_LIB = \
|
||||
math_fmod.o \
|
||||
math_fpclassify.o \
|
||||
math_isfinite.o \
|
||||
math_isunordered.o \
|
||||
math_signbit.o \
|
||||
math_frexp.o \
|
||||
math_huge_val.o \
|
||||
@ -542,6 +549,8 @@ MATH_LIB = \
|
||||
math_modf.o \
|
||||
math_nan.o \
|
||||
math_nanf.o \
|
||||
math_nextafter.o \
|
||||
math_nextafterf.o \
|
||||
math_pow.o \
|
||||
math_rint.o \
|
||||
math_rintf.o \
|
||||
|
||||
@ -62,6 +62,31 @@
|
||||
|
||||
- Added isblank().
|
||||
|
||||
- Added isunordered(), isgreater(), isgreaterequal(), isless(),
|
||||
islessequal() and islessgreater() to <math.h> for C99.
|
||||
|
||||
- The wchar_t type is now an 'unsigned short' integer (16 bits wide).
|
||||
|
||||
- Added PTRDIFF_MIN/PTRDIFF_MAX, WCHAR_MIN/WCHAR_MAX and
|
||||
WINT_MIN/WINT_MAX to <stdint.h> for C99.
|
||||
|
||||
- Added imaxdiv() and imaxabs() for C99.
|
||||
|
||||
- Added strtoimax() and strtoumax() for C99.
|
||||
|
||||
- Added nextafter() and nextafterf() for C99.
|
||||
|
||||
- Added copysign() and copysignf() for C99.
|
||||
|
||||
- Unless I missed something, clib2 should now be functionally complete
|
||||
with regard to C99, except for the floating point operations covered.
|
||||
These are a major challenge all by themselves, and I wonder both
|
||||
whether they are worth the effort and how one could implement them
|
||||
correctly.
|
||||
|
||||
- fflush() now consistently supports a NULL parameter, causing all
|
||||
streams to be flushed for which this behaviour is defined.
|
||||
|
||||
|
||||
c.lib 1.191 (9.4.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: complex.h,v 1.2 2005-04-04 11:56:26 obarthel Exp $
|
||||
* $Id: complex.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,24 +41,24 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__cplusplus) && defined(__GNUC__)
|
||||
#warning C99 header used in C++.
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if (__GNUC__ + 0) < 3 && (__STDC_VERSION__ + 0) < 199901L
|
||||
#error Complex numbers are not supported by/for this compiler.
|
||||
#endif /* __GNUC__ && __STDC_VERSION__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef __GNUC__
|
||||
#error Unsupported compiler.
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#warning C99 header file used in C++.
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if !defined(__STDC_VERSION__) || (__GNUC__ < 3 && __STDC_VERSION__ < 199901L)
|
||||
#error Complex numbers are not supported by/for this compiler.
|
||||
#endif /* __GNUC__ && __STDC_VERSION__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: inttypes.h,v 1.1 2005-02-04 15:03:13 obarthel Exp $
|
||||
* $Id: inttypes.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -50,6 +50,12 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif /* _STDDEF_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* printf() format specifications for different types. */
|
||||
|
||||
/* "Decimal" */
|
||||
@ -162,7 +168,7 @@
|
||||
|
||||
/* intmax_t is 32 bits for SAS/C, 64-bits for GCC or if using a conforming C99 compiler. */
|
||||
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define PRIdMAX "lld"
|
||||
#define PRIiMAX "lli"
|
||||
#define PRIuMAX "llu"
|
||||
@ -176,22 +182,22 @@
|
||||
#define PRIxMAX "lx"
|
||||
#define PRIXMAX "lX"
|
||||
#define PRIoMAX "lo"
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
/* scanf() format specifiers. */
|
||||
|
||||
/* "Decimal" */
|
||||
/* #define SCNd8 "hhd" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNd8 "hhd"
|
||||
#define SCNd16 "hd"
|
||||
#define SCNd32 "d"
|
||||
#define SCNd64 "lld"
|
||||
|
||||
/* #define SCNdLEAST8 "hhd" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNdLEAST8 "hhd"
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNdLEAST32 "d"
|
||||
#define SCNdLEAST64 "lld"
|
||||
|
||||
/* #define SCNdFAST8 "hhd" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNdFAST8 "hhd"
|
||||
#define SCNdFAST16 "d"
|
||||
#define SCNdFAST32 "d"
|
||||
#define SCNdFAST64 "lld"
|
||||
@ -199,17 +205,17 @@
|
||||
#define SCNdPTR "d"
|
||||
|
||||
/* "Integer" */
|
||||
/* #define SCNi8 "hhi" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNi8 "hhi"
|
||||
#define SCNi16 "hi"
|
||||
#define SCNi32 "i"
|
||||
#define SCNi64 "lli"
|
||||
|
||||
/* #define SCNiLEAST8 "hhi" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNiLEAST8 "hhi"
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNiLEAST32 "i"
|
||||
#define SCNiLEAST64 "lli"
|
||||
|
||||
/* #define SCNiFAST8 "hhi" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNiFAST8 "hhi"
|
||||
#define SCNiFAST16 "i"
|
||||
#define SCNiFAST32 "i"
|
||||
#define SCNiFAST64 "lli"
|
||||
@ -217,17 +223,17 @@
|
||||
#define SCNiPTR "i"
|
||||
|
||||
/* "Unsigned" */
|
||||
/* #define SCNu8 "hhu" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNu8 "hhu"
|
||||
#define SCNu16 "hu"
|
||||
#define SCNu32 "u"
|
||||
#define SCNu64 "llu"
|
||||
|
||||
/* #define SCNuLEAST8 "hhu" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNuLEAST8 "hhu"
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNuLEAST32 "u"
|
||||
#define SCNuLEAST64 "llu"
|
||||
|
||||
/* #define SCNuFAST8 "hhu" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNuFAST8 "hhu"
|
||||
#define SCNuFAST16 "u"
|
||||
#define SCNuFAST32 "u"
|
||||
#define SCNuFAST64 "llu"
|
||||
@ -235,17 +241,17 @@
|
||||
#define SCNuPTR "u"
|
||||
|
||||
/* "Hexadecimal" */
|
||||
/* #define SCNx8 "hhx" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNx8 "hhx"
|
||||
#define SCNx16 "hx"
|
||||
#define SCNx32 "x"
|
||||
#define SCNx64 "llx"
|
||||
|
||||
/* #define SCNxLEAST8 "hhx" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNxLEAST8 "hhx"
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNxLEAST32 "x"
|
||||
#define SCNxLEAST64 "llx"
|
||||
|
||||
/* #define SCNxFAST8 "hhx" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNxFAST8 "hhx"
|
||||
#define SCNxFAST16 "x"
|
||||
#define SCNxFAST32 "x"
|
||||
#define SCNxFAST64 "llx"
|
||||
@ -253,24 +259,24 @@
|
||||
#define SCNxPTR "x"
|
||||
|
||||
/* "Octal" */
|
||||
/* #define SCNo8 "hho" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNo8 "hho"
|
||||
#define SCNo16 "ho"
|
||||
#define SCNo32 "o"
|
||||
#define SCNo64 "llo"
|
||||
|
||||
/* #define SCNoLEAST8 "hho" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNoLEAST8 "hho"
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNoLEAST32 "o"
|
||||
#define SCNoLEAST64 "llo"
|
||||
|
||||
/* #define SCNoFAST8 "hho" */ /* Missing. TODO: Add support for char conversions in scanf() */
|
||||
#define SCNoFAST8 "hho"
|
||||
#define SCNoFAST16 "o"
|
||||
#define SCNoFAST32 "o"
|
||||
#define SCNoFAST64 "llo"
|
||||
|
||||
#define SCNoPTR "o"
|
||||
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define SCNdMAX "lld"
|
||||
#define SCNiMAX "lli"
|
||||
#define SCNuMAX "llu"
|
||||
@ -282,14 +288,30 @@
|
||||
#define SCNuMAX "lu"
|
||||
#define SCNxMAX "lx"
|
||||
#define SCNoMAX "lo"
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
/* TODO: Add the rest of inttypes.h here + in the library. */
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Missing stuff is among other things atoll(), strtoll(), ...
|
||||
* Then there is the matter of wchar support - Zzzz.
|
||||
*/
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
typedef struct { long long quot; long long rem; } imaxdiv_t;
|
||||
#else
|
||||
typedef struct { long quot; long rem; } imaxdiv_t;
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern intmax_t imaxabs(intmax_t x);
|
||||
extern imaxdiv_t imaxdiv(intmax_t n,intmax_t d);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern intmax_t strtoimax(const char *str, char **ptr, int base);
|
||||
extern uintmax_t strtoumax(const char *str, char **ptr, int base);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern intmax_t wcstoimax(const wchar_t *str, char **ptr, int base);
|
||||
extern uintmax_t wcstoumax(const wchar_t *str, char **ptr, int base);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: limits.h,v 1.6 2005-04-03 10:22:48 obarthel Exp $
|
||||
* $Id: limits.h,v 1.7 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -83,7 +83,8 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
/* The following is not part of the ISO 'C' (1994) standard, but it should
|
||||
be part of ISO/IEC 9899:1999, also known as "C99". */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -93,6 +94,14 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define MB_LEN_MAX 1
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define SSIZE_MAX 2147483647L
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math.h,v 1.8 2005-05-08 08:51:30 obarthel Exp $
|
||||
* $Id: math.h,v 1.9 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -113,6 +113,14 @@ extern double hypot(double x,double y);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Note that the comparison operations performed on the floating point
|
||||
data types ought to include float, double and long double. However,
|
||||
because the current (2005-06-12) compiler technology available on the
|
||||
Amiga does not support the long double type yet, this library is restricted
|
||||
to operations on float and double. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern float __huge_val_float;
|
||||
|
||||
/****************************************************************************/
|
||||
@ -137,23 +145,72 @@ extern int __isfinite_double(double x);
|
||||
extern int __signbit_float(float x);
|
||||
extern int __signbit_double(double x);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define fpclassify(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x))
|
||||
(sizeof(x) == sizeof(float) ? \
|
||||
__fpclassify_float(x) : \
|
||||
__fpclassify_double(x))
|
||||
|
||||
#define isfinite(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __isfinite_single(x) : __isfinite_double(x))
|
||||
(sizeof(x) == sizeof(float) ? \
|
||||
__isfinite_float(x) : \
|
||||
__isfinite_double(x))
|
||||
|
||||
#define isinf(x) \
|
||||
(((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x)) == FP_INFINITE)
|
||||
((sizeof(x) == sizeof(float) ? \
|
||||
__fpclassify_float(x) : \
|
||||
__fpclassify_double(x)) \
|
||||
== FP_INFINITE)
|
||||
|
||||
#define isnan(x) \
|
||||
(((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x)) == FP_NAN)
|
||||
((sizeof(x) == sizeof(float) ? \
|
||||
__fpclassify_float(x) : \
|
||||
__fpclassify_double(x)) \
|
||||
== FP_NAN)
|
||||
|
||||
#define isnormal(x) \
|
||||
(((sizeof(x) == sizeof(float)) ? __fpclassify_float(x) : __fpclassify_double(x)) == FP_NORMAL)
|
||||
((sizeof(x) == sizeof(float) ? \
|
||||
__fpclassify_float(x) : \
|
||||
__fpclassify_double(x)) \
|
||||
== FP_NORMAL)
|
||||
|
||||
#define signbit(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __signbit_single(x) : __signbit_double(x))
|
||||
(sizeof(x) == sizeof(float) ? \
|
||||
__signbit_float(x) : \
|
||||
__signbit_double(x))
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern int __isunordered_float(float x,float y);
|
||||
extern int __isunordered_float_double(float x,double y);
|
||||
extern int __isunordered_double(double x,double y);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define isunordered(x,y) \
|
||||
(sizeof(x) == sizeof(float) ? \
|
||||
(sizeof(y) == sizeof(float) ? \
|
||||
__isunordered_float((x),y) : \
|
||||
__isunordered_float_double((x),(y))) : \
|
||||
(sizeof(y) == sizeof(float) ? \
|
||||
__isunordered_float_double((y),(x)) : \
|
||||
__isunordered_double((x),(y))))
|
||||
|
||||
#define isgreater(x,y) \
|
||||
(isunordered(x,y) ? 0 : (x) > (y))
|
||||
|
||||
#define isgreaterequal(x,y) \
|
||||
(isunordered(x,y) ? 0 : (x) >= (y))
|
||||
|
||||
#define isless(x,y) \
|
||||
(isunordered(x,y) ? 0 : (x) < (y))
|
||||
|
||||
#define islessequal(x,y) \
|
||||
(isunordered(x,y) ? 0 : (x) <= (y))
|
||||
|
||||
#define islessgreater(x,y) \
|
||||
(isunordered(x,y) ? 0 : (x) < (y) || (x) > (y)) /* ZZZ don't evaulate twice! */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -166,6 +223,16 @@ extern double nan(const char *tagp);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern float nextafterf(float x,float y);
|
||||
extern double nextafter(double x,double y);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern double copysign(double x, double y);
|
||||
extern float copysignf(float x, float y);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: signal.h,v 1.4 2005-01-02 09:07:21 obarthel Exp $
|
||||
* $Id: signal.h,v 1.5 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -62,6 +62,15 @@ extern int raise(int sig);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard, but it should
|
||||
be part of ISO/IEC 9899:1999, also known as "C99". */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
/****************************************************************************/
|
||||
@ -76,10 +85,6 @@ typedef void (*sig_t)(int);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef int sigset_t;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdbool.h,v 1.1 2005-04-03 10:22:48 obarthel Exp $
|
||||
* $Id: stdbool.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -47,9 +47,9 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if (__STDC_VERSION__ + 0) < 199901L
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
#warning C99 header file used by non-C99 compliant compiler.
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* !__STDC_VERSION__ || __STDC_VERSION__ < 199901L */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stddef.h,v 1.3 2005-01-08 10:21:28 obarthel Exp $
|
||||
* $Id: stddef.h,v 1.4 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -54,7 +54,7 @@ extern "C" {
|
||||
|
||||
typedef int ptrdiff_t;
|
||||
typedef unsigned int size_t;
|
||||
typedef unsigned int wchar_t;
|
||||
typedef unsigned short wchar_t;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdint.h,v 1.1 2005-02-04 15:03:14 obarthel Exp $
|
||||
* $Id: stdint.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -77,8 +77,7 @@ typedef unsigned int uint_fast32_t;
|
||||
typedef signed long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
|
||||
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int_least64_t;
|
||||
@ -87,10 +86,10 @@ typedef signed long long int_fast64_t;
|
||||
typedef unsigned long long uint_fast64_t;
|
||||
typedef signed long long intmax_t;
|
||||
typedef unsigned long long uintmax_t;
|
||||
#else /* No 64-bit types for SAS/C */
|
||||
#else
|
||||
typedef signed long intmax_t;
|
||||
typedef unsigned long uintmax_t;
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#define INT8_MIN SCHAR_MIN
|
||||
#define INT8_MAX SCHAR_MAX
|
||||
@ -101,11 +100,11 @@ typedef unsigned long uintmax_t;
|
||||
#define INT32_MIN INT_MIN
|
||||
#define INT32_MAX INT_MAX
|
||||
#define UINT32_MAX UINT_MAX
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define INT64_MIN LLONG_MIN
|
||||
#define INT64_MAX LLONG_MAX
|
||||
#define UINT64_MAX ULLONG_MAX
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#define INT_LEAST8_MIN SCHAR_MIN
|
||||
#define INT_LEAST8_MAX SCHAR_MAX
|
||||
@ -116,11 +115,11 @@ typedef unsigned long uintmax_t;
|
||||
#define INT_LEAST32_MIN INT_MIN
|
||||
#define INT_LEAST32_MAX INT_MAX
|
||||
#define UINT_LEAST32_MAX UINT_MAX
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define INT_LEAST64_MIN LLONG_MIN
|
||||
#define INT_LEAST64_MAX LLONG_MAX
|
||||
#define UINT_LEAST64_MAX ULLONG_MAX
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#define INT_FAST8_MIN SCHAR_MIN
|
||||
#define INT_FAST8_MAX SCHAR_MAX
|
||||
@ -131,17 +130,17 @@ typedef unsigned long uintmax_t;
|
||||
#define INT_FAST32_MIN INT_MIN
|
||||
#define INT_FAST32_MAX INT_MAX
|
||||
#define UINT_FAST32_MAX UINT_MAX
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define INT_FAST64_MIN LLONG_MIN
|
||||
#define INT_FAST64_MAX LLONG_MAX
|
||||
#define UINT_FAST64_MAX ULLONG_MAX
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#define INTPTR_MIN LONG_MIN
|
||||
#define INTPTR_MAX LONG_MAX
|
||||
#define UINTPTR_MAX ULONG_MAX
|
||||
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define INTMAX_MIN LLONG_MIN
|
||||
#define INTMAX_MAX LLONG_MAX
|
||||
#define UINTMAX_MAX ULLONG_MAX
|
||||
@ -149,9 +148,9 @@ typedef unsigned long uintmax_t;
|
||||
#define INTMAX_MIN LONG_MIN
|
||||
#define INTMAX_MAX LONG_MAX
|
||||
#define UINTMAX_MAX ULONG_MAX
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#if !defined(__cpluspluis) || defined(__STDC_LIMIT_MACROS)
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
|
||||
/* sigatomic_t is an int. */
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
@ -171,16 +170,27 @@ typedef unsigned long uintmax_t;
|
||||
#define UINT32_C(x) x ## U
|
||||
#define UINT64_C(x) x ## ULL
|
||||
|
||||
#if defined(__GNUC__) || ((__STDC_VERSION__ +0) >= 199901L)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
#define INTMAX_C(x) x ## LL
|
||||
#define UINTMAX_C(x) x ## ULL
|
||||
#else
|
||||
#define INTMAX_C(x) x ## L
|
||||
#define UINTMAX_C(x) x ## UL
|
||||
#endif
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
#endif /* not C++ or CONSTANT_MACROS */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define PTRDIFF_MIN INT_MIN
|
||||
#define PTRDIFF_MAX INT_MAX
|
||||
|
||||
#define WCHAR_MIN 0
|
||||
#define WCHAR_MAX USHRT_MAX
|
||||
|
||||
#define WINT_MIN INT_MIN
|
||||
#define WINT_MAX INT_MAX
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _STDINT_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib.h,v 1.10 2005-05-07 13:21:49 obarthel Exp $
|
||||
* $Id: stdlib.h,v 1.11 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -49,7 +49,7 @@ extern "C" {
|
||||
/****************************************************************************/
|
||||
|
||||
/* Maximum number of bytes in a multibyte character */
|
||||
#define MB_CUR_MAX 4
|
||||
#define MB_CUR_MAX 2
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -182,9 +182,7 @@ extern char * mkdtemp(char *name_template);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* These functions and data structures are unavailable under SAS/C for lack
|
||||
of a "long long" data type. */
|
||||
#if ! defined(__SASC)
|
||||
#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -203,7 +201,7 @@ extern lldiv_t lldiv(long long n,long long d);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __SASC */
|
||||
#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
63
library/include/sys/clib2_stdc.h
Normal file
63
library/include/sys/clib2_stdc.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* $Id: clib2_stdc.h,v 1.1 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CLIB2_STDC_H
|
||||
#define _SYS_CLIB2_STDC_H
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Make the "restrict" qualifier work well with 'C' compilers that do
|
||||
not support it. We do assume that __STDC__ is defined, though. */
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
#define restrict
|
||||
#endif /* !__STDC_VERSION__ || __STDC_VERSION__ < 199901L */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _SYS_CLIB2_STDC_H */
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: wchar.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $
|
||||
* $Id: wchar.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -162,6 +162,20 @@ extern size_t wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard, but it should
|
||||
be part of ISO/IEC 9899:1999, also known as "C99". */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
|
||||
extern long long wcstoll(const wchar_t *str, wchar_t **ptr, int base);
|
||||
extern unsigned long long wcstoull(const wchar_t *str, wchar_t **ptr, int base);
|
||||
|
||||
#endif /* __STDC_VERSION__ && __STDC_VERSION__ >= 199901L */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: wctype.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $
|
||||
* $Id: wctype.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -68,6 +68,7 @@ extern int iswlower(wint_t c);
|
||||
extern int iswupper(wint_t c);
|
||||
|
||||
extern int iswspace(wint_t c);
|
||||
extern int iswblank(wint_t c);
|
||||
|
||||
extern wint_t towlower(wint_t c);
|
||||
extern wint_t towupper(wint_t c);
|
||||
|
||||
49
library/inttypes_headers.h
Normal file
49
library/inttypes_headers.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* $Id: inttypes_headers.h,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#define _INTTYPES_HEADERS_H
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
51
library/inttypes_imaxabs.c
Normal file
51
library/inttypes_imaxabs.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $Id: inttypes_imaxabs.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#include "inttypes_headers.h"
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
intmax_t
|
||||
imaxabs(intmax_t x)
|
||||
{
|
||||
intmax_t result;
|
||||
|
||||
if(x < 0)
|
||||
result = (-x);
|
||||
else
|
||||
result = x;
|
||||
|
||||
return(result);
|
||||
}
|
||||
51
library/inttypes_imaxdiv.c
Normal file
51
library/inttypes_imaxdiv.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $Id: inttypes_imaxdiv.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#include "inttypes_headers.h"
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
imaxdiv_t
|
||||
imaxdiv(intmax_t n,intmax_t d)
|
||||
{
|
||||
imaxdiv_t result;
|
||||
|
||||
assert( d != 0 );
|
||||
|
||||
result.quot = n / d;
|
||||
result.rem = n % d;
|
||||
|
||||
return(result);
|
||||
}
|
||||
192
library/inttypes_strtoimax.c
Normal file
192
library/inttypes_strtoimax.c
Normal file
@ -0,0 +1,192 @@
|
||||
/*
|
||||
* $Id: inttypes_strtoimax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_NULL_POINTER_CHECK_H
|
||||
#include "stdlib_null_pointer_check.h"
|
||||
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#include "inttypes_headers.h"
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
intmax_t
|
||||
strtoimax(const char *str, char **ptr, int base)
|
||||
{
|
||||
BOOL is_negative;
|
||||
intmax_t result = 0;
|
||||
intmax_t new_sum;
|
||||
intmax_t sum;
|
||||
char c;
|
||||
|
||||
ENTER();
|
||||
|
||||
SHOWSTRING(str);
|
||||
SHOWPOINTER(ptr);
|
||||
SHOWVALUE(base);
|
||||
|
||||
assert(str != NULL && base >= 0);
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(str == NULL)
|
||||
{
|
||||
SHOWMSG("invalid str parameter");
|
||||
|
||||
__set_errno(EFAULT);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(base < 0)
|
||||
{
|
||||
SHOWMSG("invalid base parameter");
|
||||
|
||||
__set_errno(ERANGE);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Skip all leading blanks. */
|
||||
while((c = (*str)) != '\0')
|
||||
{
|
||||
if(NOT isspace(c))
|
||||
break;
|
||||
|
||||
str++;
|
||||
}
|
||||
|
||||
/* The first character may be a sign. */
|
||||
if(c == '-')
|
||||
{
|
||||
/* It's a negative number. */
|
||||
is_negative = TRUE;
|
||||
|
||||
str++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It's not going to be negative. */
|
||||
is_negative = FALSE;
|
||||
|
||||
/* But there may be a sign we will choose to
|
||||
ignore. */
|
||||
if(c == '+')
|
||||
str++;
|
||||
}
|
||||
|
||||
c = (*str);
|
||||
|
||||
/* There may be a leading '0x' to indicate that what
|
||||
follows is a hexadecimal number. */
|
||||
if(base == 0 || base == 16)
|
||||
{
|
||||
if((c == '0') && (str[1] == 'x' || str[1] == 'X'))
|
||||
{
|
||||
base = 16;
|
||||
|
||||
str += 2;
|
||||
|
||||
c = (*str);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we still don't know what base to use and the
|
||||
next letter to follow is a zero then this is
|
||||
probably a number in octal notation. */
|
||||
if(base == 0)
|
||||
{
|
||||
if(c == '0')
|
||||
base = 8;
|
||||
else
|
||||
base = 10;
|
||||
}
|
||||
|
||||
sum = 0;
|
||||
|
||||
if(1 <= base && base <= 36)
|
||||
{
|
||||
while(c != '\0')
|
||||
{
|
||||
if('0' <= c && c <= '9')
|
||||
c -= '0';
|
||||
else if ('a' <= c)
|
||||
c -= 'a' - 10;
|
||||
else if ('A' <= c)
|
||||
c -= 'A' - 10;
|
||||
else
|
||||
break;
|
||||
|
||||
/* Ignore invalid numbers. */
|
||||
if(c >= base)
|
||||
break;
|
||||
|
||||
new_sum = base * sum + c;
|
||||
if(new_sum < sum) /* overflow? */
|
||||
{
|
||||
__set_errno(ERANGE);
|
||||
|
||||
if(is_negative)
|
||||
result = INTMAX_MIN;
|
||||
else
|
||||
result = INTMAX_MAX;
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
sum = new_sum;
|
||||
|
||||
str++;
|
||||
|
||||
c = (*str);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_negative)
|
||||
result = (-sum);
|
||||
else
|
||||
result = sum;
|
||||
|
||||
out:
|
||||
|
||||
/* If desired, remember where we stopped reading the
|
||||
number from the buffer. */
|
||||
if(ptr != NULL)
|
||||
(*ptr) = (char *)str;
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
}
|
||||
189
library/inttypes_strtoumax.c
Normal file
189
library/inttypes_strtoumax.c
Normal file
@ -0,0 +1,189 @@
|
||||
/*
|
||||
* $Id: inttypes_strtoumax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_NULL_POINTER_CHECK_H
|
||||
#include "stdlib_null_pointer_check.h"
|
||||
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#include "inttypes_headers.h"
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
uintmax_t
|
||||
strtoumax(const char *str, char **ptr, int base)
|
||||
{
|
||||
BOOL is_negative;
|
||||
uintmax_t result = 0;
|
||||
uintmax_t new_sum;
|
||||
uintmax_t sum;
|
||||
char c;
|
||||
|
||||
ENTER();
|
||||
|
||||
SHOWSTRING(str);
|
||||
SHOWPOINTER(ptr);
|
||||
SHOWVALUE(base);
|
||||
|
||||
assert(str != NULL && base >= 0);
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(str == NULL)
|
||||
{
|
||||
SHOWMSG("invalid str parameter");
|
||||
|
||||
__set_errno(EFAULT);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(base < 0)
|
||||
{
|
||||
SHOWMSG("invalid base parameter");
|
||||
|
||||
__set_errno(ERANGE);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Skip all leading blanks. */
|
||||
while((c = (*str)) != '\0')
|
||||
{
|
||||
if(NOT isspace(c))
|
||||
break;
|
||||
|
||||
str++;
|
||||
}
|
||||
|
||||
/* The first character may be a sign. */
|
||||
if(c == '-')
|
||||
{
|
||||
/* It's a negative number. */
|
||||
is_negative = TRUE;
|
||||
|
||||
str++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It's not going to be negative. */
|
||||
is_negative = FALSE;
|
||||
|
||||
/* But there may be a sign we will choose to
|
||||
ignore. */
|
||||
if(c == '+')
|
||||
str++;
|
||||
}
|
||||
|
||||
c = (*str);
|
||||
|
||||
/* There may be a leading '0x' to indicate that what
|
||||
follows is a hexadecimal number. */
|
||||
if(base == 0 || base == 16)
|
||||
{
|
||||
if((c == '0') && (str[1] == 'x' || str[1] == 'X'))
|
||||
{
|
||||
base = 16;
|
||||
|
||||
str += 2;
|
||||
|
||||
c = (*str);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we still don't know what base to use and the
|
||||
next letter to follow is a zero then this is
|
||||
probably a number in octal notation. */
|
||||
if(base == 0)
|
||||
{
|
||||
if(c == '0')
|
||||
base = 8;
|
||||
else
|
||||
base = 10;
|
||||
}
|
||||
|
||||
sum = 0;
|
||||
|
||||
if(1 <= base && base <= 36)
|
||||
{
|
||||
while(c != '\0')
|
||||
{
|
||||
if('0' <= c && c <= '9')
|
||||
c -= '0';
|
||||
else if ('a' <= c)
|
||||
c -= 'a' - 10;
|
||||
else if ('A' <= c)
|
||||
c -= 'A' - 10;
|
||||
else
|
||||
break;
|
||||
|
||||
/* Ignore invalid numbers. */
|
||||
if(c >= base)
|
||||
break;
|
||||
|
||||
new_sum = base * sum + c;
|
||||
if(new_sum < sum) /* overflow? */
|
||||
{
|
||||
__set_errno(ERANGE);
|
||||
|
||||
result = UINTMAX_MAX;
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
sum = new_sum;
|
||||
|
||||
str++;
|
||||
|
||||
c = (*str);
|
||||
}
|
||||
}
|
||||
|
||||
if(is_negative)
|
||||
result = (-sum);
|
||||
else
|
||||
result = sum;
|
||||
|
||||
out:
|
||||
|
||||
/* If desired, remember where we stopped reading the
|
||||
number from the buffer. */
|
||||
if(ptr != NULL)
|
||||
(*ptr) = (char *)str;
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
}
|
||||
51
library/inttypes_wcstoimax.c
Normal file
51
library/inttypes_wcstoimax.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $Id: inttypes_wcstoimax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_NULL_POINTER_CHECK_H
|
||||
#include "stdlib_null_pointer_check.h"
|
||||
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#include "inttypes_headers.h"
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
intmax_t
|
||||
wcstoimax(const wchar_t *str, char **ptr, int base)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
}
|
||||
51
library/inttypes_wcstoumax.c
Normal file
51
library/inttypes_wcstoumax.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $Id: inttypes_wcstoumax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_NULL_POINTER_CHECK_H
|
||||
#include "stdlib_null_pointer_check.h"
|
||||
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _INTTYPES_HEADERS_H
|
||||
#include "inttypes_headers.h"
|
||||
#endif /* _INTTYPES_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
uintmax_t
|
||||
wcstoumax(const wchar_t *str, char **ptr, int base)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
}
|
||||
67
library/math_copysign.c
Normal file
67
library/math_copysign.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* $Id: math_copysign.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* PowerPC math library based in part on work by Sun Microsystems
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_HEADERS_H
|
||||
#include "math_headers.h"
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(FLOATING_POINT_SUPPORT)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
double
|
||||
copysign(double x, double y)
|
||||
{
|
||||
unsigned long hx,hy;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
GET_HIGH_WORD(hy,y);
|
||||
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000U));
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* FLOATING_POINT_SUPPORT */
|
||||
67
library/math_copysignf.c
Normal file
67
library/math_copysignf.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* $Id: math_copysignf.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* PowerPC math library based in part on work by Sun Microsystems
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_HEADERS_H
|
||||
#include "math_headers.h"
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(FLOATING_POINT_SUPPORT)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
float
|
||||
copysignf(float x, float y)
|
||||
{
|
||||
unsigned long ix,iy;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
GET_FLOAT_WORD(iy,y);
|
||||
SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000U));
|
||||
return x;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* FLOATING_POINT_SUPPORT */
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_headers.h,v 1.9 2005-05-08 17:02:10 obarthel Exp $
|
||||
* $Id: math_headers.h,v 1.10 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -99,8 +99,6 @@ extern struct Library * NOCOMMON MathIeeeDoubTransBase;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(PPC_FLOATING_POINT_SUPPORT)
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
@ -212,6 +210,8 @@ do { \
|
||||
(d) = sf_u.value; \
|
||||
} while (0)
|
||||
|
||||
#if defined(PPC_FLOATING_POINT_SUPPORT)
|
||||
|
||||
extern double __kernel_cos(double x, double y);
|
||||
extern double __kernel_sin(double x, double y, int iy);
|
||||
extern int __rem_pio2(double x, double *y);
|
||||
|
||||
117
library/math_isunordered.c
Normal file
117
library/math_isunordered.c
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* $Id: math_isunordered.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDIO_HEADERS_H
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined (FLOATING_POINT_SUPPORT)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard, but it should
|
||||
be part of ISO/IEC 9899:1999, also known as "C99". */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__isunordered_float(float number_x,float number_y)
|
||||
{
|
||||
union ieee_single x;
|
||||
union ieee_single y;
|
||||
int result;
|
||||
|
||||
x.value = number_x;
|
||||
y.value = number_y;
|
||||
|
||||
/* Exponent = 255 and fraction != 0.0 -> not a number */
|
||||
if((x.raw[0] & 0x7f800000) == 0x7f800000 && (x.raw[0] & 0x007fffff) != 0)
|
||||
result = 1;
|
||||
else if((y.raw[0] & 0x7f800000) == 0x7f800000 && (y.raw[0] & 0x007fffff) != 0)
|
||||
result = 1;
|
||||
else
|
||||
result = 0;
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__isunordered_float_double(float number_x,double number_y)
|
||||
{
|
||||
union ieee_single x;
|
||||
union ieee_double y;
|
||||
int result;
|
||||
|
||||
x.value = number_x;
|
||||
y.value = number_y;
|
||||
|
||||
if((x.raw[0] & 0x7f800000) == 0x7f800000 && (x.raw[0] & 0x007fffff) != 0)
|
||||
result = 1; /* Exponent = 255 and fraction != 0.0 -> not a number */
|
||||
else if (((y.raw[0] & 0x7ff00000) == 0x7ff00000) && ((y.raw[0] & 0x000fffff) != 0 || (y.raw[1] != 0)))
|
||||
result = 1; /* Exponent = 2047 and fraction != 0.0 -> not a number */
|
||||
else
|
||||
result = 0;
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__isunordered_double(double number_x,double number_y)
|
||||
{
|
||||
union ieee_double x;
|
||||
union ieee_double y;
|
||||
int result;
|
||||
|
||||
x.value = number_x;
|
||||
y.value = number_y;
|
||||
|
||||
/* Exponent = 2047 and fraction != 0.0 -> not a number */
|
||||
if(((x.raw[0] & 0x7ff00000) == 0x7ff00000) && ((x.raw[0] & 0x000fffff) != 0 || (x.raw[1] != 0)))
|
||||
result = 1;
|
||||
else if (((y.raw[0] & 0x7ff00000) == 0x7ff00000) && ((y.raw[0] & 0x000fffff) != 0 || (y.raw[1] != 0)))
|
||||
result = 1;
|
||||
else
|
||||
result = 0;
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* FLOATING_POINT_SUPPORT */
|
||||
105
library/math_nextafter.c
Normal file
105
library/math_nextafter.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* $Id: math_nextafter.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* PowerPC math library based in part on work by Sun Microsystems
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_HEADERS_H
|
||||
#include "math_headers.h"
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(FLOATING_POINT_SUPPORT)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
double
|
||||
nextafter(double x,double y)
|
||||
{
|
||||
long hx,hy,ix,iy;
|
||||
unsigned long lx,ly;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
EXTRACT_WORDS(hy,ly,y);
|
||||
ix = hx&0x7fffffff; /* |x| */
|
||||
iy = hy&0x7fffffff; /* |y| */
|
||||
|
||||
if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
|
||||
((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
|
||||
return x+y;
|
||||
if(x==y) return x; /* x=y, return x */
|
||||
if((ix|lx)==0) { /* x == 0 */
|
||||
INSERT_WORDS(x,hy&0x80000000U,1); /* return +-minsubnormal */
|
||||
y = x*x;
|
||||
if(y==x) return y; else return x; /* raise underflow flag */
|
||||
}
|
||||
if(hx>=0) { /* x > 0 */
|
||||
if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */
|
||||
if(lx==0) hx -= 1;
|
||||
lx -= 1;
|
||||
} else { /* x < y, x += ulp */
|
||||
lx += 1;
|
||||
if(lx==0) hx += 1;
|
||||
}
|
||||
} else { /* x < 0 */
|
||||
if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
|
||||
if(lx==0) hx -= 1;
|
||||
lx -= 1;
|
||||
} else { /* x > y, x += ulp */
|
||||
lx += 1;
|
||||
if(lx==0) hx += 1;
|
||||
}
|
||||
}
|
||||
hy = hx&0x7ff00000;
|
||||
if(hy>=0x7ff00000) return x+x; /* overflow */
|
||||
if(hy<0x00100000) { /* underflow */
|
||||
y = x*x;
|
||||
if(y!=x) { /* raise underflow flag */
|
||||
INSERT_WORDS(y,hx,lx);
|
||||
return y;
|
||||
}
|
||||
}
|
||||
INSERT_WORDS(x,hx,lx);
|
||||
return x;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* FLOATING_POINT_SUPPORT */
|
||||
102
library/math_nextafterf.c
Normal file
102
library/math_nextafterf.c
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* $Id: math_nextafterf.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* PowerPC math library based in part on work by Sun Microsystems
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
*
|
||||
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_HEADERS_H
|
||||
#include "math_headers.h"
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(FLOATING_POINT_SUPPORT)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
float
|
||||
nextafterf(float x, float y)
|
||||
{
|
||||
long hx,hy,ix,iy;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
GET_FLOAT_WORD(hy,y);
|
||||
ix = hx&0x7fffffff; /* |x| */
|
||||
iy = hy&0x7fffffff; /* |y| */
|
||||
|
||||
if((ix>0x7f800000) || /* x is nan */
|
||||
(iy>0x7f800000)) /* y is nan */
|
||||
return x+y;
|
||||
if(x==y) return x; /* x=y, return x */
|
||||
if(ix==0) { /* x == 0 */
|
||||
SET_FLOAT_WORD(x,(hy&0x80000000U)|1);/* return +-minsubnormal */
|
||||
y = x*x;
|
||||
if(y==x) return y; else return x; /* raise underflow flag */
|
||||
}
|
||||
if(hx>=0) { /* x > 0 */
|
||||
if(hx>hy) { /* x > y, x -= ulp */
|
||||
hx -= 1;
|
||||
} else { /* x < y, x += ulp */
|
||||
hx += 1;
|
||||
}
|
||||
} else { /* x < 0 */
|
||||
if(hy>=0||hx>hy){ /* x < y, x -= ulp */
|
||||
hx -= 1;
|
||||
} else { /* x > y, x += ulp */
|
||||
hx += 1;
|
||||
}
|
||||
}
|
||||
hy = hx&0x7f800000;
|
||||
if(hy>=0x7f800000) return x+x; /* overflow */
|
||||
if(hy<0x00800000) { /* underflow */
|
||||
y = x*x;
|
||||
if(y!=x) { /* raise underflow flag */
|
||||
SET_FLOAT_WORD(y,hx);
|
||||
return y;
|
||||
}
|
||||
}
|
||||
SET_FLOAT_WORD(x,hx);
|
||||
return x;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* FLOATING_POINT_SUPPORT */
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: smakefile,v 1.41 2005-05-11 20:15:25 obarthel Exp $
|
||||
# $Id: smakefile,v 1.42 2005-05-12 13:21:43 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -186,6 +186,8 @@ MATH_OBJ = \
|
||||
math_ceil.o \
|
||||
math_cos.o \
|
||||
math_cosh.o \
|
||||
math_copysign.o \
|
||||
math_copysignf.o \
|
||||
math_exp.o \
|
||||
math_fabs.o \
|
||||
math_fabsf.o \
|
||||
@ -193,6 +195,7 @@ MATH_OBJ = \
|
||||
math_fmod.o \
|
||||
math_fpclassify.o \
|
||||
math_isfinite.o \
|
||||
math_isunordered.o \
|
||||
math_signbit.o \
|
||||
math_frexp.o \
|
||||
math_huge_val.o \
|
||||
@ -206,6 +209,8 @@ MATH_OBJ = \
|
||||
math_modf.o \
|
||||
math_nan.o \
|
||||
math_nanf.o \
|
||||
math_nextafter.o \
|
||||
math_nextafterf.o \
|
||||
math_pow.o \
|
||||
math_rint.o \
|
||||
math_rintf.o \
|
||||
@ -377,6 +382,10 @@ STDIO_OBJ = \
|
||||
stdio_vsprintf_hook_entry.o
|
||||
|
||||
STDLIB_OBJ = \
|
||||
inttypes_imaxdiv.o \
|
||||
inttypes_imaxabs.o \
|
||||
inttypes_strtoimax.o \
|
||||
inttypes_strtoumax.o \
|
||||
stdlib_abort.o \
|
||||
stdlib_abs.o \
|
||||
stdlib_alloca.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fflush.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $
|
||||
* $Id: stdio_fflush.c,v 1.9 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -68,71 +68,44 @@ fflush(FILE *stream)
|
||||
in the wrong order. */
|
||||
flockfile(stream);
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
/* Flush a particular stream? */
|
||||
if(stream != NULL)
|
||||
{
|
||||
struct iob * file = (struct iob *)stream;
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
|
||||
if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0)
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
int failed_iob = -1;
|
||||
int i;
|
||||
|
||||
__stdio_lock();
|
||||
|
||||
/* Flush all streams which still have unwritten data in the buffer. */
|
||||
for(i = 0 ; i < __num_iob ; i++)
|
||||
{
|
||||
if(__iob[i] != NULL &&
|
||||
FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_IN_USE) &&
|
||||
FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_WRITE) &&
|
||||
__iob_write_buffer_is_valid(__iob[i]))
|
||||
{
|
||||
if(__flush_iob_write_buffer(__iob[i]) < 0)
|
||||
{
|
||||
failed_iob = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__stdio_unlock();
|
||||
|
||||
if(failed_iob >= 0)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Flush a particular stream? */
|
||||
if(stream != NULL)
|
||||
{
|
||||
struct iob * file = (struct iob *)stream;
|
||||
|
||||
assert( stream != NULL );
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(stream == NULL)
|
||||
{
|
||||
SHOWMSG("invalid file handle");
|
||||
|
||||
__set_errno(EFAULT);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
|
||||
if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0)
|
||||
goto out;
|
||||
}
|
||||
#endif /* UNIX_PATH_SEMANTICS */
|
||||
else
|
||||
{
|
||||
int failed_iob = -1;
|
||||
int i;
|
||||
|
||||
__stdio_lock();
|
||||
|
||||
/* Flush all streams which still have unwritten data in the buffer. */
|
||||
for(i = 0 ; i < __num_iob ; i++)
|
||||
{
|
||||
if(__iob[i] != NULL &&
|
||||
FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_IN_USE) &&
|
||||
FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_WRITE) &&
|
||||
__iob_write_buffer_is_valid(__iob[i]))
|
||||
{
|
||||
if(__flush_iob_write_buffer(__iob[i]) < 0)
|
||||
{
|
||||
failed_iob = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__stdio_unlock();
|
||||
|
||||
if(failed_iob >= 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = OK;
|
||||
|
||||
|
||||
45
library/wchar_wcstoll.c
Normal file
45
library/wchar_wcstoll.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* $Id: wchar_wcstoll.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _WCHAR_HEADERS_H
|
||||
#include "wchar_headers.h"
|
||||
#endif /* _WCHAR_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
long long
|
||||
wcstoll(const wchar_t *str, wchar_t **ptr, int base)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
}
|
||||
45
library/wchar_wcstoull.c
Normal file
45
library/wchar_wcstoull.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* $Id: wchar_wcstoull.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _WCHAR_HEADERS_H
|
||||
#include "wchar_headers.h"
|
||||
#endif /* _WCHAR_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
unsigned long long
|
||||
wcstoull(const wchar_t *str, wchar_t **ptr, int base)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
}
|
||||
45
library/wctype_iswblank.c
Normal file
45
library/wctype_iswblank.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* $Id: wctype_iswblank.c,v 1.1 2005-05-12 13:21:44 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _WCTYPE_HEADERS_H
|
||||
#include <wctype.h>
|
||||
#endif /* _WCTYPE_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
iswblank(wint_t c)
|
||||
{
|
||||
/* ZZZ unimplemented */
|
||||
return(0);
|
||||
}
|
||||
Reference in New Issue
Block a user