rheolef  6.5
vec_expr_ops_make.cc
Go to the documentation of this file.
1 #include "expr_ops_make.icc"
2 /* example: abbrev
3 
4  int i
5  T t n_scalar=2
6 
7  vec<T,M> F
8 
9  vec_expr<E> E expr
10 
11  => binary matrix profile :
12 
13  iF iE
14  tF tE
15 
16  Fi Ft FF FE
17 
18  Ei Et EF EE
19 
20  template:
21  xY Xy => template<T,M> x=i,t X=F
22  XY => template<T1,T2,M> X,Y=F
23  iE Ei => template<E> x=i
24  tE Et => template<T,E> x=t
25  XE EX => template<E,T,M> X=F
26  EE => template<E1,E2>
27 */
28 int main() {
29  s expr = "vec_expr";
30  s details = "vec_detail";
31  s domain = "vec_domain";
32  s tag = "is_vec";
33 
34  vector<rhs> Rhsclass;
35  Rhsclass.push_back (rhs("vec", "&"));
36 
37  vector<s> Class;
38  Class.push_back ("vec");
39 
40  vector<op> Unop;
41  Unop.push_back (op("+", "boost::proto::tag::unary_plus"));
42  Unop.push_back (op("-", "boost::proto::tag::negate"));
43 
44  vector<op> Binop;
45  Binop.push_back (op("+", "boost::proto::tag::plus"));
46  Binop.push_back (op("-", "boost::proto::tag::minus"));
47  Binop.push_back (op("*", "boost::proto::tag::multiplies"));
48  Binop.push_back (op("/", "boost::proto::tag::divides"));
49 
50  vector<aop> Assign_op;
51  Assign_op.push_back (aop("+=", "plus_assign"));
52  Assign_op.push_back (aop("-=", "minus_assign"));
53  Assign_op.push_back (aop("*=", "multiplies_assign"));
54  Assign_op.push_back (aop("/=", "divides_assign"));
55 
56  vector<func> Ufunc;
57  Ufunc.push_back (func("abs"));
58  Ufunc.push_back (func("fabs"));
59  Ufunc.push_back (func("floor"));
60  Ufunc.push_back (func("ceil"));
61  Ufunc.push_back (func("sqr")); // rheolef extension
62 
63  vector<func> Bifunc;
64  Bifunc.push_back (func("min")); // std::algorithm
65  Bifunc.push_back (func("max"));
66 
67  header("VEC", "vec");
68  all_unops (tag, domain, Unop, Class, expr);
69  all_binops (tag, domain, Binop, Class, expr);
70  all_assign_ops ("vec", "size", tag, domain, details, Assign_op, Rhsclass, Class, expr);
71  all_ufunc ("boost::proto::tag::function", domain, details, Ufunc, Class, expr);
72  all_bifunc ("boost::proto::tag::function", domain, details, Bifunc, Class, expr);
73  ucompose ("boost::proto::tag::function", domain, details, "compose", Class, expr);
74  bicompose ("boost::proto::tag::function", domain, details, "compose", Class, expr);
75  dot ("dot", "vec", Class, expr, "size");
76  footer("VEC", "vec");
77 }
78