From ea63400741f431131dbb09a85e13f658fcf28a9c Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 3 May 2007 04:13:43 +0000 Subject: [PATCH] Shellin' out a framework --- libraries/libLSL/lsl.cs | 8 +++---- libraries/libLSL/lslByteCode.cs | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 libraries/libLSL/lslByteCode.cs diff --git a/libraries/libLSL/lsl.cs b/libraries/libLSL/lsl.cs index e84c2bf1f4..37a6429ed7 100644 --- a/libraries/libLSL/lsl.cs +++ b/libraries/libLSL/lsl.cs @@ -6,7 +6,7 @@ namespace libLSL { - enum lslVarType + enum lslVarType : byte { VARTYPE_VOID = 0, VARTYPE_INTEGER = 1, @@ -18,7 +18,7 @@ namespace libLSL VARTYPE_LIST = 7 } - enum lslEventType + enum lslEventType : byte { EVENT_STATE_ENTRY = 0, EVENT_STATE_EXIT = 1, @@ -55,7 +55,7 @@ namespace libLSL EVENT_HTTP_RESPONSE = 32 } - enum lslOpcodes + enum lslOpcodes : byte { // No Operation OP_NOOP = 0x00, @@ -319,7 +319,7 @@ namespace libLSL class lslCodeChunk { lslCodeChunkHeader header; - byte[] bytecode; + lslByteCode bytecode; public void readFromBytes(byte[] data) { diff --git a/libraries/libLSL/lslByteCode.cs b/libraries/libLSL/lslByteCode.cs new file mode 100644 index 0000000000..eb987730c2 --- /dev/null +++ b/libraries/libLSL/lslByteCode.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace libLSL +{ + class lslByteCode + { + byte[] bytecode; + + public void executeStep() + { + byte ins = nextInstruction(); + lslOpcodes code = (lslOpcodes)ins; + + switch (code) + { + case lslOpcodes.OP_NOOP: + break; + case lslOpcodes.OP_POP: + popBytes(4); + break; + + default: + break; + } + } + + byte nextInstruction() + { + return 0; + } + + void popBytes(int num) + { + + } + } +}