summaryrefslogtreecommitdiff
path: root/js/IntegerOp/EXTRACTBITS.js
diff options
context:
space:
mode:
authorSunil Shetye2018-07-11 13:05:13 +0530
committerSunil Shetye2018-07-11 15:21:08 +0530
commit079d0b4a3ec15a4d7d2644484d116df9d1c694bb (patch)
tree785ed59b5b238203a9e91f3e323da59d1083d86e /js/IntegerOp/EXTRACTBITS.js
parent0e9bc36f45fa1bb598c6ebb0febc1989439a8d98 (diff)
downloadsci2js-079d0b4a3ec15a4d7d2644484d116df9d1c694bb.tar.gz
sci2js-079d0b4a3ec15a4d7d2644484d116df9d1c694bb.tar.bz2
sci2js-079d0b4a3ec15a4d7d2644484d116df9d1c694bb.zip
fix assignment to list
Diffstat (limited to 'js/IntegerOp/EXTRACTBITS.js')
-rw-r--r--js/IntegerOp/EXTRACTBITS.js49
1 files changed, 26 insertions, 23 deletions
diff --git a/js/IntegerOp/EXTRACTBITS.js b/js/IntegerOp/EXTRACTBITS.js
index 65367a6f..5525a5f5 100644
--- a/js/IntegerOp/EXTRACTBITS.js
+++ b/js/IntegerOp/EXTRACTBITS.js
@@ -1,7 +1,7 @@
/* autogenerated from "macros/IntegerOp/EXTRACTBITS.sci" */
function EXTRACTBITS() {
EXTRACTBITS.prototype.define = function EXTRACTBITS() {
- numb = [];
+ var numb = [];
this.model = scicos_model();
this.model.sim = list(new ScilabString(["extract_bit_32_UH0"]), new ScilabDouble([4]));
this.model.in1 = new ScilabDouble([1]);
@@ -13,8 +13,8 @@ function EXTRACTBITS() {
this.model.ipar = [0,numb];
this.model.blocktype = new ScilabString(["c"]);
this.model.dep_ut = [true,false];
- exprs = [[sci2exp(3)],[sci2exp(1)],[sci2exp(0)],[sci2exp(0)]];
- gr_i = [];
+ var exprs = [[sci2exp(3)],[sci2exp(1)],[sci2exp(0)],[sci2exp(0)]];
+ var gr_i = [];
this.x = standard_define([4,2],this.model,exprs,gr_i);
return new BasicBlock(this.x);
}
@@ -36,52 +36,52 @@ function EXTRACTBITS() {
this.bit = parseFloat(arguments[0]["bit"])
this.scal = arguments[0]["scal"]
this.x = arg1;
- graphics = arg1.graphics;
- exprs = graphics.exprs;
+ var graphics = arg1.graphics;
+ var exprs = graphics.exprs;
this.model = arg1.model;
while (true) {
[ok,this.Datatype,this.rule,this.bit,this.scal,exprs] = scicos_getvalue([[msprintf("Set %s block parameters","EXTRACTBITS")],[" "],["Bits Extraction"],[" "],[" - Bits to Extract:"],["    1 Upper Half"],["    2 Lower Half"],["    3 Range from MSB"],["    4 Range to LSB"],["    5 Range of Bits"],[" - Number of Bits or Index of bit : Index 0 is LSB"],["    If \'Bits to Extract\' is set to \'Range of bits\': [Start, End]"],[" "]],[msprintf("Data Type %s","(3:int32, 4:int16, 5:int8, ...)"),"Bits to extract","Number of Bits or Index of Bit","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(this.bit.slice())," ");
+ var bitstr = strcat(string(this.bit.slice())," ");
if ((this.rule<1)||(this.rule>5)) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Bits to Extract",this.rule),msprintf("Must be in the interval %s.","[1, 5]"));
- ok = false;
+ var ok = false;
} else if (this.scal<0||this.scal>1) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Treat Bit Field as an Integer",this.scal),msprintf("Must be in the interval %s.","[0, 1]"));
- ok = false;
+ var ok = false;
} else {
- in1 = [this.model.in1,this.model.in2];
+ var in1 = [this.model.in1,this.model.in2];
this.bit = int(this.bit);
this.rule = int(this.rule);
if ((this.rule==3)||(this.rule==4)) {
if ((size(this.bit,"*")!=1)) {
block_parameter_error(msprintf("Wrong size for \'%s\' parameter: %s.","Number of Bits or Index of Bit",bitstr),"Must be a single value.");
- ok = false;
+ var ok = false;
} else {
- numb = this.bit;
+ var numb = this.bit;
}
} else if ((this.rule==5)) {
if ((size(this.bit,"*")!=2)) {
block_parameter_error(msprintf("Wrong size for \'%s\' parameter: %s.","Number of Bits or Index of Bit",bitstr),"Must have this form: [Start, End].");
- ok = false;
+ var ok = false;
} else if (this.bit[1-1]>this.bit[2-1]) {
block_parameter_error(msprintf("Wrong values for \'%s\' parameter: %s.","Number of Bits or Index of Bit",bitstr),msprintf("\'Start\' must be less than \'End\'."));
- ok = false;
+ var ok = false;
} else {
- numb = this.bit[2-1]-this.bit[1-1];
+ var numb = this.bit[2-1]-this.bit[1-1];
}
} else {
this.bit = 0;
- numb = [];
+ var numb = [];
}
}
if (ok) {
if ((this.Datatype==3||this.Datatype==6)) {
if (or(this.bit.slice()>31)||or(this.bit.slice()<0)) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %s.","Number of Bits or Index of Bit",bitstr),msprintf("Indexes must be in the interval %s.","[0, 31]"));
- ok = false;
+ var ok = false;
}
switch (this.rule) {
case 1:
@@ -128,7 +128,7 @@ function EXTRACTBITS() {
} else if ((this.Datatype==4||this.Datatype==7)) {
if (or(this.bit.slice()>15)||or(this.bit.slice()<0)) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %s.","Number of Bits or Index of Bit",bitstr),msprintf("Indexes must be in the interval %s.","[0, 15]"));
- ok = false;
+ var ok = false;
}
switch (this.rule) {
case 1:
@@ -175,7 +175,7 @@ function EXTRACTBITS() {
} else if ((this.Datatype==5||this.Datatype==8)) {
if (or(this.bit.slice()>7)||or(this.bit.slice()<0)) {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %s.","Number of Bits or Index of Bit",bitstr),msprintf("Indexes must be in the interval %s.","[0, 7]"));
- ok = false;
+ var ok = false;
}
switch (this.rule) {
case 1:
@@ -221,14 +221,17 @@ function EXTRACTBITS() {
}
} else {
block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Data Type",this.Datatype),msprintf("Must be in the interval %s.","[3, 8]"));
- ok = false;
+ var ok = false;
}
}
if (ok) {
- it = this.Datatype;
- ot = this.Datatype;
- out = [1,1];
- [this.model,graphics,ok] = set_io(this.model,graphics,list(in1,it),list(out,ot),[],[]);
+ var it = this.Datatype;
+ var ot = this.Datatype;
+ 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];
}
if (ok) {
graphics.exprs = exprs;