Exemple #1
0
    public CFibre(CFibreScript Script, CFibreReg FunctionReg, int ArgCount, CFibreRegStore Data, CFibreRegStore Global, CFibreRegStore Local, List <CFibreVM.InteropFuncDelegate> InteropFuncs)
    {
        mScript   = Script;
        mFramePtr = 0;

        mData         = Data;
        mGlobal       = Global;
        mLocal        = Local;
        mInteropFuncs = InteropFuncs;
        mStores       = new CFibreRegStore[] { Data, Global, Local };

        mCallFrames = new Stack <CFibreCallFrame>();

        if (FunctionReg == null)
        {
            mInstructionPtr = 0;
            mCallFrames.Push(new CFibreCallFrame(mInstructionPtr, 0, 0));
        }
        else
        {
            if (FunctionReg.mID < -1)
            {
                int funcIndex = -FunctionReg.mID - 10;
                mInteropFuncs[funcIndex](this, 0);
            }
            else
            {
                mInstructionPtr = FunctionReg.mID;
                mCallFrames.Push(new CFibreCallFrame(mInstructionPtr, 0, ArgCount));
            }
        }
    }
Exemple #2
0
 public CFibreVM()
 {
     _script = new CFibreScript();
     _script.Init();
     PushInteropFunction("log", Log);
 }