FAUST compiler  0.9.9.6b8
binop.cpp
Go to the documentation of this file.
00001 /************************************************************************
00002  ************************************************************************
00003     FAUST compiler
00004     Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
00005     ---------------------------------------------------------------------
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  ************************************************************************
00020  ************************************************************************/
00021  
00022  
00023  
00024 #include "binop.hh"
00025     
00026 static bool noNtrl(const Node& n) { return false; }
00027 
00028 BinOp* gBinOpTable[] = { 
00029 
00030     new BinOp("+","add_vec","add_scal", &addNode, &isZero, &isZero, 6),
00031     new BinOp("-","sub_vec","sub_scal", &subNode, &noNtrl, &isZero, 7),
00032     new BinOp("*","mul_vec","mul_scal", &mulNode, &isOne, &isOne, 8),
00033     new BinOp("/","div_vec","div_scal", &divNode, &noNtrl, &isOne, 10),
00034     new BinOp("%","mod_vec","mod_scal", &remNode, &noNtrl, &noNtrl, 9),
00035 
00036     new BinOp("<<","shift_left_vec","shift_left_scal", &lshNode, &noNtrl, &isZero, 8),
00037     new BinOp(">>","shift_right_vec","shift_right_scal", &rshNode, &noNtrl, &isZero, 8),
00038 
00039     new BinOp(">","gt_vec","gt_scal", &gtNode, &noNtrl, &noNtrl, 5),
00040     new BinOp("<","lt_vec","lt_scal", &ltNode, &noNtrl, &noNtrl, 5),
00041     new BinOp(">=","ge_vec","ge_scal", &geNode, &noNtrl, &noNtrl, 5),
00042     new BinOp("<=","le_vec","le_scal", &leNode, &noNtrl, &noNtrl, 5),
00043     new BinOp("==","eq_vec","eq_scal", &eqNode, &noNtrl, &noNtrl, 5),
00044     new BinOp("!=","neq_vec","neq_scal", &neNode, &noNtrl, &noNtrl, 5),
00045 
00046     new BinOp("&","and_vec","and_scal", &andNode, &isMinusOne, &isMinusOne, 8),
00047     new BinOp("|","or_vec","or_scal", &orNode, &isZero, &isZero, 7),
00048     new BinOp("^","xor_vec","xor_scal", &xorNode, &noNtrl, &noNtrl, 8)
00049 };
00050 
00051 
00052 BinOp* gBinOpLateqTable[] = { 
00053 
00054     new BinOp("+","add_vec","add_scal", &addNode, &isZero, &isZero, 6),
00055     new BinOp("-","sub_vec","sub_scal", &subNode, &noNtrl, &isZero, 7),
00056     new BinOp("*","mul_vec","mul_scal", &mulNode, &isOne, &isOne, 8), // \DeclareMathSymbol{*}{\mathbin}{symbols}{"01}
00057     new BinOp("/","div_vec","div_scal", &divNode, &noNtrl, &isOne, 10), // \frac{}{} used in generateBinOp
00058     new BinOp("\\bmod","mod_vec","mod_scal", &remNode, &noNtrl, &noNtrl, 9),
00059     
00060     new BinOp("\\hiderel{\\ll}","shift_left_vec","shift_left_scal", &lshNode, &noNtrl, &isZero, 8),
00061     new BinOp("\\hiderel{\\gg}","shift_right_vec","shift_right_scal", &rshNode, &noNtrl, &isZero, 8),
00062     
00063     new BinOp("\\hiderel{>}","gt_vec","gt_scal", &gtNode, &noNtrl, &noNtrl, 5),
00064     new BinOp("\\hiderel{<}","lt_vec","lt_scal", &ltNode, &noNtrl, &noNtrl, 5),
00065     new BinOp("\\hiderel{\\geq}","ge_vec","ge_scal", &geNode, &noNtrl, &noNtrl, 5),
00066     new BinOp("\\hiderel{\\leq}","le_vec","le_scal", &leNode, &noNtrl, &noNtrl, 5),
00067     new BinOp("\\hiderel{\\equiv}","eq_vec","eq_scal", &eqNode, &noNtrl, &noNtrl, 5),
00068     new BinOp("\\hiderel{\\neq}","neq_vec","neq_scal", &neNode, &noNtrl, &noNtrl, 5),
00069     
00070     new BinOp("\\wedge","and_vec","and_scal", &andNode, &isMinusOne, &isMinusOne, 8),
00071     new BinOp("\\vee","or_vec","or_scal", &orNode, &isZero, &isZero, 7),
00072     new BinOp("\\veebar","xor_vec","xor_scal", &xorNode, &noNtrl, &noNtrl, 8)
00073 };