enhanced __float128 handling

added qse_strvfmt() and qse_strxvfmt()
This commit is contained in:
2013-11-03 16:01:39 +00:00
parent fa47ad2965
commit 91c9182ad7
54 changed files with 447 additions and 248 deletions

View File

@ -199,6 +199,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@

View File

@ -234,6 +234,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@

View File

@ -1280,9 +1280,6 @@ protected:
/// @}
// primitive handlers
virtual int vsprintf (char_t* buf, size_t size,
const char_t* fmt, va_list arg) = 0;
virtual flt_t pow (flt_t x, flt_t y) = 0;
virtual flt_t mod (flt_t x, flt_t y) = 0;
virtual flt_t sin (flt_t x) = 0;
@ -1320,8 +1317,6 @@ protected:
static int functionHandler (rtx_t* rtx, const fnc_info_t* fi);
static int sprintf (awk_t* awk, char_t* buf, size_t size,
const char_t* fmt, ...);
static flt_t pow (awk_t* awk, flt_t x, flt_t y);
static flt_t mod (awk_t* awk, flt_t x, flt_t y);
static flt_t sin (awk_t* awk, flt_t x);

View File

@ -194,6 +194,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@

View File

@ -156,9 +156,6 @@ protected:
void* reallocMem (void* ptr, size_t n);
void freeMem (void* ptr);
int vsprintf (char_t* buf, size_t size,
const char_t* fmt, va_list arg);
flt_t pow (flt_t x, flt_t y);
flt_t mod (flt_t x, flt_t y);
flt_t sin (flt_t x);

View File

