summaryrefslogtreecommitdiff
path: root/js/Misc/LOGICAL_OP.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/Misc/LOGICAL_OP.js')
-rw-r--r--js/Misc/LOGICAL_OP.js54
1 files changed, 30 insertions, 24 deletions
diff --git a/js/Misc/LOGICAL_OP.js b/js/Misc/LOGICAL_OP.js
index 73feb47a..83de46aa 100644
--- a/js/Misc/LOGICAL_OP.js
+++ b/js/Misc/LOGICAL_OP.js
@@ -1,8 +1,8 @@
/* autogenerated from "macros/Misc/LOGICAL_OP.sci" */
function LOGICAL_OP() {
LOGICAL_OP.prototype.define = function LOGICAL_OP() {
- in1 = [[-1],[-1]];
- ipar = [0];
+ var in1 = [[-1],[-1]];
+ var ipar = [0];
this.nin = 2;
this.model = scicos_model();
this.model.sim = list(new ScilabString(["logicalop"]), new ScilabDouble([4]));
@@ -11,8 +11,8 @@ function LOGICAL_OP() {
this.model.ipar = ipar;
this.model.blocktype = new ScilabString(["c"]);
this.model.dep_ut = [true,false];
- exprs = [[string(this.nin)],[string(ipar)]];
- gr_i = [];
+ var exprs = [[string(this.nin)],[string(ipar)]];
+ var gr_i = [];
this.x = standard_define([2,2],this.model,exprs,gr_i);
return new BasicBlock(this.x);
}
@@ -34,11 +34,11 @@ function LOGICAL_OP() {
this.Datatype = arguments[0]["Datatype"]
this.tp = parseFloat(arguments[0]["tp"])
this.x = arg1;
- graphics = arg1.graphics;
- exprs = graphics.exprs;
+ var graphics = arg1.graphics;
+ var exprs = graphics.exprs;
this.model = arg1.model;
if (size(exprs,1)==2) {
- exprs = [[exprs],[sci2exp(1)],[sci2exp(0)]];
+ var exprs = [[exprs],[sci2exp(1)],[sci2exp(0)]];
}
while (true) {
[ok,this.nin,this.rule,this.Datatype,this.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);
@@ -50,16 +50,16 @@ function LOGICAL_OP() {
this.tp = int(this.tp);
if (this.nin<1) {
message("Number of inputs must be >=1 ");
- ok = false;
+ var ok = false;
} else if ((this.rule<0)||(this.rule>5)) {
message("Incorrect operator "+string(this.rule)+" ; must be 0 to 5.");
- ok = false;
+ var ok = false;
} else if ((this.rule==5)&&(this.nin>1)) {
message("Only one input allowed for NOT operation");
this.nin = 1;
} else if (((this.Datatype==1)&&(this.tp!=0))) {
message("Bitwise Rule is only activated when Data type is integer");
- ok = false;
+ var ok = false;
}
if (ok) {
if ((this.tp!=0)) {
@@ -83,35 +83,41 @@ function LOGICAL_OP() {
this.model.sim = list(new ScilabString(["logicalop_ui8"]), new ScilabDouble([4]));
} else {
message("Datatype is not supported");
- ok = false;
+ var ok = false;
}
this.model.ipar = new ScilabDouble([this.rule],[this.tp]);
}
if (ok) {
- it = this.Datatype*ones(this.nin,1);
- ot = this.Datatype;
- in1 = [-ones(this.nin,1),-2*ones(this.nin,1)];
+ var it = this.Datatype*ones(this.nin,1);
+ var ot = this.Datatype;
+ var in1 = [-ones(this.nin,1),-2*ones(this.nin,1)];
if ((this.rule!=5)&&(this.nin==1)) {
- out = [1,1];
- [this.model,graphics,ok] = set_io(this.model,graphics,list(in1,it),list(out,ot),[],[]);
+ var out = [1,1];
+ var tmpvar0 = set_io(this.model,graphics,list(in1,it),list(out,ot),[],[])
+ this.model = tmpvar0[0]
+ var graphics = tmpvar0[1]
+ var ok = tmpvar0[2];
} else {
- out = [-1,-2];
- [this.model,graphics,ok] = set_io(this.model,graphics,list(in1,it),list(out,ot),[],[]);
+ var out = [-1,-2];
+ var tmpvar1 = set_io(this.model,graphics,list(in1,it),list(out,ot),[],[])
+ this.model = tmpvar1[0]
+ var graphics = tmpvar1[1]
+ var ok = tmpvar1[2];
}
}
if (ok) {
if (this.rule==0) {
- label = "AND";
+ var label = "AND";
} else if (this.rule==1) {
- label = "OR";
+ var label = "OR";
} else if (this.rule==2) {
- label = "NAND";
+ var label = "NAND";
} else if (this.rule==3) {
- label = "NOR";
+ var label = "NOR";
} else if (this.rule==4) {
- label = "XOR";
+ var label = "XOR";
} else if (this.rule==5) {
- label = "NOT";
+ var label = "NOT";
}
graphics.exprs = exprs;
graphics.style = ["blockWithLabel;displayedLabel="+label];