From 313f7f60fda81c987e0ac4da4dc8c2f5def46b72 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Mon, 30 Jun 2008 11:57:47 +0000 Subject: [PATCH] properly explaining each #pragma warning disable massaging OSHttpRequestPump to not abort on exceptions... --- OpenSim/Framework/Servers/OSHttpHandler.cs | 1 + .../Framework/Servers/OSHttpRequestPump.cs | 64 +++++++++++-------- .../World/Archiver/ArchiveConstants.cs | 12 ++-- .../Modules/World/NPC/NPCAvatar.cs | 5 +- .../Examples/SimpleModule/MyNpcCharacter.cs | 1 + .../Region/Physics/Manager/PhysicsActor.cs | 1 + OpenSim/Region/Physics/Meshing/HelperTypes.cs | 9 +-- .../Api/Runtime/YieldProlog/BagofAnswers.cs | 56 ++++++++-------- .../Api/Runtime/YieldProlog/Functor2.cs | 16 ++--- .../Api/Runtime/YieldProlog/Functor3.cs | 16 ++--- .../Shared/Api/Runtime/YieldProlog/Parser.cs | 8 +-- .../Api/Runtime/YieldProlog/Variable.cs | 8 +-- .../Shared/Api/Runtime/YieldProlog/YP.cs | 64 +++++++++---------- .../Api/Runtime/YieldProlog/YPCompiler.cs | 18 +++--- .../Shared/CodeTools/YP2CSConverter.cs | 9 +-- .../Region/ScriptEngine/XEngine/XEngine.cs | 3 + 16 files changed, 158 insertions(+), 133 deletions(-) diff --git a/OpenSim/Framework/Servers/OSHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHandler.cs index c4ab81c26d..da96cca577 100644 --- a/OpenSim/Framework/Servers/OSHttpHandler.cs +++ b/OpenSim/Framework/Servers/OSHttpHandler.cs @@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers /// public enum OSHttpHandlerResult { + Unprocessed, Pass, Handled, Detached, diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs index 3459cc625c..44fba47a5b 100644 --- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs +++ b/OpenSim/Framework/Servers/OSHttpRequestPump.cs @@ -98,42 +98,54 @@ namespace OpenSim.Framework.Servers { OSHttpRequest req = null; - try { - while (true) - { - // get job to do + while (true) + { + try { + // dequeue an OSHttpRequest from OSHttpServer's + // request queue req = _queue.Dequeue(); - - // get list of registered handlers + + // get a copy of the list of registered handlers List handlers = _server.OSHttpHandlers; - - // prune list and sort from most specific to least - // specific + + // prune list and have it sorted from most + // specific to least specific handlers = MatchHandlers(req, handlers); - - // process req + + // process req: we try each handler in turn until + // we are either out of handlers or get back a + // Handled or Detached + OSHttpHandlerResult rc = OSHttpHandlerResult.Unprocessed; foreach(OSHttpHandler h in handlers) { - OSHttpHandlerResult rc = h.Process(req); - // handler did not process the request, try - // next handler + rc = h.Process(req); + + // Pass: handler did not process the request, + // try next handler if (OSHttpHandlerResult.Pass == rc) continue; - // handler is taking over processing of - // request, we are done + // Detached: handler is taking over processing + // of request, we are done if (OSHttpHandlerResult.Detached == rc) break; - - // request was handled, we need to clean up - // TODO: cleanup :-) - + + if (OSHttpHandlerResult.Handled != rc) + { + // something went wrong + throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc)); + } + + // Handled: clean up + // response.KeepAlive = false; + // response.SendChunked = false; + break; } - + + } + catch (Exception e) + { + _log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString()); + _log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message); } - } - catch (Exception e) - { - _log.DebugFormat("[{0}] something went wrong: {1}", EngineID, e.ToString()); - _log.ErrorFormat("[{0}] something went wrong: {1}, terminating this pump", EngineID, e.Message); } } diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs index 0115d8d697..7b76cb8c9f 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs @@ -77,9 +77,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ".ncd"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".oob"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rfd"; // Not sure if we'll ever see this - #pragma warning disable 0612 +// disable warning: we know Script is obsolete, but need to support it +// anyhow +#pragma warning disable 0612 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ".spt"; // Not sure if we'll ever see this - #pragma warning restore 0612 +#pragma warning restore 0612 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ".sst"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ".sfd"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg"; @@ -102,9 +104,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver EXTENSION_TO_ASSET_TYPE[".ncd"] = (sbyte)AssetType.Notecard; EXTENSION_TO_ASSET_TYPE[".oob"] = (sbyte)AssetType.Object; EXTENSION_TO_ASSET_TYPE[".rfd"] = (sbyte)AssetType.RootFolder; - #pragma warning disable 0612 +// disable warning: we know Script is obsolete, but need to support it +// anyhow +#pragma warning disable 0612 EXTENSION_TO_ASSET_TYPE[".spt"] = (sbyte)AssetType.Script; - #pragma warning restore 0612 +#pragma warning restore 0612 EXTENSION_TO_ASSET_TYPE[".sst"] = (sbyte)AssetType.Simstate; EXTENSION_TO_ASSET_TYPE[".sfd"] = (sbyte)AssetType.SnapshotFolder; EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound; diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 5d94407ece..a8ad56f5c5 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -139,8 +139,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC #endregion #region Event Definitions IGNORE -#pragma warning disable 67 +// disable warning: public events constituting public API +#pragma warning disable 67 public event Action OnLogout; public event ObjectPermissions OnObjectPermissions; @@ -294,8 +295,8 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; public event UpdateVector OnAutoPilotGo; - #pragma warning restore 67 + #endregion #region Overrriden Methods IGNORE diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4379c44063..fb9cd1b00a 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -43,6 +43,7 @@ namespace OpenSim.Region.Examples.SimpleModule private short count = 0; private short frame = 0; +// disable warning: public events, part of the public API #pragma warning disable 67 public event Action OnLogout; diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index c87e748905..22e21a519e 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -100,6 +100,7 @@ namespace OpenSim.Region.Physics.Manager public delegate void CollisionUpdate(EventArgs e); public delegate void OutOfBounds(PhysicsVector pos); +// disable warning: public events #pragma warning disable 67 public event PositionUpdate OnPositionUpdate; public event VelocityUpdate OnVelocityUpdate; diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index 5d9823c416..418baf59b8 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs @@ -193,9 +193,10 @@ public class Vertex : PhysicsVector, IComparable return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); } - // mono compiler moans about overloading operators hiding base - // operator but should not according to C# language spec - #pragma warning disable 0108 + // disable warning: mono compiler moans about overloading + // operators hiding base operator but should not according to C# + // language spec +#pragma warning disable 0108 public static Vertex operator *(Vertex v, Quaternion q) { Matrix4 tm = q.computeMatrix(); @@ -253,7 +254,7 @@ public class Vertex : PhysicsVector, IComparable v1.Z *= mul; return v1; } - #pragma warning restore 0108 +#pragma warning restore 0108 public float dot(Vertex v) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs index c52adb19dc..c2bb0b7c59 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs @@ -127,27 +127,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog // No unbound free variables, so we only filled one bag. If empty, bagof fails. if (_findallBagArray.Count > 0) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in bagArrayVariable.unify(_findallBagArray)) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } else { foreach (KeyValuePair> valuesAndBag in _bagForFreeVariables) { - // disable warning on l1 and l2, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key)) { foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value)) yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 // Debug: Should we free memory of the answers already returned? } } @@ -161,15 +161,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog public IEnumerable result(object Bag) { Variable bagArrayVariable = new Variable(); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in resultArray(bagArrayVariable)) { foreach (bool l2 in YP.unify(Bag, ListPair.make((List)bagArrayVariable.getValue()))) yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 } /// @@ -181,9 +181,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog public IEnumerable resultSet(object Bag) { Variable bagArrayVariable = new Variable(); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in resultArray(bagArrayVariable)) { List bagArray = (List)bagArrayVariable.getValue(); @@ -191,19 +191,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray))) yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 } public static IEnumerable bagofArray (object Template, object Goal, IEnumerable goalIterator, Variable bagArrayVariable) { BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in goalIterator) bagOfAnswers.add(); - #pragma warning restore 0168 +#pragma warning restore 0168 return bagOfAnswers.resultArray(bagArrayVariable); } @@ -211,12 +211,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog (object Template, object Goal, IEnumerable goalIterator, object Bag) { BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in goalIterator) bagOfAnswers.add(); - #pragma warning restore 0168 +#pragma warning restore 0168 return bagOfAnswers.result(Bag); } @@ -224,12 +224,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog (object Template, object Goal, IEnumerable goalIterator, object Bag) { BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in goalIterator) bagOfAnswers.add(); - #pragma warning restore 0168 +#pragma warning restore 0168 return bagOfAnswers.resultSet(Bag); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs index 7e4f27dd6d..4ae325e31f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs @@ -59,25 +59,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog Functor2 argFunctor = (Functor2)arg; if (_name.Equals(argFunctor._name)) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) { foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2)) yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 } } else if (arg is Variable) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in ((Variable)arg).unify(this)) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs index 6ef8327cfd..907bfca052 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs @@ -61,9 +61,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog Functor3 argFunctor = (Functor3)arg; if (_name.Equals(argFunctor._name)) { - // disable warning on l1, l2, l3 don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) { foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2)) @@ -72,17 +72,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog yield return false; } } - #pragma warning restore 0168 +#pragma warning restore 0168 } } else if (arg is Variable) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in ((Variable)arg).unify(this)) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs index e9dd8f1348..3d869055bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs @@ -44,9 +44,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog yield return false; } - // disable warning about unused variables: the following code - // is infested with it. - #pragma warning disable 0168, 0219 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168, 0219 // Debug: Hand-modify this central predicate to do tail recursion. public static IEnumerable read_tokens(object arg1, object arg2, object arg3) @@ -4457,6 +4457,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog { } } } - #pragma warning restore 0168 +#pragma warning restore 0168 } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs index 8e2aa7ecf5..f68a94153d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs @@ -92,12 +92,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog } else { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(this, arg)) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs index f0e814756a..c212fb83c8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs @@ -572,9 +572,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog Variable Name = new Variable(); Variable ArgList = new Variable(); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in new ListPair(Name, ArgList).unify(List)) { object[] args = ListPair.toArray(ArgList); @@ -588,7 +588,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog return YP.unify(Term, Functor.make((Atom)YP.getValue(Name), args)); } - #pragma warning restore 0168 +#pragma warning restore 0168 return YP.fail(); } @@ -601,15 +601,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog if (!(Term is Variable)) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term))) { foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length)) yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 } else throw new NotImplementedException("Debug: must finish functor/3"); @@ -629,12 +629,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog if (argNumberInt >= 1 && argNumberInt <= termArgs.Length) { // The first ArgNumber is at 1, not 0. - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1])) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } } @@ -826,12 +826,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog object[] args = new object[] { Priority, Specifier, Operator }; foreach (object[] answer in _operatorTable) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unifyArrays(args, answer)) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } @@ -863,16 +863,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog int afterInt = atomAtom._name.Length - (beforeInt + lengthInt); if (afterInt >= 0) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(After, afterInt)) { foreach (bool l2 in YP.unify (Sub_atom, Atom.a(atomAtom._name.Substring(beforeInt, lengthInt)))) yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 } } @@ -1221,13 +1221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog if (arity == 2 && (name == Atom.a(",") || name == Atom.a(";") || name == Atom.DOT)) return false; // Use the same mapping to static predicates in YP as the compiler. - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable())) return false; // Debug: Do we need to check if name._module is null? - #pragma warning restore 0168 +#pragma warning restore 0168 return true; } @@ -1366,13 +1366,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog foreach (NameArity key in _predicatesStore.Keys) { - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify (new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity)) yield return false; - #pragma warning restore 0168 +#pragma warning restore 0168 } } @@ -1628,15 +1628,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog if (_exception != null) { bool didUnify = false; - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in YP.unify(_exception._term, Catcher)) { didUnify = true; yield return false; } - #pragma warning restore 0168 +#pragma warning restore 0168 if (!didUnify) throw _exception; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs index d6115ce84a..96f2b89f35 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs @@ -209,9 +209,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog object[] functorArgs = YP.getFunctorArgs(Term); Variable pred = new Variable(); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in ((CompilerState)State)._pred.match (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") })) { @@ -220,7 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog return true; } } - #pragma warning restore 0168 +#pragma warning restore 0168 return false; } @@ -232,9 +232,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog object[] functorArgs = YP.getFunctorArgs(Term); Variable pred = new Variable(); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in ((CompilerState)State)._pred.match (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") })) { @@ -243,7 +243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog return true; } } - #pragma warning restore 0168 +#pragma warning restore 0168 return false; } @@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog // disable warning unused variables, the following code is // infested with it. - #pragma warning disable 0168, 0219 +#pragma warning disable 0168, 0219 /// /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs index 69f9fdc93f..52c8251518 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs @@ -69,9 +69,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools YP.tell(myCS_SW); //Console.WriteLine("Mycode\n ===================================\n" + myCode+"\n"); - // disable warning on l1, don't see how we can - // code this differently - #pragma warning disable 0168 + +// disable warning: don't see how we can code this differently short +// of rewriting the whole thing +#pragma warning disable 0168 foreach (bool l1 in Parser.parseInput(TermList)) { foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode)) @@ -84,7 +85,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools //YPCompiler.convertStringCodesCSharp(VFC); } } - #pragma warning restore 0168 +#pragma warning restore 0168 YP.seen(); myCS_SW.Close(); YP.told(); diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index cf84237339..7f539f35d1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -59,6 +59,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine private Scene m_Scene; private IConfig m_ScriptConfig; private Compiler m_Compiler; + +// disable warning: need to keep a reference to XEngine.EventManager +// alive to avoid it being garbage collected #pragma warning disable 414 private EventManager m_EventManager; #pragma warning restore 414