diff options
author | MW | 2007-05-26 13:40:19 +0000 |
---|---|---|
committer | MW | 2007-05-26 13:40:19 +0000 |
commit | 3436961bb5c01d659d09be134368f4f69460cef9 (patch) | |
tree | 3753ba4d7818df2a6bce0bbe863ff033cdfd568a /libraries/libLSL/lslByteCode.cs | |
download | opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.zip opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.gz opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.bz2 opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.xz |
Start of rewrite 5279!
Diffstat (limited to 'libraries/libLSL/lslByteCode.cs')
-rw-r--r-- | libraries/libLSL/lslByteCode.cs | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/libraries/libLSL/lslByteCode.cs b/libraries/libLSL/lslByteCode.cs new file mode 100644 index 0000000..4dffe22 --- /dev/null +++ b/libraries/libLSL/lslByteCode.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace libLSL | ||
6 | { | ||
7 | class lslByteCode | ||
8 | { | ||
9 | byte[] bytecode; | ||
10 | |||
11 | public void executeStep() | ||
12 | { | ||
13 | byte ins = nextInstruction(); | ||
14 | lslOpcodes code = (lslOpcodes)ins; | ||
15 | |||
16 | Object arg1 = (Object)32; | ||
17 | Object arg2 = (Object)32; | ||
18 | |||
19 | switch (code) | ||
20 | { | ||
21 | case lslOpcodes.OP_NOOP: | ||
22 | break; | ||
23 | |||
24 | case lslOpcodes.OP_POP: | ||
25 | popBytes(4); | ||
26 | break; | ||
27 | |||
28 | case lslOpcodes.OP_POPS: | ||
29 | case lslOpcodes.OP_POPL: | ||
30 | // Do Stuff | ||
31 | break; | ||
32 | |||
33 | case lslOpcodes.OP_POPV: | ||
34 | popBytes(12); | ||
35 | break; | ||
36 | case lslOpcodes.OP_POPQ: | ||
37 | popBytes(16); | ||
38 | break; | ||
39 | |||
40 | case lslOpcodes.OP_POPARG: | ||
41 | popBytes((Int32)arg1); | ||
42 | break; | ||
43 | |||
44 | case lslOpcodes.OP_POPIP: | ||
45 | // Do Stuff | ||
46 | break; | ||
47 | |||
48 | case lslOpcodes.OP_POPBP: | ||
49 | // Do Stuff | ||
50 | break; | ||
51 | |||
52 | case lslOpcodes.OP_POPSP: | ||
53 | // Do Stuff | ||
54 | break; | ||
55 | |||
56 | case lslOpcodes.OP_POPSLR: | ||
57 | // Do Stuff | ||
58 | break; | ||
59 | |||
60 | case lslOpcodes.OP_DUP: | ||
61 | pushBytes(getBytes(4)); | ||
62 | break; | ||
63 | |||
64 | case lslOpcodes.OP_DUPS: | ||
65 | case lslOpcodes.OP_DUPL: | ||
66 | // Do Stuff | ||
67 | break; | ||
68 | |||
69 | case lslOpcodes.OP_DUPV: | ||
70 | pushBytes(getBytes(12)); | ||
71 | break; | ||
72 | |||
73 | case lslOpcodes.OP_DUPQ: | ||
74 | pushBytes(getBytes(16)); | ||
75 | break; | ||
76 | |||
77 | case lslOpcodes.OP_STORE: | ||
78 | // Somefin. | ||
79 | break; | ||
80 | |||
81 | default: | ||
82 | break; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Advance the instruction pointer, pull the current instruction | ||
88 | /// </summary> | ||
89 | /// <returns></returns> | ||
90 | byte nextInstruction() | ||
91 | { | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Removes bytes from the stack | ||
97 | /// </summary> | ||
98 | /// <param name="num">Number of bytes</param> | ||
99 | void popBytes(int num) | ||
100 | { | ||
101 | |||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Pushes Bytes to the stack | ||
106 | /// </summary> | ||
107 | /// <param name="bytes">Ze bytes!</param> | ||
108 | void pushBytes(byte[] bytes) | ||
109 | { | ||
110 | |||
111 | } | ||
112 | |||
113 | /// <summary> | ||
114 | /// Get Bytes from the stack | ||
115 | /// </summary> | ||
116 | /// <param name="num">Number of bytes</param> | ||
117 | /// <returns>Ze bytes!</returns> | ||
118 | byte[] getBytes(int num) | ||
119 | { | ||
120 | return new byte[1]; | ||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Saves bytes to the local frame | ||
125 | /// </summary> | ||
126 | /// <param name="bytes">Ze bytes!</param> | ||
127 | /// <param name="index">Index in local frame</param> | ||
128 | void storeBytes(byte[] bytes, int index) | ||
129 | { | ||
130 | |||
131 | } | ||
132 | } | ||
133 | } | ||