1
function [x,y,typ]=rtai_mbx_rcv(job,arg1,arg2)
3
// Copyright roberto.bucher@supsi.ch
7
graphics=arg1.graphics; exprs=graphics.exprs;
11
[x,y,typ]=standard_inputs(arg1)
12
case 'getoutputs' then
13
[x,y,typ]=standard_outputs(arg1)
15
[x,y]=standard_origin(arg1)
18
model=arg1.model;graphics=arg1.graphics;
21
[ok,op,name,ipaddr,lab]=..
22
getvalue('Set RTAI-mbx_rcv block parameters',..
26
list('vec',-1,'str',1,'str',1),label(1))
30
funam='i_mbx_rcv_' + name;
38
o=int(o(:));nout=size(o,1);
46
[ok,tt]=getCode_mbx_rcv(funam)
48
[model,graphics,ok]=check_io(model,graphics,i,o,ci,co)
50
model.sim=list(funam,funtyp)
76
model.sim=list(' ',2004)
90
label=list([sci2exp(out),name,ipaddr],[])
92
gr_i=['xstringb(orig(1),orig(2),[''Mbx rcv blk'';name],sz(1),sz(2),''fill'');']
93
x=standard_define([3 2],model,label,gr_i)
98
function [ok,tt]=getCode_mbx_rcv(funam)
102
'#include <stdlib.h>';
103
'#include <scicos/scicos_block.h>';
106
'void '+funam+'(scicos_block *block,int flag)';
109
textmp($+1)='#ifdef MODEL'
110
textmp($+1)='static void * blk;'
112
textmp($+1)='double y[' + string(nout) + '];'
113
textmp($+1)='double t = get_scicos_time();'
114
textmp($+1)=' switch(flag) {'
115
textmp($+1)=' case 4:'
116
textmp($+1)=' blk=inp_mbx_receive_init('+ string(nout)+','+ '""' + name + '"",""'+ipaddr+'"");'
117
textmp($+1)=' break;';
118
textmp($+1)=' case 1:'
119
textmp($+1)=' inp_mbx_receive_input(blk,y,t);'
120
textmp($+1)=' for (i=0;i<' + string(nout) + ';i++) block->outptr[i][0] = y[i];'
121
textmp($+1)=' break;'
122
textmp($+1)=' case 5:'
123
textmp($+1)=' inp_mbx_receive_end(blk);'
124
textmp($+1)=' break;'