removed script platform

This commit is contained in:
Steven Hugg 2020-08-02 20:05:25 -05:00
parent 5fcdde3244
commit 40af6b2602
2 changed files with 0 additions and 115 deletions

View File

@ -1,101 +0,0 @@
import { PLATFORMS } from "../common/emu";
import { Platform } from "../common/baseplatform";
// TODO: scripts run in global context
class NotebookItem {
obj: any;
el: JQuery<HTMLElement>;
wrap: JQuery<HTMLElement>;
setData(data: any) {
this.obj = data;
this.el = $("<div>");
this.el.text(JSON.stringify(data, null, ' '));
return true;
}
delete() {
this.wrap && this.wrap.remove();
this.wrap = null;
}
}
class Notebook {
top: HTMLElement;
items: {[id:string]:NotebookItem};
constructor(top: HTMLElement) {
this.items = {};
this.top = top;
$(top).css('overflowY', 'auto');
}
update(obj: any) {
var last = null;
var unused = new Set<string>(Object.keys(this.items));
for (var entry of Object.entries(obj)) {
var id = entry[0];
var data = entry[1];
var item = this.items[id];
//console.log(id,data,item);
if (!item) {
this.items[id] = item = new NotebookItem();
}
if (item.setData(data)) {
if (!item.wrap) {
item.wrap = $('<div class="markdown">');
$(this.top).append(item.wrap);
}
item.wrap.empty().append(item.el);
}
unused.delete(id);
}
unused.forEach((id) => { this.items[id].delete(); });
}
}
class ScriptPlatform implements Platform {
mainElement;
htmlDiv;
notebook: Notebook;
constructor(mainElement:HTMLElement) {
this.mainElement = mainElement;
this.notebook = new Notebook(mainElement);
}
start() {
}
reset() {
}
pause() {
}
resume() {
}
loadROM(title, data) {
this.notebook.update(data);
}
isRunning() {
return false;
}
isDebugging() : boolean {
return false;
}
getToolForFilename(fn : string) : string {
return "js";
}
getDefaultExtension() : string {
return ".js";
}
getPresets() {
return [
{id:'hello.js', name:'Hello'},
];
}
/*
showHelp() {
window.open("https://github.com/showdownjs/showdown/wiki/Showdown's-Script-syntax", "_help");
}
*/
}
PLATFORMS['script'] = ScriptPlatform;

View File

@ -1923,19 +1923,6 @@ function translateShowdown(step:BuildStep) {
};
}
function runJavascript(step:BuildStep) {
var code = getWorkFileAsString(step.path);
try {
//eval(code);
var fn = new Function("'use strict';\n" + code);
var obj = {};
var out = fn.call(obj);
return { output:out||obj };
} catch (e) {
return { errors:[{line:(e.lineNumber-2)|0, msg:e.message||"Error"}] };
}
}
// http://datapipe-blackbeltsystems.com/windows/flex/asm09.html
function assembleXASM6809(step:BuildStep) {
load("xasm6809");
@ -2678,7 +2665,6 @@ var TOOLS = {
'yasm': assembleYASM,
'bataribasic': compileBatariBasic,
'markdown': translateShowdown,
'js': runJavascript,
'inform6': compileInform6,
'merlin32': assembleMerlin32,
'fastbasic': compileFastBasic,