Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
53 lines (53 loc) · 2.55 KB
/
Copy pathindex.html
File metadata and controls
53 lines (53 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<title>CCGraph</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<a href="https://github.com/pslacerda/CobolCallGraph"><img src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
<section id=controls>
<button onclick="generateDot()">Generate dot graph</button>
<button onclick="generateD3()">Generate d3.js graph</button>
<section>
<div id=drawarea>
<p>
<h3>Click on button Load to choose your Cobol source file</h3>
</p>
</div>
<footer>
Project source: <a href="https://github.com/pslacerda/CobolCallGraph">GitHub</a>
</footer>
</body>
<script src=https://mdaines.github.io/viz.js/bower_components/viz.js/viz.js></script>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src=ccgraph.js></script>
<script src=d3.js></script>
<script src=file_read.js></script>
<script>
function generateDot() {
let drawarea = document.querySelector('#drawarea');
drawarea.innerHTML = "<h3>Loading...</h3>";
loadLocalFile(function(fullText) {
let tree = parseCallGraph(fullText, true, true, {});
var dot = generateDotFile(tree);
var result = Viz(dot, {format: 'svg'});
drawarea.innerHTML = result;
});
}
function generateD3() {
let drawarea = document.querySelector('#drawarea');
drawarea.innerHTML = "<h3>Loading...</h3>";
loadLocalFile(function(fullText) {
let tree = parseCallGraph(fullText, true, true, {});
var nodes = {};
// Compute the distinct nodes from the links.
tree.edges.forEach(function(link) {
link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
link.target = nodes[link.target] || (nodes[link.target] = {name: link.target});
});
drawarea.innerHTML = "";
d3Graph(nodes, tree.edges);
});
}
</script>
<html>