properly explaining each #pragma warning disable

massaging OSHttpRequestPump to not abort on exceptions...
0.6.0-stable
Dr Scofield 2008-06-30 11:57:47 +00:00
parent b0287a43bd
commit 313f7f60fd
16 changed files with 158 additions and 133 deletions

View File

@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public enum OSHttpHandlerResult public enum OSHttpHandlerResult
{ {
Unprocessed,
Pass, Pass,
Handled, Handled,
Detached, Detached,

View File

@ -98,42 +98,54 @@ namespace OpenSim.Framework.Servers
{ {
OSHttpRequest req = null; OSHttpRequest req = null;
try {
while (true) while (true)
{ {
// get job to do try {
// dequeue an OSHttpRequest from OSHttpServer's
// request queue
req = _queue.Dequeue(); req = _queue.Dequeue();
// get list of registered handlers // get a copy of the list of registered handlers
List<OSHttpHandler> handlers = _server.OSHttpHandlers; List<OSHttpHandler> handlers = _server.OSHttpHandlers;
// prune list and sort from most specific to least // prune list and have it sorted from most
// specific // specific to least specific
handlers = MatchHandlers(req, handlers); 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) foreach(OSHttpHandler h in handlers)
{ {
OSHttpHandlerResult rc = h.Process(req); rc = h.Process(req);
// handler did not process the request, try
// next handler // Pass: handler did not process the request,
// try next handler
if (OSHttpHandlerResult.Pass == rc) continue; if (OSHttpHandlerResult.Pass == rc) continue;
// handler is taking over processing of // Detached: handler is taking over processing
// request, we are done // of request, we are done
if (OSHttpHandlerResult.Detached == rc) break; if (OSHttpHandlerResult.Detached == rc) break;
// request was handled, we need to clean up if (OSHttpHandlerResult.Handled != rc)
// TODO: cleanup :-) {
// 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; break;
} }
} }
}
catch (Exception e) catch (Exception e)
{ {
_log.DebugFormat("[{0}] something went wrong: {1}", EngineID, e.ToString()); _log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString());
_log.ErrorFormat("[{0}] something went wrong: {1}, terminating this pump", EngineID, e.Message); _log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message);
}
} }
} }

View File

@ -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.Notecard] = ".ncd";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".oob"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".oob";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rfd"; // Not sure if we'll ever see this 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 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.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.SnapshotFolder] = ".sfd"; // Not sure if we'll ever see this
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg"; 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[".ncd"] = (sbyte)AssetType.Notecard;
EXTENSION_TO_ASSET_TYPE[".oob"] = (sbyte)AssetType.Object; EXTENSION_TO_ASSET_TYPE[".oob"] = (sbyte)AssetType.Object;
EXTENSION_TO_ASSET_TYPE[".rfd"] = (sbyte)AssetType.RootFolder; 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; 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[".sst"] = (sbyte)AssetType.Simstate;
EXTENSION_TO_ASSET_TYPE[".sfd"] = (sbyte)AssetType.SnapshotFolder; EXTENSION_TO_ASSET_TYPE[".sfd"] = (sbyte)AssetType.SnapshotFolder;
EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound; EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound;

View File

@ -139,8 +139,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
#endregion #endregion
#region Event Definitions IGNORE #region Event Definitions IGNORE
#pragma warning disable 67
// disable warning: public events constituting public API
#pragma warning disable 67
public event Action<IClientAPI> OnLogout; public event Action<IClientAPI> OnLogout;
public event ObjectPermissions OnObjectPermissions; public event ObjectPermissions OnObjectPermissions;
@ -294,8 +295,8 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event GetScriptRunning OnGetScriptRunning; public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning; public event SetScriptRunning OnSetScriptRunning;
public event UpdateVector OnAutoPilotGo; public event UpdateVector OnAutoPilotGo;
#pragma warning restore 67 #pragma warning restore 67
#endregion #endregion
#region Overrriden Methods IGNORE #region Overrriden Methods IGNORE

View File

@ -43,6 +43,7 @@ namespace OpenSim.Region.Examples.SimpleModule
private short count = 0; private short count = 0;
private short frame = 0; private short frame = 0;
// disable warning: public events, part of the public API
#pragma warning disable 67 #pragma warning disable 67
public event Action<IClientAPI> OnLogout; public event Action<IClientAPI> OnLogout;

