1
0

DATA,READを実装.

This commit is contained in:
otya128
2015-08-19 13:02:02 +09:00
parent 190e655b90
commit 4c7487bb31
6 changed files with 111 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ struct VMVariable
}
class VM
{
DataTable globalDataTable;
Code[] code;
int stacki;
int pc;
@@ -29,7 +30,7 @@ class VM
Function[wstring] functions;
int bp;
PetitComputer petitcomputer;
this(Code[] code, int len, VMVariable[wstring] globalTable, Function[wstring] functions)
this(Code[] code, int len, VMVariable[wstring] globalTable, Function[wstring] functions, DataTable gdt/*GNU Debugging Tools*/)
{
this.code = code;
this.stack = new Value[16384];
@@ -40,6 +41,7 @@ class VM
this.global[v.index] = Value(v.type);
}
this.functions = functions;
this.globalDataTable = gdt;
}
void run()
{
@@ -1120,3 +1122,20 @@ class InputCode : Code
} while(error);
}
}
class ReadCode : Code
{
int count;
this(int count)
{
this.count = count;
}
override void execute(VM vm)
{
for(int i = 0; i < count; i++)
{
Value data;
vm.globalDataTable.read(data, vm);
vm.push(data);
}
}
}