From 3630fd36d5963ec6e4299f52930db7c0d2cf2f01 Mon Sep 17 00:00:00 2001
From: Alasdair Armstrong
Date: Thu, 1 Feb 2018 15:27:18 +0000
Subject: Remove trace viewer application from repository
---
src/trace_viewer/.gitignore | 6 -
src/trace_viewer/List-add.svg | 56 --------
src/trace_viewer/List-remove.svg | 117 ----------------
src/trace_viewer/README | 11 --
src/trace_viewer/index.css | 86 ------------
src/trace_viewer/index.html | 19 ---
src/trace_viewer/index.ts | 287 ---------------------------------------
src/trace_viewer/main.ts | 12 --
src/trace_viewer/package.json | 15 --
src/trace_viewer/tsconfig.json | 18 ---
10 files changed, 627 deletions(-)
delete mode 100644 src/trace_viewer/.gitignore
delete mode 100644 src/trace_viewer/List-add.svg
delete mode 100644 src/trace_viewer/List-remove.svg
delete mode 100644 src/trace_viewer/README
delete mode 100644 src/trace_viewer/index.css
delete mode 100644 src/trace_viewer/index.html
delete mode 100644 src/trace_viewer/index.ts
delete mode 100644 src/trace_viewer/main.ts
delete mode 100644 src/trace_viewer/package.json
delete mode 100644 src/trace_viewer/tsconfig.json
diff --git a/src/trace_viewer/.gitignore b/src/trace_viewer/.gitignore
deleted file mode 100644
index c1f9aea6..00000000
--- a/src/trace_viewer/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-*~
-*.js
-*.js.map
-
-# Dependencies
-node_modules/
diff --git a/src/trace_viewer/List-add.svg b/src/trace_viewer/List-add.svg
deleted file mode 100644
index f8031599..00000000
--- a/src/trace_viewer/List-add.svg
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
diff --git a/src/trace_viewer/List-remove.svg b/src/trace_viewer/List-remove.svg
deleted file mode 100644
index 18c9a135..00000000
--- a/src/trace_viewer/List-remove.svg
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/src/trace_viewer/README b/src/trace_viewer/README
deleted file mode 100644
index 547a1435..00000000
--- a/src/trace_viewer/README
+++ /dev/null
@@ -1,11 +0,0 @@
-
-To use, first make sure node.js and npm are installed (e.g. via the
-Ubuntu package manager), then run the following in this directory:
-
-> npm install
-
-> npm run tsc
-
-> ./node_modules/.bin/electron .
-
-and point the file selector at a trace produced by sail -ocaml_trace
\ No newline at end of file
diff --git a/src/trace_viewer/index.css b/src/trace_viewer/index.css
deleted file mode 100644
index 35ebcb23..00000000
--- a/src/trace_viewer/index.css
+++ /dev/null
@@ -1,86 +0,0 @@
-
-body {
- background-color: #202020;
- color: #DCDCCC;
- font-family: monospace;
- font-size: 14pt;
- font-weight: bold;
-}
-
-img {
- height: 30px;
-}
-
-#control {
- position: fixed;
- bottom: 0px;
- left:10%;
- right:10%;
- width:80%;
-}
-
-#command {
- font-size: 16pt;
- width: 100%;
-}
-
-.call {
- background-color: #313131;
- border: 1px;
- border-left: 5px;
- border-color: rgb(118, 173, 160);
- border-style: solid;
- padding-top: 2px;
- padding-bottom: 2px;
- margin: 0px;
- min-height: 32px;
- display: flex;
- align-items: center;
-}
-
-.write {
- background-color: #313131;
- border: 1px;
- border-left: 5px;
- border-color: rgb(255, 40, 40);
- border-style: solid;
- padding-top: 2px;
- padding-bottom: 2px;
- margin: 0px;
- min-height: 32px;
- display: flex;
- align-items: center;
-}
-
-.load {
- background-color: #313131;
- color: white;
- border: 1px;
- border-left: 5px;
- border-color: #ff9100;
- border-style: solid;
- padding-top: 2px;
- padding-bottom: 2px;
- margin: 0px;
- min-height: 32px;
- display: flex;
- align-items: center;
-}
-
-.read {
- background-color: #313131;
- border: 1px;
- border-left: 5px;
- border-color: rgb(107, 199, 47);
- border-style: solid;
- padding-top: 2px;
- padding-bottom: 2px;
- margin: 0px;
- min-height: 32px;
- display: flex;
- align-items: center;
-}
-
-.tree {
- padding-left: 20px;
-}
\ No newline at end of file
diff --git a/src/trace_viewer/index.html b/src/trace_viewer/index.html
deleted file mode 100644
index 9efcca56..00000000
--- a/src/trace_viewer/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
- Sail Trace Viewer
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/trace_viewer/index.ts b/src/trace_viewer/index.ts
deleted file mode 100644
index f9b5041b..00000000
--- a/src/trace_viewer/index.ts
+++ /dev/null
@@ -1,287 +0,0 @@
-import {remote} from "electron"
-import fs = require("fs")
-const dialog = remote.dialog
-const app = remote.app
-
-let topCallDiv = document.createElement("div")
-
-const max_arg_length = 5000
-
-abstract class Event {
- caller: Call
-
- protected div: HTMLDivElement | null = null
-
- public hide(): void {
- if (this.div != null) {
- this.div.remove()
- this.div = null
- }
- }
-
- protected abstract showText(text: HTMLParagraphElement): void
-
- public show(): HTMLDivElement {
- let callerDiv: HTMLDivElement = (this.caller != null) ? this.caller.show() : topCallDiv
-
- if (this.div != null) {
- return this.div
- } else {
- this.div = document.createElement("div")
- this.div.className = "tree"
- callerDiv.appendChild(this.div)
- let text = document.createElement("p")
- this.showText(text)
- this.div.appendChild(text)
- return this.div
- }
- }
-}
-
-class Load extends Event {
- loc: string
- val: string
-
- constructor(loc: string, val: string) {
- super()
- this.loc = loc
- this.val = val
- }
-
- protected showText(text: HTMLParagraphElement): void {
- text.className = "load"
- text.insertAdjacentText('beforeend', this.loc + " " + this.val)
- }
-}
-
-class Read extends Event {
- reg: string
- value: string
-
- constructor(reg: string, value: string) {
- super()
- this.reg = reg
- this.value = value
- }
-
- public showText(text: HTMLParagraphElement): void {
- text.className = "read"
- text.insertAdjacentText('beforeend', this.reg + " " + this.value)
- }
-}
-
-class Write extends Event {
- reg: string
- value: string
-
- constructor(reg: string, value: string) {
- super()
- this.reg = reg
- this.value = value
- }
-
- public showText(text: HTMLParagraphElement): void {
- text.className = "write"
- text.insertAdjacentText('beforeend', this.reg + " " + this.value)
- }
-}
-
-class Call {
- fn: string
- arg: string
- ret: string
- callees: (Call | Event)[] = []
- caller: Call
-
- private div: HTMLDivElement | null = null
-
- private toggle: boolean = false
- private toggleImg: HTMLImageElement | null = null
-
- constructor(fn: string, arg: string, ret: string) {
- this.fn = fn
- this.arg = arg
- this.ret = ret
- }
-
- public expand() {
- if (this.caller != undefined) {
- this.caller.expand()
- }
- this.showChildren()
- }
-
- public iter(f: (call: Call) => void): void {
- f(this)
- this.callees.forEach((callee) => {
- if (callee instanceof Call) { callee.iter(f) }
- })
-
- }
-
- public show(): HTMLDivElement {
- let callerDiv: HTMLDivElement = (this.caller != null) ? this.caller.show() : topCallDiv
-
- if (this.div != null) {
- return this.div
- } else {
- this.div = document.createElement("div")
- this.div.className = "tree"
- callerDiv.appendChild(this.div)
- let text = document.createElement("p")
- text.className = "call"
- if (this.callees.length > 0) {
- this.toggleImg = document.createElement("img")
- this.toggleImg.src = "List-add.svg"
- this.toggleImg.addEventListener('click', () => {
- if (this.toggle) {
- this.hideChildren()
- } else {
- this.showChildren()
- }
- })
- text.appendChild(this.toggleImg)
- }
- this.toggle = false
- let display_arg = this.arg
- if (this.arg.length > max_arg_length) {
- display_arg = this.arg.slice(0, max_arg_length)
- }
- let display_ret = this.ret
- if (this.ret.length > max_arg_length) {
- display_ret = this.ret.slice(0, max_arg_length)
- }
-
- text.insertAdjacentText('beforeend', this.fn + " " + display_arg + " -> " + display_ret)
- this.div.appendChild(text)
- return this.div
- }
- }
-
- public hide(): void {
- if (this.toggle == true) {
- this.hideChildren()
- }
-
- if (this.div != null) {
- this.div.remove()
- this.div = null
- }
- if (this.toggleImg != null) {
- this.toggleImg.remove()
- this.toggleImg = null
- }
- }
-
- public hideChildren(): void {
- this.callees.forEach(call => {
- call.hide()
- })
-
- if (this.toggleImg != null) {
- this.toggleImg.src = "List-add.svg"
- this.toggle = false
- } else {
- alert("this.toggleImg was null!")
- }
- }
-
- public showChildren(): void {
- this.callees.forEach(call => {
- call.show()
- });
-
- if (this.toggleImg != null) {
- this.toggleImg.src = "List-remove.svg"
- this.toggle = true
- } else {
- alert("this.toggleImg was null!")
- }
- }
-
- public appendChild(child: Call | Write | Read | Load): void {
- child.caller = this
-
- this.callees.push(child)
- }
-}
-
-document.addEventListener('DOMContentLoaded', () => {
- let rootCall = new Call("ROOT", "", "")
- topCallDiv.id = "root"
- document.getElementById("container")!.appendChild(topCallDiv)
-
- let commandInput = document.getElementById("command") as HTMLInputElement
-
- commandInput.addEventListener("keydown", (event) => {
- if(event.keyCode == 13) {
- let cmd = commandInput.value.split(" ")
- commandInput.value = ""
-
- if (cmd[0] == "function") {
- rootCall.iter((call) => {
- if (call.fn == cmd[1]) { call.caller.expand() }
- })
- }
- }
- })
-
- let files = dialog.showOpenDialog(remote.getCurrentWindow(), {title: "Select log file", defaultPath: app.getAppPath()})
-
- if (files == [] || files == undefined) {
- dialog.showErrorBox("Error", "No file selected")
- app.exit(1)
- }
-
- fs.readFile(files[0], 'utf-8', (err, data) => {
- if (err) {
- dialog.showErrorBox("Error", "An error occurred when reading the log: " + err.message)
- app.exit(1)
- }
-
- let lines = data.split("\n")
- // let indents = lines.map(line => line.search(/[^\s]/) / 2)
- lines = lines.map(line => line.trim())
-
- let stack : Call[] = [rootCall]
-
- lines.forEach(line => {
- if (line.match(/^Call:/)) {
- let words = line.slice(6).split(" ")
- let call = new Call(words[0], words.slice(1).join(" "), "")
- if (stack.length > 0) {
- stack[stack.length - 1].appendChild(call)
- }
- stack.push(call)
- } else if (line.match(/^Return:/)) {
- let call = stack.pop()
- if (call == undefined) {
- alert("Unbalanced return")
- app.exit(1)
- } else {
- call.ret = line.slice(8)
- }
- } else if (line.match(/^Write:/)) {
- let words = line.slice(7).split(" ")
- let write = new Write(words[0], words.slice(1).join(" "))
- if (stack.length > 0) {
- stack[stack.length - 1].appendChild(write)
- }
- } else if (line.match(/^Read:/)) {
- let words = line.slice(6).split(" ")
- let read = new Read(words[0], words.slice(1).join(" "))
- if (stack.length > 0) {
- stack[stack.length - 1].appendChild(read)
- }
- } else if (line.match(/^Load:/)) {
- let words = line.slice(6).split(" ")
- let load = new Load(words[0], words[1])
- if (stack.length > 0) {
- stack[stack.length - 1].appendChild(load)
- }
- }
- })
-
- rootCall.show()
- })
-})
\ No newline at end of file
diff --git a/src/trace_viewer/main.ts b/src/trace_viewer/main.ts
deleted file mode 100644
index 5cc33452..00000000
--- a/src/trace_viewer/main.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import {app, BrowserWindow} from 'electron'
-
-let win : BrowserWindow | null = null
-
-app.on('ready', () => {
- win = new BrowserWindow({width: 1920, height: 1200})
- win.loadURL('file://' + __dirname + '/index.html')
- //win.webContents.openDevTools()
- win.on('close', () => {
- win = null
- })
-})
\ No newline at end of file
diff --git a/src/trace_viewer/package.json b/src/trace_viewer/package.json
deleted file mode 100644
index e3a88d30..00000000
--- a/src/trace_viewer/package.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "trace_viewer",
- "version": "1.0.0",
- "description": "",
- "main": "main.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1",
- "tsc": "./node_modules/typescript/bin/tsc"
- },
- "devDependencies": {
- "@types/node": "^8.0.46",
- "electron": "1.7.9",
- "typescript": "^2.5.3"
- }
-}
diff --git a/src/trace_viewer/tsconfig.json b/src/trace_viewer/tsconfig.json
deleted file mode 100644
index e66156b3..00000000
--- a/src/trace_viewer/tsconfig.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "compileOnSave": true,
- "compilerOptions": {
- "target": "es5",
- "moduleResolution": "node",
- "pretty": true,
- "newLine": "LF",
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "sourceMap": true,
- "strictNullChecks": true,
- "skipLibCheck": true,
- "allowJs": true,
- "jsx": "preserve"
- }
-}
\ No newline at end of file
--
cgit v1.2.3