View File

@ -100,6 +100,7 @@ namespace OpenSim.Region.Physics.Manager
public delegate void CollisionUpdate(EventArgs e); public delegate void CollisionUpdate(EventArgs e);
public delegate void OutOfBounds(PhysicsVector pos); public delegate void OutOfBounds(PhysicsVector pos);
// disable warning: public events
#pragma warning disable 67 #pragma warning disable 67
public event PositionUpdate OnPositionUpdate; public event PositionUpdate OnPositionUpdate;
public event VelocityUpdate OnVelocityUpdate; public event VelocityUpdate OnVelocityUpdate;

View File

@ -193,9 +193,10 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); 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 // disable warning: mono compiler moans about overloading
// operator but should not according to C# language spec // operators hiding base operator but should not according to C#
#pragma warning disable 0108 // language spec
#pragma warning disable 0108
public static Vertex operator *(Vertex v, Quaternion q) public static Vertex operator *(Vertex v, Quaternion q)
{ {
Matrix4 tm = q.computeMatrix(); Matrix4 tm = q.computeMatrix();
@ -253,7 +254,7 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
v1.Z *= mul; v1.Z *= mul;
return v1; return v1;
} }
#pragma warning restore 0108 #pragma warning restore 0108
public float dot(Vertex v) public float dot(Vertex v)

View File

@ -127,27 +127,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// No unbound free variables, so we only filled one bag. If empty, bagof fails. // No unbound free variables, so we only filled one bag. If empty, bagof fails.
if (_findallBagArray.Count > 0) if (_findallBagArray.Count > 0)
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in bagArrayVariable.unify(_findallBagArray)) foreach (bool l1 in bagArrayVariable.unify(_findallBagArray))
yield return false; yield return false;
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }
else else
{ {
foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables) foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables)
{ {
// disable warning on l1 and l2, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key)) foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key))
{ {
foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value)) foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value))
yield return false; yield return false;
} }
#pragma warning restore 0168 #pragma warning restore 0168
// Debug: Should we free memory of the answers already returned? // Debug: Should we free memory of the answers already returned?
} }
} }
@ -161,15 +161,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public IEnumerable<bool> result(object Bag) public IEnumerable<bool> result(object Bag)
{ {
Variable bagArrayVariable = new Variable(); Variable bagArrayVariable = new Variable();
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in resultArray(bagArrayVariable)) foreach (bool l1 in resultArray(bagArrayVariable))
{ {
foreach (bool l2 in YP.unify(Bag, ListPair.make((List<object>)bagArrayVariable.getValue()))) foreach (bool l2 in YP.unify(Bag, ListPair.make((List<object>)bagArrayVariable.getValue())))
yield return false; yield return false;
} }
#pragma warning restore 0168 #pragma warning restore 0168
} }
/// <summary> /// <summary>
@ -181,9 +181,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public IEnumerable<bool> resultSet(object Bag) public IEnumerable<bool> resultSet(object Bag)
{ {
Variable bagArrayVariable = new Variable(); Variable bagArrayVariable = new Variable();
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in resultArray(bagArrayVariable)) foreach (bool l1 in resultArray(bagArrayVariable))
{ {
List<object> bagArray = (List<object>)bagArrayVariable.getValue(); List<object> bagArray = (List<object>)bagArrayVariable.getValue();
@ -191,19 +191,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray))) foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray)))
yield return false; yield return false;
} }
#pragma warning restore 0168 #pragma warning restore 0168
} }
public static IEnumerable<bool> bagofArray public static IEnumerable<bool> bagofArray
(object Template, object Goal, IEnumerable<bool> goalIterator, Variable bagArrayVariable) (object Template, object Goal, IEnumerable<bool> goalIterator, Variable bagArrayVariable)
{ {
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in goalIterator) foreach (bool l1 in goalIterator)
bagOfAnswers.add(); bagOfAnswers.add();
#pragma warning restore 0168 #pragma warning restore 0168
return bagOfAnswers.resultArray(bagArrayVariable); return bagOfAnswers.resultArray(bagArrayVariable);
} }
@ -211,12 +211,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable<bool> goalIterator, object Bag) (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
{ {
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in goalIterator) foreach (bool l1 in goalIterator)
bagOfAnswers.add(); bagOfAnswers.add();
#pragma warning restore 0168 #pragma warning restore 0168
return bagOfAnswers.result(Bag); return bagOfAnswers.result(Bag);
} }
@ -224,12 +224,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable<bool> goalIterator, object Bag) (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
{ {
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal); BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in goalIterator) foreach (bool l1 in goalIterator)
bagOfAnswers.add(); bagOfAnswers.add();
#pragma warning restore 0168 #pragma warning restore 0168
return bagOfAnswers.resultSet(Bag); return bagOfAnswers.resultSet(Bag);
} }

