From 8cf65fe92b28b8809abcb0eb59f951d26f30792f Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Tue, 19 Jun 2018 23:23:04 +0530 Subject: distinguish between functions and arrays maintain a list of functions --- js/Misc/MPBLOCK.js | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'js/Misc/MPBLOCK.js') diff --git a/js/Misc/MPBLOCK.js b/js/Misc/MPBLOCK.js index d9048ac5..83ed4ff3 100644 --- a/js/Misc/MPBLOCK.js +++ b/js/Misc/MPBLOCK.js @@ -14,7 +14,7 @@ model=scicos_model(); model.blocktype="c"; model.dep_ut=[true,true]; model.rpar=[]; -for (i=1;i<=lstsize(paramv);i+=1) { +for (i=1;i<=lstsize[paramv-1];i+=1) { model.rpar=[[model.rpar],[paramv[i-1].slice()]]; } mo=modelica(); @@ -40,14 +40,14 @@ x=arg1; model=arg1.model; graphics=arg1.graphics; exprs=graphics.exprs; -if (type(exprs)==15) { +if (type[exprs-1]==15) { paramv=list(); pprop=[]; for (i=1;i<=size(model.rpar,"*");i+=1) { -paramv[$+1-1]=string(model.rpar(i)); +paramv[$+1-1]=string(model.rpar[i-1]); pprop[$+1-1]=0; } -exprs=tlist(["MPBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1](1),exprs[1-1](2),exprs[1-1](3),exprs[1-1](4),exprs[1-1](5),paramv,sci2exp(pprop.slice()),exprs[1-1](7),exprs[2-1]); +exprs=tlist(["MPBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(pprop.slice()),exprs[1-1][7-1],exprs[2-1]); } lab_1=list(exprs.in1,exprs.intype,exprs.out,exprs.outtype,exprs.param,exprs.pprop,exprs.nameF); lab_2=exprs.paramv; @@ -71,7 +71,7 @@ break; } } if (!ok) { -x_message([["Invalid variable name for the input "+string(i)+"."],["\""+in1(i)+"\""],["Please choose another variable name."]]); +x_message([["Invalid variable name for the input "+string(i)+"."],["\""+in1[i-1]+"\""],["Please choose another variable name."]]); } } if (ok) { @@ -84,7 +84,7 @@ break; } } if (!ok) { -x_message([["Invalid variable name for the output "+string(i)+"."],["\""+out(i)+"\""],["Please choose another variable name."]]); +x_message([["Invalid variable name for the output "+string(i)+"."],["\""+out[i-1]+"\""],["Please choose another variable name."]]); } } if (ok) { @@ -103,7 +103,7 @@ x_message([["Invalid variable name for the parameter "+string(i)+"."],["\""+para } if (ok) { for (i=1;i<=size(intype,"*");i+=1) { -if (intype(i)!="E"&&intype(i)!="I") { +if (intype[i-1]!="E"&&intype[i-1]!="I") { x_message("Input type should be \'E\' or \'I\'!"); ok=false; break; @@ -112,7 +112,7 @@ break; } if (ok) { for (i=1;i<=size(outtype,"*");i+=1) { -if (outtype(i)!="E"&&outtype(i)!="I") { +if (outtype[i-1]!="E"&&outtype[i-1]!="I") { x_message("Output type should be \'E\' or \'I\'!"); ok=false; break; @@ -165,17 +165,17 @@ outtypex=find(outtype=="I"); if (ok) { Tparam_lab=evstr(Tparam); Tparam_sz=size(Tparam_lab,"*"); -if (Tparam_sz>lstsize(lab_2)) { -for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { +if (Tparam_sz>lstsize[lab_2-1]) { +for (i=1;i<=(Tparam_sz-lstsize[lab_2-1]);i+=1) { lab_2[$+1-1]="0"; } -} else if (Tparam_sz