aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/libLSL
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/libLSL/libLSL.csproj1
-rw-r--r--libraries/libLSL/lsl.cs329
2 files changed, 330 insertions, 0 deletions
diff --git a/libraries/libLSL/libLSL.csproj b/libraries/libLSL/libLSL.csproj
index 0735cca..ae6e207 100644
--- a/libraries/libLSL/libLSL.csproj
+++ b/libraries/libLSL/libLSL.csproj
@@ -33,6 +33,7 @@
33 <Reference Include="System.Xml" /> 33 <Reference Include="System.Xml" />
34 </ItemGroup> 34 </ItemGroup>
35 <ItemGroup> 35 <ItemGroup>
36 <Compile Include="lsl.cs" />
36 <Compile Include="lslscript.cs" /> 37 <Compile Include="lslscript.cs" />
37 <Compile Include="Properties\AssemblyInfo.cs" /> 38 <Compile Include="Properties\AssemblyInfo.cs" />
38 </ItemGroup> 39 </ItemGroup>
diff --git a/libraries/libLSL/lsl.cs b/libraries/libLSL/lsl.cs
new file mode 100644
index 0000000..e84c2bf
--- /dev/null
+++ b/libraries/libLSL/lsl.cs
@@ -0,0 +1,329 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace libLSL
6{
7
8
9 enum lslVarType
10 {
11 VARTYPE_VOID = 0,
12 VARTYPE_INTEGER = 1,
13 VARTYPE_FLOAT = 2,
14 VARTYPE_STRING = 3,
15 VARTYPE_KEY = 4,
16 VARTYPE_VECTOR = 5,
17 VARTYPE_ROTATION = 6,
18 VARTYPE_LIST = 7
19 }
20
21 enum lslEventType
22 {
23 EVENT_STATE_ENTRY = 0,
24 EVENT_STATE_EXIT = 1,
25 EVENT_TOUCH_START = 2,
26 EVENT_TOUCH = 3,
27 EVENT_TOUCH_END = 4,
28 EVENT_COLLISION_START = 5,
29 EVENT_COLLISION = 6,
30 EVENT_COLLISION_END = 7,
31 EVENT_LAND_COLLISION_START = 8,
32 EVENT_LAND_COLLISION = 9,
33 EVENT_LAND_COLLISION_END = 10,
34 EVENT_TIMER = 11,
35 EVENT_LISTEN = 12,
36 EVENT_ON_REZ = 13,
37 EVENT_SENSOR = 14,
38 EVENT_NO_SENSOR = 15,
39 EVENT_CONTROL = 16,
40 EVENT_MONEY = 17,
41 EVENT_EMAIL = 18,
42 EVENT_AT_TARGET = 19,
43 EVENT_NOT_AT_TARGET = 20,
44 EVENT_AT_ROT_TARGET = 21,
45 EVENT_NOT_AT_ROT_TARGET = 22,
46 EVENT_RUN_TIME_PERMISSIONS = 23,
47 EVENT_CHANGED = 24,
48 EVENT_ATTACH = 25,
49 EVENT_DATASERVER = 26,
50 EVENT_LINK_MESSAGE = 27,
51 EVENT_MOVING_START = 28,
52 EVENT_MOVING_END = 29,
53 EVENT_OBJECT_REZ = 30,
54 EVENT_REMOTE_DATA = 31,
55 EVENT_HTTP_RESPONSE = 32
56 }
57
58 enum lslOpcodes
59 {
60 // No Operation
61 OP_NOOP = 0x00,
62
63 // Pops
64 OP_POP = 0x01,
65 OP_POPS = 0x02,
66 OP_POPL = 0x03,
67 OP_POPV = 0x04,
68 OP_POPQ = 0x05,
69 OP_POPARG = 0x06,
70 OP_POPIP = 0x07,
71 OP_POPBP = 0x08,
72 OP_POPSP = 0x09,
73 OP_POPSLR = 0x0A,
74
75 // Dupes
76 OP_DUP = 0x20,
77 OP_DUPS = 0x21,
78 OP_DUPL = 0x22,
79 OP_DUPV = 0x23,
80 OP_DUPQ = 0x24,
81
82 // Stores
83 OP_STORE = 0x30,
84 OP_STORES = 0x31,
85 OP_STOREL = 0x32,
86 OP_STOREV = 0x33,
87 OP_STOREQ = 0x34,
88 OP_STOREG = 0x35,
89 OP_STOREGS = 0x36,
90 OP_STOREGL = 0x37,
91 OP_STOREGV = 0x38,
92 OP_STOREGQ = 0x39,
93
94 // Loads
95 OP_LOADP = 0x3A,
96 OP_LOADSP = 0x3B,
97 OP_LOADLP = 0x3C,
98 OP_LOADVP = 0x3D,
99 OP_LOADQP = 0x3E,
100 OP_LOADGP = 0x3F,
101 OP_LOADGSP = 0x40,
102 OP_LOADGLP = 0x41,
103 OP_LOADGVP = 0x42,
104 OP_LOADGQP = 0x43,
105
106 // Pushes
107 OP_PUSH = 0x50,
108 OP_PUSHS = 0x51,
109 OP_PUSHL = 0x52,
110 OP_PUSHV = 0x53,
111 OP_PUSHQ = 0x54,
112 OP_PUSHG = 0x55,
113 OP_PUSHGS = 0x56,
114 OP_PUSHGL = 0x57,
115 OP_PUSHGV = 0x58,
116 OP_PUSHGQ = 0x59,
117 OP_PUSHIP = 0x5A,
118 OP_PUSHBP = 0x5B,
119 OP_PUSHSP = 0x5C,
120 OP_PUSHARGB = 0x5D,
121 OP_PUSHARGI = 0x5E,
122 OP_PUSHARGF = 0x5F,
123 OP_PUSHARGS = 0x60,
124 OP_PUSHARGV = 0x61,
125 OP_PUSHARGQ = 0x62,
126 OP_PUSHE = 0x63,
127 OP_PUSHEV = 0x64,
128 OP_PUSHEQ = 0x65,
129 OP_PUSHARGE = 0x66,
130
131 // Numerics
132 OP_ADD = 0x70,
133 OP_SUB = 0x71,
134 OP_MUL = 0x72,
135 OP_DIV = 0x73,
136 OP_MOD = 0x74,
137 OP_EQ = 0x75,
138 OP_NEQ = 0x76,
139 OP_LEQ = 0x77,
140 OP_GEQ = 0x78,
141 OP_LESS = 0x79,
142 OP_GREATER = 0x7A,
143 OP_BITAND = 0x7B,
144 OP_BITOR = 0x7C,
145 OP_BITXOR = 0x7D,
146 OP_BOOLAND = 0x7E,
147 OP_BOOLOR = 0x7F,
148 OP_NEG = 0x80,
149 OP_BITNOT = 0x81,
150 OP_BOOLNOT = 0x82,
151
152 // Sequence
153 OP_JUMP = 0x90,
154 OP_JUMPIF = 0x91,
155 OP_JUMPNIF = 0x92,
156 OP_STATE = 0x93,
157 OP_CALL = 0x94,
158 OP_RETURN = 0x95,
159
160 // Cast
161 OP_CAST = 0xA0,
162
163 // Stack
164 OP_STACKTOS = 0xB0,
165 OP_STACKTOL = 0xB1,
166
167 // Debug
168 OP_PRINT = 0xC0,
169
170 // Library
171 OP_CALLLIB = 0xD0,
172 OP_CALLLIB_TWO_BYTE = 0xD1,
173
174 // More Numerics
175 OP_SHL = 0xE0,
176 OP_SHR = 0xE1
177 }
178
179 class lslHeader
180 {
181 int TM; // Top of memory
182 int IP; // Instruction pointer
183 int VN; // Version Number (0x00000200)
184 int BP; // Base Pointer
185 int SP; // Stack Pointer
186 int HR; // Heap Register
187 int HP; // Heap Pointer
188 int CS; // Current State
189 int NS; // Next State
190 int CE; // Current Events (Which events need running still?)
191 int IE; // In Event
192 int ER; // Event Register
193 int FR; // Fault Register
194 int SLR; // Sleep Register
195 int GVR; // Global Variable Register (Pointer)
196 int GFR; // Global Function Register (Pointer)
197 int PR; // Parameter Register - OnRez Int?
198 int ESR; // Energy Supply Register
199 int SR; // State Register
200 long NCE; // Extended Current Events
201 long NIE; // Extended In Event
202 long NER; // Extended Event Register
203
204 public void readFromBytes(byte[] data)
205 {
206
207 }
208 }
209
210 class lslStaticBlock
211 {
212 int length; // Length (bytes)
213 lslVarType varType;// Variable Type
214 byte unknown; // Unknown
215 Object varObject; // Variable Object
216
217 public void readFromBytes(byte[] data)
218 {
219
220 }
221
222 }
223
224 class lslHeapBlock
225 {
226 int length;
227 lslVarType varType;
228 short referenceCount;
229 Object varObject;
230
231 public void readFromBytes(byte[] data)
232 {
233
234 }
235 }
236
237 class lslStatePointer
238 {
239 int location;
240 long eventMask;
241
242 public void readFromBytes(byte[] data)
243 {
244
245 }
246 }
247
248 class lslStateFrameBlock
249 {
250 int number;
251 lslStatePointer[] pointers;
252
253 public void readFromBytes(byte[] data)
254 {
255
256 }
257 }
258
259 class lslStateBlockElement
260 {
261 int pointerToCode;
262 int callFrameSize;
263
264 public void readFromBytes(byte[] data)
265 {
266
267 }
268 }
269
270 class lslStateBlock
271 {
272 int length;
273 byte unknown;
274
275 lslStateBlockElement[] handlers; // ?
276
277 public void readFromBytes(byte[] data)
278 {
279
280 }
281 }
282
283 class lslFunctioBlock
284 {
285 int number;
286 int[] pointers; // Relative to this -> codechunk
287
288 public void readFromBytes(byte[] data)
289 {
290
291 }
292 }
293
294 class lslCodeArgument
295 {
296 lslVarType type;
297 byte empty;
298
299 public void readFromBytes(byte[] data)
300 {
301
302 }
303 }
304
305 class lslCodeChunkHeader
306 {
307 int length;
308 string comment;
309 lslVarType returnType;
310 lslCodeArgument[] arguments;
311 byte empty;
312
313 public void readFromBytes(byte[] data)
314 {
315
316 }
317 }
318
319 class lslCodeChunk
320 {
321 lslCodeChunkHeader header;
322 byte[] bytecode;
323
324 public void readFromBytes(byte[] data)
325 {
326
327 }
328 }
329}