View File

@ -59,25 +59,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor2 argFunctor = (Functor2)arg; Functor2 argFunctor = (Functor2)arg;
if (_name.Equals(argFunctor._name)) if (_name.Equals(argFunctor._name))
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
{ {
foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2)) foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
yield return false; yield return false;
} }
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }
else if (arg is Variable) else if (arg is Variable)
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this)) foreach (bool l1 in ((Variable)arg).unify(this))
yield return false; yield return false;
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }

View File

@ -61,9 +61,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor3 argFunctor = (Functor3)arg; Functor3 argFunctor = (Functor3)arg;
if (_name.Equals(argFunctor._name)) if (_name.Equals(argFunctor._name))
{ {
// disable warning on l1, l2, l3 don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1)) foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
{ {
foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2)) foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
@ -72,17 +72,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false; yield return false;
} }
} }
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }
else if (arg is Variable) else if (arg is Variable)
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this)) foreach (bool l1 in ((Variable)arg).unify(this))
yield return false; yield return false;
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }

View File

@ -44,9 +44,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false; yield return false;
} }
// disable warning about unused variables: the following code // disable warning: don't see how we can code this differently short
// is infested with it. // of rewriting the whole thing
#pragma warning disable 0168, 0219 #pragma warning disable 0168, 0219
// Debug: Hand-modify this central predicate to do tail recursion. // Debug: Hand-modify this central predicate to do tail recursion.
public static IEnumerable<bool> read_tokens(object arg1, object arg2, object arg3) public static IEnumerable<bool> 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
} }
} }

View File

@ -92,12 +92,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
} }
else else
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(this, arg)) foreach (bool l1 in YP.unify(this, arg))
yield return false; yield return false;
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }

View File

