fixed a minor build issue with mingw64.

renamed qse_real_t to qse_flt_t
This commit is contained in:
hyung-hwan 2011-11-22 05:03:31 +00:00
parent 5bd21d36b2
commit 350c75434c
38 changed files with 505 additions and 402 deletions

View File

@ -8,6 +8,6 @@ AM_CPPFLAGS = \
bin_PROGRAMS = qseawk
qseawk_SOURCES = awk.c
qseawk_LDFLAGS = -L../../lib/awk -L$(libdir)
qseawk_LDADD = -lqseawk $(LIBM)
qseawk_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir)
qseawk_LDADD = -lqseawk -lqsecmn $(LIBM)

View File

@ -224,8 +224,8 @@ AM_CPPFLAGS = \
-I$(includedir)
qseawk_SOURCES = awk.c
qseawk_LDFLAGS = -L../../lib/awk -L$(libdir)
qseawk_LDADD = -lqseawk $(LIBM)
qseawk_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir)
qseawk_LDADD = -lqseawk -lqsecmn $(LIBM)
all: all-am
.SUFFIXES:

View File

@ -343,7 +343,7 @@ static int fnc_sleep (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
qse_size_t nargs;
qse_awk_val_t* a0;
qse_long_t lv;
qse_real_t rv;
qse_flt_t rv;
qse_awk_val_t* r;
int n;

View File

@ -8,6 +8,6 @@ AM_CPPFLAGS = \
bin_PROGRAMS = qsecut
qsecut_SOURCES = cut.c
qsecut_LDFLAGS = -L../../lib/cut -L$(libdir)
qsecut_LDADD = -lqsecut
qsecut_LDFLAGS = -L../../lib/cut -L../../lib/cmn -L$(libdir)
qsecut_LDADD = -lqsecut -lqsecmn

View File

@ -223,8 +223,8 @@ AM_CPPFLAGS = \
-I$(includedir)
qsecut_SOURCES = cut.c
qsecut_LDFLAGS = -L../../lib/cut -L$(libdir)
qsecut_LDADD = -lqsecut
qsecut_LDFLAGS = -L../../lib/cut -L../../lib/cmn -L$(libdir)
qsecut_LDADD = -lqsecut -lqsecmn
all: all-am
.SUFFIXES:

View File

@ -8,6 +8,6 @@ AM_CPPFLAGS = \
bin_PROGRAMS = qsesed
qsesed_SOURCES = sed.c
qsesed_LDFLAGS = -L../../lib/sed -L$(libdir)
qsesed_LDADD = -lqsesed
qsesed_LDFLAGS = -L../../lib/sed -L../../lib/cmn -L$(libdir)
qsesed_LDADD = -lqsesed -lqsecmn

View File

@ -223,8 +223,8 @@ AM_CPPFLAGS = \
-I$(includedir)
qsesed_SOURCES = sed.c
qsesed_LDFLAGS = -L../../lib/sed -L$(libdir)
qsesed_LDADD = -lqsesed
qsesed_LDFLAGS = -L../../lib/sed -L../../lib/cmn -L$(libdir)
qsesed_LDADD = -lqsesed -lqsecmn
all: all-am
.SUFFIXES:

View File

@ -8,6 +8,6 @@ AM_CPPFLAGS = \
bin_PROGRAMS = qsestx
qsestx_SOURCES = stx.c
qsestx_LDFLAGS = -L../../lib/stx -L$(libdir)
qsestx_LDADD = -lqsestx $(LIBM)
qsestx_LDFLAGS = -L../../lib/stx -L../../lib/cmn -L$(libdir)
qsestx_LDADD = -lqsestx -lqsecmn $(LIBM)

View File

@ -224,8 +224,8 @@ AM_CPPFLAGS = \
-I$(includedir)
qsestx_SOURCES = stx.c
qsestx_LDFLAGS = -L../../lib/stx -L$(libdir)
qsestx_LDADD = -lqsestx $(LIBM)
qsestx_LDFLAGS = -L../../lib/stx -L../../lib/cmn -L$(libdir)
qsestx_LDADD = -lqsestx -lqsecmn $(LIBM)
all: all-am
.SUFFIXES:

41
qse/configure vendored
View File

@ -16422,6 +16422,40 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __float128" >&5
$as_echo_n "checking size of __float128... " >&6; }
if test "${ac_cv_sizeof___float128+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__float128))" "ac_cv_sizeof___float128" "
"; then :
else
if test "$ac_cv_type___float128" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (__float128)
See \`config.log' for more details" "$LINENO" 5 ; }
else
ac_cv_sizeof___float128=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___float128" >&5
$as_echo "$ac_cv_sizeof___float128" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF___FLOAT128 $ac_cv_sizeof___float128
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
@ -16661,6 +16695,12 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF___FLOAT128 ${ac_cv_sizeof___float128}
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_WCHAR_T ${ac_cv_sizeof_wchar_t}
_ACEOF
@ -16676,6 +16716,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_MBSTATE_T ${ac_cv_sizeof_mbstate_t}
_ACEOF

View File

@ -134,6 +134,7 @@ AC_CHECK_SIZEOF(void *,,[[]])
AC_CHECK_SIZEOF(float,,[[]])
AC_CHECK_SIZEOF(double,,[[]])
AC_CHECK_SIZEOF(long double,,[[]])
AC_CHECK_SIZEOF(__float128,,[[]])
AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_SIZEOF(off_t)
@ -157,9 +158,12 @@ AC_DEFINE_UNQUOTED(QSE_SIZEOF_VOID_P, ${ac_cv_sizeof_void_p}, [sizeof(void*)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_FLOAT, ${ac_cv_sizeof_float}, [sizeof(float)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_DOUBLE, ${ac_cv_sizeof_double}, [sizeof(double)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_LONG_DOUBLE, ${ac_cv_sizeof_long_double}, [sizeof(long double)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF___FLOAT128, ${ac_cv_sizeof___float128}, [sizeof(__float128)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_WCHAR_T, ${ac_cv_sizeof_wchar_t}, [sizeof(wchar_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_OFF_T, ${ac_cv_sizeof_off_t}, [sizeof(off_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_OFF64_T, ${ac_cv_sizeof_off64_t}, [sizeof(off64_t)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_MBSTATE_T, ${ac_cv_sizeof_mbstate_t}, [sizeof(mbstate_t)])
AC_DEFINE_UNQUOTED(QSE_MBLEN_MAX, ${ax_cv_numvalof_MB_LEN_MAX}, [MB_LEN_MAX])

View File

@ -36,22 +36,44 @@ class Types
public:
/** boolean data type */
typedef qse_bool_t bool_t;
/** data type that can hold any character */
typedef qse_char_t char_t;
/** data type that can hold any character or an end-of-file value */
typedef qse_cint_t cint_t;
/** redefines an unsigned integer number of the same size as void* */
typedef qse_size_t size_t;
/** signed version of size_t */
typedef qse_ssize_t ssize_t;
/** redefines an integer */
/** redefines qse_long_t */
typedef qse_long_t long_t;
/** redefines qse_ulong_t */
typedef qse_ulong_t ulong_t;
/** redefines qse_intptr_t */
typedef qse_intptr_t intptr_t;
/** redefines qse_uintptr_t */
typedef qse_uintptr_t uintptr_t;
/** redefines qse_intmax_t */
typedef qse_intmax_t intmax_t;
/** redefines qse_uintmax_t */
typedef qse_uintmax_t uintmax_t;
/** redefines a floating-point number */
typedef qse_real_t real_t;
typedef qse_flt_t flt_t;
/** redefines a structure of a constant character pointer and length */
typedef qse_cstr_t cstr_t;
/** redefines a structure of a character pointer and length */
typedef qse_xstr_t xstr_t;
typedef qse_xstr_t xstr_t;
};
/////////////////////////////////

View File

@ -566,7 +566,7 @@ public:
operator val_t* () const { return val; }
operator long_t () const;
operator real_t () const;
operator flt_t () const;
operator const char_t* () const;
val_t* toVal () const
@ -579,9 +579,9 @@ public:
return operator long_t ();
}
real_t toReal () const
flt_t toFlt () const
{
return operator real_t ();
return operator flt_t ();
}
const char_t* toStr (size_t* len) const
@ -600,7 +600,7 @@ public:
}
int getInt (long_t* v) const;
int getReal (real_t* v) const;
int getFlt (flt_t* v) const;
int getStr (const char_t** str, size_t* len) const;
int setVal (val_t* v);
@ -608,8 +608,8 @@ public:
int setInt (long_t v);
int setInt (Run* r, long_t v);
int setReal (real_t v);
int setReal (Run* r, real_t v);
int setFlt (flt_t v);
int setFlt (Run* r, flt_t v);
int setStr (const char_t* str, size_t len);
int setStr (Run* r, const char_t* str, size_t len);
int setStr (const char_t* str);
@ -636,15 +636,15 @@ public:
const Index& idx,
long_t v);
int setIndexedReal (
int setIndexedFlt (
const Index& idx,
real_t v
flt_t v
);
int setIndexedReal (
int setIndexedFlt (
Run* r,
const Index& idx,
real_t v
flt_t v
);
int setIndexedStr (
@ -775,7 +775,7 @@ public:
/// to @a v.
/// @return 0 on success, -1 on failure
///
int setGlobal (int id, real_t v);
int setGlobal (int id, flt_t v);
///
/// The setGlobal() function sets the value of a global
@ -1091,16 +1091,16 @@ protected:
virtual int vsprintf (char_t* buf, size_t size,
const char_t* fmt, va_list arg) = 0;
virtual real_t pow (real_t x, real_t y) = 0;
virtual real_t mod (real_t x, real_t y) = 0;
virtual real_t sin (real_t x) = 0;
virtual real_t cos (real_t x) = 0;
virtual real_t tan (real_t x) = 0;
virtual real_t atan (real_t x) = 0;
virtual real_t atan2 (real_t x, real_t y) = 0;
virtual real_t log (real_t x) = 0;
virtual real_t exp (real_t x) = 0;
virtual real_t sqrt (real_t x) = 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;
virtual flt_t cos (flt_t x) = 0;
virtual flt_t tan (flt_t x) = 0;
virtual flt_t atan (flt_t x) = 0;
virtual flt_t atan2 (flt_t x, flt_t y) = 0;
virtual flt_t log (flt_t x) = 0;
virtual flt_t exp (flt_t x) = 0;
virtual flt_t sqrt (flt_t x) = 0;
// static glue members for various handlers
static ssize_t readSource (
@ -1124,16 +1124,16 @@ protected:
static int sprintf (awk_t* data, char_t* buf, size_t size,
const char_t* fmt, ...);
static real_t pow (awk_t* data, real_t x, real_t y);
static real_t mod (awk_t* data, real_t x, real_t y);
static real_t sin (awk_t* data, real_t x);
static real_t cos (awk_t* data, real_t x);
static real_t tan (awk_t* data, real_t x);
static real_t atan (awk_t* data, real_t x);
static real_t atan2 (awk_t* data, real_t x, real_t y);
static real_t log (awk_t* data, real_t x);
static real_t exp (awk_t* data, real_t x);
static real_t sqrt (awk_t* data, real_t x);
static flt_t pow (awk_t* data, flt_t x, flt_t y);
static flt_t mod (awk_t* data, flt_t x, flt_t y);
static flt_t sin (awk_t* data, flt_t x);
static flt_t cos (awk_t* data, flt_t x);
static flt_t tan (awk_t* data, flt_t x);
static flt_t atan (awk_t* data, flt_t x);
static flt_t atan2 (awk_t* data, flt_t x, flt_t y);
static flt_t log (awk_t* data, flt_t x);
static flt_t exp (awk_t* data, flt_t x);
static flt_t sqrt (awk_t* data, flt_t x);
protected:
awk_t* awk;

View File

@ -141,16 +141,16 @@ protected:
int vsprintf (char_t* buf, size_t size,
const char_t* fmt, va_list arg);
real_t pow (real_t x, real_t y);
real_t mod (real_t x, real_t y);
real_t sin (real_t x);
real_t cos (real_t x);
real_t tan (real_t x);
real_t atan (real_t x);
real_t atan2 (real_t x, real_t y);
real_t log (real_t x);
real_t exp (real_t x);
real_t sqrt (real_t x);
flt_t pow (flt_t x, flt_t y);
flt_t mod (flt_t x, flt_t y);
flt_t sin (flt_t x);
flt_t cos (flt_t x);
flt_t tan (flt_t x);
flt_t atan (flt_t x);
flt_t atan2 (flt_t x, flt_t y);
flt_t log (flt_t x);
flt_t exp (flt_t x);
flt_t sqrt (flt_t x);
protected:
unsigned int seed;

View File

@ -183,16 +183,16 @@ struct qse_awk_val_int_t
typedef struct qse_awk_val_int_t qse_awk_val_int_t;
/**
* The qse_awk_val_real_t type is a floating-point number type. The type field
* is #QSE_AWK_VAL_REAL.
* The qse_awk_val_flt_t type is a floating-point number type. The type field
* is #QSE_AWK_VAL_FLT.
*/
struct qse_awk_val_real_t
struct qse_awk_val_flt_t
{
QSE_AWK_VAL_HDR;
qse_real_t val;
void* nde;
qse_flt_t val;
void* nde;
};
typedef struct qse_awk_val_real_t qse_awk_val_real_t;
typedef struct qse_awk_val_flt_t qse_awk_val_flt_t;
/**
* The qse_awk_val_str_t type is a string type. The type field is
@ -318,7 +318,7 @@ enum qse_awk_nde_type_t
QSE_AWK_NDE_FNC,
QSE_AWK_NDE_FUN,
QSE_AWK_NDE_INT,
QSE_AWK_NDE_REAL,
QSE_AWK_NDE_FLT,
QSE_AWK_NDE_STR,
QSE_AWK_NDE_REX,
@ -379,15 +379,15 @@ typedef int (*qse_awk_sprintf_t) (
...
);
typedef qse_real_t (*qse_awk_math1_t) (
typedef qse_flt_t (*qse_awk_math1_t) (
qse_awk_t* awk,
qse_real_t x
qse_flt_t x
);
typedef qse_real_t (*qse_awk_math2_t) (
typedef qse_flt_t (*qse_awk_math2_t) (
qse_awk_t* awk,
qse_real_t x,
qse_real_t y
qse_flt_t x,
qse_flt_t y
);
@ -1046,7 +1046,7 @@ enum qse_awk_val_type_t
* function in run.c */
QSE_AWK_VAL_NIL = 0, /**< nil */
QSE_AWK_VAL_INT = 1, /**< integer */
QSE_AWK_VAL_REAL = 2, /**< floating-pointer number */
QSE_AWK_VAL_FLT = 2, /**< floating-pointer number */
QSE_AWK_VAL_STR = 3, /**< string */
QSE_AWK_VAL_REX = 4, /**< regular expression */
@ -1509,10 +1509,10 @@ qse_long_t qse_awk_strxtolong (
);
/**
* The qse_awk_strxtoreal() function converts a string to a floating-point
* The qse_awk_strxtoflt() function converts a string to a floating-point
* number.
*/
qse_real_t qse_awk_strxtoreal (
qse_flt_t qse_awk_strxtoflt (
qse_awk_t* awk,
const qse_char_t* str,
qse_size_t len,
@ -1879,12 +1879,12 @@ qse_awk_val_t* qse_awk_rtx_makeintval (
);
/**
* The qse_awk_rtx_makerealval() function creates a floating-point value.
* The qse_awk_rtx_makefltval() function creates a floating-point value.
* @return value on success, QSE_NULL on failure
*/
qse_awk_val_t* qse_awk_rtx_makerealval (
qse_awk_val_t* qse_awk_rtx_makefltval (
qse_awk_rtx_t* rtx,
qse_real_t v
qse_flt_t v
);
/**
@ -2196,7 +2196,7 @@ qse_char_t* qse_awk_rtx_valtocpldup (
*
* @code
* qse_long_t l;
* qse_real_t r;
* qse_flt_t r;
* int n;
* n = qse_awk_rtx_valtonum (v, &l, &r);
* if (n <= -1) error ();
@ -2211,7 +2211,7 @@ int qse_awk_rtx_valtonum (
qse_awk_rtx_t* rtx,
const qse_awk_val_t* val,
qse_long_t* l,
qse_real_t* r
qse_flt_t* r
);
int qse_awk_rtx_valtolong (
@ -2220,10 +2220,10 @@ int qse_awk_rtx_valtolong (
qse_long_t* l
);
int qse_awk_rtx_valtoreal (
int qse_awk_rtx_valtoflt (
qse_awk_rtx_t* rtx,
const qse_awk_val_t* val,
qse_real_t* r
qse_flt_t* r
);
/**
@ -2246,7 +2246,7 @@ int qse_awk_rtx_strtonum (
const qse_char_t* ptr, /**< points to a string to convert */
qse_size_t len, /**< number of characters in a string */
qse_long_t* l, /**< stores a converted integer */
qse_real_t* r /**< stores a converted floating-poing number */
qse_flt_t* r /**< stores a converted floating-poing number */
);
/**

View File

@ -51,6 +51,12 @@ typedef qse_search_comper_t qse_sort_comper_t;
/**
* The qse_bsearch() function performs binary search over a sorted array.
* It looks for an item matching @a key in an array @a base containing
* @a nmemb items each of which is as large as @a size. The comparison
* function @a comper is invoked with @a key as the first parameter and
* an item being tested as the second parameter. The @a ctx parameter is
* passed to @a comper as the third parameter.
*
* See the example below:
* @code
* static int compstr (const void* s1, const void* s2, void* ctx)

View File

@ -389,6 +389,9 @@
/* sizeof(wchar_t) */
#undef QSE_SIZEOF_WCHAR_T
/* sizeof(__float128) */
#undef QSE_SIZEOF___FLOAT128
/* sizeof(__int128) */
#undef QSE_SIZEOF___INT128
@ -449,6 +452,9 @@
/* The size of `wchar_t', as computed by sizeof. */
#undef SIZEOF_WCHAR_T
/* The size of `__float128', as computed by sizeof. */
#undef SIZEOF___FLOAT128
/* The size of `__int128', as computed by sizeof. */
#undef SIZEOF___INT128

