From 6ef9d4da901a346c232458317cca6268da888e2e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 18 Aug 2008 00:39:10 +0000 Subject: Formatting cleanup. --- .../Compiler/YieldProlog/IndexedAnswers.cs | 2 +- .../Compiler/YieldProlog/PrologException.cs | 28 ++++---- .../DotNetEngine/Compiler/YieldProlog/YP.cs | 74 +++++++++++----------- 3 files changed, 52 insertions(+), 52 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs index 999208d..415c646 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/IndexedAnswers.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog { _arity = arity; } - + /// /// 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 diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs index 9a1f00d..56ed719 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/PrologException.cs @@ -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. /// /// the error term of the error - /// the message term of the error. If this is a string, it is converted to an + /// 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. /// @@ -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 /// 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; } /// - /// 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. /// /// diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs index b69f9c4..694e733 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/YP.cs @@ -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 /// /// 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). /// @@ -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 /// /// 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). /// @@ -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 } /// - /// 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()); 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()); clauses.Add(indexedAnswers = new IndexedAnswers(values.Length)); } @@ -1855,7 +1855,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog { List 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 } /// - /// 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. . /// @@ -1917,7 +1917,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog } /// - /// 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. /// /// @@ -2066,7 +2066,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog /// dynamic predicate. /// /// - /// if not null, used to resolve references to the default + /// if not null, used to resolve references to the default /// module Atom.a("") /// public static IEnumerable 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 } /// - /// 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. /// /// - /// if not null, used to resolve references to the default + /// if not null, used to resolve references to the default /// module Atom.a("") /// public static IEnumerable 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 } } - + /// /// 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 /// 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))) -- cgit v1.1