-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from lisa-analyzer/support-dumping
Unconditionally dump support files
- Loading branch information
Showing
21 changed files
with
2,333 additions
and
162 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
lisa/lisa-analyses/imp-testcases/visualization/html-inputs/js/cytoscape-3.21.1.min.js
Large diffs are not rendered by default.
Oops, something went wrong.
238 changes: 238 additions & 0 deletions
238
.../lisa-analyses/imp-testcases/visualization/html-inputs/js/cytoscape-graphml-1.0.6-hier.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
'use strict'; | ||
|
||
|
||
function xmlToString(xmlData) { | ||
|
||
var xmlString; | ||
//IE | ||
if (window.ActiveXObject) { | ||
xmlString = xmlData.xml; | ||
} | ||
// code for Mozilla, Firefox, Opera, etc. | ||
else { | ||
xmlString = (new XMLSerializer()).serializeToString(xmlData); | ||
} | ||
return xmlString; | ||
} | ||
|
||
|
||
function getEleData(ele) { | ||
var type = ele.isNode() ? "node" : "edge"; | ||
var attrs = ["css", "data", "position"]; | ||
var result = {}; | ||
|
||
for (var i = 0; i < attrs.length; i++) { | ||
var attr = attrs[i]; | ||
var opt = options[type][attr]; | ||
if (!opt) | ||
result[attr] = {}; | ||
else if ($.isArray(opt)) { | ||
result[attr] = {}; | ||
for (var j = 0; j < opt.length; j++) { | ||
var el = opt[i]; | ||
if (ele[attr](el)) | ||
result[attr][el] = ele[attr](el); | ||
} | ||
} else { | ||
var eleAttr = ele[attr](); | ||
result[attr] = {}; | ||
for (var key in eleAttr) | ||
if ($.inArray(key, options[type].discludeds) < 0) { | ||
result[attr][key] = {value: eleAttr[key], attrType: attr}; | ||
} | ||
} | ||
} | ||
|
||
return $.extend(result.css, result.data, result.position); | ||
} | ||
|
||
|
||
function parseNode(ele, xml) { | ||
var node = $('<node />', xml).attr({id: ele.id()}).appendTo(xml); | ||
|
||
var eleData = getEleData(ele); debugger; | ||
for (var key in eleData) | ||
$('<data />', node).attr({type: eleData[key].attrType, key: key}).text(eleData[key].value).appendTo(node); | ||
|
||
|
||
if (ele.isParent()) { | ||
var subgraph = $('<graph />', node).attr({id: ele.id() + ':'}).appendTo(node); | ||
ele.children().each(function (i, child) { | ||
parseNode(child, subgraph); | ||
}); | ||
} | ||
|
||
return node; | ||
} | ||
|
||
/* | ||
options.node.discludeds.push("id"); | ||
options.edge.discludeds.push("id", "source", "target"); | ||
var xmlDoc = $.parseXML( | ||
'<?xml version="1.0" encoding="UTF-8"?>\n' + | ||
'<graphml xmlns="http://graphml.graphdrawing.org/xmlns"\n' + | ||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n' + | ||
'xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns\n' + | ||
'http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">\n' + | ||
' <graph>\n' + | ||
' </graph>\n' + | ||
' </graphml>\n' | ||
); | ||
var $xml = $(xmlDoc); | ||
var $graph = $xml.find("graph"); | ||
cy.nodes().orphans().forEach(function (ele) { | ||
parseNode(ele, $graph); | ||
}); | ||
cy.edges().forEach(function (ele) { | ||
var edge = $('<edge />', $graph).attr({id: ele.id(), source: ele.source().id(), target: ele.target().id()}).appendTo($graph); | ||
var eleData = getEleData(ele); | ||
for (var key in eleData) | ||
$('<data />', edge).attr({key: key}).text(eleData[key].value).appendTo(edge); | ||
}); | ||
return xmlToString(xmlDoc); | ||
*/ | ||
function renderNode(cy, $graph, parentNodeId) { | ||
$graph.children("node").each(function () { | ||
var $node = $(this); | ||
|
||
var settings = { | ||
data: {id: $node.attr("id"), name: $node.attr("name"), parent: parentNodeId}, | ||
css: {}, | ||
position: {} | ||
}; | ||
|
||
$node.children('data').each(function () { | ||
var $data = $(this); | ||
|
||
//settings[$data.attr("type")][$data.attr("key")] = $data.text(); | ||
settings.data[$data.attr("key")] = $data.text(); | ||
|
||
}); | ||
|
||
cy.add({ | ||
group: "nodes", | ||
data: settings.data, | ||
css: settings.css, | ||
position: settings.position | ||
}); | ||
|
||
$node.children("graph").each(function () { | ||
var $graph = $(this); | ||
|
||
renderNode(cy, $graph, $node.attr("id")); | ||
}); | ||
}); | ||
} | ||
|
||
function loadXml(cy, pippo, options, xmlString) { | ||
|
||
cy.batch(function () { | ||
var xml = $.parseXML(xmlString); | ||
var $xml = $(xml); | ||
|
||
var $graphs = $xml.find("graph"); | ||
|
||
// $graphs.each(function () { | ||
// var $graph = $(this); | ||
var $graph = $graphs.first(); | ||
|
||
renderNode(cy, $graph, undefined); | ||
|
||
$graph.children("edge").each(function () { | ||
var $edge = $(this); | ||
|
||
var settings = { | ||
data: {id: $edge.attr("id"), source: $edge.attr("source"), target: $edge.attr("target")}, | ||
css: {}, | ||
position: {} | ||
}; | ||
|
||
$edge.children('data').each(function () { | ||
var $data = $(this); | ||
|
||
//settings[$data.attr("type")][$data.attr("key")] = $data.text(); | ||
settings.data[$data.attr("key")] = $data.text(); | ||
}); | ||
|
||
cy.add({ | ||
group: "edges", | ||
data: settings.data, | ||
css: settings.css | ||
}); | ||
}); | ||
|
||
// }); | ||
runLayout(cy, options); | ||
}); | ||
} | ||
|
||
function runLayout(cy, options) { | ||
switch (typeof options.layoutBy) { | ||
case 'string': | ||
cy.layout({name: options.layoutBy}).run(); | ||
break; | ||
case 'function': | ||
options.layoutBy(); | ||
} | ||
} | ||
|
||
// registers the extension on a cytoscape lib ref | ||
var register = function (cytoscape, $) { | ||
|
||
if (!cytoscape || !$) { | ||
return; | ||
} // can't register if cytoscape unspecified | ||
|
||
var options = { | ||
node: { | ||
css: false, | ||
data: true, | ||
position: true, | ||
discludeds: [] | ||
}, | ||
edge: { | ||
css: false, | ||
data: true, | ||
discludeds: [] | ||
}, | ||
layoutBy: "cose" // string of layout name or layout function | ||
}; | ||
|
||
cytoscape('core', 'graphml', function (cyGraphML) { | ||
var cy = this; | ||
var res; | ||
|
||
switch (typeof cyGraphML) { | ||
case "string": // import | ||
res = loadXml(cy, $, options, cyGraphML); | ||
break; | ||
case "object": // set options | ||
$.extend(true, options, cyGraphML); | ||
res = cy; | ||
break; | ||
case "undefined": // export | ||
res = exporter(cy, $, options); | ||
break; | ||
default: | ||
console.log("Functionality(argument) of .graphml() is not recognized."); | ||
} | ||
|
||
return res; | ||
|
||
}); | ||
|
||
}; | ||
|
||
if( typeof cytoscape !== 'undefined' && typeof jQuery !== 'undefined' ){ // expose to global cytoscape (i.e. window.cytoscape) | ||
register( cytoscape, jQuery ); | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
lisa/lisa-analyses/imp-testcases/visualization/html-inputs/js/jquery-3.0.0.min.js
Large diffs are not rendered by default.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
lisa/lisa-analyses/imp-testcases/visualization/html-inputs/report.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"warnings" : [ ], | ||
"files" : [ "js/cytoscape-3.21.1.min.js", "js/cytoscape-graphml-1.0.6-hier.js", "js/jquery-3.0.0.min.js", "report.json", "untyped_A.A(A__this)_cfg.html", "untyped_A.A(A__this)_cfg.json", "untyped_A.getOne(A__this)_cfg.html", "untyped_A.getOne(A__this)_cfg.json", "untyped_A.getPositive(A__this,_untyped_i)_cfg.html", "untyped_A.getPositive(A__this,_untyped_i)_cfg.json", "untyped_A.identity(A__this,_untyped_i)_cfg.html", "untyped_A.identity(A__this,_untyped_i)_cfg.json", "untyped_tests.helper(tests__this,_untyped_i,_untyped_dispatcher)_cfg.html", "untyped_tests.helper(tests__this,_untyped_i,_untyped_dispatcher)_cfg.json", "untyped_tests.main(tests__this)_cfg.html", "untyped_tests.main(tests__this)_cfg.json" ], | ||
"info" : { | ||
"cfgs" : "6", | ||
"duration" : "408ms", | ||
"end" : "2023-12-12T17:03:45.989+01:00", | ||
"expressions" : "49", | ||
"files" : "15", | ||
"globals" : "0", | ||
"members" : "6", | ||
"programs" : "1", | ||
"start" : "2023-12-12T17:03:45.581+01:00", | ||
"statements" : "21", | ||
"units" : "2", | ||
"version" : "0.1b8", | ||
"warnings" : "0" | ||
}, | ||
"configuration" : { | ||
"analysisGraphs" : "HTML", | ||
"descendingPhaseType" : "NONE", | ||
"dumpForcesUnwinding" : "false", | ||
"fixpointWorkingSet" : "DuplicateFreeFIFOWorkingSet", | ||
"glbThreshold" : "5", | ||
"hotspots" : "unset", | ||
"jsonOutput" : "true", | ||
"openCallPolicy" : "WorstCasePolicy", | ||
"optimize" : "false", | ||
"recursionWideningThreshold" : "5", | ||
"semanticChecks" : "", | ||
"serializeInputs" : "true", | ||
"serializeResults" : "false", | ||
"syntacticChecks" : "", | ||
"useWideningPoints" : "true", | ||
"wideningThreshold" : "5", | ||
"workdir" : "test-outputs/visualization/html-inputs" | ||
} | ||
} |
Oops, something went wrong.