View File

@ -434,40 +434,61 @@ typedef qse_int_t qse_intptr_t;
#elif (QSE_SIZEOF_INTMAX_T == QSE_SIZEOF_INT128_T)
typedef qse_int128_t qse_intmax_t;
typedef qse_uint128_t qse_uintmax_t;
/* QSE_SIZEOF_INTMAX_T and QSE_SIZEOF_UINTMAX_T are
* defined when qse_int128_t is defined */
#elif (QSE_SIZEOF_INTMAX_T == QSE_SIZEOF_INT64_T)
typedef qse_int64_t qse_intmax_t;
typedef qse_uint64_t qse_uintmax_t;
/* QSE_SIZEOF_INTMAX_T and QSE_SIZEOF_UINTMAX_T are
* defined when qse_int64_t is defined */
#elif (QSE_SIZEOF_INTMAX_T == QSE_SIZEOF_INT32_T)
typedef qse_int32_t qse_intmax_t;
typedef qse_uint32_t qse_uintmax_t;
/* QSE_SIZEOF_INTMAX_T and QSE_SIZEOF_UINTMAX_T are
* defined when qse_int32_t is defined */
#elif (QSE_SIZEOF_INTMAX_T == QSE_SIZEOF_INT16_T)
typedef qse_int16_t qse_intmax_t;
typedef qse_uint16_t qse_uintmax_t;
/* QSE_SIZEOF_INTMAX_T and QSE_SIZEOF_UINTMAX_T are
* defined when qse_int16_t is defined */
#elif (QSE_SIZEOF_INTMAX_T == QSE_SIZEOF_INT8_T)
typedef qse_int8_t qse_intmax_t;
typedef qse_uint8_t qse_uintmax_t;
/* QSE_SIZEOF_INTMAX_T and QSE_SIZEOF_UINTMAX_T are
* defined when qse_int8_t is defined */
#else
# error FATAL. THIS MUST NOT HAPPEN
#endif
/** @typedef qse_real_t
* The qse_real_t type defines the largest floating-pointer number type
/** @typedef qse_flt_t
* The qse_flt_t type defines the largest floating-pointer number type
* supported.
*/
#if defined(__FreeBSD__)
/* TODO: check if the support for long double is complete.
* if so, use long double for qse_real_t */
# define QSE_SIZEOF_REAL QSE_SIZEOF_DOUBLE
typedef double qse_real_t;
* if so, use long double for qse_flt_t */
typedef double qse_flt_t;
# define QSE_SIZEOF_FLT_T QSE_SIZEOF_DOUBLE
#elif QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE
# define QSE_SIZEOF_REAL QSE_SIZEOF_LONG_DOUBLE
typedef long double qse_real_t;
typedef long double qse_flt_t;
# define QSE_SIZEOF_FLT_T QSE_SIZEOF_LONG_DOUBLE
#else
# define QSE_SIZEOF_REAL QSE_SIZEOF_DOUBLE
typedef double qse_real_t;
typedef double qse_flt_t;
# define QSE_SIZEOF_FLT_T QSE_SIZEOF_DOUBLE
#endif
/* TODO: qse_fltmax_t to include the quadruple precision floating-point type.
*
#if QSE_SIZEOF___FLOAT128 > 0
typedef __float128 qse_fltmax_t;
# define QSE_SIZEOF_FLTMAX_T QSE_SIZEOF___FLOAT128
#else
typedef qse_flt_t qse_fltmax_t;
# define QSE_SIZEOF_FLTMAX_T QSE_SIZEOF_FLT_T
#endif
*/
/**
* The qse_mchar_t type defines a multi-byte character type.
*/
@ -754,11 +775,11 @@ union qse_ubi_t
qse_uintptr_t uintptr;
qse_intmax_t intmax;
qse_uintmax_t uintmax;
qse_real_t real;
qse_flt_t flt;
qse_char_t cha;
qse_mchar_t mchar;
qse_wchar_t wchar;
qse_char_t ch;
qse_mchar_t mch;
qse_wchar_t wch;
qse_cint_t cint;
qse_mcint_t mcint;
qse_wcint_t wcint;

View File

