diff options
author | Sunil Shetye | 2018-06-16 08:23:15 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-16 08:23:15 +0530 |
commit | 58c3b670390b278ee45a4b45ccb36a949ad582eb (patch) | |
tree | 722ea570b5703195e4fdbf84c7410776177cc70f /js | |
parent | 4a602cc59c9bc5a888e50caa40776e4fb5e7b852 (diff) | |
download | sci2js-58c3b670390b278ee45a4b45ccb36a949ad582eb.tar.gz sci2js-58c3b670390b278ee45a4b45ccb36a949ad582eb.tar.bz2 sci2js-58c3b670390b278ee45a4b45ccb36a949ad582eb.zip |
make exprs an array by default
Diffstat (limited to 'js')
36 files changed, 584 insertions, 44 deletions
diff --git a/js/IntegerOp/EXTRACTBITS.js b/js/IntegerOp/EXTRACTBITS.js index 187b2914..2d93c8e2 100644 --- a/js/IntegerOp/EXTRACTBITS.js +++ b/js/IntegerOp/EXTRACTBITS.js @@ -1,3 +1,229 @@ -Syntax error in input LexToken(EOL,'\n ',1,3407) /* autogenerated from "macros/IntegerOp/EXTRACTBITS.sci" */ -None +function EXTRACTBITS() { +EXTRACTBITS.prototype.get = function EXTRACTBITS() { +} +EXTRACTBITS.prototype.set = function EXTRACTBITS() { +x=arg1; +graphics=arg1.graphics; +exprs=graphics.exprs; +model=arg1.model; +while (true) { +[ok,Datatype,rule,bit,scal,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"EXTRACTBITS")," ",gettext("Bits Extraction")," ",gettext(" - Bits to Extract:"),gettext(" 1 Upper Half"),gettext(" 2 Lower Half"),gettext(" 3 Range from MSB"),gettext(" 4 Range to LSB"),gettext(" 5 Range of Bits"),gettext(" - Number of Bits or Index of bit : Index 0 is LSB"),gettext(" If \'Bits to Extract\' is set to \'Range of bits\': [Start, End]")," "],[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)"),gettext("Bits to extract"),gettext("Number of Bits or Index of Bit"),gettext("Treat Bit Field as an Integer (0:No, 1:Yes)")],list("vec",1,"vec",1,"vec",-1,"vec",1),exprs); +if (!ok) { +break +} +bitstr=strcat(string(bit.slice())," "); +if ((rule<1)||(rule>5)) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Bits to Extract"),rule),msprintf(gettext("Must be in the interval %s."),"[1, 5]")); +ok=None; +} else if (scal<0||scal>1) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Treat Bit Field as an Integer"),scal),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); +ok=None; +} else { +in1=[model.in1,model.in2]; +bit=int(bit); +rule=int(rule); +if ((rule==3)||(rule==4)) { +if ((size(bit,"*")!=1)) { +block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),gettext("Must be a single value.")); +ok=None; +} else { +numb=bit; +} +} else if ((rule==5)) { +if ((size(bit,"*")!=2)) { +block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),gettext("Must have this form: [Start, End].")); +ok=None; +} else if (bit(1)>bit(2)) { +block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("\'Start\' must be less than \'End\'."))); +ok=None; +} else { +numb=bit(2)-bit(1); +} +} else { +bit=0; +numb=[]; +} +} +if (ok) { +if ((Datatype==3||Datatype==6)) { +if (or(bit.slice()>31)||or(bit.slice()<0)) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 31]")); +ok=None; +} +switch (rule) { +case 1: +switch (scal) { +case 0: +model.sim=list("extract_bit_32_UH0",4); +case 1: +switch (Datatype) { +case 3: +model.sim=list("extract_bit_32_UH1",4); +case 6: +model.sim=list("extract_bit_u32_UH1",4); +} +} +case 2: +model.sim=list("extract_bit_32_LH",4); +case 3: +switch (scal) { +case 0: +model.sim=list("extract_bit_32_MSB0",4); +case 1: +switch (Datatype) { +case 3: +model.sim=list("extract_bit_32_MSB1",4); +case 6: +model.sim=list("extract_bit_u32_MSB1",4); +} +} +case 4: +model.sim=list("extract_bit_32_LSB",4); +case 5: +switch (scal) { +case 0: +model.sim=list("extract_bit_32_RB0",4); +case 1: +switch (Datatype) { +case 3: +model.sim=list("extract_bit_32_RB1",4); +case 6: +model.sim=list("extract_bit_u32_RB1",4); +} +} +} +} else if ((Datatype==4||Datatype==7)) { +if (or(bit.slice()>15)||or(bit.slice()<0)) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 15]")); +ok=None; +} +switch (rule) { +case 1: +switch (scal) { +case 0: +model.sim=list("extract_bit_16_UH0",4); +case 1: +switch (Datatype) { +case 4: +model.sim=list("extract_bit_16_UH1",4); +case 7: +model.sim=list("extract_bit_u16_UH1",4); +} +} +case 2: +model.sim=list("extract_bit_16_LH",4); +case 3: +switch (scal) { +case 0: +model.sim=list("extract_bit_16_MSB0",4); +case 1: +switch (Datatype) { +case 4: +model.sim=list("extract_bit_16_MSB1",4); +case 7: +model.sim=list("extract_bit_u16_MSB1",4); +} +} +case 4: +model.sim=list("extract_bit_16_LSB",4); +case 5: +switch (scal) { +case 0: +model.sim=list("extract_bit_16_RB0",4); +case 1: +switch (Datatype) { +case 4: +model.sim=list("extract_bit_16_RB1",4); +case 7: +model.sim=list("extract_bit_u16_RB1",4); +} +} +} +} else if ((Datatype==5||Datatype==8)) { +if (or(bit.slice()>7)||or(bit.slice()<0)) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 7]")); +ok=None; +} +switch (rule) { +case 1: +switch (scal) { +case 0: +model.sim=list("extract_bit_8_UH0",4); +case 1: +switch (Datatype) { +case 5: +model.sim=list("extract_bit_8_UH1",4); +case 8: +model.sim=list("extract_bit_u8_UH1",4); +} +} +case 2: +model.sim=list("extract_bit_8_LH",4); +case 3: +switch (scal) { +case 0: +model.sim=list("extract_bit_8_MSB0",4); +case 1: +switch (Datatype) { +case 5: +model.sim=list("extract_bit_8_MSB1",4); +case 8: +model.sim=list("extract_bit_u8_MSB1",4); +} +} +case 4: +model.sim=list("extract_bit_8_LSB",4); +case 5: +switch (scal) { +case 0: +model.sim=list("extract_bit_8_RB0",4); +case 1: +switch (Datatype) { +case 5: +model.sim=list("extract_bit_8_RB1",4); +case 8: +model.sim=list("extract_bit_u8_RB1",4); +} +} +} +} else { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); +ok=None; +} +} +if (ok) { +it=Datatype; +ot=Datatype; +out=[1,1]; +[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]); +} +if (ok) { +graphics.exprs=exprs; +model.ipar=[int(bit.slice()),int(numb.slice())]; +x.graphics=graphics; +x.model=model; +break +} +} +} +EXTRACTBITS.prototype.define = function EXTRACTBITS() { +numb=[]; +model=scicos_model(); +model.sim=list("extract_bit_32_UH0",4); +model.in1=1; +model.in2=1; +model.out=1; +model.out2=1; +model.intyp=3; +model.outtyp=3; +model.ipar=[0,numb]; +model.blocktype="c"; +model.dep_ut=[true,None]; +exprs=[sci2exp(3),sci2exp(1),sci2exp(0),sci2exp(0)]; +gr_i=[]; +x=standard_define([4,2],model,exprs,gr_i); +} +EXTRACTBITS.prototype.details = function EXTRACTBITS() { +} +} diff --git a/js/IntegerOp/SHIFT.js b/js/IntegerOp/SHIFT.js index 96e4bda5..99b33134 100644 --- a/js/IntegerOp/SHIFT.js +++ b/js/IntegerOp/SHIFT.js @@ -1,3 +1,121 @@ -Syntax error in input LexToken(EOL,'\n ',1,2341) /* autogenerated from "macros/IntegerOp/SHIFT.sci" */ -None +function SHIFT() { +SHIFT.prototype.get = function SHIFT() { +} +SHIFT.prototype.set = function SHIFT() { +x=arg1; +graphics=arg1.graphics; +model=arg1.model; +exprs=graphics.exprs; +while (true) { +[ok,Datatype,nb,np,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"SHIFT")," ",gettext("Shift/Rotates bits")],[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)"),gettext("Number of Bits to Shift Left (Negative number to shift right)"),gettext("Shift Type (0:Arithmetic, 1:Circular)")],list("vec",1,"vec",1,"vec",1),exprs); +if (!ok) { +break +} +if ((np!=0&&np!=1)) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Shift Type"),np),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); +ok=None; +} +it=Datatype; +ot=Datatype; +if ((Datatype==3||Datatype==6)) { +if (nb>0) { +switch (np) { +case 0: +model.sim=list("shift_32_LA",4); +case 1: +model.sim=list("shift_32_LC",4); +} +} else if (nb<0) { +switch (np) { +case 0: +switch (Datatype) { +case 3: +model.sim=list("shift_32_RA",4); +case 6: +model.sim=list("shift_u32_RA",4); +} +case 1: +model.sim=list("shift_32_RC",4); +} +} +} else if ((Datatype==4||Datatype==7)) { +if (nb>0) { +switch (np) { +case 0: +model.sim=list("shift_16_LA",4); +case 1: +model.sim=list("shift_16_LC",4); +} +} else if (nb<0) { +switch (np) { +case 0: +switch (Datatype) { +case 4: +model.sim=list("shift_16_RA",4); +case 7: +model.sim=list("shift_u16_RA",4); +} +case 1: +model.sim=list("shift_16_RC",4); +} +} +} else if ((Datatype==5||Datatype==8)) { +if (nb>0) { +switch (np) { +case 0: +model.sim=list("shift_8_LA",4); +case 1: +model.sim=list("shift_8_LC",4); +} +} else if (nb<0) { +switch (np) { +case 0: +switch (Datatype) { +case 5: +model.sim=list("shift_8_RA",4); +case 8: +model.sim=list("shift_u8_RA",4); +} +case 1: +model.sim=list("shift_8_RC",4); +} +} +} else { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); +ok=None; +} +if (ok) { +[model,graphics,ok]=set_io(model,graphics,list([-1,-2],it),list([-1,-2],ot),[],[]); +} +if (ok) { +model.ipar=nb; +graphics.exprs=exprs; +x.graphics=graphics; +x.model=model; +break +} +} +} +SHIFT.prototype.define = function SHIFT() { +sgn=[0,0]; +OPER=0; +model=scicos_model(); +model.sim=list("shift_32_LA",4); +model.in1=-1; +model.out=-1; +model.in2=-2; +model.out2=-2; +model.intyp=3; +model.outtyp=3; +model.rpar=[]; +model.ipar=sgn; +model.blocktype="c"; +model.dep_ut=[true,None]; +exprs=[sci2exp(3),sci2exp(0),sci2exp(0)]; +gr_i=[]; +x=standard_define([3,2],model,exprs,gr_i); +} +SHIFT.prototype.details = function SHIFT() { +} +} diff --git a/js/Linear/CLSS.js b/js/Linear/CLSS.js index 1435350a..6901dbef 100644 --- a/js/Linear/CLSS.js +++ b/js/Linear/CLSS.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; exprs=graphics.exprs; if (size(exprs,"*")==7) { -exprs=exprs([1:4,7]); +exprs=exprs[[1:4,7]-1]; } model=arg1.model; while (true) { diff --git a/js/Linear/CLSS_f.js b/js/Linear/CLSS_f.js index 4ca7a818..2c6eed25 100644 --- a/js/Linear/CLSS_f.js +++ b/js/Linear/CLSS_f.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; exprs=graphics.exprs; if (size(exprs,"*")==7) { -exprs=exprs([1:4,7]); +exprs=exprs[[1:4,7]-1]; } model=arg1.model; while (true) { diff --git a/js/Linear/DELAY_f.js b/js/Linear/DELAY_f.js index e044dbfb..f4372065 100644 --- a/js/Linear/DELAY_f.js +++ b/js/Linear/DELAY_f.js @@ -40,13 +40,13 @@ ok=None; if (!ok) { message(mess); } else { -evtdly.graphics.exprs[1-1]=exprs(1); +evtdly.graphics.exprs[1-1]=exprs[1-1]; if (evtdly.model.rpar!=dt) { evtdly.model.rpar=dt; newpar[$+1-1]=ppath[2-1]; } x.model.rpar.objs[ppath[2-1]-1]=evtdly; -register.graphics.exprs=exprs(2); +register.graphics.exprs=exprs[2-1]; if (or(register.model.dstate!=z0.slice())) { register.model.dstate=z0.slice(); newpar[$+1-1]=ppath[1-1]; diff --git a/js/Linear/DLSS.js b/js/Linear/DLSS.js index 63a1dc2c..7cdb4587 100644 --- a/js/Linear/DLSS.js +++ b/js/Linear/DLSS.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; exprs=graphics.exprs; if (size(exprs,"*")==7) { -exprs=exprs([1:4,7]); +exprs=exprs[[1:4,7]-1]; } model=arg1.model; while (true) { diff --git a/js/Linear/DLSS_f.js b/js/Linear/DLSS_f.js index 4cc29c36..ff1a8ba5 100644 --- a/js/Linear/DLSS_f.js +++ b/js/Linear/DLSS_f.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; exprs=graphics.exprs; if (size(exprs,"*")==7) { -exprs=exprs([1:4,7]); +exprs=exprs[[1:4,7]-1]; } model=arg1.model; while (true) { diff --git a/js/Linear/GAINBLK_f.js b/js/Linear/GAINBLK_f.js index fc9d6680..71b2ce6f 100644 --- a/js/Linear/GAINBLK_f.js +++ b/js/Linear/GAINBLK_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; while (true) { -[ok,gain,exprs]=scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs(1)); +[ok,gain,exprs]=scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); if (!ok) { break } diff --git a/js/Linear/GAIN_f.js b/js/Linear/GAIN_f.js index dc7c38b5..8ded9ef0 100644 --- a/js/Linear/GAIN_f.js +++ b/js/Linear/GAIN_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; while (true) { -[ok,gain,exprs]=scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs(1)); +[ok,gain,exprs]=scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); if (!ok) { break } diff --git a/js/Linear/SOM_f.js b/js/Linear/SOM_f.js index df747276..4a8b18f3 100644 --- a/js/Linear/SOM_f.js +++ b/js/Linear/SOM_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; model=arg1.model; exprs=graphics.exprs; if (size(exprs,"*")==2) { -exprs=exprs(2); +exprs=exprs[2-1]; } if (size(exprs,"*")!=3) { exprs=string(model.rpar); diff --git a/js/Linear/TCLSS.js b/js/Linear/TCLSS.js index 9d9b91b4..e5d0f08e 100644 --- a/js/Linear/TCLSS.js +++ b/js/Linear/TCLSS.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==7) { -exprs=exprs([1:4,7]); +exprs=exprs[[1:4,7]-1]; } while (true) { [ok,A,B,C,D,x0,exprs]=scicos_getvalue("Set continuous linear system parameters",["A matrix","B matrix","C matrix","D matrix","Initial state"],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); diff --git a/js/Linear/TCLSS_f.js b/js/Linear/TCLSS_f.js index 05338018..33d55861 100644 --- a/js/Linear/TCLSS_f.js +++ b/js/Linear/TCLSS_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==7) { -exprs=exprs([1:4,7]); +exprs=exprs[[1:4,7]-1]; } while (true) { [ok,A,B,C,D,x0,exprs]=scicos_getvalue("Set continuous linear system parameters",["A matrix","B matrix","C matrix","D matrix","Initial state"],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); diff --git a/js/Misc/AUTOMAT.js b/js/Misc/AUTOMAT.js index 182b7a17..cd27f093 100644 --- a/js/Misc/AUTOMAT.js +++ b/js/Misc/AUTOMAT.js @@ -1,3 +1,3 @@ -Syntax error in input LexToken(EOL,'\n ',1,2967) +Syntax error in input LexToken(COLON,':',1,3221) /* autogenerated from "macros/Misc/AUTOMAT.sci" */ None diff --git a/js/Misc/DEBUG.js b/js/Misc/DEBUG.js index 8f37e923..7a36654c 100644 --- a/js/Misc/DEBUG.js +++ b/js/Misc/DEBUG.js @@ -6,7 +6,7 @@ DEBUG.prototype.set = function DEBUG() { x=arg1; graphics=arg1.graphics; exprs=graphics.exprs; -textmp=exprs(2); +textmp=exprs[2-1]; ok=true; while (1==1) { [txt]=dialog(["Enter scilab instructions for debugging."," Inputs are block and flag, output is block"],textmp); diff --git a/js/Misc/LOGICAL_OP.js b/js/Misc/LOGICAL_OP.js index bc75d35e..ec4fd20d 100644 --- a/js/Misc/LOGICAL_OP.js +++ b/js/Misc/LOGICAL_OP.js @@ -1,3 +1,112 @@ -Syntax error in input LexToken(EOL,'\n ',1,2070) /* autogenerated from "macros/Misc/LOGICAL_OP.sci" */ -None +function LOGICAL_OP() { +LOGICAL_OP.prototype.get = function LOGICAL_OP() { +} +LOGICAL_OP.prototype.set = function LOGICAL_OP() { +x=arg1; +graphics=arg1.graphics; +exprs=graphics.exprs; +model=arg1.model; +if (size(exprs,1)==2) { +exprs=[exprs,sci2exp(1),sci2exp(0)]; +} +while (true) { +[ok,nin,rule,Datatype,tp,exprs]=scicos_getvalue("Set parameters",["number of inputs","Operator: AND (0), OR (1), NAND (2), NOR (3), XOR (4), NOT (5)","Datatype (1=double 3=int32 ...)","Bitwise Rule(0=No 1=yes)"],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); +if (!ok) { +break +} +nin=int(nin); +rule=int(rule); +tp=int(tp); +if (nin<1) { +message("Number of inputs must be >=1 "); +ok=None; +} else if ((rule<0)||(rule>5)) { +message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); +ok=None; +} else if ((rule==5)&&(nin>1)) { +message("Only one input allowed for NOT operation"); +nin=1; +} else if (((Datatype==1)&&(tp!=0))) { +message("Bitwise Rule is only activated when Data type is integer"); +ok=None; +} +if (ok) { +if ((tp!=0)) { +tp=1; +} +if (Datatype==1) { +model.sim=list("logicalop",4); +model.ipar=[rule]; +} else { +if (Datatype==3) { +model.sim=list("logicalop_i32",4); +} else if (Datatype==4) { +model.sim=list("logicalop_i16",4); +} else if (Datatype==5) { +model.sim=list("logicalop_i8",4); +} else if (Datatype==6) { +model.sim=list("logicalop_ui32",4); +} else if (Datatype==7) { +model.sim=list("logicalop_ui16",4); +} else if (Datatype==8) { +model.sim=list("logicalop_ui8",4); +} else { +message("Datatype is not supported"); +ok=None; +} +model.ipar=[rule,tp]; +} +if (ok) { +it=Datatype*ones(nin,1); +ot=Datatype; +in1=[-ones(nin,1),-2*ones(nin,1)]; +if ((rule!=5)&&(nin==1)) { +out=[1,1]; +[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]); +} else { +out=[-1,-2]; +[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]); +} +} +if (ok) { +if (rule==0) { +label="AND"; +} else if (rule==1) { +label="OR"; +} else if (rule==2) { +label="NAND"; +} else if (rule==3) { +label="NOR"; +} else if (rule==4) { +label="XOR"; +} else if (rule==5) { +label="NOT"; +} +graphics.exprs=exprs; +graphics.style=["blockWithLabel;displayedLabel="+label]; +x.graphics=graphics; +x.model=model; +break +} +} +} +} +LOGICAL_OP.prototype.define = function LOGICAL_OP() { +in1=[-1,-1]; +ipar=[0]; +nin=2; +model=scicos_model(); +model.sim=list("logicalop",4); +model.in1=in1; +model.out=-1; +model.ipar=ipar; +model.blocktype="c"; +model.dep_ut=[true,None]; +exprs=[string(nin),string(ipar)]; +gr_i=[]; +x=standard_define([2,2],model,exprs,gr_i); +} +LOGICAL_OP.prototype.details = function LOGICAL_OP() { +} +} diff --git a/js/Misc/MBLOCK.js b/js/Misc/MBLOCK.js index 43af51df..b5741088 100644 --- a/js/Misc/MBLOCK.js +++ b/js/Misc/MBLOCK.js @@ -1,3 +1,3 @@ -Syntax error in input LexToken(OPENBRACKET,'(',1,1518) +Syntax error in input LexToken(COLON,':',1,14003) /* autogenerated from "macros/Misc/MBLOCK.sci" */ None diff --git a/js/Misc/MPBLOCK.js b/js/Misc/MPBLOCK.js index a72e1990..dfd5f058 100644 --- a/js/Misc/MPBLOCK.js +++ b/js/Misc/MPBLOCK.js @@ -1,3 +1,3 @@ -Syntax error in input LexToken(OPENBRACKET,'(',1,1559) +Syntax error in input LexToken(COLON,':',1,13483) /* autogenerated from "macros/Misc/MPBLOCK.sci" */ None diff --git a/js/Misc/TEXT_f.js b/js/Misc/TEXT_f.js index d997af37..99eac7bb 100644 --- a/js/Misc/TEXT_f.js +++ b/js/Misc/TEXT_f.js @@ -32,7 +32,7 @@ default_font_size=gh_winpal.font_size; default_font_color=gh_winpal.font_color; gh_winpal.font_style=font; gh_winpal.font_size=siz; -r=xstringl(0,0,exprs(1),evstr(exprs(2)),evstr(exprs(3))); +r=xstringl(0,0,exprs[1-1],evstr(exprs[2-1]),evstr(exprs[3-1])); gh_winpal.font_style=default_font_style; gh_winpal.font_size=default_font_size; gh_winpal.font_color=default_font_color; diff --git a/js/Misc/scifunc_block_m.js b/js/Misc/scifunc_block_m.js index 0c0c8f3c..18ee889b 100644 --- a/js/Misc/scifunc_block_m.js +++ b/js/Misc/scifunc_block_m.js @@ -9,7 +9,7 @@ model=arg1.model; graphics=arg1.graphics; exprs=graphics.exprs; while (true) { -[ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab]=scicos_getvalue(["Set scifunc_block parameters","only regular blocks supported"],["input ports sizes","output port sizes","input event ports sizes","output events ports sizes","initial continuous state","initial discrete state","System parameters vector","initial firing vector (<0 for no firing)","is block always active (0:no, 1:yes)"],list("mat",[-1,2],"mat",[-2,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs(1)); +[ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab]=scicos_getvalue(["Set scifunc_block parameters","only regular blocks supported"],["input ports sizes","output port sizes","input event ports sizes","output events ports sizes","initial continuous state","initial discrete state","System parameters vector","initial firing vector (<0 for no firing)","is block always active (0:no, 1:yes)"],list("mat",[-1,2],"mat",[-2,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs[1-1]); if (!ok) { break } diff --git a/js/NonLinear/EXPBLK_f.js b/js/NonLinear/EXPBLK_f.js index 7fff28bd..13e4471d 100644 --- a/js/NonLinear/EXPBLK_f.js +++ b/js/NonLinear/EXPBLK_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(2); +exprs=exprs[2-1]; } while (true) { [ok,a,exprs]=scicos_getvalue("Set a^u block parameters","a (>0)",list("vec",1),exprs); diff --git a/js/NonLinear/EXPBLK_m.js b/js/NonLinear/EXPBLK_m.js index 9554f84f..587c7617 100644 --- a/js/NonLinear/EXPBLK_m.js +++ b/js/NonLinear/EXPBLK_m.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(2); +exprs=exprs[2-1]; } while (true) { [ok,a,exprs]=scicos_getvalue("Set a^u block parameters","a (>0)",list("vec",1),exprs); diff --git a/js/NonLinear/LOGBLK_f.js b/js/NonLinear/LOGBLK_f.js index a0e28e4c..debd12f6 100644 --- a/js/NonLinear/LOGBLK_f.js +++ b/js/NonLinear/LOGBLK_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(2); +exprs=exprs[2-1]; } while (true) { [ok,a,exprs]=scicos_getvalue("Set log block parameters","Basis (>1)",list("vec",1),exprs); diff --git a/js/NonLinear/POWBLK_f.js b/js/NonLinear/POWBLK_f.js index d8aeabe3..8570682c 100644 --- a/js/NonLinear/POWBLK_f.js +++ b/js/NonLinear/POWBLK_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(2); +exprs=exprs[2-1]; } while (true) { [ok,a,exprs]=scicos_getvalue("Set u^a block parameters","to the power of",list("vec",1),exprs); diff --git a/js/Sinks/CLKOUT_f.js b/js/Sinks/CLKOUT_f.js index 52e92ba7..f97d4c48 100644 --- a/js/Sinks/CLKOUT_f.js +++ b/js/Sinks/CLKOUT_f.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; model=arg1.model; exprs=graphics.exprs; -exprs=exprs(1); +exprs=exprs[1-1]; while (true) { [ok,prt,exprs]=scicos_getvalue("Set Event Output block parameters","Port number",list("vec",1),exprs); if (!ok) { diff --git a/js/Sinks/OUTIMPL_f.js b/js/Sinks/OUTIMPL_f.js index 3f2a583a..490f1e07 100644 --- a/js/Sinks/OUTIMPL_f.js +++ b/js/Sinks/OUTIMPL_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(1); +exprs=exprs[1-1]; } while (true) { [ok,prt,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"OUTIMPL_f")," ",gettext("Implicit output port")],gettext("Port number"),list("vec",1),exprs); diff --git a/js/Sinks/OUT_f.js b/js/Sinks/OUT_f.js index 464dc045..a8eddb21 100644 --- a/js/Sinks/OUT_f.js +++ b/js/Sinks/OUT_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; model=arg1.model; exprs=graphics.exprs; if (size(exprs,"*")==2) { -exprs=exprs(1); +exprs=exprs[1-1]; } while (true) { [ok,prt,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"OUT_f")," ",gettext("Regular output port")],gettext("Port number"),list("vec",1),exprs); diff --git a/js/Sinks/WFILE_f.js b/js/Sinks/WFILE_f.js index 589af0a0..d78784af 100644 --- a/js/Sinks/WFILE_f.js +++ b/js/Sinks/WFILE_f.js @@ -1,3 +1,90 @@ -Syntax error in input LexToken(EOL,'\n ',1,3640) /* autogenerated from "macros/Sinks/WFILE_f.sci" */ -None +function WFILE_f() { +WFILE_f.prototype.get = function WFILE_f() { +} +WFILE_f.prototype.set = function WFILE_f() { +warnobsolete("WRITEC_f","6.0.0"); +warnMessage=msprintf(_("Feature %s is obsolete."),"WFILE_f"); +warnAdvise=msprintf(_("Please use %s instead."),"WRITEC_f"); +warnXcosMessage=msprintf("%s %s",warnMessage,warnAdvise); +warnBlockByUID(arg1.model.label,warnXcosMessage); +x=arg1; +graphics=arg1.graphics; +exprs=graphics.exprs; +model=arg1.model; +dstate=model.dstate; +lunit=dstate(2); +fname=exprs[2-1]; +frmt=exprs[3-1]; +while (true) { +[ok,in1,fname1,frmt1,N,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"WFILE_f")," ",gettext("Write to output file")," ",gettext("Write is done on:"),gettext(" - A binary file if no format given"),gettext(" - A formatted text file if a format (Fortran type) is given")],[gettext("Input Size"),gettext("Output File Name"),gettext("Output Format"),gettext("Buffer Size")],list("vec",1,"str",1,"str",1,"vec",1),exprs); +if (!ok) { +break +} +in1=int(in1); +nin=in1; +fname1=pathconvert(stripblanks(fname1),None,true); +frmt1=stripblanks(frmt1); +if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { +block_parameter_error(gettext("Simulation running !!! You cannot switch<br />between formatted and unformatted when running"),gettext("End current simulation first.")); +ok=None; +} else if (lunit>0&&fname1!=fname) { +block_parameter_error(gettext("You cannot modify \'Output File Name\' when running."),gettext("End current simulation first.")); +ok=None; +} else if (fname1=="") { +block_parameter_error(gettext("Wrong value for \'Output File Name\' parameter"),gettext("You must provide a filename.")); +ok=None; +} else if (fileparts(fname1)!="") { +[pa,fn,ex]=fileparts(fname1); +if (!isdir(pa)) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); +ok=None; +} +} else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); +ok=None; +} else if (N<2) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Must be greater than 1.")); +ok=None; +} else if (in1<=0) { +block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); +ok=None; +} +if (ok) { +ipar=[length(fname1),length(frmt1),0,N,_str2code(fname1),_str2code(frmt1)]; +if (prod(size(dstate))!=(nin+1)*N+2) { +dstate=[-1,lunit,zeros((nin+1)*N,1)]; +} +model.in1=nin; +model.dstate=dstate; +model.ipar=ipar; +model.dep_ut=[true,None]; +graphics.exprs=exprs; +x.graphics=graphics; +x.model=model; +break +} +} +} +WFILE_f.prototype.define = function WFILE_f() { +in1=1; +nin=sum(in1); +frmt="(7(e10.3,1x))"; +fname="foo"; +lunit=0; +N=2; +model=scicos_model(); +model.sim="writef"; +model.in1=in1; +model.evtin=1; +model.dstate=[-1,lunit,zeros((nin+1)*N,1)]; +model.ipar=[length(fname),length(frmt),0,N,_str2code(fname),_str2code(frmt)]; +model.blocktype="d"; +model.dep_ut=[true,None]; +exprs=[sci2exp(in1),fname,frmt,string(N)]; +gr_i=[]; +x=standard_define([3,2],model,exprs,gr_i); +} +WFILE_f.prototype.details = function WFILE_f() { +} +} diff --git a/js/Sinks/WRITEC_f.js b/js/Sinks/WRITEC_f.js index 5dcb16d6..b101a91e 100644 --- a/js/Sinks/WRITEC_f.js +++ b/js/Sinks/WRITEC_f.js @@ -10,8 +10,8 @@ model=arg1.model; ipar=model.ipar; dstate=model.dstate; lunit=dstate(2); -fname=exprs(2); -frmt=exprs(3); +fname=exprs[2-1]; +frmt=exprs[3-1]; while (true) { [ok,in1,fname1,frmt1,N,swap,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"WRITEC_f")," ",gettext("Write to C binary file")],[gettext("Input Size"),gettext("Output File Name"),gettext("Output Format"),gettext("Buffer Size"),gettext("Swap Mode (0:No, 1:Yes)")],list("vec",1,"str",1,"str",1,"vec",1,"vec",1),exprs); if (!ok) { diff --git a/js/Sources/CLKINV_f.js b/js/Sources/CLKINV_f.js index 95cfa7d5..b6ef32a8 100644 --- a/js/Sources/CLKINV_f.js +++ b/js/Sources/CLKINV_f.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; model=arg1.model; exprs=graphics.exprs; -exprs=exprs(1); +exprs=exprs[1-1]; while (true) { [ok,prt,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"CLKINV_f")," ",gettext("Event input port")," "],"Port Number",list("vec",1),exprs); prt=int(prt); diff --git a/js/Sources/CLKIN_f.js b/js/Sources/CLKIN_f.js index b740b93c..274772ad 100644 --- a/js/Sources/CLKIN_f.js +++ b/js/Sources/CLKIN_f.js @@ -7,7 +7,7 @@ x=arg1; graphics=arg1.graphics; model=arg1.model; exprs=graphics.exprs; -exprs=exprs(1); +exprs=exprs[1-1]; while (true) { [ok,prt,exprs]=scicos_getvalue("Set Event Input block parameters","Port number",list("vec",1),exprs); prt=int(prt); diff --git a/js/Sources/GENSQR_f.js b/js/Sources/GENSQR_f.js index f8f70525..3766c73b 100644 --- a/js/Sources/GENSQR_f.js +++ b/js/Sources/GENSQR_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(2); +exprs=exprs[2-1]; } while (true) { [ok,Amplitude,exprs]=scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs); diff --git a/js/Sources/INIMPL_f.js b/js/Sources/INIMPL_f.js index c6afca25..26990047 100644 --- a/js/Sources/INIMPL_f.js +++ b/js/Sources/INIMPL_f.js @@ -8,7 +8,7 @@ graphics=arg1.graphics; exprs=graphics.exprs; model=arg1.model; if (size(exprs,"*")==2) { -exprs=exprs(1); +exprs=exprs[1-1]; } while (true) { [ok,prt,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"INIMPL_f")," ",gettext("Implicit input port")," "],"Port Number",list("vec",1),exprs); diff --git a/js/Sources/IN_f.js b/js/Sources/IN_f.js index d9ca87b1..2099e960 100644 --- a/js/Sources/IN_f.js +++ b/js/Sources/IN_f.js @@ -8,10 +8,10 @@ graphics=arg1.graphics; model=arg1.model; exprs=graphics.exprs; if (size(exprs,"*")==2) { -exprs=exprs(1); +exprs=exprs[1-1]; } if (size(exprs,"*")==1) { -exprs=[exprs(1),"[-1 -2]","-1"]; +exprs=[exprs[1-1],"[-1 -2]","-1"]; } while (true) { [ok,prt,otsz,ot,exprs]=getvalue(_("Set Input block parameters"),[_("Port number"),_("Outport size ([-1 -2] for inherit)"),_("Outport Type (-1 for inherit)")],list("vec",1,"vec",-1,"vec",1),exprs); diff --git a/js/Sources/READAU_f.js b/js/Sources/READAU_f.js index 365f072e..0cfdba51 100644 --- a/js/Sources/READAU_f.js +++ b/js/Sources/READAU_f.js @@ -13,7 +13,7 @@ ipar=model.ipar; imask=9+ipar(1); tmask=ipar(imask); lunit=dstate(3); -fname=exprs(1); +fname=exprs[1-1]; while (true) { [ok,fname1,N,swap,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"READAU_f")," ",gettext("(Read Audio File)")," ",gettext("Read is done on a binary \'.au\' file")],[gettext("Input File Name"),gettext("Buffer size"),gettext("Swap Mode (0:No, 1:Yes)")],list("str",1,"vec",1,"vec",1),exprs); tmask1=[]; diff --git a/js/Sources/READC_f.js b/js/Sources/READC_f.js index aeff85c7..a5524672 100644 --- a/js/Sources/READC_f.js +++ b/js/Sources/READC_f.js @@ -13,8 +13,8 @@ ipar=model.ipar; imask=9+ipar(1); tmask=ipar(imask); lunit=dstate(3); -fname=exprs(3); -frmt=exprs(4); +fname=exprs[3-1]; +frmt=exprs[4-1]; while (true) { [ok,tmask1,outmask,fname1,frmt1,M,N,offset,swap,exprs]=scicos_getvalue([msprintf(gettext("Set %s block parameters"),"READC_f")," ",gettext("Read from C binary file")],[gettext("Time Record Selection"),gettext("Outputs Record Selection"),gettext("Input File Name"),gettext("Input Format"),gettext("Record Size"),gettext("Buffer Size"),gettext("Initial Record Index"),gettext("Swap Mode (0:No, 1:Yes)")],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); if (!ok) { diff --git a/js/Sources/RFILE_f.js b/js/Sources/RFILE_f.js index 2b2ac0f6..265cc7f6 100644 --- a/js/Sources/RFILE_f.js +++ b/js/Sources/RFILE_f.js @@ -1,3 +1,3 @@ -Syntax error in input LexToken(EOL,'\n ',1,4018) +Syntax error in input LexToken(SPACE,' ',1,5989) /* autogenerated from "macros/Sources/RFILE_f.sci" */ None |