aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTedd Hansen2008-09-17 16:46:23 +0000
committerTedd Hansen2008-09-17 16:46:23 +0000
commite94d6f12eeb3bd84a752fc401847b4c25d39cdac (patch)
treea4d4f1d91df2f2dd2d6fc715c7b8e9bb241f5784
parent* SSL Documentation update from Lexa (diff)
downloadopensim-SC_OLD-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.zip
opensim-SC_OLD-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.tar.gz
opensim-SC_OLD-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.tar.bz2
opensim-SC_OLD-e94d6f12eeb3bd84a752fc401847b4c25d39cdac.tar.xz
More ScriptEngine cleanup
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/Executor.cs137
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/IScript.cs35
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs635
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs82
-rw-r--r--OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs63
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs223
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs58
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs144
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs314
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs2128
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs87
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs291
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs51
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs82
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs405
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs393
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs75
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs435
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs561
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs728
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs143
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs2290
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/c_sharp_example.txt12
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs222
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs335
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs354
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs65
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs119
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs421
-rw-r--r--OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs68
30 files changed, 0 insertions, 10956 deletions
diff --git a/OpenSim/Grid/ScriptEngine/Common/Executor.cs b/OpenSim/Grid/ScriptEngine/Common/Executor.cs
deleted file mode 100644
index 676af7b..0000000
--- a/OpenSim/Grid/ScriptEngine/Common/Executor.cs
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Runtime.Remoting.Lifetime;
32
33namespace OpenSim.Grid.ScriptEngine.Common
34{
35 public class Executor : MarshalByRefObject
36 {
37 // Private instance for each script
38
39 private IScript m_Script;
40 private Dictionary<string, MethodInfo> Events = new Dictionary<string, MethodInfo>();
41 private bool m_Running = true;
42 //private List<IScript> Scripts = new List<IScript>();
43
44 public Executor(IScript Script)
45 {
46 m_Script = Script;
47 }
48
49 // Object never expires
50 public override Object InitializeLifetimeService()
51 {
52 //Console.WriteLine("Executor: InitializeLifetimeService()");
53 // return null;
54 ILease lease = (ILease) base.InitializeLifetimeService();
55
56 if (lease.CurrentState == LeaseState.Initial)
57 {
58 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
59// lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
60// lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
61 }
62 return lease;
63 }
64
65 public AppDomain GetAppDomain()
66 {
67 return AppDomain.CurrentDomain;
68 }
69
70 public void ExecuteEvent(string FunctionName, object[] args)
71 {
72 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
73 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
74 //try
75 //{
76 if (m_Running == false)
77 {
78 // Script is inactive, do not execute!
79 return;
80 }
81
82 string EventName = m_Script.State() + "_event_" + FunctionName;
83
84 //type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
85
86 //Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
87
88 if (Events.ContainsKey(EventName) == false)
89 {
90 // Not found, create
91 Type type = m_Script.GetType();
92 try
93 {
94 MethodInfo mi = type.GetMethod(EventName);
95 Events.Add(EventName, mi);
96 }
97 catch
98 {
99 // Event name not found, cache it as not found
100 Events.Add(EventName, null);
101 }
102 }
103
104 // Get event
105 MethodInfo ev = null;
106 Events.TryGetValue(EventName, out ev);
107
108 if (ev == null) // No event by that name!
109 {
110 //Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\"");
111 return;
112 }
113
114 // Found
115 //try
116 //{
117 // Invoke it
118 ev.Invoke(m_Script, args);
119
120 //}
121 //catch (Exception e)
122 //{
123 // // TODO: Send to correct place
124 // Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString());
125 //}
126
127
128 //}
129 //catch { }
130 }
131
132 public void StopScript()
133 {
134 m_Running = false;
135 }
136 }
137}
diff --git a/OpenSim/Grid/ScriptEngine/Common/IScript.cs b/OpenSim/Grid/ScriptEngine/Common/IScript.cs
deleted file mode 100644
index 9ebf683..0000000
--- a/OpenSim/Grid/ScriptEngine/Common/IScript.cs
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Grid.ScriptEngine.Common
29{
30 public interface IScript
31 {
32 string State();
33 Executor Exec { get; }
34 }
35}
diff --git a/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
deleted file mode 100644
index 422af46..0000000
--- a/OpenSim/Grid/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ /dev/null
@@ -1,635 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System.Collections.Generic;
30
31namespace OpenSim.Grid.ScriptEngine.Common
32{
33 public interface LSL_BuiltIn_Commands_Interface
34 {
35 string State();
36
37 double llSin(double f);
38 double llCos(double f);
39 double llTan(double f);
40 double llAtan2(double x, double y);
41 double llSqrt(double f);
42 double llPow(double fbase, double fexponent);
43 int llAbs(int i);
44 double llFabs(double f);
45 double llFrand(double mag);
46 int llFloor(double f);
47 int llCeil(double f);
48 int llRound(double f);
49 double llVecMag(LSL_Types.Vector3 v);
50 LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v);
51 double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b);
52 LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r);
53 LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v);
54 LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up);
55 LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r);
56 LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r);
57 LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r);
58 LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end);
59 void llWhisper(int channelID, string text);
60 void llSay(int channelID, string text);
61 void llShout(int channelID, string text);
62 int llListen(int channelID, string name, string ID, string msg);
63 void llListenControl(int number, int active);
64 void llListenRemove(int number);
65 void llSensor(string name, string id, int type, double range, double arc);
66 void llSensorRepeat(string name, string id, int type, double range, double arc, double rate);
67 void llSensorRemove();
68 string llDetectedName(int number);
69 string llDetectedKey(int number);
70 string llDetectedOwner(int number);
71 int llDetectedType(int number);
72 LSL_Types.Vector3 llDetectedPos(int number);
73 LSL_Types.Vector3 llDetectedVel(int number);
74 LSL_Types.Vector3 llDetectedGrab(int number);
75 LSL_Types.Quaternion llDetectedRot(int number);
76 int llDetectedGroup(int number);
77 int llDetectedLinkNumber(int number);
78 void llDie();
79 double llGround(LSL_Types.Vector3 offset);
80 double llCloud(LSL_Types.Vector3 offset);
81 LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset);
82 void llSetStatus(int status, int value);
83 int llGetStatus(int status);
84 void llSetScale(LSL_Types.Vector3 scale);
85 LSL_Types.Vector3 llGetScale();
86 void llSetColor(LSL_Types.Vector3 color, int face);
87 double llGetAlpha(int face);
88 void llSetAlpha(double alpha, int face);
89 LSL_Types.Vector3 llGetColor(int face);
90 void llSetTexture(string texture, int face);
91 void llScaleTexture(double u, double v, int face);
92 void llOffsetTexture(double u, double v, int face);
93 void llRotateTexture(double rotation, int face);
94 string llGetTexture(int face);
95 void llSetPos(LSL_Types.Vector3 pos);
96
97 //wiki: vector llGetPos()
98 LSL_Types.Vector3 llGetPos();
99 //wiki: vector llGetLocalPos()
100 LSL_Types.Vector3 llGetLocalPos();
101 //wiki: llSetRot(rotation rot)
102 void llSetRot(LSL_Types.Quaternion rot);
103 //wiki: rotation llGetRot()
104 LSL_Types.Quaternion llGetRot();
105 //wiki: rotation llGetLocalRot()
106 LSL_Types.Quaternion llGetLocalRot();
107 //wiki: llSetForce(vector force, integer local)
108 void llSetForce(LSL_Types.Vector3 force, int local);
109 //wiki: vector llGetForce()
110 LSL_Types.Vector3 llGetForce();
111 //wiki: integer llTarget(vector position, double range)
112 int llTarget(LSL_Types.Vector3 position, double range);
113 //wiki: llTargetRemove(integer number)
114 void llTargetRemove(int number);
115 //wiki: integer llRotTarget(rotation rot, double error)
116 int llRotTarget(LSL_Types.Quaternion rot, double error);
117 //wiki: integer llRotTargetRemove(integer number)
118 void llRotTargetRemove(int number);
119 //wiki: llMoveToTarget(vector target, double tau)
120 void llMoveToTarget(LSL_Types.Vector3 target, double tau);
121 //wiki: llStopMoveToTarget()
122 void llStopMoveToTarget();
123 //wiki: llApplyImpulse(vector force, integer local)
124 void llApplyImpulse(LSL_Types.Vector3 force, int local);
125 //wiki: llapplyRotationalImpulse(vector force, integer local)
126 void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local);
127 //wiki: llSetTorque(vector torque, integer local)
128 void llSetTorque(LSL_Types.Vector3 torque, int local);
129 //wiki: vector llGetTorque()
130 LSL_Types.Vector3 llGetTorque();
131 //wiki: llSeForceAndTorque(vector force, vector torque, integer local)
132 void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local);
133 //wiki: vector llGetVel()
134 LSL_Types.Vector3 llGetVel();
135 //wiki: vector llGetAccel()
136 LSL_Types.Vector3 llGetAccel();
137 //wiki: vector llGetOmega()
138 LSL_Types.Vector3 llGetOmega();
139 //wiki: double llGetTimeOfDay()
140 double llGetTimeOfDay();
141 //wiki: double llGetWallclock()
142 double llGetWallclock();
143 //wiki: double llGetTime()
144 double llGetTime();
145 //wiki: llResetTime()
146 void llResetTime();
147 //wiki: double llGetAndResetTime()
148 double llGetAndResetTime();
149 //wiki (deprecated) llSound(string sound, double volume, integer queue, integer loop)
150 void llSound();
151 //wiki: llPlaySound(string sound, double volume)
152 void llPlaySound(string sound, double volume);
153 //wiki: llLoopSound(string sound, double volume)
154 void llLoopSound(string sound, double volume);
155 //wiki: llLoopSoundMaster(string sound, double volume)
156 void llLoopSoundMaster(string sound, double volume);
157 //wiki: llLoopSoundSlave(string sound, double volume)
158 void llLoopSoundSlave(string sound, double volume);
159 //wiki llPlaySoundSlave(string sound, double volume)
160 void llPlaySoundSlave(string sound, double volume);
161 //wiki: llTriggerSound(string sound, double volume)
162 void llTriggerSound(string sound, double volume);
163 //wiki: llStopSound()
164 void llStopSound();
165 //wiki: llPreloadSound(string sound)
166 void llPreloadSound(string sound);
167 //wiki: string llGetSubString(string src, integer start, integer end)
168 string llGetSubString(string src, int start, int end);
169 //wiki: string llDeleteSubString(string src, integer start, integer end)
170 string llDeleteSubString(string src, int start, int end);
171 //wiki string llInsertString(string dst, integer position, string src)
172 string llInsertString(string dst, int position, string src);
173 //wiki: string llToUpper(string source)
174 string llToUpper(string source);
175 //wiki: string llToLower(string source)
176 string llToLower(string source);
177 //wiki: integer llGiveMoney(key destination, integer amount)
178 int llGiveMoney(string destination, int amount);
179 //wiki: (deprecated)
180 void llMakeExplosion();
181 //wiki: (deprecated)
182 void llMakeFountain();
183 //wiki: (deprecated)
184 void llMakeSmoke();
185 //wiki: (deprecated)
186 void llMakeFire();
187 //wiki: llRezObject(string inventory, vector pos, vector rel, rotation rot, integer param)
188 void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param);
189 //wiki: llLookAt(vector target, double strength, double damping)
190 void llLookAt(LSL_Types.Vector3 target, double strength, double damping);
191 //wiki: llStopLookAt()
192 void llStopLookAt();
193 //wiki: llSetTimerEvent(double sec)
194 void llSetTimerEvent(double sec);
195 //wiki: llSleep(double sec)
196 void llSleep(double sec);
197 //wiki: double llGetMass()
198 double llGetMass();
199 //wiki: llCollisionFilter(string name, key id, integer accept)
200 void llCollisionFilter(string name, string id, int accept);
201 //wiki: llTakeControls(integer controls, integer accept, integer pass_on)
202 void llTakeControls(int controls, int accept, int pass_on);
203 //wiki: llReleaseControls()
204 void llReleaseControls();
205 //wiki: llAttachToAvatar(integer attachment)
206 void llAttachToAvatar(int attachment);
207 //wiki: llDetachFromAvatar()
208 void llDetachFromAvatar();
209 //wiki: (deprecated) llTakeCamera()
210 void llTakeCamera();
211 //wiki: (deprecated) llReleaseCamera()
212 void llReleaseCamera();
213 //wiki: key llGetOwner()
214 string llGetOwner();
215 //wiki: llInstantMessage(key user, string message)
216 void llInstantMessage(string user, string message);
217 //wiki: llEmail(string address, string subject, string message)
218 void llEmail(string address, string subject, string message);
219 //wiki: llGetNextEmail(string address, string subject)
220 void llGetNextEmail(string address, string subject);
221 //wiki: key llGetKey()
222 string llGetKey();
223 //wiki: llSetBuoyancy(double buoyancy)
224 void llSetBuoyancy(double buoyancy);
225 //wiki: llSetHoverHeight(double height, integer water, double tau)
226 void llSetHoverHeight(double height, int water, double tau);
227 //wiki: llStopHover
228 void llStopHover();
229 //wiki: llMinEventDelay(double delay)
230 void llMinEventDelay(double delay);
231 //wiki: (deprecated) llSoundPreload()
232 void llSoundPreload();
233 //wiki: llRotLookAt(rotation target, double strength, double damping)
234 void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping);
235 //wiki: integer llStringLength(string str)
236 int llStringLength(string str);
237 //wiki: llStartAnimation(string anim)
238 void llStartAnimation(string anim);
239 //wiki: llStopAnimation(string anim)
240 void llStopAnimation(string anim);
241 //wiki: (deprecated) llPointAt
242 void llPointAt();
243 //wiki: (deprecated) llStopPointAt
244 void llStopPointAt();
245 //wiki: llTargetOmega(vector axis, double spinrate, double gain)
246 void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain);
247 //wiki: integer llGetStartParameter()
248 int llGetStartParameter();
249 //wiki: llGodLikeRezObject(key inventory, vector pos)
250 void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos);
251 //wiki: llRequestPermissions(key agent, integer perm)
252 void llRequestPermissions(string agent, int perm);
253 //wiki: key llGetPermissionsKey()
254 string llGetPermissionsKey();
255 //wiki: integer llGetPermissions()
256 int llGetPermissions();
257 //wiki integer llGetLinkNumber()
258 int llGetLinkNumber();
259 //wiki: llSetLinkColor(integer linknumber, vector color, integer face)
260 void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face);
261 //wiki: llCreateLink(key target, integer parent)
262 void llCreateLink(string target, int parent);
263 //wiki: llBreakLink(integer linknum)
264 void llBreakLink(int linknum);
265 //wiki: llBreakAllLinks()
266 void llBreakAllLinks();
267 //wiki: key llGetLinkKey(integer linknum)
268 string llGetLinkKey(int linknum);
269 //wiki: llGetLinkName(integer linknum)
270 void llGetLinkName(int linknum);
271 //wiki: integer llGetInventoryNumber(integer type)
272 int llGetInventoryNumber(int type);
273 //wiki: string llGetInventoryName(integer type, integer number)
274 string llGetInventoryName(int type, int number);
275 //wiki: llSetScriptState(string name, integer run)
276 void llSetScriptState(string name, int run);
277 //wiki: double llGetEnergy()
278 double llGetEnergy();
279 //wiki: llGiveInventory(key destination, string inventory)
280 void llGiveInventory(string destination, string inventory);
281 //wiki: llRemoveInventory(string item)
282 void llRemoveInventory(string item);
283 //wiki: llSetText(string text, vector color, double alpha)
284 void llSetText(string text, LSL_Types.Vector3 color, double alpha);
285 //wiki: double llWater(vector offset)
286 double llWater(LSL_Types.Vector3 offset);
287 //wiki: llPassTouches(integer pass)
288 void llPassTouches(int pass);
289 //wiki: key llRequestAgentData(key id, integer data)
290 string llRequestAgentData(string id, int data);
291 //wiki: key llRequestInventoryData(string name)
292 string llRequestInventoryData(string name);
293 //wiki: llSetDamage(double damage)
294 void llSetDamage(double damage);
295 //wiki: llTeleportAgentHome(key agent)
296 void llTeleportAgentHome(string agent);
297 //wiki: llModifyLand(integer action, integer brush)
298 void llModifyLand(int action, int brush);
299 //wiki: llCollisionSound(string impact_sound, double impact_volume)
300 void llCollisionSound(string impact_sound, double impact_volume);
301 //wiki: llCollisionSprite(string impact_sprite)
302 void llCollisionSprite(string impact_sprite);
303 //wiki: string llGetAnimation(key id)
304 string llGetAnimation(string id);
305 //wiki: llResetScript()
306 void llResetScript();
307 //wiki: llMessageLinked(integer linknum, integer num, string str, key id)
308 void llMessageLinked(int linknum, int num, string str, string id);
309 //wiki: llPushObject(key target, vector impulse, vector ang_impulse, integer local)
310 void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local);
311 //wiki: llPassCollisions(integer pass)
312 void llPassCollisions(int pass);
313 //wiki: string llGetScriptName()
314 string llGetScriptName();
315 //wiki: integer llGetNumberOfSides()
316 int llGetNumberOfSides();
317 //wiki: rotation llAxisAngle2Rot(vector axis, double angle)
318 LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle);
319 //wiki: vector llRot2Axis(rotation rot)
320 LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot);
321 void llRot2Angle();
322 //wiki: double llAcos(double val)
323 double llAcos(double val);
324 //wiki: double llAsin(double val)
325 double llAsin(double val);
326 //wiki: double llAngleBetween(rotation a, rotation b)
327 double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b);
328 //wiki: string llGetInventoryKey(string name)
329 string llGetInventoryKey(string name);
330 //wiki: llAllowInventoryDrop(integer add)
331 void llAllowInventoryDrop(int add);
332 //wiki: vector llGetSunDirection()
333 LSL_Types.Vector3 llGetSunDirection();
334 //wiki: vector llGetTextureOffset(integer face)
335 LSL_Types.Vector3 llGetTextureOffset(int face);
336 //wiki: vector llGetTextureScale(integer side)
337 LSL_Types.Vector3 llGetTextureScale(int side);
338 //wiki: double llGetTextureRot(integer side)
339 double llGetTextureRot(int side);
340 //wiki: integer llSubStringIndex(string source, string pattern)
341 int llSubStringIndex(string source, string pattern);
342 //wiki: key llGetOwnerKey(key id)
343 string llGetOwnerKey(string id);
344 //wiki: vector llGetCenterOfMass()
345 LSL_Types.Vector3 llGetCenterOfMass();
346 //wiki: list llListSort(list src, integer stride, integer ascending)
347 List<string> llListSort(List<string> src, int stride, int ascending);
348 //integer llGetListLength(list src)
349 int llGetListLength(List<string> src);
350 //wiki: integer llList2Integer(list src, integer index)
351 int llList2Integer(List<string> src, int index);
352 //wiki: double llList2double(list src, integer index)
353 double llList2double(List<string> src, int index);
354 //wiki: string llList2String(list src, integer index)
355 string llList2String(List<string> src, int index);
356 //wiki: key llList2Key(list src, integer index)
357 string llList2Key(List<string> src, int index);
358 //wiki: vector llList2Vector(list src, integer index)
359 LSL_Types.Vector3 llList2Vector(List<string> src, int index);
360 //wiki rotation llList2Rot(list src, integer index)
361 LSL_Types.Quaternion llList2Rot(List<string> src, int index);
362 //wiki: list llList2List(list src, integer start, integer end)
363 List<string> llList2List(List<string> src, int start, int end);
364 //wiki: llDeleteSubList(list src, integer start, integer end)
365 List<string> llDeleteSubList(List<string> src, int start, int end);
366 //wiki: integer llGetListEntryType(list src, integer index)
367 int llGetListEntryType(List<string> src, int index);
368 //wiki: string llList2CSV(list src)
369 string llList2CSV(List<string> src);
370 //wiki: list llCSV2List(string src)
371 List<string> llCSV2List(string src);
372 //wiki: list llListRandomize(list src, integer stride)
373 List<string> llListRandomize(List<string> src, int stride);
374 //wiki: list llList2ListStrided(list src, integer start, integer end, integer stride)
375 List<string> llList2ListStrided(List<string> src, int start, int end, int stride);
376 //wiki: vector llGetRegionCorner()
377 LSL_Types.Vector3 llGetRegionCorner();
378 //wiki: list llListInsertList(list dest, list src, integer start)
379 List<string> llListInsertList(List<string> dest, List<string> src, int start);
380 //wiki: integer llListFindList(list src, list test)
381 int llListFindList(List<string> src, List<string> test);
382 //wiki: string llGetObjectName()
383 string llGetObjectName();
384 //wiki: llSetObjectName(string name)
385 void llSetObjectName(string name);
386 //wiki: string llGetDate()
387 string llGetDate();
388 //wiki: integer llEdgeOfWorld(vector pos, vector dir)
389 int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir);
390 //wiki: integer llGetAgentInfo(key id)
391 int llGetAgentInfo(string id);
392 //wiki: llAdjustSoundVolume(double volume)
393 void llAdjustSoundVolume(double volume);
394 //wiki: llSetSoundQueueing(integer queue)
395 void llSetSoundQueueing(int queue);
396 //wiki: llSetSoundRadius(double radius)
397 void llSetSoundRadius(double radius);
398 //wiki: string llKey2Name(key id)
399 string llKey2Name(string id);
400 //wiki: llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, double start, double length, double rate)
401 void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate);
402 //wiki: llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west)
403 void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
404 LSL_Types.Vector3 bottom_south_west);
405
406 //wiki: llEjectFromLand(key pest)
407 void llEjectFromLand(string pest);
408 void llParseString2List();
409 //wiki: integer llOverMyLand(key id)
410 int llOverMyLand(string id);
411 //wiki: key llGetLandOwnerAt(vector pos)
412 string llGetLandOwnerAt(LSL_Types.Vector3 pos);
413 //wiki: key llGetNotecardLine(string name, integer line)
414 string llGetNotecardLine(string name, int line);
415 //wiki: vector llGetAgentSize(key id)
416 LSL_Types.Vector3 llGetAgentSize(string id);
417 //wiki: integer llSameGroup(key agent)
418 int llSameGroup(string agent);
419 //wiki: llUnSit(key id)
420 void llUnSit(string id);
421 //wiki: vector llGroundSlope(vector offset)
422 LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset);
423 //wiki: vector llGroundNormal(vector offset)
424 LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset);
425 //wiki: vector llGroundContour(vector offset)
426 LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset);
427 //wiki: integer llGetAttached()
428 int llGetAttached();
429 //wiki: integer llGetFreeMemory()
430 int llGetFreeMemory();
431 //wiki: string llGetRegionName()
432 string llGetRegionName();
433 //wiki: double llGetRegionTimeDilation()
434 double llGetRegionTimeDilation();
435 //wiki: double llGetRegionFPS()
436 double llGetRegionFPS();
437 //wiki: llParticleSystem(List<Object> rules
438 void llParticleSystem(List<object> rules);
439 //wiki: llGroundRepel(double height, integer water, double tau)
440 void llGroundRepel(double height, int water, double tau);
441 void llGiveInventoryList();
442 //wiki: llSetVehicleType(integer type)
443 void llSetVehicleType(int type);
444 //wiki: llSetVehicledoubleParam(integer param, double value)
445 void llSetVehicledoubleParam(int param, double value);
446 //wiki: llSetVehicleVectorParam(integer param, vector vec)
447 void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec);
448 //wiki: llSetVehicleRotationParam(integer param, rotation rot)
449 void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot);
450 //wiki: llSetVehicleFlags(integer flags)
451 void llSetVehicleFlags(int flags);
452 //wiki: llRemoveVehicleFlags(integer flags)
453 void llRemoveVehicleFlags(int flags);
454 //wiki: llSitTarget(vector offset, rotation rot)
455 void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot);
456 //wiki key llAvatarOnSitTarget()
457 string llAvatarOnSitTarget();
458 //wiki: llAddToLandPassList(key avatar, double hours)
459 void llAddToLandPassList(string avatar, double hours);
460 //wiki: llSetTouchText(string text)
461 void llSetTouchText(string text);
462 //wiki: llSetSitText(string text)
463 void llSetSitText(string text);
464 //wiki: llSetCameraEyeOffset(vector offset)
465 void llSetCameraEyeOffset(LSL_Types.Vector3 offset);
466 //wiki: llSeteCameraAtOffset(vector offset)
467 void llSetCameraAtOffset(LSL_Types.Vector3 offset);
468 void llDumpList2String();
469 //wiki: integer llScriptDanger(vector pos)
470 void llScriptDanger(LSL_Types.Vector3 pos);
471 //wiki: llDialog(key avatar, string message, list buttons, integer chat_channel)
472 void llDialog(string avatar, string message, List<string> buttons, int chat_channel);
473 //wiki: llVolumeDetect(integer detect)
474 void llVolumeDetect(int detect);
475 //wiki: llResetOtherScript(string name)
476 void llResetOtherScript(string name);
477 //wiki: integer llGetScriptState(string name)
478 int llGetScriptState(string name);
479 //wiki: (deprecated)
480 void llRemoteLoadScript();
481 //wiki: llSetRemoteScriptAccessPin(integer pin)
482 void llSetRemoteScriptAccessPin(int pin);
483 //wiki: llRemoteLoadScriptPin(key target, string name, integer pin, integer running, integer start_param)
484 void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param);
485 //wiki: llOpenRemoteDataChannel()
486 void llOpenRemoteDataChannel();
487 //wiki: key llSendRemoteData(key channel, string dest, integer idata, string sdata)
488 string llSendRemoteData(string channel, string dest, int idata, string sdata);
489 //wiki: llRemoteDataReply(key channel, key message_id, string sdata, integer idata)
490 void llRemoteDataReply(string channel, string message_id, string sdata, int idata);
491 //wiki: llCloseRemoteDataChannel(key channel)
492 void llCloseRemoteDataChannel(string channel);
493 //wiki: string llMD5String(string src, integer nonce)
494 string llMD5String(string src, int nonce);
495 //wiki: llSetPrimitiveParams(list rules)
496 void llSetPrimitiveParams(List<string> rules);
497 //wiki: string llStringToBase64(string str)
498 string llStringToBase64(string str);
499 //wiki: string llBase64ToString(string str)
500 string llBase64ToString(string str);
501 //wiki: (deprecated)
502 void llXorBase64Strings();
503 //wiki: llRemoteDataSetRegion()
504 void llRemoteDataSetRegion();
505 //wiki: double llLog10(double val)
506 double llLog10(double val);
507 //wiki: double llLog(double val)
508 double llLog(double val);
509 //wiki: list llGetAnimationList(key id)
510 List<string> llGetAnimationList(string id);
511 //wiki: llSetParcelMusicURL(string url)
512 void llSetParcelMusicURL(string url);
513 //wiki: vector llGetRootPosition()
514 LSL_Types.Vector3 llGetRootPosition();
515 //wiki: rotation llGetRootRotation()
516 LSL_Types.Quaternion llGetRootRotation();
517 //wiki: string llGetObjectDesc()
518 string llGetObjectDesc();
519 //wiki: llSetObjectDesc(string desc)
520 void llSetObjectDesc(string desc);
521 //wiki: key llGetCreator()
522 string llGetCreator();
523 //wiki: string llGetTimestamp()
524 string llGetTimestamp();
525 //wiki: llSetLinkAlpha(integer linknumber, double alpha, integer face)
526 void llSetLinkAlpha(int linknumber, double alpha, int face);
527 //wiki: integer llGetNumberOfPrims()
528 int llGetNumberOfPrims();
529 //wiki: key llGetNumberOfNotecardLines(string name)
530 string llGetNumberOfNotecardLines(string name);
531 //wiki: list llGetBoundingBox(key object)
532 List<string> llGetBoundingBox(string obj);
533 //wiki: vector llGetGeometricCenter()
534 LSL_Types.Vector3 llGetGeometricCenter();
535 void llGetPrimitiveParams();
536 //wiki: string llIntegerToBase64(integer number)
537 string llIntegerToBase64(int number);
538 //wiki integer llBase64ToInteger(string str)
539 int llBase64ToInteger(string str);
540 //wiki: double llGetGMTclock()
541 double llGetGMTclock();
542 //wiki: string llGetSimulatorHostname()
543 string llGetSimulatorHostname();
544 //llSetLocalRot(rotation rot)
545 void llSetLocalRot(LSL_Types.Quaternion rot);
546 //wiki: list llParseStringKeepNulls(string src, list separators, list spacers)
547 List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers);
548 //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param)
549 void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
550 LSL_Types.Quaternion rot, int param);
551
552 //wiki: integer llGetObjectPermMask(integer mask)
553 int llGetObjectPermMask(int mask);
554 //wiki: llSetObjectPermMask(integer mask, integer value)
555 void llSetObjectPermMask(int mask, int value);
556 //wiki integer llGetInventoryPermMask(string item, integer mask)
557 void llGetInventoryPermMask(string item, int mask);
558 //wiki: llSetInventoryPermMask(string item, integer mask, integer value)
559 void llSetInventoryPermMask(string item, int mask, int value);
560 //wiki: key llGetInventoryCreator(string item)
561 string llGetInventoryCreator(string item);
562 //wiki: llOwnerSay(string msg)
563 void llOwnerSay(string msg);
564 //wiki: key llRequestSimulatorData(string simulator, integer data)
565 void llRequestSimulatorData(string simulator, int data);
566 //wiki: llForceMouselook(integer mouselook)
567 void llForceMouselook(int mouselook);
568 //wiki: double llGetObjectMass(key id)
569 double llGetObjectMass(string id);
570 void llListReplaceList();
571 //wiki: llLoadURL(key avatar_id, string message, string url)
572 void llLoadURL(string avatar_id, string message, string url);
573 //wiki: llParcelMediaCommandList(list commandList)
574 void llParcelMediaCommandList(List<string> commandList);
575 void llParcelMediaQuery();
576 //wiki integer llModPow(integer a, integer b, integer c)
577 int llModPow(int a, int b, int c);
578 //wiki: integer llGetInventoryType(string name)
579 int llGetInventoryType(string name);
580 //wiki: llSetPayPrice(integer price, list quick_pay_buttons)
581 void llSetPayPrice(int price, List<string> quick_pay_buttons);
582 //wiki: vector llGetCameraPos()
583 LSL_Types.Vector3 llGetCameraPos();
584 //wiki rotation llGetCameraRot()
585 LSL_Types.Quaternion llGetCameraRot();
586 //wiki: (deprecated)
587 void llSetPrimURL();
588 //wiki: (deprecated)
589 void llRefreshPrimURL();
590 //wiki: string llEscapeURL(string url)
591 string llEscapeURL(string url);
592 //wiki: string llUnescapeURL(string url)
593 string llUnescapeURL(string url);
594 //wiki: llMapDestination(string simname, vector pos, vector look_at)
595 void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at);
596 //wiki: llAddToLandBanList(key avatar, double hours)
597 void llAddToLandBanList(string avatar, double hours);
598 //wiki: llRemoveFromLandPassList(key avatar)
599 void llRemoveFromLandPassList(string avatar);
600 //wiki: llRemoveFromLandBanList(key avatar)
601 void llRemoveFromLandBanList(string avatar);
602 //wiki: llSetCameraParams(list rules)
603 void llSetCameraParams(List<string> rules);
604 //wiki: llClearCameraParams()
605 void llClearCameraParams();
606 //wiki: double llListStatistics(integer operation, list src)
607 double llListStatistics(int operation, List<string> src);
608 //wiki: integer llGetUnixTime()
609 int llGetUnixTime();
610 //wiki: integer llGetParcelFlags(vector pos)
611 int llGetParcelFlags(LSL_Types.Vector3 pos);
612 //wiki: integer llGetRegionFlags()
613 int llGetRegionFlags();
614 //wiki: string llXorBase64StringsCorrect(string str1, string str2)
615 string llXorBase64StringsCorrect(string str1, string str2);
616 void llHTTPRequest(string url, List<string> parameters, string body);
617 //wiki: llResetLandBanList()
618 void llResetLandBanList();
619 //wiki: llResetLandPassList()
620 void llResetLandPassList();
621 //wiki integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)
622 int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide);
623 //wiki: list llGetParcelPrimOwners(vector pos)
624 List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos);
625 //wiki: integer llGetObjectPrimCount(key object_id)
626 int llGetObjectPrimCount(string object_id);
627 //wiki: integer llGetParcelMaxPrims(vector pos, integer sim_wide)
628 int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide);
629 //wiki list llGetParcelDetails(vector pos, list params)
630 List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param);
631
632 //OpenSim functions
633 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
634 }
635}
diff --git a/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs
deleted file mode 100644
index ef46cba..0000000
--- a/OpenSim/Grid/ScriptEngine/Common/LSL_Types.cs
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Grid.ScriptEngine.Common
31{
32 [Serializable]
33 public class LSL_Types
34 {
35 [Serializable]
36 public struct Vector3
37 {
38 public double X;
39 public double Y;
40 public double Z;
41
42 public Vector3(Vector3 vector)
43 {
44 X = (float) vector.X;
45 Y = (float) vector.Y;
46 Z = (float) vector.Z;
47 }
48
49 public Vector3(double x, double y, double z)
50 {
51 X = x;
52 Y = y;
53 Z = z;
54 }
55 }
56
57 [Serializable]
58 public struct Quaternion
59 {
60 public double X;
61 public double Y;
62 public double Z;
63 public double R;
64
65 public Quaternion(Quaternion Quat)
66 {
67 X = (float) Quat.X;
68 Y = (float) Quat.Y;
69 Z = (float) Quat.Z;
70 R = (float) Quat.R;
71 }
72
73 public Quaternion(double x, double y, double z, double r)
74 {
75 X = x;
76 Y = y;
77 Z = z;
78 R = r;
79 }
80 }
81 }
82}
diff --git a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
deleted file mode 100644
index d18822c..0000000
--- a/OpenSim/Grid/ScriptEngine/Common/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OpenSim.Grid.ScriptEngine.Common")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("")]
39[assembly : AssemblyProduct("OpenSim.Grid.ScriptEngine.Common")]
40[assembly : AssemblyCopyright("Copyright (c) 2007")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61
62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs
deleted file mode 100644
index c5b5e95..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
33
34namespace OpenSim.Grid.ScriptEngine.DotNetEngine
35{
36 public class AppDomainManager
37 {
38 private int maxScriptsPerAppDomain = 1;
39
40 /// <summary>
41 /// Internal list of all AppDomains
42 /// </summary>
43 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>();
44
45 /// <summary>
46 /// Structure to keep track of data around AppDomain
47 /// </summary>
48 private class AppDomainStructure
49 {
50 /// <summary>
51 /// The AppDomain itself
52 /// </summary>
53 public AppDomain CurrentAppDomain;
54
55 /// <summary>
56 /// Number of scripts loaded into AppDomain
57 /// </summary>
58 public int ScriptsLoaded;
59
60 /// <summary>
61 /// Number of dead scripts
62 /// </summary>
63 public int ScriptsWaitingUnload;
64 }
65
66 /// <summary>
67 /// Current AppDomain
68 /// </summary>
69 private AppDomainStructure currentAD;
70
71 private object getLock = new object(); // Mutex
72 private object freeLock = new object(); // Mutex
73
74 //private ScriptEngine m_scriptEngine;
75 //public AppDomainManager(ScriptEngine scriptEngine)
76 public AppDomainManager()
77 {
78 //m_scriptEngine = scriptEngine;
79 }
80
81 /// <summary>
82 /// Find a free AppDomain, creating one if necessary
83 /// </summary>
84 /// <returns>Free AppDomain</returns>
85 private AppDomainStructure GetFreeAppDomain()
86 {
87 Console.WriteLine("Finding free AppDomain");
88 lock (getLock)
89 {
90 // Current full?
91 if (currentAD != null && currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
92 {
93 // Add it to AppDomains list and empty current
94 appDomains.Add(currentAD);
95 currentAD = null;
96 }
97 // No current
98 if (currentAD == null)
99 {
100 // Create a new current AppDomain
101 currentAD = new AppDomainStructure();
102 currentAD.CurrentAppDomain = PrepareNewAppDomain();
103 }
104
105 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded);
106 return currentAD;
107 }
108 }
109
110 private int AppDomainNameCount;
111
112 /// <summary>
113 /// Create and prepare a new AppDomain for scripts
114 /// </summary>
115 /// <returns>The new AppDomain</returns>
116 private AppDomain PrepareNewAppDomain()
117 {
118 // Create and prepare a new AppDomain
119 AppDomainNameCount++;
120 // TODO: Currently security match current appdomain
121
122 // Construct and initialize settings for a second AppDomain.
123 AppDomainSetup ads = new AppDomainSetup();
124 ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
125 ads.DisallowBindingRedirects = false;
126 ads.DisallowCodeDownload = true;
127 ads.LoaderOptimization = LoaderOptimization.MultiDomain; // Sounds good ;)
128 ads.ShadowCopyFiles = "true"; // Enabled shadowing
129 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
130
131 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads);
132 Console.WriteLine("Loading: " +
133 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
134 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll"));
135
136 // Return the new AppDomain
137 return AD;
138 }
139
140 /// <summary>
141 /// Unload appdomains that are full and have only dead scripts
142 /// </summary>
143 private void UnloadAppDomains()
144 {
145 lock (freeLock)
146 {
147 // Go through all
148 foreach (AppDomainStructure ads in new ArrayList(appDomains))
149 {
150 // Don't process current AppDomain
151 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
152 {
153 // Not current AppDomain
154 // Is number of unloaded bigger or equal to number of loaded?
155 if (ads.ScriptsLoaded <= ads.ScriptsWaitingUnload)
156 {
157 Console.WriteLine("Found empty AppDomain, unloading");
158 // Remove from internal list
159 appDomains.Remove(ads);
160#if DEBUG
161 long m = GC.GetTotalMemory(true);
162#endif
163 // Unload
164 AppDomain.Unload(ads.CurrentAppDomain);
165#if DEBUG
166 Console.WriteLine("AppDomain unload freed " + (m - GC.GetTotalMemory(true)) +
167 " bytes of memory");
168#endif
169 }
170 }
171 }
172 }
173 }
174
175 public LSL_BaseClass LoadScript(string FileName)
176 {
177 // Find next available AppDomain to put it in
178 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
179
180 Console.WriteLine("Loading into AppDomain: " + FileName);
181 LSL_BaseClass mbrt =
182 (LSL_BaseClass)
183 FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
184 //Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt));
185 FreeAppDomain.ScriptsLoaded++;
186
187 return mbrt;
188 }
189
190 /// <summary>
191 /// Increase "dead script" counter for an AppDomain
192 /// </summary>
193 /// <param name="ad"></param>
194 //[Obsolete("Needs fixing, needs a real purpose in life!!!")]
195 public void StopScript(AppDomain ad)
196 {
197 lock (freeLock)
198 {
199 Console.WriteLine("Stopping script in AppDomain");
200 // Check if it is current AppDomain
201 if (currentAD.CurrentAppDomain == ad)
202 {
203 // Yes - increase
204 currentAD.ScriptsWaitingUnload++;
205 return;
206 }
207
208 // Lopp through all AppDomains
209 foreach (AppDomainStructure ads in new ArrayList(appDomains))
210 {
211 if (ads.CurrentAppDomain == ad)
212 {
213 // Found it
214 ads.ScriptsWaitingUnload++;
215 break;
216 }
217 }
218 }
219
220 UnloadAppDomains(); // Outsite lock, has its own GetLock
221 }
222 }
223}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs
deleted file mode 100644
index 444c2e8..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Common.cs
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29
30namespace OpenSim.Grid.ScriptEngine.DotNetEngine
31{
32 public static class Common
33 {
34 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
35
36 public static bool debug = true;
37 public static ScriptEngine mySE;
38
39 //public delegate void SendToDebugEventDelegate(string Message);
40 //public delegate void SendToLogEventDelegate(string Message);
41 //static public event SendToDebugEventDelegate SendToDebugEvent;
42 //static public event SendToLogEventDelegate SendToLogEvent;
43
44 public static void SendToDebug(string Message)
45 {
46 //if (Debug == true)
47 mySE.m_log.Info("[ScriptEngine]: Debug: " + Message);
48 //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
49 }
50
51 public static void SendToLog(string Message)
52 {
53 //if (Debug == true)
54 mySE.m_log.Info("[ScriptEngine]: LOG: " + Message);
55 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
56 }
57 }
58}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
deleted file mode 100644
index 353d59e..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.CodeDom.Compiler;
30using System.IO;
31using System.Reflection;
32using Microsoft.CSharp;
33
34namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL
35{
36 public class Compiler
37 {
38 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
39 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
40 private static UInt64 scriptCompileCounter = 0;
41 //private ICodeCompiler icc = codeProvider.CreateCompiler();
42 public string CompileFromFile(string LSOFileName)
43 {
44 switch (Path.GetExtension(LSOFileName).ToLower())
45 {
46 case ".txt":
47 case ".lsl":
48 Common.SendToDebug("Source code is LSL, converting to CS");
49 return CompileFromLSLText(File.ReadAllText(LSOFileName));
50 case ".cs":
51 Common.SendToDebug("Source code is CS");
52 return CompileFromCSText(File.ReadAllText(LSOFileName));
53 default:
54 throw new Exception("Unknown script type.");
55 }
56 }
57
58 /// <summary>
59 /// Converts script from LSL to CS and calls CompileFromCSText
60 /// </summary>
61 /// <param name="Script">LSL script</param>
62 /// <returns>Filename to .dll assembly</returns>
63 public string CompileFromLSLText(string Script)
64 {
65 if (Script.Substring(0, 4).ToLower() == "//c#")
66 {
67 return CompileFromCSText(Script);
68 }
69 else
70 {
71 return CompileFromCSText(LSL_Converter.Convert(Script));
72 }
73 }
74
75 /// <summary>
76 /// Compile CS script to .Net assembly (.dll)
77 /// </summary>
78 /// <param name="Script">CS script</param>
79 /// <returns>Filename to .dll assembly</returns>
80 public string CompileFromCSText(string Script)
81 {
82 // Output assembly name
83 scriptCompileCounter++;
84 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
85 try
86 {
87 File.Delete(OutFile);
88 }
89 catch (Exception e)
90 {
91 Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString());
92 }
93 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
94
95 // DEBUG - write source to disk
96 try
97 {
98 File.WriteAllText(
99 Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script);
100 }
101 catch
102 {
103 }
104
105 // Do actual compile
106 CompilerParameters parameters = new CompilerParameters();
107 parameters.IncludeDebugInformation = true;
108 // Add all available assemblies
109 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
110 {
111 //Console.WriteLine("Adding assembly: " + asm.Location);
112 //parameters.ReferencedAssemblies.Add(asm.Location);
113 }
114
115 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
116 string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
117 //Console.WriteLine("Assembly location: " + rootPath);
118 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
119 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Grid.ScriptEngine.DotNetEngine.dll"));
120
121 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
122 parameters.GenerateExecutable = false;
123 parameters.OutputAssembly = OutFile;
124 parameters.IncludeDebugInformation = false;
125 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script);
126
127 // Go through errors
128 // TODO: Return errors to user somehow
129 if (results.Errors.Count > 0)
130 {
131 string errtext = "";
132 foreach (CompilerError CompErr in results.Errors)
133 {
134 errtext += "Line number " + (CompErr.Line - 1) +
135 ", Error Number: " + CompErr.ErrorNumber +
136 ", '" + CompErr.ErrorText + "'\r\n";
137 }
138 throw new Exception(errtext);
139 }
140
141 return OutFile;
142 }
143 }
144}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
deleted file mode 100644
index 639cd54..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ /dev/null
@@ -1,314 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using System.Text.RegularExpressions;
30
31namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL
32{
33 public class LSL2CSConverter
34 {
35 //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled);
36 private Dictionary<string, string> dataTypes = new Dictionary<string, string>();
37 private Dictionary<string, string> quotes = new Dictionary<string, string>();
38
39 public LSL2CSConverter()
40 {
41 // Only the types we need to convert
42 dataTypes.Add("void", "void");
43 dataTypes.Add("integer", "int");
44 dataTypes.Add("float", "double");
45 dataTypes.Add("string", "string");
46 dataTypes.Add("key", "string");
47 dataTypes.Add("vector", "LSL_Types.Vector3");
48 dataTypes.Add("rotation", "LSL_Types.Quaternion");
49 dataTypes.Add("list", "list");
50 dataTypes.Add("null", "null");
51 }
52
53 public string Convert(string Script)
54 {
55 string Return = "";
56 Script = " \r\n" + Script;
57
58 //
59 // Prepare script for processing
60 //
61
62 // Clean up linebreaks
63 Script = Regex.Replace(Script, @"\r\n", "\n");
64 Script = Regex.Replace(Script, @"\n", "\r\n");
65
66
67 // QUOTE REPLACEMENT
68 // temporarily replace quotes so we can work our magic on the script without
69 // always considering if we are inside our outside ""'s
70 string _Script = "";
71 string C;
72 bool in_quote = false;
73 bool quote_replaced = false;
74 string quote_replacement_string = "Q_U_O_T_E_REPLACEMENT_";
75 string quote = "";
76 bool last_was_escape = false;
77 int quote_replaced_count = 0;
78 for (int p = 0; p < Script.Length; p++)
79 {
80 C = Script.Substring(p, 1);
81 while (true)
82 {
83 // found " and last was not \ so this is not an escaped \"
84 if (C == "\"" && last_was_escape == false)
85 {
86 // Toggle inside/outside quote
87 in_quote = !in_quote;
88 if (in_quote)
89 {
90 quote_replaced_count++;
91 }
92 else
93 {
94 if (quote == "")
95 {
96 // We didn't replace quote, probably because of empty string?
97 _Script += quote_replacement_string +
98 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
99 }
100 // We just left a quote
101 quotes.Add(
102 quote_replacement_string +
103 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
104 quote = "";
105 }
106 break;
107 }
108
109 if (!in_quote)
110 {
111 // We are not inside a quote
112 quote_replaced = false;
113 }
114 else
115 {
116 // We are inside a quote
117 if (!quote_replaced)
118 {
119 // Replace quote
120 _Script += quote_replacement_string +
121 quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
122 quote_replaced = true;
123 }
124 quote += C;
125 break;
126 }
127 _Script += C;
128 break;
129 }
130 last_was_escape = false;
131 if (C == @"\")
132 {
133 last_was_escape = true;
134 }
135 }
136 Script = _Script;
137 //
138 // END OF QUOTE REPLACEMENT
139 //
140
141 //
142 // PROCESS STATES
143 // Remove state definitions and add state names to start of each event within state
144 //
145 int ilevel = 0;
146 int lastlevel = 0;
147 string ret = "";
148 string cache = "";
149 bool in_state = false;
150 string current_statename = "";
151 for (int p = 0; p < Script.Length; p++)
152 {
153 C = Script.Substring(p, 1);
154 while (true)
155 {
156 // inc / dec level
157 if (C == @"{")
158 ilevel++;
159 if (C == @"}")
160 ilevel--;
161 if (ilevel < 0)
162 ilevel = 0;
163 cache += C;
164
165 // if level == 0, add to return
166 if (ilevel == 1 && lastlevel == 0)
167 {
168 // 0 => 1: Get last
169 Match m =
170 Regex.Match(cache, @"(?![a-zA-Z_]+)\s*([a-zA-Z_]+)[^a-zA-Z_\(\)]*{",
171 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
172
173 in_state = false;
174 if (m.Success)
175 {
176 // Go back to level 0, this is not a state
177 in_state = true;
178 current_statename = m.Groups[1].Captures[0].Value;
179 //Console.WriteLine("Current statename: " + current_statename);
180 cache =
181 Regex.Replace(cache,
182 @"(?<s1>(?![a-zA-Z_]+)\s*)" + @"([a-zA-Z_]+)(?<s2>[^a-zA-Z_\(\)]*){",
183 "${s1}${s2}",
184 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
185 }
186 ret += cache;
187 cache = "";
188 }
189 if (ilevel == 0 && lastlevel == 1)
190 {
191 // 1 => 0: Remove last }
192 if (in_state == true)
193 {
194 cache = cache.Remove(cache.Length - 1, 1);
195 //cache = Regex.Replace(cache, "}$", "", RegexOptions.Multiline | RegexOptions.Singleline);
196
197 //Replace function names
198 // void dataserver(key query_id, string data) {
199 //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
200 //Console.WriteLine("Replacing using statename: " + current_statename);
201 cache =
202 Regex.Replace(cache,
203 @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)",
204 @"$1public " + current_statename + "_event_$2",
205 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
206 }
207
208 ret += cache;
209 cache = "";
210 in_state = true;
211 current_statename = "";
212 }
213
214 break;
215 }
216 lastlevel = ilevel;
217 }
218 ret += cache;
219 cache = "";
220
221 Script = ret;
222 ret = "";
223
224
225 foreach (string key in dataTypes.Keys)
226 {
227 string val;
228 dataTypes.TryGetValue(key, out val);
229
230 // Replace CAST - (integer) with (int)
231 Script =
232 Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")",
233 RegexOptions.Compiled | RegexOptions.Multiline);
234 // Replace return types and function variables - integer a() and f(integer a, integer a)
235 Script =
236 Regex.Replace(Script, @"(^|;|}|[\(,])(\s*)" + key + @"(\s*)", @"$1$2" + val + "$3",
237 RegexOptions.Compiled | RegexOptions.Multiline);
238 }
239
240 // Add "void" in front of functions that needs it
241 Script =
242 Regex.Replace(Script,
243 @"^(\s*public\s+)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)",
244 @"$1void $2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
245
246 // Replace <x,y,z> and <x,y,z,r>
247 Script =
248 Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Quaternion($1)",
249 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
250 Script =
251 Regex.Replace(Script, @"<([^,>]*,[^,>]*,[^,>]*)>", @"new LSL_Types.Vector3($1)",
252 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
253
254 // Replace List []'s
255 Script =
256 Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)",
257 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
258
259
260 // Replace (string) to .ToString() //
261 Script =
262 Regex.Replace(Script, @"\(string\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.ToString()",
263 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
264 Script =
265 Regex.Replace(Script, @"\((float|int)\)\s*([a-zA-Z0-9_]+(\s*\([^\)]*\))?)", @"$1.Parse($2)",
266 RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
267
268
269 // REPLACE BACK QUOTES
270 foreach (string key in quotes.Keys)
271 {
272 string val;
273 quotes.TryGetValue(key, out val);
274 Script = Script.Replace(key, "\"" + val + "\"");
275 }
276
277
278 // Add namespace, class name and inheritance
279
280 Return = "" +
281 "using OpenSim.Region.ScriptEngine.Common;";
282 //"using System; " +
283 //"using System.Collections.Generic; " +
284 //"using System.Text; " +
285 //"using OpenSim.Region.ScriptEngine.Common; " +
286 //"using integer = System.Int32; " +
287 //"using key = System.String; ";
288
289 //// Make a Using out of DataTypes
290 //// Using integer = System.Int32;
291 //string _val;
292 //foreach (string key in DataTypes.Keys)
293 //{
294 // DataTypes.TryGetValue(key, out _val);
295 // if (key != _val)
296 // {
297 // Return += "using " + key + " = " + _val + "; ";
298 // }
299 //}
300
301
302 Return += "" +
303 "namespace SecondLife { ";
304 Return += "" +
305 //"[Serializable] " +
306 "public class Script : OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { ";
307 Return += @"public Script() { } ";
308 Return += Script;
309 Return += "} }\r\n";
310
311 return Return;
312 }
313 }
314}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
deleted file mode 100644
index be22484..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ /dev/null
@@ -1,2128 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Runtime.Remoting.Lifetime;
31using System.Threading;
32using OpenSim.Region.ScriptEngine.Common;
33using integer = System.Int32;
34using key = System.String;
35using vector = OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3;
36using rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion;
37
38namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL
39{
40 //[Serializable]
41 public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
42 {
43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44
45 // Object never expires
46 public override Object InitializeLifetimeService()
47 {
48 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()");
49 // return null;
50 ILease lease = (ILease) base.InitializeLifetimeService();
51
52 if (lease.CurrentState == LeaseState.Initial)
53 {
54 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
55 //lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
56 //lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
57 }
58 return lease;
59 }
60
61
62 private Executor m_Exec;
63
64 public Executor Exec
65 {
66 get
67 {
68 if (m_Exec == null)
69 m_Exec = new Executor(this);
70 return m_Exec;
71 }
72 }
73
74 public LSL_BuiltIn_Commands_Interface m_LSL_Functions;
75 public string SourceCode = "";
76
77 public LSL_BaseClass()
78 {
79 }
80
81 public string State()
82 {
83 return m_LSL_Functions.State();
84 }
85
86
87 public void Start(LSL_BuiltIn_Commands_Interface LSL_Functions)
88 {
89 m_LSL_Functions = LSL_Functions;
90
91 //m_log.Info("[ScriptEngine]: LSL_BaseClass.Start() called.");
92
93 // Get this AppDomain's settings and display some of them.
94 AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation;
95 Console.WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}",
96 ads.ApplicationName,
97 ads.ApplicationBase,
98 ads.ConfigurationFile
99 );
100
101 // Display the name of the calling AppDomain and the name
102 // of the second domain.
103 // NOTE: The application's thread has transitioned between
104 // AppDomains.
105 Console.WriteLine("Calling to '{0}'.",
106 Thread.GetDomain().FriendlyName
107 );
108
109 return;
110 }
111
112
113 //
114 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
115 //
116 // They are only forwarders to LSL_BuiltIn_Commands.cs
117 //
118 public double llSin(double f)
119 {
120 return m_LSL_Functions.llSin(f);
121 }
122
123 public double llCos(double f)
124 {
125 return m_LSL_Functions.llCos(f);
126 }
127
128 public double llTan(double f)
129 {
130 return m_LSL_Functions.llTan(f);
131 }
132
133 public double llAtan2(double x, double y)
134 {
135 return m_LSL_Functions.llAtan2(x, y);
136 }
137
138 public double llSqrt(double f)
139 {
140 return m_LSL_Functions.llSqrt(f);
141 }
142
143 public double llPow(double fbase, double fexponent)
144 {
145 return m_LSL_Functions.llPow(fbase, fexponent);
146 }
147
148 public int llAbs(int i)
149 {
150 return m_LSL_Functions.llAbs(i);
151 }
152
153 public double llFabs(double f)
154 {
155 return m_LSL_Functions.llFabs(f);
156 }
157
158 public double llFrand(double mag)
159 {
160 return m_LSL_Functions.llFrand(mag);
161 }
162
163 public int llFloor(double f)
164 {
165 return m_LSL_Functions.llFloor(f);
166 }
167
168 public int llCeil(double f)
169 {
170 return m_LSL_Functions.llCeil(f);
171 }
172
173 public int llRound(double f)
174 {
175 return m_LSL_Functions.llRound(f);
176 }
177
178 public double llVecMag(vector v)
179 {
180 return m_LSL_Functions.llVecMag(v);
181 }
182
183 public vector llVecNorm(vector v)
184 {
185 return m_LSL_Functions.llVecNorm(v);
186 }
187
188 public double llVecDist(vector a, vector b)
189 {
190 return m_LSL_Functions.llVecDist(a, b);
191 }
192
193 public vector llRot2Euler(rotation r)
194 {
195 return m_LSL_Functions.llRot2Euler(r);
196 }
197
198 public rotation llEuler2Rot(vector v)
199 {
200 return m_LSL_Functions.llEuler2Rot(v);
201 }
202
203 public rotation llAxes2Rot(vector fwd, vector left, vector up)
204 {
205 return m_LSL_Functions.llAxes2Rot(fwd, left, up);
206 }
207
208 public vector llRot2Fwd(rotation r)
209 {
210 return m_LSL_Functions.llRot2Fwd(r);
211 }
212
213 public vector llRot2Left(rotation r)
214 {
215 return m_LSL_Functions.llRot2Left(r);
216 }
217
218 public vector llRot2Up(rotation r)
219 {
220 return m_LSL_Functions.llRot2Up(r);
221 }
222
223 public rotation llRotBetween(vector start, vector end)
224 {
225 return m_LSL_Functions.llRotBetween(start, end);
226 }
227
228 public void llWhisper(int channelID, string text)
229 {
230 m_LSL_Functions.llWhisper(channelID, text);
231 }
232
233 public void llSay(int channelID, string text)
234 {
235 m_LSL_Functions.llSay(channelID, text);
236 }
237
238 //
239 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
240 //
241 public void llShout(int channelID, string text)
242 {
243 m_LSL_Functions.llShout(channelID, text);
244 }
245
246 public void llOwnerSay(string msg)
247 {
248 m_LSL_Functions.llOwnerSay(msg);
249 }
250
251 public int llListen(int channelID, string name, string ID, string msg)
252 {
253 return m_LSL_Functions.llListen(channelID, name, ID, msg);
254 }
255
256 public void llListenControl(int number, int active)
257 {
258 m_LSL_Functions.llListenControl(number, active);
259 }
260
261 public void llListenRemove(int number)
262 {
263 m_LSL_Functions.llListenRemove(number);
264 }
265
266 public void llSensor(string name, string id, int type, double range, double arc)
267 {
268 m_LSL_Functions.llSensor(name, id, type, range, arc);
269 }
270
271 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
272 {
273 m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate);
274 }
275
276 public void llSensorRemove()
277 {
278 m_LSL_Functions.llSensorRemove();
279 }
280
281 public string llDetectedName(int number)
282 {
283 return m_LSL_Functions.llDetectedName(number);
284 }
285
286 public string llDetectedKey(int number)
287 {
288 return m_LSL_Functions.llDetectedKey(number);
289 }
290
291 public string llDetectedOwner(int number)
292 {
293 return m_LSL_Functions.llDetectedOwner(number);
294 }
295
296 public int llDetectedType(int number)
297 {
298 return m_LSL_Functions.llDetectedType(number);
299 }
300
301 public vector llDetectedPos(int number)
302 {
303 return m_LSL_Functions.llDetectedPos(number);
304 }
305
306 public vector llDetectedVel(int number)
307 {
308 return m_LSL_Functions.llDetectedVel(number);
309 }
310
311 public vector llDetectedGrab(int number)
312 {
313 return m_LSL_Functions.llDetectedGrab(number);
314 }
315
316 public rotation llDetectedRot(int number)
317 {
318 return m_LSL_Functions.llDetectedRot(number);
319 }
320
321 public int llDetectedGroup(int number)
322 {
323 return m_LSL_Functions.llDetectedGroup(number);
324 }
325
326 public int llDetectedLinkNumber(int number)
327 {
328 return m_LSL_Functions.llDetectedLinkNumber(number);
329 }
330
331 //
332 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
333 //
334 public void llDie()
335 {
336 m_LSL_Functions.llDie();
337 }
338
339 public double llGround(vector offset)
340 {
341 return m_LSL_Functions.llGround(offset);
342 }
343
344 public double llCloud(vector offset)
345 {
346 return m_LSL_Functions.llCloud(offset);
347 }
348
349 public vector llWind(vector offset)
350 {
351 return m_LSL_Functions.llWind(offset);
352 }
353
354 public void llSetStatus(int status, int value)
355 {
356 m_LSL_Functions.llSetStatus(status, value);
357 }
358
359 public int llGetStatus(int status)
360 {
361 return m_LSL_Functions.llGetStatus(status);
362 }
363
364 public void llSetScale(vector scale)
365 {
366 m_LSL_Functions.llSetScale(scale);
367 }
368
369 public vector llGetScale()
370 {
371 return m_LSL_Functions.llGetScale();
372 }
373
374 public void llSetColor(vector color, int face)
375 {
376 m_LSL_Functions.llSetColor(color, face);
377 }
378
379 public double llGetAlpha(int face)
380 {
381 return m_LSL_Functions.llGetAlpha(face);
382 }
383
384 public void llSetAlpha(double alpha, int face)
385 {
386 m_LSL_Functions.llSetAlpha(alpha, face);
387 }
388
389 public vector llGetColor(int face)
390 {
391 return m_LSL_Functions.llGetColor(face);
392 }
393
394 public void llSetTexture(string texture, int face)
395 {
396 m_LSL_Functions.llSetTexture(texture, face);
397 }
398
399 public void llScaleTexture(double u, double v, int face)
400 {
401 m_LSL_Functions.llScaleTexture(u, v, face);
402 }
403
404 public void llOffsetTexture(double u, double v, int face)
405 {
406 m_LSL_Functions.llOffsetTexture(u, v, face);
407 }
408
409 public void llRotateTexture(double rotation, int face)
410 {
411 m_LSL_Functions.llRotateTexture(rotation, face);
412 }
413
414 public string llGetTexture(int face)
415 {
416 return m_LSL_Functions.llGetTexture(face);
417 }
418
419 //
420 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
421 //
422 public void llSetPos(vector pos)
423 {
424 m_LSL_Functions.llSetPos(pos);
425 }
426
427 public vector llGetPos()
428 {
429 return m_LSL_Functions.llGetPos();
430 }
431
432 public vector llGetLocalPos()
433 {
434 return m_LSL_Functions.llGetLocalPos();
435 }
436
437 public void llSetRot(rotation rot)
438 {
439 m_LSL_Functions.llSetRot(rot);
440 }
441
442 public rotation llGetRot()
443 {
444 return m_LSL_Functions.llGetRot();
445 }
446
447 public rotation llGetLocalRot()
448 {
449 return m_LSL_Functions.llGetLocalRot();
450 }
451
452 public void llSetForce(vector force, int local)
453 {
454 m_LSL_Functions.llSetForce(force, local);
455 }
456
457 public vector llGetForce()
458 {
459 return m_LSL_Functions.llGetForce();
460 }
461
462 public int llTarget(vector position, double range)
463 {
464 return m_LSL_Functions.llTarget(position, range);
465 }
466
467 public void llTargetRemove(int number)
468 {
469 m_LSL_Functions.llTargetRemove(number);
470 }
471
472 public int llRotTarget(rotation rot, double error)
473 {
474 return m_LSL_Functions.llRotTarget(rot, error);
475 }
476
477 public void llRotTargetRemove(int number)
478 {
479 m_LSL_Functions.llRotTargetRemove(number);
480 }
481
482 public void llMoveToTarget(vector target, double tau)
483 {
484 m_LSL_Functions.llMoveToTarget(target, tau);
485 }
486
487 public void llStopMoveToTarget()
488 {
489 m_LSL_Functions.llStopMoveToTarget();
490 }
491
492 public void llApplyImpulse(vector force, int local)
493 {
494 m_LSL_Functions.llApplyImpulse(force, local);
495 }
496
497 //
498 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
499 //
500 public void llApplyRotationalImpulse(vector force, int local)
501 {
502 m_LSL_Functions.llApplyRotationalImpulse(force, local);
503 }
504
505 public void llSetTorque(vector torque, int local)
506 {
507 m_LSL_Functions.llSetTorque(torque, local);
508 }
509
510 public vector llGetTorque()
511 {
512 return m_LSL_Functions.llGetTorque();
513 }
514
515 public void llSetForceAndTorque(vector force, vector torque, int local)
516 {
517 m_LSL_Functions.llSetForceAndTorque(force, torque, local);
518 }
519
520 public vector llGetVel()
521 {
522 return m_LSL_Functions.llGetVel();
523 }
524
525 public vector llGetAccel()
526 {
527 return m_LSL_Functions.llGetAccel();
528 }
529
530 public vector llGetOmega()
531 {
532 return m_LSL_Functions.llGetOmega();
533 }
534
535 public double llGetTimeOfDay()
536 {
537 return m_LSL_Functions.llGetTimeOfDay();
538 }
539
540 public double llGetWallclock()
541 {
542 return m_LSL_Functions.llGetWallclock();
543 }
544
545 public double llGetTime()
546 {
547 return m_LSL_Functions.llGetTime();
548 }
549
550 public void llResetTime()
551 {
552 m_LSL_Functions.llResetTime();
553 }
554
555 public double llGetAndResetTime()
556 {
557 return m_LSL_Functions.llGetAndResetTime();
558 }
559
560 public void llSound()
561 {
562 m_LSL_Functions.llSound();
563 }
564
565 public void llPlaySound(string sound, double volume)
566 {
567 m_LSL_Functions.llPlaySound(sound, volume);
568 }
569
570 public void llLoopSound(string sound, double volume)
571 {
572 m_LSL_Functions.llLoopSound(sound, volume);
573 }
574
575 public void llLoopSoundMaster(string sound, double volume)
576 {
577 m_LSL_Functions.llLoopSoundMaster(sound, volume);
578 }
579
580 public void llLoopSoundSlave(string sound, double volume)
581 {
582 m_LSL_Functions.llLoopSoundSlave(sound, volume);
583 }
584
585 public void llPlaySoundSlave(string sound, double volume)
586 {
587 m_LSL_Functions.llPlaySoundSlave(sound, volume);
588 }
589
590 //
591 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
592 //
593 public void llTriggerSound(string sound, double volume)
594 {
595 m_LSL_Functions.llTriggerSound(sound, volume);
596 }
597
598 public void llStopSound()
599 {
600 m_LSL_Functions.llStopSound();
601 }
602
603 public void llPreloadSound(string sound)
604 {
605 m_LSL_Functions.llPreloadSound(sound);
606 }
607
608 public string llGetSubString(string src, int start, int end)
609 {
610 return m_LSL_Functions.llGetSubString(src, start, end);
611 }
612
613 public string llDeleteSubString(string src, int start, int end)
614 {
615 return m_LSL_Functions.llDeleteSubString(src, start, end);
616 }
617
618 public string llInsertString(string dst, int position, string src)
619 {
620 return m_LSL_Functions.llInsertString(dst, position, src);
621 }
622
623 public string llToUpper(string source)
624 {
625 return m_LSL_Functions.llToUpper(source);
626 }
627
628 public string llToLower(string source)
629 {
630 return m_LSL_Functions.llToLower(source);
631 }
632
633 public int llGiveMoney(string destination, int amount)
634 {
635 return m_LSL_Functions.llGiveMoney(destination, amount);
636 }
637
638 public void llMakeExplosion()
639 {
640 m_LSL_Functions.llMakeExplosion();
641 }
642
643 public void llMakeFountain()
644 {
645 m_LSL_Functions.llMakeFountain();
646 }
647
648 public void llMakeSmoke()
649 {
650 m_LSL_Functions.llMakeSmoke();
651 }
652
653 public void llMakeFire()
654 {
655 m_LSL_Functions.llMakeFire();
656 }
657
658 public void llRezObject(string inventory, vector pos, rotation rot, int param)
659 {
660 m_LSL_Functions.llRezObject(inventory, pos, rot, param);
661 }
662
663 public void llLookAt(vector target, double strength, double damping)
664 {
665 m_LSL_Functions.llLookAt(target, strength, damping);
666 }
667
668 public void llStopLookAt()
669 {
670 m_LSL_Functions.llStopLookAt();
671 }
672
673 public void llSetTimerEvent(double sec)
674 {
675 m_LSL_Functions.llSetTimerEvent(sec);
676 }
677
678 public void llSleep(double sec)
679 {
680 m_LSL_Functions.llSleep(sec);
681 }
682
683 //
684 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
685 //
686 public double llGetMass()
687 {
688 return m_LSL_Functions.llGetMass();
689 }
690
691 public void llCollisionFilter(string name, string id, int accept)
692 {
693 m_LSL_Functions.llCollisionFilter(name, id, accept);
694 }
695
696 public void llTakeControls(int controls, int accept, int pass_on)
697 {
698 m_LSL_Functions.llTakeControls(controls, accept, pass_on);
699 }
700
701 public void llReleaseControls()
702 {
703 m_LSL_Functions.llReleaseControls();
704 }
705
706 public void llAttachToAvatar(int attachment)
707 {
708 m_LSL_Functions.llAttachToAvatar(attachment);
709 }
710
711 public void llDetachFromAvatar()
712 {
713 m_LSL_Functions.llDetachFromAvatar();
714 }
715
716 public void llTakeCamera()
717 {
718 m_LSL_Functions.llTakeCamera();
719 }
720
721 public void llReleaseCamera()
722 {
723 m_LSL_Functions.llReleaseCamera();
724 }
725
726 public string llGetOwner()
727 {
728 return m_LSL_Functions.llGetOwner();
729 }
730
731 public void llInstantMessage(string user, string message)
732 {
733 m_LSL_Functions.llInstantMessage(user, message);
734 }
735
736 public void llEmail(string address, string subject, string message)
737 {
738 m_LSL_Functions.llEmail(address, subject, message);
739 }
740
741 public void llGetNextEmail(string address, string subject)
742 {
743 m_LSL_Functions.llGetNextEmail(address, subject);
744 }
745
746 public string llGetKey()
747 {
748 return m_LSL_Functions.llGetKey();
749 }
750
751 public void llSetBuoyancy(double buoyancy)
752 {
753 m_LSL_Functions.llSetBuoyancy(buoyancy);
754 }
755
756 public void llSetHoverHeight(double height, int water, double tau)
757 {
758 m_LSL_Functions.llSetHoverHeight(height, water, tau);
759 }
760
761 public void llStopHover()
762 {
763 m_LSL_Functions.llStopHover();
764 }
765
766 public void llMinEventDelay(double delay)
767 {
768 m_LSL_Functions.llMinEventDelay(delay);
769 }
770
771 public void llSoundPreload()
772 {
773 m_LSL_Functions.llSoundPreload();
774 }
775
776 public void llRotLookAt(rotation target, double strength, double damping)
777 {
778 m_LSL_Functions.llRotLookAt(target, strength, damping);
779 }
780
781 //
782 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
783 //
784 public int llStringLength(string str)
785 {
786 return m_LSL_Functions.llStringLength(str);
787 }
788
789 public void llStartAnimation(string anim)
790 {
791 m_LSL_Functions.llStartAnimation(anim);
792 }
793
794 public void llStopAnimation(string anim)
795 {
796 m_LSL_Functions.llStopAnimation(anim);
797 }
798
799 public void llPointAt()
800 {
801 m_LSL_Functions.llPointAt();
802 }
803
804 public void llStopPointAt()
805 {
806 m_LSL_Functions.llStopPointAt();
807 }
808
809 public void llTargetOmega(vector axis, double spinrate, double gain)
810 {
811 m_LSL_Functions.llTargetOmega(axis, spinrate, gain);
812 }
813
814 public int llGetStartParameter()
815 {
816 return m_LSL_Functions.llGetStartParameter();
817 }
818
819 public void llGodLikeRezObject(string inventory, vector pos)
820 {
821 m_LSL_Functions.llGodLikeRezObject(inventory, pos);
822 }
823
824 public void llRequestPermissions(string agent, int perm)
825 {
826 m_LSL_Functions.llRequestPermissions(agent, perm);
827 }
828
829 public string llGetPermissionsKey()
830 {
831 return m_LSL_Functions.llGetPermissionsKey();
832 }
833
834 public int llGetPermissions()
835 {
836 return m_LSL_Functions.llGetPermissions();
837 }
838
839 public int llGetLinkNumber()
840 {
841 return m_LSL_Functions.llGetLinkNumber();
842 }
843
844 public void llSetLinkColor(int linknumber, vector color, int face)
845 {
846 m_LSL_Functions.llSetLinkColor(linknumber, color, face);
847 }
848
849 public void llCreateLink(string target, int parent)
850 {
851 m_LSL_Functions.llCreateLink(target, parent);
852 }
853
854 public void llBreakLink(int linknum)
855 {
856 m_LSL_Functions.llBreakLink(linknum);
857 }
858
859 public void llBreakAllLinks()
860 {
861 m_LSL_Functions.llBreakAllLinks();
862 }
863
864 public string llGetLinkKey(int linknum)
865 {
866 return m_LSL_Functions.llGetLinkKey(linknum);
867 }
868
869 public void llGetLinkName(int linknum)
870 {
871 m_LSL_Functions.llGetLinkName(linknum);
872 }
873
874 public int llGetInventoryNumber(int type)
875 {
876 return m_LSL_Functions.llGetInventoryNumber(type);
877 }
878
879 public string llGetInventoryName(int type, int number)
880 {
881 return m_LSL_Functions.llGetInventoryName(type, number);
882 }
883
884 //
885 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
886 //
887 public void llSetScriptState(string name, int run)
888 {
889 m_LSL_Functions.llSetScriptState(name, run);
890 }
891
892 public double llGetEnergy()
893 {
894 return m_LSL_Functions.llGetEnergy();
895 }
896
897 public void llGiveInventory(string destination, string inventory)
898 {
899 m_LSL_Functions.llGiveInventory(destination, inventory);
900 }
901
902 public void llRemoveInventory(string item)
903 {
904 m_LSL_Functions.llRemoveInventory(item);
905 }
906
907 public void llSetText(string text, vector color, double alpha)
908 {
909 m_LSL_Functions.llSetText(text, color, alpha);
910 }
911
912 public double llWater(vector offset)
913 {
914 return m_LSL_Functions.llWater(offset);
915 }
916
917 public void llPassTouches(int pass)
918 {
919 m_LSL_Functions.llPassTouches(pass);
920 }
921
922 public string llRequestAgentData(string id, int data)
923 {
924 return m_LSL_Functions.llRequestAgentData(id, data);
925 }
926
927 public string llRequestInventoryData(string name)
928 {
929 return m_LSL_Functions.llRequestInventoryData(name);
930 }
931
932 public void llSetDamage(double damage)
933 {
934 m_LSL_Functions.llSetDamage(damage);
935 }
936
937 public void llTeleportAgentHome(string agent)
938 {
939 m_LSL_Functions.llTeleportAgentHome(agent);
940 }
941
942 public void llModifyLand(int action, int brush)
943 {
944 m_LSL_Functions.llModifyLand(action, brush);
945 }
946
947 public void llCollisionSound(string impact_sound, double impact_volume)
948 {
949 m_LSL_Functions.llCollisionSound(impact_sound, impact_volume);
950 }
951
952 public void llCollisionSprite(string impact_sprite)
953 {
954 m_LSL_Functions.llCollisionSprite(impact_sprite);
955 }
956
957 public string llGetAnimation(string id)
958 {
959 return m_LSL_Functions.llGetAnimation(id);
960 }
961
962 public void llResetScript()
963 {
964 m_LSL_Functions.llResetScript();
965 }
966
967 public void llMessageLinked(int linknum, int num, string str, string id)
968 {
969 m_LSL_Functions.llMessageLinked(linknum, num, str, id);
970 }
971
972 public void llPushObject(string target, vector impulse, vector ang_impulse, int local)
973 {
974 m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local);
975 }
976
977 public void llPassCollisions(int pass)
978 {
979 m_LSL_Functions.llPassCollisions(pass);
980 }
981
982 public string llGetScriptName()
983 {
984 return m_LSL_Functions.llGetScriptName();
985 }
986
987 public int llGetNumberOfSides()
988 {
989 return m_LSL_Functions.llGetNumberOfSides();
990 }
991
992 //
993 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
994 //
995 public rotation llAxisAngle2Rot(vector axis, double angle)
996 {
997 return m_LSL_Functions.llAxisAngle2Rot(axis, angle);
998 }
999
1000 public vector llRot2Axis(rotation rot)
1001 {
1002 return m_LSL_Functions.llRot2Axis(rot);
1003 }
1004
1005 public void llRot2Angle()
1006 {
1007 m_LSL_Functions.llRot2Angle();
1008 }
1009
1010 public double llAcos(double val)
1011 {
1012 return m_LSL_Functions.llAcos(val);
1013 }
1014
1015 public double llAsin(double val)
1016 {
1017 return m_LSL_Functions.llAsin(val);
1018 }
1019
1020 public double llAngleBetween(rotation a, rotation b)
1021 {
1022 return m_LSL_Functions.llAngleBetween(a, b);
1023 }
1024
1025 public string llGetInventoryKey(string name)
1026 {
1027 return m_LSL_Functions.llGetInventoryKey(name);
1028 }
1029
1030 public void llAllowInventoryDrop(int add)
1031 {
1032 m_LSL_Functions.llAllowInventoryDrop(add);
1033 }
1034
1035 public vector llGetSunDirection()
1036 {
1037 return m_LSL_Functions.llGetSunDirection();
1038 }
1039
1040 public vector llGetTextureOffset(int face)
1041 {
1042 return m_LSL_Functions.llGetTextureOffset(face);
1043 }
1044
1045 public vector llGetTextureScale(int side)
1046 {
1047 return m_LSL_Functions.llGetTextureScale(side);
1048 }
1049
1050 public double llGetTextureRot(int side)
1051 {
1052 return m_LSL_Functions.llGetTextureRot(side);
1053 }
1054
1055 public int llSubStringIndex(string source, string pattern)
1056 {
1057 return m_LSL_Functions.llSubStringIndex(source, pattern);
1058 }
1059
1060 public string llGetOwnerKey(string id)
1061 {
1062 return m_LSL_Functions.llGetOwnerKey(id);
1063 }
1064
1065 public vector llGetCenterOfMass()
1066 {
1067 return m_LSL_Functions.llGetCenterOfMass();
1068 }
1069
1070 public List<string> llListSort(List<string> src, int stride, int ascending)
1071 {
1072 return m_LSL_Functions.llListSort(src, stride, ascending);
1073 }
1074
1075 public int llGetListLength(List<string> src)
1076 {
1077 return m_LSL_Functions.llGetListLength(src);
1078 }
1079
1080 //
1081 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1082 //
1083 public int llList2Integer(List<string> src, int index)
1084 {
1085 return m_LSL_Functions.llList2Integer(src, index);
1086 }
1087
1088 public double llList2double(List<string> src, int index)
1089 {
1090 return m_LSL_Functions.llList2double(src, index);
1091 }
1092
1093 public string llList2String(List<string> src, int index)
1094 {
1095 return m_LSL_Functions.llList2String(src, index);
1096 }
1097
1098 public string llList2Key(List<string> src, int index)
1099 {
1100 return m_LSL_Functions.llList2Key(src, index);
1101 }
1102
1103 public vector llList2Vector(List<string> src, int index)
1104 {
1105 return m_LSL_Functions.llList2Vector(src, index);
1106 }
1107
1108 public rotation llList2Rot(List<string> src, int index)
1109 {
1110 return m_LSL_Functions.llList2Rot(src, index);
1111 }
1112
1113 public List<string> llList2List(List<string> src, int start, int end)
1114 {
1115 return m_LSL_Functions.llList2List(src, start, end);
1116 }
1117
1118 public List<string> llDeleteSubList(List<string> src, int start, int end)
1119 {
1120 return m_LSL_Functions.llDeleteSubList(src, start, end);
1121 }
1122
1123 public int llGetListEntryType(List<string> src, int index)
1124 {
1125 return m_LSL_Functions.llGetListEntryType(src, index);
1126 }
1127
1128 public string llList2CSV(List<string> src)
1129 {
1130 return m_LSL_Functions.llList2CSV(src);
1131 }
1132
1133 public List<string> llCSV2List(string src)
1134 {
1135 return m_LSL_Functions.llCSV2List(src);
1136 }
1137
1138 public List<string> llListRandomize(List<string> src, int stride)
1139 {
1140 return m_LSL_Functions.llListRandomize(src, stride);
1141 }
1142
1143 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
1144 {
1145 return m_LSL_Functions.llList2ListStrided(src, start, end, stride);
1146 }
1147
1148 public vector llGetRegionCorner()
1149 {
1150 return m_LSL_Functions.llGetRegionCorner();
1151 }
1152
1153 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
1154 {
1155 return m_LSL_Functions.llListInsertList(dest, src, start);
1156 }
1157
1158 public int llListFindList(List<string> src, List<string> test)
1159 {
1160 return m_LSL_Functions.llListFindList(src, test);
1161 }
1162
1163 public string llGetObjectName()
1164 {
1165 return m_LSL_Functions.llGetObjectName();
1166 }
1167
1168 public void llSetObjectName(string name)
1169 {
1170 m_LSL_Functions.llSetObjectName(name);
1171 }
1172
1173 public string llGetDate()
1174 {
1175 return m_LSL_Functions.llGetDate();
1176 }
1177
1178 public int llEdgeOfWorld(vector pos, vector dir)
1179 {
1180 return m_LSL_Functions.llEdgeOfWorld(pos, dir);
1181 }
1182
1183 public int llGetAgentInfo(string id)
1184 {
1185 return m_LSL_Functions.llGetAgentInfo(id);
1186 }
1187
1188 //
1189 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1190 //
1191 public void llAdjustSoundVolume(double volume)
1192 {
1193 m_LSL_Functions.llAdjustSoundVolume(volume);
1194 }
1195
1196 public void llSetSoundQueueing(int queue)
1197 {
1198 m_LSL_Functions.llSetSoundQueueing(queue);
1199 }
1200
1201 public void llSetSoundRadius(double radius)
1202 {
1203 m_LSL_Functions.llSetSoundRadius(radius);
1204 }
1205
1206 public string llKey2Name(string id)
1207 {
1208 return m_LSL_Functions.llKey2Name(id);
1209 }
1210
1211 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
1212 {
1213 m_LSL_Functions.llSetTextureAnim(mode, face, sizex, sizey, start, length, rate);
1214 }
1215
1216 public void llTriggerSoundLimited(string sound, double volume, vector top_north_east, vector bottom_south_west)
1217 {
1218 m_LSL_Functions.llTriggerSoundLimited(sound, volume, top_north_east, bottom_south_west);
1219 }
1220
1221 public void llEjectFromLand(string pest)
1222 {
1223 m_LSL_Functions.llEjectFromLand(pest);
1224 }
1225
1226 public void llParseString2List()
1227 {
1228 m_LSL_Functions.llParseString2List();
1229 }
1230
1231 public int llOverMyLand(string id)
1232 {
1233 return m_LSL_Functions.llOverMyLand(id);
1234 }
1235
1236 public string llGetLandOwnerAt(vector pos)
1237 {
1238 return m_LSL_Functions.llGetLandOwnerAt(pos);
1239 }
1240
1241 public string llGetNotecardLine(string name, int line)
1242 {
1243 return m_LSL_Functions.llGetNotecardLine(name, line);
1244 }
1245
1246 public vector llGetAgentSize(string id)
1247 {
1248 return m_LSL_Functions.llGetAgentSize(id);
1249 }
1250
1251 public int llSameGroup(string agent)
1252 {
1253 return m_LSL_Functions.llSameGroup(agent);
1254 }
1255
1256 public void llUnSit(string id)
1257 {
1258 m_LSL_Functions.llUnSit(id);
1259 }
1260
1261 public vector llGroundSlope(vector offset)
1262 {
1263 return m_LSL_Functions.llGroundSlope(offset);
1264 }
1265
1266 public vector llGroundNormal(vector offset)
1267 {
1268 return m_LSL_Functions.llGroundNormal(offset);
1269 }
1270
1271 public vector llGroundContour(vector offset)
1272 {
1273 return m_LSL_Functions.llGroundContour(offset);
1274 }
1275
1276 public int llGetAttached()
1277 {
1278 return m_LSL_Functions.llGetAttached();
1279 }
1280
1281 public int llGetFreeMemory()
1282 {
1283 return m_LSL_Functions.llGetFreeMemory();
1284 }
1285
1286 public string llGetRegionName()
1287 {
1288 return m_LSL_Functions.llGetRegionName();
1289 }
1290
1291 public double llGetRegionTimeDilation()
1292 {
1293 return m_LSL_Functions.llGetRegionTimeDilation();
1294 }
1295
1296 public double llGetRegionFPS()
1297 {
1298 return m_LSL_Functions.llGetRegionFPS();
1299 }
1300
1301 //
1302 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1303 //
1304 public void llParticleSystem(List<Object> rules)
1305 {
1306 m_LSL_Functions.llParticleSystem(rules);
1307 }
1308
1309 public void llGroundRepel(double height, int water, double tau)
1310 {
1311 m_LSL_Functions.llGroundRepel(height, water, tau);
1312 }
1313
1314 public void llGiveInventoryList()
1315 {
1316 m_LSL_Functions.llGiveInventoryList();
1317 }
1318
1319 public void llSetVehicleType(int type)
1320 {
1321 m_LSL_Functions.llSetVehicleType(type);
1322 }
1323
1324 public void llSetVehicledoubleParam(int param, double value)
1325 {
1326 m_LSL_Functions.llSetVehicledoubleParam(param, value);
1327 }
1328
1329 public void llSetVehicleVectorParam(int param, vector vec)
1330 {
1331 m_LSL_Functions.llSetVehicleVectorParam(param, vec);
1332 }
1333
1334 public void llSetVehicleRotationParam(int param, rotation rot)
1335 {
1336 m_LSL_Functions.llSetVehicleRotationParam(param, rot);
1337 }
1338
1339 public void llSetVehicleFlags(int flags)
1340 {
1341 m_LSL_Functions.llSetVehicleFlags(flags);
1342 }
1343
1344 public void llRemoveVehicleFlags(int flags)
1345 {
1346 m_LSL_Functions.llRemoveVehicleFlags(flags);
1347 }
1348
1349 public void llSitTarget(vector offset, rotation rot)
1350 {
1351 m_LSL_Functions.llSitTarget(offset, rot);
1352 }
1353
1354 public string llAvatarOnSitTarget()
1355 {
1356 return m_LSL_Functions.llAvatarOnSitTarget();
1357 }
1358
1359 public void llAddToLandPassList(string avatar, double hours)
1360 {
1361 m_LSL_Functions.llAddToLandPassList(avatar, hours);
1362 }
1363
1364 public void llSetTouchText(string text)
1365 {
1366 m_LSL_Functions.llSetTouchText(text);
1367 }
1368
1369 public void llSetSitText(string text)
1370 {
1371 m_LSL_Functions.llSetSitText(text);
1372 }
1373
1374 public void llSetCameraEyeOffset(vector offset)
1375 {
1376 m_LSL_Functions.llSetCameraEyeOffset(offset);
1377 }
1378
1379 public void llSetCameraAtOffset(vector offset)
1380 {
1381 m_LSL_Functions.llSetCameraAtOffset(offset);
1382 }
1383
1384 public void llDumpList2String()
1385 {
1386 m_LSL_Functions.llDumpList2String();
1387 }
1388
1389 public void llScriptDanger(vector pos)
1390 {
1391 m_LSL_Functions.llScriptDanger(pos);
1392 }
1393
1394 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1395 {
1396 m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
1397 }
1398
1399 public void llVolumeDetect(int detect)
1400 {
1401 m_LSL_Functions.llVolumeDetect(detect);
1402 }
1403
1404 public void llResetOtherScript(string name)
1405 {
1406 m_LSL_Functions.llResetOtherScript(name);
1407 }
1408
1409 public int llGetScriptState(string name)
1410 {
1411 return m_LSL_Functions.llGetScriptState(name);
1412 }
1413
1414 public void llRemoteLoadScript()
1415 {
1416 m_LSL_Functions.llRemoteLoadScript();
1417 }
1418
1419 public void llSetRemoteScriptAccessPin(int pin)
1420 {
1421 m_LSL_Functions.llSetRemoteScriptAccessPin(pin);
1422 }
1423
1424 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
1425 {
1426 m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param);
1427 }
1428
1429 //
1430 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1431 //
1432 public void llOpenRemoteDataChannel()
1433 {
1434 m_LSL_Functions.llOpenRemoteDataChannel();
1435 }
1436
1437 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
1438 {
1439 return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata);
1440 }
1441
1442 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
1443 {
1444 m_LSL_Functions.llRemoteDataReply(channel, message_id, sdata, idata);
1445 }
1446
1447 public void llCloseRemoteDataChannel(string channel)
1448 {
1449 m_LSL_Functions.llCloseRemoteDataChannel(channel);
1450 }
1451
1452 public string llMD5String(string src, int nonce)
1453 {
1454 return m_LSL_Functions.llMD5String(src, nonce);
1455 }
1456
1457 public void llSetPrimitiveParams(List<string> rules)
1458 {
1459 m_LSL_Functions.llSetPrimitiveParams(rules);
1460 }
1461
1462 public string llStringToBase64(string str)
1463 {
1464 return m_LSL_Functions.llStringToBase64(str);
1465 }
1466
1467 public string llBase64ToString(string str)
1468 {
1469 return m_LSL_Functions.llBase64ToString(str);
1470 }
1471
1472 public void llXorBase64Strings()
1473 {
1474 m_LSL_Functions.llXorBase64Strings();
1475 }
1476
1477 public void llRemoteDataSetRegion()
1478 {
1479 m_LSL_Functions.llRemoteDataSetRegion();
1480 }
1481
1482 public double llLog10(double val)
1483 {
1484 return m_LSL_Functions.llLog10(val);
1485 }
1486
1487 public double llLog(double val)
1488 {
1489 return m_LSL_Functions.llLog(val);
1490 }
1491
1492 public List<string> llGetAnimationList(string id)
1493 {
1494 return m_LSL_Functions.llGetAnimationList(id);
1495 }
1496
1497 public void llSetParcelMusicURL(string url)
1498 {
1499 m_LSL_Functions.llSetParcelMusicURL(url);
1500 }
1501
1502 public vector llGetRootPosition()
1503 {
1504 return m_LSL_Functions.llGetRootPosition();
1505 }
1506
1507 public rotation llGetRootRotation()
1508 {
1509 return m_LSL_Functions.llGetRootRotation();
1510 }
1511
1512 public string llGetObjectDesc()
1513 {
1514 return m_LSL_Functions.llGetObjectDesc();
1515 }
1516
1517 public void llSetObjectDesc(string desc)
1518 {
1519 m_LSL_Functions.llSetObjectDesc(desc);
1520 }
1521
1522 public string llGetCreator()
1523 {
1524 return m_LSL_Functions.llGetCreator();
1525 }
1526
1527 public string llGetTimestamp()
1528 {
1529 return m_LSL_Functions.llGetTimestamp();
1530 }
1531
1532 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1533 {
1534 m_LSL_Functions.llSetLinkAlpha(linknumber, alpha, face);
1535 }
1536
1537 public int llGetNumberOfPrims()
1538 {
1539 return m_LSL_Functions.llGetNumberOfPrims();
1540 }
1541
1542 public string llGetNumberOfNotecardLines(string name)
1543 {
1544 return m_LSL_Functions.llGetNumberOfNotecardLines(name);
1545 }
1546
1547 public List<string> llGetBoundingBox(string obj)
1548 {
1549 return m_LSL_Functions.llGetBoundingBox(obj);
1550 }
1551
1552 public vector llGetGeometricCenter()
1553 {
1554 return m_LSL_Functions.llGetGeometricCenter();
1555 }
1556
1557 public void llGetPrimitiveParams()
1558 {
1559 m_LSL_Functions.llGetPrimitiveParams();
1560 }
1561
1562 //
1563 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1564 //
1565 public string llIntegerToBase64(int number)
1566 {
1567 return m_LSL_Functions.llIntegerToBase64(number);
1568 }
1569
1570 public int llBase64ToInteger(string str)
1571 {
1572 return m_LSL_Functions.llBase64ToInteger(str);
1573 }
1574
1575 public double llGetGMTclock()
1576 {
1577 return m_LSL_Functions.llGetGMTclock();
1578 }
1579
1580 public string llGetSimulatorHostname()
1581 {
1582 return m_LSL_Functions.llGetSimulatorHostname();
1583 }
1584
1585 public void llSetLocalRot(rotation rot)
1586 {
1587 m_LSL_Functions.llSetLocalRot(rot);
1588 }
1589
1590 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
1591 {
1592 return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers);
1593 }
1594
1595 public void llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, int param)
1596 {
1597 m_LSL_Functions.llRezAtRoot(inventory, position, velocity, rot, param);
1598 }
1599
1600 public int llGetObjectPermMask(int mask)
1601 {
1602 return m_LSL_Functions.llGetObjectPermMask(mask);
1603 }
1604
1605 public void llSetObjectPermMask(int mask, int value)
1606 {
1607 m_LSL_Functions.llSetObjectPermMask(mask, value);
1608 }
1609
1610 public void llGetInventoryPermMask(string item, int mask)
1611 {
1612 m_LSL_Functions.llGetInventoryPermMask(item, mask);
1613 }
1614
1615 public void llSetInventoryPermMask(string item, int mask, int value)
1616 {
1617 m_LSL_Functions.llSetInventoryPermMask(item, mask, value);
1618 }
1619
1620 public string llGetInventoryCreator(string item)
1621 {
1622 return m_LSL_Functions.llGetInventoryCreator(item);
1623 }
1624
1625 public void llRequestSimulatorData(string simulator, int data)
1626 {
1627 m_LSL_Functions.llRequestSimulatorData(simulator, data);
1628 }
1629
1630 public void llForceMouselook(int mouselook)
1631 {
1632 m_LSL_Functions.llForceMouselook(mouselook);
1633 }
1634
1635 public double llGetObjectMass(string id)
1636 {
1637 return m_LSL_Functions.llGetObjectMass(id);
1638 }
1639
1640 public void llListReplaceList()
1641 {
1642 m_LSL_Functions.llListReplaceList();
1643 }
1644
1645 public void llLoadURL(string avatar_id, string message, string url)
1646 {
1647 m_LSL_Functions.llLoadURL(avatar_id, message, url);
1648 }
1649
1650 public void llParcelMediaCommandList(List<string> commandList)
1651 {
1652 m_LSL_Functions.llParcelMediaCommandList(commandList);
1653 }
1654
1655 public void llParcelMediaQuery()
1656 {
1657 m_LSL_Functions.llParcelMediaQuery();
1658 }
1659
1660 public int llModPow(int a, int b, int c)
1661 {
1662 return m_LSL_Functions.llModPow(a, b, c);
1663 }
1664
1665 //
1666 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1667 //
1668 public int llGetInventoryType(string name)
1669 {
1670 return m_LSL_Functions.llGetInventoryType(name);
1671 }
1672
1673 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
1674 {
1675 m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons);
1676 }
1677
1678 public vector llGetCameraPos()
1679 {
1680 return m_LSL_Functions.llGetCameraPos();
1681 }
1682
1683 public rotation llGetCameraRot()
1684 {
1685 return m_LSL_Functions.llGetCameraRot();
1686 }
1687
1688 public void llSetPrimURL()
1689 {
1690 m_LSL_Functions.llSetPrimURL();
1691 }
1692
1693 public void llRefreshPrimURL()
1694 {
1695 m_LSL_Functions.llRefreshPrimURL();
1696 }
1697
1698 public string llEscapeURL(string url)
1699 {
1700 return m_LSL_Functions.llEscapeURL(url);
1701 }
1702
1703 public string llUnescapeURL(string url)
1704 {
1705 return m_LSL_Functions.llUnescapeURL(url);
1706 }
1707
1708 public void llMapDestination(string simname, vector pos, vector look_at)
1709 {
1710 m_LSL_Functions.llMapDestination(simname, pos, look_at);
1711 }
1712
1713 public void llAddToLandBanList(string avatar, double hours)
1714 {
1715 m_LSL_Functions.llAddToLandBanList(avatar, hours);
1716 }
1717
1718 public void llRemoveFromLandPassList(string avatar)
1719 {
1720 m_LSL_Functions.llRemoveFromLandPassList(avatar);
1721 }
1722
1723 public void llRemoveFromLandBanList(string avatar)
1724 {
1725 m_LSL_Functions.llRemoveFromLandBanList(avatar);
1726 }
1727
1728 public void llSetCameraParams(List<string> rules)
1729 {
1730 m_LSL_Functions.llSetCameraParams(rules);
1731 }
1732
1733 public void llClearCameraParams()
1734 {
1735 m_LSL_Functions.llClearCameraParams();
1736 }
1737
1738 public double llListStatistics(int operation, List<string> src)
1739 {
1740 return m_LSL_Functions.llListStatistics(operation, src);
1741 }
1742
1743 public int llGetUnixTime()
1744 {
1745 return m_LSL_Functions.llGetUnixTime();
1746 }
1747
1748 public int llGetParcelFlags(vector pos)
1749 {
1750 return m_LSL_Functions.llGetParcelFlags(pos);
1751 }
1752
1753 public int llGetRegionFlags()
1754 {
1755 return m_LSL_Functions.llGetRegionFlags();
1756 }
1757
1758 public string llXorBase64StringsCorrect(string str1, string str2)
1759 {
1760 return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2);
1761 }
1762
1763 public void llHTTPRequest(string url, List<string> parameters, string body)
1764 {
1765 m_LSL_Functions.llHTTPRequest(url, parameters, body);
1766 }
1767
1768 public void llResetLandBanList()
1769 {
1770 m_LSL_Functions.llResetLandBanList();
1771 }
1772
1773 public void llResetLandPassList()
1774 {
1775 m_LSL_Functions.llResetLandPassList();
1776 }
1777
1778 public int llGetParcelPrimCount(vector pos, int category, int sim_wide)
1779 {
1780 return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide);
1781 }
1782
1783 public List<string> llGetParcelPrimOwners(vector pos)
1784 {
1785 return m_LSL_Functions.llGetParcelPrimOwners(pos);
1786 }
1787
1788 public int llGetObjectPrimCount(string object_id)
1789 {
1790 return m_LSL_Functions.llGetObjectPrimCount(object_id);
1791 }
1792
1793 //
1794 // DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
1795 //
1796 public int llGetParcelMaxPrims(vector pos, int sim_wide)
1797 {
1798 return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
1799 }
1800
1801 public List<string> llGetParcelDetails(vector pos, List<string> param)
1802 {
1803 return m_LSL_Functions.llGetParcelDetails(pos, param);
1804 }
1805
1806 //
1807 // OpenSim Functions
1808 //
1809 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
1810 int timer)
1811 {
1812 return m_LSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer);
1813 }
1814
1815 // LSL CONSTANTS
1816 public const int TRUE = 1;
1817 public const int FALSE = 0;
1818 public const int STATUS_PHYSICS = 1;
1819 public const int STATUS_ROTATE_X = 2;
1820 public const int STATUS_ROTATE_Y = 4;
1821 public const int STATUS_ROTATE_Z = 8;
1822 public const int STATUS_PHANTOM = 16;
1823 public const int STATUS_SANDBOX = 32;
1824 public const int STATUS_BLOCK_GRAB = 64;
1825 public const int STATUS_DIE_AT_EDGE = 128;
1826 public const int STATUS_RETURN_AT_EDGE = 256;
1827 public const int AGENT = 1;
1828 public const int ACTIVE = 2;
1829 public const int PASSIVE = 4;
1830 public const int SCRIPTED = 8;
1831 public const int CONTROL_FWD = 1;
1832 public const int CONTROL_BACK = 2;
1833 public const int CONTROL_LEFT = 4;
1834 public const int CONTROL_RIGHT = 8;
1835 public const int CONTROL_UP = 16;
1836 public const int CONTROL_DOWN = 32;
1837 public const int CONTROL_ROT_LEFT = 256;
1838 public const int CONTROL_ROT_RIGHT = 512;
1839 public const int CONTROL_LBUTTON = 268435456;
1840 public const int CONTROL_ML_LBUTTON = 1073741824;
1841 public const int PERMISSION_DEBIT = 2;
1842 public const int PERMISSION_TAKE_CONTROLS = 4;
1843 public const int PERMISSION_REMAP_CONTROLS = 8;
1844 public const int PERMISSION_TRIGGER_ANIMATION = 16;
1845 public const int PERMISSION_ATTACH = 32;
1846 public const int PERMISSION_RELEASE_OWNERSHIP = 64;
1847 public const int PERMISSION_CHANGE_LINKS = 128;
1848 public const int PERMISSION_CHANGE_JOINTS = 256;
1849 public const int PERMISSION_CHANGE_PERMISSIONS = 512;
1850 public const int PERMISSION_TRACK_CAMERA = 1024;
1851 public const int PERMISSION_CONTROL_CAMERA = 2048;
1852 public const int AGENT_FLYING = 1;
1853 public const int AGENT_ATTACHMENTS = 2;
1854 public const int AGENT_SCRIPTED = 4;
1855 public const int AGENT_MOUSELOOK = 8;
1856 public const int AGENT_SITTING = 16;
1857 public const int AGENT_ON_OBJECT = 32;
1858 public const int AGENT_AWAY = 64;
1859 public const int AGENT_WALKING = 128;
1860 public const int AGENT_IN_AIR = 256;
1861 public const int AGENT_TYPING = 512;
1862 public const int AGENT_CROUCHING = 1024;
1863 public const int AGENT_BUSY = 2048;
1864 public const int AGENT_ALWAYS_RUN = 4096;
1865 public const int PSYS_PART_INTERP_COLOR_MASK = 1;
1866 public const int PSYS_PART_INTERP_SCALE_MASK = 2;
1867 public const int PSYS_PART_BOUNCE_MASK = 4;
1868 public const int PSYS_PART_WIND_MASK = 8;
1869 public const int PSYS_PART_FOLLOW_SRC_MASK = 16;
1870 public const int PSYS_PART_FOLLOW_VELOCITY_MASK = 32;
1871 public const int PSYS_PART_TARGET_POS_MASK = 64;
1872 public const int PSYS_PART_TARGET_LINEAR_MASK = 128;
1873 public const int PSYS_PART_EMISSIVE_MASK = 256;
1874 public const int PSYS_PART_FLAGS = 0;
1875 public const int PSYS_PART_START_COLOR = 1;
1876 public const int PSYS_PART_START_ALPHA = 2;
1877 public const int PSYS_PART_END_COLOR = 3;
1878 public const int PSYS_PART_END_ALPHA = 4;
1879 public const int PSYS_PART_START_SCALE = 5;
1880 public const int PSYS_PART_END_SCALE = 6;
1881 public const int PSYS_PART_MAX_AGE = 7;
1882 public const int PSYS_SRC_ACCEL = 8;
1883 public const int PSYS_SRC_PATTERN = 9;
1884 public const int PSYS_SRC_INNERANGLE = 10;
1885 public const int PSYS_SRC_OUTERANGLE = 11;
1886 public const int PSYS_SRC_TEXTURE = 12;
1887 public const int PSYS_SRC_BURST_RATE = 13;
1888 public const int PSYS_SRC_BURST_PART_COUNT = 15;
1889 public const int PSYS_SRC_BURST_RADIUS = 16;
1890 public const int PSYS_SRC_BURST_SPEED_MIN = 17;
1891 public const int PSYS_SRC_BURST_SPEED_MAX = 18;
1892 public const int PSYS_SRC_MAX_AGE = 19;
1893 public const int PSYS_SRC_TARGET_KEY = 20;
1894 public const int PSYS_SRC_OMEGA = 21;
1895 public const int PSYS_SRC_ANGLE_BEGIN = 22;
1896 public const int PSYS_SRC_ANGLE_END = 23;
1897 public const int PSYS_SRC_PATTERN_DROP = 1;
1898 public const int PSYS_SRC_PATTERN_EXPLODE = 2;
1899 public const int PSYS_SRC_PATTERN_ANGLE = 4;
1900 public const int PSYS_SRC_PATTERN_ANGLE_CONE = 8;
1901 public const int PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY = 16;
1902 public const int VEHICLE_TYPE_NONE = 0;
1903 public const int VEHICLE_TYPE_SLED = 1;
1904 public const int VEHICLE_TYPE_CAR = 2;
1905 public const int VEHICLE_TYPE_BOAT = 3;
1906 public const int VEHICLE_TYPE_AIRPLANE = 4;
1907 public const int VEHICLE_TYPE_BALLOON = 5;
1908 public const int VEHICLE_LINEAR_FRICTION_TIMESCALE = 16;
1909 public const int VEHICLE_ANGULAR_FRICTION_TIMESCALE = 17;
1910 public const int VEHICLE_LINEAR_MOTOR_DIRECTION = 18;
1911 public const int VEHICLE_LINEAR_MOTOR_OFFSET = 20;
1912 public const int VEHICLE_ANGULAR_MOTOR_DIRECTION = 19;
1913 public const int VEHICLE_HOVER_HEIGHT = 24;
1914 public const int VEHICLE_HOVER_EFFICIENCY = 25;
1915 public const int VEHICLE_HOVER_TIMESCALE = 26;
1916 public const int VEHICLE_BUOYANCY = 27;
1917 public const int VEHICLE_LINEAR_DEFLECTION_EFFICIENCY = 28;
1918 public const int VEHICLE_LINEAR_DEFLECTION_TIMESCALE = 29;
1919 public const int VEHICLE_LINEAR_MOTOR_TIMESCALE = 30;
1920 public const int VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE = 31;
1921 public const int VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY = 32;
1922 public const int VEHICLE_ANGULAR_DEFLECTION_TIMESCALE = 33;
1923 public const int VEHICLE_ANGULAR_MOTOR_TIMESCALE = 34;
1924 public const int VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE = 35;
1925 public const int VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY = 36;
1926 public const int VEHICLE_VERTICAL_ATTRACTION_TIMESCALE = 37;
1927 public const int VEHICLE_BANKING_EFFICIENCY = 38;
1928 public const int VEHICLE_BANKING_MIX = 39;
1929 public const int VEHICLE_BANKING_TIMESCALE = 40;
1930 public const int VEHICLE_REFERENCE_FRAME = 44;
1931 public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1;
1932 public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2;
1933 public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4;
1934 public const int VEHICLE_FLAG_HOVER_TERRAIN_ONLY = 8;
1935 public const int VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT = 16;
1936 public const int VEHICLE_FLAG_HOVER_UP_ONLY = 32;
1937 public const int VEHICLE_FLAG_LIMIT_MOTOR_UP = 64;
1938 public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128;
1939 public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256;
1940 public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512;
1941 public const int INVENTORY_ALL = -1;
1942 public const int INVENTORY_NONE = -1;
1943 public const int INVENTORY_TEXTURE = 0;
1944 public const int INVENTORY_SOUND = 1;
1945 public const int INVENTORY_LANDMARK = 3;
1946 public const int INVENTORY_CLOTHING = 5;
1947 public const int INVENTORY_OBJECT = 6;
1948 public const int INVENTORY_NOTECARD = 7;
1949 public const int INVENTORY_SCRIPT = 10;
1950 public const int INVENTORY_BODYPART = 13;
1951 public const int INVENTORY_ANIMATION = 20;
1952 public const int INVENTORY_GESTURE = 21;
1953 public const int ATTACH_CHEST = 1;
1954 public const int ATTACH_HEAD = 2;
1955 public const int ATTACH_LSHOULDER = 3;
1956 public const int ATTACH_RSHOULDER = 4;
1957 public const int ATTACH_LHAND = 5;
1958 public const int ATTACH_RHAND = 6;
1959 public const int ATTACH_LFOOT = 7;
1960 public const int ATTACH_RFOOT = 8;
1961 public const int ATTACH_BACK = 9;
1962 public const int ATTACH_PELVIS = 10;
1963 public const int ATTACH_MOUTH = 11;
1964 public const int ATTACH_CHIN = 12;
1965 public const int ATTACH_LEAR = 13;
1966 public const int ATTACH_REAR = 14;
1967 public const int ATTACH_LEYE = 15;
1968 public const int ATTACH_REYE = 16;
1969 public const int ATTACH_NOSE = 17;
1970 public const int ATTACH_RUARM = 18;
1971 public const int ATTACH_RLARM = 19;
1972 public const int ATTACH_LUARM = 20;
1973 public const int ATTACH_LLARM = 21;
1974 public const int ATTACH_RHIP = 22;
1975 public const int ATTACH_RULEG = 23;
1976 public const int ATTACH_RLLEG = 24;
1977 public const int ATTACH_LHIP = 25;
1978 public const int ATTACH_LULEG = 26;
1979 public const int ATTACH_LLLEG = 27;
1980 public const int ATTACH_BELLY = 28;
1981 public const int ATTACH_RPEC = 29;
1982 public const int ATTACH_LPEC = 30;
1983 public const int LAND_LEVEL = 0;
1984 public const int LAND_RAISE = 1;
1985 public const int LAND_LOWER = 2;
1986 public const int LAND_SMOOTH = 3;
1987 public const int LAND_NOISE = 4;
1988 public const int LAND_REVERT = 5;
1989 public const int LAND_SMALL_BRUSH = 1;
1990 public const int LAND_MEDIUM_BRUSH = 2;
1991 public const int LAND_LARGE_BRUSH = 3;
1992 public const int DATA_ONLINE = 1;
1993 public const int DATA_NAME = 2;
1994 public const int DATA_BORN = 3;
1995 public const int DATA_RATING = 4;
1996 public const int DATA_SIM_POS = 5;
1997 public const int DATA_SIM_STATUS = 6;
1998 public const int DATA_SIM_RATING = 7;
1999 public const int ANIM_ON = 1;
2000 public const int LOOP = 2;
2001 public const int REVERSE = 4;
2002 public const int PING_PONG = 8;
2003 public const int SMOOTH = 16;
2004 public const int ROTATE = 32;
2005 public const int SCALE = 64;
2006 public const int ALL_SIDES = -1;
2007 public const int LINK_SET = -1;
2008 public const int LINK_ROOT = 1;
2009 public const int LINK_ALL_OTHERS = -2;
2010 public const int LINK_ALL_CHILDREN = -3;
2011 public const int LINK_THIS = -4;
2012 public const int CHANGED_INVENTORY = 1;
2013 public const int CHANGED_COLOR = 2;
2014 public const int CHANGED_SHAPE = 4;
2015 public const int CHANGED_SCALE = 8;
2016 public const int CHANGED_TEXTURE = 16;
2017 public const int CHANGED_LINK = 32;
2018 public const int CHANGED_ALLOWED_DROP = 64;
2019 public const int CHANGED_OWNER = 128;
2020 public const int CHANGED_REGION_RESTART = 256;
2021 public const int CHANGED_REGION = 512;
2022 public const int CHANGED_TELEPORT = 1024;
2023 public const int TYPE_INVALID = 0;
2024 public const int TYPE_INTEGER = 1;
2025 public const int TYPE_double = 2;
2026 public const int TYPE_STRING = 3;
2027 public const int TYPE_KEY = 4;
2028 public const int TYPE_VECTOR = 5;
2029 public const int TYPE_ROTATION = 6;
2030 public const int REMOTE_DATA_CHANNEL = 1;
2031 public const int REMOTE_DATA_REQUEST = 2;
2032 public const int REMOTE_DATA_REPLY = 3;
2033 //public const int PRIM_TYPE = 1;
2034 public const int PRIM_MATERIAL = 2;
2035 public const int PRIM_PHYSICS = 3;
2036 public const int PRIM_TEMP_ON_REZ = 4;
2037 public const int PRIM_PHANTOM = 5;
2038 public const int PRIM_POSITION = 6;
2039 public const int PRIM_SIZE = 7;
2040 public const int PRIM_ROTATION = 8;
2041 public const int PRIM_TYPE = 9;
2042 public const int PRIM_TEXTURE = 17;
2043 public const int PRIM_COLOR = 18;
2044 public const int PRIM_BUMP_SHINY = 19;
2045 public const int PRIM_FULLBRIGHT = 20;
2046 public const int PRIM_FLEXIBLE = 21;
2047 public const int PRIM_TEXGEN = 22;
2048 public const int PRIM_TEXGEN_DEFAULT = 0;
2049 public const int PRIM_TEXGEN_PLANAR = 1;
2050 public const int PRIM_TYPE_BOX = 0;
2051 public const int PRIM_TYPE_CYLINDER = 1;
2052 public const int PRIM_TYPE_PRISM = 2;
2053 public const int PRIM_TYPE_SPHERE = 3;
2054 public const int PRIM_TYPE_TORUS = 4;
2055 public const int PRIM_TYPE_TUBE = 5;
2056 public const int PRIM_TYPE_RING = 6;
2057 public const int PRIM_HOLE_DEFAULT = 0;
2058 public const int PRIM_HOLE_CIRCLE = 16;
2059 public const int PRIM_HOLE_SQUARE = 32;
2060 public const int PRIM_HOLE_TRIANGLE = 48;
2061 public const int PRIM_MATERIAL_STONE = 0;
2062 public const int PRIM_MATERIAL_METAL = 1;
2063 public const int PRIM_MATERIAL_GLASS = 2;
2064 public const int PRIM_MATERIAL_WOOD = 3;
2065 public const int PRIM_MATERIAL_FLESH = 4;
2066 public const int PRIM_MATERIAL_PLASTIC = 5;
2067 public const int PRIM_MATERIAL_RUBBER = 6;
2068 public const int PRIM_MATERIAL_LIGHT = 7;
2069 public const int PRIM_SHINY_NONE = 0;
2070 public const int PRIM_SHINY_LOW = 1;
2071 public const int PRIM_SHINY_MEDIUM = 2;
2072 public const int PRIM_SHINY_HIGH = 3;
2073 public const int PRIM_BUMP_NONE = 0;
2074 public const int PRIM_BUMP_BRIGHT = 1;
2075 public const int PRIM_BUMP_DARK = 2;
2076 public const int PRIM_BUMP_WOOD = 3;
2077 public const int PRIM_BUMP_BARK = 4;
2078 public const int PRIM_BUMP_BRICKS = 5;
2079 public const int PRIM_BUMP_CHECKER = 6;
2080 public const int PRIM_BUMP_CONCRETE = 7;
2081 public const int PRIM_BUMP_TILE = 8;
2082 public const int PRIM_BUMP_STONE = 9;
2083 public const int PRIM_BUMP_DISKS = 10;
2084 public const int PRIM_BUMP_GRAVEL = 11;
2085 public const int PRIM_BUMP_BLOBS = 12;
2086 public const int PRIM_BUMP_SIDING = 13;
2087 public const int PRIM_BUMP_LARGETILE = 14;
2088 public const int PRIM_BUMP_STUCCO = 15;
2089 public const int PRIM_BUMP_SUCTION = 16;
2090 public const int PRIM_BUMP_WEAVE = 17;
2091 public const int MASK_BASE = 0;
2092 public const int MASK_OWNER = 1;
2093 public const int MASK_GROUP = 2;
2094 public const int MASK_EVERYONE = 3;
2095 public const int MASK_NEXT = 4;
2096 public const int PERM_TRANSFER = 8192;
2097 public const int PERM_MODIFY = 16384;
2098 public const int PERM_COPY = 32768;
2099 public const int PERM_MOVE = 524288;
2100 public const int PERM_ALL = 2147483647;
2101 public const int PARCEL_MEDIA_COMMAND_STOP = 0;
2102 public const int PARCEL_MEDIA_COMMAND_PAUSE = 1;
2103 public const int PARCEL_MEDIA_COMMAND_PLAY = 2;
2104 public const int PARCEL_MEDIA_COMMAND_LOOP = 3;
2105 public const int PARCEL_MEDIA_COMMAND_TEXTURE = 4;
2106 public const int PARCEL_MEDIA_COMMAND_URL = 5;
2107 public const int PARCEL_MEDIA_COMMAND_TIME = 6;
2108 public const int PARCEL_MEDIA_COMMAND_AGENT = 7;
2109 public const int PARCEL_MEDIA_COMMAND_UNLOAD = 8;
2110 public const int PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9;
2111 public const int PAY_HIDE = -1;
2112 public const int PAY_DEFAULT = -2;
2113 public const string NULL_KEY = "00000000-0000-0000-0000-000000000000";
2114 public const string EOF = "\n\n\n";
2115 public const double PI = 3.14159274f;
2116 public const double TWO_PI = 6.28318548f;
2117 public const double PI_BY_TWO = 1.57079637f;
2118 public const double DEG_TO_RAD = 0.01745329238f;
2119 public const double RAD_TO_DEG = 57.29578f;
2120 public const double SQRT2 = 1.414213538f;
2121 public const int DEBUG_CHANNEL 0x7FFFFFFF;
2122 public const int PUBLIC_CHANNEL 0x00000000
2123
2124 // Can not be public const?
2125 public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0);
2126 public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0);
2127 }
2128}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
deleted file mode 100644
index bb06cf5..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Common.cs
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30
31namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
32{
33 public static class Common
34 {
35 public static bool Debug = true;
36 public static bool IL_UseTryCatch = true;
37 public static bool IL_CreateConstructor = true;
38 public static bool IL_CreateFunctionList = true;
39 public static bool IL_ProcessCodeChunks = true;
40
41 public delegate void SendToDebugEventDelegate(string Message);
42
43 public delegate void SendToLogEventDelegate(string Message);
44
45 public static event SendToDebugEventDelegate SendToDebugEvent;
46 public static event SendToLogEventDelegate SendToLogEvent;
47
48 public static void SendToDebug(string Message)
49 {
50 //if (Debug == true)
51 Console.WriteLine("COMPILER:Debug: " + Message);
52 SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
53 }
54
55 public static void SendToLog(string Message)
56 {
57 //if (Debug == true)
58 Console.WriteLine("COMPILER:LOG: " + Message);
59 SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
60 }
61 }
62
63 // TEMPORARY TEST THINGIES
64 public static class IL_Helper
65 {
66 public static string ReverseFormatString(string text1, string format)
67 {
68 Common.SendToDebug("ReverseFormatString text1: " + text1);
69 Common.SendToDebug("ReverseFormatString format: " + format);
70 return string.Format(format, text1);
71 }
72
73 public static string ReverseFormatString(string text1, UInt32 text2, string format)
74 {
75 Common.SendToDebug("ReverseFormatString text1: " + text1);
76 Common.SendToDebug("ReverseFormatString text2: " + text2.ToString());
77 Common.SendToDebug("ReverseFormatString format: " + format);
78 return string.Format(format, text1, text2.ToString());
79 }
80
81 public static string Cast_ToString(object obj)
82 {
83 Common.SendToDebug("OBJECT TO BE CASTED: " + obj.GetType().ToString());
84 return "ABCDEFGIHJKLMNOPQ123";
85 }
86 }
87}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
deleted file mode 100644
index f7c8fb1..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/Engine.cs
+++ /dev/null
@@ -1,291 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.IO;
31using System.Reflection;
32using System.Reflection.Emit;
33using System.Text;
34using System.Threading;
35
36namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
37{
38 public class Engine
39 {
40 //private string LSO_FileName = @"LSO\AdditionTest.lso";
41 private string LSO_FileName; // = @"LSO\CloseToDefault.lso";
42 private AppDomain appDomain;
43
44 public string Compile(string LSOFileName)
45 {
46 LSO_FileName = LSOFileName;
47
48
49 //appDomain = AppDomain.CreateDomain("AlternateAppDomain");
50 appDomain = Thread.GetDomain();
51
52 // Create Assembly Name
53 AssemblyName asmName = new AssemblyName();
54 asmName.Name = Path.GetFileNameWithoutExtension(LSO_FileName);
55 //asmName.Name = "TestAssembly";
56
57 string DLL_FileName = asmName.Name + ".dll";
58 string DLL_FileName_WithPath = Path.GetDirectoryName(LSO_FileName) + @"\" + DLL_FileName;
59
60 Common.SendToLog("LSO File Name: " + Path.GetFileName(LSO_FileName));
61 Common.SendToLog("Assembly name: " + asmName.Name);
62 Common.SendToLog("Assembly File Name: " + asmName.Name + ".dll");
63 Common.SendToLog("Starting processing of LSL ByteCode...");
64 Common.SendToLog("");
65
66
67 // Create Assembly
68 AssemblyBuilder asmBuilder = appDomain.DefineDynamicAssembly(
69 asmName,
70 AssemblyBuilderAccess.RunAndSave
71 );
72 //// Create Assembly
73 //AssemblyBuilder asmBuilder =
74 // Thread.GetDomain().DefineDynamicAssembly
75 //(asmName, AssemblyBuilderAccess.RunAndSave);
76
77 // Create a module (and save to disk)
78 ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
79 (asmName.Name,
80 DLL_FileName);
81
82 //Common.SendToDebug("asmName.Name is still \"" + asmName.Name + "\"");
83 // Create a Class (/Type)
84 TypeBuilder typeBuilder = modBuilder.DefineType(
85 "LSL_ScriptObject",
86 TypeAttributes.Public | TypeAttributes.BeforeFieldInit,
87 typeof (LSL_BaseClass));
88 //,
89 // typeof());
90 //, typeof(LSL_BuiltIn_Commands_Interface));
91 //,
92 // typeof(object),
93 // new Type[] { typeof(LSL_CLRInterface.LSLScript) });
94
95
96 /*
97 * Generate the IL itself
98 */
99
100 LSO_Parser LSOP = new LSO_Parser(LSO_FileName, typeBuilder);
101 LSOP.OpenFile();
102 LSOP.Parse();
103
104 // Constructor has to be created AFTER LSO_Parser because of accumulated variables
105 if (Common.IL_CreateConstructor)
106 IL_CREATE_CONSTRUCTOR(typeBuilder, LSOP);
107
108 LSOP.CloseFile();
109 /*
110 * Done generating. Create a type and run it.
111 */
112
113
114 Common.SendToLog("Attempting to compile assembly...");
115 // Compile it
116 Type type = typeBuilder.CreateType();
117 Common.SendToLog("Compilation successful!");
118
119 Common.SendToLog("Saving assembly: " + DLL_FileName);
120 asmBuilder.Save(DLL_FileName);
121
122 Common.SendToLog("Returning assembly filename: " + DLL_FileName);
123
124
125 return DLL_FileName;
126
127
128 //Common.SendToLog("Creating an instance of new assembly...");
129 //// Create an instance we can play with
130 ////LSLScript hello = (LSLScript)Activator.CreateInstance(type);
131 ////LSL_CLRInterface.LSLScript MyScript = (LSL_CLRInterface.LSLScript)Activator.CreateInstance(type);
132 //object MyScript = (object)Activator.CreateInstance(type);
133
134
135 //System.Reflection.MemberInfo[] Members = type.GetMembers();
136
137 //Common.SendToLog("Members of assembly " + type.ToString() + ":");
138 //foreach (MemberInfo member in Members)
139 // Common.SendToLog(member.ToString());
140
141
142 //// Play with it
143 ////MyScript.event_state_entry("Test");
144 //object[] args = { null };
145 ////System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null);
146
147 //string[] ret = { };
148 //if (Common.IL_CreateFunctionList)
149 // ret = (string[])type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, MyScript, null);
150
151 //foreach (string s in ret)
152 //{
153 // Common.SendToLog("");
154 // Common.SendToLog("*** Executing LSL Server Event: " + s);
155 // //object test = type.GetMember(s);
156 // //object runner = type.InvokeMember(s, BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance, null, MyScript, args);
157 // //runner();
158 // //objBooks_Late = type.InvokeMember(s, BindingFlags.CreateInstance, null, objApp_Late, null);
159 // type.InvokeMember(s, BindingFlags.InvokeMethod, null, MyScript, new object[] { "Test" });
160
161 //}
162 }
163
164
165 private static void IL_CREATE_CONSTRUCTOR(TypeBuilder typeBuilder, LSO_Parser LSOP)
166 {
167 Common.SendToDebug("IL_CREATE_CONSTRUCTOR()");
168 //ConstructorBuilder constructor = typeBuilder.DefineConstructor(
169 // MethodAttributes.Public,
170 // CallingConventions.Standard,
171 // new Type[0]);
172 ConstructorBuilder constructor = typeBuilder.DefineConstructor(
173 MethodAttributes.Public |
174 MethodAttributes.SpecialName |
175 MethodAttributes.RTSpecialName,
176 CallingConventions.Standard,
177 new Type[0]);
178
179 //Define the reflection ConstructorInfor for System.Object
180 ConstructorInfo conObj = typeof (LSL_BaseClass).GetConstructor(new Type[0]);
181
182 //call constructor of base object
183 ILGenerator il = constructor.GetILGenerator();
184
185 il.Emit(OpCodes.Ldarg_0);
186 il.Emit(OpCodes.Call, conObj);
187
188
189 //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: UInt32 State = 0;");
190 //string FieldName;
191 //// Create state object
192 //FieldName = "State";
193 //FieldBuilder State_fb = typeBuilder.DefineField(
194 // FieldName,
195 // typeof(UInt32),
196 // FieldAttributes.Public);
197 //il.Emit(OpCodes.Ldarg_0);
198 //il.Emit(OpCodes.Ldc_I4, 0);
199 //il.Emit(OpCodes.Stfld, State_fb);
200
201
202 //Common.SendToDebug("IL_CREATE_CONSTRUCTOR: Creating global: LSL_BuiltIn_Commands_TestImplementation LSL_BuiltIns = New LSL_BuiltIn_Commands_TestImplementation();");
203 ////Type objType1 = typeof(object);
204 //Type objType1 = typeof(LSL_BuiltIn_Commands_TestImplementation);
205
206 //FieldName = "LSL_BuiltIns";
207 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField(
208 // FieldName,
209 // objType1,
210 // FieldAttributes.Public);
211
212 ////LSL_BuiltIn_Commands_TestImplementation _ti = new LSL_BuiltIn_Commands_TestImplementation();
213 //il.Emit(OpCodes.Ldarg_0);
214 ////il.Emit(OpCodes.Ldstr, "Test 123");
215 //il.Emit(OpCodes.Newobj, objType1.GetConstructor(new Type[] { }));
216 //il.Emit(OpCodes.Stfld, LSL_BuiltIns_fb);
217
218 foreach (UInt32 pos in LSOP.StaticBlocks.Keys)
219 {
220 LSO_Struct.StaticBlock sb;
221 LSOP.StaticBlocks.TryGetValue(pos, out sb);
222
223 if (sb.ObjectType > 0 && sb.ObjectType < 8)
224 {
225 // We don't want void or null's
226
227 il.Emit(OpCodes.Ldarg_0);
228 // Push position to stack
229 il.Emit(OpCodes.Ldc_I4, pos);
230 //il.Emit(OpCodes.Box, typeof(UInt32));
231
232
233 Type datatype = null;
234
235 // Push data to stack
236 Common.SendToDebug("Adding to static (" + pos + ") type: " +
237 ((LSO_Enums.Variable_Type_Codes) sb.ObjectType).ToString() + " (" + sb.ObjectType +
238 ")");
239 switch ((LSO_Enums.Variable_Type_Codes) sb.ObjectType)
240 {
241 case LSO_Enums.Variable_Type_Codes.Float:
242 case LSO_Enums.Variable_Type_Codes.Integer:
243 //UInt32
244 il.Emit(OpCodes.Ldc_I4, BitConverter.ToUInt32(sb.BlockVariable, 0));
245 datatype = typeof (UInt32);
246 il.Emit(OpCodes.Box, datatype);
247 break;
248 case LSO_Enums.Variable_Type_Codes.String:
249 case LSO_Enums.Variable_Type_Codes.Key:
250 //String
251 LSO_Struct.HeapBlock hb =
252 LSOP.GetHeap(LSOP.myHeader.HR + BitConverter.ToUInt32(sb.BlockVariable, 0) - 1);
253 il.Emit(OpCodes.Ldstr, Encoding.UTF8.GetString(hb.Data));
254 datatype = typeof (string);
255 break;
256 case LSO_Enums.Variable_Type_Codes.Vector:
257 datatype = typeof (LSO_Enums.Vector);
258 //TODO: Not implemented
259 break;
260 case LSO_Enums.Variable_Type_Codes.Rotation:
261 //Object
262 //TODO: Not implemented
263 datatype = typeof (LSO_Enums.Rotation);
264 break;
265 default:
266 datatype = typeof (object);
267 break;
268 }
269
270
271 // Make call
272 il.Emit(OpCodes.Call,
273 typeof (LSL_BaseClass).GetMethod("AddToStatic", new Type[] {typeof (UInt32), datatype}));
274 }
275 }
276
277
278 ////il.Emit(OpCodes.Newobj, typeof(UInt32));
279 //il.Emit(OpCodes.Starg_0);
280 //// Create LSL function library
281 //FieldBuilder LSL_BuiltIns_fb = typeBuilder.DefineField("LSL_BuiltIns", typeof(LSL_BuiltIn_Commands_Interface), FieldAttributes.Public);
282 //il.Emit(OpCodes.Newobj, typeof(LSL_BuiltIn_Commands_Interface));
283 //il.Emit(OpCodes.Stloc_1);
284
285 il.Emit(OpCodes.Ret);
286 }
287
288
289 // End of class
290 }
291}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
deleted file mode 100644
index e393551..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/IL_common_functions.cs
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.Reflection;
31using System.Reflection.Emit;
32
33namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
34{
35 internal partial class LSO_Parser
36 {
37 private static TypeBuilder CreateType(ModuleBuilder modBuilder, string typeName)
38 {
39 TypeBuilder typeBuilder = modBuilder.DefineType(typeName,
40 TypeAttributes.Public |
41 TypeAttributes.Class |
42 TypeAttributes.AutoClass |
43 TypeAttributes.AnsiClass |
44 TypeAttributes.BeforeFieldInit |
45 TypeAttributes.AutoLayout,
46 typeof (object),
47 new Type[] {typeof (object)});
48 return typeBuilder;
49 }
50 }
51}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
deleted file mode 100644
index fd81f30..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass.cs
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenSim.Region.ScriptEngine.Common;
31
32namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
33{
34 public partial class LSL_BaseClass
35 {
36 //public MemoryStream LSLStack = new MemoryStream();
37 public Stack<object> LSLStack = new Stack<object>();
38 public Dictionary<uint, object> StaticVariables = new Dictionary<uint, object>();
39 public Dictionary<uint, object> GlobalVariables = new Dictionary<uint, object>();
40 public Dictionary<uint, object> LocalVariables = new Dictionary<uint, object>();
41 //public System.Collections.Generic.List<string> FunctionList = new System.Collections.Generic.List<string>();
42 //public void AddFunction(String x)
43 //{
44 // FunctionList.Add(x);
45 //}
46 //public Stack<StackItemStruct> LSLStack = new Stack<StackItemStruct>;
47 //public struct StackItemStruct
48 //{
49 // public LSO_Enums.Variable_Type_Codes ItemType;
50 // public object Data;
51 //}
52 public UInt32 State = 0;
53 public LSL_BuiltIn_Commands_Interface LSL_Builtins;
54
55 public LSL_BuiltIn_Commands_Interface GetLSL_BuiltIn()
56 {
57 return LSL_Builtins;
58 }
59
60 public LSL_BaseClass()
61 {
62 }
63
64 public virtual int OverrideMe()
65 {
66 return 0;
67 }
68
69 public void Start(LSL_BuiltIn_Commands_Interface LSLBuiltins)
70 {
71 LSL_Builtins = LSLBuiltins;
72
73 Common.SendToLog("OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass.Start() called");
74 }
75
76 public void AddToStatic(UInt32 index, object obj)
77 {
78 Common.SendToDebug("AddToStatic: " + index + " type: " + obj.GetType());
79 StaticVariables.Add(index, obj);
80 }
81 }
82}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs
deleted file mode 100644
index a551fde..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_Builtins.cs
+++ /dev/null
@@ -1,405 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28//using System;
29//using System.Collections.Generic;
30//using System.Text;
31
32//namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
33//{
34// public partial class LSL_BaseClass
35// {
36
37
38// public float llSin()
39// {
40// float f = (float)LSLStack.Pop();
41// return LSL_Builtins.llSin(f);
42// }
43// public float llCos()
44// {
45// float f = (float)LSLStack.Pop();
46// return LSL_Builtins.llCos(f);
47// }
48// public float llTan()
49// {
50// float f = (float)LSLStack.Pop();
51// return LSL_Builtins.llTan(f);
52// }
53// public float llAtan2()
54// {
55// float x = (float)LSLStack.Pop();
56// float y = (float)LSLStack.Pop();
57// return LSL_Builtins.llAtan2(x, y);
58// }
59// public float llSqrt()
60// {
61// float f = (float)LSLStack.Pop();
62// return LSL_Builtins.llSqrt(f);
63// }
64// float llPow()
65// {
66// float fexponent = (float)LSLStack.Pop();
67// float fbase = (float)LSLStack.Pop();
68// return LSL_Builtins.llPow(fbase, fexponent);
69// }
70// //UInt32 llAbs(UInt32 i){ return; }
71// //float llFabs(float f){ return; }
72// //float llFrand(float mag){ return; }
73// //UInt32 llFloor(float f){ return; }
74// //UInt32 llCeil(float f){ return; }
75// //UInt32 llRound(float f){ return; }
76// //float llVecMag(LSO_Enums.Vector v){ return; }
77// //LSO_Enums.Vector llVecNorm(LSO_Enums.Vector v){ return; }
78// //float llVecDist(LSO_Enums.Vector a, LSO_Enums.Vector b){ return; }
79// //LSO_Enums.Vector llRot2Euler(LSO_Enums.Rotation r){ return; }
80// //LSO_Enums.Rotation llEuler2Rot(LSO_Enums.Vector v){ return; }
81// //LSO_Enums.Rotation llAxes2Rot(LSO_Enums.Vector fwd, LSO_Enums.Vector left, LSO_Enums.Vector up){ return; }
82// //LSO_Enums.Vector llRot2Fwd(LSO_Enums.Rotation r){ return; }
83// //LSO_Enums.Vector llRot2Left(LSO_Enums.Rotation r){ return; }
84// //LSO_Enums.Vector llRot2Up(LSO_Enums.Rotation r){ return; }
85// //LSO_Enums.Rotation llRotBetween(LSO_Enums.Vector start, LSO_Enums.Vector end){ return; }
86// public void llWhisper()
87// {
88// UInt16 i = (UInt16)LSLStack.Pop();
89// string s = (string)LSLStack.Pop();
90// LSL_Builtins.llWhisper(i, s);
91// }
92// public void llSay()
93// {
94// UInt16 i = (UInt16)LSLStack.Pop();
95// string s = (string)LSLStack.Pop();
96// LSL_Builtins.llSay(i, s);
97// }
98// //void llShout(UInt16 channelID, string text);
99// //UInt32 llListen(UInt16 channelID, string name, LSO_Enums.Key ID, string msg);
100// //void llListenControl(UInt32 number, UInt32 active);
101// //void llListenRemove(UInt32 number);
102// //void llSensor(string name, LSO_Enums.Key id, UInt32 type, float range, float arc);
103// //void llSensorRepeat(string name, LSO_Enums.Key id, UInt32 type, float range, float arc, float rate);
104// //void llSensorRemove();
105// //string llDetectedName(UInt32 number);
106// //LSO_Enums.Key llDetectedKey(UInt32 number);
107// //LSO_Enums.Key llDetectedOwner(UInt32 number);
108// //UInt32 llDetectedType(UInt32 number);
109// //LSO_Enums.Vector llDetectedPos(UInt32 number);
110// //LSO_Enums.Vector llDetectedVel(UInt32 number);
111// //LSO_Enums.Vector llDetectedGrab(UInt32 number);
112// //LSO_Enums.Rotation llDetectedRot(UInt32 number);
113// //UInt32 llDetectedGroup(UInt32 number);
114// //UInt32 llDetectedLinkNumber(UInt32 number);
115// //void llDie();
116// //float llGround(LSO_Enums.Vector offset);
117// //float llCloud(LSO_Enums.Vector offset);
118// //LSO_Enums.Vector llWind(LSO_Enums.Vector offset);
119// //void llSetStatus(UInt32 status, UInt32 value);
120// //UInt32 llGetStatus(UInt32 status);
121// //void llSetScale(LSO_Enums.Vector scale);
122// //LSO_Enums.Vector llGetScale();
123// //void llSetColor();
124// //float llGetAlpha();
125// //void llSetAlpha();
126// //LSO_Enums.Vector llGetColor();
127// //void llSetTexture();
128// //void llScaleTexture();
129// //void llOffsetTexture();
130// //void llRotateTexture();
131// //string llGetTexture();
132// //void llSetPos();
133
134// public void llGetPos() { }
135// public void llGetLocalPos() { }
136// public void llSetRot() { }
137// public void llGetRot() { }
138// public void llGetLocalRot() { }
139// public void llSetForce() { }
140// public void llGetForce() { }
141// public void llTarget() { }
142// public void llTargetRemove() { }
143// public void llRotTarget() { }
144// public void llRotTargetRemove() { }
145// public void llMoveToTarget() { }
146// public void llStopMoveToTarget() { }
147// public void llApplyImpulse() { }
148// public void llApplyRotationalImpulse() { }
149// public void llSetTorque() { }
150// public void llGetTorque() { }
151// public void llSetForceAndTorque() { }
152// public void llGetVel() { }
153// public void llGetAccel() { }
154// public void llGetOmega() { }
155// public void llGetTimeOfDay() { }
156// public void llGetWallclock() { }
157// public void llGetTime() { }
158// public void llResetTime() { }
159// public void llGetAndResetTime() { }
160// public void llSound() { }
161// public void llPlaySound() { }
162// public void llLoopSound() { }
163// public void llLoopSoundMaster() { }
164// public void llLoopSoundSlave() { }
165// public void llPlaySoundSlave() { }
166// public void llTriggerSound() { }
167// public void llStopSound() { }
168// public void llPreloadSound() { }
169// public void llGetSubString() { }
170// public void llDeleteSubString() { }
171// public void llInsertString() { }
172// public void llToUpper() { }
173// public void llToLower() { }
174// public void llGiveMoney() { }
175// public void llMakeExplosion() { }
176// public void llMakeFountain() { }
177// public void llMakeSmoke() { }
178// public void llMakeFire() { }
179// public void llRezObject() { }
180// public void llLookAt() { }
181// public void llStopLookAt() { }
182// public void llSetTimerEvent() { }
183// public void llSleep() { }
184// public void llGetMass() { }
185// public void llCollisionFilter() { }
186// public void llTakeControls() { }
187// public void llReleaseControls() { }
188// public void llAttachToAvatar() { }
189// public void llDetachFromAvatar() { }
190// public void llTakeCamera() { }
191// public void llReleaseCamera() { }
192// public void llGetOwner() { }
193// public void llInstantMessage() { }
194// public void llEmail() { }
195// public void llGetNextEmail() { }
196// public void llGetKey() { }
197// public void llSetBuoyancy() { }
198// public void llSetHoverHeight() { }
199// public void llStopHover() { }
200// public void llMinEventDelay() { }
201// public void llSoundPreload() { }
202// public void llRotLookAt() { }
203// public void llStringLength() { }
204// public void llStartAnimation() { }
205// public void llStopAnimation() { }
206// public void llPointAt() { }
207// public void llStopPointAt() { }
208// public void llTargetOmega() { }
209// public void llGetStartParameter() { }
210// public void llGodLikeRezObject() { }
211// public void llRequestPermissions() { }
212// public void llGetPermissionsKey() { }
213// public void llGetPermissions() { }
214// public void llGetLinkNumber() { }
215// public void llSetLinkColor() { }
216// public void llCreateLink() { }
217// public void llBreakLink() { }
218// public void llBreakAllLinks() { }
219// public void llGetLinkKey() { }
220// public void llGetLinkName() { }
221// public void llGetInventoryNumber() { }
222// public void llGetInventoryName() { }
223// public void llSetScriptState() { }
224// public void llGetEnergy() { }
225// public void llGiveInventory() { }
226// public void llRemoveInventory() { }
227// public void llSetText() { }
228// public void llWater() { }
229// public void llPassTouches() { }
230// public void llRequestAgentData() { }
231// public void llRequestInventoryData() { }
232// public void llSetDamage() { }
233// public void llTeleportAgentHome() { }
234// public void llModifyLand() { }
235// public void llCollisionSound() { }
236// public void llCollisionSprite() { }
237// public void llGetAnimation() { }
238// public void llResetScript() { }
239// public void llMessageLinked() { }
240// public void llPushObject() { }
241// public void llPassCollisions() { }
242// public void llGetScriptName() { }
243// public void llGetNumberOfSides() { }
244// public void llAxisAngle2Rot() { }
245// public void llRot2Axis() { }
246// public void llRot2Angle() { }
247// public void llAcos() { }
248// public void llAsin() { }
249// public void llAngleBetween() { }
250// public void llGetInventoryKey() { }
251// public void llAllowInventoryDrop() { }
252// public void llGetSunDirection() { }
253// public void llGetTextureOffset() { }
254// public void llGetTextureScale() { }
255// public void llGetTextureRot() { }
256// public void llSubStringIndex() { }
257// public void llGetOwnerKey() { }
258// public void llGetCenterOfMass() { }
259// public void llListSort() { }
260// public void llGetListLength() { }
261// public void llList2Integer() { }
262// public void llList2Float() { }
263// public void llList2String() { }
264// public void llList2Key() { }
265// public void llList2Vector() { }
266// public void llList2Rot() { }
267// public void llList2List() { }
268// public void llDeleteSubList() { }
269// public void llGetListEntryType() { }
270// public void llList2CSV() { }
271// public void llCSV2List() { }
272// public void llListRandomize() { }
273// public void llList2ListStrided() { }
274// public void llGetRegionCorner() { }
275// public void llListInsertList() { }
276// public void llListFindList() { }
277// public void llGetObjectName() { }
278// public void llSetObjectName() { }
279// public void llGetDate() { }
280// public void llEdgeOfWorld() { }
281// public void llGetAgentInfo() { }
282// public void llAdjustSoundVolume() { }
283// public void llSetSoundQueueing() { }
284// public void llSetSoundRadius() { }
285// public void llKey2Name() { }
286// public void llSetTextureAnim() { }
287// public void llTriggerSoundLimited() { }
288// public void llEjectFromLand() { }
289// public void llParseString2List() { }
290// public void llOverMyLand() { }
291// public void llGetLandOwnerAt() { }
292// public void llGetNotecardLine() { }
293// public void llGetAgentSize() { }
294// public void llSameGroup() { }
295// public void llUnSit() { }
296// public void llGroundSlope() { }
297// public void llGroundNormal() { }
298// public void llGroundContour() { }
299// public void llGetAttached() { }
300// public void llGetFreeMemory() { }
301// public void llGetRegionName() { }
302// public void llGetRegionTimeDilation() { }
303// public void llGetRegionFPS() { }
304// public void llParticleSystem() { }
305// public void llGroundRepel() { }
306// public void llGiveInventoryList() { }
307// public void llSetVehicleType() { }
308// public void llSetVehicleFloatParam() { }
309// public void llSetVehicleVectorParam() { }
310// public void llSetVehicleRotationParam() { }
311// public void llSetVehicleFlags() { }
312// public void llRemoveVehicleFlags() { }
313// public void llSitTarget() { }
314// public void llAvatarOnSitTarget() { }
315// public void llAddToLandPassList() { }
316// public void llSetTouchText() { }
317// public void llSetSitText() { }
318// public void llSetCameraEyeOffset() { }
319// public void llSetCameraAtOffset() { }
320// public void llDumpList2String() { }
321// public void llScriptDanger() { }
322// public void llDialog() { }
323// public void llVolumeDetect() { }
324// public void llResetOtherScript() { }
325// public void llGetScriptState() { }
326// public void llRemoteLoadScript() { }
327// public void llSetRemoteScriptAccessPin() { }
328// public void llRemoteLoadScriptPin() { }
329// public void llOpenRemoteDataChannel() { }
330// public void llSendRemoteData() { }
331// public void llRemoteDataReply() { }
332// public void llCloseRemoteDataChannel() { }
333// public void llMD5String() { }
334// public void llSetPrimitiveParams() { }
335// public void llStringToBase64() { }
336// public void llBase64ToString() { }
337// public void llXorBase64Strings() { }
338// public void llRemoteDataSetRegion() { }
339// public void llLog10() { }
340// public void llLog() { }
341// public void llGetAnimationList() { }
342// public void llSetParcelMusicURL() { }
343// public void llGetRootPosition() { }
344// public void llGetRootRotation() { }
345// public void llGetObjectDesc() { }
346// public void llSetObjectDesc() { }
347// public void llGetCreator() { }
348// public void llGetTimestamp() { }
349// public void llSetLinkAlpha() { }
350// public void llGetNumberOfPrims() { }
351// public void llGetNumberOfNotecardLines() { }
352// public void llGetBoundingBox() { }
353// public void llGetGeometricCenter() { }
354// public void llGetPrimitiveParams() { }
355// public void llIntegerToBase64() { }
356// public void llBase64ToInteger() { }
357// public void llGetGMTclock() { }
358// public void llGetSimulatorHostname() { }
359// public void llSetLocalRot() { }
360// public void llParseStringKeepNulls() { }
361// public void llRezAtRoot() { }
362// public void llGetObjectPermMask() { }
363// public void llSetObjectPermMask() { }
364// public void llGetInventoryPermMask() { }
365// public void llSetInventoryPermMask() { }
366// public void llGetInventoryCreator() { }
367// public void llOwnerSay() { }
368// public void llRequestSimulatorData() { }
369// public void llForceMouselook() { }
370// public void llGetObjectMass() { }
371// public void llListReplaceList() { }
372// public void llLoadURL() { }
373// public void llParcelMediaCommandList() { }
374// public void llParcelMediaQuery() { }
375// public void llModPow() { }
376// public void llGetInventoryType() { }
377// public void llSetPayPrice() { }
378// public void llGetCameraPos() { }
379// public void llGetCameraRot() { }
380// public void llSetPrimURL() { }
381// public void llRefreshPrimURL() { }
382// public void llEscapeURL() { }
383// public void llUnescapeURL() { }
384// public void llMapDestination() { }
385// public void llAddToLandBanList() { }
386// public void llRemoveFromLandPassList() { }
387// public void llRemoveFromLandBanList() { }
388// public void llSetCameraParams() { }
389// public void llClearCameraParams() { }
390// public void llListStatistics() { }
391// public void llGetUnixTime() { }
392// public void llGetParcelFlags() { }
393// public void llGetRegionFlags() { }
394// public void llXorBase64StringsCorrect() { }
395// public void llHTTPRequest() { }
396// public void llResetLandBanList() { }
397// public void llResetLandPassList() { }
398// public void llGetParcelPrimCount() { }
399// public void llGetParcelPrimOwners() { }
400// public void llGetObjectPrimCount() { }
401// public void llGetParcelMaxPrims() { }
402// public void llGetParcelDetails() { }
403
404// }
405//}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
deleted file mode 100644
index 11b567e..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_BaseClass_OPCODES.cs
+++ /dev/null
@@ -1,393 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
31{
32 public partial class LSL_BaseClass
33 {
34 /*
35 * OPCODES
36 *
37 * These are internal "assembly" commands,
38 * basic operators like "ADD", "PUSH" and "POP"
39 *
40 * It also contains managed stack and keeps track of internal variables, etc.
41 *
42 */
43
44
45 public void StoreToLocal(UInt32 index)
46 {
47 // TODO: How to determine local?
48 Common.SendToDebug("::StoreToLocal " + index);
49 if (LocalVariables.ContainsKey(index))
50 LocalVariables.Remove(index);
51 LocalVariables.Add(index, LSLStack.Peek());
52 }
53
54 public void StoreToGlobal(UInt32 index)
55 {
56 Common.SendToDebug("::StoreToGlobal " + index);
57 if (GlobalVariables.ContainsKey(index))
58 GlobalVariables.Remove(index);
59 GlobalVariables.Add(index, LSLStack.Peek());
60 }
61
62 public void StoreToStatic(UInt32 index)
63 {
64 Common.SendToDebug("::StoreToStatic " + index);
65 //if (StaticVariables.ContainsKey(index))
66 // StaticVariables.Remove(index);
67 StaticVariables.Add(index, LSLStack.Peek());
68 }
69
70 public void GetFromLocal(UInt32 index)
71 {
72 // TODO: How to determine local?
73 Common.SendToDebug("::GetFromLocal " + index);
74 object ret;
75 LocalVariables.TryGetValue(index, out ret);
76 LSLStack.Push(ret);
77 //return ret;
78 }
79
80 public void GetFromGlobal(UInt32 index)
81 {
82 Common.SendToDebug("::GetFromGlobal " + index);
83 object ret;
84 GlobalVariables.TryGetValue(index, out ret);
85 LSLStack.Push(ret);
86 //return ret;
87 }
88
89 public void GetFromStatic(UInt32 index)
90 {
91 Common.SendToDebug("::GetFromStatic " + index);
92 object ret;
93 StaticVariables.TryGetValue(index, out ret);
94 Common.SendToDebug("::GetFromStatic - ObjectType: " + ret.GetType().ToString());
95 LSLStack.Push(ret);
96 //return ret;
97 }
98
99 public object POPToStack()
100 {
101 Common.SendToDebug("::POPToStack");
102 //return LSLStack.Pop();
103 object p = LSLStack.Pop();
104 if (p.GetType() == typeof (UInt32))
105 return (UInt32) p;
106 if (p.GetType() == typeof (string))
107 return (string) p;
108 if (p.GetType() == typeof (Int32))
109 return (Int32) p;
110 if (p.GetType() == typeof (UInt16))
111 return (UInt16) p;
112 if (p.GetType() == typeof (float))
113 return (float) p;
114 if (p.GetType() == typeof (LSO_Enums.Vector))
115 return (LSO_Enums.Vector) p;
116 if (p.GetType() == typeof (LSO_Enums.Rotation))
117 return (LSO_Enums.Rotation) p;
118 if (p.GetType() == typeof (LSO_Enums.Key))
119 return (LSO_Enums.Key) p;
120
121 return p;
122 }
123
124 //public object POPToStack(UInt32 count)
125 //{
126 // // POP NUMBER FROM TOP OF STACK
127 // //LSLStack.SetLength(LSLStack.Length - 4);
128 // Common.SendToDebug("::POPToStack " + count);
129 // if (count < 2)
130 // return LSLStack.Pop();
131
132 // Stack<object> s = new Stack<object>();
133 // for (int i = 0; i < count; i++)
134 // {
135 // s.Push(LSLStack.Pop);
136
137 // }
138
139 //}
140
141 public void POP()
142 {
143 // POP NUMBER FROM TOP OF STACK
144 //LSLStack.SetLength(LSLStack.Length - 4);
145 Common.SendToDebug("::POP");
146 if (LSLStack.Count < 1)
147 {
148 //TODO: Temporary fix
149 Common.SendToDebug("ERROR: TRYING TO POP EMPTY STACK!");
150 }
151 else
152 {
153 LSLStack.Pop();
154 }
155 }
156
157 public void PUSH(object Param)
158 {
159 if (Param == null)
160 {
161 Common.SendToDebug("::PUSH: <null>");
162 }
163 else
164 {
165 //Common.SendToDebug("::PUSH: " + Param.GetType());
166 }
167
168 LSLStack.Push(Param);
169 }
170
171 public void ADD(UInt32 Param)
172 {
173 Common.SendToDebug("::ADD: " + Param);
174 object o2 = LSLStack.Pop();
175 object o1 = LSLStack.Pop();
176 Common.SendToDebug("::ADD: Debug: o1: " + o1.GetType() + " (" + o1.ToString() + "), o2: " + o2.GetType() +
177 " (" + o2.ToString() + ")");
178 if (o2.GetType() == typeof (string))
179 {
180 LSLStack.Push((string) o1 + (string) o2);
181 return;
182 }
183 if (o2.GetType() == typeof (UInt32))
184 {
185 LSLStack.Push((UInt32) o1 + (UInt32) o2);
186 return;
187 }
188 }
189
190 public void SUB(UInt32 Param)
191 {
192 Common.SendToDebug("::SUB: " + Param);
193 UInt32 i2 = (UInt32) LSLStack.Pop();
194 UInt32 i1 = (UInt32) LSLStack.Pop();
195 LSLStack.Push((UInt32) (i1 - i2));
196 }
197
198 public void MUL(UInt32 Param)
199 {
200 Common.SendToDebug("::SUB: " + Param);
201 UInt32 i2 = (UInt32) LSLStack.Pop();
202 UInt32 i1 = (UInt32) LSLStack.Pop();
203 LSLStack.Push((UInt32) (i1*i2));
204 }
205
206 public void DIV(UInt32 Param)
207 {
208 Common.SendToDebug("::DIV: " + Param);
209 UInt32 i2 = (UInt32) LSLStack.Pop();
210 UInt32 i1 = (UInt32) LSLStack.Pop();
211 LSLStack.Push((UInt32) (i1/i2));
212 }
213
214
215 public void MOD(UInt32 Param)
216 {
217 Common.SendToDebug("::MOD: " + Param);
218 UInt32 i2 = (UInt32) LSLStack.Pop();
219 UInt32 i1 = (UInt32) LSLStack.Pop();
220 LSLStack.Push((UInt32) (i1%i2));
221 }
222
223 public void EQ(UInt32 Param)
224 {
225 Common.SendToDebug("::EQ: " + Param);
226 UInt32 i2 = (UInt32) LSLStack.Pop();
227 UInt32 i1 = (UInt32) LSLStack.Pop();
228 if (i1 == i2)
229 {
230 LSLStack.Push((UInt32) 1);
231 }
232 else
233 {
234 LSLStack.Push((UInt32) 0);
235 }
236 }
237
238 public void NEQ(UInt32 Param)
239 {
240 Common.SendToDebug("::NEQ: " + Param);
241 UInt32 i2 = (UInt32) LSLStack.Pop();
242 UInt32 i1 = (UInt32) LSLStack.Pop();
243 if (i1 != i2)
244 {
245 LSLStack.Push((UInt32) 1);
246 }
247 else
248 {
249 LSLStack.Push((UInt32) 0);
250 }
251 }
252
253 public void LEQ(UInt32 Param)
254 {
255 Common.SendToDebug("::LEQ: " + Param);
256 UInt32 i2 = (UInt32) LSLStack.Pop();
257 UInt32 i1 = (UInt32) LSLStack.Pop();
258 if (i1 <= i2)
259 {
260 LSLStack.Push((UInt32) 1);
261 }
262 else
263 {
264 LSLStack.Push((UInt32) 0);
265 }
266 }
267
268 public void GEQ(UInt32 Param)
269 {
270 Common.SendToDebug("::GEQ: " + Param);
271 UInt32 i2 = (UInt32) LSLStack.Pop();
272 UInt32 i1 = (UInt32) LSLStack.Pop();
273 if (i1 >= i2)
274 {
275 LSLStack.Push((UInt32) 1);
276 }
277 else
278 {
279 LSLStack.Push((UInt32) 0);
280 }
281 }
282
283 public void LESS(UInt32 Param)
284 {
285 Common.SendToDebug("::LESS: " + Param);
286 UInt32 i2 = (UInt32) LSLStack.Pop();
287 UInt32 i1 = (UInt32) LSLStack.Pop();
288 if (i1 < i2)
289 {
290 LSLStack.Push((UInt32) 1);
291 }
292 else
293 {
294 LSLStack.Push((UInt32) 0);
295 }
296 }
297
298 public void GREATER(UInt32 Param)
299 {
300 Common.SendToDebug("::GREATER: " + Param);
301 UInt32 i2 = (UInt32) LSLStack.Pop();
302 UInt32 i1 = (UInt32) LSLStack.Pop();
303 if (i1 > i2)
304 {
305 LSLStack.Push((UInt32) 1);
306 }
307 else
308 {
309 LSLStack.Push((UInt32) 0);
310 }
311 }
312
313
314 public void BITAND()
315 {
316 Common.SendToDebug("::BITAND");
317 UInt32 i2 = (UInt32) LSLStack.Pop();
318 UInt32 i1 = (UInt32) LSLStack.Pop();
319 LSLStack.Push((UInt32) (i1 & i2));
320 }
321
322 public void BITOR()
323 {
324 Common.SendToDebug("::BITOR");
325 UInt32 i2 = (UInt32) LSLStack.Pop();
326 UInt32 i1 = (UInt32) LSLStack.Pop();
327 LSLStack.Push((UInt32) (i1 | i2));
328 }
329
330 public void BITXOR()
331 {
332 Common.SendToDebug("::BITXOR");
333 UInt32 i2 = (UInt32) LSLStack.Pop();
334 UInt32 i1 = (UInt32) LSLStack.Pop();
335 LSLStack.Push((UInt32) (i1 ^ i2));
336 }
337
338 public void BOOLAND()
339 {
340 Common.SendToDebug("::BOOLAND");
341 bool b2 = bool.Parse((string) LSLStack.Pop());
342 bool b1 = bool.Parse((string) LSLStack.Pop());
343 if (b1 && b2)
344 {
345 LSLStack.Push((UInt32) 1);
346 }
347 else
348 {
349 LSLStack.Push((UInt32) 0);
350 }
351 }
352
353 public void BOOLOR()
354 {
355 Common.SendToDebug("::BOOLOR");
356 bool b2 = bool.Parse((string) LSLStack.Pop());
357 bool b1 = bool.Parse((string) LSLStack.Pop());
358
359 if (b1 || b2)
360 {
361 LSLStack.Push((UInt32) 1);
362 }
363 else
364 {
365 LSLStack.Push((UInt32) 0);
366 }
367 }
368
369 public void NEG(UInt32 Param)
370 {
371 Common.SendToDebug("::NEG: " + Param);
372 //UInt32 i2 = (UInt32)LSLStack.Pop();
373 UInt32 i1 = (UInt32) LSLStack.Pop();
374 LSLStack.Push((UInt32) (i1*-1));
375 }
376
377 public void BITNOT()
378 {
379 //Common.SendToDebug("::BITNOT");
380 //UInt32 i2 = (UInt32)LSLStack.Pop();
381 //UInt32 i1 = (UInt32)LSLStack.Pop();
382 //LSLStack.Push((UInt32)(i1 / i2));
383 }
384
385 public void BOOLNOT()
386 {
387 //Common.SendToDebug("::BOOLNOT");
388 ////UInt32 i2 = (UInt32)LSLStack.Pop();
389 //UInt32 i1 = (UInt32)LSLStack.Pop();
390 //LSLStack.Push((UInt32)(i1));
391 }
392 }
393}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
deleted file mode 100644
index e357b45..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_CLRInterface.cs
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
30{
31 public class LSL_CLRInterface
32 {
33 public interface LSLScript
34 {
35 //public virtual void Run(object arg)
36 //{
37 //}
38 //void Run(object arg);
39
40 //void event_state_entry(object arg);
41 //void event_state_exit();
42 //void event_touch_start(object arg);
43 //void event_touch();
44 //void event_touch_end();
45 //void event_collision_start();
46 //void event_collision();
47 //void event_collision_end();
48 //void event_land_collision_start();
49 //void event_land_collision();
50 //void event_land_collision_end();
51 //void event_timer();
52 //void event_listen();
53 //void event_on_rez();
54 //void event_sensor();
55 //void event_no_sensor();
56 //void event_control();
57 //void event_money();
58 //void event_email();
59 //void event_at_target();
60 //void event_not_at_target();
61 //void event_at_rot_target();
62 //void event_not_at_rot_target();
63 //void event_run_time_permissions();
64 //void event_changed();
65 //void event_attach();
66 //void event_dataserver();
67 //void event_link_message();
68 //void event_moving_start();
69 //void event_moving_end();
70 //void event_object_rez();
71 //void event_remote_data();
72 //void event_http_response();
73 }
74 }
75}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
deleted file mode 100644
index 967da76..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSL_OPCODE_IL_processor.cs
+++ /dev/null
@@ -1,435 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.Reflection;
31using System.Reflection.Emit;
32using OpenSim.Region.ScriptEngine.Common;
33
34namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
35{
36 internal partial class LSO_Parser
37 {
38 //internal Stack<Type> ILStack = new Stack<Type>();
39 //LSO_Enums MyLSO_Enums = new LSO_Enums();
40
41 internal bool LSL_PROCESS_OPCODE(ILGenerator il)
42 {
43 byte bp1;
44 UInt32 u32p1;
45 float fp1;
46 UInt16 opcode = br_read(1)[0];
47 Common.SendToDebug("OPCODE: " + ((LSO_Enums.Operation_Table) opcode).ToString());
48 string idesc = ((LSO_Enums.Operation_Table) opcode).ToString();
49 switch ((LSO_Enums.Operation_Table) opcode)
50 {
51 /***************
52 * IMPLEMENTED *
53 ***************/
54 case LSO_Enums.Operation_Table.NOOP:
55 break;
56 case LSO_Enums.Operation_Table.PUSHSP:
57 // Push Stack Top (Memory Address) to stack
58 Common.SendToDebug("Instruction " + idesc);
59 Common.SendToDebug("Instruction " + idesc +
60 ": Description: Pushing Stack Top (Memory Address from header) to stack");
61 IL_Push(il, (UInt32) myHeader.SP);
62 break;
63 // BYTE
64 case LSO_Enums.Operation_Table.PUSHARGB:
65 Common.SendToDebug("Param1: " + br_read(1)[0]);
66 break;
67 // INTEGER
68 case LSO_Enums.Operation_Table.PUSHARGI:
69 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
70 Common.SendToDebug("Instruction " + idesc + ", Param1: " + u32p1);
71 IL_Push(il, u32p1);
72 break;
73 // FLOAT
74 case LSO_Enums.Operation_Table.PUSHARGF:
75 fp1 = BitConverter.ToUInt32(br_read(4), 0);
76 Common.SendToDebug("Instruction " + idesc + ", Param1: " + fp1);
77 IL_Push(il, fp1);
78 break;
79 // STRING
80 case LSO_Enums.Operation_Table.PUSHARGS:
81 string s = Read_String();
82 Common.SendToDebug("Instruction " + idesc + ", Param1: " + s);
83 IL_Debug(il, "OPCODE: " + idesc + ":" + s);
84 IL_Push(il, s);
85 break;
86 // VECTOR z,y,x
87 case LSO_Enums.Operation_Table.PUSHARGV:
88 LSO_Enums.Vector v = new LSO_Enums.Vector();
89 v.Z = BitConverter.ToUInt32(br_read(4), 0);
90 v.Y = BitConverter.ToUInt32(br_read(4), 0);
91 v.X = BitConverter.ToUInt32(br_read(4), 0);
92 Common.SendToDebug("Param1 Z: " + v.Z);
93 Common.SendToDebug("Param1 Y: " + v.Y);
94 Common.SendToDebug("Param1 X: " + v.X);
95 IL_Push(il, v);
96 break;
97 // ROTATION s,z,y,x
98 case LSO_Enums.Operation_Table.PUSHARGQ:
99 LSO_Enums.Rotation r = new LSO_Enums.Rotation();
100 r.S = BitConverter.ToUInt32(br_read(4), 0);
101 r.Z = BitConverter.ToUInt32(br_read(4), 0);
102 r.Y = BitConverter.ToUInt32(br_read(4), 0);
103 r.X = BitConverter.ToUInt32(br_read(4), 0);
104 Common.SendToDebug("Param1 S: " + r.S);
105 Common.SendToDebug("Param1 Z: " + r.Z);
106 Common.SendToDebug("Param1 Y: " + r.Y);
107 Common.SendToDebug("Param1 X: " + r.X);
108 IL_Push(il, r);
109 break;
110
111 case LSO_Enums.Operation_Table.PUSHE:
112 IL_Push(il, (UInt32) 0);
113 break;
114
115 case LSO_Enums.Operation_Table.PUSHARGE:
116 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
117 Common.SendToDebug("Param1: " + u32p1);
118 //IL_Push(il, new string(" ".ToCharArray()[0], Convert.ToInt32(u32p1)));
119 IL_Push(il, u32p1);
120 break;
121 // BYTE
122 case LSO_Enums.Operation_Table.ADD:
123 case LSO_Enums.Operation_Table.SUB:
124 case LSO_Enums.Operation_Table.MUL:
125 case LSO_Enums.Operation_Table.DIV:
126 case LSO_Enums.Operation_Table.EQ:
127 case LSO_Enums.Operation_Table.NEQ:
128 case LSO_Enums.Operation_Table.LEQ:
129 case LSO_Enums.Operation_Table.GEQ:
130 case LSO_Enums.Operation_Table.LESS:
131 case LSO_Enums.Operation_Table.GREATER:
132 case LSO_Enums.Operation_Table.NEG:
133 case LSO_Enums.Operation_Table.MOD:
134 bp1 = br_read(1)[0];
135 Common.SendToDebug("Param1: " + bp1);
136 IL_CallBaseFunction(il, idesc, (UInt32) bp1);
137 break;
138
139 // NO ARGUMENTS
140 case LSO_Enums.Operation_Table.BITAND:
141 case LSO_Enums.Operation_Table.BITOR:
142 case LSO_Enums.Operation_Table.BITXOR:
143 case LSO_Enums.Operation_Table.BOOLAND:
144 case LSO_Enums.Operation_Table.BOOLOR:
145 case LSO_Enums.Operation_Table.BITNOT:
146 case LSO_Enums.Operation_Table.BOOLNOT:
147 IL_CallBaseFunction(il, idesc);
148 break;
149 // SHORT
150 case LSO_Enums.Operation_Table.CALLLIB_TWO_BYTE:
151 // TODO: What is size of short?
152 UInt16 U16p1 = BitConverter.ToUInt16(br_read(2), 0);
153 Common.SendToDebug("Instruction " + idesc + ": Builtin Command: " +
154 ((LSO_Enums.BuiltIn_Functions) U16p1).ToString());
155 //Common.SendToDebug("Param1: " + U16p1);
156 string fname = ((LSO_Enums.BuiltIn_Functions) U16p1).ToString();
157
158 bool cmdFound = false;
159 foreach (MethodInfo mi in typeof (LSL_BuiltIn_Commands_Interface).GetMethods())
160 {
161 // Found command
162 if (mi.Name == fname)
163 {
164 il.Emit(OpCodes.Ldarg_0);
165 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("GetLSL_BuiltIn", new Type[] {}));
166 // Pop required number of items from my stack to .Net stack
167 IL_PopToStack(il, mi.GetParameters().Length);
168 il.Emit(OpCodes.Callvirt, mi);
169 cmdFound = true;
170 break;
171 }
172 }
173 if (cmdFound == false)
174 {
175 Common.SendToDebug("ERROR: UNABLE TO LOCATE OPCODE " + idesc + " IN BASECLASS");
176 }
177
178 break;
179
180 // RETURN
181 case LSO_Enums.Operation_Table.RETURN:
182
183 Common.SendToDebug("OPCODE: RETURN");
184 return true;
185
186 case LSO_Enums.Operation_Table.POP:
187 case LSO_Enums.Operation_Table.POPS:
188 case LSO_Enums.Operation_Table.POPL:
189 case LSO_Enums.Operation_Table.POPV:
190 case LSO_Enums.Operation_Table.POPQ:
191 // Pops a specific datatype from the stack
192 // We just ignore the datatype for now
193 IL_Pop(il);
194 break;
195
196 // LONG
197 case LSO_Enums.Operation_Table.STORE:
198 case LSO_Enums.Operation_Table.STORES:
199 case LSO_Enums.Operation_Table.STOREL:
200 case LSO_Enums.Operation_Table.STOREV:
201 case LSO_Enums.Operation_Table.STOREQ:
202 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
203 Common.SendToDebug("Param1: " + u32p1.ToString());
204 IL_CallBaseFunction(il, "StoreToLocal", u32p1);
205 break;
206
207 case LSO_Enums.Operation_Table.STOREG:
208 case LSO_Enums.Operation_Table.STOREGS:
209 case LSO_Enums.Operation_Table.STOREGL:
210 case LSO_Enums.Operation_Table.STOREGV:
211 case LSO_Enums.Operation_Table.STOREGQ:
212 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
213 Common.SendToDebug("Param1: " + u32p1.ToString());
214 IL_CallBaseFunction(il, "StoreToGlobal", u32p1);
215 break;
216
217 case LSO_Enums.Operation_Table.LOADP:
218 case LSO_Enums.Operation_Table.LOADSP:
219 case LSO_Enums.Operation_Table.LOADLP:
220 case LSO_Enums.Operation_Table.LOADVP:
221 case LSO_Enums.Operation_Table.LOADQP:
222 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
223 Common.SendToDebug("Param1: " + u32p1.ToString());
224 IL_CallBaseFunction(il, "StoreToLocal", u32p1);
225 IL_Pop(il);
226 break;
227
228 case LSO_Enums.Operation_Table.LOADGP:
229 case LSO_Enums.Operation_Table.LOADGSP:
230 case LSO_Enums.Operation_Table.LOADGLP:
231 case LSO_Enums.Operation_Table.LOADGVP:
232 case LSO_Enums.Operation_Table.LOADGQP:
233 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
234 Common.SendToDebug("Param1: " + u32p1.ToString());
235 IL_CallBaseFunction(il, "StoreToStatic", u32p1 - 6 + myHeader.GVR);
236 IL_Pop(il);
237 break;
238
239 // PUSH FROM LOCAL FRAME
240 case LSO_Enums.Operation_Table.PUSH:
241 case LSO_Enums.Operation_Table.PUSHS:
242 case LSO_Enums.Operation_Table.PUSHL:
243 case LSO_Enums.Operation_Table.PUSHV:
244 case LSO_Enums.Operation_Table.PUSHQ:
245 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
246 Common.SendToDebug("Param1: " + u32p1.ToString());
247 IL_CallBaseFunction(il, "GetFromLocal", u32p1);
248
249 break;
250
251 // PUSH FROM STATIC FRAME
252 case LSO_Enums.Operation_Table.PUSHG:
253 case LSO_Enums.Operation_Table.PUSHGS:
254 case LSO_Enums.Operation_Table.PUSHGL:
255 case LSO_Enums.Operation_Table.PUSHGV:
256 case LSO_Enums.Operation_Table.PUSHGQ:
257 u32p1 = BitConverter.ToUInt32(br_read(4), 0);
258 Common.SendToDebug("Param1: " + u32p1.ToString());
259 IL_CallBaseFunction(il, "GetFromStatic", u32p1 - 6 + myHeader.GVR);
260 break;
261
262
263 /***********************
264 * NOT IMPLEMENTED YET *
265 ***********************/
266
267
268 case LSO_Enums.Operation_Table.POPIP:
269 case LSO_Enums.Operation_Table.POPSP:
270 case LSO_Enums.Operation_Table.POPSLR:
271 case LSO_Enums.Operation_Table.POPARG:
272 case LSO_Enums.Operation_Table.POPBP:
273 //Common.SendToDebug("Instruction " + idesc + ": Ignored");
274 Common.SendToDebug("Instruction " + idesc +
275 ": Description: Drop x bytes from the stack (TODO: Only popping 1)");
276 //Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
277 IL_Pop(il);
278 break;
279
280
281 // None
282 case LSO_Enums.Operation_Table.PUSHIP:
283 // PUSH INSTRUCTION POINTER
284 break;
285 case LSO_Enums.Operation_Table.PUSHBP:
286
287 case LSO_Enums.Operation_Table.PUSHEV:
288 break;
289 case LSO_Enums.Operation_Table.PUSHEQ:
290 break;
291
292
293 // LONG
294 case LSO_Enums.Operation_Table.JUMP:
295 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
296 break;
297 // BYTE, LONG
298 case LSO_Enums.Operation_Table.JUMPIF:
299 case LSO_Enums.Operation_Table.JUMPNIF:
300 Common.SendToDebug("Param1: " + br_read(1)[0]);
301 Common.SendToDebug("Param2: " + BitConverter.ToUInt32(br_read(4), 0));
302 break;
303 // LONG
304 case LSO_Enums.Operation_Table.STATE:
305 bp1 = br_read(1)[0];
306 //il.Emit(OpCodes.Ld); // Load local variable 0 onto stack
307 //il.Emit(OpCodes.Ldc_I4, 0); // Push index position
308 //il.Emit(OpCodes.Ldstr, EventList[p1]); // Push value
309 //il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value
310 break;
311 case LSO_Enums.Operation_Table.CALL:
312 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
313 Common.SendToDebug("ERROR: Function CALL not implemented yet.");
314 break;
315 // BYTE
316 case LSO_Enums.Operation_Table.CAST:
317 bp1 = br_read(1)[0];
318 Common.SendToDebug("Instruction " + idesc + ": Cast to type: " +
319 ((LSO_Enums.OpCode_Cast_TypeDefs) bp1));
320 Common.SendToDebug("Param1: " + bp1);
321 switch ((LSO_Enums.OpCode_Cast_TypeDefs) bp1)
322 {
323 case LSO_Enums.OpCode_Cast_TypeDefs.String:
324 Common.SendToDebug("Instruction " + idesc + ": il.Emit(OpCodes.Box, ILStack.Pop());");
325 break;
326 default:
327 Common.SendToDebug("Instruction " + idesc + ": Unknown cast type!");
328 break;
329 }
330 break;
331 // LONG
332 case LSO_Enums.Operation_Table.STACKTOS:
333 case LSO_Enums.Operation_Table.STACKTOL:
334 Common.SendToDebug("Param1: " + BitConverter.ToUInt32(br_read(4), 0));
335 break;
336 // BYTE
337 case LSO_Enums.Operation_Table.PRINT:
338 case LSO_Enums.Operation_Table.CALLLIB:
339 Common.SendToDebug("Param1: " + br_read(1)[0]);
340 break;
341 }
342 return false;
343 }
344
345 private void IL_PopToStack(ILGenerator il)
346 {
347 IL_PopToStack(il, 1);
348 }
349
350 private void IL_PopToStack(ILGenerator il, int count)
351 {
352 Common.SendToDebug("IL_PopToStack();");
353 for (int i = 0; i < count; i++)
354 {
355 IL_CallBaseFunction(il, "POPToStack");
356 //il.Emit(OpCodes.Ldarg_0);
357 //il.Emit(OpCodes.Call,
358 // typeof(LSL_BaseClass).GetMethod("POPToStack",
359 // new Type[] { }));
360 }
361 }
362
363 private void IL_Pop(ILGenerator il)
364 {
365 Common.SendToDebug("IL_Pop();");
366 IL_CallBaseFunction(il, "POP");
367 }
368
369 private void IL_Debug(ILGenerator il, string text)
370 {
371 il.Emit(OpCodes.Ldstr, text);
372 il.Emit(OpCodes.Call, typeof (Common).GetMethod("SendToDebug",
373 new Type[] {typeof (string)}
374 ));
375 }
376
377 private void IL_CallBaseFunction(ILGenerator il, string methodname)
378 {
379 il.Emit(OpCodes.Ldarg_0);
380 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {}));
381 }
382
383 private void IL_CallBaseFunction(ILGenerator il, string methodname, object data)
384 {
385 il.Emit(OpCodes.Ldarg_0);
386 if (data.GetType() == typeof (string))
387 il.Emit(OpCodes.Ldstr, (string) data);
388 if (data.GetType() == typeof (UInt32))
389 il.Emit(OpCodes.Ldc_I4, (UInt32) data);
390 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod(methodname, new Type[] {data.GetType()}));
391 }
392
393 private void IL_Push(ILGenerator il, object data)
394 {
395 il.Emit(OpCodes.Ldarg_0);
396 Common.SendToDebug("PUSH datatype: " + data.GetType());
397
398 IL_PushDataTypeToILStack(il, data);
399
400 il.Emit(OpCodes.Call, typeof (LSL_BaseClass).GetMethod("PUSH", new Type[] {data.GetType()}));
401 }
402
403 private void IL_PushDataTypeToILStack(ILGenerator il, object data)
404 {
405 if (data.GetType() == typeof (UInt16))
406 {
407 il.Emit(OpCodes.Ldc_I4, (UInt16) data);
408 il.Emit(OpCodes.Box, data.GetType());
409 }
410 if (data.GetType() == typeof (UInt32))
411 {
412 il.Emit(OpCodes.Ldc_I4, (UInt32) data);
413 il.Emit(OpCodes.Box, data.GetType());
414 }
415 if (data.GetType() == typeof (Int32))
416 {
417 il.Emit(OpCodes.Ldc_I4, (Int32) data);
418 il.Emit(OpCodes.Box, data.GetType());
419 }
420 if (data.GetType() == typeof (float))
421 {
422 il.Emit(OpCodes.Ldc_I4, (float) data);
423 il.Emit(OpCodes.Box, data.GetType());
424 }
425 if (data.GetType() == typeof (string))
426 il.Emit(OpCodes.Ldstr, (string) data);
427 //if (data.GetType() == typeof(LSO_Enums.Rotation))
428 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Rotation)data);
429 //if (data.GetType() == typeof(LSO_Enums.Vector))
430 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Vector)data);
431 //if (data.GetType() == typeof(LSO_Enums.Key))
432 // il.Emit(OpCodes.Ldobj, (LSO_Enums.Key)data);
433 }
434 }
435}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
deleted file mode 100644
index 97ccc18..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Enums.cs
+++ /dev/null
@@ -1,561 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30
31namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
32{
33 public static class LSO_Enums
34 {
35 //public System.Collections.Generic.Dictionary<Byte, Type> OpCode_Add_Types;
36
37 //LSO_Enums()
38 //{
39 // OpCode_Add_Types.Add(51, typeof(String));
40 // OpCode_Add_Types.Add(17, typeof(UInt32));
41 //}
42
43 [Serializable]
44 public enum OpCode_Add_TypeDefs
45 {
46 String = 51,
47 UInt32 = 17
48 }
49
50 [Serializable]
51 public enum OpCode_Cast_TypeDefs
52 {
53 String = 19
54 }
55
56 [Serializable]
57 public struct Key
58 {
59 public string KeyString;
60 }
61
62 [Serializable]
63 public struct Vector
64 {
65 public UInt32 Z;
66 public UInt32 Y;
67 public UInt32 X;
68 }
69
70 [Serializable]
71 public struct Rotation
72 {
73 public UInt32 S;
74 public UInt32 Z;
75 public UInt32 Y;
76 public UInt32 X;
77 }
78
79 [Serializable]
80 public enum Variable_Type_Codes
81 {
82 Void = 0,
83 Integer = 1,
84 Float = 2,
85 String = 3,
86 Key = 4,
87 Vector = 5,
88 Rotation = 6,
89 List = 7,
90 Null = 8
91 }
92
93 [Serializable]
94 public enum Event_Mask_Values
95 {
96 state_entry = 0,
97 state_exit = 1,
98 touch_start = 2,
99 touch = 3,
100 touch_end = 4,
101 collision_start = 5,
102 collision = 6,
103 collision_end = 7,
104 land_collision_start = 8,
105 land_collision = 9,
106 land_collision_end = 10,
107 timer = 11,
108 listen = 12,
109 on_rez = 13,
110 sensor = 14,
111 no_sensor = 15,
112 control = 16,
113 money = 17,
114 email = 18,
115 at_target = 19,
116 not_at_target = 20,
117 at_rot_target = 21,
118 not_at_rot_target = 22,
119 run_time_permissions = 23,
120 changed = 24,
121 attach = 25,
122 dataserver = 26,
123 link_message = 27,
124 moving_start = 28,
125 moving_end = 29,
126 object_rez = 30,
127 remote_data = 31,
128 http_response = 32
129 }
130
131 [Serializable]
132 public enum Operation_Table
133 {
134 NOOP = 0x0,
135 POP = 0x1,
136 POPS = 0x2,
137 POPL = 0x3,
138 POPV = 0x4,
139 POPQ = 0x5,
140 POPARG = 0x6,
141 POPIP = 0x7,
142 POPBP = 0x8,
143 POPSP = 0x9,
144 POPSLR = 0xa,
145 DUP = 0x20,
146 DUPS = 0x21,
147 DUPL = 0x22,
148 DUPV = 0x23,
149 DUPQ = 0x24,
150 STORE = 0x30,
151 STORES = 0x31,
152 STOREL = 0x32,
153 STOREV = 0x33,
154 STOREQ = 0x34,
155 STOREG = 0x35,
156 STOREGS = 0x36,
157 STOREGL = 0x37,
158 STOREGV = 0x38,
159 STOREGQ = 0x39,
160 LOADP = 0x3a,
161 LOADSP = 0x3b,
162 LOADLP = 0x3c,
163 LOADVP = 0x3d,
164 LOADQP = 0x3e,
165 LOADGP = 0x3f,
166 LOADGSP = 0x40,
167 LOADGLP = 0x41,
168 LOADGVP = 0x42,
169 LOADGQP = 0x43,
170 PUSH = 0x50,
171 PUSHS = 0x51,
172 PUSHL = 0x52,
173 PUSHV = 0x53,
174 PUSHQ = 0x54,
175 PUSHG = 0x55,
176 PUSHGS = 0x56,
177 PUSHGL = 0x57,
178 PUSHGV = 0x58,
179 PUSHGQ = 0x59,
180 PUSHIP = 0x5a,
181 PUSHBP = 0x5b,
182 PUSHSP = 0x5c,
183 PUSHARGB = 0x5d,
184 PUSHARGI = 0x5e,
185 PUSHARGF = 0x5f,
186 PUSHARGS = 0x60,
187 PUSHARGV = 0x61,
188 PUSHARGQ = 0x62,
189 PUSHE = 0x63,
190 PUSHEV = 0x64,
191 PUSHEQ = 0x65,
192 PUSHARGE = 0x66,
193 ADD = 0x70,
194 SUB = 0x71,
195 MUL = 0x72,
196 DIV = 0x73,
197 MOD = 0x74,
198 EQ = 0x75,
199 NEQ = 0x76,
200 LEQ = 0x77,
201 GEQ = 0x78,
202 LESS = 0x79,
203 GREATER = 0x7a,
204 BITAND = 0x7b,
205 BITOR = 0x7c,
206 BITXOR = 0x7d,
207 BOOLAND = 0x7e,
208 BOOLOR = 0x7f,
209 NEG = 0x80,
210 BITNOT = 0x81,
211 BOOLNOT = 0x82,
212 JUMP = 0x90,
213 JUMPIF = 0x91,
214 JUMPNIF = 0x92,
215 STATE = 0x93,
216 CALL = 0x94,
217 RETURN = 0x95,
218 CAST = 0xa0,
219 STACKTOS = 0xb0,
220 STACKTOL = 0xb1,
221 PRINT = 0xc0,
222 CALLLIB = 0xd0,
223 CALLLIB_TWO_BYTE = 0xd1,
224 SHL = 0xe0,
225 SHR = 0xe1
226 }
227
228 [Serializable]
229 public enum BuiltIn_Functions
230 {
231 llSin = 0,
232 llCos = 1,
233 llTan = 2,
234 llAtan2 = 3,
235 llSqrt = 4,
236 llPow = 5,
237 llAbs = 6,
238 llFabs = 7,
239 llFrand = 8,
240 llFloor = 9,
241 llCeil = 10,
242 llRound = 11,
243 llVecMag = 12,
244 llVecNorm = 13,
245 llVecDist = 14,
246 llRot2Euler = 15,
247 llEuler2Rot = 16,
248 llAxes2Rot = 17,
249 llRot2Fwd = 18,
250 llRot2Left = 19,
251 llRot2Up = 20,
252 llRotBetween = 21,
253 llWhisper = 22,
254 llSay = 23,
255 llShout = 24,
256 llListen = 25,
257 llListenControl = 26,
258 llListenRemove = 27,
259 llSensor = 28,
260 llSensorRepeat = 29,
261 llSensorRemove = 30,
262 llDetectedName = 31,
263 llDetectedKey = 32,
264 llDetectedOwner = 33,
265 llDetectedType = 34,
266 llDetectedPos = 35,
267 llDetectedVel = 36,
268 llDetectedGrab = 37,
269 llDetectedRot = 38,
270 llDetectedGroup = 39,
271 llDetectedLinkNumber = 40,
272 llDie = 41,
273 llGround = 42,
274 llCloud = 43,
275 llWind = 44,
276 llSetStatus = 45,
277 llGetStatus = 46,
278 llSetScale = 47,
279 llGetScale = 48,
280 llSetColor = 49,
281 llGetAlpha = 50,
282 llSetAlpha = 51,
283 llGetColor = 52,
284 llSetTexture = 53,
285 llScaleTexture = 54,
286 llOffsetTexture = 55,
287 llRotateTexture = 56,
288 llGetTexture = 57,
289 llSetPos = 58,
290 llGetPos = 59,
291 llGetLocalPos = 60,
292 llSetRot = 61,
293 llGetRot = 62,
294 llGetLocalRot = 63,
295 llSetForce = 64,
296 llGetForce = 65,
297 llTarget = 66,
298 llTargetRemove = 67,
299 llRotTarget = 68,
300 llRotTargetRemove = 69,
301 llMoveToTarget = 70,
302 llStopMoveToTarget = 71,
303 llApplyImpulse = 72,
304 llApplyRotationalImpulse = 73,
305 llSetTorque = 74,
306 llGetTorque = 75,
307 llSetForceAndTorque = 76,
308 llGetVel = 77,
309 llGetAccel = 78,
310 llGetOmega = 79,
311 llGetTimeOfDay = 80,
312 llGetWallclock = 81,
313 llGetTime = 82,
314 llResetTime = 83,
315 llGetAndResetTime = 84,
316 llSound = 85,
317 llPlaySound = 86,
318 llLoopSound = 87,
319 llLoopSoundMaster = 88,
320 llLoopSoundSlave = 89,
321 llPlaySoundSlave = 90,
322 llTriggerSound = 91,
323 llStopSound = 92,
324 llPreloadSound = 93,
325 llGetSubString = 94,
326 llDeleteSubString = 95,
327 llInsertString = 96,
328 llToUpper = 97,
329 llToLower = 98,
330 llGiveMoney = 99,
331 llMakeExplosion = 100,
332 llMakeFountain = 101,
333 llMakeSmoke = 102,
334 llMakeFire = 103,
335 llRezObject = 104,
336 llLookAt = 105,
337 llStopLookAt = 106,
338 llSetTimerEvent = 107,
339 llSleep = 108,
340 llGetMass = 109,
341 llCollisionFilter = 110,
342 llTakeControls = 111,
343 llReleaseControls = 112,
344 llAttachToAvatar = 113,
345 llDetachFromAvatar = 114,
346 llTakeCamera = 115,
347 llReleaseCamera = 116,
348 llGetOwner = 117,
349 llInstantMessage = 118,
350 llEmail = 119,
351 llGetNextEmail = 120,
352 llGetKey = 121,
353 llSetBuoyancy = 122,
354 llSetHoverHeight = 123,
355 llStopHover = 124,
356 llMinEventDelay = 125,
357 llSoundPreload = 126,
358 llRotLookAt = 127,
359 llStringLength = 128,
360 llStartAnimation = 129,
361 llStopAnimation = 130,
362 llPointAt = 131,
363 llStopPointAt = 132,
364 llTargetOmega = 133,
365 llGetStartParameter = 134,
366 llGodLikeRezObject = 135,
367 llRequestPermissions = 136,
368 llGetPermissionsKey = 137,
369 llGetPermissions = 138,
370 llGetLinkNumber = 139,
371 llSetLinkColor = 140,
372 llCreateLink = 141,
373 llBreakLink = 142,
374 llBreakAllLinks = 143,
375 llGetLinkKey = 144,
376 llGetLinkName = 145,
377 llGetInventoryNumber = 146,
378 llGetInventoryName = 147,
379 llSetScriptState = 148,
380 llGetEnergy = 149,
381 llGiveInventory = 150,
382 llRemoveInventory = 151,
383 llSetText = 152,
384 llWater = 153,
385 llPassTouches = 154,
386 llRequestAgentData = 155,
387 llRequestInventoryData = 156,
388 llSetDamage = 157,
389 llTeleportAgentHome = 158,
390 llModifyLand = 159,
391 llCollisionSound = 160,
392 llCollisionSprite = 161,
393 llGetAnimation = 162,
394 llResetScript = 163,
395 llMessageLinked = 164,
396 llPushObject = 165,
397 llPassCollisions = 166,
398 llGetScriptName = 167,
399 llGetNumberOfSides = 168,
400 llAxisAngle2Rot = 169,
401 llRot2Axis = 170,
402 llRot2Angle = 171,
403 llAcos = 172,
404 llAsin = 173,
405 llAngleBetween = 174,
406 llGetInventoryKey = 175,
407 llAllowInventoryDrop = 176,
408 llGetSunDirection = 177,
409 llGetTextureOffset = 178,
410 llGetTextureScale = 179,
411 llGetTextureRot = 180,
412 llSubStringIndex = 181,
413 llGetOwnerKey = 182,
414 llGetCenterOfMass = 183,
415 llListSort = 184,
416 llGetListLength = 185,
417 llList2Integer = 186,
418 llList2Float = 187,
419 llList2String = 188,
420 llList2Key = 189,
421 llList2Vector = 190,
422 llList2Rot = 191,
423 llList2List = 192,
424 llDeleteSubList = 193,
425 llGetListEntryType = 194,
426 llList2CSV = 195,
427 llCSV2List = 196,
428 llListRandomize = 197,
429 llList2ListStrided = 198,
430 llGetRegionCorner = 199,
431 llListInsertList = 200,
432 llListFindList = 201,
433 llGetObjectName = 202,
434 llSetObjectName = 203,
435 llGetDate = 204,
436 llEdgeOfWorld = 205,
437 llGetAgentInfo = 206,
438 llAdjustSoundVolume = 207,
439 llSetSoundQueueing = 208,
440 llSetSoundRadius = 209,
441 llKey2Name = 210,
442 llSetTextureAnim = 211,
443 llTriggerSoundLimited = 212,
444 llEjectFromLand = 213,
445 llParseString2List = 214,
446 llOverMyLand = 215,
447 llGetLandOwnerAt = 216,
448 llGetNotecardLine = 217,
449 llGetAgentSize = 218,
450 llSameGroup = 219,
451 llUnSit = 220,
452 llGroundSlope = 221,
453 llGroundNormal = 222,
454 llGroundContour = 223,
455 llGetAttached = 224,
456 llGetFreeMemory = 225,
457 llGetRegionName = 226,
458 llGetRegionTimeDilation = 227,
459 llGetRegionFPS = 228,
460 llParticleSystem = 229,
461 llGroundRepel = 230,
462 llGiveInventoryList = 231,
463 llSetVehicleType = 232,
464 llSetVehicleFloatParam = 233,
465 llSetVehicleVectorParam = 234,
466 llSetVehicleRotationParam = 235,
467 llSetVehicleFlags = 236,
468 llRemoveVehicleFlags = 237,
469 llSitTarget = 238,
470 llAvatarOnSitTarget = 239,
471 llAddToLandPassList = 240,
472 llSetTouchText = 241,
473 llSetSitText = 242,
474 llSetCameraEyeOffset = 243,
475 llSetCameraAtOffset = 244,
476 llDumpList2String = 245,
477 llScriptDanger = 246,
478 llDialog = 247,
479 llVolumeDetect = 248,
480 llResetOtherScript = 249,
481 llGetScriptState = 250,
482 llRemoteLoadScript = 251,
483 llSetRemoteScriptAccessPin = 252,
484 llRemoteLoadScriptPin = 253,
485 llOpenRemoteDataChannel = 254,
486 llSendRemoteData = 255,
487 llRemoteDataReply = 256,
488 llCloseRemoteDataChannel = 257,
489 llMD5String = 258,
490 llSetPrimitiveParams = 259,
491 llStringToBase64 = 260,
492 llBase64ToString = 261,
493 llXorBase64Strings = 262,
494 llRemoteDataSetRegion = 263,
495 llLog10 = 264,
496 llLog = 265,
497 llGetAnimationList = 266,
498 llSetParcelMusicURL = 267,
499 llGetRootPosition = 268,
500 llGetRootRotation = 269,
501 llGetObjectDesc = 270,
502 llSetObjectDesc = 271,
503 llGetCreator = 272,
504 llGetTimestamp = 273,
505 llSetLinkAlpha = 274,
506 llGetNumberOfPrims = 275,
507 llGetNumberOfNotecardLines = 276,
508 llGetBoundingBox = 277,
509 llGetGeometricCenter = 278,
510 llGetPrimitiveParams = 279,
511 llIntegerToBase64 = 280,
512 llBase64ToInteger = 281,
513 llGetGMTclock = 282,
514 llGetSimulatorHostname = 283,
515 llSetLocalRot = 284,
516 llParseStringKeepNulls = 285,
517 llRezAtRoot = 286,
518 llGetObjectPermMask = 287,
519 llSetObjectPermMask = 288,
520 llGetInventoryPermMask = 289,
521 llSetInventoryPermMask = 290,
522 llGetInventoryCreator = 291,
523 llOwnerSay = 292,
524 llRequestSimulatorData = 293,
525 llForceMouselook = 294,
526 llGetObjectMass = 295,
527 llListReplaceList = 296,
528 llLoadURL = 297,
529 llParcelMediaCommandList = 298,
530 llParcelMediaQuery = 299,
531 llModPow = 300,
532 llGetInventoryType = 301,
533 llSetPayPrice = 302,
534 llGetCameraPos = 303,
535 llGetCameraRot = 304,
536 llSetPrimURL = 305,
537 llRefreshPrimURL = 306,
538 llEscapeURL = 307,
539 llUnescapeURL = 308,
540 llMapDestination = 309,
541 llAddToLandBanList = 310,
542 llRemoveFromLandPassList = 311,
543 llRemoveFromLandBanList = 312,
544 llSetCameraParams = 313,
545 llClearCameraParams = 314,
546 llListStatistics = 315,
547 llGetUnixTime = 316,
548 llGetParcelFlags = 317,
549 llGetRegionFlags = 318,
550 llXorBase64StringsCorrect = 319,
551 llHTTPRequest = 320,
552 llResetLandBanList = 321,
553 llResetLandPassList = 322,
554 llGetParcelPrimCount = 323,
555 llGetParcelPrimOwners = 324,
556 llGetObjectPrimCount = 325,
557 llGetParcelMaxPrims = 326,
558 llGetParcelDetails = 327
559 }
560 }
561}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
deleted file mode 100644
index 25d1211..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Parser.cs
+++ /dev/null
@@ -1,728 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.IO;
33using System.Reflection;
34using System.Reflection.Emit;
35using System.Text;
36
37namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
38{
39 internal partial class LSO_Parser
40 {
41 private string FileName;
42 private FileStream fs;
43 private BinaryReader br;
44 internal LSO_Struct.Header myHeader;
45 internal Dictionary<long, LSO_Struct.StaticBlock> StaticBlocks = new Dictionary<long, LSO_Struct.StaticBlock>();
46 //private System.Collections.Hashtable StaticBlocks = new System.Collections.Hashtable();
47
48 private TypeBuilder typeBuilder;
49 private List<string> EventList = new List<string>();
50
51 public LSO_Parser(string _FileName, TypeBuilder _typeBuilder)
52 {
53 FileName = _FileName;
54 typeBuilder = _typeBuilder;
55 }
56
57 internal void OpenFile()
58 {
59 // Open
60 Common.SendToDebug("Opening filename: " + FileName);
61 fs = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
62 br = new BinaryReader(fs, Encoding.BigEndianUnicode);
63 }
64
65 internal void CloseFile()
66 {
67 // Close
68 br.Close();
69 fs.Close();
70 }
71
72
73 /// <summary>
74 /// Parse LSO file.
75 /// </summary>
76 public void Parse()
77 {
78 // The LSO Format consist of 6 major blocks: header, statics, functions, states, heap, and stack.
79
80
81 // HEADER BLOCK
82 Common.SendToDebug("Reading HEADER BLOCK at: 0");
83 fs.Seek(0, SeekOrigin.Begin);
84 myHeader = new LSO_Struct.Header();
85 myHeader.TM = BitConverter.ToUInt32(br_read(4), 0);
86 myHeader.IP = BitConverter.ToUInt32(br_read(4), 0);
87 myHeader.VN = BitConverter.ToUInt32(br_read(4), 0);
88 myHeader.BP = BitConverter.ToUInt32(br_read(4), 0);
89 myHeader.SP = BitConverter.ToUInt32(br_read(4), 0);
90 myHeader.HR = BitConverter.ToUInt32(br_read(4), 0);
91 myHeader.HP = BitConverter.ToUInt32(br_read(4), 0);
92 myHeader.CS = BitConverter.ToUInt32(br_read(4), 0);
93 myHeader.NS = BitConverter.ToUInt32(br_read(4), 0);
94 myHeader.CE = BitConverter.ToUInt32(br_read(4), 0);
95 myHeader.IE = BitConverter.ToUInt32(br_read(4), 0);
96 myHeader.ER = BitConverter.ToUInt32(br_read(4), 0);
97 myHeader.FR = BitConverter.ToUInt32(br_read(4), 0);
98 myHeader.SLR = BitConverter.ToUInt32(br_read(4), 0);
99 myHeader.GVR = BitConverter.ToUInt32(br_read(4), 0);
100 myHeader.GFR = BitConverter.ToUInt32(br_read(4), 0);
101 myHeader.PR = BitConverter.ToUInt32(br_read(4), 0);
102 myHeader.ESR = BitConverter.ToUInt32(br_read(4), 0);
103 myHeader.SR = BitConverter.ToUInt32(br_read(4), 0);
104 myHeader.NCE = BitConverter.ToUInt64(br_read(8), 0);
105 myHeader.NIE = BitConverter.ToUInt64(br_read(8), 0);
106 myHeader.NER = BitConverter.ToUInt64(br_read(8), 0);
107
108 // Print Header Block to debug
109 Common.SendToDebug("TM - Top of memory (size): " + myHeader.TM);
110 Common.SendToDebug("IP - Instruction Pointer (0=not running): " + myHeader.IP);
111 Common.SendToDebug("VN - Version number: " + myHeader.VN);
112 Common.SendToDebug("BP - Local Frame Pointer: " + myHeader.BP);
113 Common.SendToDebug("SP - Stack Pointer: " + myHeader.SP);
114 Common.SendToDebug("HR - Heap Register: " + myHeader.HR);
115 Common.SendToDebug("HP - Heap Pointer: " + myHeader.HP);
116 Common.SendToDebug("CS - Current State: " + myHeader.CS);
117 Common.SendToDebug("NS - Next State: " + myHeader.NS);
118 Common.SendToDebug("CE - Current Events: " + myHeader.CE);
119 Common.SendToDebug("IE - In Event: " + myHeader.IE);
120 Common.SendToDebug("ER - Event Register: " + myHeader.ER);
121 Common.SendToDebug("FR - Fault Register: " + myHeader.FR);
122 Common.SendToDebug("SLR - Sleep Register: " + myHeader.SLR);
123 Common.SendToDebug("GVR - Global Variable Register: " + myHeader.GVR);
124 Common.SendToDebug("GFR - Global Function Register: " + myHeader.GFR);
125 Common.SendToDebug("PR - Parameter Register: " + myHeader.PR);
126 Common.SendToDebug("ESR - Energy Supply Register: " + myHeader.ESR);
127 Common.SendToDebug("SR - State Register: " + myHeader.SR);
128 Common.SendToDebug("NCE - 64-bit Current Events: " + myHeader.NCE);
129 Common.SendToDebug("NIE - 64-bit In Events: " + myHeader.NIE);
130 Common.SendToDebug("NER - 64-bit Event Register: " + myHeader.NER);
131 Common.SendToDebug("Read position when exiting HEADER BLOCK: " + fs.Position);
132
133 // STATIC BLOCK
134 Common.SendToDebug("Reading STATIC BLOCK at: " + myHeader.GVR);
135 fs.Seek(myHeader.GVR, SeekOrigin.Begin);
136 int StaticBlockCount = 0;
137 // Read function blocks until we hit GFR
138 while (fs.Position < myHeader.GFR)
139 {
140 StaticBlockCount++;
141 long startReadPos = fs.Position;
142 Common.SendToDebug("Reading Static Block " + StaticBlockCount + " at: " + startReadPos);
143
144 //fs.Seek(myHeader.GVR, SeekOrigin.Begin);
145 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
146 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
147 myStaticBlock.ObjectType = br_read(1)[0];
148 Common.SendToDebug("Static Block ObjectType: " +
149 ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
150 myStaticBlock.Unknown = br_read(1)[0];
151 // Size of datatype varies -- what about strings?
152 if (myStaticBlock.ObjectType != 0)
153 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
154
155 StaticBlocks.Add((UInt32) startReadPos, myStaticBlock);
156 }
157 Common.SendToDebug("Number of Static Blocks read: " + StaticBlockCount);
158
159
160 // FUNCTION BLOCK
161 // Always right after STATIC BLOCK
162 LSO_Struct.FunctionBlock myFunctionBlock = new LSO_Struct.FunctionBlock();
163 if (myHeader.GFR == myHeader.SR)
164 {
165 // If GFR and SR are at same position then there is no fuction block
166 Common.SendToDebug("No FUNCTION BLOCK found");
167 }
168 else
169 {
170 Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR);
171 fs.Seek(myHeader.GFR, SeekOrigin.Begin);
172 myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0);
173 Common.SendToDebug("Number of functions in Fuction Block: " + myFunctionBlock.FunctionCount);
174 if (myFunctionBlock.FunctionCount > 0)
175 {
176 myFunctionBlock.CodeChunkPointer = new UInt32[myFunctionBlock.FunctionCount];
177 for (int i = 0; i < myFunctionBlock.FunctionCount; i++)
178 {
179 Common.SendToDebug("Reading function " + i + " at: " + fs.Position);
180 // TODO: ADD TO FUNCTION LIST (How do we identify it later?)
181 // Note! Absolute position
182 myFunctionBlock.CodeChunkPointer[i] = BitConverter.ToUInt32(br_read(4), 0) + myHeader.GFR;
183 Common.SendToDebug("Fuction " + i + " code chunk position: " +
184 myFunctionBlock.CodeChunkPointer[i]);
185 }
186 }
187 }
188
189
190 // STATE FRAME BLOCK
191 // Always right after FUNCTION BLOCK
192 Common.SendToDebug("Reading STATE BLOCK at: " + myHeader.SR);
193 fs.Seek(myHeader.SR, SeekOrigin.Begin);
194 LSO_Struct.StateFrameBlock myStateFrameBlock = new LSO_Struct.StateFrameBlock();
195 myStateFrameBlock.StateCount = BitConverter.ToUInt32(br_read(4), 0);
196 if (myStateFrameBlock.StateCount > 0)
197 {
198 // Initialize array
199 myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount];
200 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
201 {
202 Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position);
203 // Position is relative to state frame
204 myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
205 myStateFrameBlock.StatePointer[i].EventMask = new BitArray(br_read(8));
206 Common.SendToDebug("Pointer: " + myStateFrameBlock.StatePointer[i].Location);
207 Common.SendToDebug("Total potential EventMask bits: " +
208 myStateFrameBlock.StatePointer[i].EventMask.Count);
209
210 //// Read STATE BLOCK
211 //long CurPos = fs.Position;
212 //fs.Seek(CurPos, SeekOrigin.Begin);
213 }
214 }
215
216
217 // STATE BLOCK
218 // For each StateFrameBlock there is one StateBlock with multiple event handlers
219
220 if (myStateFrameBlock.StateCount > 0)
221 {
222 // Go through all State Frame Pointers found
223 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
224 {
225 fs.Seek(myStateFrameBlock.StatePointer[i].Location, SeekOrigin.Begin);
226 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " at: " + fs.Position);
227
228 // READ: STATE BLOCK HEADER
229 myStateFrameBlock.StatePointer[i].StateBlock = new LSO_Struct.StateBlock();
230 myStateFrameBlock.StatePointer[i].StateBlock.StartPos = (UInt32) fs.Position; // Note
231 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize = BitConverter.ToUInt32(br_read(4), 0);
232 myStateFrameBlock.StatePointer[i].StateBlock.Unknown = br_read(1)[0];
233 myStateFrameBlock.StatePointer[i].StateBlock.EndPos = (UInt32) fs.Position; // Note
234 Common.SendToDebug("State block Start Pos: " + myStateFrameBlock.StatePointer[i].StateBlock.StartPos);
235 Common.SendToDebug("State block Header Size: " +
236 myStateFrameBlock.StatePointer[i].StateBlock.HeaderSize);
237 Common.SendToDebug("State block Header End Pos: " +
238 myStateFrameBlock.StatePointer[i].StateBlock.EndPos);
239
240 // We need to count number of bits flagged in EventMask?
241
242
243 // for each bit in myStateFrameBlock.StatePointer[i].EventMask
244
245 // ADDING TO ALL RIGHT NOW, SHOULD LIMIT TO ONLY THE ONES IN USE
246 //TODO: Create event hooks
247 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers =
248 new LSO_Struct.StateBlockHandler[myStateFrameBlock.StatePointer[i].EventMask.Count - 1];
249 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
250 {
251 if (myStateFrameBlock.StatePointer[i].EventMask.Get(ii) == true)
252 {
253 // We got an event
254 // READ: STATE BLOCK HANDLER
255 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER matching EVENT MASK " + ii +
256 " (" + ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") at: " +
257 fs.Position);
258 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer =
259 myStateFrameBlock.StatePointer[i].StateBlock.EndPos +
260 BitConverter.ToUInt32(br_read(4), 0);
261 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize =
262 BitConverter.ToUInt32(br_read(4), 0);
263 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" +
264 ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Code Chunk Pointer: " +
265 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].
266 CodeChunkPointer);
267 Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" +
268 ((LSO_Enums.Event_Mask_Values) ii).ToString() + ") Call Frame Size: " +
269 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].
270 CallFrameSize);
271 }
272 }
273 }
274 }
275
276
277 //// READ FUNCTION CODE CHUNKS
278 //// Functions + Function start pos (GFR)
279 //// TODO: Somehow be able to identify and reference this
280 //LSO_Struct.CodeChunk[] myFunctionCodeChunk;
281 //if (myFunctionBlock.FunctionCount > 0)
282 //{
283 // myFunctionCodeChunk = new LSO_Struct.CodeChunk[myFunctionBlock.FunctionCount];
284 // for (int i = 0; i < myFunctionBlock.FunctionCount; i++)
285 // {
286 // Common.SendToDebug("Reading Function Code Chunk " + i);
287 // myFunctionCodeChunk[i] = GetCodeChunk((UInt32)myFunctionBlock.CodeChunkPointer[i]);
288 // }
289
290 //}
291 // READ EVENT CODE CHUNKS
292 LSO_Struct.CodeChunk[] myEventCodeChunk;
293 if (myStateFrameBlock.StateCount > 0)
294 {
295 myEventCodeChunk = new LSO_Struct.CodeChunk[myStateFrameBlock.StateCount];
296 for (int i = 0; i < myStateFrameBlock.StateCount; i++)
297 {
298 // TODO: Somehow organize events and functions so they can be found again,
299 // two level search ain't no good
300 for (int ii = 0; ii < myStateFrameBlock.StatePointer[i].EventMask.Count - 1; ii++)
301 {
302 if (myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer > 0)
303 {
304 Common.SendToDebug("Reading Event Code Chunk state " + i + ", event " +
305 (LSO_Enums.Event_Mask_Values) ii);
306
307
308 // Override a Method / Function
309 string eventname = i + "_event_" + (LSO_Enums.Event_Mask_Values) ii;
310 Common.SendToDebug("Event Name: " + eventname);
311 if (Common.IL_ProcessCodeChunks)
312 {
313 EventList.Add(eventname);
314
315 // JUMP TO CODE PROCESSOR
316 ProcessCodeChunk(
317 myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer,
318 typeBuilder, eventname);
319 }
320 }
321 }
322 }
323 }
324
325
326 if (Common.IL_CreateFunctionList)
327 IL_INSERT_FUNCTIONLIST();
328 }
329
330 internal LSO_Struct.HeapBlock GetHeap(UInt32 pos)
331 {
332 // HEAP BLOCK
333 // TODO:? Special read for strings/keys (null terminated) and lists (pointers to other HEAP entries)
334 Common.SendToDebug("Reading HEAP BLOCK at: " + pos);
335 fs.Seek(pos, SeekOrigin.Begin);
336
337 LSO_Struct.HeapBlock myHeapBlock = new LSO_Struct.HeapBlock();
338 myHeapBlock.DataBlockSize = BitConverter.ToInt32(br_read(4), 0);
339 myHeapBlock.ObjectType = br_read(1)[0];
340 myHeapBlock.ReferenceCount = BitConverter.ToUInt16(br_read(2), 0);
341 //myHeapBlock.Data = br_read(getObjectSize(myHeapBlock.ObjectType));
342 // Don't read it reversed
343 myHeapBlock.Data = new byte[myHeapBlock.DataBlockSize - 1];
344 br.Read(myHeapBlock.Data, 0, myHeapBlock.DataBlockSize - 1);
345
346
347 Common.SendToDebug("Heap Block Data Block Size: " + myHeapBlock.DataBlockSize);
348 Common.SendToDebug("Heap Block ObjectType: " +
349 ((LSO_Enums.Variable_Type_Codes) myHeapBlock.ObjectType).ToString());
350 Common.SendToDebug("Heap Block Reference Count: " + myHeapBlock.ReferenceCount);
351
352 return myHeapBlock;
353 }
354
355 private byte[] br_read(int len)
356 {
357 if (len <= 0)
358 return null;
359
360 try
361 {
362 byte[] bytes = new byte[len];
363 for (int i = len - 1; i > -1; i--)
364 bytes[i] = br.ReadByte();
365 return bytes;
366 }
367 catch (Exception e)
368 {
369 Common.SendToDebug("Exception: " + e.ToString());
370 throw (e);
371 }
372 }
373
374 //private byte[] br_read_smallendian(int len)
375 //{
376 // byte[] bytes = new byte[len];
377 // br.Read(bytes,0, len);
378 // return bytes;
379 //}
380 private Type getLLObjectType(byte objectCode)
381 {
382 switch ((LSO_Enums.Variable_Type_Codes) objectCode)
383 {
384 case LSO_Enums.Variable_Type_Codes.Void:
385 return typeof (void);
386 case LSO_Enums.Variable_Type_Codes.Integer:
387 return typeof (UInt32);
388 case LSO_Enums.Variable_Type_Codes.Float:
389 return typeof (float);
390 case LSO_Enums.Variable_Type_Codes.String:
391 return typeof (string);
392 case LSO_Enums.Variable_Type_Codes.Key:
393 return typeof (string);
394 case LSO_Enums.Variable_Type_Codes.Vector:
395 return typeof (LSO_Enums.Vector);
396 case LSO_Enums.Variable_Type_Codes.Rotation:
397 return typeof (LSO_Enums.Rotation);
398 case LSO_Enums.Variable_Type_Codes.List:
399 Common.SendToDebug("TODO: List datatype not implemented yet!");
400 return typeof (ArrayList);
401 case LSO_Enums.Variable_Type_Codes.Null:
402 Common.SendToDebug("TODO: Datatype null is not implemented, using string instead.!");
403 return typeof (string);
404 default:
405 Common.SendToDebug("Lookup of LSL datatype " + objectCode +
406 " to .Net datatype failed: Unknown LSL datatype. Defaulting to object.");
407 return typeof (object);
408 }
409 }
410
411 private int getObjectSize(byte ObjectType)
412 {
413 switch ((LSO_Enums.Variable_Type_Codes) ObjectType)
414 {
415 case LSO_Enums.Variable_Type_Codes.Integer:
416 case LSO_Enums.Variable_Type_Codes.Float:
417 case LSO_Enums.Variable_Type_Codes.String:
418 case LSO_Enums.Variable_Type_Codes.Key:
419 case LSO_Enums.Variable_Type_Codes.List:
420 return 4;
421 case LSO_Enums.Variable_Type_Codes.Vector:
422 return 12;
423 case LSO_Enums.Variable_Type_Codes.Rotation:
424 return 16;
425 default:
426 return 0;
427 }
428 }
429
430 private string Read_String()
431 {
432 string ret = "";
433 byte reader = br_read(1)[0];
434 while (reader != 0x000)
435 {
436 ret += (char) reader;
437 reader = br_read(1)[0];
438 }
439 return ret;
440 }
441
442 /// <summary>
443 /// Reads a code chunk and creates IL
444 /// </summary>
445 /// <param name="pos">Absolute position in file. REMEMBER TO ADD myHeader.GFR!</param>
446 /// <param name="typeBuilder">TypeBuilder for assembly</param>
447 /// <param name="eventname">Name of event (function) to generate</param>
448 private void ProcessCodeChunk(UInt32 pos, TypeBuilder typeBuilder, string eventname)
449 {
450 LSO_Struct.CodeChunk myCodeChunk = new LSO_Struct.CodeChunk();
451
452 Common.SendToDebug("Reading Function Code Chunk at: " + pos);
453 fs.Seek(pos, SeekOrigin.Begin);
454 myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0);
455 Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize);
456 // Read until null
457 myCodeChunk.Comment = Read_String();
458 Common.SendToDebug("Function comment: " + myCodeChunk.Comment);
459 myCodeChunk.ReturnTypePos = br_read(1)[0];
460 myCodeChunk.ReturnType = GetStaticBlock((long) myCodeChunk.ReturnTypePos + (long) myHeader.GVR);
461 Common.SendToDebug("Return type #" + myCodeChunk.ReturnType.ObjectType + ": " +
462 ((LSO_Enums.Variable_Type_Codes) myCodeChunk.ReturnType.ObjectType).ToString());
463
464
465 // TODO: How to determine number of codechunks -- does this method work?
466 myCodeChunk.CodeChunkArguments = new List<LSO_Struct.CodeChunkArgument>();
467 byte reader = br_read(1)[0];
468 reader = br_read(1)[0];
469
470 // NOTE ON CODE CHUNK ARGUMENTS
471 // This determins type definition
472 int ccount = 0;
473 while (reader != 0x000)
474 {
475 ccount++;
476 Common.SendToDebug("Reading Code Chunk Argument " + ccount);
477 LSO_Struct.CodeChunkArgument CCA = new LSO_Struct.CodeChunkArgument();
478 CCA.FunctionReturnTypePos = reader;
479 reader = br_read(1)[0];
480 CCA.NullString = reader;
481 CCA.FunctionReturnType = GetStaticBlock(CCA.FunctionReturnTypePos + myHeader.GVR);
482 myCodeChunk.CodeChunkArguments.Add(CCA);
483 Common.SendToDebug("Code Chunk Argument " + ccount + " type #" + CCA.FunctionReturnType.ObjectType +
484 ": " + (LSO_Enums.Variable_Type_Codes) CCA.FunctionReturnType.ObjectType);
485 }
486 // Create string array
487 Type[] MethodArgs = new Type[myCodeChunk.CodeChunkArguments.Count];
488 for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++)
489 {
490 MethodArgs[_ic] = getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType);
491 Common.SendToDebug("Method argument " + _ic + ": " +
492 getLLObjectType(myCodeChunk.CodeChunkArguments[_ic].FunctionReturnType.ObjectType).
493 ToString());
494 }
495 // End marker is 0x000
496 myCodeChunk.EndMarker = reader;
497
498
499 //
500 // Emit: START OF METHOD (FUNCTION)
501 //
502
503 Common.SendToDebug("CLR:" + eventname + ":MethodBuilder methodBuilder = typeBuilder.DefineMethod...");
504 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
505 MethodAttributes.Public,
506 typeof (void),
507 new Type[] {typeof (object)});
508 //MethodArgs);
509 //typeof(void), //getLLObjectType(myCodeChunk.ReturnType),
510 // new Type[] { typeof(object) }, //);
511
512 //Common.SendToDebug("CLR:" + eventname + ":typeBuilder.DefineMethodOverride(methodBuilder...");
513 //typeBuilder.DefineMethodOverride(methodBuilder,
514 // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
515
516 // Create the IL generator
517
518 Common.SendToDebug("CLR:" + eventname + ":ILGenerator il = methodBuilder.GetILGenerator();");
519 ILGenerator il = methodBuilder.GetILGenerator();
520
521
522 if (Common.IL_UseTryCatch)
523 IL_INSERT_TRY(il, eventname);
524
525
526 // Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
527 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
528 //il.Emit(OpCodes.Call, typeof(Console).GetMethod
529 // ("WriteLine", new Type[] { typeof(string) }));
530
531 //Common.SendToDebug("STARTUP: il.Emit(OpCodes.Ldc_I4_S, 0);");
532
533 //il.Emit(OpCodes.Ldc_I4_S, 0);
534 for (int _ic = 0; _ic < myCodeChunk.CodeChunkArguments.Count; _ic++)
535 {
536 Common.SendToDebug("PARAMS: il.Emit(OpCodes.Ldarg, " + _ic + ");");
537 il.Emit(OpCodes.Ldarg, _ic);
538 }
539
540
541 //
542 // CALLING OPCODE PROCESSOR, one command at the time TO GENERATE IL
543 //
544 bool FoundRet = false;
545 while (FoundRet == false)
546 {
547 FoundRet = LSL_PROCESS_OPCODE(il);
548 }
549
550
551 if (Common.IL_UseTryCatch)
552 IL_INSERT_END_TRY(il, eventname);
553
554 // Emit: RETURN FROM METHOD
555 il.Emit(OpCodes.Ret);
556
557 return;
558 }
559
560 private void IL_INSERT_FUNCTIONLIST()
561 {
562 Common.SendToDebug("Creating function list");
563
564
565 string eventname = "GetFunctions";
566
567 Common.SendToDebug("Creating IL " + eventname);
568 // Define a private String field.
569 //FieldBuilder myField = myTypeBuilder.DefineField("EventList", typeof(String[]), FieldAttributes.Public);
570
571
572 //FieldBuilder mem = typeBuilder.DefineField("mem", typeof(Array), FieldAttributes.Private);
573
574
575 MethodBuilder methodBuilder = typeBuilder.DefineMethod(eventname,
576 MethodAttributes.Public,
577 typeof (string[]),
578 null);
579
580 //typeBuilder.DefineMethodOverride(methodBuilder,
581 // typeof(LSL_CLRInterface.LSLScript).GetMethod(eventname));
582
583 ILGenerator il = methodBuilder.GetILGenerator();
584
585
586 // IL_INSERT_TRY(il, eventname);
587
588 // // Push string to stack
589 // il.Emit(OpCodes.Ldstr, "Inside " + eventname);
590
591 //// Push Console.WriteLine command to stack ... Console.WriteLine("Hello World!");
592 //il.Emit(OpCodes.Call, typeof(Console).GetMethod
593 // ("WriteLine", new Type[] { typeof(string) }));
594
595 //initIL.Emit(OpCodes.Newobj, typeof(string[]));
596
597 //string[] MyArray = new string[2] { "TestItem1" , "TestItem2" };
598
599 ////il.Emit(OpCodes.Ldarg_0);
600
601 il.DeclareLocal(typeof (string[]));
602
603 ////il.Emit(OpCodes.Ldarg_0);
604 il.Emit(OpCodes.Ldc_I4, EventList.Count); // Specify array length
605 il.Emit(OpCodes.Newarr, typeof (String)); // create new string array
606 il.Emit(OpCodes.Stloc_0); // Store array as local variable 0 in stack
607 ////SetFunctionList
608
609 for (int lv = 0; lv < EventList.Count; lv++)
610 {
611 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
612 il.Emit(OpCodes.Ldc_I4, lv); // Push index position
613 il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
614 il.Emit(OpCodes.Stelem_Ref); // Perform array[index] = value
615
616 //il.Emit(OpCodes.Ldarg_0);
617 //il.Emit(OpCodes.Ldstr, EventList[lv]); // Push value
618 //il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("AddFunction", new Type[] { typeof(string) }));
619 }
620
621
622 // IL_INSERT_END_TRY(il, eventname);
623
624
625 il.Emit(OpCodes.Ldloc_0); // Load local variable 0 onto stack
626 // il.Emit(OpCodes.Call, typeof(LSL_BaseClass).GetMethod("SetFunctionList", new Type[] { typeof(Array) }));
627
628 il.Emit(OpCodes.Ret); // Return
629 }
630
631
632 private void IL_INSERT_TRY(ILGenerator il, string eventname)
633 {
634 /*
635 * CLR TRY
636 */
637 //Common.SendToDebug("CLR:" + eventname + ":il.BeginExceptionBlock()");
638 il.BeginExceptionBlock();
639
640 // Push "Hello World!" string to stack
641 //Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
642 //il.Emit(OpCodes.Ldstr, "Starting CLR dynamic execution of: " + eventname);
643 }
644
645 private void IL_INSERT_END_TRY(ILGenerator il, string eventname)
646 {
647 /*
648 * CATCH
649 */
650 Common.SendToDebug("CLR:" + eventname + ":il.BeginCatchBlock(typeof(Exception));");
651 il.BeginCatchBlock(typeof (Exception));
652
653 // Push "Hello World!" string to stack
654 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Ldstr...");
655 il.Emit(OpCodes.Ldstr, "Execption executing dynamic CLR function " + eventname + ": ");
656
657 //call void [mscorlib]System.Console::WriteLine(string)
658 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
659 il.Emit(OpCodes.Call, typeof (Console).GetMethod
660 ("Write", new Type[] {typeof (string)}));
661
662 //callvirt instance string [mscorlib]System.Exception::get_Message()
663 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Callvirt...");
664 il.Emit(OpCodes.Callvirt, typeof (Exception).GetMethod
665 ("get_Message"));
666
667 //call void [mscorlib]System.Console::WriteLine(string)
668 Common.SendToDebug("CLR:" + eventname + ":il.Emit(OpCodes.Call...");
669 il.Emit(OpCodes.Call, typeof (Console).GetMethod
670 ("WriteLine", new Type[] {typeof (string)}));
671
672 /*
673 * CLR END TRY
674 */
675 //Common.SendToDebug("CLR:" + eventname + ":il.EndExceptionBlock();");
676 il.EndExceptionBlock();
677 }
678
679 private LSO_Struct.StaticBlock GetStaticBlock(long pos)
680 {
681 long FirstPos = fs.Position;
682 try
683 {
684 UInt32 position = (UInt32) pos;
685 // STATIC BLOCK
686 Common.SendToDebug("Reading STATIC BLOCK at: " + position);
687 fs.Seek(position, SeekOrigin.Begin);
688
689 if (StaticBlocks.ContainsKey(position) == true)
690 {
691 Common.SendToDebug("Found cached STATIC BLOCK");
692
693
694 return StaticBlocks[pos];
695 }
696
697 //int StaticBlockCount = 0;
698 // Read function blocks until we hit GFR
699 //while (fs.Position < myHeader.GFR)
700 //{
701 //StaticBlockCount++;
702
703 //Common.SendToDebug("Reading Static Block at: " + position);
704
705 //fs.Seek(myHeader.GVR, SeekOrigin.Begin);
706 LSO_Struct.StaticBlock myStaticBlock = new LSO_Struct.StaticBlock();
707 myStaticBlock.Static_Chunk_Header_Size = BitConverter.ToUInt32(br_read(4), 0);
708 myStaticBlock.ObjectType = br_read(1)[0];
709 Common.SendToDebug("Static Block ObjectType: " +
710 ((LSO_Enums.Variable_Type_Codes) myStaticBlock.ObjectType).ToString());
711 myStaticBlock.Unknown = br_read(1)[0];
712 // Size of datatype varies
713 if (myStaticBlock.ObjectType != 0)
714 myStaticBlock.BlockVariable = br_read(getObjectSize(myStaticBlock.ObjectType));
715
716 StaticBlocks.Add(position, myStaticBlock);
717 //}
718 Common.SendToDebug("Done reading Static Block.");
719 return myStaticBlock;
720 }
721 finally
722 {
723 // Go back to original read pos
724 fs.Seek(FirstPos, SeekOrigin.Begin);
725 }
726 }
727 }
728}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
deleted file mode 100644
index 42effa1..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/LSO/LSO_Struct.cs
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33
34namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSO
35{
36 internal static class LSO_Struct
37 {
38 public struct Header
39 {
40 public UInt32 TM;
41 public UInt32 IP;
42 public UInt32 VN;
43 public UInt32 BP;
44 public UInt32 SP;
45 public UInt32 HR;
46 public UInt32 HP;
47 public UInt32 CS;
48 public UInt32 NS;
49 public UInt32 CE;
50 public UInt32 IE;
51 public UInt32 ER;
52 public UInt32 FR;
53 public UInt32 SLR;
54 public UInt32 GVR;
55 public UInt32 GFR;
56 public UInt32 PR;
57 public UInt32 ESR;
58 public UInt32 SR;
59 public UInt64 NCE;
60 public UInt64 NIE;
61 public UInt64 NER;
62 }
63
64 public struct StaticBlock
65 {
66 public UInt32 Static_Chunk_Header_Size;
67 public byte ObjectType;
68 public byte Unknown;
69 public byte[] BlockVariable;
70 }
71
72 /* Not actually a structure
73 public struct StaticBlockVariable
74 {
75 public UInt32 Integer1;
76 public UInt32 Float1;
77 public UInt32 HeapPointer_String;
78 public UInt32 HeapPointer_Key;
79 public byte[] Vector_12;
80 public byte[] Rotation_16;
81 public UInt32 Pointer_List_Structure;
82 } */
83
84 public struct HeapBlock
85 {
86 public Int32 DataBlockSize;
87 public byte ObjectType;
88 public UInt16 ReferenceCount;
89 public byte[] Data;
90 }
91
92 public struct StateFrameBlock
93 {
94 public UInt32 StateCount;
95 public StatePointerBlock[] StatePointer;
96 }
97
98 public struct StatePointerBlock
99 {
100 public UInt32 Location;
101 public BitArray EventMask;
102 public StateBlock StateBlock;
103 }
104
105 public struct StateBlock
106 {
107 public UInt32 StartPos;
108 public UInt32 EndPos;
109 public UInt32 HeaderSize;
110 public byte Unknown;
111 public StateBlockHandler[] StateBlockHandlers;
112 }
113
114 public struct StateBlockHandler
115 {
116 public UInt32 CodeChunkPointer;
117 public UInt32 CallFrameSize;
118 }
119
120 public struct FunctionBlock
121 {
122 public UInt32 FunctionCount;
123 public UInt32[] CodeChunkPointer;
124 }
125
126 public struct CodeChunk
127 {
128 public UInt32 CodeChunkHeaderSize;
129 public string Comment;
130 public List<CodeChunkArgument> CodeChunkArguments;
131 public byte EndMarker;
132 public byte ReturnTypePos;
133 public StaticBlock ReturnType;
134 }
135
136 public struct CodeChunkArgument
137 {
138 public byte FunctionReturnTypePos;
139 public byte NullString;
140 public StaticBlock FunctionReturnType;
141 }
142 }
143}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
deleted file mode 100644
index 9cd3fb1..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ /dev/null
@@ -1,2290 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Runtime.Remoting.Lifetime;
31using System.Text;
32using System.Threading;
33using Axiom.Math;
34using libsecondlife;
35using OpenSim.Framework;
36using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
37using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Scenes;
39using OpenSim.Region.ScriptEngine.Common;
40
41namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
42{
43 //
44 // !!!IMPORTANT!!!
45 //
46 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LSL_Status
47 //
48
49 /// <summary>
50 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
51 /// </summary>
52 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
53 {
54 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
55
56 private ASCIIEncoding enc = new ASCIIEncoding();
57 private ScriptEngine m_ScriptEngine;
58 private SceneObjectPart m_host;
59 private uint m_localID;
60 private LLUUID m_itemID;
61 private bool throwErrorOnNotImplemented = true;
62
63
64 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
65 {
66 m_ScriptEngine = ScriptEngine;
67 m_host = host;
68 m_localID = localID;
69 m_itemID = itemID;
70
71
72 //m_log.Info("[ScriptEngine]: LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
73 }
74
75
76 private string m_state = "default";
77
78 public string State()
79 {
80 return m_state;
81 }
82
83 // Object never expires
84 public override Object InitializeLifetimeService()
85 {
86 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
87 // return null;
88 ILease lease = (ILease) base.InitializeLifetimeService();
89
90 if (lease.CurrentState == LeaseState.Initial)
91 {
92 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
93 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
94 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
95 }
96 return lease;
97 }
98
99
100 public Scene World
101 {
102 get { return m_ScriptEngine.World; }
103 }
104
105 //These are the implementations of the various ll-functions used by the LSL scripts.
106 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
107 public double llSin(double f)
108 {
109 return (double) Math.Sin(f);
110 }
111
112 public double llCos(double f)
113 {
114 return (double) Math.Cos(f);
115 }
116
117 public double llTan(double f)
118 {
119 return (double) Math.Tan(f);
120 }
121
122 public double llAtan2(double x, double y)
123 {
124 return (double) Math.Atan2(y, x);
125 }
126
127 public double llSqrt(double f)
128 {
129 return (double) Math.Sqrt(f);
130 }
131
132 public double llPow(double fbase, double fexponent)
133 {
134 return (double) Math.Pow(fbase, fexponent);
135 }
136
137 public int llAbs(int i)
138 {
139 return (int) Math.Abs(i);
140 }
141
142 public double llFabs(double f)
143 {
144 return (double) Math.Abs(f);
145 }
146
147 public double llFrand(double mag)
148 {
149 lock (Util.RandomClass)
150 {
151 return Util.RandomClass.Next((int) mag);
152 }
153 }
154
155 public int llFloor(double f)
156 {
157 return (int) Math.Floor(f);
158 }
159
160 public int llCeil(double f)
161 {
162 return (int) Math.Ceiling(f);
163 }
164
165 public int llRound(double f)
166 {
167 return (int) Math.Round(f, 3);
168 }
169
170 //This next group are vector operations involving squaring and square root. ckrinke
171 public double llVecMag(LSL_Types.Vector3 v)
172 {
173 return (v.X*v.X + v.Y*v.Y + v.Z*v.Z);
174 }
175
176 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
177 {
178 double mag = v.X*v.X + v.Y*v.Y + v.Z*v.Z;
179 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
180 nor.X = v.X/mag;
181 nor.Y = v.Y/mag;
182 nor.Z = v.Z/mag;
183 return nor;
184 }
185
186 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
187 {
188 double dx = a.X - b.X;
189 double dy = a.Y - b.Y;
190 double dz = a.Z - b.Z;
191 return Math.Sqrt(dx*dx + dy*dy + dz*dz);
192 }
193
194 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
195 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
196 {
197 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
198 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X*r.X, r.Y*r.Y, r.Z*r.Z, r.R*r.R);
199 double m = (t.X + t.Y + t.Z + t.R);
200 if (m == 0) return new LSL_Types.Vector3();
201 double n = 2*(r.Y*r.R + r.X*r.Z);
202 double p = m*m - n*n;
203 if (p > 0)
204 return new LSL_Types.Vector3(Math.Atan2(2.0*(r.X*r.R - r.Y*r.Z), (-t.X - t.Y + t.Z + t.R)),
205 Math.Atan2(n, Math.Sqrt(p)),
206 Math.Atan2(2.0*(r.Z*r.R - r.X*r.Y), (t.X - t.Y - t.Z + t.R)));
207 else if (n > 0)
208 return new LSL_Types.Vector3(0.0, Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z));
209 else
210 return new LSL_Types.Vector3(0.0, -Math.PI/2, Math.Atan2((r.Z*r.R + r.X*r.Y), 0.5 - t.X - t.Z));
211 }
212
213 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
214 {
215 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
216 float err = 0.00001f;
217 double ax = Math.Sin(v.X/2);
218 double aw = Math.Cos(v.X/2);
219 double by = Math.Sin(v.Y/2);
220 double bw = Math.Cos(v.Y/2);
221 double cz = Math.Sin(v.Z/2);
222 double cw = Math.Cos(v.Z/2);
223 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw);
224 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
225 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
226 LSL_Types.Quaternion a = new LSL_Types.Quaternion();
227 //This multiplication doesn't compile, yet. a = a1 * a2 * a3;
228 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax*bw*cw + aw*by*cz,
229 aw*by*cw - ax*bw*cz, aw*bw*cz + ax*by*cw,
230 aw*bw*cw - ax*by*cz);
231 LSL_Types.Quaternion c = new LSL_Types.Quaternion();
232 //This addition doesn't compile yet c = a + b;
233 LSL_Types.Quaternion d = new LSL_Types.Quaternion();
234 //This addition doesn't compile yet d = a - b;
235 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) ||
236 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) ||
237 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) ||
238 (Math.Abs(c.R) > err && Math.Abs(d.R) > err))
239 {
240 //return a new Quaternion that is null until I figure this out
241 // return b;
242 // return a;
243 }
244 return new LSL_Types.Quaternion();
245 }
246
247 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
248 {
249 return new LSL_Types.Quaternion();
250 }
251
252 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r)
253 {
254 return new LSL_Types.Vector3();
255 }
256
257 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r)
258 {
259 return new LSL_Types.Vector3();
260 }
261
262 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r)
263 {
264 return new LSL_Types.Vector3();
265 }
266
267 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end)
268 {
269 return new LSL_Types.Quaternion();
270 }
271
272 public void llWhisper(int channelID, string text)
273 {
274 World.SimChat(Helpers.StringToField(text),
275 ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition,
276 m_host.Name, m_host.UUID, false);
277 }
278
279 public void llSay(int channelID, string text)
280 {
281 World.SimChat(Helpers.StringToField(text),
282 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition,
283 m_host.Name, m_host.UUID, false);
284 }
285
286 public void llShout(int channelID, string text)
287 {
288 World.SimChat(Helpers.StringToField(text),
289 ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition,
290 m_host.Name, m_host.UUID, false);
291 }
292
293 public void llOwnerSay(string msg)
294 {
295 World.SimChatBroadcast(Helpers.StringToField(text),
296 ChatTypeEnum.Owner, 0, m_host.AbsolutePosition,
297 m_host.Name, m_host.UUID, false);
298 }
299
300 public int llListen(int channelID, string name, string ID, string msg)
301 {
302 NotImplemented("llListen");
303 return 0;
304 }
305
306 public void llListenControl(int number, int active)
307 {
308 NotImplemented("llListenControl");
309 return;
310 }
311
312 public void llListenRemove(int number)
313 {
314 NotImplemented("llListenRemove");
315 return;
316 }
317
318 public void llSensor(string name, string id, int type, double range, double arc)
319 {
320 NotImplemented("llSensor");
321 return;
322 }
323
324 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate)
325 {
326 NotImplemented("llSensorRepeat");
327 return;
328 }
329
330 public void llSensorRemove()
331 {
332 NotImplemented("llSensorRemove");
333 return;
334 }
335
336 public string llDetectedName(int number)
337 {
338 NotImplemented("llDetectedName");
339 return "";
340 }
341
342 public string llDetectedKey(int number)
343 {
344 NotImplemented("llDetectedKey");
345 return "";
346 }
347
348 public string llDetectedOwner(int number)
349 {
350 NotImplemented("llDetectedOwner");
351 return "";
352 }
353
354 public int llDetectedType(int number)
355 {
356 NotImplemented("llDetectedType");
357 return 0;
358 }
359
360 public LSL_Types.Vector3 llDetectedPos(int number)
361 {
362 NotImplemented("llDetectedPos");
363 return new LSL_Types.Vector3();
364 }
365
366 public LSL_Types.Vector3 llDetectedVel(int number)
367 {
368 NotImplemented("llDetectedVel");
369 return new LSL_Types.Vector3();
370 }
371
372 public LSL_Types.Vector3 llDetectedGrab(int number)
373 {
374 NotImplemented("llDetectedGrab");
375 return new LSL_Types.Vector3();
376 }
377
378 public LSL_Types.Quaternion llDetectedRot(int number)
379 {
380 NotImplemented("llDetectedRot");
381 return new LSL_Types.Quaternion();
382 }
383
384 public int llDetectedGroup(int number)
385 {
386 NotImplemented("llDetectedGroup");
387 return 0;
388 }
389
390 public int llDetectedLinkNumber(int number)
391 {
392 NotImplemented("llDetectedLinkNumber");
393 return 0;
394 }
395
396 public void llDie()
397 {
398 NotImplemented("llDie");
399 return;
400 }
401
402 public double llGround(LSL_Types.Vector3 offset)
403 {
404 NotImplemented("llGround");
405 return 0;
406 }
407
408 public double llCloud(LSL_Types.Vector3 offset)
409 {
410 NotImplemented("llCloud");
411 return 0;
412 }
413
414 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset)
415 {
416 NotImplemented("llWind");
417 return new LSL_Types.Vector3();
418 }
419
420 public void llSetStatus(int status, int value)
421 {
422 NotImplemented("llSetStatus");
423 return;
424 }
425
426 public int llGetStatus(int status)
427 {
428 NotImplemented("llGetStatus");
429 return 0;
430 }
431
432 public void llSetScale(LSL_Types.Vector3 scale)
433 {
434 // TODO: this needs to trigger a persistance save as well
435 LLVector3 tmp = m_host.Scale;
436 tmp.X = (float) scale.X;
437 tmp.Y = (float) scale.Y;
438 tmp.Z = (float) scale.Z;
439 m_host.Scale = tmp;
440 return;
441 }
442
443 public LSL_Types.Vector3 llGetScale()
444 {
445 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
446 }
447
448 public void llSetColor(LSL_Types.Vector3 color, int face)
449 {
450 NotImplemented("llSetColor");
451 return;
452 }
453
454 public double llGetAlpha(int face)
455 {
456 NotImplemented("llGetAlpha");
457 return 0;
458 }
459
460 public void llSetAlpha(double alpha, int face)
461 {
462 NotImplemented("llSetAlpha");
463 return;
464 }
465
466 public LSL_Types.Vector3 llGetColor(int face)
467 {
468 NotImplemented("llGetColor");
469 return new LSL_Types.Vector3();
470 }
471
472 public void llSetTexture(string texture, int face)
473 {
474 NotImplemented("llSetTexture");
475 return;
476 }
477
478 public void llScaleTexture(double u, double v, int face)
479 {
480 NotImplemented("llScaleTexture");
481 return;
482 }
483
484 public void llOffsetTexture(double u, double v, int face)
485 {
486 NotImplemented("llOffsetTexture");
487 return;
488 }
489
490 public void llRotateTexture(double rotation, int face)
491 {
492 NotImplemented("llRotateTexture");
493 return;
494 }
495
496 public string llGetTexture(int face)
497 {
498 NotImplemented("llGetTexture");
499 return "";
500 }
501
502 public void llSetPos(LSL_Types.Vector3 pos)
503 {
504 if (m_host.ParentID != 0)
505 {
506 m_host.UpdateOffSet(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
507 }
508 else
509 {
510 m_host.UpdateGroupPosition(new LLVector3((float) pos.X, (float) pos.Y, (float) pos.Z));
511 }
512 }
513
514 public LSL_Types.Vector3 llGetPos()
515 {
516 return new LSL_Types.Vector3(m_host.AbsolutePosition.X,
517 m_host.AbsolutePosition.Y,
518 m_host.AbsolutePosition.Z);
519 }
520
521 public LSL_Types.Vector3 llGetLocalPos()
522 {
523 if (m_host.ParentID != 0)
524 {
525 return new LSL_Types.Vector3(m_host.OffsetPosition.X,
526 m_host.OffsetPosition.Y,
527 m_host.OffsetPosition.Z);
528 }
529 else
530 {
531 return new LSL_Types.Vector3(m_host.AbsolutePosition.X,
532 m_host.AbsolutePosition.Y,
533 m_host.AbsolutePosition.Z);
534 }
535 }
536
537 public void llSetRot(LSL_Types.Quaternion rot)
538 {
539 m_host.UpdateRotation(new LLQuaternion((float) rot.X, (float) rot.Y, (float) rot.Z, (float) rot.R));
540 }
541
542 public LSL_Types.Quaternion llGetRot()
543 {
544 LLQuaternion q = m_host.RotationOffset;
545 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
546 }
547
548 public LSL_Types.Quaternion llGetLocalRot()
549 {
550 NotImplemented("llGetLocalRot");
551 return new LSL_Types.Quaternion();
552 }
553
554 public void llSetForce(LSL_Types.Vector3 force, int local)
555 {
556 NotImplemented("llSetForce");
557 }
558
559 public LSL_Types.Vector3 llGetForce()
560 {
561 NotImplemented("llGetForce");
562 return new LSL_Types.Vector3();
563 }
564
565 public int llTarget(LSL_Types.Vector3 position, double range)
566 {
567 NotImplemented("llTarget");
568 return 0;
569 }
570
571 public void llTargetRemove(int number)
572 {
573 NotImplemented("llTargetRemove");
574 }
575
576 public int llRotTarget(LSL_Types.Quaternion rot, double error)
577 {
578 NotImplemented("llRotTarget");
579 return 0;
580 }
581
582 public void llRotTargetRemove(int number)
583 {
584 NotImplemented("llRotTargetRemove");
585 }
586
587 public void llMoveToTarget(LSL_Types.Vector3 target, double tau)
588 {
589 NotImplemented("llMoveToTarget");
590 }
591
592 public void llStopMoveToTarget()
593 {
594 NotImplemented("llStopMoveToTarget");
595 }
596
597 public void llApplyImpulse(LSL_Types.Vector3 force, int local)
598 {
599 NotImplemented("llApplyImpulse");
600 }
601
602 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local)
603 {
604 NotImplemented("llApplyRotationalImpulse");
605 }
606
607 public void llSetTorque(LSL_Types.Vector3 torque, int local)
608 {
609 NotImplemented("llSetTorque");
610 }
611
612 public LSL_Types.Vector3 llGetTorque()
613 {
614 NotImplemented("llGetTorque");
615 return new LSL_Types.Vector3();
616 }
617
618 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local)
619 {
620 NotImplemented("llSetForceAndTorque");
621 }
622
623 public LSL_Types.Vector3 llGetVel()
624 {
625 NotImplemented("llGetVel");
626 return new LSL_Types.Vector3();
627 }
628
629 public LSL_Types.Vector3 llGetAccel()
630 {
631 NotImplemented("llGetAccel");
632 return new LSL_Types.Vector3();
633 }
634
635 public LSL_Types.Vector3 llGetOmega()
636 {
637 NotImplemented("llGetOmega");
638 return new LSL_Types.Vector3();
639 }
640
641 public double llGetTimeOfDay()
642 {
643 NotImplemented("llGetTimeOfDay");
644 return 0;
645 }
646
647 public double llGetWallclock()
648 {
649 return DateTime.Now.TimeOfDay.TotalSeconds;
650 }
651
652 public double llGetTime()
653 {
654 NotImplemented("llGetTime");
655 return 0;
656 }
657
658 public void llResetTime()
659 {
660 NotImplemented("llResetTime");
661 }
662
663 public double llGetAndResetTime()
664 {
665 NotImplemented("llGetAndResetTime");
666 return 0;
667 }
668
669 public void llSound()
670 {
671 NotImplemented("llSound");
672 }
673
674 public void llPlaySound(string sound, double volume)
675 {
676 NotImplemented("llPlaySound");
677 }
678
679 public void llLoopSound(string sound, double volume)
680 {
681 NotImplemented("llLoopSound");
682 }
683
684 public void llLoopSoundMaster(string sound, double volume)
685 {
686 NotImplemented("llLoopSoundMaster");
687 }
688
689 public void llLoopSoundSlave(string sound, double volume)
690 {
691 NotImplemented("llLoopSoundSlave");
692 }
693
694 public void llPlaySoundSlave(string sound, double volume)
695 {
696 NotImplemented("llPlaySoundSlave");
697 }
698
699 public void llTriggerSound(string sound, double volume)
700 {
701 NotImplemented("llTriggerSound");
702 }
703
704 public void llStopSound()
705 {
706 NotImplemented("llStopSound");
707 }
708
709 public void llPreloadSound(string sound)
710 {
711 NotImplemented("llPreloadSound");
712 }
713
714 public string llGetSubString(string src, int start, int end)
715 {
716 return src.Substring(start, end);
717 }
718
719 public string llDeleteSubString(string src, int start, int end)
720 {
721 return src.Remove(start, end - start);
722 }
723
724 public string llInsertString(string dst, int position, string src)
725 {
726 return dst.Insert(position, src);
727 }
728
729 public string llToUpper(string src)
730 {
731 return src.ToUpper();
732 }
733
734 public string llToLower(string src)
735 {
736 return src.ToLower();
737 }
738
739 public int llGiveMoney(string destination, int amount)
740 {
741 NotImplemented("llGiveMoney");
742 return 0;
743 }
744
745 public void llMakeExplosion()
746 {
747 NotImplemented("llMakeExplosion");
748 }
749
750 public void llMakeFountain()
751 {
752 NotImplemented("llMakeFountain");
753 }
754
755 public void llMakeSmoke()
756 {
757 NotImplemented("llMakeSmoke");
758 }
759
760 public void llMakeFire()
761 {
762 NotImplemented("llMakeFire");
763 }
764
765 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param)
766 {
767 NotImplemented("llRezObject");
768 }
769
770 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping)
771 {
772 NotImplemented("llLookAt");
773 }
774
775 public void llStopLookAt()
776 {
777 NotImplemented("llStopLookAt");
778 }
779
780 public void llSetTimerEvent(double sec)
781 {
782 // Setting timer repeat
783 m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
784 }
785
786 public void llSleep(double sec)
787 {
788 Thread.Sleep((int) (sec*1000));
789 }
790
791 public double llGetMass()
792 {
793 NotImplemented("llGetMass");
794 return 0;
795 }
796
797 public void llCollisionFilter(string name, string id, int accept)
798 {
799 NotImplemented("llCollisionFilter");
800 }
801
802 public void llTakeControls(int controls, int accept, int pass_on)
803 {
804 NotImplemented("llTakeControls");
805 }
806
807 public void llReleaseControls()
808 {
809 NotImplemented("llReleaseControls");
810 }
811
812 public void llAttachToAvatar(int attachment)
813 {
814 NotImplemented("llAttachToAvatar");
815 }
816
817 public void llDetachFromAvatar()
818 {
819 NotImplemented("llDetachFromAvatar");
820 }
821
822 public void llTakeCamera()
823 {
824 NotImplemented("llTakeCamera");
825 }
826
827 public void llReleaseCamera()
828 {
829 NotImplemented("llReleaseCamera");
830 }
831
832 public string llGetOwner()
833 {
834 return m_host.ObjectOwner.ToString();
835 }
836
837 public void llInstantMessage(string user, string message)
838 {
839 NotImplemented("llInstantMessage");
840 }
841
842 public void llEmail(string address, string subject, string message)
843 {
844 NotImplemented("llEmail");
845 }
846
847 public void llGetNextEmail(string address, string subject)
848 {
849 NotImplemented("llGetNextEmail");
850 }
851
852 public string llGetKey()
853 {
854 return m_host.UUID.ToString();
855 }
856
857 public void llSetBuoyancy(double buoyancy)
858 {
859 NotImplemented("llSetBuoyancy");
860 }
861
862 public void llSetHoverHeight(double height, int water, double tau)
863 {
864 NotImplemented("llSetHoverHeight");
865 }
866
867 public void llStopHover()
868 {
869 NotImplemented("llStopHover");
870 }
871
872 public void llMinEventDelay(double delay)
873 {
874 NotImplemented("llMinEventDelay");
875 }
876
877 public void llSoundPreload()
878 {
879 NotImplemented("llSoundPreload");
880 }
881
882 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping)
883 {
884 NotImplemented("llRotLookAt");
885 }
886
887 public int llStringLength(string str)
888 {
889 if (str.Length > 0)
890 {
891 return str.Length;
892 }
893 else
894 {
895 return 0;
896 }
897 }
898
899 public void llStartAnimation(string anim)
900 {
901 NotImplemented("llStartAnimation");
902 }
903
904 public void llStopAnimation(string anim)
905 {
906 NotImplemented("llStopAnimation");
907 }
908
909 public void llPointAt()
910 {
911 NotImplemented("llPointAt");
912 }
913
914 public void llStopPointAt()
915 {
916 NotImplemented("llStopPointAt");
917 }
918
919 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain)
920 {
921 NotImplemented("llTargetOmega");
922 }
923
924 public int llGetStartParameter()
925 {
926 NotImplemented("llGetStartParameter");
927 return 0;
928 }
929
930 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos)
931 {
932 NotImplemented("llGodLikeRezObject");
933 }
934
935 public void llRequestPermissions(string agent, int perm)
936 {
937 NotImplemented("llRequestPermissions");
938 }
939
940 public string llGetPermissionsKey()
941 {
942 NotImplemented("llGetPermissionsKey");
943 return "";
944 }
945
946 public int llGetPermissions()
947 {
948 NotImplemented("llGetPermissions");
949 return 0;
950 }
951
952 public int llGetLinkNumber()
953 {
954 NotImplemented("llGetLinkNumber");
955 return 0;
956 }
957
958 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face)
959 {
960 NotImplemented("llSetLinkColor");
961 }
962
963 public void llCreateLink(string target, int parent)
964 {
965 NotImplemented("llCreateLink");
966 }
967
968 public void llBreakLink(int linknum)
969 {
970 NotImplemented("llBreakLink");
971 }
972
973 public void llBreakAllLinks()
974 {
975 NotImplemented("llBreakAllLinks");
976 }
977
978 public string llGetLinkKey(int linknum)
979 {
980 NotImplemented("llGetLinkKey");
981 return "";
982 }
983
984 public void llGetLinkName(int linknum)
985 {
986 NotImplemented("llGetLinkName");
987 }
988
989 public int llGetInventoryNumber(int type)
990 {
991 NotImplemented("llGetInventoryNumber");
992 return 0;
993 }
994
995 public string llGetInventoryName(int type, int number)
996 {
997 NotImplemented("llGetInventoryName");
998 return "";
999 }
1000
1001 public void llSetScriptState(string name, int run)
1002 {
1003 NotImplemented("llSetScriptState");
1004 }
1005
1006 public double llGetEnergy()
1007 {
1008 return 1.0f;
1009 }
1010
1011 public void llGiveInventory(string destination, string inventory)
1012 {
1013 NotImplemented("llGiveInventory");
1014 }
1015
1016 public void llRemoveInventory(string item)
1017 {
1018 NotImplemented("llRemoveInventory");
1019 }
1020
1021 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
1022 {
1023 Vector3 av3 = new Vector3((float) color.X, (float) color.Y, (float) color.Z);
1024 m_host.SetText(text, av3, alpha);
1025 }
1026
1027
1028 public double llWater(LSL_Types.Vector3 offset)
1029 {
1030 NotImplemented("llWater");
1031 return 0;
1032 }
1033
1034 public void llPassTouches(int pass)
1035 {
1036 NotImplemented("llPassTouches");
1037 }
1038
1039 public string llRequestAgentData(string id, int data)
1040 {
1041 NotImplemented("llRequestAgentData");
1042 return "";
1043 }
1044
1045 public string llRequestInventoryData(string name)
1046 {
1047 NotImplemented("llRequestInventoryData");
1048 return "";
1049 }
1050
1051 public void llSetDamage(double damage)
1052 {
1053 NotImplemented("llSetDamage");
1054 }
1055
1056 public void llTeleportAgentHome(string agent)
1057 {
1058 NotImplemented("llTeleportAgentHome");
1059 }
1060
1061 public void llModifyLand(int action, int brush)
1062 {
1063 }
1064
1065 public void llCollisionSound(string impact_sound, double impact_volume)
1066 {
1067 NotImplemented("llCollisionSound");
1068 }
1069
1070 public void llCollisionSprite(string impact_sprite)
1071 {
1072 NotImplemented("llCollisionSprite");
1073 }
1074
1075 public string llGetAnimation(string id)
1076 {
1077 NotImplemented("llGetAnimation");
1078 return "";
1079 }
1080
1081 public void llResetScript()
1082 {
1083 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
1084 }
1085
1086 public void llMessageLinked(int linknum, int num, string str, string id)
1087 {
1088 }
1089
1090 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local)
1091 {
1092 }
1093
1094 public void llPassCollisions(int pass)
1095 {
1096 }
1097
1098 public string llGetScriptName()
1099 {
1100 return "";
1101 }
1102
1103 public int llGetNumberOfSides()
1104 {
1105 return 0;
1106 }
1107
1108 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle)
1109 {
1110 return new LSL_Types.Quaternion();
1111 }
1112
1113 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot)
1114 {
1115 return new LSL_Types.Vector3();
1116 }
1117
1118 public void llRot2Angle()
1119 {
1120 }
1121
1122 public double llAcos(double val)
1123 {
1124 return (double) Math.Acos(val);
1125 }
1126
1127 public double llAsin(double val)
1128 {
1129 return (double) Math.Asin(val);
1130 }
1131
1132 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b)
1133 {
1134 return 0;
1135 }
1136
1137 public string llGetInventoryKey(string name)
1138 {
1139 return "";
1140 }
1141
1142 public void llAllowInventoryDrop(int add)
1143 {
1144 }
1145
1146 public LSL_Types.Vector3 llGetSunDirection()
1147 {
1148 return new LSL_Types.Vector3();
1149 }
1150
1151 public LSL_Types.Vector3 llGetTextureOffset(int face)
1152 {
1153 return new LSL_Types.Vector3();
1154 }
1155
1156 public LSL_Types.Vector3 llGetTextureScale(int side)
1157 {
1158 return new LSL_Types.Vector3();
1159 }
1160
1161 public double llGetTextureRot(int side)
1162 {
1163 return 0;
1164 }
1165
1166 public int llSubStringIndex(string source, string pattern)
1167 {
1168 return source.IndexOf(pattern);
1169 }
1170
1171 public string llGetOwnerKey(string id)
1172 {
1173 NotImplemented("llGetOwnerKey");
1174 return "";
1175 }
1176
1177 public LSL_Types.Vector3 llGetCenterOfMass()
1178 {
1179 NotImplemented("llGetCenterOfMass");
1180 return new LSL_Types.Vector3();
1181 }
1182
1183 public List<string> llListSort(List<string> src, int stride, int ascending)
1184 {
1185 SortedList<string, List<string>> sorted = new SortedList<string, List<string>>();
1186 // Add chunks to an array
1187 int s = stride;
1188 if (s < 1)
1189 s = 1;
1190 int c = 0;
1191 List<string> chunk = new List<string>();
1192 string chunkString = "";
1193 foreach (string element in src)
1194 {
1195 c++;
1196 if (c > s)
1197 {
1198 sorted.Add(chunkString, chunk);
1199 chunkString = "";
1200 chunk = new List<string>();
1201 c = 0;
1202 }
1203 chunk.Add(element);
1204 chunkString += element.ToString();
1205 }
1206 if (chunk.Count > 0)
1207 sorted.Add(chunkString, chunk);
1208
1209 List<string> ret = new List<string>();
1210 foreach (List<string> ls in sorted.Values)
1211 {
1212 ret.AddRange(ls);
1213 }
1214
1215 if (ascending == LSL_BaseClass.TRUE)
1216 return ret;
1217 ret.Reverse();
1218 return ret;
1219 }
1220
1221 public int llGetListLength(List<string> src)
1222 {
1223 return src.Count;
1224 }
1225
1226 public int llList2Integer(List<string> src, int index)
1227 {
1228 return Convert.ToInt32(src[index]);
1229 }
1230
1231 public double llList2double(List<string> src, int index)
1232 {
1233 return Convert.ToDouble(src[index]);
1234 }
1235
1236 public float llList2Float(List<string> src, int index)
1237 {
1238 return Convert.ToSingle(src[index]);
1239 }
1240
1241 public string llList2String(List<string> src, int index)
1242 {
1243 return src[index];
1244 }
1245
1246 public string llList2Key(List<string> src, int index)
1247 {
1248 //return OpenSim.Framework.ToString(src[index]);
1249 return src[index].ToString();
1250 }
1251
1252 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
1253 {
1254 return
1255 new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]),
1256 double.Parse(src[index + 2]));
1257 }
1258
1259 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
1260 {
1261 return
1262 new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]),
1263 double.Parse(src[index + 2]), double.Parse(src[index + 3]));
1264 }
1265
1266 public List<string> llList2List(List<string> src, int start, int end)
1267 {
1268 if (end > start)
1269 {
1270 // Simple straight forward chunk
1271 return src.GetRange(start, end - start);
1272 }
1273 else
1274 {
1275 // Some of the end + some of the beginning
1276 // First chunk
1277 List<string> ret = new List<string>();
1278 ret.AddRange(src.GetRange(start, src.Count - start));
1279 ret.AddRange(src.GetRange(0, end));
1280 return ret;
1281 }
1282 }
1283
1284 public List<string> llDeleteSubList(List<string> src, int start, int end)
1285 {
1286 List<string> ret = new List<string>(src);
1287 ret.RemoveRange(start, end - start);
1288 return ret;
1289 }
1290
1291 public int llGetListEntryType(List<string> src, int index)
1292 {
1293 NotImplemented("llGetListEntryType");
1294 return 0;
1295 }
1296
1297 public string llList2CSV(List<string> src)
1298 {
1299 string ret = "";
1300 foreach (string s in src)
1301 {
1302 if (s.Length > 0)
1303 ret += ",";
1304 ret += s;
1305 }
1306 return ret;
1307 }
1308
1309 public List<string> llCSV2List(string src)
1310 {
1311 List<string> ret = new List<string>();
1312 foreach (string s in src.Split(",".ToCharArray()))
1313 {
1314 ret.Add(s);
1315 }
1316 return ret;
1317 }
1318
1319 public List<string> llListRandomize(List<string> src, int stride)
1320 {
1321 int s = stride;
1322 if (s < 1)
1323 s = 1;
1324
1325 // This is a cowardly way of doing it ;)
1326 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange
1327 List<List<string>> tmp = new List<List<string>>();
1328
1329 // Add chunks to an array
1330 int c = 0;
1331 List<string> chunk = new List<string>();
1332 foreach (string element in src)
1333 {
1334 c++;
1335 if (c > s)
1336 {
1337 tmp.Add(chunk);
1338 chunk = new List<string>();
1339 c = 0;
1340 }
1341 chunk.Add(element);
1342 }
1343 if (chunk.Count > 0)
1344 tmp.Add(chunk);
1345
1346 // Decreate (<- what kind of word is that? :D) array back into a list
1347 int rnd;
1348 List<string> ret = new List<string>();
1349 while (tmp.Count > 0)
1350 {
1351 rnd = Util.RandomClass.Next(tmp.Count);
1352 foreach (string str in tmp[rnd])
1353 {
1354 ret.Add(str);
1355 }
1356 tmp.RemoveAt(rnd);
1357 }
1358
1359 return ret;
1360 }
1361
1362 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
1363 {
1364 List<string> ret = new List<string>();
1365 int s = stride;
1366 if (s < 1)
1367 s = 1;
1368
1369 int sc = s;
1370 for (int i = start; i < src.Count; i++)
1371 {
1372 sc--;
1373 if (sc == 0)
1374 {
1375 sc = s;
1376 // Addthis
1377 ret.Add(src[i]);
1378 }
1379 if (i == end)
1380 break;
1381 }
1382 return ret;
1383 }
1384
1385 public LSL_Types.Vector3 llGetRegionCorner()
1386 {
1387 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0);
1388 }
1389
1390 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
1391 {
1392 List<string> ret = new List<string>(dest);
1393 //foreach (string s in src.Reverse())
1394 for (int ci = src.Count - 1; ci > -1; ci--)
1395 {
1396 ret.Insert(start, src[ci]);
1397 }
1398 return ret;
1399 }
1400
1401 public int llListFindList(List<string> src, List<string> test)
1402 {
1403 foreach (string s in test)
1404 {
1405 for (int ci = 0; ci < src.Count; ci++)
1406 {
1407 if (s == src[ci])
1408 return ci;
1409 }
1410 }
1411 return -1;
1412 }
1413
1414 public string llGetObjectName()
1415 {
1416 return m_host.Name;
1417 }
1418
1419 public void llSetObjectName(string name)
1420 {
1421 m_host.Name = name;
1422 }
1423
1424 public string llGetDate()
1425 {
1426 DateTime date = DateTime.Now.ToUniversalTime();
1427 string result = date.ToString("yyyy-MM-dd");
1428 return result;
1429 }
1430
1431 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir)
1432 {
1433 NotImplemented("llEdgeOfWorld");
1434 return 0;
1435 }
1436
1437 public int llGetAgentInfo(string id)
1438 {
1439 NotImplemented("llGetAgentInfo");
1440 return 0;
1441 }
1442
1443 public void llAdjustSoundVolume(double volume)
1444 {
1445 NotImplemented("llAdjustSoundVolume");
1446 }
1447
1448 public void llSetSoundQueueing(int queue)
1449 {
1450 NotImplemented("llSetSoundQueueing");
1451 }
1452
1453 public void llSetSoundRadius(double radius)
1454 {
1455 NotImplemented("llSetSoundRadius");
1456 }
1457
1458 public string llKey2Name(string id)
1459 {
1460 NotImplemented("llKey2Name");
1461 return "";
1462 }
1463
1464 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
1465 {
1466 NotImplemented("llSetTextureAnim");
1467 }
1468
1469 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,
1470 LSL_Types.Vector3 bottom_south_west)
1471 {
1472 NotImplemented("llTriggerSoundLimited");
1473 }
1474
1475 public void llEjectFromLand(string pest)
1476 {
1477 NotImplemented("llEjectFromLand");
1478 }
1479
1480 public void llParseString2List()
1481 {
1482 NotImplemented("llParseString2List");
1483 }
1484
1485 public int llOverMyLand(string id)
1486 {
1487 NotImplemented("llOverMyLand");
1488 return 0;
1489 }
1490
1491 public string llGetLandOwnerAt(LSL_Types.Vector3 pos)
1492 {
1493 NotImplemented("llGetLandOwnerAt");
1494 return "";
1495 }
1496
1497 public string llGetNotecardLine(string name, int line)
1498 {
1499 NotImplemented("llGetNotecardLine");
1500 return "";
1501 }
1502
1503 public LSL_Types.Vector3 llGetAgentSize(string id)
1504 {
1505 NotImplemented("llGetAgentSize");
1506 return new LSL_Types.Vector3();
1507 }
1508
1509 public int llSameGroup(string agent)
1510 {
1511 NotImplemented("llSameGroup");
1512 return 0;
1513 }
1514
1515 public void llUnSit(string id)
1516 {
1517 NotImplemented("llUnSit");
1518 }
1519
1520 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset)
1521 {
1522 NotImplemented("llGroundSlope");
1523 return new LSL_Types.Vector3();
1524 }
1525
1526 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset)
1527 {
1528 NotImplemented("llGroundNormal");
1529 return new LSL_Types.Vector3();
1530 }
1531
1532 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset)
1533 {
1534 NotImplemented("llGroundContour");
1535 return new LSL_Types.Vector3();
1536 }
1537
1538 public int llGetAttached()
1539 {
1540 NotImplemented("llGetAttached");
1541 return 0;
1542 }
1543
1544 public int llGetFreeMemory()
1545 {
1546 NotImplemented("llGetFreeMemory");
1547 return 0;
1548 }
1549
1550 public string llGetRegionName()
1551 {
1552 return World.RegionInfo.RegionName;
1553 }
1554
1555 public double llGetRegionTimeDilation()
1556 {
1557 return 1.0f;
1558 }
1559
1560 public double llGetRegionFPS()
1561 {
1562 return 10.0f;
1563 }
1564
1565 /* particle system rules should be coming into this routine as doubles, that is
1566 rule[0] should be an integer from this list and rule[1] should be the arg
1567 for the same integer. wiki.secondlife.com has most of this mapping, but some
1568 came from http://www.caligari-designs.com/p4u2
1569
1570 We iterate through the list for 'Count' elements, incrementing by two for each
1571 iteration and set the members of Primitive.ParticleSystem, one at a time.
1572 */
1573
1574 public enum PrimitiveRule : int
1575 {
1576 PSYS_PART_FLAGS = 0,
1577 PSYS_PART_START_COLOR = 1,
1578 PSYS_PART_START_ALPHA = 2,
1579 PSYS_PART_END_COLOR = 3,
1580 PSYS_PART_END_ALPHA = 4,
1581 PSYS_PART_START_SCALE = 5,
1582 PSYS_PART_END_SCALE = 6,
1583 PSYS_PART_MAX_AGE = 7,
1584 PSYS_SRC_ACCEL = 8,
1585 PSYS_SRC_PATTERN = 9,
1586 PSYS_SRC_TEXTURE = 12,
1587 PSYS_SRC_BURST_RATE = 13,
1588 PSYS_SRC_BURST_PART_COUNT = 15,
1589 PSYS_SRC_BURST_RADIUS = 16,
1590 PSYS_SRC_BURST_SPEED_MIN = 17,
1591 PSYS_SRC_BURST_SPEED_MAX = 18,
1592 PSYS_SRC_MAX_AGE = 19,
1593 PSYS_SRC_TARGET_KEY = 20,
1594 PSYS_SRC_OMEGA = 21,
1595 PSYS_SRC_ANGLE_BEGIN = 22,
1596 PSYS_SRC_ANGLE_END = 23
1597 }
1598
1599 public void llParticleSystem(List<Object> rules)
1600 {
1601 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
1602 for (int i = 0; i < rules.Count; i += 2)
1603 {
1604 switch ((int) rules[i])
1605 {
1606 case (int) PrimitiveRule.PSYS_PART_FLAGS:
1607 prules.PartFlags = (uint) rules[i + 1];
1608 break;
1609
1610 case (int) PrimitiveRule.PSYS_PART_START_COLOR:
1611 prules.PartStartColor = (LLColor) rules[i + 1];
1612 break;
1613
1614 case (int) PrimitiveRule.PSYS_PART_START_ALPHA:
1615 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
1616 break;
1617
1618 case (int) PrimitiveRule.PSYS_PART_END_COLOR:
1619 prules.PartEndColor = (LLColor) rules[i + 1];
1620 break;
1621
1622 case (int) PrimitiveRule.PSYS_PART_END_ALPHA:
1623 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
1624 break;
1625
1626 case (int) PrimitiveRule.PSYS_PART_START_SCALE:
1627 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
1628 break;
1629
1630 case (int) PrimitiveRule.PSYS_PART_END_SCALE:
1631 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
1632 break;
1633
1634 case (int) PrimitiveRule.PSYS_PART_MAX_AGE:
1635 prules.MaxAge = (float) rules[i + 1];
1636 break;
1637
1638 case (int) PrimitiveRule.PSYS_SRC_ACCEL:
1639 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
1640 break;
1641
1642 case (int) PrimitiveRule.PSYS_SRC_PATTERN:
1643 //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
1644 break;
1645
1646 case (int) PrimitiveRule.PSYS_SRC_TEXTURE:
1647 prules.Texture = (LLUUID) rules[i + 1];
1648 break;
1649
1650 case (int) PrimitiveRule.PSYS_SRC_BURST_RATE:
1651 prules.BurstRate = (float) rules[i + 1];
1652 break;
1653
1654 case (int) PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
1655 prules.BurstPartCount = (byte) rules[i + 1];
1656 break;
1657
1658 case (int) PrimitiveRule.PSYS_SRC_BURST_RADIUS:
1659 prules.BurstRadius = (float) rules[i + 1];
1660 break;
1661
1662 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
1663 prules.BurstSpeedMin = (float) rules[i + 1];
1664 break;
1665
1666 case (int) PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
1667 prules.BurstSpeedMax = (float) rules[i + 1];
1668 break;
1669
1670 case (int) PrimitiveRule.PSYS_SRC_MAX_AGE:
1671 prules.MaxAge = (float) rules[i + 1];
1672 break;
1673
1674 case (int) PrimitiveRule.PSYS_SRC_TARGET_KEY:
1675 prules.Target = (LLUUID) rules[i + 1];
1676 break;
1677
1678 case (int) PrimitiveRule.PSYS_SRC_OMEGA:
1679 //cast?? prules.MaxAge = (float)rules[i + 1];
1680 break;
1681
1682 case (int) PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
1683 prules.InnerAngle = (float) rules[i + 1];
1684 break;
1685
1686 case (int) PrimitiveRule.PSYS_SRC_ANGLE_END:
1687 prules.OuterAngle = (float) rules[i + 1];
1688 break;
1689 }
1690 }
1691
1692 m_host.AddNewParticleSystem(prules);
1693 }
1694
1695 public void llGroundRepel(double height, int water, double tau)
1696 {
1697 NotImplemented("llGroundRepel");
1698 }
1699
1700 public void llGiveInventoryList()
1701 {
1702 NotImplemented("llGiveInventoryList");
1703 }
1704
1705 public void llSetVehicleType(int type)
1706 {
1707 NotImplemented("llSetVehicleType");
1708 }
1709
1710 public void llSetVehicledoubleParam(int param, double value)
1711 {
1712 NotImplemented("llSetVehicledoubleParam");
1713 }
1714
1715 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec)
1716 {
1717 NotImplemented("llSetVehicleVectorParam");
1718 }
1719
1720 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot)
1721 {
1722 NotImplemented("llSetVehicleRotationParam");
1723 }
1724
1725 public void llSetVehicleFlags(int flags)
1726 {
1727 NotImplemented("llSetVehicleFlags");
1728 }
1729
1730 public void llRemoveVehicleFlags(int flags)
1731 {
1732 NotImplemented("llRemoveVehicleFlags");
1733 }
1734
1735 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot)
1736 {
1737 NotImplemented("llSitTarget");
1738 }
1739
1740 public string llAvatarOnSitTarget()
1741 {
1742 NotImplemented("llAvatarOnSitTarget");
1743 return "";
1744 }
1745
1746 public void llAddToLandPassList(string avatar, double hours)
1747 {
1748 NotImplemented("llAddToLandPassList");
1749 }
1750
1751 public void llSetTouchText(string text)
1752 {
1753 m_host.TouchName = text;
1754 }
1755
1756 public void llSetSitText(string text)
1757 {
1758 m_host.SitName = text;
1759 }
1760
1761 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset)
1762 {
1763 NotImplemented("llSetCameraEyeOffset");
1764 }
1765
1766 public void llSetCameraAtOffset(LSL_Types.Vector3 offset)
1767 {
1768 NotImplemented("llSetCameraAtOffset");
1769 }
1770
1771 public void llDumpList2String()
1772 {
1773 NotImplemented("llDumpList2String");
1774 }
1775
1776 public void llScriptDanger(LSL_Types.Vector3 pos)
1777 {
1778 NotImplemented("llScriptDanger");
1779 }
1780
1781 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
1782 {
1783 NotImplemented("llDialog");
1784 }
1785
1786 public void llVolumeDetect(int detect)
1787 {
1788 NotImplemented("llVolumeDetect");
1789 }
1790
1791 public void llResetOtherScript(string name)
1792 {
1793 NotImplemented("llResetOtherScript");
1794 }
1795
1796 public int llGetScriptState(string name)
1797 {
1798 NotImplemented("llGetScriptState");
1799 return 0;
1800 }
1801
1802 public void llRemoteLoadScript()
1803 {
1804 NotImplemented("llRemoteLoadScript");
1805 }
1806
1807 public void llSetRemoteScriptAccessPin(int pin)
1808 {
1809 NotImplemented("llSetRemoteScriptAccessPin");
1810 }
1811
1812 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
1813 {
1814 NotImplemented("llRemoteLoadScriptPin");
1815 }
1816
1817 public void llOpenRemoteDataChannel()
1818 {
1819 NotImplemented("llOpenRemoteDataChannel");
1820 }
1821
1822 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
1823 {
1824 NotImplemented("llSendRemoteData");
1825 return "";
1826 }
1827
1828 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
1829 {
1830 NotImplemented("llRemoteDataReply");
1831 }
1832
1833 public void llCloseRemoteDataChannel(string channel)
1834 {
1835 NotImplemented("llCloseRemoteDataChannel");
1836 }
1837
1838 public string llMD5String(string src, int nonce)
1839 {
1840 return Util.Md5Hash(src + ":" + nonce.ToString());
1841 }
1842
1843 public void llSetPrimitiveParams(List<string> rules)
1844 {
1845 NotImplemented("llSetPrimitiveParams");
1846 }
1847
1848 public string llStringToBase64(string str)
1849 {
1850 try
1851 {
1852 byte[] encData_byte = new byte[str.Length];
1853 encData_byte = Encoding.UTF8.GetBytes(str);
1854 string encodedData = Convert.ToBase64String(encData_byte);
1855 return encodedData;
1856 }
1857 catch (Exception e)
1858 {
1859 throw new Exception("Error in base64Encode" + e.Message);
1860 }
1861 }
1862
1863 public string llBase64ToString(string str)
1864 {
1865 UTF8Encoding encoder = new UTF8Encoding();
1866 Decoder utf8Decode = encoder.GetDecoder();
1867 try
1868 {
1869 byte[] todecode_byte = Convert.FromBase64String(str);
1870 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
1871 char[] decoded_char = new char[charCount];
1872 utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
1873 string result = new String(decoded_char);
1874 return result;
1875 }
1876 catch (Exception e)
1877 {
1878 throw new Exception("Error in base64Decode" + e.Message);
1879 }
1880 }
1881
1882 public void llXorBase64Strings()
1883 {
1884 throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead.");
1885 }
1886
1887 public void llRemoteDataSetRegion()
1888 {
1889 NotImplemented("llRemoteDataSetRegion");
1890 }
1891
1892 public double llLog10(double val)
1893 {
1894 return (double) Math.Log10(val);
1895 }
1896
1897 public double llLog(double val)
1898 {
1899 return (double) Math.Log(val);
1900 }
1901
1902 public List<string> llGetAnimationList(string id)
1903 {
1904 NotImplemented("llGetAnimationList");
1905 return new List<string>();
1906 }
1907
1908 public void llSetParcelMusicURL(string url)
1909 {
1910 NotImplemented("llSetParcelMusicURL");
1911 }
1912
1913 public LSL_Types.Vector3 llGetRootPosition()
1914 {
1915 NotImplemented("llGetRootPosition");
1916 return new LSL_Types.Vector3();
1917 }
1918
1919 public LSL_Types.Quaternion llGetRootRotation()
1920 {
1921 NotImplemented("llGetRootRotation");
1922 return new LSL_Types.Quaternion();
1923 }
1924
1925 public string llGetObjectDesc()
1926 {
1927 return m_host.Description;
1928 }
1929
1930 public void llSetObjectDesc(string desc)
1931 {
1932 m_host.Description = desc;
1933 }
1934
1935 public string llGetCreator()
1936 {
1937 return m_host.ObjectCreator.ToString();
1938 }
1939
1940 public string llGetTimestamp()
1941 {
1942 return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
1943 }
1944
1945 public void llSetLinkAlpha(int linknumber, double alpha, int face)
1946 {
1947 NotImplemented("llSetLinkAlpha");
1948 }
1949
1950 public int llGetNumberOfPrims()
1951 {
1952 NotImplemented("llGetNumberOfPrims");
1953 return 0;
1954 }
1955
1956 public string llGetNumberOfNotecardLines(string name)
1957 {
1958 NotImplemented("llGetNumberOfNotecardLines");
1959 return "";
1960 }
1961
1962 public List<string> llGetBoundingBox(string obj)
1963 {
1964 NotImplemented("llGetBoundingBox");
1965 return new List<string>();
1966 }
1967
1968 public LSL_Types.Vector3 llGetGeometricCenter()
1969 {
1970 NotImplemented("llGetGeometricCenter");
1971 return new LSL_Types.Vector3();
1972 }
1973
1974 public void llGetPrimitiveParams()
1975 {
1976 NotImplemented("llGetPrimitiveParams");
1977 }
1978
1979 public string llIntegerToBase64(int number)
1980 {
1981 NotImplemented("llIntegerToBase64");
1982 return "";
1983 }
1984
1985 public int llBase64ToInteger(string str)
1986 {
1987 NotImplemented("llBase64ToInteger");
1988 return 0;
1989 }
1990
1991 public double llGetGMTclock()
1992 {
1993 return DateTime.UtcNow.TimeOfDay.TotalSeconds;
1994 }
1995
1996 public string llGetSimulatorHostname()
1997 {
1998 return Environment.MachineName;
1999 }
2000
2001 public void llSetLocalRot(LSL_Types.Quaternion rot)
2002 {
2003 NotImplemented("llSetLocalRot");
2004 }
2005
2006 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
2007 {
2008 NotImplemented("llParseStringKeepNulls");
2009 return new List<string>();
2010 }
2011
2012 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
2013 LSL_Types.Quaternion rot, int param)
2014 {
2015 NotImplemented("llRezAtRoot");
2016 }
2017
2018 public int llGetObjectPermMask(int mask)
2019 {
2020 NotImplemented("llGetObjectPermMask");
2021 return 0;
2022 }
2023
2024 public void llSetObjectPermMask(int mask, int value)
2025 {
2026 NotImplemented("llSetObjectPermMask");
2027 }
2028
2029 public void llGetInventoryPermMask(string item, int mask)
2030 {
2031 NotImplemented("llGetInventoryPermMask");
2032 }
2033
2034 public void llSetInventoryPermMask(string item, int mask, int value)
2035 {
2036 NotImplemented("llSetInventoryPermMask");
2037 }
2038
2039 public string llGetInventoryCreator(string item)
2040 {
2041 NotImplemented("llGetInventoryCreator");
2042 return "";
2043 }
2044
2045 public void llRequestSimulatorData(string simulator, int data)
2046 {
2047 NotImplemented("llRequestSimulatorData");
2048 }
2049
2050 public void llForceMouselook(int mouselook)
2051 {
2052 NotImplemented("llForceMouselook");
2053 }
2054
2055 public double llGetObjectMass(string id)
2056 {
2057 NotImplemented("llGetObjectMass");
2058 return 0;
2059 }
2060
2061 public void llListReplaceList()
2062 {
2063 NotImplemented("llListReplaceList");
2064 }
2065
2066 public void llLoadURL(string avatar_id, string message, string url)
2067 {
2068 LLUUID avatarId = new LLUUID(avatar_id);
2069 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message,
2070 url);
2071 }
2072
2073 public void llParcelMediaCommandList(List<string> commandList)
2074 {
2075 NotImplemented("llParcelMediaCommandList");
2076 }
2077
2078 public void llParcelMediaQuery()
2079 {
2080 NotImplemented("llParcelMediaQuery");
2081 }
2082
2083 public int llModPow(int a, int b, int c)
2084 {
2085 Int64 tmp = 0;
2086 Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
2087 return Convert.ToInt32(tmp);
2088 }
2089
2090 public int llGetInventoryType(string name)
2091 {
2092 NotImplemented("llGetInventoryType");
2093 return 0;
2094 }
2095
2096 public void llSetPayPrice(int price, List<string> quick_pay_buttons)
2097 {
2098 NotImplemented("llSetPayPrice");
2099 }
2100
2101 public LSL_Types.Vector3 llGetCameraPos()
2102 {
2103 NotImplemented("llGetCameraPos");
2104 return new LSL_Types.Vector3();
2105 }
2106
2107 public LSL_Types.Quaternion llGetCameraRot()
2108 {
2109 NotImplemented("llGetCameraRot");
2110 return new LSL_Types.Quaternion();
2111 }
2112
2113 public void llSetPrimURL()
2114 {
2115 NotImplemented("llSetPrimURL");
2116 }
2117
2118 public void llRefreshPrimURL()
2119 {
2120 NotImplemented("llRefreshPrimURL");
2121 }
2122
2123 public string llEscapeURL(string url)
2124 {
2125 try
2126 {
2127 return Uri.EscapeUriString(url);
2128 }
2129 catch (Exception ex)
2130 {
2131 return "llEscapeURL: " + ex.ToString();
2132 }
2133 }
2134
2135 public string llUnescapeURL(string url)
2136 {
2137 try
2138 {
2139 return Uri.UnescapeDataString(url);
2140 }
2141 catch (Exception ex)
2142 {
2143 return "llUnescapeURL: " + ex.ToString();
2144 }
2145 }
2146
2147 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at)
2148 {
2149 NotImplemented("llMapDestination");
2150 }
2151
2152 public void llAddToLandBanList(string avatar, double hours)
2153 {
2154 NotImplemented("llAddToLandBanList");
2155 }
2156
2157 public void llRemoveFromLandPassList(string avatar)
2158 {
2159 NotImplemented("llRemoveFromLandPassList");
2160 }
2161
2162 public void llRemoveFromLandBanList(string avatar)
2163 {
2164 NotImplemented("llRemoveFromLandBanList");
2165 }
2166
2167 public void llSetCameraParams(List<string> rules)
2168 {
2169 NotImplemented("llSetCameraParams");
2170 }
2171
2172 public void llClearCameraParams()
2173 {
2174 NotImplemented("llClearCameraParams");
2175 }
2176
2177 public double llListStatistics(int operation, List<string> src)
2178 {
2179 NotImplemented("llListStatistics");
2180 return 0;
2181 }
2182
2183 public int llGetUnixTime()
2184 {
2185 return Util.UnixTimeSinceEpoch();
2186 }
2187
2188 public int llGetParcelFlags(LSL_Types.Vector3 pos)
2189 {
2190 NotImplemented("llGetParcelFlags");
2191 return 0;
2192 }
2193
2194 public int llGetRegionFlags()
2195 {
2196 NotImplemented("llGetRegionFlags");
2197 return 0;
2198 }
2199
2200 public string llXorBase64StringsCorrect(string str1, string str2)
2201 {
2202 string ret = "";
2203 string src1 = llBase64ToString(str1);
2204 string src2 = llBase64ToString(str2);
2205 int c = 0;
2206 for (int i = 0; i < src1.Length; i++)
2207 {
2208 ret += src1[i] ^ src2[c];
2209
2210 c++;
2211 if (c > src2.Length)
2212 c = 0;
2213 }
2214 return llStringToBase64(ret);
2215 }
2216
2217 public void llHTTPRequest(string url, List<string> parameters, string body)
2218 {
2219 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body);
2220 }
2221
2222 public void llResetLandBanList()
2223 {
2224 NotImplemented("llResetLandBanList");
2225 }
2226
2227 public void llResetLandPassList()
2228 {
2229 NotImplemented("llResetLandPassList");
2230 }
2231
2232 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide)
2233 {
2234 NotImplemented("llGetParcelPrimCount");
2235 return 0;
2236 }
2237
2238 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos)
2239 {
2240 NotImplemented("llGetParcelPrimOwners");
2241 return new List<string>();
2242 }
2243
2244 public int llGetObjectPrimCount(string object_id)
2245 {
2246 NotImplemented("llGetObjectPrimCount");
2247 return 0;
2248 }
2249
2250 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide)
2251 {
2252 NotImplemented("llGetParcelMaxPrims");
2253 return 0;
2254 }
2255
2256 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param)
2257 {
2258 NotImplemented("llGetParcelDetails");
2259 return new List<string>();
2260 }
2261
2262 //
2263 // OpenSim functions
2264 //
2265 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams,
2266 int timer)
2267 {
2268 if (dynamicID == "")
2269 {
2270 IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
2271 LLUUID createdTexture =
2272 textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, m_host.UUID, contentType, url,
2273 extraParams, timer);
2274 return createdTexture.ToString();
2275 }
2276 else
2277 {
2278 //TODO update existing dynamic textures
2279 }
2280
2281 return LLUUID.Zero.ToString();
2282 }
2283
2284 private void NotImplemented(string Command)
2285 {
2286 if (throwErrorOnNotImplemented)
2287 throw new NotImplementedException("Command not implemented: " + Command);
2288 }
2289 }
2290}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/c_sharp_example.txt b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/c_sharp_example.txt
deleted file mode 100644
index a39d1db..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/c_sharp_example.txt
+++ /dev/null
@@ -1,12 +0,0 @@
1//c#
2namespace SecondLife {
3 public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass
4{
5 public Script() { }
6
7 public void default_event_state_entry( )
8 {
9 llSay(0, "testing, I've been touched");
10 }
11
12}} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs
deleted file mode 100644
index 0d2d7cf..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventManager.cs
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using libsecondlife;
31using OpenSim.Framework;
32
33namespace OpenSim.Grid.ScriptEngine.DotNetEngine
34{
35 /// <summary>
36 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it.
37 /// </summary>
38 [Serializable]
39 internal class EventManager
40 {
41 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42
43 private ScriptEngine myScriptEngine;
44 //public IScriptHost TEMP_OBJECT_ID;
45 public EventManager(ScriptEngine _ScriptEngine)
46 {
47 myScriptEngine = _ScriptEngine;
48 // TODO: HOOK EVENTS UP TO SERVER!
49 //myScriptEngine.m_log.Info("[ScriptEngine]: EventManager Start");
50 // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager
51
52 // Hook up a test event to our test form
53 myScriptEngine.m_log.Info("[ScriptEngine]: Hooking up to server events");
54 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
55 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
56 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
57 }
58
59 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
60 {
61 // Add to queue for all scripts in ObjectID object
62 //myScriptEngine.m_log.Info("[ScriptEngine]: EventManager Event: touch_start");
63 //Console.WriteLine("touch_start localID: " + localID);
64 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1});
65 }
66
67 public void OnRezScript(uint localID, LLUUID itemID, string script)
68 {
69 //myScriptEngine.myScriptManager.StartScript(
70 // Path.Combine("ScriptEngines", "Default.lsl"),
71 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
72 //);
73 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +
74 script.Length);
75 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
76 }
77
78 public void OnRemoveScript(uint localID, LLUUID itemID)
79 {
80 //myScriptEngine.myScriptManager.StartScript(
81 // Path.Combine("ScriptEngines", "Default.lsl"),
82 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
83 //);
84 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
85 myScriptEngine.m_ScriptManager.StopScript(
86 localID,
87 itemID
88 );
89 }
90
91 // TODO: Replace placeholders below
92 // These needs to be hooked up to OpenSim during init of this class
93 // then queued in EventQueueManager.
94 // When queued in EventQueueManager they need to be LSL compatible (name and params)
95
96 //public void state_entry() { }
97 public void state_exit()
98 {
99 }
100
101 //public void touch_start() { }
102 public void touch()
103 {
104 }
105
106 public void touch_end()
107 {
108 }
109
110 public void collision_start()
111 {
112 }
113
114 public void collision()
115 {
116 }
117
118 public void collision_end()
119 {
120 }
121
122 public void land_collision_start()
123 {
124 }
125
126 public void land_collision()
127 {
128 }
129
130 public void land_collision_end()
131 {
132 }
133
134 public void timer()
135 {
136 }
137
138 public void listen()
139 {
140 }
141
142 public void on_rez()
143 {
144 }
145
146 public void sensor()
147 {
148 }
149
150 public void no_sensor()
151 {
152 }
153
154 public void control()
155 {
156 }
157
158 public void money()
159 {
160 }
161
162 public void email()
163 {
164 }
165
166 public void at_target()
167 {
168 }
169
170 public void not_at_target()
171 {
172 }
173
174 public void at_rot_target()
175 {
176 }
177
178 public void not_at_rot_target()
179 {
180 }
181
182 public void run_time_permissions()
183 {
184 }
185
186 public void changed()
187 {
188 }
189
190 public void attach()
191 {
192 }
193
194 public void dataserver()
195 {
196 }
197
198 public void link_message()
199 {
200 }
201
202 public void moving_start()
203 {
204 }
205
206 public void moving_end()
207 {
208 }
209
210 public void object_rez()
211 {
212 }
213
214 public void remote_data()
215 {
216 }
217
218 public void http_response()
219 {
220 }
221 }
222}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
deleted file mode 100644
index 40556de..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ /dev/null
@@ -1,335 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.Threading;
33using libsecondlife;
34using OpenSim.Framework;
35using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
36using OpenSim.Region.Environment.Scenes.Scripting;
37
38namespace OpenSim.Grid.ScriptEngine.DotNetEngine
39{
40 /// <summary>
41 /// EventQueueManager handles event queues
42 /// Events are queued and executed in separate thread
43 /// </summary>
44 [Serializable]
45 internal class EventQueueManager
46 {
47 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
48
49 /// <summary>
50 /// List of threads processing event queue
51 /// </summary>
52 private List<Thread> eventQueueThreads = new List<Thread>();
53
54 private object queueLock = new object(); // Mutex lock object
55
56 /// <summary>
57 /// How many ms to sleep if queue is empty
58 /// </summary>
59 private int nothingToDoSleepms = 50;
60
61 /// <summary>
62 /// How many threads to process queue with
63 /// </summary>
64 private int numberOfThreads = 2;
65
66 /// <summary>
67 /// Queue containing events waiting to be executed
68 /// </summary>
69 private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>();
70
71 /// <summary>
72 /// Queue item structure
73 /// </summary>
74 private struct QueueItemStruct
75 {
76 public uint localID;
77 public LLUUID itemID;
78 public string functionName;
79 public object[] param;
80 }
81
82 /// <summary>
83 /// List of localID locks for mutex processing of script events
84 /// </summary>
85 private List<uint> objectLocks = new List<uint>();
86
87 private object tryLockLock = new object(); // Mutex lock object
88
89 private ScriptEngine m_ScriptEngine;
90
91 public EventQueueManager(ScriptEngine _ScriptEngine)
92 {
93 m_ScriptEngine = _ScriptEngine;
94
95 //
96 // Start event queue processing threads (worker threads)
97 //
98 for (int ThreadCount = 0; ThreadCount <= numberOfThreads; ThreadCount++)
99 {
100 Thread EventQueueThread = new Thread(EventQueueThreadLoop);
101 eventQueueThreads.Add(EventQueueThread);
102 EventQueueThread.IsBackground = true;
103 EventQueueThread.Priority = ThreadPriority.BelowNormal;
104 EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount;
105 EventQueueThread.Start();
106 }
107 }
108
109 ~EventQueueManager()
110 {
111 // Kill worker threads
112 foreach (Thread EventQueueThread in new ArrayList(eventQueueThreads))
113 {
114 if (EventQueueThread != null && EventQueueThread.IsAlive == true)
115 {
116 try
117 {
118 EventQueueThread.Abort();
119 EventQueueThread.Join();
120 }
121 catch (Exception)
122 {
123 //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Exception killing worker thread: " + e.ToString());
124 }
125 }
126 }
127 eventQueueThreads.Clear();
128 // Todo: Clean up our queues
129 eventQueue.Clear();
130 }
131
132 /// <summary>
133 /// Queue processing thread loop
134 /// </summary>
135 private void EventQueueThreadLoop()
136 {
137 //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Worker thread spawned");
138 try
139 {
140 QueueItemStruct BlankQIS = new QueueItemStruct();
141 while (true)
142 {
143 try
144 {
145 QueueItemStruct QIS = BlankQIS;
146 bool GotItem = false;
147
148 if (eventQueue.Count == 0)
149 {
150 // Nothing to do? Sleep a bit waiting for something to do
151 Thread.Sleep(nothingToDoSleepms);
152 }
153 else
154 {
155 // Something in queue, process
156 //myScriptEngine.m_log.Info("[ScriptEngine]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
157
158 // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
159 lock (queueLock)
160 {
161 GotItem = false;
162 for (int qc = 0; qc < eventQueue.Count; qc++)
163 {
164 // Get queue item
165 QIS = eventQueue.Dequeue();
166
167 // Check if object is being processed by someone else
168 if (TryLock(QIS.localID) == false)
169 {
170 // Object is already being processed, requeue it
171 eventQueue.Enqueue(QIS);
172 }
173 else
174 {
175 // We have lock on an object and can process it
176 GotItem = true;
177 break;
178 }
179 }
180 }
181
182 if (GotItem == true)
183 {
184 // Execute function
185 try
186 {
187 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID,
188 QIS.functionName, QIS.param);
189 }
190 catch (Exception e)
191 {
192 // DISPLAY ERROR INWORLD
193 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
194 if (e.InnerException != null)
195 {
196 // Send inner exception
197 text += e.InnerException.Message.ToString();
198 }
199 else
200 {
201 // Send normal
202 text += e.Message.ToString();
203 }
204 try
205 {
206 if (text.Length > 1500)
207 text = text.Substring(0, 1500);
208 IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
209 //if (m_host != null)
210 //{
211 m_ScriptEngine.World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0,
212 m_host.AbsolutePosition, m_host.Name, m_host.UUID);
213 }
214 catch
215 {
216 //}
217 //else
218 //{
219 // T oconsole
220 Console.WriteLine("Unable to send text in-world:\r\n" + text);
221 }
222 }
223 finally
224 {
225 ReleaseLock(QIS.localID);
226 }
227 }
228 }
229 }
230 catch (ThreadAbortException tae)
231 {
232 throw tae;
233 }
234 catch (Exception e)
235 {
236 Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString());
237 }
238 }
239 }
240 catch (ThreadAbortException)
241 {
242 //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Worker thread killed: " + tae.Message);
243 }
244 }
245
246 /// <summary>
247 /// Try to get a mutex lock on localID
248 /// </summary>
249 /// <param name="localID"></param>
250 /// <returns></returns>
251 private bool TryLock(uint localID)
252 {
253 lock (tryLockLock)
254 {
255 if (objectLocks.Contains(localID) == true)
256 {
257 return false;
258 }
259 else
260 {
261 objectLocks.Add(localID);
262 return true;
263 }
264 }
265 }
266
267 /// <summary>
268 /// Release mutex lock on localID
269 /// </summary>
270 /// <param name="localID"></param>
271 private void ReleaseLock(uint localID)
272 {
273 lock (tryLockLock)
274 {
275 if (objectLocks.Contains(localID) == true)
276 {
277 objectLocks.Remove(localID);
278 }
279 }
280 }
281
282 /// <summary>
283 /// Add event to event execution queue
284 /// </summary>
285 /// <param name="localID"></param>
286 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
287 /// <param name="param">Array of parameters to match event mask</param>
288 public void AddToObjectQueue(uint localID, string FunctionName, object[] param)
289 {
290 // Determine all scripts in Object and add to their queue
291 //myScriptEngine.m_log.Info("[ScriptEngine]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
292
293
294 // Do we have any scripts in this object at all? If not, return
295 if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false)
296 {
297 //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
298 return;
299 }
300
301 Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys =
302 m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
303
304 foreach (LLUUID itemID in scriptKeys)
305 {
306 // Add to each script in that object
307 // TODO: Some scripts may not subscribe to this event. Should we NOT add it? Does it matter?
308 AddToScriptQueue(localID, itemID, FunctionName, param);
309 }
310 }
311
312 /// <summary>
313 /// Add event to event execution queue
314 /// </summary>
315 /// <param name="localID"></param>
316 /// <param name="itemID"></param>
317 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
318 /// <param name="param">Array of parameters to match event mask</param>
319 public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param)
320 {
321 lock (queueLock)
322 {
323 // Create a structure and add data
324 QueueItemStruct QIS = new QueueItemStruct();
325 QIS.localID = localID;
326 QIS.itemID = itemID;
327 QIS.functionName = FunctionName;
328 QIS.param = param;
329
330 // Add it to queue
331 eventQueue.Enqueue(QIS);
332 }
333 }
334 }
335}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
deleted file mode 100644
index d054a2c..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ /dev/null
@@ -1,354 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using libsecondlife;
32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Modules;
34
35namespace OpenSim.Grid.ScriptEngine.DotNetEngine
36{
37 /// <summary>
38 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
39 /// </summary>
40 internal class LSLLongCmdHandler
41 {
42 private Thread cmdHandlerThread;
43 private int cmdHandlerThreadCycleSleepms = 100;
44
45 private ScriptEngine m_ScriptEngine;
46
47 public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
48 {
49 m_ScriptEngine = _ScriptEngine;
50
51 // Start the thread that will be doing the work
52 cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
53 cmdHandlerThread.Name = "CmdHandlerThread";
54 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
55 cmdHandlerThread.IsBackground = true;
56 cmdHandlerThread.Start();
57 }
58
59 ~LSLLongCmdHandler()
60 {
61 // Shut down thread
62 try
63 {
64 if (cmdHandlerThread != null)
65 {
66 if (cmdHandlerThread.IsAlive == true)
67 {
68 cmdHandlerThread.Abort();
69 cmdHandlerThread.Join();
70 }
71 }
72 }
73 catch
74 {
75 }
76 }
77
78 private void CmdHandlerThreadLoop()
79 {
80 while (true)
81 {
82 // Check timers
83 CheckTimerEvents();
84 Thread.Sleep(25);
85 // Check HttpRequests
86 CheckHttpRequests();
87 Thread.Sleep(25);
88 // Check XMLRPCRequests
89 CheckXMLRPCRequests();
90 Thread.Sleep(25);
91 // Check Listeners
92 CheckListeners();
93 Thread.Sleep(25);
94
95 // Sleep before next cycle
96 //Thread.Sleep(cmdHandlerThreadCycleSleepms);
97 }
98 }
99
100 /// <summary>
101 /// Remove a specific script (and all its pending commands)
102 /// </summary>
103 /// <param name="m_localID"></param>
104 /// <param name="m_itemID"></param>
105 public void RemoveScript(uint localID, LLUUID itemID)
106 {
107 // Remove a specific script
108
109 // Remove from: Timers
110 UnSetTimerEvents(localID, itemID);
111 // Remove from: HttpRequest
112 StopHttpRequest(localID, itemID);
113 }
114
115 #region TIMER
116
117 //
118 // TIMER
119 //
120 private class TimerClass
121 {
122 public uint localID;
123 public LLUUID itemID;
124 public double interval;
125 public DateTime next;
126 }
127
128 private List<TimerClass> Timers = new List<TimerClass>();
129 private object TimerListLock = new object();
130
131 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec)
132 {
133 Console.WriteLine("SetTimerEvent");
134
135 // Always remove first, in case this is a re-set
136 UnSetTimerEvents(m_localID, m_itemID);
137 if (sec == 0) // Disabling timer
138 return;
139
140 // Add to timer
141 TimerClass ts = new TimerClass();
142 ts.localID = m_localID;
143 ts.itemID = m_itemID;
144 ts.interval = sec;
145 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
146 lock (TimerListLock)
147 {
148 Timers.Add(ts);
149 }
150 }
151
152 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID)
153 {
154 // Remove from timer
155 lock (TimerListLock)
156 {
157 List<TimerClass> NewTimers = new List<TimerClass>();
158 foreach (TimerClass ts in Timers)
159 {
160 if (ts.localID != m_localID && ts.itemID != m_itemID)
161 {
162 NewTimers.Add(ts);
163 }
164 }
165 Timers.Clear();
166 Timers = NewTimers;
167 }
168 }
169
170 public void CheckTimerEvents()
171 {
172 // Nothing to do here?
173 if (Timers.Count == 0)
174 return;
175
176 lock (TimerListLock)
177 {
178 // Go through all timers
179 foreach (TimerClass ts in Timers)
180 {
181 // Time has passed?
182 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
183 {
184 // Add it to queue
185 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer",
186 new object[] {});
187 // set next interval
188
189
190 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
191 }
192 }
193 }
194 }
195
196 #endregion
197
198 #region HTTP REQUEST
199
200 //
201 // HTTP REAQUEST
202 //
203 private class HttpClass
204 {
205 public uint localID;
206 public LLUUID itemID;
207 public string url;
208 public List<string> parameters;
209 public string body;
210 public DateTime next;
211
212 public string response_request_id;
213 public int response_status;
214 public List<string> response_metadata;
215 public string response_body;
216
217 public void SendRequest()
218 {
219 // TODO: SEND REQUEST!!!
220 }
221
222 public void Stop()
223 {
224 // TODO: Cancel any ongoing request
225 }
226
227 public bool CheckResponse()
228 {
229 // TODO: Check if we got a response yet, return true if so -- false if not
230 return true;
231
232 // TODO: If we got a response, set the following then return true
233 //response_request_id
234 //response_status
235 //response_metadata
236 //response_body
237 }
238 }
239
240 private List<HttpClass> HttpRequests = new List<HttpClass>();
241 private object HttpListLock = new object();
242
243 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
244 {
245 Console.WriteLine("StartHttpRequest");
246
247 HttpClass htc = new HttpClass();
248 htc.localID = localID;
249 htc.itemID = itemID;
250 htc.url = url;
251 htc.parameters = parameters;
252 htc.body = body;
253 lock (HttpListLock)
254 {
255 //ADD REQUEST
256 HttpRequests.Add(htc);
257 }
258 }
259
260 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
261 {
262 // Remove from list
263 lock (HttpListLock)
264 {
265 List<HttpClass> NewHttpList = new List<HttpClass>();
266 foreach (HttpClass ts in HttpRequests)
267 {
268 if (ts.localID != m_localID && ts.itemID != m_itemID)
269 {
270 // Keeping this one
271 NewHttpList.Add(ts);
272 }
273 else
274 {
275 // Shutting this one down
276 ts.Stop();
277 }
278 }
279 HttpRequests.Clear();
280 HttpRequests = NewHttpList;
281 }
282 }
283
284 public void CheckHttpRequests()
285 {
286 // Nothing to do here?
287 if (HttpRequests.Count == 0)
288 return;
289
290 lock (HttpListLock)
291 {
292 foreach (HttpClass ts in HttpRequests)
293 {
294 if (ts.CheckResponse() == true)
295 {
296 // Add it to event queue
297 //key request_id, integer status, list metadata, string body
298 object[] resobj =
299 new object[]
300 {ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body};
301 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response",
302 resobj);
303 // Now stop it
304 StopHttpRequest(ts.localID, ts.itemID);
305 }
306 }
307 }
308 }
309
310 #endregion
311
312 public void CheckXMLRPCRequests()
313 {
314 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
315
316 while (xmlrpc.hasRequests())
317 {
318 RPCRequestInfo rInfo = xmlrpc.GetNextRequest();
319 Console.WriteLine("PICKED REQUEST");
320
321 //Deliver data to prim's remote_data handler
322 object[] resobj = new object[]
323 {
324 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(),
325 rInfo.GetStrVal()
326 };
327 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
328 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", resobj
329 );
330 }
331 }
332
333 public void CheckListeners()
334 {
335 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
336
337 while (comms.HasMessages())
338 {
339 ListenerInfo lInfo = comms.GetNextMessage();
340 Console.WriteLine("PICKED LISTENER");
341
342 //Deliver data to prim's listen handler
343 object[] resobj = new object[]
344 {
345 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
346 };
347
348 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
349 lInfo.GetLocalID(), lInfo.GetItemID(), "listen", resobj
350 );
351 }
352 }
353 }
354}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
deleted file mode 100644
index 060ae0b..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OpenSim.Grid.ScriptEngine.DotNetEngine")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("")]
39[assembly : AssemblyProduct("OpenSim.Grid.ScriptEngine.DotNetEngine")]
40[assembly : AssemblyCopyright("Copyright (c) 2007")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("2842257e-6fde-4460-9368-4cde57fa9cc4")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below:
63
64[assembly : AssemblyVersion("1.0.0.0")]
65[assembly : AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs
deleted file mode 100644
index fadd927..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using Nini.Config;
31using OpenSim.Framework.Console;
32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes;
34
35namespace OpenSim.Grid.ScriptEngine.DotNetEngine
36{
37 /// <summary>
38 /// This is the root object for ScriptEngine
39 /// </summary>
40 [Serializable]
41 public class ScriptEngine : IRegionModule
42 {
43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44
45 internal Scene World;
46 internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
47 internal EventQueueManager m_EventQueueManager; // Executes events
48 internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
49 internal AppDomainManager m_AppDomainManager;
50 internal LSLLongCmdHandler m_LSLLongCmdHandler;
51
52
53 public ScriptEngine()
54 {
55 //Common.SendToDebug("ScriptEngine Object Initialized");
56 Common.mySE = this;
57 }
58
59 public void InitializeEngine(Scene Sceneworld)
60 {
61 World = Sceneworld;
62
63 m_log.Info("[ScriptEngine]: DotNet & LSL ScriptEngine initializing");
64
65 //m_log.Info("[ScriptEngine]: InitializeEngine");
66
67 // Create all objects we'll be using
68 m_EventQueueManager = new EventQueueManager(this);
69 m_EventManager = new EventManager(this);
70 m_ScriptManager = new ScriptManager(this);
71 m_AppDomainManager = new AppDomainManager();
72 m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
73
74 // Should we iterate the region for scripts that needs starting?
75 // Or can we assume we are loaded before anything else so we can use proper events?
76 }
77
78 public void Shutdown()
79 {
80 // We are shutting down
81 }
82
83 //// !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
84 //[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
85 //public void StartScript(string ScriptID, IScriptHost ObjectID)
86 //{
87 // this.myEventManager.TEMP_OBJECT_ID = ObjectID;
88 // m_log.Info("[ScriptEngine]: DEBUG FUNCTION: StartScript: " + ScriptID);
89 // myScriptManager.StartScript(ScriptID, ObjectID);
90 //}
91
92 #region IRegionModule
93
94 public void Initialise(Scene scene, IConfigSource config)
95 {
96 InitializeEngine(scene);
97 }
98
99 public void PostInitialise()
100 {
101 }
102
103 public void Close()
104 {
105 }
106
107 public string Name
108 {
109 get { return "LSLScriptingModule"; }
110 }
111
112 public bool IsSharedModule
113 {
114 get { return false; }
115 }
116
117 #endregion
118 }
119}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
deleted file mode 100644
index 439fb7d..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ /dev/null
@@ -1,421 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Original code: Tedd Hansen */
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using System.Runtime.Serialization.Formatters.Binary;
34using System.Threading;
35using libsecondlife;
36using OpenSim.Framework;
37using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler;
38using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
39using OpenSim.Region.Environment.Scenes;
40
41namespace OpenSim.Grid.ScriptEngine.DotNetEngine
42{
43 /// <summary>
44 /// Loads scripts
45 /// Compiles them if necessary
46 /// Execute functions for EventQueueManager (Sends them to script on other AppDomain for execution)
47 /// </summary>
48 [Serializable]
49 public class ScriptManager
50 {
51 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
52
53 #region Declares
54
55 private Thread scriptLoadUnloadThread;
56 private int scriptLoadUnloadThread_IdleSleepms = 100;
57 private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>();
58 private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>();
59
60 private struct LoadStruct
61 {
62 public uint localID;
63 public LLUUID itemID;
64 public string script;
65 }
66
67 private struct UnloadStruct
68 {
69 public uint localID;
70 public LLUUID itemID;
71 }
72
73 // Object<string, Script<string, script>>
74 // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
75 // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
76 internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts =
77 new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>();
78
79 public Scene World
80 {
81 get { return m_scriptEngine.World; }
82 }
83
84 #endregion
85
86 #region Object init/shutdown
87
88 private ScriptEngine m_scriptEngine;
89
90 public ScriptManager(ScriptEngine scriptEngine)
91 {
92 m_scriptEngine = scriptEngine;
93 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
94 scriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop);
95 scriptLoadUnloadThread.Name = "ScriptLoadUnloadThread";
96 scriptLoadUnloadThread.IsBackground = true;
97 scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal;
98 scriptLoadUnloadThread.Start();
99 }
100
101 ~ScriptManager()
102 {
103 // Abort load/unload thread
104 try
105 {
106 if (scriptLoadUnloadThread != null)
107 {
108 if (scriptLoadUnloadThread.IsAlive == true)
109 {
110 scriptLoadUnloadThread.Abort();
111 scriptLoadUnloadThread.Join();
112 }
113 }
114 }
115 catch
116 {
117 }
118 }
119
120 #endregion
121
122 #region Load / Unload scripts (Thread loop)
123
124 private void ScriptLoadUnloadThreadLoop()
125 {
126 try
127 {
128 while (true)
129 {
130 if (loadQueue.Count == 0 && unloadQueue.Count == 0)
131 Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
132
133 if (loadQueue.Count > 0)
134 {
135 LoadStruct item = loadQueue.Dequeue();
136 _StartScript(item.localID, item.itemID, item.script);
137 }
138
139 if (unloadQueue.Count > 0)
140 {
141 UnloadStruct item = unloadQueue.Dequeue();
142 _StopScript(item.localID, item.itemID);
143 }
144 }
145 }
146 catch (ThreadAbortException tae)
147 {
148 string a = tae.ToString();
149 a = "";
150 // Expected
151 }
152 }
153
154 #endregion
155
156 #region Helper functions
157
158 private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
159 {
160 //Console.WriteLine("ScriptManager.CurrentDomain_AssemblyResolve: " + args.Name);
161 return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null;
162 }
163
164 #endregion
165
166 #region Internal functions to keep track of script
167
168 internal Dictionary<LLUUID, LSL_BaseClass>.KeyCollection GetScriptKeys(uint localID)
169 {
170 if (Scripts.ContainsKey(localID) == false)
171 return null;
172
173 Dictionary<LLUUID, LSL_BaseClass> Obj;
174 Scripts.TryGetValue(localID, out Obj);
175
176 return Obj.Keys;
177 }
178
179 internal LSL_BaseClass GetScript(uint localID, LLUUID itemID)
180 {
181 if (Scripts.ContainsKey(localID) == false)
182 return null;
183
184 Dictionary<LLUUID, LSL_BaseClass> Obj;
185 Scripts.TryGetValue(localID, out Obj);
186 if (Obj.ContainsKey(itemID) == false)
187 return null;
188
189 // Get script
190 LSL_BaseClass Script;
191 Obj.TryGetValue(itemID, out Script);
192
193 return Script;
194 }
195
196 internal void SetScript(uint localID, LLUUID itemID, LSL_BaseClass Script)
197 {
198 // Create object if it doesn't exist
199 if (Scripts.ContainsKey(localID) == false)
200 {
201 Scripts.Add(localID, new Dictionary<LLUUID, LSL_BaseClass>());
202 }
203
204 // Delete script if it exists
205 Dictionary<LLUUID, LSL_BaseClass> Obj;
206 Scripts.TryGetValue(localID, out Obj);
207 if (Obj.ContainsKey(itemID) == true)
208 Obj.Remove(itemID);
209
210 // Add to object
211 Obj.Add(itemID, Script);
212 }
213
214 internal void RemoveScript(uint localID, LLUUID itemID)
215 {
216 // Don't have that object?
217 if (Scripts.ContainsKey(localID) == false)
218 return;
219
220 // Delete script if it exists
221 Dictionary<LLUUID, LSL_BaseClass> Obj;
222 Scripts.TryGetValue(localID, out Obj);
223 if (Obj.ContainsKey(itemID) == true)
224 Obj.Remove(itemID);
225 }
226
227 #endregion
228
229 #region Start/Stop/Reset script
230
231 /// <summary>
232 /// Fetches, loads and hooks up a script to an objects events
233 /// </summary>
234 /// <param name="itemID"></param>
235 /// <param name="localID"></param>
236 public void StartScript(uint localID, LLUUID itemID, string Script)
237 {
238 LoadStruct ls = new LoadStruct();
239 ls.localID = localID;
240 ls.itemID = itemID;
241 ls.script = Script;
242 loadQueue.Enqueue(ls);
243 }
244
245 /// <summary>
246 /// Disables and unloads a script
247 /// </summary>
248 /// <param name="localID"></param>
249 /// <param name="itemID"></param>
250 public void StopScript(uint localID, LLUUID itemID)
251 {
252 UnloadStruct ls = new UnloadStruct();
253 ls.localID = localID;
254 ls.itemID = itemID;
255 unloadQueue.Enqueue(ls);
256 }
257
258 public void ResetScript(uint localID, LLUUID itemID)
259 {
260 string script = GetScript(localID, itemID).SourceCode;
261 StopScript(localID, itemID);
262 StartScript(localID, itemID, script);
263 }
264
265 private void _StartScript(uint localID, LLUUID itemID, string Script)
266 {
267 //IScriptHost root = host.GetRoot();
268 Console.WriteLine("ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
269
270 // We will initialize and start the script.
271 // It will be up to the script itself to hook up the correct events.
272 string ScriptSource = "";
273
274 SceneObjectPart m_host = World.GetSceneObjectPart(localID);
275
276 try
277 {
278 // Create a new instance of the compiler (currently we don't want reuse)
279 Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
280 // Compile (We assume LSL)
281 ScriptSource = LSLCompiler.CompileFromLSLText(Script);
282 //Console.WriteLine("Compilation of " + FileName + " done");
283 // * Insert yield into code
284 ScriptSource = ProcessYield(ScriptSource);
285
286
287#if DEBUG
288 long before;
289 before = GC.GetTotalMemory(true);
290#endif
291
292 LSL_BaseClass CompiledScript;
293 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
294
295#if DEBUG
296 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
297#endif
298
299 CompiledScript.SourceCode = ScriptSource;
300 // Add it to our script memstruct
301 SetScript(localID, itemID, CompiledScript);
302
303 // We need to give (untrusted) assembly a private instance of BuiltIns
304 // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed.
305
306
307 LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, m_host, localID, itemID);
308
309 // Start the script - giving it BuiltIns
310 CompiledScript.Start(LSLB);
311
312 // Fire the first start-event
313 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {});
314 }
315 catch (Exception e)
316 {
317 //m_scriptEngine.m_log.Error("[ScriptEngine]: Error compiling script: " + e.ToString());
318 try
319 {
320 // DISPLAY ERROR INWORLD
321 string text = "Error compiling script:\r\n" + e.Message.ToString();
322 if (text.Length > 1500)
323 text = text.Substring(0, 1500);
324 World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
325 }
326 catch (Exception e2)
327 {
328 m_scriptEngine.m_log.Error("[ScriptEngine]: Error displaying error in-world: " + e2.ToString());
329 }
330 }
331 }
332
333 private void _StopScript(uint localID, LLUUID itemID)
334 {
335 // Stop script
336 Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
337
338
339 // Stop long command on script
340 m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID);
341
342 LSL_BaseClass LSLBC = GetScript(localID, itemID);
343 if (LSLBC == null)
344 return;
345
346 // TEMP: First serialize it
347 //GetSerializedScript(localID, itemID);
348
349
350 try
351 {
352 // Get AppDomain
353 AppDomain ad = LSLBC.Exec.GetAppDomain();
354 // Tell script not to accept new requests
355 GetScript(localID, itemID).Exec.StopScript();
356 // Remove from internal structure
357 RemoveScript(localID, itemID);
358 // Tell AppDomain that we have stopped script
359 m_scriptEngine.m_AppDomainManager.StopScript(ad);
360 }
361 catch (Exception e)
362 {
363 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
364 ": " + e.ToString());
365 }
366 }
367
368 private string ProcessYield(string FileName)
369 {
370 // TODO: Create a new assembly and copy old but insert Yield Code
371 //return TempDotNetMicroThreadingCodeInjector.TestFix(FileName);
372 return FileName;
373 }
374
375 #endregion
376
377 #region Perform event execution in script
378
379 /// <summary>
380 /// Execute a LL-event-function in Script
381 /// </summary>
382 /// <param name="localID">Object the script is located in</param>
383 /// <param name="itemID">Script ID</param>
384 /// <param name="FunctionName">Name of function</param>
385 /// <param name="args">Arguments to pass to function</param>
386 internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args)
387 {
388 // Execute a function in the script
389 //m_scriptEngine.m_log.Info("[ScriptEngine]: Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
390 LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID);
391 if (Script == null)
392 return;
393
394 // Must be done in correct AppDomain, so leaving it up to the script itself
395 Script.Exec.ExecuteEvent(FunctionName, args);
396 }
397
398 #endregion
399
400 #region Script serialization/deserialization
401
402 public void GetSerializedScript(uint localID, LLUUID itemID)
403 {
404 // Serialize the script and return it
405 // Should not be a problem
406 FileStream fs = File.Create("SERIALIZED_SCRIPT_" + itemID);
407 BinaryFormatter b = new BinaryFormatter();
408 b.Serialize(fs, GetScript(localID, itemID));
409 fs.Close();
410 }
411
412 public void PutSerializedScript(uint localID, LLUUID itemID)
413 {
414 // Deserialize the script and inject it into an AppDomain
415
416 // How to inject into an AppDomain?
417 }
418
419 #endregion
420 }
421}
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
deleted file mode 100644
index f40d19a..0000000
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using Rail.Reflect;
31using Rail.Transformation;
32
33namespace OpenSim.Grid.ScriptEngine.DotNetEngine
34{
35 /// <summary>
36 /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes!
37 /// Its offspring will be the actual implementation.
38 /// </summary>
39 internal class TempDotNetMicroThreadingCodeInjector
40 {
41 public static string TestFix(string FileName)
42 {
43 string ret = Path.GetFileNameWithoutExtension(FileName + "_fixed.dll");
44
45 Console.WriteLine("Loading: \"" + FileName + "\"");
46 RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName);
47
48
49 //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe
50 RTypeDef type = (RTypeDef) rAssembly.RModuleDef.GetType("SecondLife.Script");
51
52 //Get the methods in the type
53 RMethod[] m = type.GetMethods();
54
55 //Create a MethodPrologueAdder visitor object with the method to add
56 //and with the flag that enables local variable creation set to true
57 MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef) m[0], true);
58
59 //Apply the changes to the assembly
60 rAssembly.Accept(mpa);
61
62 //Save the new assembly
63 rAssembly.SaveAssembly(ret);
64
65 return ret;
66 }
67 }
68}