@ -356,10 +356,10 @@ Awk::Value::operator Awk::long_t () const
return v;
}
Awk::Value::operator Awk::real_t () const
Awk::Value::operator Awk::flt_t () const
{
real_t v;
if (getReal (&v) <= -1) v = 0.0;
flt_t v;
if (getFlt (&v) <= -1) v = 0.0;
return v;
}
@ -393,9 +393,9 @@ int Awk::Value::getInt (long_t* v) const
return 0;
}
int Awk::Value::getReal (real_t* v) const
int Awk::Value::getFlt (flt_t* v) const
{
real_t rv = 0;
flt_t rv = 0;
QSE_ASSERT (val != QSE_NULL);
@ -403,7 +403,7 @@ int Awk::Value::getReal (real_t* v) const
val->type != QSE_AWK_VAL_NIL &&
val->type != QSE_AWK_VAL_MAP)
{
int n = qse_awk_rtx_valtoreal (run->rtx, val, &rv);
int n = qse_awk_rtx_valtoflt (run->rtx, val, &rv);
if (n <= -1)
{
run->awk->retrieveError (run);
@ -522,7 +522,7 @@ int Awk::Value::setInt (Run* r, long_t v)
return n;
}
int Awk::Value::setReal (real_t v)
int Awk::Value::setFlt (flt_t v)
{
if (this->run == QSE_NULL)
{
@ -530,13 +530,13 @@ int Awk::Value::setReal (real_t v)
* set an error number for the same reason */
return -1;
}
return setReal (this->run, v);
return setFlt (this->run, v);
}
int Awk::Value::setReal (Run* r, real_t v)
int Awk::Value::setFlt (Run* r, flt_t v)
{
val_t* tmp;
tmp = qse_awk_rtx_makerealval (r->rtx, v);
tmp = qse_awk_rtx_makefltval (r->rtx, v);
if (tmp == QSE_NULL)
{
r->awk->retrieveError (r);
@ -686,15 +686,15 @@ int Awk::Value::setIndexedInt (Run* r, const Index& idx, long_t v)
return n;
}
int Awk::Value::setIndexedReal (const Index& idx, real_t v)
int Awk::Value::setIndexedFlt (const Index& idx, flt_t v)
{
if (run == QSE_NULL) return -1;
return setIndexedReal (run, idx, v);
return setIndexedFlt (run, idx, v);
}
int Awk::Value::setIndexedReal (Run* r, const Index& idx, real_t v)
int Awk::Value::setIndexedFlt (Run* r, const Index& idx, flt_t v)
{
val_t* tmp = qse_awk_rtx_makerealval (r->rtx, v);
val_t* tmp = qse_awk_rtx_makefltval (r->rtx, v);
if (tmp == QSE_NULL)
{
r->awk->retrieveError (r);
@ -917,11 +917,11 @@ int Awk::Run::setGlobal (int id, long_t v)
return n;
}
int Awk::Run::setGlobal (int id, real_t v)
int Awk::Run::setGlobal (int id, flt_t v)
{
QSE_ASSERT (this->rtx != QSE_NULL);
val_t* tmp = qse_awk_rtx_makerealval (this->rtx, v);
val_t* tmp = qse_awk_rtx_makefltval (this->rtx, v);
if (tmp == QSE_NULL) return -1;
qse_awk_rtx_refupval (this->rtx, tmp);
@ -1744,61 +1744,61 @@ int Awk::sprintf (awk_t* awk, char_t* buf, size_t size,
return n;
}
Awk::real_t Awk::pow (awk_t* awk, real_t x, real_t y)
Awk::flt_t Awk::pow (awk_t* awk, flt_t x, flt_t y)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->pow (x, y);
}
Awk::real_t Awk::mod (awk_t* awk, real_t x, real_t y)
Awk::flt_t Awk::mod (awk_t* awk, flt_t x, flt_t y)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->mod (x, y);
}
Awk::real_t Awk::sin (awk_t* awk, real_t x)
Awk::flt_t Awk::sin (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->sin (x);
}
Awk::real_t Awk::cos (awk_t* awk, real_t x)
Awk::flt_t Awk::cos (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->cos (x);
}
Awk::real_t Awk::tan (awk_t* awk, real_t x)
Awk::flt_t Awk::tan (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->tan (x);
}
Awk::real_t Awk::atan (awk_t* awk, real_t x)
Awk::flt_t Awk::atan (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->atan (x);
}
Awk::real_t Awk::atan2 (awk_t* awk, real_t x, real_t y)
Awk::flt_t Awk::atan2 (awk_t* awk, flt_t x, flt_t y)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->atan2 (x, y);
}
Awk::real_t Awk::log (awk_t* awk, real_t x)
Awk::flt_t Awk::log (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->log (x);
}
Awk::real_t Awk::exp (awk_t* awk, real_t x)
Awk::flt_t Awk::exp (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->exp (x);
}
Awk::real_t Awk::sqrt (awk_t* awk, real_t x)
Awk::flt_t Awk::sqrt (awk_t* awk, flt_t x)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);
return xtn->awk->sqrt (x);

View File

