1// Scicos 2// 3// Copyright (C) INRIA - METALAU Project <scicos@inria.fr> 4// 5// This program is free software; you can redistribute it and/or modify 6// it under the terms of the GNU General Public License as published by 7// the Free Software Foundation; either version 2 of the License, or 8// (at your option) any later version. 9// 10// This program is distributed in the hope that it will be useful, 11// but WITHOUT ANY WARRANTY; without even the implied warranty of 12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13// GNU General Public License for more details. 14// 15// You should have received a copy of the GNU General Public License 16// along with this program; if not, write to the Free Software 17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18// 19// See the file ../license.txt 20// 21 22function connected=get_connected(scs_m,k,typ) 23 //return the vector of number of link connected to a given block 24 // scs_m : structure of blocks and links 25 // k : block_number 26 // typ : 'in','out','clkin','clkout' 27 // connected : vector of connected link numbers 28 [lhs,rhs]=argn(0) 29 30 connected=[] 31 32 //disp('get_connected') 33 // pause 34 if rhs<=2 then // all connected links 35 graphics=scs_m.objs(k).graphics 36 37 ip=graphics.pin 38 connected=[connected ip(find(ip>0))'] 39 40 op=graphics.pout 41 connected=[connected op(find(op>0))'] 42 43 cip=graphics.pein 44 connected=[connected cip(find(cip>0))'] 45 46 cop=graphics.peout 47 connected=[connected cop(find(cop>0))'] 48 else 49 50 if typ=="in" then 51 ip=scs_m.objs(k).graphics.pin 52 connected=[connected ip(find(ip>0))'], 53 elseif typ=="out" then 54 op=scs_m.objs(k).graphics.pout 55 connected=[connected op(find(op>0))'], 56 elseif typ=="clkin" then 57 cip=scs_m.objs(k).graphics.pein 58 connected=[connected cip(find(cip>0))'], 59 elseif typ=="clkout" then 60 cop=scs_m.objs(k).graphics.peout 61 connected=[connected cop(find(cop>0))'], 62 end 63 end 64 65endfunction 66