예제 #1
0
        private void exec_ret(NakoILCode code)
        {
            autoIncPos = false;
            NakoCallStack c = callStack.Pop();

            this.runpos = c.nextpos;
            if (((bool)code.value) == false)
            {
                globalVar.SetValue(0, c.sore);                // "それ"を関数実行前に戻す
            }
            this.localVar = c.localVar;
        }
예제 #2
0
        private void exec_usrcall(NakoILCode code)
        {
            NakoCallStack c = new NakoCallStack();

            c.localVar    = localVar;
            c.nextpos     = runpos + 1;
            c.sore        = globalVar.GetValue(0);
            this.localVar = new NakoVariableManager(NakoVariableScope.Local);
            callStack.Push(c);
            // JUMP
            autoIncPos = false;
            runpos     = Convert.ToInt32((long)code.value);
        }
예제 #3
0
        /// <summary>
        /// Callback the specified sender, func_name and args.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="func_name">Func name.</param>
        /// <param name="args">Arguments.</param>
        public void CallUserFunc(string func_name, params object[] args)
        {
            NakoILCode c = null;

            foreach (NakoILCode tmp in this.list)
            {
                if (tmp.type == NakoILType.NOP && (string)tmp.value == "FUNC_" + func_name)
                {
                    c = tmp;
                    break;
                }
            }
            if (c == null)
            {
                return;// _nop;
            }
            currentIL = c;
            //StackPush (sender);
            foreach (object o in args)
            {
                StackPush(o);
            }
            NakoCallStack stack = new NakoCallStack();
            //escape
            int    currentPos        = runpos;
            bool   currentAutoIncPos = autoIncPos;
            object currentSore       = globalVar.GetValue(0);

            stack.localVar = localVar;
            stack.nextpos  = list.Count + 1; // ストッパー
            stack.sore     = globalVar.GetValue(0);
            //prepare
            this.localVar = new NakoVariableManager(NakoVariableScope.Local);
            autoIncPos    = true;
            runpos        = this.list.IndexOf(currentIL);
            callStack.Push(stack);
            //int baseStackCount=callStack.Count;
            _run();
            runpos     = currentPos;
            autoIncPos = currentAutoIncPos;
            globalVar.SetValue(0, currentSore);
        }
예제 #4
0
 private void exec_usrcall(NakoILCode code)
 {
     NakoCallStack c = new NakoCallStack();
     c.localVar = localVar;
     c.nextpos = runpos + 1;
     c.sore = globalVar.GetValue(0);
     this.localVar = new NakoVariableManager(NakoVariableScope.Local);
     callStack.Push(c);
     // JUMP
     autoIncPos = false;
     runpos = Convert.ToInt32((long)code.value);
 }