aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/libLSL/Properties/AssemblyInfo.cs35
-rw-r--r--libraries/libLSL/libLSL.csproj49
-rw-r--r--libraries/libLSL/lsl.cs329
-rw-r--r--libraries/libLSL/lslByteCode.cs133
-rw-r--r--libraries/libLSL/lslscript.cs10
5 files changed, 556 insertions, 0 deletions
diff --git a/libraries/libLSL/Properties/AssemblyInfo.cs b/libraries/libLSL/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..205dd95
--- /dev/null
+++ b/libraries/libLSL/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("libLSL")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("libLSL")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("65895724-efca-49f8-8efc-211594b4c716")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/libraries/libLSL/libLSL.csproj b/libraries/libLSL/libLSL.csproj
new file mode 100644
index 0000000..fe8822b
--- /dev/null
+++ b/libraries/libLSL/libLSL.csproj
@@ -0,0 +1,49 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{E213BD9C-85C9-4739-B613-E1B58543370C}</ProjectGuid>
8 <OutputType>Library</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>libLSL</RootNamespace>
11 <AssemblyName>libLSL</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>bin\Debug\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="System" />
32 <Reference Include="System.Data" />
33 <Reference Include="System.Xml" />
34 </ItemGroup>
35 <ItemGroup>
36 <Compile Include="lsl.cs" />
37 <Compile Include="lslByteCode.cs" />
38 <Compile Include="lslscript.cs" />
39 <Compile Include="Properties\AssemblyInfo.cs" />
40 </ItemGroup>
41 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
42 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
43 Other similar extension points exist, see Microsoft.Common.targets.
44 <Target Name="BeforeBuild">
45 </Target>
46 <Target Name="AfterBuild">
47 </Target>
48 -->
49</Project> \ No newline at end of file
diff --git a/libraries/libLSL/lsl.cs b/libraries/libLSL/lsl.cs
new file mode 100644
index 0000000..37a6429
--- /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 : byte
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 : byte
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 : byte
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 lslByteCode bytecode;
323
324 public void readFromBytes(byte[] data)
325 {
326
327 }
328 }
329}
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace 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}
diff --git a/libraries/libLSL/lslscript.cs b/libraries/libLSL/lslscript.cs
new file mode 100644
index 0000000..d9d57bd
--- /dev/null
+++ b/libraries/libLSL/lslscript.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace libLSL
6{
7 public class LSLScript
8 {
9 }
10}