-
Notifications
You must be signed in to change notification settings - Fork 54
/
modules.js
34 lines (31 loc) · 1.03 KB
/
modules.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Modules available for import, such as "__builtin__" and "graph".
define(["builtin", "crt", "graph", "mouse", "PascalError"],
function (builtin, crt, graph, mouse, PascalError) {
var importModule = function (name, symbolTable) {
switch (name.toLowerCase()) {
case "__builtin__":
builtin.importSymbols(symbolTable);
break;
case "crt":
crt.importSymbols(symbolTable);
break;
case "dos":
// I don't know what goes in here.
break;
case "graph":
graph.importSymbols(symbolTable);
break;
case "mouse":
mouse.importSymbols(symbolTable);
break;
case "printer":
// I don't know what goes in here.
break;
default:
throw new PascalError(null, "unknown module " + name);
}
};
return {
importModule: importModule
};
});