1
0

TABの実装

This commit is contained in:
otya128
2015-08-30 13:41:52 +09:00
parent 4c45325f3e
commit 45c72df297
5 changed files with 75 additions and 19 deletions

View File

@@ -192,12 +192,20 @@ class Compiler
sysVariable["CSRZ"] = new CSRZ();
addSystemVariable("VERSION", new Version());
addSystemVariable("FREEMEM", new FreeMem());
addSystemVariable("TABSTEP", new TabStep());
}
void addSystemVariable(wstring name, SystemVariable var)
{
global[name] = VMVariable(-1);
sysVariable[name] = var;
}
void registerSystemVariable(VM vm)
{
foreach(k, ref v; sysVariable)
{
v.vm = vm;
}
}
SystemVariable[wstring] sysVariable;
Code[] code;
VMVariable[wstring] global;
@@ -1030,7 +1038,9 @@ class Compiler
code[i] = new RestoreCode(s.data.label[restore.label], s.data);
}
}
return new VM(code, globalIndex + 1, global, functions, s.data, globalLabel, debugInfo);
VM vm = new VM(code, globalIndex + 1, global, functions, s.data, globalLabel, debugInfo);
registerSystemVariable(vm);
return vm;
}
}