@ -396,14 +396,6 @@ typedef struct qse_awk_fun_t qse_awk_fun_t;
/* ------------------------------------------------------------------------ */
typedef int (*qse_awk_sprintf_t) (
qse_awk_t* awk,
qse_char_t* buf,
qse_size_t size,
const qse_char_t* fmt,
...
);
typedef qse_flt_t (*qse_awk_math1_t) (
qse_awk_t* awk,
qse_flt_t x
@ -651,8 +643,6 @@ typedef qse_ssize_t (*qse_awk_rio_impl_t) (
*/
struct qse_awk_prm_t
{
qse_awk_sprintf_t sprintf;
struct
{
qse_awk_math2_t pow; /**< floating-point power function */

View File

@ -199,6 +199,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@

View File

@ -23,6 +23,7 @@
#include <qse/types.h>
#include <qse/macros.h>
#include <stdarg.h>
/** \file
* This file provides various functions, types, macros for string manipulation.
@ -692,6 +693,12 @@ QSE_EXPORT qse_size_t qse_mbsfmt (
...
);
QSE_EXPORT qse_size_t qse_mbsvfmt (
qse_mchar_t* buf,
const qse_mchar_t* fmt,
va_list ap
);
/**
* The qse_mbsxfmt() function writes a formatted string into the buffer \a buf
* of the size \a bsz using the format \a fmt and the variable arguments. It
@ -714,12 +721,25 @@ QSE_EXPORT qse_size_t qse_mbsxfmt (
...
);
QSE_EXPORT qse_size_t qse_mbsxvfmt (
qse_mchar_t* buf,
qse_size_t bsz,
const qse_mchar_t* fmt,
va_list ap
);
QSE_EXPORT qse_size_t qse_wcsfmt (
qse_wchar_t* buf,
const qse_wchar_t* fmt,
...
);
QSE_EXPORT qse_size_t qse_wcsvfmt (
qse_wchar_t* buf,
const qse_wchar_t* fmt,
va_list ap
);
/**
* The qse_wcsxfmt() function writes a formatted string into the buffer \a buf
* of the size \a bsz using the format \a fmt and the variable arguments. It
@ -742,13 +762,24 @@ QSE_EXPORT qse_size_t qse_wcsxfmt (
...
);
QSE_EXPORT qse_size_t qse_wcsxvfmt (
qse_wchar_t* buf,
qse_size_t bsz,
const qse_wchar_t* fmt,
va_list ap
);
#if defined(QSE_CHAR_IS_MCHAR)
# define qse_strfmt qse_mbsfmt
# define qse_strvfmt qse_mbsvfmt
# define qse_strxfmt qse_mbsxfmt
# define qse_strxvfmt qse_mbsxvfmt
#else
# define qse_strfmt qse_wcsfmt
# define qse_strvfmt qse_wcsvfmt
# define qse_strxfmt qse_wcsxfmt
# define qse_strxvfmt qse_wcsxvfmt
#endif
/**

View File

@ -39,12 +39,18 @@
/* Define to 1 if you have the `atan2l' function. */
#undef HAVE_ATAN2L
/* Define to 1 if you have the `atan2q' function. */
#undef HAVE_ATAN2Q
/* Define to 1 if you have the `atanf' function. */
#undef HAVE_ATANF
/* Define to 1 if you have the `atanl' function. */
#undef HAVE_ATANL
/* Define to 1 if you have the `atanq' function. */
#undef HAVE_ATANQ
/* Define to 1 if you have the `backtrace' function. */
#undef HAVE_BACKTRACE
@ -60,6 +66,9 @@
/* Define to 1 if you have the `ceill' function. */
#undef HAVE_CEILL
/* Define to 1 if you have the `ceilq' function. */
#undef HAVE_CEILQ
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
@ -75,6 +84,9 @@
/* Define to 1 if you have the `cosl' function. */
#undef HAVE_COSL
/* Define to 1 if you have the `cosq' function. */
#undef HAVE_COSQ
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
@ -131,6 +143,9 @@
/* Define to 1 if you have the `expl' function. */
#undef HAVE_EXPL
/* Define to 1 if you have the `expq' function. */
#undef HAVE_EXPQ
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
@ -146,6 +161,9 @@
/* Define to 1 if you have the `floorl' function. */
#undef HAVE_FLOORL
/* Define to 1 if you have the `floorq' function. */
#undef HAVE_FLOORQ
/* Define to 1 if you have the `fmod' function. */
#undef HAVE_FMOD
@ -155,6 +173,9 @@
/* Define to 1 if you have the `fmodl' function. */
#undef HAVE_FMODL
/* Define to 1 if you have the `fmodq' function. */
#undef HAVE_FMODQ
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
@ -239,12 +260,18 @@
/* Define to 1 if you have the `log10l' function. */
#undef HAVE_LOG10L
/* Define to 1 if you have the `log10q' function. */
#undef HAVE_LOG10Q
/* Define to 1 if you have the `logf' function. */
#undef HAVE_LOGF
/* Define to 1 if you have the `logl' function. */
#undef HAVE_LOGL
/* Define to 1 if you have the `logq' function. */
#undef HAVE_LOGQ
/* Define to 1 if you have the `lseek64' function. */
#undef HAVE_LSEEK64
@ -305,6 +332,9 @@
/* Define to 1 if you have the `powl' function. */
#undef HAVE_POWL
/* Define to 1 if you have the `powq' function. */
#undef HAVE_POWQ
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL
@ -317,6 +347,12 @@
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the <quadmath.h> header file. */
#undef HAVE_QUADMATH_H
/* Define to 1 if you have the `quadmath_snprintf' function. */
#undef HAVE_QUADMATH_SNPRINTF
/* Define to 1 if you have the `readdir' function. */
#undef HAVE_READDIR
@ -332,6 +368,9 @@
/* Define to 1 if you have the `roundl' function. */
#undef HAVE_ROUNDL
/* Define to 1 if you have the `roundq' function. */
#undef HAVE_ROUNDQ
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
@ -368,6 +407,9 @@
/* Define to 1 if you have the `sinl' function. */
#undef HAVE_SINL
/* Define to 1 if you have the `sinq' function. */
#undef HAVE_SINQ
/* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T
@ -383,6 +425,9 @@
/* Define to 1 if you have the `sqrtl' function. */
#undef HAVE_SQRTL
/* Define to 1 if you have the `sqrtq' function. */
#undef HAVE_SQRTQ
/* ssl support */
#undef HAVE_SSL
@ -413,6 +458,9 @@
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strtoflt128' function. */
#undef HAVE_STRTOFLT128
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#undef HAVE_STRUCT_DIRENT_D_TYPE
@ -523,6 +571,9 @@
/* Define to 1 if you have the `tanl' function. */
#undef HAVE_TANL
/* Define to 1 if you have the `tanq' function. */
#undef HAVE_TANQ
/* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM

View File

@ -192,6 +192,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@

View File

@ -194,6 +194,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@

View File

@ -456,7 +456,7 @@ typedef qse_int_t qse_intptr_t;
* The qse_flt_t type defines the largest floating-pointer number type
* naturally supported.
*/
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__MINGW32__)
/* TODO: check if the support for long double is complete.
* if so, use long double for qse_flt_t */
typedef double qse_flt_t;
@ -473,7 +473,9 @@ typedef qse_int_t qse_intptr_t;
* The qse_fltmax_t type defines the largest floating-pointer number type
* ever supported.
*/
#if QSE_SIZEOF__FLOAT128 > QSE_SIZEOF_FLT_T
#if QSE_SIZEOF___FLOAT128 >= QSE_SIZEOF_FLT_T
/* the size of long double may be equal to the size of __float128
* for alignment on some platforms */
typedef __float128 qse_fltmax_t;
# define QSE_SIZEOF_FLTMAX_T QSE_SIZEOF___FLOAT128
#else
@ -481,7 +483,6 @@ typedef qse_int_t qse_intptr_t;
# define QSE_SIZEOF_FLTMAX_T QSE_SIZEOF_FLT_T
#endif
/** @typedef qse_ptrdiff_t
*/
typedef qse_ssize_t qse_ptrdiff_t;

View File

@ -192,6 +192,7 @@ QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@