X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcalc.h;h=3aa949ca2761ca37dd69db33265f3d66c8f4ff1d;hp=dbbb1161978dab42438bf4cb13eb461ca5e54d60;hb=16e375c9503246b179550cd97c0739c916dc802a;hpb=e11280a7b6ed67a4d79b14569ca06131ea2338bd diff --git a/src/calc.h b/src/calc.h index dbbb116..3aa949c 100644 --- a/src/calc.h +++ b/src/calc.h @@ -29,37 +29,24 @@ #include "token.h" #include "types/impl_val.h" -#define PRIfval "f" -#define PRIdval "lf" -#define PRIldval "Lf" +#include + +#define PRIfmt_digits(digits) #digits +#define PRIfmt(digits, fmt) "." PRIfmt_digits(digits) fmt +#define PRIfval PRIfmt(FLT_DECIMAL_DIG, "g") +#define PRIdval PRIfmt(DBL_DECIMAL_DIG, "g") +#if HAVE_LONG_DOUBLE +# define PRIldval PRIfmt(LDBL_DECIMAL_DIG, "Lg") +#endif typedef token_t (*psi_calc)(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_mod(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); - -token_t psi_calc_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); - -token_t psi_calc_bin_lshift(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_bin_rshift(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_bin_and(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_bin_xor(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_bin_or(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); - -token_t psi_calc_and(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_or(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); - -token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); -token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res); - -void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_type, impl_val *out_val); +#include "calc/basic.h" +#include "calc/bin.h" +#include "calc/bool.h" +#include "calc/unary.h" +#include "calc/cast.h" +#include "calc/cmp.h" +#include "calc/oper.h" #endif