mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
Formatting cleanup.
This commit is contained in:
@@ -355,8 +355,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
|
||||
private static string CreateYPCompilerScript(string compileScript)
|
||||
{
|
||||
|
||||
|
||||
compileScript = String.Empty +
|
||||
"using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " +
|
||||
"using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
myCode = myCode.Substring(0, cs_pointer);
|
||||
}
|
||||
myCode.Replace("//yp", "%YPCode");
|
||||
|
||||
|
||||
StringWriter myCS_SW = new StringWriter();
|
||||
StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n");
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
{
|
||||
_arity = arity;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Append the answer to the list and update the indexes, if any.
|
||||
/// Elements of answer must be ground, since arguments with unbound variables make this
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008, Jeff Thompson
|
||||
*
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* * Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
/// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding.
|
||||
/// </summary>
|
||||
/// <param name="ErrorTerm">the error term of the error</param>
|
||||
/// <param name="Messsage">the message term of the error. If this is a string, it is converted to an
|
||||
/// <param name="Messsage">the message term of the error. If this is a string, it is converted to an
|
||||
/// Atom so it can be used by Prolog code.
|
||||
/// Message, converted to a string, is use as the printable exception message.
|
||||
/// </param>
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
_term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore());
|
||||
}
|
||||
|
||||
public class TypeErrorInfo
|
||||
public class TypeErrorInfo
|
||||
{
|
||||
public readonly Atom _Type;
|
||||
public readonly object _Culprit;
|
||||
@@ -116,14 +116,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
/// <returns></returns>
|
||||
public object getProcedureName()
|
||||
{
|
||||
if (!(_Type._name == "procedure" &&
|
||||
if (!(_Type._name == "procedure" &&
|
||||
_Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH))
|
||||
return null;
|
||||
return ((Functor2)_Culprit)._arg1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity.
|
||||
/// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity.
|
||||
/// Otherwise return -1.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008, Jeff Thompson
|
||||
*
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* * Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
/// <summary>
|
||||
/// Convert term to an int.
|
||||
/// If term is a single-element List, use its first element
|
||||
/// (to handle the char types like "a").
|
||||
/// (to handle the char types like "a").
|
||||
/// If can't convert, throw a PrologException for type_error evaluable (because this is only
|
||||
/// called from arithmetic functions).
|
||||
/// </summary>
|
||||
@@ -172,8 +172,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
{
|
||||
throw new PrologException
|
||||
(new Functor2
|
||||
("type_error", Atom.a("evaluable"),
|
||||
new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)),
|
||||
("type_error", Atom.a("evaluable"),
|
||||
new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)),
|
||||
"Term must be an integer");
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
/// <summary>
|
||||
/// Convert term to a double. This may convert an int to a double, etc.
|
||||
/// If term is a single-element List, use its first element
|
||||
/// (to handle the char types like "a").
|
||||
/// (to handle the char types like "a").
|
||||
/// If can't convert, throw a PrologException for type_error evaluable (because this is only
|
||||
/// called from arithmetic functions).
|
||||
/// </summary>
|
||||
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
// Assume it is a char type like "a".
|
||||
term = YP.getValue(((Functor2)term)._arg1);
|
||||
if (term is Variable)
|
||||
throw new PrologException(Atom.a("instantiation_error"),
|
||||
throw new PrologException(Atom.a("instantiation_error"),
|
||||
"Expected a number but the argument is an unbound variable");
|
||||
|
||||
try
|
||||
@@ -776,8 +776,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
if (term1TypeCode == -2)
|
||||
{
|
||||
// Variable.
|
||||
// We always check for equality first because we want to be sure
|
||||
// that less than returns false if the terms are equal, in
|
||||
// We always check for equality first because we want to be sure
|
||||
// that less than returns false if the terms are equal, in
|
||||
// case that the less than check really behaves like less than or equal.
|
||||
if ((Variable)Term1 != (Variable)Term2)
|
||||
// The hash code should be unique to a Variable object.
|
||||
@@ -820,8 +820,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type code is -2 if term is a Variable, 0 if it is an Atom,
|
||||
/// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3,
|
||||
/// Type code is -2 if term is a Variable, 0 if it is an Atom,
|
||||
/// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3,
|
||||
/// 4 if it is Functor.
|
||||
/// Otherwise, type code is -1.
|
||||
/// This does not call YP.getValue(term).
|
||||
@@ -1167,7 +1167,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
"Arg 2 List has an element which is an unbound variable");
|
||||
if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1))
|
||||
throw new PrologException
|
||||
(new Functor2("type_error", Atom.a("character"), listAtom),
|
||||
(new Functor2("type_error", Atom.a("character"), listAtom),
|
||||
"Arg 2 List has an element which is not a one character atom");
|
||||
charArray[i] = ((Atom)listAtom)._name[0];
|
||||
}
|
||||
@@ -1209,7 +1209,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
int codeInt;
|
||||
if (!getInt(codeArray[i], out codeInt) || codeInt < 0)
|
||||
throw new PrologException
|
||||
(new Functor1("representation_error", Atom.a("character_code")),
|
||||
(new Functor1("representation_error", Atom.a("character_code")),
|
||||
"Element of Arg 2 List is not a character code");
|
||||
charArray[i] = (char)codeInt;
|
||||
}
|
||||
@@ -1323,7 +1323,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
{
|
||||
if (!YP.number(Number))
|
||||
throw new PrologException
|
||||
(new Functor2("type_error", Atom.a("number"), Number),
|
||||
(new Functor2("type_error", Atom.a("number"), Number),
|
||||
"Arg 1 Number is not var or number");
|
||||
// We just checked, so convertDouble shouldn't throw an exception.
|
||||
numberString = YP.doubleToString(YP.convertDouble(Number));
|
||||
@@ -1413,7 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
{
|
||||
if (!(Char is Atom) || ((Atom)Char)._name.Length != 1)
|
||||
throw new PrologException
|
||||
(new Functor2("type_error", Atom.a("character"), Char),
|
||||
(new Functor2("type_error", Atom.a("character"), Char),
|
||||
"Arg 1 Char is not var or one-character atom");
|
||||
|
||||
if (Code is Variable)
|
||||
@@ -1795,7 +1795,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
IndexedAnswers indexedAnswers;
|
||||
if (!_predicatesStore.TryGetValue(nameArity, out clauses))
|
||||
{
|
||||
// Create an IndexedAnswers as the only clause of the predicate.
|
||||
// Create an IndexedAnswers as the only clause of the predicate.
|
||||
_predicatesStore[nameArity] = (clauses = new List<IClause>());
|
||||
clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
|
||||
}
|
||||
@@ -1826,7 +1826,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
IndexedAnswers indexedAnswers;
|
||||
if (!_predicatesStore.TryGetValue(nameArity, out clauses))
|
||||
{
|
||||
// Create an IndexedAnswers as the only clause of the predicate.
|
||||
// Create an IndexedAnswers as the only clause of the predicate.
|
||||
_predicatesStore[nameArity] = (clauses = new List<IClause>());
|
||||
clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
|
||||
}
|
||||
@@ -1855,7 +1855,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
{
|
||||
List<IClause> clauses;
|
||||
if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses))
|
||||
return unknownPredicate(name, arguments.Length,
|
||||
return unknownPredicate(name, arguments.Length,
|
||||
"Undefined dynamic predicate: " + name + "/" + arguments.Length);
|
||||
|
||||
if (clauses.Count == 1)
|
||||
@@ -1889,7 +1889,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If _prologFlags["unknown"] is fail then return fail(), else if
|
||||
/// If _prologFlags["unknown"] is fail then return fail(), else if
|
||||
/// _prologFlags["unknown"] is warning then write the message to YP.write and
|
||||
/// return fail(), else throw a PrologException for existence_error. .
|
||||
/// </summary>
|
||||
@@ -1917,7 +1917,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is deprecated and just calls matchDynamic. This matches all clauses,
|
||||
/// This is deprecated and just calls matchDynamic. This matches all clauses,
|
||||
/// not just the ones defined with assertFact.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
@@ -2066,7 +2066,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
/// dynamic predicate.
|
||||
/// </summary>
|
||||
/// <param name="NameSlashArity"></param>
|
||||
/// <param name="declaringClass">if not null, used to resolve references to the default
|
||||
/// <param name="declaringClass">if not null, used to resolve references to the default
|
||||
/// module Atom.a("")</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass)
|
||||
@@ -2078,7 +2078,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
Functor2 NameArityFunctor = NameSlashArity as Functor2;
|
||||
if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH))
|
||||
throw new PrologException
|
||||
(new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
|
||||
(new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
|
||||
"Must be a name/arity predicate indicator");
|
||||
object name = YP.getValue(NameArityFunctor._arg1);
|
||||
object arity = YP.getValue(NameArityFunctor._arg2);
|
||||
@@ -2163,12 +2163,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from
|
||||
/// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from
|
||||
/// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error.
|
||||
/// Otherwise, compile the goal as a single clause predicate and invoke it.
|
||||
/// Otherwise, compile the goal as a single clause predicate and invoke it.
|
||||
/// </summary>
|
||||
/// <param name="Goal"></param>
|
||||
/// <param name="declaringClass">if not null, used to resolve references to the default
|
||||
/// <param name="declaringClass">if not null, used to resolve references to the default
|
||||
/// module Atom.a("")</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<bool> getIterator(object Goal, Type declaringClass)
|
||||
@@ -2259,7 +2259,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
(new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom");
|
||||
if (!_prologFlags.ContainsKey(((Atom)Key)._name))
|
||||
throw new PrologException
|
||||
(new Functor2("domain_error", Atom.a("prolog_flag"), Key),
|
||||
(new Functor2("domain_error", Atom.a("prolog_flag"), Key),
|
||||
"Arg 1 Key is not a recognized flag");
|
||||
|
||||
foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name]))
|
||||
@@ -2343,7 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
string results = "";
|
||||
for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch())
|
||||
{
|
||||
//Console.WriteLine( m );
|
||||
//Console.WriteLine( m );
|
||||
results += presep+ m + postsep;
|
||||
}
|
||||
return results;
|
||||
@@ -2662,7 +2662,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
#pragma warning restore 0168
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// CodeListReader extends TextReader and overrides Read to read the next code from
|
||||
/// the CodeList which is a Prolog list of integer character codes.
|
||||
@@ -2683,7 +2683,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog
|
||||
/// <returns></returns>
|
||||
public override int Read()
|
||||
{
|
||||
Functor2 CodeListPair = _CodeList as Functor2;
|
||||
Functor2 CodeListPair = _CodeList as Functor2;
|
||||
int code;
|
||||
if (!(CodeListPair != null && CodeListPair._name == Atom.DOT &&
|
||||
getInt(CodeListPair._arg1, out code)))
|
||||
|
||||
@@ -39,13 +39,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
public class ScriptManager : Common.ScriptEngineBase.ScriptManager
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine)
|
||||
: base(scriptEngine)
|
||||
{
|
||||
base.m_scriptEngine = scriptEngine;
|
||||
}
|
||||
private Compiler.LSL.Compiler LSLCompiler;
|
||||
private Compiler.LSL.Compiler LSLCompiler;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
|
||||
"[{0}]: ScriptManager StartScript: localID: {1}, itemID: {2}",
|
||||
m_scriptEngine.ScriptEngineName, localID, itemID);
|
||||
|
||||
//IScriptHost root = host.GetRoot();
|
||||
@@ -73,13 +73,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
string CompiledScriptFile = String.Empty;
|
||||
|
||||
SceneObjectPart m_host = World.GetSceneObjectPart(localID);
|
||||
|
||||
|
||||
if (null == m_host)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[{0}]: Could not find scene object part corresponding to localID {1} to start script",
|
||||
"[{0}]: Could not find scene object part corresponding to localID {1} to start script",
|
||||
m_scriptEngine.ScriptEngineName, localID);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user