Examples' Makefiles are completed and tested.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / signals / binop.cpp
1 /************************************************************************
2 ************************************************************************
3 FAUST compiler
4 Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
5 ---------------------------------------------------------------------
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ************************************************************************
20 ************************************************************************/
21
22
23
24 #include "binop.hh"
25
26 static bool noNtrl(const Node& n) { return false; }
27
28 BinOp* gBinOpTable[] = {
29
30 new BinOp("+","add_vec","add_scal", &addNode, &isZero, &isZero, 6),
31 new BinOp("-","sub_vec","sub_scal", &subNode, &noNtrl, &isZero, 7),
32 new BinOp("*","mul_vec","mul_scal", &mulNode, &isOne, &isOne, 8),
33 new BinOp("/","div_vec","div_scal", &divNode, &noNtrl, &isOne, 10),
34 new BinOp("%","mod_vec","mod_scal", &remNode, &noNtrl, &noNtrl, 9),
35
36 new BinOp("<<","shift_left_vec","shift_left_scal", &lshNode, &noNtrl, &isZero, 8),
37 new BinOp(">>","shift_right_vec","shift_right_scal", &rshNode, &noNtrl, &isZero, 8),
38
39 new BinOp(">","gt_vec","gt_scal", &gtNode, &noNtrl, &noNtrl, 5),
40 new BinOp("<","lt_vec","lt_scal", &ltNode, &noNtrl, &noNtrl, 5),
41 new BinOp(">=","ge_vec","ge_scal", &geNode, &noNtrl, &noNtrl, 5),
42 new BinOp("<=","le_vec","le_scal", &leNode, &noNtrl, &noNtrl, 5),
43 new BinOp("==","eq_vec","eq_scal", &eqNode, &noNtrl, &noNtrl, 5),
44 new BinOp("!=","neq_vec","neq_scal", &neNode, &noNtrl, &noNtrl, 5),
45
46 new BinOp("&","and_vec","and_scal", &andNode, &isMinusOne, &isMinusOne, 8),
47 new BinOp("|","or_vec","or_scal", &orNode, &isZero, &isZero, 7),
48 new BinOp("^","xor_vec","xor_scal", &xorNode, &noNtrl, &noNtrl, 8)
49 };
50
51
52 BinOp* gBinOpLateqTable[] = {
53
54 new BinOp("+","add_vec","add_scal", &addNode, &isZero, &isZero, 6),
55 new BinOp("-","sub_vec","sub_scal", &subNode, &noNtrl, &isZero, 7),
56 new BinOp("*","mul_vec","mul_scal", &mulNode, &isOne, &isOne, 8), // \DeclareMathSymbol{*}{\mathbin}{symbols}{"01}
57 new BinOp("/","div_vec","div_scal", &divNode, &noNtrl, &isOne, 10), // \frac{}{} used in generateBinOp
58 new BinOp("\\bmod","mod_vec","mod_scal", &remNode, &noNtrl, &noNtrl, 9),
59
60 new BinOp("\\hiderel{\\ll}","shift_left_vec","shift_left_scal", &lshNode, &noNtrl, &isZero, 8),
61 new BinOp("\\hiderel{\\gg}","shift_right_vec","shift_right_scal", &rshNode, &noNtrl, &isZero, 8),
62
63 new BinOp("\\hiderel{>}","gt_vec","gt_scal", &gtNode, &noNtrl, &noNtrl, 5),
64 new BinOp("\\hiderel{<}","lt_vec","lt_scal", &ltNode, &noNtrl, &noNtrl, 5),
65 new BinOp("\\hiderel{\\geq}","ge_vec","ge_scal", &geNode, &noNtrl, &noNtrl, 5),
66 new BinOp("\\hiderel{\\leq}","le_vec","le_scal", &leNode, &noNtrl, &noNtrl, 5),
67 new BinOp("\\hiderel{\\equiv}","eq_vec","eq_scal", &eqNode, &noNtrl, &noNtrl, 5),
68 new BinOp("\\hiderel{\\neq}","neq_vec","neq_scal", &neNode, &noNtrl, &noNtrl, 5),
69
70 new BinOp("\\wedge","and_vec","and_scal", &andNode, &isMinusOne, &isMinusOne, 8),
71 new BinOp("\\vee","or_vec","or_scal", &orNode, &isZero, &isZero, 7),
72 new BinOp("\\veebar","xor_vec","xor_scal", &xorNode, &noNtrl, &noNtrl, 8)
73 };