File: standard_inputs.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (38 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [x,y,typ]=standard_inputs(o)
//get position of inputs ports and clock inputs port for a standard block
//  the input ports are located on the left (or rigth if tilded) vertical
//    side of the block, regularly located from top to bottom
//  the clock input ports are located on the top horizontal side
//    side of the block, regularly located from left to right
// Copyright INRIA
xf=60
yf=40
graphics=o(2)
model=o(3)
orig=graphics(1);sz=graphics(2);orient=graphics(3);
inp=size(model(2),1);clkinp=size(model(4),1);
if orient then
  xo=orig(1)
  dx=-xf/7
else
  xo=orig(1)+sz(1)
  dx=yf/7
end


if inp==0 then
  x=[];y=[],typ=[]
else
  y=orig(2)+sz(2)-(sz(2)/(inp+1))*(1:inp)
  x=(xo+dx)*ones(y)
  typ=ones(x)
end
if clkinp<>0 then
  x=[x,orig(1)+(sz(1)/(clkinp+1))*(1:clkinp)]
  y=[y,(orig(2)+yf/7+sz(2))*ones(1,clkinp)]
  typ=[typ,-ones(1,clkinp)]
end