Пример #1
0
 /// <summary>
 /// Initialize try-panic environment
 /// </summary>
 /// <param name="args">Instruction index of relative OnPanic statement</param>
 public static void Try(object args)
 {
     if (BasePanic.TryScopeTarget != null)
     {
         BasePanic.Throw("Can not initialize try environment in the scope of another try environment", 14, "PreRuntime");
     }
     BasePanic.TryScopeTarget = (int)args;
 }
Пример #2
0
 /// <summary>
 /// Initialize try-panic environment
 /// </summary>
 /// <param name="args">Label name of relative OnPanic statement</param>
 public static void TryLabel(object args)
 {
     if (BasePanic.TryScopeTarget != null)
     {
         BasePanic.Throw("Can not initialize try environment in the scope of another try environment", 7, "PreRuntime");
     }
     BasePanic.TryScopeTarget = CurrentFunctionPointer.FindLabel((string)args);
 }
Пример #3
0
        public static void ExecuteLabel(this Function function, string trail)
        {
            var x1 = Runtime.ProgramCounter;

            BasePanic.LoadTrail(trail);
            Runtime.Stack.TransferToArguments(ref function);
            var x3 = Runtime.Stack;

            Runtime.Stack = new RStack(1000);
            Runtime.CurrentFunctionPointer = function;
            if (Runtime.StorageManager != 0)
            {
                var x2 = Runtime.StorageManager;
                var x0 = Runtime.Storage;
                Runtime.Storage = new object[byte.MaxValue];

                for (Runtime.ProgramCounter = 0, Runtime.StorageManager = 0; Runtime.ProgramCounter < function.Instructions.Length; Runtime.ProgramCounter++)
                {
                    function.Instructions[Runtime.ProgramCounter].FunctionPointer(function.Instructions[Runtime.ProgramCounter].Argument);
                }

                Runtime.Storage        = x0;
                Runtime.StorageManager = x2;
            }
            else
            {
                for (Runtime.ProgramCounter = 0, Runtime.StorageManager = 0; Runtime.ProgramCounter < function.Instructions.Length; Runtime.ProgramCounter++)
                {
                    function.Instructions[Runtime.ProgramCounter].FunctionPointer(function.Instructions[Runtime.ProgramCounter].Argument);
                }

                if (Runtime.StorageManager != 0)
                {
                    Array.Clear(Runtime.Storage, byte.MinValue, byte.MaxValue);
                }
            }
            Runtime.Stack = x3;
            BasePanic.UnloadTrail();
            Runtime.ProgramCounter = x1;
        }
Пример #4
0
 /// <summary>
 /// Throws a new exception with a string parameter as message
 /// </summary>
 /// <param name="args"></param>
 public static void RvmThrow(object args)
 {
     BasePanic.Throw(Stack.Pop().Cast <CacheTable>());
 }