Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/workertypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface WorkerUnchangedResult {
export interface WorkerErrorResult {
errors: WorkerError[]
listings?: CodeListingMap
uppercaseOnly?: boolean
}

export interface WorkerOutputResult<T> {
Expand All @@ -147,6 +148,7 @@ export interface WorkerOutputResult<T> {
params?: {}
segments?: Segment[]
debuginfo?: {} // optional info
uppercaseOnly?: boolean
origin?: number
}

Expand Down
5 changes: 4 additions & 1 deletion src/ide/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Toolbar } from "./toolbar";
import { AssetEditorView } from "./views/asseteditor";
import { isMobileDevice } from "./views/baseviews";
import { AddressHeatMapView, BinaryFileView, MemoryMapView, MemoryView, ProbeLogView, ProbeSymbolView, RasterStackMapView, ScanlineIOView, VRAMMemoryView } from "./views/debugviews";
import { DisassemblerView, ListingView, PC_LINE_LOOKAHEAD, SourceEditor } from "./views/editors";
import { DisassemblerView, ListingView, PC_LINE_LOOKAHEAD, SourceEditor, setUppercaseOnly } from "./views/editors";
import { CallStackView, DebugBrowserView } from "./views/treeviews";
import { ProjectWindows } from "./windows";
import Split = require('split.js');
Expand Down Expand Up @@ -908,6 +908,9 @@ function showExceptionAsError(err, msg: string) {
}

async function setCompileOutput(data: WorkerResult) {
if ('uppercaseOnly' in data) {
setUppercaseOnly(data.uppercaseOnly);
}
// errors? mark them in editor
if ('errors' in data && data.errors.length > 0) {
toolbar.addClass("has-errors");
Expand Down
4 changes: 4 additions & 0 deletions src/ide/views/editors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export var textMapFunctions = {
input: null as ((text: string) => string) | null
};

export function setUppercaseOnly(uppercaseOnly: boolean) {
textMapFunctions.input = uppercaseOnly ? (s) => s.toUpperCase() : null;
}

export class SourceEditor implements ProjectView {
constructor(path: string, mode: string) {
this.path = path;
Expand Down
3 changes: 0 additions & 3 deletions src/platform/basic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import { Platform, BreakpointCallback, DebugCondition, DebugEvalCondition } from "../common/baseplatform";
import { PLATFORMS, AnimationTimer, EmuHalt } from "../common/emu";
import * as editors from "../ide/views/editors";
import { BASICRuntime } from "../common/basic/runtime";
import { BASICProgram } from "../common/basic/compiler";
import { TeleTypeWithKeyboard } from "../common/teletype";
Expand Down Expand Up @@ -133,8 +132,6 @@ class BASICPlatform implements Platform {
this.program = data;
var resumePC = this.runtime.load(data);
this.tty.uppercaseOnly = true; // this.program.opts.uppercaseOnly; //TODO?
// map editor to uppercase-only if need be
editors.textMapFunctions.input = this.program.opts.uppercaseOnly ? (s) => s.toUpperCase() : null;
// only reset if we exited, or couldn't restart at label (PC reset to 0)
if (!this.hotReload || didExit || !resumePC)
this.reset();
Expand Down
3 changes: 2 additions & 1 deletion src/worker/tools/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ export function compileBASIC(step: BuildStep): WorkerResult {
if (parser.errors.length == 0) throw e;
}
if (parser.errors.length) {
return { errors: parser.errors };
return { errors: parser.errors, uppercaseOnly: parser.opts.uppercaseOnly };
}
// put AST into JSON (sans source locations) to see if it has changed
var json = JSON.stringify(ast, (key, value) => { return (key == '$loc' ? undefined : value) });
putWorkFile(jsonpath, json);
if (anyTargetChanged(step, [jsonpath])) return {
output: ast,
listings: parser.getListings(),
uppercaseOnly: parser.opts.uppercaseOnly,
};
}
}
Expand Down
Loading