aboutsummaryrefslogtreecommitdiffgithub
diff options
context:
space:
mode:
authorAustin Adams <git@austinjadams.com>2019-02-01 13:42:30 -0500
committerAustin Adams <git@austinjadams.com>2019-02-01 13:42:30 -0500
commitaf65fd071280db18c828fc498227b647adb42a8c (patch)
tree5227c4983b20d92dde07fca3077e19e84ec98d83
parent6a3aac25902d60c150af83a1be4b5fe907c8503c (diff)
downloadnovice-af65fd071280db18c828fc498227b647adb42a8c.tar.gz
novice-af65fd071280db18c828fc498227b647adb42a8c.tar.xz
Make loaders specify a file extension
-rw-r--r--novice/simulator/loaders/complx.test.ts6
-rw-r--r--novice/simulator/loaders/complx.ts4
-rw-r--r--novice/simulator/loaders/loader.ts1
3 files changed, 11 insertions, 0 deletions
diff --git a/novice/simulator/loaders/complx.test.ts b/novice/simulator/loaders/complx.test.ts
index 6282d01..a2969f1 100644
--- a/novice/simulator/loaders/complx.test.ts
+++ b/novice/simulator/loaders/complx.test.ts
@@ -168,6 +168,12 @@ describe('complx loader', () => {
});
});
+ describe('fileExt()', () => {
+ it('returns the right file extension', () => {
+ expect(loader.fileExt()).toEqual('obj');
+ });
+ });
+
describe('symbFileExt()', () => {
it('returns the right file extension', () => {
expect(loader.symbFileExt()).toEqual('sym');
diff --git a/novice/simulator/loaders/complx.ts b/novice/simulator/loaders/complx.ts
index c7110df..51a33a9 100644
--- a/novice/simulator/loaders/complx.ts
+++ b/novice/simulator/loaders/complx.ts
@@ -89,6 +89,10 @@ class ComplxObjectFileLoader implements Loader {
}
}
+ public fileExt(): string {
+ return 'obj';
+ }
+
public symbFileExt(): string {
return 'sym';
}
diff --git a/novice/simulator/loaders/loader.ts b/novice/simulator/loaders/loader.ts
index 99aeae5..1b070e3 100644
--- a/novice/simulator/loaders/loader.ts
+++ b/novice/simulator/loaders/loader.ts
@@ -4,6 +4,7 @@ import { Memory } from '../mem';
interface Loader {
load(isa: Isa, fp: Readable, mem: Memory): Promise<void>;
+ fileExt(): string;
symbFileExt(): string;
loadSymb(fp: Readable, symbtable: SymbTable): Promise<void>;
}