summaryrefslogtreecommitdiff
path: root/js/IntegerOp/LOGIC.js
diff options
context:
space:
mode:
authorSunil Shetye2018-06-25 12:08:56 +0530
committerSunil Shetye2018-06-25 12:45:27 +0530
commit7c70459c10aed0d74ee03896abaf47fefdbf7c8f (patch)
tree6f6acc6a5087295c6e59f0f94bfda5025049d5fa /js/IntegerOp/LOGIC.js
parent870479a2e4b932426a904b2ebae7e4ee72037326 (diff)
downloadsci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.gz
sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.bz2
sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.zip
separate out code for getvalue
Diffstat (limited to 'js/IntegerOp/LOGIC.js')
-rw-r--r--js/IntegerOp/LOGIC.js90
1 files changed, 45 insertions, 45 deletions
diff --git a/js/IntegerOp/LOGIC.js b/js/IntegerOp/LOGIC.js
index 06861382..ae5dff86 100644
--- a/js/IntegerOp/LOGIC.js
+++ b/js/IntegerOp/LOGIC.js
@@ -1,64 +1,64 @@
/* autogenerated from "macros/IntegerOp/LOGIC.sci" */
function LOGIC() {
LOGIC.prototype.define = function LOGIC() {
-mat=[[0],[0],[0],[1]];
-model=scicos_model();
-model.sim=list("logic",4);
-model.in1=[[1],[1]];
-model.in2=[[1],[1]];
-model.out=1;
-model.out2=1;
-model.evtin=1;
-model.intyp=[5,5];
-model.outtyp=5;
-model.opar=list(int8(mat));
-model.blocktype="c";
-model.firing=false;
-model.dep_ut=[true,false];
-exprs=[[sci2exp(mat)],[sci2exp(0)]];
-gr_i=[];
-x=standard_define([2,2],model,exprs,gr_i);
+ mat = [[0],[0],[0],[1]];
+ model = scicos_model();
+ model.sim = list("logic",4);
+ model.in1 = [[1],[1]];
+ model.in2 = [[1],[1]];
+ model.out = 1;
+ model.out2 = 1;
+ model.evtin = 1;
+ model.intyp = [5,5];
+ model.outtyp = 5;
+ model.opar = list(int8(mat));
+ model.blocktype = "c";
+ model.firing = false;
+ model.dep_ut = [true,false];
+ exprs = [[sci2exp(mat)],[sci2exp(0)]];
+ gr_i = [];
+ x = standard_define([2,2],model,exprs,gr_i);
}
LOGIC.prototype.details = function LOGIC() {
}
LOGIC.prototype.get = function LOGIC() {
}
LOGIC.prototype.set = function LOGIC() {
-x=arg1;
-graphics=arg1.graphics;
-exprs=graphics.exprs;
-model=arg1.model;
-while (true) {
-[ok,mat,herit,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"LOGIC")],[" "],[gettext("Combinatorial logic")],[" "],[gettext("  Rows of the matrix are the output values")],[gettext("  Number of rows must be a power of two.")],[gettext("  Number of columns gives the number of outputs.")],[" "]],[[gettext("Truth Table (matrix of outputs)")],[gettext("Accepts Inherited Events (0:No, 1:Yes)")]],list("mat",[-1,-2],"vec",1),exprs);
-if (!ok) {
+ x = arg1;
+ graphics = arg1.graphics;
+ exprs = graphics.exprs;
+ model = arg1.model;
+ while (true) {
+ [ok,mat,herit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"LOGIC")],[" "],[gettext("Combinatorial logic")],[" "],[gettext("  Rows of the matrix are the output values")],[gettext("  Number of rows must be a power of two.")],[gettext("  Number of columns gives the number of outputs.")],[" "]],[[gettext("Truth Table (matrix of outputs)")],[gettext("Accepts Inherited Events (0:No, 1:Yes)")]],list("mat",[-1,-2],"vec",1),exprs);
+ if (!ok) {
break;
}
-nout=size(mat,2);
-nin=(log(size(mat,1))/log(2));
-u1=floor(nin);
-if ((u1!=nin)) {
+ nout = size(mat,2);
+ nin = (log(size(mat,1))/log(2));
+ u1 = floor(nin);
+ if ((u1!=nin)) {
block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %d."),gettext("Truth Table"),size(mat,1)),gettext("Number of rows must be a power of two."));
-ok=false;
-} else if ((find(mat.slice()!=0&&mat.slice()!=1)!=[])) {
+ ok = false;
+ } else if ((find(mat.slice()!=0&&mat.slice()!=1)!=[])) {
block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Truth Table")),msprintf(gettext("Elements must be in the interval %s."),"[0, 1]"));
-ok=false;
-} else if (herit<0||herit>1) {
+ ok = false;
+ } else if (herit<0||herit>1) {
block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Accepts Inherited Events"),herit),msprintf(gettext("Must be in the interval %s."),"[0, 1]"));
-ok=false;
+ ok = false;
}
-if (ok) {
-in1=[ones(nin,1),ones(nin,1)];
-out=[ones(nout,1),ones(nout,1)];
-it=5*ones(1,nin);
-ot=5*ones(1,nout);
-[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(1-herit,1),[]);
+ if (ok) {
+ in1 = [ones(nin,1),ones(nin,1)];
+ out = [ones(nout,1),ones(nout,1)];
+ it = 5*ones(1,nin);
+ ot = 5*ones(1,nout);
+ [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-herit,1),[]);
}
-if (ok) {
-graphics.exprs=exprs;
-mat=int8(mat);
-model.opar=list(mat);
-x.graphics=graphics;
-x.model=model;
+ if (ok) {
+ graphics.exprs = exprs;
+ mat = int8(mat);
+ model.opar = list(mat);
+ x.graphics = graphics;
+ x.model = model;
break;
}
}