@ -572,9 +572,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Name = new Variable(); Variable Name = new Variable();
Variable ArgList = new Variable(); Variable ArgList = new Variable();
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in new ListPair(Name, ArgList).unify(List)) foreach (bool l1 in new ListPair(Name, ArgList).unify(List))
{ {
object[] args = ListPair.toArray(ArgList); 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)); return YP.unify(Term, Functor.make((Atom)YP.getValue(Name), args));
} }
#pragma warning restore 0168 #pragma warning restore 0168
return YP.fail(); return YP.fail();
} }
@ -601,15 +601,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (!(Term is Variable)) if (!(Term is Variable))
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term))) foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term)))
{ {
foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length)) foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length))
yield return false; yield return false;
} }
#pragma warning restore 0168 #pragma warning restore 0168
} }
else else
throw new NotImplementedException("Debug: must finish functor/3"); throw new NotImplementedException("Debug: must finish functor/3");
@ -629,12 +629,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (argNumberInt >= 1 && argNumberInt <= termArgs.Length) if (argNumberInt >= 1 && argNumberInt <= termArgs.Length)
{ {
// The first ArgNumber is at 1, not 0. // The first ArgNumber is at 1, not 0.
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1])) foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1]))
yield return false; 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 }; object[] args = new object[] { Priority, Specifier, Operator };
foreach (object[] answer in _operatorTable) foreach (object[] answer in _operatorTable)
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unifyArrays(args, answer)) foreach (bool l1 in YP.unifyArrays(args, answer))
yield return false; 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); int afterInt = atomAtom._name.Length - (beforeInt + lengthInt);
if (afterInt >= 0) if (afterInt >= 0)
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(After, afterInt)) foreach (bool l1 in YP.unify(After, afterInt))
{ {
foreach (bool l2 in YP.unify foreach (bool l2 in YP.unify
(Sub_atom, Atom.a(atomAtom._name.Substring(beforeInt, lengthInt)))) (Sub_atom, Atom.a(atomAtom._name.Substring(beforeInt, lengthInt))))
yield return false; 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)) if (arity == 2 && (name == Atom.a(",") || name == Atom.a(";") || name == Atom.DOT))
return false; return false;
// Use the same mapping to static predicates in YP as the compiler. // Use the same mapping to static predicates in YP as the compiler.
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable())) foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable()))
return false; return false;
// Debug: Do we need to check if name._module is null? // Debug: Do we need to check if name._module is null?
#pragma warning restore 0168 #pragma warning restore 0168
return true; return true;
} }
@ -1366,13 +1366,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
foreach (NameArity key in _predicatesStore.Keys) foreach (NameArity key in _predicatesStore.Keys)
{ {
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify foreach (bool l1 in YP.unify
(new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity)) (new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity))
yield return false; yield return false;
#pragma warning restore 0168 #pragma warning restore 0168
} }
} }
@ -1628,15 +1628,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (_exception != null) if (_exception != null)
{ {
bool didUnify = false; bool didUnify = false;
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in YP.unify(_exception._term, Catcher)) foreach (bool l1 in YP.unify(_exception._term, Catcher))
{ {
didUnify = true; didUnify = true;
yield return false; yield return false;
} }
#pragma warning restore 0168 #pragma warning restore 0168
if (!didUnify) if (!didUnify)
throw _exception; throw _exception;

View File

@ -209,9 +209,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object[] functorArgs = YP.getFunctorArgs(Term); object[] functorArgs = YP.getFunctorArgs(Term);
Variable pred = new Variable(); Variable pred = new Variable();
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in ((CompilerState)State)._pred.match foreach (bool l1 in ((CompilerState)State)._pred.match
(new object[] { functorName, functorArgs.Length, pred, Atom.a("det") })) (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") }))
{ {
@ -220,7 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return true; return true;
} }
} }
#pragma warning restore 0168 #pragma warning restore 0168
return false; return false;
} }
@ -232,9 +232,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object[] functorArgs = YP.getFunctorArgs(Term); object[] functorArgs = YP.getFunctorArgs(Term);
Variable pred = new Variable(); Variable pred = new Variable();
// disable warning on l1, don't see how we can // disable warning: don't see how we can code this differently short
// code this differently // of rewriting the whole thing
#pragma warning disable 0168 #pragma warning disable 0168
foreach (bool l1 in ((CompilerState)State)._pred.match foreach (bool l1 in ((CompilerState)State)._pred.match
(new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") })) (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") }))
{ {
@ -243,7 +243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return true; return true;
} }
} }
#pragma warning restore 0168 #pragma warning restore 0168
return false; return false;
} }
@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// disable warning unused variables, the following code is // disable warning unused variables, the following code is
// infested with it. // infested with it.
#pragma warning disable 0168, 0219 #pragma warning disable 0168, 0219
/// <summary> /// <summary>
/// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction

View File

@ -69,9 +69,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
YP.tell(myCS_SW); YP.tell(myCS_SW);
//Console.WriteLine("Mycode\n ===================================\n" + myCode+"\n"); //Console.WriteLine("Mycode\n ===================================\n" + myCode+"\n");
// disable warning on l1, don't see how we can
// code this differently // disable warning: don't see how we can code this differently short
#pragma warning disable 0168 // of rewriting the whole thing
#pragma warning disable 0168
foreach (bool l1 in Parser.parseInput(TermList)) foreach (bool l1 in Parser.parseInput(TermList))
{ {
foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode)) foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode))
@ -84,7 +85,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
//YPCompiler.convertStringCodesCSharp(VFC); //YPCompiler.convertStringCodesCSharp(VFC);
} }
} }
#pragma warning restore 0168 #pragma warning restore 0168
YP.seen(); YP.seen();
myCS_SW.Close(); myCS_SW.Close();
YP.told(); YP.told();

View File

@ -59,6 +59,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private Scene m_Scene; private Scene m_Scene;
private IConfig m_ScriptConfig; private IConfig m_ScriptConfig;
private Compiler m_Compiler; 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 #pragma warning disable 414
private EventManager m_EventManager; private EventManager m_EventManager;
#pragma warning restore 414 #pragma warning restore 414