From 3436961bb5c01d659d09be134368f4f69460cef9 Mon Sep 17 00:00:00 2001
From: MW
Date: Sat, 26 May 2007 13:40:19 +0000
Subject: Start of rewrite 5279!
---
libraries/libLSL/Properties/AssemblyInfo.cs | 35 +++
libraries/libLSL/libLSL.csproj | 49 +++++
libraries/libLSL/lsl.cs | 329 ++++++++++++++++++++++++++++
libraries/libLSL/lslByteCode.cs | 133 +++++++++++
libraries/libLSL/lslscript.cs | 10 +
5 files changed, 556 insertions(+)
create mode 100644 libraries/libLSL/Properties/AssemblyInfo.cs
create mode 100644 libraries/libLSL/libLSL.csproj
create mode 100644 libraries/libLSL/lsl.cs
create mode 100644 libraries/libLSL/lslByteCode.cs
create mode 100644 libraries/libLSL/lslscript.cs
(limited to 'libraries/libLSL')
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 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("libLSL")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("libLSL")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("65895724-efca-49f8-8efc-211594b4c716")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[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 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {E213BD9C-85C9-4739-B613-E1B58543370C}
+ Library
+ Properties
+ libLSL
+ libLSL
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace libLSL
+{
+
+
+ enum lslVarType : byte
+ {
+ VARTYPE_VOID = 0,
+ VARTYPE_INTEGER = 1,
+ VARTYPE_FLOAT = 2,
+ VARTYPE_STRING = 3,
+ VARTYPE_KEY = 4,
+ VARTYPE_VECTOR = 5,
+ VARTYPE_ROTATION = 6,
+ VARTYPE_LIST = 7
+ }
+
+ enum lslEventType : byte
+ {
+ EVENT_STATE_ENTRY = 0,
+ EVENT_STATE_EXIT = 1,
+ EVENT_TOUCH_START = 2,
+ EVENT_TOUCH = 3,
+ EVENT_TOUCH_END = 4,
+ EVENT_COLLISION_START = 5,
+ EVENT_COLLISION = 6,
+ EVENT_COLLISION_END = 7,
+ EVENT_LAND_COLLISION_START = 8,
+ EVENT_LAND_COLLISION = 9,
+ EVENT_LAND_COLLISION_END = 10,
+ EVENT_TIMER = 11,
+ EVENT_LISTEN = 12,
+ EVENT_ON_REZ = 13,
+ EVENT_SENSOR = 14,
+ EVENT_NO_SENSOR = 15,
+ EVENT_CONTROL = 16,
+ EVENT_MONEY = 17,
+ EVENT_EMAIL = 18,
+ EVENT_AT_TARGET = 19,
+ EVENT_NOT_AT_TARGET = 20,
+ EVENT_AT_ROT_TARGET = 21,
+ EVENT_NOT_AT_ROT_TARGET = 22,
+ EVENT_RUN_TIME_PERMISSIONS = 23,
+ EVENT_CHANGED = 24,
+ EVENT_ATTACH = 25,
+ EVENT_DATASERVER = 26,
+ EVENT_LINK_MESSAGE = 27,
+ EVENT_MOVING_START = 28,
+ EVENT_MOVING_END = 29,
+ EVENT_OBJECT_REZ = 30,
+ EVENT_REMOTE_DATA = 31,
+ EVENT_HTTP_RESPONSE = 32
+ }
+
+ enum lslOpcodes : byte
+ {
+ // No Operation
+ OP_NOOP = 0x00,
+
+ // Pops
+ OP_POP = 0x01,
+ OP_POPS = 0x02,
+ OP_POPL = 0x03,
+ OP_POPV = 0x04,
+ OP_POPQ = 0x05,
+ OP_POPARG = 0x06,
+ OP_POPIP = 0x07,
+ OP_POPBP = 0x08,
+ OP_POPSP = 0x09,
+ OP_POPSLR = 0x0A,
+
+ // Dupes
+ OP_DUP = 0x20,
+ OP_DUPS = 0x21,
+ OP_DUPL = 0x22,
+ OP_DUPV = 0x23,
+ OP_DUPQ = 0x24,
+
+ // Stores
+ OP_STORE = 0x30,
+ OP_STORES = 0x31,
+ OP_STOREL = 0x32,
+ OP_STOREV = 0x33,
+ OP_STOREQ = 0x34,
+ OP_STOREG = 0x35,
+ OP_STOREGS = 0x36,
+ OP_STOREGL = 0x37,
+ OP_STOREGV = 0x38,
+ OP_STOREGQ = 0x39,
+
+ // Loads
+ OP_LOADP = 0x3A,
+ OP_LOADSP = 0x3B,
+ OP_LOADLP = 0x3C,
+ OP_LOADVP = 0x3D,
+ OP_LOADQP = 0x3E,
+ OP_LOADGP = 0x3F,
+ OP_LOADGSP = 0x40,
+ OP_LOADGLP = 0x41,
+ OP_LOADGVP = 0x42,
+ OP_LOADGQP = 0x43,
+
+ // Pushes
+ OP_PUSH = 0x50,
+ OP_PUSHS = 0x51,
+ OP_PUSHL = 0x52,
+ OP_PUSHV = 0x53,
+ OP_PUSHQ = 0x54,
+ OP_PUSHG = 0x55,
+ OP_PUSHGS = 0x56,
+ OP_PUSHGL = 0x57,
+ OP_PUSHGV = 0x58,
+ OP_PUSHGQ = 0x59,
+ OP_PUSHIP = 0x5A,
+ OP_PUSHBP = 0x5B,
+ OP_PUSHSP = 0x5C,
+ OP_PUSHARGB = 0x5D,
+ OP_PUSHARGI = 0x5E,
+ OP_PUSHARGF = 0x5F,
+ OP_PUSHARGS = 0x60,
+ OP_PUSHARGV = 0x61,
+ OP_PUSHARGQ = 0x62,
+ OP_PUSHE = 0x63,
+ OP_PUSHEV = 0x64,
+ OP_PUSHEQ = 0x65,
+ OP_PUSHARGE = 0x66,
+
+ // Numerics
+ OP_ADD = 0x70,
+ OP_SUB = 0x71,
+ OP_MUL = 0x72,
+ OP_DIV = 0x73,
+ OP_MOD = 0x74,
+ OP_EQ = 0x75,
+ OP_NEQ = 0x76,
+ OP_LEQ = 0x77,
+ OP_GEQ = 0x78,
+ OP_LESS = 0x79,
+ OP_GREATER = 0x7A,
+ OP_BITAND = 0x7B,
+ OP_BITOR = 0x7C,
+ OP_BITXOR = 0x7D,
+ OP_BOOLAND = 0x7E,
+ OP_BOOLOR = 0x7F,
+ OP_NEG = 0x80,
+ OP_BITNOT = 0x81,
+ OP_BOOLNOT = 0x82,
+
+ // Sequence
+ OP_JUMP = 0x90,
+ OP_JUMPIF = 0x91,
+ OP_JUMPNIF = 0x92,
+ OP_STATE = 0x93,
+ OP_CALL = 0x94,
+ OP_RETURN = 0x95,
+
+ // Cast
+ OP_CAST = 0xA0,
+
+ // Stack
+ OP_STACKTOS = 0xB0,
+ OP_STACKTOL = 0xB1,
+
+ // Debug
+ OP_PRINT = 0xC0,
+
+ // Library
+ OP_CALLLIB = 0xD0,
+ OP_CALLLIB_TWO_BYTE = 0xD1,
+
+ // More Numerics
+ OP_SHL = 0xE0,
+ OP_SHR = 0xE1
+ }
+
+ class lslHeader
+ {
+ int TM; // Top of memory
+ int IP; // Instruction pointer
+ int VN; // Version Number (0x00000200)
+ int BP; // Base Pointer
+ int SP; // Stack Pointer
+ int HR; // Heap Register
+ int HP; // Heap Pointer
+ int CS; // Current State
+ int NS; // Next State
+ int CE; // Current Events (Which events need running still?)
+ int IE; // In Event
+ int ER; // Event Register
+ int FR; // Fault Register
+ int SLR; // Sleep Register
+ int GVR; // Global Variable Register (Pointer)
+ int GFR; // Global Function Register (Pointer)
+ int PR; // Parameter Register - OnRez Int?
+ int ESR; // Energy Supply Register
+ int SR; // State Register
+ long NCE; // Extended Current Events
+ long NIE; // Extended In Event
+ long NER; // Extended Event Register
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslStaticBlock
+ {
+ int length; // Length (bytes)
+ lslVarType varType;// Variable Type
+ byte unknown; // Unknown
+ Object varObject; // Variable Object
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+
+ }
+
+ class lslHeapBlock
+ {
+ int length;
+ lslVarType varType;
+ short referenceCount;
+ Object varObject;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslStatePointer
+ {
+ int location;
+ long eventMask;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslStateFrameBlock
+ {
+ int number;
+ lslStatePointer[] pointers;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslStateBlockElement
+ {
+ int pointerToCode;
+ int callFrameSize;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslStateBlock
+ {
+ int length;
+ byte unknown;
+
+ lslStateBlockElement[] handlers; // ?
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslFunctioBlock
+ {
+ int number;
+ int[] pointers; // Relative to this -> codechunk
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslCodeArgument
+ {
+ lslVarType type;
+ byte empty;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslCodeChunkHeader
+ {
+ int length;
+ string comment;
+ lslVarType returnType;
+ lslCodeArgument[] arguments;
+ byte empty;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+
+ class lslCodeChunk
+ {
+ lslCodeChunkHeader header;
+ lslByteCode bytecode;
+
+ public void readFromBytes(byte[] data)
+ {
+
+ }
+ }
+}
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 @@
+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;
+
+ Object arg1 = (Object)32;
+ Object arg2 = (Object)32;
+
+ switch (code)
+ {
+ case lslOpcodes.OP_NOOP:
+ break;
+
+ case lslOpcodes.OP_POP:
+ popBytes(4);
+ break;
+
+ case lslOpcodes.OP_POPS:
+ case lslOpcodes.OP_POPL:
+ // Do Stuff
+ break;
+
+ case lslOpcodes.OP_POPV:
+ popBytes(12);
+ break;
+ case lslOpcodes.OP_POPQ:
+ popBytes(16);
+ break;
+
+ case lslOpcodes.OP_POPARG:
+ popBytes((Int32)arg1);
+ break;
+
+ case lslOpcodes.OP_POPIP:
+ // Do Stuff
+ break;
+
+ case lslOpcodes.OP_POPBP:
+ // Do Stuff
+ break;
+
+ case lslOpcodes.OP_POPSP:
+ // Do Stuff
+ break;
+
+ case lslOpcodes.OP_POPSLR:
+ // Do Stuff
+ break;
+
+ case lslOpcodes.OP_DUP:
+ pushBytes(getBytes(4));
+ break;
+
+ case lslOpcodes.OP_DUPS:
+ case lslOpcodes.OP_DUPL:
+ // Do Stuff
+ break;
+
+ case lslOpcodes.OP_DUPV:
+ pushBytes(getBytes(12));
+ break;
+
+ case lslOpcodes.OP_DUPQ:
+ pushBytes(getBytes(16));
+ break;
+
+ case lslOpcodes.OP_STORE:
+ // Somefin.
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ ///
+ /// Advance the instruction pointer, pull the current instruction
+ ///
+ ///
+ byte nextInstruction()
+ {
+ return 0;
+ }
+
+ ///
+ /// Removes bytes from the stack
+ ///
+ /// Number of bytes
+ void popBytes(int num)
+ {
+
+ }
+
+ ///
+ /// Pushes Bytes to the stack
+ ///
+ /// Ze bytes!
+ void pushBytes(byte[] bytes)
+ {
+
+ }
+
+ ///
+ /// Get Bytes from the stack
+ ///
+ /// Number of bytes
+ /// Ze bytes!
+ byte[] getBytes(int num)
+ {
+ return new byte[1];
+ }
+
+ ///
+ /// Saves bytes to the local frame
+ ///
+ /// Ze bytes!
+ /// Index in local frame
+ void storeBytes(byte[] bytes, int index)
+ {
+
+ }
+ }
+}
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 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace libLSL
+{
+ public class LSLScript
+ {
+ }
+}
--
cgit v1.1