microvium
Version:
A compact, embeddable scripting engine for microcontrollers for executing small scripts written in a subset of JavaScript.
68 lines (67 loc) • 1.48 kB
TypeScript
import * as IL from './il';
import { SnapshotIL } from "./snapshot-il";
import { Snapshot } from '../lib';
declare type Offset = number;
interface Pointer {
type: 'Pointer';
offset: Offset;
target: Pointer | IL.Value;
}
declare type Component = {
type: 'Region';
regionName: string;
value: Region;
} | {
type: 'Value';
value: IL.Value | Pointer;
} | {
type: 'LabeledValue';
label: string;
value: IL.Value | Pointer;
} | {
type: 'AllocationHeaderAttribute';
text: string;
} | {
type: 'Attribute';
label: string;
value: any;
} | {
type: 'Annotation';
text: string;
} | {
type: 'HeaderField';
name: string;
value: number;
isOffset: boolean;
} | {
type: 'UnusedSpace';
} | {
type: 'RegionOverflow';
} | {
type: 'OverlapWarning';
offsetStart: number;
offsetEnd: number;
};
interface RegionItem {
offset: number;
size: number;
content: Component;
}
export declare type Region = RegionItem[];
export interface SnapshotDisassembly {
bytecodeSize: number;
components: Region;
}
export interface SnapshotReconstructionInfo {
names: {
[type: string]: {
[offset: number]: string;
};
};
}
/** Decode a snapshot (bytecode) to IL */
export declare function decodeSnapshot(snapshot: Snapshot): {
snapshotInfo: SnapshotIL;
disassembly: string;
};
export {};