summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--combined.js247
-rw-r--r--js/Branching/DEMUX.js2
-rw-r--r--js/Branching/DEMUX_f.js2
-rw-r--r--js/Hydraulics/Bache.js2
-rw-r--r--js/MatrixOp/MATCATH.js2
-rw-r--r--js/MatrixOp/MATCATV.js2
-rw-r--r--js/MatrixOp/MATMUL.js152
-rw-r--r--js/Misc/RELATIONALOP.js94
-rw-r--r--js/Sources/GENSQR_f.js3
-rwxr-xr-xsci2jsyacc.py19
10 files changed, 499 insertions, 26 deletions
diff --git a/combined.js b/combined.js
index 451f3024..558e512c 100644
--- a/combined.js
+++ b/combined.js
@@ -4435,8 +4435,7 @@ if (size(exprs,"*")==2) {
exprs=exprs(2);
}
while (true) {
-[ok,Amplitude,exprs]=scicos_getvalue([
- "Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs);
+[ok,Amplitude,exprs]=scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs);
if (!ok) {
break
}
@@ -5512,6 +5511,157 @@ x=standard_define([3,2],model,exprs,gr_i);
GENSIN_f.prototype.details = function GENSIN_f() {
}
}
+/* autogenerated from "macros/MatrixOp/MATMUL.sci" */
+function MATMUL() {
+MATMUL.prototype.get = function MATMUL() {
+}
+MATMUL.prototype.set = function MATMUL() {
+x=arg1;
+graphics=x.graphics;
+label=graphics.exprs;
+model=x.model;
+if (model.ipar==[]) {
+model.ipar=1;
+}
+if (size(label,"*")==1) {
+label[2-1]=sci2exp(1);
+}
+if (size(label,"*")==2) {
+label[3-1]=sci2exp(1);
+}
+while (true) {
+[ok,dtype,rule,np,exprs]=scicos_getvalue(["Set MATMUL parameter","For the Multipication rule:"," 1= Matrix by Matrix"," 2= Matrix by Matrix element wise "," 3= Matrix by Scalar","In the third case the second input will be the scalar"],["Datatype(1=real double 2=Complex 3=int32 ...)","Multiplication rule","Do on Overflow(0=Nothing 1=Saturate 2=Error)"],list("vec",1,"vec",1,"vec",1),label);
+if (!ok) {
+break
+}
+rule=int(rule);
+if ((dtype<1||dtype>8)) {
+message("type is not supported");
+ok=None;
+}
+if ((rule<1||rule>3)) {
+message("Multiplication rule must be only 1,2 or 3");
+ok=None;
+}
+if ((dtype==1||dtype==2)) {
+np=0;
+}
+TABMIN=[0,0,-(2^31),-(2^15),-(2^7),0,0,0];
+TABMAX=[0,0,(2^31)-1,(2^15)-1,(2^7)-1,(2^32)-1,(2^16)-1,(2^8)-1];
+if (rule==2) {
+if (np==0) {
+model.sim=list("matmul2_m",4);
+} else if (np==1) {
+model.sim=list("matmul2_s",4);
+} else {
+model.sim=list("matmul2_e",4);
+}
+} else if (rule==3) {
+if (np==0) {
+model.sim=list("matbyscal",4);
+} else if (np==1) {
+model.sim=list("matbyscal_s",4);
+} else {
+model.sim=list("matbyscal_e",4);
+}
+} else {
+if ((dtype==1)) {
+model.sim=list("matmul_m",4);
+} else if ((dtype==2)) {
+model.sim=list("matzmul_m",4);
+} else if (dtype==3) {
+if (np==0) {
+model.sim=list("matmul_i32n",4);
+} else if (np==1) {
+model.sim=list("matmul_i32s",4);
+} else {
+model.sim=list("matmul_i32e",4);
+}
+} else if (dtype==4) {
+if (np==0) {
+model.sim=list("matmul_i16n",4);
+} else if (np==1) {
+model.sim=list("matmul_i16s",4);
+} else {
+model.sim=list("matmul_i16e",4);
+}
+} else if (dtype==5) {
+if (np==0) {
+model.sim=list("matmul_i8n",4);
+} else if (np==1) {
+model.sim=list("matmul_i8s",4);
+} else {
+model.sim=list("matmul_i8e",4);
+}
+} else if (dtype==6) {
+if (np==0) {
+model.sim=list("matmul_ui32n",4);
+} else if (np==1) {
+model.sim=list("matmul_ui32s",4);
+} else {
+model.sim=list("matmul_ui32e",4);
+}
+} else if (dtype==7) {
+if (np==0) {
+model.sim=list("matmul_ui16n",4);
+} else if (np==1) {
+model.sim=list("matmul_ui16s",4);
+} else {
+model.sim=list("matmul_ui16e",4);
+}
+} else if (dtype==8) {
+if (np==0) {
+model.sim=list("matmul_ui8n",4);
+} else if (np==1) {
+model.sim=list("matmul_ui8s",4);
+} else {
+model.sim=list("matmul_ui8e",4);
+}
+}
+}
+kmin=TABMIN(dtype);
+kmax=TABMAX(dtype);
+it=dtype*ones(1,2);
+ot=dtype;
+if (rule==1) {
+in1=[-1,-2,-2,-3];
+out=[-1,-3];
+} else if (rule==2) {
+in1=[-1,-2,-1,-2];
+out=[-1,-2];
+} else {
+in1=[-1,-2,1,1];
+out=[-1,-2];
+}
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]);
+if (ok) {
+label=exprs;
+model.ipar=rule;
+model.rpar=[kmin,kmax];
+graphics.exprs=label;
+x.graphics=graphics;
+x.model=model;
+arg1=x;
+break
+}
+}
+}
+MATMUL.prototype.define = function MATMUL() {
+model=scicos_model();
+model.sim=list("matmul_m",4);
+model.in=[-1,-2];
+model.in2=[-2,-3];
+model.out=-1;
+model.out2=-3;
+model.dep_ut=[true,None];
+model.ipar=1;
+label=[sci2exp(model.ipar)];
+gr_i=[];
+x=standard_define([3,2],model,label,gr_i);
+}
+MATMUL.prototype.details = function MATMUL() {
+}
+}
/* autogenerated from "macros/MatrixOp/MATMAGPHI.sci" */
function MATMAGPHI() {
MATMAGPHI.prototype.get = function MATMAGPHI() {
@@ -8816,6 +8966,99 @@ x=standard_define([3.5,2],model,exprs,gr_i);
RATELIMITER.prototype.details = function RATELIMITER() {
}
}
+/* autogenerated from "macros/Misc/RELATIONALOP.sci" */
+function RELATIONALOP() {
+RELATIONALOP.prototype.get = function RELATIONALOP() {
+}
+RELATIONALOP.prototype.set = function RELATIONALOP() {
+x=arg1;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+model=arg1.model;
+if (size(exprs,1)==2) {
+exprs=[exprs,sci2exp(1)];
+}
+while (true) {
+[ok,rule,zcr,Datatype,exprs]=scicos_getvalue("Set parameters",["Operator: == (0), ~= (1), < (2), <= (3), > (4), >= (5)","Use zero crossing (no: 0), (yes: 1)","Datatype (1=double 3=int32 ...)"],list("vec",1,"vec",1,"vec",1),exprs);
+if (!ok) {
+break
+}
+rule=int(rule);
+if (zcr!=0) {
+zcr=1;
+}
+if ((rule<0)||(rule>5)) {
+message("Incorrect operator "+string(rule)+" ; must be 0 to 5.");
+ok=None;
+}
+if ((Datatype==1)) {
+model.sim=list("relational_op",4);
+} else if ((Datatype==3||Datatype==9)) {
+model.sim=list("relational_op_i32",4);
+} else if ((Datatype==4)) {
+model.sim=list("relational_op_i16",4);
+} else if ((Datatype==5)) {
+model.sim=list("relational_op_i8",4);
+} else if ((Datatype==6)) {
+model.sim=list("relational_op_ui32",4);
+} else if ((Datatype==7)) {
+model.sim=list("relational_op_ui16",4);
+} else if ((Datatype==8)) {
+model.sim=list("relational_op_ui8",4);
+} else {
+message("Datatype is not supported");
+ok=None;
+}
+if (ok) {
+it=Datatype*ones(1,2);
+ot=Datatype;
+in1=[-1,-2,-1,-2];
+out=[-1,-2];
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]);
+}
+if (ok) {
+if (rule==0) {
+label="==";
+} else if (rule==1) {
+label="~=";
+} else if (rule==2) {
+label="&#60;";
+} else if (rule==3) {
+label="&#8804;";
+} else if (rule==4) {
+label="&#62;";
+} else if (rule==5) {
+label="&#8805;";
+}
+graphics.exprs=exprs;
+graphics.style=["fontSize=13;fontStyle=1;displayedLabel="+label];
+model.ipar=[rule];
+model.nzcross=zcr;
+model.nmode=zcr;
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+RELATIONALOP.prototype.define = function RELATIONALOP() {
+ipar=[2];
+label="&lt";
+model=scicos_model();
+model.sim=list("relationalop",4);
+model.in=[1,1];
+model.out=1;
+model.ipar=ipar;
+model.blocktype="c";
+model.dep_ut=[true,None];
+exprs=[string(ipar),string(0)];
+gr_i=[];
+x=standard_define([2,2],model,exprs,gr_i);
+x.graphics.style=["fontSize=13;fontStyle=1;displayedLabel="+label];
+}
+RELATIONALOP.prototype.details = function RELATIONALOP() {
+}
+}
/* autogenerated from "macros/Misc/CONSTRAINT_c.sci" */
function CONSTRAINT_c() {
CONSTRAINT_c.prototype.get = function CONSTRAINT_c() {
diff --git a/js/Branching/DEMUX.js b/js/Branching/DEMUX.js
index e5b5400d..8c811195 100644
--- a/js/Branching/DEMUX.js
+++ b/js/Branching/DEMUX.js
@@ -1,3 +1,3 @@
-Syntax error in input LexToken(OPENSQBRACKET,'[',1,1558)
+Syntax error in input LexToken(COLON,':',1,1560)
/* autogenerated from "macros/Branching/DEMUX.sci" */
None
diff --git a/js/Branching/DEMUX_f.js b/js/Branching/DEMUX_f.js
index 4b468fb4..3299c56f 100644
--- a/js/Branching/DEMUX_f.js
+++ b/js/Branching/DEMUX_f.js
@@ -1,3 +1,3 @@
-Syntax error in input LexToken(OPENSQBRACKET,'[',1,1557)
+Syntax error in input LexToken(COLON,':',1,1559)
/* autogenerated from "macros/Branching/DEMUX_f.sci" */
None
diff --git a/js/Hydraulics/Bache.js b/js/Hydraulics/Bache.js
index 15908dc0..3a25b009 100644
--- a/js/Hydraulics/Bache.js
+++ b/js/Hydraulics/Bache.js
@@ -1,3 +1,3 @@
-Syntax error in input LexToken(OPENBRACKET,'(',1,2447)
+Syntax error in input LexToken(COLON,':',1,2449)
/* autogenerated from "macros/Hydraulics/Bache.sci" */
None
diff --git a/js/MatrixOp/MATCATH.js b/js/MatrixOp/MATCATH.js
index 40f8c5b8..66648256 100644
--- a/js/MatrixOp/MATCATH.js
+++ b/js/MatrixOp/MATCATH.js
@@ -1,3 +1,3 @@
-Syntax error in input LexToken(OPENBRACKET,'(',1,1457)
+Syntax error in input LexToken(COLON,':',1,1460)
/* autogenerated from "macros/MatrixOp/MATCATH.sci" */
None
diff --git a/js/MatrixOp/MATCATV.js b/js/MatrixOp/MATCATV.js
index f6271396..7a5ba1a3 100644
--- a/js/MatrixOp/MATCATV.js
+++ b/js/MatrixOp/MATCATV.js
@@ -1,3 +1,3 @@
-Syntax error in input LexToken(OPENBRACKET,'(',1,1442)
+Syntax error in input LexToken(COLON,':',1,1445)
/* autogenerated from "macros/MatrixOp/MATCATV.sci" */
None
diff --git a/js/MatrixOp/MATMUL.js b/js/MatrixOp/MATMUL.js
index 1a565138..4b3cc4d0 100644
--- a/js/MatrixOp/MATMUL.js
+++ b/js/MatrixOp/MATMUL.js
@@ -1,3 +1,151 @@
-Syntax error in input LexToken(OPENBRACKET,'(',1,2302)
/* autogenerated from "macros/MatrixOp/MATMUL.sci" */
-None
+function MATMUL() {
+MATMUL.prototype.get = function MATMUL() {
+}
+MATMUL.prototype.set = function MATMUL() {
+x=arg1;
+graphics=x.graphics;
+label=graphics.exprs;
+model=x.model;
+if (model.ipar==[]) {
+model.ipar=1;
+}
+if (size(label,"*")==1) {
+label[2-1]=sci2exp(1);
+}
+if (size(label,"*")==2) {
+label[3-1]=sci2exp(1);
+}
+while (true) {
+[ok,dtype,rule,np,exprs]=scicos_getvalue(["Set MATMUL parameter","For the Multipication rule:"," 1= Matrix by Matrix"," 2= Matrix by Matrix element wise "," 3= Matrix by Scalar","In the third case the second input will be the scalar"],["Datatype(1=real double 2=Complex 3=int32 ...)","Multiplication rule","Do on Overflow(0=Nothing 1=Saturate 2=Error)"],list("vec",1,"vec",1,"vec",1),label);
+if (!ok) {
+break
+}
+rule=int(rule);
+if ((dtype<1||dtype>8)) {
+message("type is not supported");
+ok=None;
+}
+if ((rule<1||rule>3)) {
+message("Multiplication rule must be only 1,2 or 3");
+ok=None;
+}
+if ((dtype==1||dtype==2)) {
+np=0;
+}
+TABMIN=[0,0,-(2^31),-(2^15),-(2^7),0,0,0];
+TABMAX=[0,0,(2^31)-1,(2^15)-1,(2^7)-1,(2^32)-1,(2^16)-1,(2^8)-1];
+if (rule==2) {
+if (np==0) {
+model.sim=list("matmul2_m",4);
+} else if (np==1) {
+model.sim=list("matmul2_s",4);
+} else {
+model.sim=list("matmul2_e",4);
+}
+} else if (rule==3) {
+if (np==0) {
+model.sim=list("matbyscal",4);
+} else if (np==1) {
+model.sim=list("matbyscal_s",4);
+} else {
+model.sim=list("matbyscal_e",4);
+}
+} else {
+if ((dtype==1)) {
+model.sim=list("matmul_m",4);
+} else if ((dtype==2)) {
+model.sim=list("matzmul_m",4);
+} else if (dtype==3) {
+if (np==0) {
+model.sim=list("matmul_i32n",4);
+} else if (np==1) {
+model.sim=list("matmul_i32s",4);
+} else {
+model.sim=list("matmul_i32e",4);
+}
+} else if (dtype==4) {
+if (np==0) {
+model.sim=list("matmul_i16n",4);
+} else if (np==1) {
+model.sim=list("matmul_i16s",4);
+} else {
+model.sim=list("matmul_i16e",4);
+}
+} else if (dtype==5) {
+if (np==0) {
+model.sim=list("matmul_i8n",4);
+} else if (np==1) {
+model.sim=list("matmul_i8s",4);
+} else {
+model.sim=list("matmul_i8e",4);
+}
+} else if (dtype==6) {
+if (np==0) {
+model.sim=list("matmul_ui32n",4);
+} else if (np==1) {
+model.sim=list("matmul_ui32s",4);
+} else {
+model.sim=list("matmul_ui32e",4);
+}
+} else if (dtype==7) {
+if (np==0) {
+model.sim=list("matmul_ui16n",4);
+} else if (np==1) {
+model.sim=list("matmul_ui16s",4);
+} else {
+model.sim=list("matmul_ui16e",4);
+}
+} else if (dtype==8) {
+if (np==0) {
+model.sim=list("matmul_ui8n",4);
+} else if (np==1) {
+model.sim=list("matmul_ui8s",4);
+} else {
+model.sim=list("matmul_ui8e",4);
+}
+}
+}
+kmin=TABMIN(dtype);
+kmax=TABMAX(dtype);
+it=dtype*ones(1,2);
+ot=dtype;
+if (rule==1) {
+in1=[-1,-2,-2,-3];
+out=[-1,-3];
+} else if (rule==2) {
+in1=[-1,-2,-1,-2];
+out=[-1,-2];
+} else {
+in1=[-1,-2,1,1];
+out=[-1,-2];
+}
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]);
+if (ok) {
+label=exprs;
+model.ipar=rule;
+model.rpar=[kmin,kmax];
+graphics.exprs=label;
+x.graphics=graphics;
+x.model=model;
+arg1=x;
+break
+}
+}
+}
+MATMUL.prototype.define = function MATMUL() {
+model=scicos_model();
+model.sim=list("matmul_m",4);
+model.in=[-1,-2];
+model.in2=[-2,-3];
+model.out=-1;
+model.out2=-3;
+model.dep_ut=[true,None];
+model.ipar=1;
+label=[sci2exp(model.ipar)];
+gr_i=[];
+x=standard_define([3,2],model,label,gr_i);
+}
+MATMUL.prototype.details = function MATMUL() {
+}
+}
diff --git a/js/Misc/RELATIONALOP.js b/js/Misc/RELATIONALOP.js
index 7ebbd94d..33d0d152 100644
--- a/js/Misc/RELATIONALOP.js
+++ b/js/Misc/RELATIONALOP.js
@@ -1,3 +1,93 @@
-Syntax error in input LexToken(CLOSESQBRACKET,']',1,3405)
/* autogenerated from "macros/Misc/RELATIONALOP.sci" */
-None
+function RELATIONALOP() {
+RELATIONALOP.prototype.get = function RELATIONALOP() {
+}
+RELATIONALOP.prototype.set = function RELATIONALOP() {
+x=arg1;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+model=arg1.model;
+if (size(exprs,1)==2) {
+exprs=[exprs,sci2exp(1)];
+}
+while (true) {
+[ok,rule,zcr,Datatype,exprs]=scicos_getvalue("Set parameters",["Operator: == (0), ~= (1), < (2), <= (3), > (4), >= (5)","Use zero crossing (no: 0), (yes: 1)","Datatype (1=double 3=int32 ...)"],list("vec",1,"vec",1,"vec",1),exprs);
+if (!ok) {
+break
+}
+rule=int(rule);
+if (zcr!=0) {
+zcr=1;
+}
+if ((rule<0)||(rule>5)) {
+message("Incorrect operator "+string(rule)+" ; must be 0 to 5.");
+ok=None;
+}
+if ((Datatype==1)) {
+model.sim=list("relational_op",4);
+} else if ((Datatype==3||Datatype==9)) {
+model.sim=list("relational_op_i32",4);
+} else if ((Datatype==4)) {
+model.sim=list("relational_op_i16",4);
+} else if ((Datatype==5)) {
+model.sim=list("relational_op_i8",4);
+} else if ((Datatype==6)) {
+model.sim=list("relational_op_ui32",4);
+} else if ((Datatype==7)) {
+model.sim=list("relational_op_ui16",4);
+} else if ((Datatype==8)) {
+model.sim=list("relational_op_ui8",4);
+} else {
+message("Datatype is not supported");
+ok=None;
+}
+if (ok) {
+it=Datatype*ones(1,2);
+ot=Datatype;
+in1=[-1,-2,-1,-2];
+out=[-1,-2];
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),[],[]);
+}
+if (ok) {
+if (rule==0) {
+label="==";
+} else if (rule==1) {
+label="~=";
+} else if (rule==2) {
+label="&#60;";
+} else if (rule==3) {
+label="&#8804;";
+} else if (rule==4) {
+label="&#62;";
+} else if (rule==5) {
+label="&#8805;";
+}
+graphics.exprs=exprs;
+graphics.style=["fontSize=13;fontStyle=1;displayedLabel="+label];
+model.ipar=[rule];
+model.nzcross=zcr;
+model.nmode=zcr;
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+RELATIONALOP.prototype.define = function RELATIONALOP() {
+ipar=[2];
+label="&lt";
+model=scicos_model();
+model.sim=list("relationalop",4);
+model.in=[1,1];
+model.out=1;
+model.ipar=ipar;
+model.blocktype="c";
+model.dep_ut=[true,None];
+exprs=[string(ipar),string(0)];
+gr_i=[];
+x=standard_define([2,2],model,exprs,gr_i);
+x.graphics.style=["fontSize=13;fontStyle=1;displayedLabel="+label];
+}
+RELATIONALOP.prototype.details = function RELATIONALOP() {
+}
+}
diff --git a/js/Sources/GENSQR_f.js b/js/Sources/GENSQR_f.js
index db97a300..f8f70525 100644
--- a/js/Sources/GENSQR_f.js
+++ b/js/Sources/GENSQR_f.js
@@ -11,8 +11,7 @@ if (size(exprs,"*")==2) {
exprs=exprs(2);
}
while (true) {
-[ok,Amplitude,exprs]=scicos_getvalue([
- "Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs);
+[ok,Amplitude,exprs]=scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs);
if (!ok) {
break
}
diff --git a/sci2jsyacc.py b/sci2jsyacc.py
index 7eca9a39..2e6ee4c5 100755
--- a/sci2jsyacc.py
+++ b/sci2jsyacc.py
@@ -276,12 +276,13 @@ def p_ltermarraylist_var(p):
def p_termarraylist_termarraylist_semicolon_expression(p):
'''termarraylist : termarraylist SEMICOLON expression
| termarraylist COMMA expression
- | termarraylist SPACE expression
- | expression SEMICOLON expression
- | expression COMMA expression
- | expression SPACE expression'''
+ | termarraylist SPACE expression'''
p[0] = str(p[1]) + ',' + str(p[3])
+def p_termarraylist_expression(p):
+ 'termarraylist : expression'
+ p[0] = str(p[1])
+
# end define termarraylist
# define list
@@ -310,14 +311,6 @@ def p_expression_termarraylist(p):
| OPENSQBRACKET termarraylist SPACE CLOSESQBRACKET'''
p[0] = '[' + str(p[2]) + ']'
-def p_expression_sqbracket_addition_term_sqbracket(p):
- 'expression : OPENSQBRACKET ADDITION term CLOSESQBRACKET'
- p[0] = str(p[1]) + str(p[2]) + str(p[3]) + str(p[4])
-
-def p_expression_sqbracket_term_sqbracket(p):
- 'expression : OPENSQBRACKET term CLOSESQBRACKET'
- p[0] = str(p[1]) + str(p[2]) + str(p[3])
-
# []
def p_expression_empty(p):
'expression : OPENSQBRACKET CLOSESQBRACKET'
@@ -358,7 +351,7 @@ def p_expression_expression_logical_expression(p):
p[0] = str(p[1]) + o + str(p[3])
def p_expression_addition_term(p):
- 'expression : ADDITION term %prec UNARYADDITION'
+ 'expression : ADDITION expression %prec UNARYADDITION'
p[0] = str(p[1]) + str(p[2])
def p_expression_not_expression(p):