summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChhavi22082016-06-21 15:04:29 +0530
committerChhavi22082016-06-21 15:04:29 +0530
commit4b09974b901deb7b29f479eb512813f3712ea8d4 (patch)
tree365d831ed13319f9a6b2c55e931a85f560a6f928
parent7f3a9f3fc199f2eb4fb7344c552ffc9d0bec79bb (diff)
downloadxcos-on-web-4b09974b901deb7b29f479eb512813f3712ea8d4.tar.gz
xcos-on-web-4b09974b901deb7b29f479eb512813f3712ea8d4.tar.bz2
xcos-on-web-4b09974b901deb7b29f479eb512813f3712ea8d4.zip
Created new instance tag
-rw-r--r--details.js15
-rw-r--r--finalmodsheet.xsl7
-rw-r--r--index.html16
3 files changed, 26 insertions, 12 deletions
diff --git a/details.js b/details.js
index 6c5e8f8..fee4e32 100644
--- a/details.js
+++ b/details.js
@@ -310,6 +310,15 @@ function modelica() {
return mo;
}
+// To add Block name under the instance tag in xml.
+function instance() {
+ this.instance = arguments[0];
+}
+
+function createInstanceTag() {
+ return new instance(arguments[0]);
+}
+
function CONST_m() {
CONST_m.prototype.get = function() {
@@ -319,9 +328,9 @@ function CONST_m() {
return options;
}
CONST_m.prototype.set = function() {
- this.c = [arguments[1]["vec"]];
- this.x.realParameters = new ScilabDouble();
- this.x.exprs = new ScilabString([sci2exp(this.c)]);
+ this.c = [arguments[0]["vec"]];
+ this.x.model.rpar = new ScilabDouble();
+ this.x.graphics.exprs = new ScilabString([sci2exp(this.c)]);
return new BasicBlock(this.x);
}
CONST_m.prototype.define = function() {
diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl
index 56e95b3..8d935dc 100644
--- a/finalmodsheet.xsl
+++ b/finalmodsheet.xsl
@@ -8,6 +8,7 @@ Authors: Maverick & Karma
NOTES:
Look for TAG:Break1!!!
TAG:Break2!!!
+ TAG:Break3!!!
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" />
@@ -151,6 +152,8 @@ Look for TAG:Break1!!!
</xsl:otherwise>
</xsl:choose>
</xsl:when>
+
+
<xsl:when test="@name">
<xsl:choose>
<xsl:when test="@name='ExplicitLink'">
@@ -2191,4 +2194,6 @@ Look for TAG:Break1!!!
<xsl:apply-templates />
</xsl:element>
</xsl:template>
-</xsl:stylesheet> \ No newline at end of file
+ <!-- To remove the instance variable in generated Xcos-->
+ <xsl:template match="mxCell/instance"/>
+</xsl:stylesheet>
diff --git a/index.html b/index.html
index c2ac40f..2e42120 100644
--- a/index.html
+++ b/index.html
@@ -355,7 +355,7 @@
var text = null;
if (cell.isVertex() == true && cell.isConnectable() == false) {
var name = cell.value.getAttribute('blockElementName');
- var cellvar = cell.inst.details();
+ var cellvar = cell.blockInstance.instance.details();
// If cell is a block or port
if (cell.source == null && cell.target == null) {
@@ -925,7 +925,7 @@
function showPropertiesWindow(graph, cell) {
var name = cell.getAttribute('blockElementName');
- var defaultProperties = cell.inst.get(); //window[name]("get");
+ var defaultProperties = cell.blockInstance.instance.get(); //window[name]("get");
/*{
nbr_curves: ["Number of curves", 1],
clrs: ["color (>0) or mark (<0)", [1, 2, 3, 4, 5, 6, 7, 13]],
@@ -1009,7 +1009,7 @@
propertiesObject[key] = document.getElementById(key.toString()).value;
}
}
- var details = cell.inst.set(cell.value, propertiesObject); //window[name]("set",cell.value,propertiesObject);
+ var details = cell.blockInstance.instance.set(propertiesObject); //window[name]("set",cell.value,propertiesObject);
var enc = new mxCodec();
var node = enc.encode(details);
node.setAttribute('label', getData(details.exprs)[0]);
@@ -1631,6 +1631,8 @@
var i, arr = [];
var Model = details_instance.x.model;
var graphics = details_instance.x.graphics;
+
+ /* To determine number and type of Port*/
var inputPorts = [],
outputPorts = [],
controlPorts = [],
@@ -1666,7 +1668,8 @@
}
}
v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, name);
- v1.inst = details_instance;
+ // Additional attribute to store the block's instance
+ v1.blockInstance = createInstanceTag(details_instance);
createPorts(graph, v1, inputPorts, controlPorts, outputPorts, commandPorts);
/*if (name == 'ANDBLK') {
var a = new ANDBLK();
@@ -1694,10 +1697,8 @@
} else if (name == 'CONST_m') {
var a = new CONST_m();
var details = a.define();
- console.log(a);
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
- console.log(node);
node.setAttribute('label',"1");
var temp = enc.encode(parent);
node.setAttribute('parent', temp.getAttribute('id'));
@@ -1827,7 +1828,6 @@
} else if (name == 'CFSCOPE') {
var a = new CFSCOPE();
var details = a.define();
- console.log(a);
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
node.setAttribute('label',label);
@@ -1841,7 +1841,6 @@
else if (name == 'CLOCK_c') {
var a = new CLOCK_c();
var details = a.define();
- console.log(a);
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
node.setAttribute('label',label);
@@ -2561,4 +2560,5 @@
});
});
</script>
+
</html>