diff options
author | Adhitya Kamakshidasan | 2016-07-11 19:42:27 +0530 |
---|---|---|
committer | GitHub | 2016-07-11 19:42:27 +0530 |
commit | f1a66d584eafe7882f90998f18d31669fc668026 (patch) | |
tree | e27fbe02cb75748e0699bdbb10d71721ba440266 | |
parent | 41f8bd25b33eedd0b255cbc5449bab16cf3c957f (diff) | |
parent | 7cc3439659f36f12e9f2d236a941b1eeea94dc40 (diff) | |
download | xcos-on-web-f1a66d584eafe7882f90998f18d31669fc668026.tar.gz xcos-on-web-f1a66d584eafe7882f90998f18d31669fc668026.tar.bz2 xcos-on-web-f1a66d584eafe7882f90998f18d31669fc668026.zip |
Merge pull request #163 from ASP1234/master
Implement Blocks and dependency fn
-rw-r--r-- | data_structures_correct/SWITCH_f.js | 27 | ||||
-rw-r--r-- | data_structures_correct/TANBLK_f.js | 23 | ||||
-rw-r--r-- | data_structures_correct/TCLSS.js | 34 | ||||
-rw-r--r-- | data_structures_correct/TEXT_f.js | 25 | ||||
-rw-r--r-- | data_structures_correct/TIME_DELAY.js | 28 | ||||
-rw-r--r-- | data_structures_correct/TIME_f.js | 18 | ||||
-rw-r--r-- | data_structures_correct/TKSCALE.js | 26 | ||||
-rw-r--r-- | dependencies.js | 78 | ||||
-rw-r--r-- | finalmodsheet.xsl | 8 |
9 files changed, 263 insertions, 4 deletions
diff --git a/data_structures_correct/SWITCH_f.js b/data_structures_correct/SWITCH_f.js new file mode 100644 index 0000000..ec4e1d7 --- /dev/null +++ b/data_structures_correct/SWITCH_f.js @@ -0,0 +1,27 @@ +function SWITCH_f() { + + SWITCH_f.prototype.define = function SWITCH_f() { + this.i0 = 0; + this.in1 = [[-1], [-1]]; + this.nin = 2; + + var model = scicos_model(); + model.sim = list(new ScilabString(["switchn"]), new ScilabDouble([2])); + model.in = new ScilabDouble(...this.in1); + model.out = new ScilabDouble([-1]); + model.ipar = new ScilabDouble([this.i0]); + model.blocktype = new ScilabString(["c"]); + model.firing = new ScilabDouble(); + model.dep_ut = new ScilabBoolean([true, true]); + + var exprs = new ScilabString([this.nin], [this.i0 + 1]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"SWITCH_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + SWITCH_f.prototype.details = function SWITCH_f() { + return this.x; + } +} diff --git a/data_structures_correct/TANBLK_f.js b/data_structures_correct/TANBLK_f.js new file mode 100644 index 0000000..d468e84 --- /dev/null +++ b/data_structures_correct/TANBLK_f.js @@ -0,0 +1,23 @@ +function TANBLK_f() { + + TANBLK_f.prototype.define = function TANBLK_f() { + this.in1 = -1; + + var model = scicos_model(); + model.sim = new ScilabString(["tanblk"]); + model.in = new ScilabDouble([this.in1]); + model.out = new ScilabDouble([this.in1]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(in1)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TANBLK_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + TANBLK_f.prototype.details = function TANBLK_f() { + return this.x; + } +} diff --git a/data_structures_correct/TCLSS.js b/data_structures_correct/TCLSS.js new file mode 100644 index 0000000..e102d93 --- /dev/null +++ b/data_structures_correct/TCLSS.js @@ -0,0 +1,34 @@ +function TCLSS() { + + TCLSS.prototype.define = function TCLSS() { + this.x0 = 0; + this.A = 0; + this.B = 1; + this.C = 1; + this.D = 0; + this.in1 = 1; + this.nx = size(this.x0, "*"); + this.out = 1; + + var model = scicos_model(); + model.sim = list(new ScilabString(["tcslti4"]), new ScilabDouble([4])); + model.in = new ScilabDouble([this.in1], [this.nx]); + model.out = new ScilabDouble([this.out]); + model.evtin = new ScilabDouble([1]); + model.state = new ScilabDouble([this.x0]); + model.rpar = new ScilabDouble([this.A], [this.B], [this.C], [this.D]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([false, true]); + + var exprs = new ScilabString([sci2exp(this.A)], [sci2exp(this.B)], [sci2exp(this.C)], [sci2exp(this.D)], [sci2exp(this.x0)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TCLSS\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + + TCLSS.prototype.details = function TCLSS() { + return this.x; + } +} diff --git a/data_structures_correct/TEXT_f.js b/data_structures_correct/TEXT_f.js new file mode 100644 index 0000000..cb5a481 --- /dev/null +++ b/data_structures_correct/TEXT_f.js @@ -0,0 +1,25 @@ +function TEXT_f() { + + TEXT_f.prototype.define = function TEXT_f() { + this.font = 2; + this.siz = 1; + + var model = scicos_model(); + model.sim = new ScilabString(["text"]); + model.rpar = new ScilabString(["Text"]); + model.ipar = new ScilabDouble([this.font], [this.siz]); + + var exprs = ["Text", this.font, this.siz]; + + var graphics = scicos_graphics(); + graphics.orig = new ScilabDouble([0, 0]); + graphics.sz = new ScilabDouble([2, 1]); + graphics.exprs = new ScilabString(exprs); + this.x = mlist(["Text", "graphics", "model", "void", "gui"], new ScilabString(["Text", "graphics", "model", "void", "gui"]), graphics, model, new ScilabString([" "]), new ScilabString(["TEXT_f"])); + return new TextBlock(this.x); + } + + TEXT_f.prototype.details = function TEXT_f() { + return this.x; + } +} diff --git a/data_structures_correct/TIME_DELAY.js b/data_structures_correct/TIME_DELAY.js new file mode 100644 index 0000000..8438941 --- /dev/null +++ b/data_structures_correct/TIME_DELAY.js @@ -0,0 +1,28 @@ +function TIME_DELAY() { + + TIME_DELAY.prototype.define = function TIME_DELAY() { + this.nin = 1; + this.T = 1; + this.init = 0; + this.N = 1024; + + var model = scicos_model(); + model.sim = list(new ScilabString(["time_delay"]), new ScilabDouble([4])); + model.in = new ScilabDouble([this.nin]); + model.out = new ScilabDouble([this.nin]); + model.rpar = new ScilabDouble([this.T, this.init]); + model.ipar = new ScilabDouble([this.N]); + model.blocktype = new ScilabString(["x"]); + model.dep_ut = new ScilabBoolean([false, true]); + + var exprs = new ScilabString([this.T], [this.init], [this.N]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TIME_DELAY\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([3.5, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + TIME_DELAY.prototype.details = function TIME_DELAY() { + return this.x; + } +} diff --git a/data_structures_correct/TIME_f.js b/data_structures_correct/TIME_f.js new file mode 100644 index 0000000..a9c233c --- /dev/null +++ b/data_structures_correct/TIME_f.js @@ -0,0 +1,18 @@ +function TIME_f() { + + TIME_f.prototype.define = function TIME_f() { + var model = scicos_model(); + model.sim = new ScilabString(["timblk"]); + model.out = new ScilabDouble([1]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([false, true]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TIME_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, new ScilabDouble(), gr_i); + return new BasicBlock(this.x); + } + + TIME_f.prototype.details = function TIME_f() { + return this.x; + } +} diff --git a/data_structures_correct/TKSCALE.js b/data_structures_correct/TKSCALE.js new file mode 100644 index 0000000..532a923 --- /dev/null +++ b/data_structures_correct/TKSCALE.js @@ -0,0 +1,26 @@ +function TKSCALE() { + + TKSCALE.prototype.define = function TKSCALE() { + this.a = -10; + this.b = 10; + this.f = 1; + + var model = scicos_model(); + model.sim = list(new ScilabString(["tkscaleblk"]), new ScilabDouble([5])); + model.out = new ScilabDouble([1]); + model.evtin = new ScilabDouble([1]); + model.rpar = new ScilabDouble([this.a], [this.b], [this.f]); + model.blocktype = new ScilabString(["d"]); + model.dep_ut = new ScilabBoolean([false, false]); + + var exprs = new ScilabString([sci2exp(this.a)], [sci2exp(this.b)], [sci2exp(this.f)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TKSCALE\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + TKSCALE.prototype.details = function TKSCALE() { + return this.x; + } +} diff --git a/dependencies.js b/dependencies.js index e19c4ab..3907ea7 100644 --- a/dependencies.js +++ b/dependencies.js @@ -496,6 +496,84 @@ function GroundBlock() { } } +function TextBlock() { + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options["model"].blocktype)[0]; + this.connectable = options.connectable; // Not Known + this.id = options.id; + this.interfaceFunctionName = arguments.callee.caller.name; + this.ordering = options.ordering; + this.parent = options.parent; + if (options.model.sim instanceof Array) { + this.simulationFunctionName = getData(options["model"].sim[0])[0]; + var func_type; + switch (getData(options[model].sim[1])[0].toString()) { + case "-2.0": + func_type = "ESELECT"; + break; + case "-1.0": + func_type = "IFTHENELSE"; + break; + case "1.0": + func_type = "TYPE_1"; + break; + case "2.0": + func_type = "TYPE_2"; + break; + case "3.0": + func_type = "TYPE_3"; + break; + case "4.0": + func_type = "C_OR_FORTRAN"; + break; + case "5.0": + func_type = "SCILAB"; + break; + case "99.0": + func_type = "DEBUG"; + break; + case "1001.0": + func_type = "DYNAMIC_FORTRAN_1"; + break; + case "2001.0": + func_type = "DYNAMIC_C_1"; + break; + case "2004.0": + func_type = "DYNAMIC_EXPLICIT_4"; + break; + case "10001.0": + func_type = "OLDBLOCKS"; + break; + case "10004.0": + func_type = "IMPLICIT_C_OR_FORTRAN"; + break; + case "30004.0": + func_type = "MODELICA"; + break; + } + this.simulationFunctionType = func_type; + } else { + this.simulationFunctionName = getData(options["model"].sim)[0]; + this.simulationFunctionType = "DEFAULT"; + } + this.style = arguments.callee.caller.name; + this.value = options.value; // Not Known + this.vertex = options.vertex; // Not Known + this.visible = options.visible; // Not Known + this.exprs = options["graphics"].exprs; + this.realParameters = options["model"].rpar; + this.objectsParameters = options["model"].opar; + this.nbZerosCrossing = options["model"].nzcross; + this.nmode = options["model"].nmode; + this.oDState = list(); + this.equations = list(); // Not Known + this.blockName = "TextBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + function Product() { if (arguments.length > 0) { var options = arguments[0]; diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl index 4b67400..25ffff6 100644 --- a/finalmodsheet.xsl +++ b/finalmodsheet.xsl @@ -172,7 +172,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="Object" match="Object"> <xsl:element name="Array"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -200,7 +200,7 @@ Look for TAG:Break1!!! --> <xsl:template name="Array" match="Array"> <xsl:element name="Array"> - <xsl:if test="name(..)='BasicBlock' or @as='context' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation'"> + <xsl:if test="name(..)='BasicBlock' or @as='context' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -1581,7 +1581,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="ScilabDouble" match="ScilabDouble"> <xsl:element name="ScilabDouble"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -1613,7 +1613,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="ScilabString" match="ScilabString"> <xsl:element name="ScilabString"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> |