aboutsummaryrefslogtreecommitdiffgithub
diff options
context:
space:
mode:
authorAustin Adams <git@austinjadams.com>2020-06-03 21:39:00 -0700
committerAustin Adams <git@austinjadams.com>2020-06-03 21:39:00 -0700
commit6493957f568b7a18898080e41d11ffb524fb8758 (patch)
treea1e9aad7c4de88660194fb199a05a83c2f0254ba
parent77bdb81abf9106568e2ce3ea9f1bb0d54bb935ef (diff)
downloadnovice-6493957f568b7a18898080e41d11ffb524fb8758.tar.gz
novice-6493957f568b7a18898080e41d11ffb524fb8758.tar.xz
Satisfy linter
-rw-r--r--packages/novice-cli/novice-cli/cli-debugger.ts2
-rw-r--r--packages/novice-web/novice-web/components/GuiDebugger.tsx88
-rw-r--r--packages/novice-web/novice-web/workers/assembler/assembler-worker.ts4
-rw-r--r--packages/novice-web/novice-web/workers/assembler/proto.ts2
-rw-r--r--packages/novice-web/novice-web/workers/debugger/debugger-worker.ts2
-rw-r--r--packages/novice/novice/index.ts4
6 files changed, 52 insertions, 50 deletions
diff --git a/packages/novice-cli/novice-cli/cli-debugger.ts b/packages/novice-cli/novice-cli/cli-debugger.ts
index a663b0c..c54c377 100644
--- a/packages/novice-cli/novice-cli/cli-debugger.ts
+++ b/packages/novice-cli/novice-cli/cli-debugger.ts
@@ -1,4 +1,4 @@
-import { Debugger, forceUnsigned, IO, Isa, maxUnsignedVal, padStr, fmtHex } from 'novice';
+import { Debugger, fmtHex, forceUnsigned, IO, Isa, maxUnsignedVal, padStr } from 'novice';
import * as readline from 'readline';
import { Readable, Writable } from 'stream';
diff --git a/packages/novice-web/novice-web/components/GuiDebugger.tsx b/packages/novice-web/novice-web/components/GuiDebugger.tsx
index 6d5ac28..baa62f2 100644
--- a/packages/novice-web/novice-web/components/GuiDebugger.tsx
+++ b/packages/novice-web/novice-web/components/GuiDebugger.tsx
@@ -1,5 +1,5 @@
-import { FullMachineState, getIsa, Isa, fmtBinOrHex, fmtHex, range, Symbols,
- BaseSymbols } from 'novice';
+import { BaseSymbols, fmtBinOrHex, fmtHex, FullMachineState, getIsa, Isa, range,
+ Symbols } from 'novice';
import * as React from 'react';
import { VariableSizeGrid as Grid } from 'react-window';
import { AssemblerFrontendMessage, AssemblerWorkerMessage } from '../workers/assembler';
@@ -58,45 +58,6 @@ export class GuiDebugger extends React.Component<GuiDebuggerProps,
}
}
- private onError(err: ErrorEvent) {
- console.error(err);
- }
-
- private onDebuggerMessage(msg: DebuggerWorkerMessage) {
- switch (msg.kind) {
- case 'updates':
- const [state, _] = this.isa.stateApplyUpdates(
- this.state.state, msg.updates);
- this.setState({ state });
- break;
-
- case 'putc':
- // TODO: actually display somehow
- console.log(String.fromCharCode(msg.c));
- break;
-
- default:
- const __: never = msg;
- }
- }
-
- private onAssemblerMessage(msg: AssemblerWorkerMessage) {
- switch (msg.kind) {
- case 'assembly-finished':
- const sections = msg.sections;
- this.postDebuggerMessage({ kind: 'load-sections', sections });
- break;
-
- case 'assembly-error':
- const errorMessage = msg.errorMessage;
- console.error('assembly error in frontend', errorMessage);
- break;
-
- default:
- const __: never = msg;
- }
- }
-
public render() {
const registers = this.isa.spec.regs.map(reg => {
let values;
@@ -106,7 +67,9 @@ export class GuiDebugger extends React.Component<GuiDebuggerProps,
reg.prefix + i + ': ' + fmtBinOrHex(this.state.state.regs.range[reg.prefix][i], reg.bits)
}</div>));
} else if (reg.kind === 'reg') {
- values = <div className='reg'>{reg.name + ': ' + fmtBinOrHex(this.state.state.regs.solo[reg.name], reg.bits)}</div>;
+ values = (<div className='reg'>
+ {reg.name + ': ' + fmtBinOrHex(this.state.state.regs.solo[reg.name], reg.bits)}
+ </div>);
} else {
const _: never = reg;
}
@@ -117,7 +80,7 @@ export class GuiDebugger extends React.Component<GuiDebuggerProps,
const rowHeight = 20;
const cols = [20, 80, 80, 80, 200];
const colVal: ((addr: number) => string)[] = [
- addr => (this.state.state.pc === addr)? '►' : '',
+ addr => (this.state.state.pc === addr) ? '►' : '',
addr => this.fmtAddr(addr),
addr => this.fmtWord(this.isa.stateLoad(this.state.state, addr)),
addr => this.isa.stateLoad(this.state.state, addr).toString(10),
@@ -156,6 +119,45 @@ export class GuiDebugger extends React.Component<GuiDebuggerProps,
);
}
+ private onError(err: ErrorEvent) {
+ console.error(err);
+ }
+
+ private onDebuggerMessage(msg: DebuggerWorkerMessage) {
+ switch (msg.kind) {
+ case 'updates':
+ const [state, _] = this.isa.stateApplyUpdates(
+ this.state.state, msg.updates);
+ this.setState({ state });
+ break;
+
+ case 'putc':
+ // TODO: actually display somehow
+ console.log(String.fromCharCode(msg.c));
+ break;
+
+ default:
+ const __: never = msg;
+ }
+ }
+
+ private onAssemblerMessage(msg: AssemblerWorkerMessage) {
+ switch (msg.kind) {
+ case 'assembly-finished':
+ const sections = msg.sections;
+ this.postDebuggerMessage({ kind: 'load-sections', sections });
+ break;
+
+ case 'assembly-error':
+ const errorMessage = msg.errorMessage;
+ console.error('assembly error in frontend', errorMessage);
+ break;
+
+ default:
+ const __: never = msg;
+ }
+ }
+
private loadWorkerBundle<WorkerMessageType>(workerBundleUrl: string,
onMessage: (msg: WorkerMessageType) => void): Worker {
const worker = new Worker(workerBundleUrl);
diff --git a/packages/novice-web/novice-web/workers/assembler/assembler-worker.ts b/packages/novice-web/novice-web/workers/assembler/assembler-worker.ts
index 56d08aa..fa3ef8e 100644
--- a/packages/novice-web/novice-web/workers/assembler/assembler-worker.ts
+++ b/packages/novice-web/novice-web/workers/assembler/assembler-worker.ts
@@ -1,6 +1,6 @@
-import { getConfig, Assembler, SymbTable, MachineCodeSection } from 'novice';
-import { AssemblerFrontendMessage, AssemblerWorkerMessage } from './proto';
+import { Assembler, getConfig, MachineCodeSection, SymbTable } from 'novice';
import { BaseWorker } from '../base-worker';
+import { AssemblerFrontendMessage, AssemblerWorkerMessage } from './proto';
class AssemblerWorker extends BaseWorker<AssemblerFrontendMessage,
AssemblerWorkerMessage> {
diff --git a/packages/novice-web/novice-web/workers/assembler/proto.ts b/packages/novice-web/novice-web/workers/assembler/proto.ts
index 7ff3620..979c867 100644
--- a/packages/novice-web/novice-web/workers/assembler/proto.ts
+++ b/packages/novice-web/novice-web/workers/assembler/proto.ts
@@ -1,4 +1,4 @@
-import { SymbTable, MachineCodeSection } from 'novice';
+import { MachineCodeSection, SymbTable } from 'novice';
// Messages originating from frontend
diff --git a/packages/novice-web/novice-web/workers/debugger/debugger-worker.ts b/packages/novice-web/novice-web/workers/debugger/debugger-worker.ts
index 5adfb1b..90934cb 100644
--- a/packages/novice-web/novice-web/workers/debugger/debugger-worker.ts
+++ b/packages/novice-web/novice-web/workers/debugger/debugger-worker.ts
@@ -1,7 +1,7 @@
import { Debugger, getIsa, IO, MachineStateUpdate } from 'novice';
+import { BaseWorker } from '../base-worker';
import { DebuggerFrontendMessage, DebuggerWorkerMessage } from './proto';
import { SnitchDebugger } from './snitch-debugger';
-import { BaseWorker } from '../base-worker';
class DebuggerWorker extends BaseWorker<DebuggerFrontendMessage,
DebuggerWorkerMessage> {
diff --git a/packages/novice/novice/index.ts b/packages/novice/novice/index.ts
index ed4301b..ebf68e5 100644
--- a/packages/novice/novice/index.ts
+++ b/packages/novice/novice/index.ts
@@ -7,8 +7,8 @@ import { AliasContext, AliasFields, AliasSpec, Assembly, BaseSymbols, Fields,
RegIdentifier, RegisterOperand, Section, StringOperand,
Symbols, SymbTable } from './isa';
import { Debugger, Memory, Simulator } from './simulator';
-import { forceUnsigned, maskTo, maxUnsignedVal, padStr, range, sextTo,
- fmtBin, fmtBinOrHex, fmtHex } from './util';
+import { fmtBin, fmtBinOrHex, fmtHex, forceUnsigned, maskTo, maxUnsignedVal,
+ padStr, range, sextTo } from './util';
export { //// assembler
Assembler, AssemblerConfig, getParser, getGenerator, getOpSpec,