|
FAUST compiler
0.9.9.6b8
|
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 #include "parSchema.h" 00023 #include <assert.h> 00024 #include <iostream> 00025 00026 using namespace std; 00027 00028 schema* makeParSchema(schema* s1, schema* s2) 00029 { 00030 // make sure s1 and s2 have same width 00031 return new parSchema( makeEnlargedSchema(s1, s2->width()), 00032 makeEnlargedSchema(s2, s1->width()) ); 00033 } 00034 00035 00036 parSchema::parSchema (schema* s1, schema* s2) 00037 : schema( s1->inputs()+s2->inputs(), 00038 s1->outputs()+s2->outputs(), 00039 s1->width(), 00040 s1->height() + s2->height() ), 00041 fSchema1(s1), 00042 fSchema2(s2), 00043 fInputFrontier(s1->inputs()), 00044 fOutputFrontier(s1->outputs()) 00045 { 00046 assert (s1->width() == s2->width()); 00047 } 00048 00049 00050 void parSchema::place(double ox, double oy, int orientation) 00051 { 00052 beginPlace(ox, oy, orientation); 00053 00054 if (orientation == kLeftRight) { 00055 fSchema1->place(ox, oy, orientation); 00056 fSchema2->place(ox, oy+fSchema1->height(), orientation); 00057 } else { 00058 fSchema2->place(ox, oy, orientation); 00059 fSchema1->place(ox, oy+fSchema2->height(), orientation); 00060 } 00061 00062 endPlace(); 00063 } 00064 00065 point parSchema::inputPoint(unsigned int i) const 00066 { 00067 return (i < fInputFrontier) 00068 ? fSchema1->inputPoint(i) 00069 : fSchema2->inputPoint(i-fInputFrontier); 00070 } 00071 00072 point parSchema::outputPoint(unsigned int i) const 00073 { 00074 return (i < fOutputFrontier) 00075 ? fSchema1->outputPoint(i) 00076 : fSchema2->outputPoint(i-fOutputFrontier); 00077 } 00078 00079 void parSchema::draw(device& dev) 00080 { 00081 fSchema1->draw(dev); 00082 fSchema2->draw(dev); 00083 } 00084 00085 void parSchema::collectTraits(collector& c) 00086 { 00087 fSchema1->collectTraits(c); 00088 fSchema2->collectTraits(c); 00089 }
1.8.0