/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/ScriptEngine/Machine/Core.cs
214 строк
4 KB
Andrei Ovsiankin
Удалены старые dto сериализации модуля
09 май 2024, 11:00
09 май 2024, 11:00
8dc8448
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; namespace ScriptEngine.Machine { [Serializable] public enum OperationCode { Nop, PushVar, PushConst, PushLoc, PushRef, LoadVar, LoadLoc, AssignRef, Add, Sub, Mul, Div, Mod, Neg, Equals, Less, Greater, LessOrEqual, GreaterOrEqual, NotEqual, Not, And, Or, CallFunc, CallProc, ArgNum, PushDefaultArg, ResolveProp, ResolveMethodProc, ResolveMethodFunc, Jmp, JmpFalse, PushIndexed, Return, JmpCounter, Inc, NewInstance, NewFunc, PushIterator, IteratorNext, StopIterator, BeginTry, EndTry, RaiseException, LineNum, MakeRawValue, MakeBool, PushTmp, PopTmp, Execute, AddHandler, RemoveHandler, ExitTry, // built-in functions Eval, Bool, Number, Str, Date, Type, ValType, StrLen, TrimL, TrimR, TrimLR, Left, Right, Mid, StrPos, UCase, LCase, TCase, Chr, ChrCode, EmptyStr, StrReplace, StrGetLine, StrLineCount, StrEntryCount, Year, Month, Day, Hour, Minute, Second, BegOfWeek, BegOfYear, BegOfMonth, BegOfDay, BegOfHour, BegOfMinute, BegOfQuarter, EndOfWeek, EndOfYear, EndOfMonth, EndOfDay, EndOfHour, EndOfMinute, EndOfQuarter, WeekOfYear, DayOfYear, DayOfWeek, AddMonth, CurrentDate, Integer, Round, Log, Log10, Sin, Cos, Tan, ASin, ACos, ATan, Exp, Pow, Sqrt, Min, Max, Format, ExceptionInfo, ExceptionDescr, ModuleInfo } [Serializable] public struct Command { public OperationCode Code; public int Argument; public override string ToString() { return Enum.GetName(typeof(OperationCode), Code) + ":" + Argument.ToString(); } } [Serializable] public enum DataType { Undefined, String, Number, Date, Boolean, Null } [Serializable] public struct ConstDefinition : IEquatable<ConstDefinition> { public DataType Type; public string Presentation; public override string ToString() { return Enum.GetName(typeof(DataType), Type) + ":" + Presentation; } public bool Equals(ConstDefinition other) { return Type == other.Type && string.Equals(Presentation, other.Presentation, StringComparison.Ordinal); } } [Serializable] public struct AnnotationDefinition { public string Name; public AnnotationParameter[] Parameters; public int ParamCount => Parameters?.Length ?? 0; } [Serializable] public struct AnnotationParameter { public string Name; public int ValueIndex; [NonSerialized] public IValue RuntimeValue; public const int UNDEFINED_VALUE_INDEX = -1; public override string ToString() { if (string.IsNullOrEmpty(Name)) { return string.Format("[{0}]", ValueIndex); } if (ValueIndex == UNDEFINED_VALUE_INDEX) { return Name; } return String.Format("{0}=[{1}]", Name, ValueIndex); } } }