Commit 1f570ebc authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Fix some icpc remarks and update operator traits.

- xtd/res.hh (macros): Add spaces to fix pb with icpc preproc.
- xtd/args.hh (xtd_nargs): Likewise.
- xtd/math/abs.hh (internal::int_): Handwrite code.
- xtd/math/pow.hh: Cosmetics.
- xtd/math/arith.hh: Add comments.
- xtd/literal.hh (argument): Remove reference so that temporaries
are copied.
- xtd/abstract/fun_nary_expr.hh: Likewise.
- xtd/bind.hh: Likewise.
- xtd/abstract/any.hh: Remove cause obsolete.
- xtd/abstract/fun.hh: Add doc.
(abstract::fun_): Disable imperative operators.
- xtd/abstract/plain_fun.hh: Add doc.
- xtd/optraits.hh: Rewrite.
- xtd/traits.hh: New.
- xtd/builtin/traits.hh: Replace dummy code by effective one.
- xtd/internal/opmacros.hh: Rewrite.
- xtd/internal/mlc.hh: Add include.
- tests: Add ignore rule for '.deps'.
- tests/cfun.cc: Fix icpc remark.
- tests/abs.cc: New.
- tests/optraits.cc: New.
- tests/Makefile.am: Update.
- tests/bi_traits: New directory to test builtin op traits.
- tests/bi_traits/bool.cc: New.
- tests/bi_traits/char.cc: New.
- tests/bi_traits/sint.cc: New.
- tests/bi_traits/uint.cc: New.
- tests/bi_traits/schar.cc: New.
- tests/bi_traits/slong.cc: New.
- tests/bi_traits/uchar.cc: New.
- tests/bi_traits/sshort.cc: New.
- tests/bi_traits/ulong.cc: New.
- tests/bi_traits/ushort.cc: New.
- tests/bi_traits/float.cc: New.
- tests/bi_traits/ldouble.cc: New.
- tests/bi_traits/double.cc: New.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@457 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 93db4c3a
2006-04-11 Thierry Geraud <theo@lrde.epita.fr>
Fix some icpc remarks and update operator traits.
* xtd/res.hh (macros): Add spaces to fix pb with icpc preproc.
* xtd/args.hh (xtd_nargs): Likewise.
* xtd/math/abs.hh (internal::int_): Handwrite code.
* xtd/math/pow.hh: Cosmetics.
* xtd/math/arith.hh: Add comments.
* xtd/literal.hh (argument): Remove reference so that temporaries
are copied.
* xtd/abstract/fun_nary_expr.hh: Likewise.
* xtd/bind.hh: Likewise.
* xtd/abstract/any.hh: Remove cause obsolete.
* xtd/abstract/fun.hh: Add doc.
(abstract::fun_): Disable imperative operators.
* xtd/abstract/plain_fun.hh: Add doc.
* xtd/optraits.hh: Rewrite.
* xtd/traits.hh: New.
* xtd/builtin/traits.hh: Replace dummy code by effective one.
* xtd/internal/opmacros.hh: Rewrite.
* xtd/internal/mlc.hh: Add include.
* tests: Add ignore rule for '.deps'.
* tests/cfun.cc: Fix icpc remark.
* tests/abs.cc: New.
* tests/optraits.cc: New.
* tests/Makefile.am: Update.
* tests/bi_traits: New directory to test builtin op traits.
* tests/bi_traits/bool.cc: New.
* tests/bi_traits/char.cc: New.
* tests/bi_traits/sint.cc: New.
* tests/bi_traits/uint.cc: New.
* tests/bi_traits/schar.cc: New.
* tests/bi_traits/slong.cc: New.
* tests/bi_traits/uchar.cc: New.
* tests/bi_traits/sshort.cc: New.
* tests/bi_traits/ulong.cc: New.
* tests/bi_traits/ushort.cc: New.
* tests/bi_traits/float.cc: New.
* tests/bi_traits/ldouble.cc: New.
* tests/bi_traits/double.cc: New.
2006-04-04 Thierry Geraud <theo@lrde.epita.fr>
Add some math functions and clean up file deps.
......
......@@ -8,20 +8,24 @@ AM_CPPFLAGS = -I$(top_srcdir)/extended -I$(top_srcdir)/metalic
# when oln.m4 is available in the distribution.
check_PROGRAMS = \
id \
abs \
bind \
cast \
cfun \
cos \
id \
lit \
math
math \
optraits
id_SOURCES = id.cc
abs_SOURCES = abs.cc
bind_SOURCES = bind.cc
cast_SOURCES = cast.cc
cfun_SOURCES = cfun.cc
cos_SOURCES = cos.cc
id_SOURCES = id.cc
lit_SOURCES = lit.cc
math_SOURCES = math.cc
optraits_SOURCES = optraits.cc
TESTS = $(check_PROGRAMS)
#include <iostream>
#include <xtd/math/abs.hh>
int main()
{
long l = -3;
long ll = xtd::abs(l);
std::cout << ll << std::endl;
long i = -3;
long ii = xtd::abs(i);
std::cout << ii << std::endl;
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
// check_trait(bool, bool);
// check_trait(bool, char);
// check_trait(bool, float);
// check_trait(bool, double);
// check_trait(bool, ldouble);
check_trait(bool, uchar);
check_trait(bool, schar);
check_trait(bool, ushort);
check_trait(bool, sshort);
// check_trait(bool, uint);
check_trait(bool, sint);
// check_trait(bool, ulong);
// check_trait(bool, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(char, bool);
check_trait(char, char);
check_trait(char, float);
check_trait(char, double);
check_trait(char, ldouble);
check_trait(char, uchar);
check_trait(char, schar);
check_trait(char, ushort);
check_trait(char, sshort);
check_trait(char, uint);
check_trait(char, sint);
check_trait(char, ulong);
check_trait(char, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
// check_trait(double, bool);
check_trait(double, char);
check_trait(double, float);
check_trait(double, double);
check_trait(double, ldouble);
check_trait(double, uchar);
check_trait(double, schar);
check_trait(double, ushort);
check_trait(double, sshort);
check_trait(double, uint);
check_trait(double, sint);
check_trait(double, ulong);
check_trait(double, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
// check_trait(float, bool);
check_trait(float, char);
check_trait(float, float);
check_trait(float, double);
check_trait(float, ldouble);
check_trait(float, uchar);
check_trait(float, schar);
check_trait(float, ushort);
check_trait(float, sshort);
check_trait(float, uint);
check_trait(float, sint);
check_trait(float, ulong);
check_trait(float, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
// check_trait(ldouble, bool);
check_trait(ldouble, char);
check_trait(ldouble, float);
check_trait(ldouble, double);
check_trait(ldouble, ldouble);
check_trait(ldouble, uchar);
check_trait(ldouble, schar);
check_trait(ldouble, ushort);
check_trait(ldouble, sshort);
check_trait(ldouble, uint);
check_trait(ldouble, sint);
check_trait(ldouble, ulong);
check_trait(ldouble, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(schar, bool);
check_trait(schar, char);
check_trait(schar, float);
check_trait(schar, double);
check_trait(schar, ldouble);
check_trait(schar, uchar);
check_trait(schar, schar);
check_trait(schar, ushort);
check_trait(schar, sshort);
check_trait(schar, uint);
check_trait(schar, sint);
check_trait(schar, ulong);
check_trait(schar, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(sint, bool);
check_trait(sint, char);
check_trait(sint, float);
check_trait(sint, double);
check_trait(sint, ldouble);
check_trait(sint, uchar);
check_trait(sint, schar);
check_trait(sint, ushort);
check_trait(sint, sshort);
check_trait(sint, uint);
check_trait(sint, sint);
check_trait(sint, ulong);
check_trait(sint, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(slong, bool);
check_trait(slong, char);
check_trait(slong, float);
check_trait(slong, double);
check_trait(slong, ldouble);
check_trait(slong, uchar);
check_trait(slong, schar);
check_trait(slong, ushort);
check_trait(slong, sshort);
check_trait(slong, uint);
check_trait(slong, sint);
check_trait(slong, ulong);
check_trait(slong, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(sshort, bool);
check_trait(sshort, char);
check_trait(sshort, float);
check_trait(sshort, double);
check_trait(sshort, ldouble);
check_trait(sshort, uchar);
check_trait(sshort, schar);
check_trait(sshort, ushort);
check_trait(sshort, sshort);
check_trait(sshort, uint);
check_trait(sshort, sint);
check_trait(sshort, ulong);
check_trait(sshort, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(uchar, bool);
check_trait(uchar, char);
check_trait(uchar, float);
check_trait(uchar, double);
check_trait(uchar, ldouble);
check_trait(uchar, uchar);
check_trait(uchar, schar);
check_trait(uchar, ushort);
check_trait(uchar, sshort);
check_trait(uchar, uint);
check_trait(uchar, sint);
check_trait(uchar, ulong);
check_trait(uchar, slong);
}
#include <iostream>
#include <typeinfo>
#include <mlc/assert.hh>
#include <mlc/cmp.hh>
#include <xtd/optraits.hh>
# define check_op_trait(OpName, OpSymb, T1, T2) \
mlc::assert_< mlc::eq_< typeof(T1() OpSymb T2()), xtd_op_##OpName##_trait_(T1, T2) > >::check()
# define check_trait(T1, T2) \
check_op_trait(plus, +, T1, T2); \
check_op_trait(minus, -, T1, T2); \
check_op_trait(mult, *, T1, T2)
// check_op_trait(mod, %, T1, T2);
int main()
{
typedef long double ldouble;
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef signed short sshort;
typedef unsigned int uint;
typedef signed int sint;
typedef unsigned long ulong;
typedef signed long slong;
check_trait(uint, bool);
check_trait(uint, char);
check_trait(uint, float);
check_trait(uint, double);
check_trait(uint, ldouble);
check_trait(uint, uchar);
check_trait(uint, schar);