@ -78,7 +78,7 @@ void StdAwk::close ()
int StdAwk::rand (Run& run, Value& ret, const Value* args, size_t nargs,
const char_t* name, size_t len)
{
return ret.setReal ((real_t)(::rand() % RAND_MAX) / RAND_MAX);
return ret.setFlt ((flt_t)(::rand() % RAND_MAX) / RAND_MAX);
}
int StdAwk::srand (Run& run, Value& ret, const Value* args, size_t nargs,
@ -647,7 +647,7 @@ int StdAwk::vsprintf (
return qse_vsprintf (buf, size, fmt, arg);
}
StdAwk::real_t StdAwk::pow (real_t x, real_t y)
StdAwk::flt_t StdAwk::pow (flt_t x, flt_t y)
{
#if defined(HAVE_POWL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::powl (x, y);
@ -660,7 +660,7 @@ StdAwk::real_t StdAwk::pow (real_t x, real_t y)
#endif
}
StdAwk::real_t StdAwk::mod (real_t x, real_t y)
StdAwk::flt_t StdAwk::mod (flt_t x, flt_t y)
{
#if defined(HAVE_FMODL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::fmodl (x, y);
@ -673,7 +673,7 @@ StdAwk::real_t StdAwk::mod (real_t x, real_t y)
#endif
}
StdAwk::real_t StdAwk::sin (real_t x)
StdAwk::flt_t StdAwk::sin (flt_t x)
{
#if defined(HAVE_SINL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::sinl (x);
@ -686,7 +686,7 @@ StdAwk::real_t StdAwk::sin (real_t x)
#endif
}
StdAwk::real_t StdAwk::cos (real_t x)
StdAwk::flt_t StdAwk::cos (flt_t x)
{
#if defined(HAVE_COSL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::cosl (x);
@ -699,7 +699,7 @@ StdAwk::real_t StdAwk::cos (real_t x)
#endif
}
StdAwk::real_t StdAwk::tan (real_t x)
StdAwk::flt_t StdAwk::tan (flt_t x)
{
#if defined(HAVE_TANL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::tanl (x);
@ -712,7 +712,7 @@ StdAwk::real_t StdAwk::tan (real_t x)
#endif
}
StdAwk::real_t StdAwk::atan (real_t x)
StdAwk::flt_t StdAwk::atan (flt_t x)
{
#if defined(HAVE_ATANL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::atanl (x);
@ -725,7 +725,7 @@ StdAwk::real_t StdAwk::atan (real_t x)
#endif
}
StdAwk::real_t StdAwk::atan2 (real_t x, real_t y)
StdAwk::flt_t StdAwk::atan2 (flt_t x, flt_t y)
{
#if defined(HAVE_ATAN2L) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::atan2l (x, y);
@ -738,7 +738,7 @@ StdAwk::real_t StdAwk::atan2 (real_t x, real_t y)
#endif
}
StdAwk::real_t StdAwk::log (real_t x)
StdAwk::flt_t StdAwk::log (flt_t x)
{
#if defined(HAVE_LOGL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::logl (x);
@ -751,7 +751,7 @@ StdAwk::real_t StdAwk::log (real_t x)
#endif
}
StdAwk::real_t StdAwk::exp (real_t x)
StdAwk::flt_t StdAwk::exp (flt_t x)
{
#if defined(HAVE_EXPL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::expl (x);
@ -764,7 +764,7 @@ StdAwk::real_t StdAwk::exp (real_t x)
#endif
}
StdAwk::real_t StdAwk::sqrt (real_t x)
StdAwk::flt_t StdAwk::sqrt (flt_t x)
{
#if defined(HAVE_SQRTL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return ::sqrtl (x);

View File

@ -268,7 +268,7 @@ struct qse_awk_rtx_t
{
qse_awk_val_int_t* ifree;
qse_awk_val_chunk_t* ichunk;
qse_awk_val_real_t* rfree;
qse_awk_val_flt_t* rfree;
qse_awk_val_chunk_t* rchunk;
} vmgr;

View File

@ -1394,7 +1394,7 @@ static int fnc_math_1 (
{
qse_size_t nargs;
qse_awk_val_t* a0;
qse_real_t rv;
qse_flt_t rv;
qse_awk_val_t* r;
int n;
@ -1403,10 +1403,10 @@ static int fnc_math_1 (
a0 = qse_awk_rtx_getarg (rtx, 0);
n = qse_awk_rtx_valtoreal (rtx, a0, &rv);
n = qse_awk_rtx_valtoflt (rtx, a0, &rv);
if (n <= -1) return -1;
r = qse_awk_rtx_makerealval (rtx, f (rtx->awk, rv));
r = qse_awk_rtx_makefltval (rtx, f (rtx->awk, rv));
if (r == QSE_NULL) return -1;
qse_awk_rtx_setretval (rtx, r);
@ -1418,7 +1418,7 @@ static int fnc_math_2 (
{
qse_size_t nargs;
qse_awk_val_t* a0, * a1;
qse_real_t rv0, rv1;
qse_flt_t rv0, rv1;
qse_awk_val_t* r;
int n;
@ -1428,13 +1428,13 @@ static int fnc_math_2 (
a0 = qse_awk_rtx_getarg (rtx, 0);
a1 = qse_awk_rtx_getarg (rtx, 1);
n = qse_awk_rtx_valtoreal (rtx, a0, &rv0);
n = qse_awk_rtx_valtoflt (rtx, a0, &rv0);
if (n <= -1) return -1;
n = qse_awk_rtx_valtoreal (rtx, a1, &rv1);
n = qse_awk_rtx_valtoflt (rtx, a1, &rv1);
if (n <= -1) return -1;
r = qse_awk_rtx_makerealval (rtx, f (rtx->awk, rv0, rv1));
r = qse_awk_rtx_makefltval (rtx, f (rtx->awk, rv0, rv1));
if (r == QSE_NULL) return -1;
qse_awk_rtx_setretval (rtx, r);

View File

@ -161,19 +161,19 @@ qse_long_t qse_awk_strxtolong (
#define MAX_EXPONENT 511
qse_real_t qse_awk_strtoreal (qse_awk_t* awk, const qse_char_t* str)
qse_flt_t qse_awk_strtoreal (qse_awk_t* awk, const qse_char_t* str)
{
/*
* Table giving binary powers of 10. Entry is 10^2^i.
* Used to convert decimal exponents into floating-point numbers.
*/
static qse_real_t powers_of_10[] =
static qse_flt_t powers_of_10[] =
{
10., 100., 1.0e4, 1.0e8, 1.0e16,
1.0e32, 1.0e64, 1.0e128, 1.0e256
};
qse_real_t fraction, dbl_exp, * d;
qse_flt_t fraction, dbl_exp, * d;
const qse_char_t* p;
qse_cint_t c;
int exp = 0; /* Esseonent read from "EX" field */
@ -351,7 +351,7 @@ done:
return (negative)? -fraction: fraction;
}
qse_real_t qse_awk_strxtoreal (
qse_flt_t qse_awk_strxtoflt (
qse_awk_t* awk, const qse_char_t* str, qse_size_t len,
const qse_char_t** endptr)
{
@ -359,13 +359,13 @@ qse_real_t qse_awk_strxtoreal (
* Table giving binary powers of 10. Entry is 10^2^i.
* Used to convert decimal exponents into floating-point numbers.
*/
static qse_real_t powers_of_10[] =
static qse_flt_t powers_of_10[] =
{
10., 100., 1.0e4, 1.0e8, 1.0e16,
1.0e32, 1.0e64, 1.0e128, 1.0e256
};
qse_real_t fraction, dbl_exp, * d;
qse_flt_t fraction, dbl_exp, * d;
const qse_char_t* p, * end;
qse_cint_t c;
int exp = 0; /* Esseonent read from "EX" field */
@ -435,7 +435,7 @@ qse_real_t qse_awk_strxtoreal (
mant_size--; /* One of the digits was the point */
}
if (mant_size > 18) /* TODO: is 18 correct for qse_real_t??? */
if (mant_size > 18) /* TODO: is 18 correct for qse_flt_t??? */
{
frac_exp = dec_pt - 18;
mant_size = 18;
@ -1108,8 +1108,8 @@ void qse_awk_rtx_freemem (qse_awk_rtx_t* rtx, void* ptr)
qse_awk_freemem (rtx->awk, ptr);
}
int qse_awk_sprintreal (
qse_awk_t* awk, qse_char_t* buf, qse_size_t len, qse_real_t num)
int qse_awk_sprintflt (
qse_awk_t* awk, qse_char_t* buf, qse_size_t len, qse_flt_t num)
{
return awk->prm.sprintf (
awk, buf, len,

View File

@ -76,11 +76,11 @@ int qse_awk_matchrex (
qse_cstr_t* match, qse_awk_errnum_t* errnum
);
int qse_awk_sprintreal (
int qse_awk_sprintflt (
qse_awk_t* awk,
qse_char_t* buf,
qse_size_t len,
qse_real_t num
qse_flt_t num
);

View File

@ -114,7 +114,7 @@ enum tok_t
TOK_GETLINE,
TOK_IDENT,
TOK_INT,
TOK_REAL,
TOK_FLT,
TOK_STR,
TOK_REX,
@ -3266,19 +3266,19 @@ static qse_awk_nde_t* parse_expr_dc (
#define INT_BINOP_INT(x,op,y) \
(((qse_awk_nde_int_t*)x)->val op ((qse_awk_nde_int_t*)y)->val)
#define INT_BINOP_REAL(x,op,y) \
(((qse_awk_nde_int_t*)x)->val op ((qse_awk_nde_real_t*)y)->val)
#define INT_BINOP_FLT(x,op,y) \
(((qse_awk_nde_int_t*)x)->val op ((qse_awk_nde_flt_t*)y)->val)
#define REAL_BINOP_INT(x,op,y) \
(((qse_awk_nde_real_t*)x)->val op ((qse_awk_nde_int_t*)y)->val)
#define FLT_BINOP_INT(x,op,y) \
(((qse_awk_nde_flt_t*)x)->val op ((qse_awk_nde_int_t*)y)->val)
#define REAL_BINOP_REAL(x,op,y) \
(((qse_awk_nde_real_t*)x)->val op ((qse_awk_nde_real_t*)y)->val)
#define FLT_BINOP_FLT(x,op,y) \
(((qse_awk_nde_flt_t*)x)->val op ((qse_awk_nde_flt_t*)y)->val)
union folded_t
{
qse_long_t l;
qse_real_t r;
qse_flt_t r;
};
typedef union folded_t folded_t;
@ -3312,9 +3312,9 @@ static int fold_constants_for_binop (
case QSE_AWK_BINOP_DIV:
if (INT_BINOP_INT(left,%,right))
{
folded->r = (qse_real_t)((qse_awk_nde_int_t*)left)->val /
(qse_real_t)((qse_awk_nde_int_t*)right)->val;
fold = QSE_AWK_NDE_REAL;
folded->r = (qse_flt_t)((qse_awk_nde_int_t*)left)->val /
(qse_flt_t)((qse_awk_nde_int_t*)right)->val;
fold = QSE_AWK_NDE_FLT;
break;
}
/* fall through here */
@ -3331,38 +3331,38 @@ static int fold_constants_for_binop (
break;
}
}
else if (left->type == QSE_AWK_NDE_REAL &&
right->type == QSE_AWK_NDE_REAL)
else if (left->type == QSE_AWK_NDE_FLT &&
right->type == QSE_AWK_NDE_FLT)
{
fold = QSE_AWK_NDE_REAL;
fold = QSE_AWK_NDE_FLT;
switch (opcode)
{
case QSE_AWK_BINOP_PLUS:
folded->r = REAL_BINOP_REAL(left,+,right);
folded->r = FLT_BINOP_FLT(left,+,right);
break;
case QSE_AWK_BINOP_MINUS:
folded->r = REAL_BINOP_REAL(left,-,right);
folded->r = FLT_BINOP_FLT(left,-,right);
break;
case QSE_AWK_BINOP_MUL:
folded->r = REAL_BINOP_REAL(left,*,right);
folded->r = FLT_BINOP_FLT(left,*,right);
break;
case QSE_AWK_BINOP_DIV:
folded->r = REAL_BINOP_REAL(left,/,right);
folded->r = FLT_BINOP_FLT(left,/,right);
break;
case QSE_AWK_BINOP_IDIV:
folded->l = (qse_long_t)REAL_BINOP_REAL(left,/,right);
folded->l = (qse_long_t)FLT_BINOP_FLT(left,/,right);
fold = QSE_AWK_NDE_INT;
break;
case QSE_AWK_BINOP_MOD:
folded->r = awk->prm.math.mod (
awk,
((qse_awk_nde_real_t*)left)->val,
((qse_awk_nde_real_t*)right)->val
((qse_awk_nde_flt_t*)left)->val,
((qse_awk_nde_flt_t*)right)->val
);
break;
@ -3372,39 +3372,39 @@ static int fold_constants_for_binop (
}
}
else if (left->type == QSE_AWK_NDE_INT &&
right->type == QSE_AWK_NDE_REAL)
right->type == QSE_AWK_NDE_FLT)
{
fold = QSE_AWK_NDE_REAL;
fold = QSE_AWK_NDE_FLT;
switch (opcode)
{
case QSE_AWK_BINOP_PLUS:
folded->r = INT_BINOP_REAL(left,+,right);
folded->r = INT_BINOP_FLT(left,+,right);
break;
case QSE_AWK_BINOP_MINUS:
folded->r = INT_BINOP_REAL(left,-,right);
folded->r = INT_BINOP_FLT(left,-,right);
break;
case QSE_AWK_BINOP_MUL:
folded->r = INT_BINOP_REAL(left,*,right);
folded->r = INT_BINOP_FLT(left,*,right);
break;
case QSE_AWK_BINOP_DIV:
folded->r = INT_BINOP_REAL(left,/,right);
folded->r = INT_BINOP_FLT(left,/,right);
break;
case QSE_AWK_BINOP_IDIV:
folded->l = (qse_long_t)
((qse_real_t)((qse_awk_nde_int_t*)left)->val /
((qse_awk_nde_real_t*)right)->val);
((qse_flt_t)((qse_awk_nde_int_t*)left)->val /
((qse_awk_nde_flt_t*)right)->val);
fold = QSE_AWK_NDE_INT;
break;
case QSE_AWK_BINOP_MOD:
folded->r = awk->prm.math.mod (
awk,
(qse_real_t)((qse_awk_nde_int_t*)left)->val,
((qse_awk_nde_real_t*)right)->val
(qse_flt_t)((qse_awk_nde_int_t*)left)->val,
((qse_awk_nde_flt_t*)right)->val
);
break;
@ -3413,40 +3413,40 @@ static int fold_constants_for_binop (
break;
}
}
else if (left->type == QSE_AWK_NDE_REAL &&
else if (left->type == QSE_AWK_NDE_FLT &&
right->type == QSE_AWK_NDE_INT)
{
fold = QSE_AWK_NDE_REAL;
fold = QSE_AWK_NDE_FLT;
switch (opcode)
{
case QSE_AWK_BINOP_PLUS:
folded->r = REAL_BINOP_INT(left,+,right);
folded->r = FLT_BINOP_INT(left,+,right);
break;
case QSE_AWK_BINOP_MINUS:
folded->r = REAL_BINOP_INT(left,-,right);
folded->r = FLT_BINOP_INT(left,-,right);
break;
case QSE_AWK_BINOP_MUL:
folded->r = REAL_BINOP_INT(left,*,right);
folded->r = FLT_BINOP_INT(left,*,right);
break;
case QSE_AWK_BINOP_DIV:
folded->r = REAL_BINOP_INT(left,/,right);
folded->r = FLT_BINOP_INT(left,/,right);
break;
case QSE_AWK_BINOP_IDIV:
folded->l = (qse_long_t)
(((qse_awk_nde_int_t*)left)->val /
(qse_real_t)((qse_awk_nde_int_t*)right)->val);
(qse_flt_t)((qse_awk_nde_int_t*)right)->val);
fold = QSE_AWK_NDE_INT;
break;
case QSE_AWK_BINOP_MOD:
folded->r = awk->prm.math.mod (
awk,
((qse_awk_nde_real_t*)left)->val,
(qse_real_t)((qse_awk_nde_int_t*)right)->val
((qse_awk_nde_flt_t*)left)->val,
(qse_flt_t)((qse_awk_nde_int_t*)right)->val
);
break;
@ -3502,12 +3502,12 @@ static qse_awk_nde_t* new_int_node (
return (qse_awk_nde_t*)tmp;
}
static qse_awk_nde_t* new_real_node (
qse_awk_t* awk, qse_real_t rv, const qse_awk_loc_t* loc)
static qse_awk_nde_t* new_flt_node (
qse_awk_t* awk, qse_flt_t rv, const qse_awk_loc_t* loc)
{
qse_awk_nde_real_t* tmp;
qse_awk_nde_flt_t* tmp;
tmp = (qse_awk_nde_real_t*) QSE_AWK_ALLOC (awk, QSE_SIZEOF(*tmp));
tmp = (qse_awk_nde_flt_t*) QSE_AWK_ALLOC (awk, QSE_SIZEOF(*tmp));
if (tmp == QSE_NULL)
{
SETERR_LOC (awk, QSE_AWK_ENOMEM, loc);
@ -3515,7 +3515,7 @@ static qse_awk_nde_t* new_real_node (
}
QSE_MEMSET (tmp, 0, QSE_SIZEOF(*tmp));
tmp->type = QSE_AWK_NDE_REAL;
tmp->type = QSE_AWK_NDE_FLT;
tmp->loc = *loc;
tmp->val = rv;
@ -3534,8 +3534,8 @@ static QSE_INLINE void update_int_node (
}
}
static QSE_INLINE void update_real_node (
qse_awk_t* awk, qse_awk_nde_real_t* node, qse_real_t rv)
static QSE_INLINE void update_flt_node (
qse_awk_t* awk, qse_awk_nde_flt_t* node, qse_flt_t rv)
{
node->val = rv;
if (node->str)
@ -3615,17 +3615,17 @@ static qse_awk_nde_t* parse_binary (
break;
case QSE_AWK_NDE_REAL:
case QSE_AWK_NDE_FLT:
if (fold == left->type)
{
qse_awk_clrpt (awk, right);
right = QSE_NULL;
update_real_node (awk, (qse_awk_nde_real_t*)left, folded.r);
update_flt_node (awk, (qse_awk_nde_flt_t*)left, folded.r);
}
else if (fold == right->type)
{
qse_awk_clrpt (awk, left);
update_real_node (awk, (qse_awk_nde_real_t*)right, folded.r);
update_flt_node (awk, (qse_awk_nde_flt_t*)right, folded.r);
left = right;
right = QSE_NULL;
}
@ -3634,7 +3634,7 @@ static qse_awk_nde_t* parse_binary (
qse_awk_clrpt (awk, right); right = QSE_NULL;
qse_awk_clrpt (awk, left); left = QSE_NULL;
left = new_real_node (awk, folded.r, xloc);
left = new_flt_node (awk, folded.r, xloc);
if (left == QSE_NULL) goto oops;
}
@ -3973,25 +3973,25 @@ static qse_awk_nde_t* parse_unary (
break;
}
}
else if (left->type == QSE_AWK_NDE_REAL)
else if (left->type == QSE_AWK_NDE_FLT)
{
fold = QSE_AWK_NDE_REAL;
fold = QSE_AWK_NDE_FLT;
switch (opcode)
{
case QSE_AWK_UNROP_PLUS:
folded.r = ((qse_awk_nde_real_t*)left)->val;
folded.r = ((qse_awk_nde_flt_t*)left)->val;
break;
case QSE_AWK_UNROP_MINUS:
folded.r = -((qse_awk_nde_real_t*)left)->val;
folded.r = -((qse_awk_nde_flt_t*)left)->val;
break;
case QSE_AWK_UNROP_LNOT:
folded.r = !((qse_awk_nde_real_t*)left)->val;
folded.r = !((qse_awk_nde_flt_t*)left)->val;
break;
case QSE_AWK_UNROP_BNOT:
folded.l = ~((qse_long_t)((qse_awk_nde_real_t*)left)->val);
folded.l = ~((qse_long_t)((qse_awk_nde_flt_t*)left)->val);
fold = QSE_AWK_NDE_INT;
break;
@ -4011,22 +4011,22 @@ static qse_awk_nde_t* parse_unary (
}
else
{
QSE_ASSERT (left->type == QSE_AWK_NDE_REAL);
QSE_ASSERT (left->type == QSE_AWK_NDE_FLT);
qse_awk_clrpt (awk, left);
return new_int_node (awk, folded.l, xloc);
}
case QSE_AWK_NDE_REAL:
case QSE_AWK_NDE_FLT:
if (left->type == fold)
{
update_real_node (awk, (qse_awk_nde_real_t*)left, folded.r);
update_flt_node (awk, (qse_awk_nde_flt_t*)left, folded.r);
return left;
}
else
{
QSE_ASSERT (left->type == QSE_AWK_NDE_INT);
qse_awk_clrpt (awk, left);
return new_real_node (awk, folded.r, xloc);
return new_flt_node (awk, folded.r, xloc);
}
default:
@ -4274,14 +4274,14 @@ static qse_awk_nde_t* parse_primary_nogetline (
return (qse_awk_nde_t*)nde;
}
else if (MATCH(awk,TOK_REAL))
else if (MATCH(awk,TOK_FLT))
{
qse_awk_nde_real_t* nde;
qse_awk_nde_flt_t* nde;
/* create the node for the literal */
nde = (qse_awk_nde_real_t*) new_real_node (
nde = (qse_awk_nde_flt_t*) new_flt_node (
awk,
qse_awk_strxtoreal (awk,
qse_awk_strxtoflt (awk,
QSE_STR_PTR(awk->tok.name),
QSE_STR_LEN(awk->tok.name),
QSE_NULL
@ -5347,7 +5347,7 @@ static int get_number (qse_awk_t* awk, qse_awk_tok_t* tok)
if (c == QSE_T('.'))
{
/* floating-point number */
SET_TOKEN_TYPE (awk, tok, TOK_REAL);
SET_TOKEN_TYPE (awk, tok, TOK_FLT);
ADD_TOKEN_CHAR (awk, tok, c);
GET_CHAR_TO (awk, c);
@ -5361,7 +5361,7 @@ static int get_number (qse_awk_t* awk, qse_awk_tok_t* tok)
if (c == QSE_T('E') || c == QSE_T('e'))
{
SET_TOKEN_TYPE (awk, tok, TOK_REAL);
SET_TOKEN_TYPE (awk, tok, TOK_FLT);
ADD_TOKEN_CHAR (awk, tok, c);
GET_CHAR_TO (awk, c);

View File

@ -432,8 +432,8 @@ static int set_global (
rtx->gbl.ignorecase =
((val->type == QSE_AWK_VAL_INT &&
((qse_awk_val_int_t*)val)->val != 0) ||
(val->type == QSE_AWK_VAL_REAL &&
((qse_awk_val_real_t*)val)->val != 0.0) ||
(val->type == QSE_AWK_VAL_FLT &&
((qse_awk_val_flt_t*)val)->val != 0.0) ||
(val->type == QSE_AWK_VAL_STR &&
((qse_awk_val_str_t*)val)->val.len != 0))? 1: 0;
break;
@ -3981,8 +3981,8 @@ static int __cmp_nil_int (
static int __cmp_nil_real (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right)
{
if (((qse_awk_val_real_t*)right)->val < 0) return 1;
if (((qse_awk_val_real_t*)right)->val > 0) return -1;
if (((qse_awk_val_flt_t*)right)->val < 0) return 1;
if (((qse_awk_val_flt_t*)right)->val > 0) return -1;
return 0;
}
@ -4014,9 +4014,9 @@ static int __cmp_int_real (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right)
{
if (((qse_awk_val_int_t*)left)->val >
((qse_awk_val_real_t*)right)->val) return 1;
((qse_awk_val_flt_t*)right)->val) return 1;
if (((qse_awk_val_int_t*)left)->val <
((qse_awk_val_real_t*)right)->val) return -1;
((qse_awk_val_flt_t*)right)->val) return -1;
return 0;
}
@ -4030,7 +4030,7 @@ static int __cmp_int_str (
if (rtx->awk->option & QSE_AWK_NCMPONSTR || right->nstr /*> 0*/)
{
qse_long_t ll;
qse_real_t rr;
qse_flt_t rr;
n = qse_awk_rtx_strtonum (
rtx, 1,
@ -4078,35 +4078,35 @@ static int __cmp_int_str (
return n;
}
static int __cmp_real_nil (
static int __cmp_flt_nil (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right)
{
if (((qse_awk_val_real_t*)left)->val > 0) return 1;
if (((qse_awk_val_real_t*)left)->val < 0) return -1;
if (((qse_awk_val_flt_t*)left)->val > 0) return 1;
if (((qse_awk_val_flt_t*)left)->val < 0) return -1;
return 0;
}
static int __cmp_real_int (
static int __cmp_flt_int (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right)
{
if (((qse_awk_val_real_t*)left)->val >
if (((qse_awk_val_flt_t*)left)->val >
((qse_awk_val_int_t*)right)->val) return 1;
if (((qse_awk_val_real_t*)left)->val <
if (((qse_awk_val_flt_t*)left)->val <
((qse_awk_val_int_t*)right)->val) return -1;
return 0;
}
static int __cmp_real_real (
static int __cmp_flt_real (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right)
{
if (((qse_awk_val_real_t*)left)->val >
((qse_awk_val_real_t*)right)->val) return 1;
if (((qse_awk_val_real_t*)left)->val <
((qse_awk_val_real_t*)right)->val) return -1;
if (((qse_awk_val_flt_t*)left)->val >
((qse_awk_val_flt_t*)right)->val) return 1;
if (((qse_awk_val_flt_t*)left)->val <
((qse_awk_val_flt_t*)right)->val) return -1;
return 0;
}
static int __cmp_real_str (
static int __cmp_flt_str (
qse_awk_rtx_t* rtx, qse_awk_val_t* left, qse_awk_val_t* right)
{
qse_awk_rtx_valtostr_out_t out;
@ -4116,9 +4116,9 @@ static int __cmp_real_str (
if (rtx->awk->option & QSE_AWK_NCMPONSTR || right->nstr /*> 0*/)
{
const qse_char_t* end;
qse_real_t rr;
qse_flt_t rr;
rr = qse_awk_strxtoreal (
rr = qse_awk_strxtoflt (
rtx->awk,
((qse_awk_val_str_t*)right)->val.ptr,
((qse_awk_val_str_t*)right)->val.len,
@ -4127,8 +4127,8 @@ static int __cmp_real_str (
if (end == ((qse_awk_val_str_t*)right)->val.ptr +
((qse_awk_val_str_t*)right)->val.len)
{
return (((qse_awk_val_real_t*)left)->val > rr)? 1:
(((qse_awk_val_real_t*)left)->val < rr)? -1: 0;
return (((qse_awk_val_flt_t*)left)->val > rr)? 1:
(((qse_awk_val_flt_t*)left)->val < rr)? -1: 0;
}
}
@ -4173,7 +4173,7 @@ static int __cmp_str_int (
static int __cmp_str_real (
qse_awk_rtx_t* run, qse_awk_val_t* left, qse_awk_val_t* right)
{
return -__cmp_real_str (run, right, left);
return -__cmp_flt_str (run, right, left);
}
static int __cmp_str_str (
@ -4211,11 +4211,11 @@ static int __cmp_str_str (
}
else
{
qse_real_t rr;
qse_flt_t rr;
QSE_ASSERT (rs->nstr == 2);
rr = qse_awk_strxtoreal (
rr = qse_awk_strxtoflt (
rtx->awk, rs->val.ptr, rs->val.len, QSE_NULL);
return (ll > rr)? 1:
@ -4224,11 +4224,11 @@ static int __cmp_str_str (
}
else
{
qse_real_t ll;
qse_flt_t ll;
QSE_ASSERT (ls->nstr == 2);
ll = qse_awk_strxtoreal (
ll = qse_awk_strxtoflt (
rtx->awk, ls->val.ptr, ls->val.len, QSE_NULL);
if (rs->nstr == 1)
@ -4243,11 +4243,11 @@ static int __cmp_str_str (
}
else
{
qse_real_t rr;
qse_flt_t rr;
QSE_ASSERT (rs->nstr == 2);
rr = qse_awk_strxtoreal (
rr = qse_awk_strxtoflt (
rtx->awk, rs->val.ptr, rs->val.len, QSE_NULL);
return (ll > rr)? 1:
@ -4267,7 +4267,7 @@ static int __cmp_val (
* the QSE_AWK_VAL_XXX values in awk.h */
__cmp_nil_nil, __cmp_nil_int, __cmp_nil_real, __cmp_nil_str,
__cmp_int_nil, __cmp_int_int, __cmp_int_real, __cmp_int_str,
__cmp_real_nil, __cmp_real_int, __cmp_real_real, __cmp_real_str,
__cmp_flt_nil, __cmp_flt_int, __cmp_flt_real, __cmp_flt_str,
__cmp_str_nil, __cmp_str_int, __cmp_str_real, __cmp_str_str,
};
@ -4371,7 +4371,7 @@ static qse_awk_val_t* eval_binop_plus (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2;
qse_flt_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
@ -4392,9 +4392,9 @@ static qse_awk_val_t* eval_binop_plus (
QSE_ASSERT (n3 >= 0 && n3 <= 3);
return (n3 == 0)? qse_awk_rtx_makeintval(rtx,(qse_long_t)l1+(qse_long_t)l2):
(n3 == 1)? qse_awk_rtx_makerealval(rtx,(qse_real_t)r1+(qse_real_t)l2):
(n3 == 2)? qse_awk_rtx_makerealval(rtx,(qse_real_t)l1+(qse_real_t)r2):
qse_awk_rtx_makerealval(rtx,(qse_real_t)r1+(qse_real_t)r2);
(n3 == 1)? qse_awk_rtx_makefltval(rtx,(qse_flt_t)r1+(qse_flt_t)l2):
(n3 == 2)? qse_awk_rtx_makefltval(rtx,(qse_flt_t)l1+(qse_flt_t)r2):
qse_awk_rtx_makefltval(rtx,(qse_flt_t)r1+(qse_flt_t)r2);
}
static qse_awk_val_t* eval_binop_minus (
@ -4402,7 +4402,7 @@ static qse_awk_val_t* eval_binop_minus (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2;
qse_flt_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
@ -4416,9 +4416,9 @@ static qse_awk_val_t* eval_binop_minus (
n3 = n1 + (n2 << 1);
QSE_ASSERT (n3 >= 0 && n3 <= 3);
return (n3 == 0)? qse_awk_rtx_makeintval(rtx,(qse_long_t)l1-(qse_long_t)l2):
(n3 == 1)? qse_awk_rtx_makerealval(rtx,(qse_real_t)r1-(qse_real_t)l2):
(n3 == 2)? qse_awk_rtx_makerealval(rtx,(qse_real_t)l1-(qse_real_t)r2):
qse_awk_rtx_makerealval(rtx,(qse_real_t)r1-(qse_real_t)r2);
(n3 == 1)? qse_awk_rtx_makefltval(rtx,(qse_flt_t)r1-(qse_flt_t)l2):
(n3 == 2)? qse_awk_rtx_makefltval(rtx,(qse_flt_t)l1-(qse_flt_t)r2):
qse_awk_rtx_makefltval(rtx,(qse_flt_t)r1-(qse_flt_t)r2);
}
static qse_awk_val_t* eval_binop_mul (
@ -4426,7 +4426,7 @@ static qse_awk_val_t* eval_binop_mul (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2;
qse_flt_t r1, r2;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
n2 = qse_awk_rtx_valtonum (rtx, right, &l2, &r2);
@ -4440,9 +4440,9 @@ static qse_awk_val_t* eval_binop_mul (
n3 = n1 + (n2 << 1);
QSE_ASSERT (n3 >= 0 && n3 <= 3);
return (n3 == 0)? qse_awk_rtx_makeintval(rtx,(qse_long_t)l1*(qse_long_t)l2):
(n3 == 1)? qse_awk_rtx_makerealval(rtx,(qse_real_t)r1*(qse_real_t)l2):
(n3 == 2)? qse_awk_rtx_makerealval(rtx,(qse_real_t)l1*(qse_real_t)r2):
qse_awk_rtx_makerealval(rtx,(qse_real_t)r1*(qse_real_t)r2);
(n3 == 1)? qse_awk_rtx_makefltval(rtx,(qse_flt_t)r1*(qse_flt_t)l2):
(n3 == 2)? qse_awk_rtx_makefltval(rtx,(qse_flt_t)l1*(qse_flt_t)r2):
qse_awk_rtx_makefltval(rtx,(qse_flt_t)r1*(qse_flt_t)r2);
}
static qse_awk_val_t* eval_binop_div (
@ -4450,7 +4450,7 @@ static qse_awk_val_t* eval_binop_div (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2;
qse_flt_t r1, r2;
qse_awk_val_t* res;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
@ -4479,24 +4479,24 @@ static qse_awk_val_t* eval_binop_div (
}
else
{
res = qse_awk_rtx_makerealval (
rtx, (qse_real_t)l1 / (qse_real_t)l2);
res = qse_awk_rtx_makefltval (
rtx, (qse_flt_t)l1 / (qse_flt_t)l2);
}
break;
case 1:
res = qse_awk_rtx_makerealval (
rtx, (qse_real_t)r1 / (qse_real_t)l2);
res = qse_awk_rtx_makefltval (
rtx, (qse_flt_t)r1 / (qse_flt_t)l2);
break;
case 2:
res = qse_awk_rtx_makerealval (
rtx, (qse_real_t)l1 / (qse_real_t)r2);
res = qse_awk_rtx_makefltval (
rtx, (qse_flt_t)l1 / (qse_flt_t)r2);
break;
case 3:
res = qse_awk_rtx_makerealval (
rtx, (qse_real_t)r1 / (qse_real_t)r2);
res = qse_awk_rtx_makefltval (
rtx, (qse_flt_t)r1 / (qse_flt_t)r2);
break;
}
@ -4508,7 +4508,7 @@ static qse_awk_val_t* eval_binop_idiv (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2, quo;
qse_flt_t r1, r2, quo;
qse_awk_val_t* res;
n1 = qse_awk_rtx_valtonum (rtx, left, &l1, &r1);
@ -4534,17 +4534,17 @@ static qse_awk_val_t* eval_binop_idiv (
break;
case 1:
quo = (qse_real_t)r1 / (qse_real_t)l2;
quo = (qse_flt_t)r1 / (qse_flt_t)l2;
res = qse_awk_rtx_makeintval (rtx, (qse_long_t)quo);
break;
case 2:
quo = (qse_real_t)l1 / (qse_real_t)r2;
quo = (qse_flt_t)l1 / (qse_flt_t)r2;
res = qse_awk_rtx_makeintval (rtx, (qse_long_t)quo);
break;
case 3:
quo = (qse_real_t)r1 / (qse_real_t)r2;
quo = (qse_flt_t)r1 / (qse_flt_t)r2;
res = qse_awk_rtx_makeintval (rtx, (qse_long_t)quo);
break;
}
@ -4557,7 +4557,7 @@ static qse_awk_val_t* eval_binop_mod (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2;
qse_flt_t r1, r2;
qse_awk_val_t* res;
QSE_ASSERTX (rtx->awk->prm.math.mod != QSE_NULL,
@ -4587,23 +4587,23 @@ static qse_awk_val_t* eval_binop_mod (
break;
case 1:
res = qse_awk_rtx_makerealval (rtx,
res = qse_awk_rtx_makefltval (rtx,
rtx->awk->prm.math.mod (
rtx->awk, (qse_real_t)r1, (qse_real_t)l2)
rtx->awk, (qse_flt_t)r1, (qse_flt_t)l2)
);
break;
case 2:
res = qse_awk_rtx_makerealval (rtx,
res = qse_awk_rtx_makefltval (rtx,
rtx->awk->prm.math.mod (
rtx->awk, (qse_real_t)l1, (qse_real_t)r2)
rtx->awk, (qse_flt_t)l1, (qse_flt_t)r2)
);
break;
case 3:
res = qse_awk_rtx_makerealval (rtx,
res = qse_awk_rtx_makefltval (rtx,
rtx->awk->prm.math.mod (
rtx->awk, (qse_real_t)r1, (qse_real_t)r2)
rtx->awk, (qse_flt_t)r1, (qse_flt_t)r2)
);
break;
}
@ -4616,7 +4616,7 @@ static qse_awk_val_t* eval_binop_exp (
{
int n1, n2, n3;
qse_long_t l1, l2;
qse_real_t r1, r2;
qse_flt_t r1, r2;
qse_awk_val_t* res;
QSE_ASSERTX (rtx->awk->prm.math.pow != QSE_NULL,
@ -4650,10 +4650,10 @@ static qse_awk_val_t* eval_binop_exp (
}
else
{
qse_real_t v = 1.0;
qse_flt_t v = 1.0;
l2 *= -1;
while (l2-- > 0) v /= l1;
res = qse_awk_rtx_makerealval (rtx, v);
res = qse_awk_rtx_makefltval (rtx, v);
}
break;
@ -4661,9 +4661,9 @@ static qse_awk_val_t* eval_binop_exp (
/* left - real, right - int */
if (l2 >= 0)
{
qse_real_t v = 1.0;
qse_flt_t v = 1.0;
while (l2-- > 0) v *= r1;
res = qse_awk_rtx_makerealval (rtx, v);
res = qse_awk_rtx_makefltval (rtx, v);
}
else if (r1 == 0.0)
{
@ -4672,29 +4672,29 @@ static qse_awk_val_t* eval_binop_exp (
}
else
{
qse_real_t v = 1.0;
qse_flt_t v = 1.0;
l2 *= -1;
while (l2-- > 0) v /= r1;
res = qse_awk_rtx_makerealval (rtx, v);
res = qse_awk_rtx_makefltval (rtx, v);
}
break;
case 2:
/* left - int, right - real */
res = qse_awk_rtx_makerealval (
res = qse_awk_rtx_makefltval (
rtx,
rtx->awk->prm.math.pow (
rtx->awk, (qse_real_t)l1, (qse_real_t)r2
rtx->awk, (qse_flt_t)l1, (qse_flt_t)r2
)
);
break;
case 3:
/* left - real, right - real */
res = qse_awk_rtx_makerealval (
res = qse_awk_rtx_makefltval (
rtx,
rtx->awk->prm.math.pow (
rtx->awk, (qse_real_t)r1,(qse_real_t)r2
rtx->awk, (qse_flt_t)r1,(qse_flt_t)r2
)
);
break;
@ -4915,7 +4915,7 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
qse_awk_nde_exp_t* exp = (qse_awk_nde_exp_t*)nde;
int n;
qse_long_t l;
qse_real_t r;
qse_flt_t r;
QSE_ASSERT (
exp->type == QSE_AWK_NDE_EXP_UNR);
@ -4940,7 +4940,7 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
if (n <= -1) goto exit_func;
res = (n == 0)? qse_awk_rtx_makeintval (run, -l):
qse_awk_rtx_makerealval (run, -r);
qse_awk_rtx_makefltval (run, -r);
break;
case QSE_AWK_UNROP_LNOT:
@ -4955,7 +4955,7 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
if (n <= -1) goto exit_func;
res = (n == 0)? qse_awk_rtx_makeintval (run, !l):
qse_awk_rtx_makerealval (run, !r);
qse_awk_rtx_makefltval (run, !r);
}
break;
@ -4971,7 +4971,7 @@ static qse_awk_val_t* eval_unary (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
if (n <= -1) goto exit_func;
res = (n == 0)? qse_awk_rtx_makeintval (run, l):
qse_awk_rtx_makerealval (run, r);
qse_awk_rtx_makefltval (run, r);
break;
}
@ -5019,10 +5019,10 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
}
else if (left->type == QSE_AWK_VAL_REAL)
else if (left->type == QSE_AWK_VAL_FLT)
{
qse_real_t r = ((qse_awk_val_real_t*)left)->val;
res = qse_awk_rtx_makerealval (run, r + 1.0);
qse_flt_t r = ((qse_awk_val_flt_t*)left)->val;
res = qse_awk_rtx_makefltval (run, r + 1.0);
if (res == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5033,7 +5033,7 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else
{
qse_long_t v1;
qse_real_t v2;
qse_flt_t v2;
int n;
n = qse_awk_rtx_valtonum (run, left, &v1, &v2);
@ -5051,7 +5051,7 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else /* if (n == 1) */
{
QSE_ASSERT (n == 1);
res = qse_awk_rtx_makerealval (run, v2 + 1.0);
res = qse_awk_rtx_makefltval (run, v2 + 1.0);
}
if (res == QSE_NULL)
@ -5075,10 +5075,10 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
}
else if (left->type == QSE_AWK_VAL_REAL)
else if (left->type == QSE_AWK_VAL_FLT)
{
qse_real_t r = ((qse_awk_val_real_t*)left)->val;
res = qse_awk_rtx_makerealval (run, r - 1.0);
qse_flt_t r = ((qse_awk_val_flt_t*)left)->val;
res = qse_awk_rtx_makefltval (run, r - 1.0);
if (res == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5089,7 +5089,7 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else
{
qse_long_t v1;
qse_real_t v2;
qse_flt_t v2;
int n;
n = qse_awk_rtx_valtonum (run, left, &v1, &v2);
@ -5107,7 +5107,7 @@ static qse_awk_val_t* eval_incpre (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else /* if (n == 1) */
{
QSE_ASSERT (n == 1);
res = qse_awk_rtx_makerealval (run, v2 - 1.0);
res = qse_awk_rtx_makefltval (run, v2 - 1.0);
}
if (res == QSE_NULL)
@ -5183,10 +5183,10 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
}
else if (left->type == QSE_AWK_VAL_REAL)
else if (left->type == QSE_AWK_VAL_FLT)
{
qse_real_t r = ((qse_awk_val_real_t*)left)->val;
res = qse_awk_rtx_makerealval (run, r);
qse_flt_t r = ((qse_awk_val_flt_t*)left)->val;
res = qse_awk_rtx_makefltval (run, r);
if (res == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5194,7 +5194,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
res2 = qse_awk_rtx_makerealval (run, r + 1.0);
res2 = qse_awk_rtx_makefltval (run, r + 1.0);
if (res2 == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5206,7 +5206,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else
{
qse_long_t v1;
qse_real_t v2;
qse_flt_t v2;
int n;
n = qse_awk_rtx_valtonum (run, left, &v1, &v2);
@ -5239,7 +5239,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else /* if (n == 1) */
{
QSE_ASSERT (n == 1);
res = qse_awk_rtx_makerealval (run, v2);
res = qse_awk_rtx_makefltval (run, v2);
if (res == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5247,7 +5247,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
res2 = qse_awk_rtx_makerealval (run, v2 + 1.0);
res2 = qse_awk_rtx_makefltval (run, v2 + 1.0);
if (res2 == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5280,10 +5280,10 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
}
else if (left->type == QSE_AWK_VAL_REAL)
else if (left->type == QSE_AWK_VAL_FLT)
{
qse_real_t r = ((qse_awk_val_real_t*)left)->val;
res = qse_awk_rtx_makerealval (run, r);
qse_flt_t r = ((qse_awk_val_flt_t*)left)->val;
res = qse_awk_rtx_makefltval (run, r);
if (res == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5291,7 +5291,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
res2 = qse_awk_rtx_makerealval (run, r - 1.0);
res2 = qse_awk_rtx_makefltval (run, r - 1.0);
if (res2 == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5303,7 +5303,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else
{
qse_long_t v1;
qse_real_t v2;
qse_flt_t v2;
int n;
n = qse_awk_rtx_valtonum (run, left, &v1, &v2);
@ -5336,7 +5336,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
else /* if (n == 1) */
{
QSE_ASSERT (n == 1);
res = qse_awk_rtx_makerealval (run, v2);
res = qse_awk_rtx_makefltval (run, v2);
if (res == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -5344,7 +5344,7 @@ static qse_awk_val_t* eval_incpst (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
return QSE_NULL;
}
res2 = qse_awk_rtx_makerealval (run, v2 - 1.0);
res2 = qse_awk_rtx_makefltval (run, v2 - 1.0);
if (res2 == QSE_NULL)
{
qse_awk_rtx_refdownval (run, left);
@ -6054,13 +6054,13 @@ static qse_awk_val_t* eval_real (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
{
qse_awk_val_t* val;
val = qse_awk_rtx_makerealval (run, ((qse_awk_nde_real_t*)nde)->val);
val = qse_awk_rtx_makefltval (run, ((qse_awk_nde_flt_t*)nde)->val);
if (val == QSE_NULL)
{
ADJERR_LOC (run, &nde->loc);
return QSE_NULL;
}
((qse_awk_val_real_t*)val)->nde = nde;
((qse_awk_val_flt_t*)val)->nde = nde;
return val;
}
@ -7126,7 +7126,7 @@ wp_mod_main:
fmt[i] == QSE_T('f'))
{
qse_awk_val_t* v;
qse_real_t r;
qse_flt_t r;
int n;
FMT_CHAR (QSE_T('L'));
@ -7160,7 +7160,7 @@ wp_mod_main:
}
qse_awk_rtx_refupval (rtx, v);
n = qse_awk_rtx_valtoreal (rtx, v, &r);
n = qse_awk_rtx_valtoflt (rtx, v, &r);
qse_awk_rtx_refdownval (rtx, v);
if (n <= -1) return QSE_NULL;
@ -7234,9 +7234,9 @@ wp_mod_main:
ch = (qse_char_t)((qse_awk_val_int_t*)v)->val;
ch_len = 1;
}
else if (v->type == QSE_AWK_VAL_REAL)
else if (v->type == QSE_AWK_VAL_FLT)
{
ch = (qse_char_t)((qse_awk_val_real_t*)v)->val;
ch = (qse_char_t)((qse_awk_val_flt_t*)v)->val;
ch_len = 1;
}
else if (v->type == QSE_AWK_VAL_STR)

View File

@ -115,7 +115,7 @@ typedef struct rxtn_t
} rxtn_t;
static qse_real_t custom_awk_pow (qse_awk_t* awk, qse_real_t x, qse_real_t y)
static qse_flt_t custom_awk_pow (qse_awk_t* awk, qse_flt_t x, qse_flt_t y)
{
#if defined(HAVE_POWL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return powl (x, y);
@ -128,7 +128,7 @@ static qse_real_t custom_awk_pow (qse_awk_t* awk, qse_real_t x, qse_real_t y)
#endif
}
static qse_real_t custom_awk_mod (qse_awk_t* awk, qse_real_t x, qse_real_t y)
static qse_flt_t custom_awk_mod (qse_awk_t* awk, qse_flt_t x, qse_flt_t y)
{
#if defined(HAVE_FMODL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return fmodl (x, y);
@ -141,7 +141,7 @@ static qse_real_t custom_awk_mod (qse_awk_t* awk, qse_real_t x, qse_real_t y)
#endif
}
static qse_real_t custom_awk_sin (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_sin (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_SINL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return sinl (x);
@ -154,7 +154,7 @@ static qse_real_t custom_awk_sin (qse_awk_t* awk, qse_real_t x)
#endif
}
static qse_real_t custom_awk_cos (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_cos (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_COSL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return cosl (x);
@ -167,7 +167,7 @@ static qse_real_t custom_awk_cos (qse_awk_t* awk, qse_real_t x)
#endif
}
static qse_real_t custom_awk_tan (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_tan (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_TANL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return tanl (x);
@ -180,7 +180,7 @@ static qse_real_t custom_awk_tan (qse_awk_t* awk, qse_real_t x)
#endif
}
static qse_real_t custom_awk_atan (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_atan (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_ATANL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return atanl (x);
@ -193,7 +193,7 @@ static qse_real_t custom_awk_atan (qse_awk_t* awk, qse_real_t x)
#endif
}
static qse_real_t custom_awk_atan2 (qse_awk_t* awk, qse_real_t x, qse_real_t y)
static qse_flt_t custom_awk_atan2 (qse_awk_t* awk, qse_flt_t x, qse_flt_t y)
{
#if defined(HAVE_ATAN2L) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return atan2l (x, y);
@ -206,7 +206,7 @@ static qse_real_t custom_awk_atan2 (qse_awk_t* awk, qse_real_t x, qse_real_t y)
#endif
}
static qse_real_t custom_awk_log (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_log (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_LOGL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return logl (x);
@ -219,7 +219,7 @@ static qse_real_t custom_awk_log (qse_awk_t* awk, qse_real_t x)
#endif
}
static qse_real_t custom_awk_exp (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_exp (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_EXPL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return expl (x);
@ -232,7 +232,7 @@ static qse_real_t custom_awk_exp (qse_awk_t* awk, qse_real_t x)
#endif
}
static qse_real_t custom_awk_sqrt (qse_awk_t* awk, qse_real_t x)
static qse_flt_t custom_awk_sqrt (qse_awk_t* awk, qse_flt_t x)
{
#if defined(HAVE_SQRTL) && (QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE)
return sqrtl (x);
@ -1395,11 +1395,11 @@ static int fnc_rand (qse_awk_rtx_t* run, const qse_cstr_t* fnm)
/*
rxtn_t* rxtn;
rxtn = (rxtn_t*) QSE_XTN (run);
r = qse_awk_rtx_makerealval (
run, (qse_real_t)(rand_r(rxtn->seed) % RAND_MAX) / RAND_MAX );
r = qse_awk_rtx_makefltval (
run, (qse_flt_t)(rand_r(rxtn->seed) % RAND_MAX) / RAND_MAX );
*/
r = qse_awk_rtx_makerealval (
run, (qse_real_t)(rand() % RAND_MAX) / RAND_MAX);
r = qse_awk_rtx_makefltval (
run, (qse_flt_t)(rand() % RAND_MAX) / RAND_MAX);
if (r == QSE_NULL) return -1;
qse_awk_rtx_setretval (run, r);

View File

@ -294,20 +294,20 @@ static int print_expr (qse_awk_t* awk, qse_awk_nde_t* nde)
break;
}
case QSE_AWK_NDE_REAL:
case QSE_AWK_NDE_FLT:
{
if (((qse_awk_nde_real_t*)nde)->str)
if (((qse_awk_nde_flt_t*)nde)->str)
{
PUT_SRCSTRX (awk,
((qse_awk_nde_real_t*)nde)->str,
((qse_awk_nde_real_t*)nde)->len);
((qse_awk_nde_flt_t*)nde)->str,
((qse_awk_nde_flt_t*)nde)->len);
}
else
{
qse_char_t buf[64];
qse_awk_sprintreal (
qse_awk_sprintflt (
awk, buf, QSE_COUNTOF(buf),
((qse_awk_nde_real_t*)nde)->val);
((qse_awk_nde_flt_t*)nde)->val);
PUT_SRCSTR (awk, buf);
}
break;
@ -1270,10 +1270,10 @@ void qse_awk_clrpt (qse_awk_t* awk, qse_awk_nde_t* tree)
break;
}
case QSE_AWK_NDE_REAL:
case QSE_AWK_NDE_FLT:
{
if (((qse_awk_nde_real_t*)p)->str)
QSE_AWK_FREE (awk, ((qse_awk_nde_real_t*)p)->str);
if (((qse_awk_nde_flt_t*)p)->str)
QSE_AWK_FREE (awk, ((qse_awk_nde_flt_t*)p)->str);
QSE_AWK_FREE (awk, p);
break;
}

View File

@ -52,7 +52,7 @@ typedef struct qse_awk_nde_cnd_t qse_awk_nde_cnd_t;
typedef struct qse_awk_nde_pos_t qse_awk_nde_pos_t;
typedef struct qse_awk_nde_int_t qse_awk_nde_int_t;
typedef struct qse_awk_nde_real_t qse_awk_nde_real_t;
typedef struct qse_awk_nde_flt_t qse_awk_nde_flt_t;
typedef struct qse_awk_nde_str_t qse_awk_nde_str_t;
typedef struct qse_awk_nde_rex_t qse_awk_nde_rex_t;
@ -128,16 +128,16 @@ struct qse_awk_nde_pos_t
struct qse_awk_nde_int_t
{
QSE_AWK_NDE_HDR;
qse_long_t val;
qse_long_t val;
qse_char_t* str;
qse_size_t len;
};
/* QSE_AWK_NDE_REAL */
struct qse_awk_nde_real_t
/* QSE_AWK_NDE_FLT */
struct qse_awk_nde_flt_t
{
QSE_AWK_NDE_HDR;
qse_real_t val;
qse_flt_t val;
qse_char_t* str;
qse_size_t len;
};

View File

@ -127,19 +127,19 @@ qse_awk_val_t* qse_awk_rtx_makeintval (qse_awk_rtx_t* rtx, qse_long_t v)
return (qse_awk_val_t*)val;
}
qse_awk_val_t* qse_awk_rtx_makerealval (qse_awk_rtx_t* rtx, qse_real_t v)
qse_awk_val_t* qse_awk_rtx_makefltval (qse_awk_rtx_t* rtx, qse_flt_t v)
{
qse_awk_val_real_t* val;
qse_awk_val_flt_t* val;
if (rtx->vmgr.rfree == QSE_NULL)
{
qse_awk_val_rchunk_t* c;
/*qse_awk_val_real_t* x;*/
/*qse_awk_val_flt_t* x;*/
qse_size_t i;
/* c = QSE_AWK_ALLOC (run->awk,
QSE_SIZEOF(qse_awk_val_chunk_t)+
QSE_SIZEOF(qse_awk_val_real_t)*CHUNKSIZE); */
QSE_SIZEOF(qse_awk_val_flt_t)*CHUNKSIZE); */
c = QSE_AWK_ALLOC (rtx->awk, QSE_SIZEOF(qse_awk_val_rchunk_t));
if (c == QSE_NULL)
{
@ -152,32 +152,32 @@ qse_awk_val_t* qse_awk_rtx_makerealval (qse_awk_rtx_t* rtx, qse_real_t v)
rtx->vmgr.rchunk = (qse_awk_val_chunk_t*)c;
/*
x = (qse_awk_val_real_t*)(c + 1);
x = (qse_awk_val_flt_t*)(c + 1);
for (i = 0; i < CHUNKSIZE-1; i++)
x[i].nde = (qse_awk_nde_real_t*)&x[i+1];
x[i].nde = (qse_awk_nde_flt_t*)&x[i+1];
x[i].nde = QSE_NULL;
run->vmgr.rfree = x;
*/
for (i = 0; i < CHUNKSIZE-1; i++)
c->slot[i].nde = (qse_awk_nde_real_t*)&c->slot[i+1];
c->slot[i].nde = (qse_awk_nde_flt_t*)&c->slot[i+1];
c->slot[i].nde = QSE_NULL;
rtx->vmgr.rfree = &c->slot[0];
}
val = rtx->vmgr.rfree;
rtx->vmgr.rfree = (qse_awk_val_real_t*)val->nde;
rtx->vmgr.rfree = (qse_awk_val_flt_t*)val->nde;
val->type = QSE_AWK_VAL_REAL;
val->type = QSE_AWK_VAL_FLT;
val->ref = 0;
val->nstr = 0;
val->val = v;
val->nde = QSE_NULL;
#ifdef DEBUG_VAL
qse_dprintf (QSE_T("makerealval => %Lf [%p]\n"), (double)v, val);
qse_dprintf (QSE_T("makefltval => %Lf [%p]\n"), (double)v, val);
#endif
return (qse_awk_val_t*)val;
}
@ -312,7 +312,7 @@ qse_awk_val_t* qse_awk_rtx_makenstrval (
int x;
qse_awk_val_t* v;
qse_long_t l;
qse_real_t r;
qse_flt_t r;
x = qse_awk_rtx_strtonum (rtx, 1, str, len, &l, &r);
v = qse_awk_rtx_makestrval (rtx, str, len);
@ -614,11 +614,11 @@ void qse_awk_rtx_freeval (
break;
}
case QSE_AWK_VAL_REAL:
case QSE_AWK_VAL_FLT:
{
((qse_awk_val_real_t*)val)->nde =
(qse_awk_nde_real_t*)rtx->vmgr.rfree;
rtx->vmgr.rfree = (qse_awk_val_real_t*)val;
((qse_awk_val_flt_t*)val)->nde =
(qse_awk_nde_flt_t*)rtx->vmgr.rfree;
rtx->vmgr.rfree = (qse_awk_val_flt_t*)val;
break;
}
@ -744,8 +744,8 @@ qse_bool_t qse_awk_rtx_valtobool (qse_awk_rtx_t* run, const qse_awk_val_t* val)
return QSE_FALSE;
case QSE_AWK_VAL_INT:
return ((qse_awk_val_int_t*)val)->val != 0;
case QSE_AWK_VAL_REAL:
return ((qse_awk_val_real_t*)val)->val != 0.0;
case QSE_AWK_VAL_FLT:
return ((qse_awk_val_flt_t*)val)->val != 0.0;
case QSE_AWK_VAL_STR:
return ((qse_awk_val_str_t*)val)->val.len > 0;
case QSE_AWK_VAL_REX: /* TODO: is this correct? */
@ -959,8 +959,8 @@ static int val_int_to_str (
return 0;
}
static int val_real_to_str (
qse_awk_rtx_t* rtx, const qse_awk_val_real_t* v,
static int val_flt_to_str (
qse_awk_rtx_t* rtx, const qse_awk_val_flt_t* v,
qse_awk_rtx_valtostr_out_t* out)
{
qse_char_t* tmp;
@ -1002,7 +1002,7 @@ static int val_real_to_str (
switch (type)
{
case QSE_AWK_RTX_VALTOSTR_CPL:
/* CPL and CPLCP behave the same for real_t.
/* CPL and CPLCP behave the same for flt_t.
* i just fall through assuming that cplcpy
* and cpl are the same type. the following
* assertion at least ensure that they have
@ -1092,10 +1092,10 @@ int qse_awk_rtx_valtostr (
rtx, (qse_awk_val_int_t*)v, out);
}
case QSE_AWK_VAL_REAL:
case QSE_AWK_VAL_FLT:
{
return val_real_to_str (
rtx, (qse_awk_val_real_t*)v, out);
return val_flt_to_str (
rtx, (qse_awk_val_flt_t*)v, out);
}
case QSE_AWK_VAL_STR:
@ -1128,7 +1128,7 @@ qse_char_t* qse_awk_rtx_valtocpldup (
}
int qse_awk_rtx_valtonum (
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_long_t* l, qse_real_t* r)
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_long_t* l, qse_flt_t* r)
{
switch (v->type)
{
@ -1144,9 +1144,9 @@ int qse_awk_rtx_valtonum (
return 0; /* long */
}
case QSE_AWK_VAL_REAL:
case QSE_AWK_VAL_FLT:
{
*r = ((qse_awk_val_real_t*)v)->val;
*r = ((qse_awk_val_flt_t*)v)->val;
return 1; /* real */
}
@ -1176,7 +1176,7 @@ int qse_awk_rtx_valtolong (
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_long_t* l)
{
int n;
qse_real_t r;
qse_flt_t r;
n = qse_awk_rtx_valtonum (rtx, v, l, &r);
if (n == 1)
@ -1188,14 +1188,14 @@ int qse_awk_rtx_valtolong (
return n;
}
int qse_awk_rtx_valtoreal (
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_real_t* r)
int qse_awk_rtx_valtoflt (
qse_awk_rtx_t* rtx, const qse_awk_val_t* v, qse_flt_t* r)
{
int n;
qse_long_t l;
n = qse_awk_rtx_valtonum (rtx, v, &l, r);
if (n == 0) *r = (qse_real_t)l;
if (n == 0) *r = (qse_flt_t)l;
else if (n == 1) n = 0;
return n;
@ -1204,7 +1204,7 @@ int qse_awk_rtx_valtoreal (
int qse_awk_rtx_strtonum (
qse_awk_rtx_t* rtx, int strict,
const qse_char_t* ptr, qse_size_t len,
qse_long_t* l, qse_real_t* r)
qse_long_t* l, qse_flt_t* r)
{
const qse_char_t* endptr;
@ -1214,7 +1214,7 @@ int qse_awk_rtx_strtonum (
*endptr == QSE_T('E') ||
*endptr == QSE_T('e')))
{
*r = qse_awk_strxtoreal (rtx->awk, ptr, len, &endptr);
*r = qse_awk_strxtoflt (rtx->awk, ptr, len, &endptr);
if (strict && endptr < ptr + len) return -1;
return 1; /* real */
}
@ -1271,13 +1271,13 @@ void qse_awk_dprintval (qse_awk_rtx_t* run, qse_awk_val_t* val)
#endif
break;
case QSE_AWK_VAL_REAL:
case QSE_AWK_VAL_FLT:
#if defined(__MINGW32__)
DPRINTF (DCUSTOM, QSE_T("%Lf"),
(double)((qse_awk_val_real_t*)val)->val);
(double)((qse_awk_val_flt_t*)val)->val);
#else
DPRINTF (DCUSTOM, QSE_T("%Lf"),
(long double)((qse_awk_val_real_t*)val)->val);
(long double)((qse_awk_val_flt_t*)val)->val);
#endif
break;

View File

@ -47,7 +47,7 @@ struct qse_awk_val_rchunk_t
/* make sure that it has the same fields as
qse_awk_val_chunk_t up to this point */
qse_awk_val_real_t slot[QSE_AWK_VAL_CHUNK_SIZE];
qse_awk_val_flt_t slot[QSE_AWK_VAL_CHUNK_SIZE];
};
#ifdef __cplusplus

View File

@ -435,6 +435,9 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
if (flags & QSE_FS_ENT_TYPE)
{
#if !defined(IO_REPARSE_TAG_SYMLINK)
# define IO_REPARSE_TAG_SYMLINK 0xA000000C
#endif
if (info->wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
fs->ent.type = QSE_FS_ENT_SUBDIR;

View File

@ -85,7 +85,7 @@ struct qse_stc_t
int type;
/*
qse_stx_int_t ivalue;
qse_stx_real_t fvalue;
qse_stx_flt_t fvalue;
*/
qse_str_t name;
} token;

View File

@ -36,8 +36,8 @@ struct qse_stx_token_t
int type;
/*
qse_stx_int_t ivalue;
qse_stx_real_t fvalue;
qse_stx_int_t ivalue;
qse_stx_flt_t fvalue;
*/
qse_stx_name_t name;
qse_bool_t __dynamic;

View File

@ -7,7 +7,7 @@ AM_CPPFLAGS = \
bin_PROGRAMS = awk01 awk02 awk03 awk04 awk09 awk10
LDFLAGS = -L../../lib/cmn -L../../lib/awk
LDFLAGS = -L../../lib/awk -L../../lib/cmn
LDADD = -lqseawk -lqsecmn $(LIBM)
awk01_SOURCES = awk01.c

View File

@ -172,7 +172,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = -L../../lib/cmn -L../../lib/awk
LDFLAGS = -L../../lib/awk -L../../lib/cmn
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@

View File

@ -64,12 +64,12 @@ static int run_awk (QSE::StdAwk& awk)
// ret = div (ret, 2);
arg[0] = ret;
if (arg[1].setReal (run, 2) <= -1) return -1;
if (arg[1].setFlt (run, 2) <= -1) return -1;
if (awk.call (QSE_T("div"), &ret, arg, 2) <= -1) return -1;
// output the result in various types
qse_printf (QSE_T("RESULT: (int) [%lld]\n"), (long long)ret.toInt());
qse_printf (QSE_T(" (real) [%Lf]\n"), (long double)ret.toReal());
qse_printf (QSE_T(" (flt) [%Lf]\n"), (long double)ret.toFlt());
qse_printf (QSE_T(" (str) [%s]\n"), ret.toStr(QSE_NULL));
// ret = sine (ret);
@ -78,7 +78,7 @@ static int run_awk (QSE::StdAwk& awk)
// output the result in various types
qse_printf (QSE_T("RESULT: (int) [%lld]\n"), (long long)ret.toInt());
qse_printf (QSE_T(" (real) [%Lf]\n"), (long double)ret.toReal());
qse_printf (QSE_T(" (flt) [%Lf]\n"), (long double)ret.toFlt());
qse_printf (QSE_T(" (str) [%s]\n"), ret.toStr(QSE_NULL));
return 0;

View File

@ -85,13 +85,13 @@ static int run_awk (QSE::StdAwk& awk)
// output the result in various types
qse_printf (QSE_T("RESULT: (int) [%lld]\n"), (long long)r.toInt());
qse_printf (QSE_T(" (real)[%Lf]\n"), (long double)r.toReal());
qse_printf (QSE_T(" (flt)[%Lf]\n"), (long double)r.toFlt());
qse_printf (QSE_T(" (str) [%s]\n"), r.toStr(QSE_NULL));
// get the value of 'FOO'
if (awk.getGlobal (foo, foov) <= -1) return -1;
qse_printf (QSE_T("FOO: (int) [%lld]\n"), (long long)foov.toInt());
qse_printf (QSE_T(" (real)[%Lf]\n"), (long double)foov.toReal());
qse_printf (QSE_T(" (flt)[%Lf]\n"), (long double)foov.toFlt());
qse_printf (QSE_T(" (str) [%s]\n"), foov.toStr(QSE_NULL));
// call the 'pb' function