예제 #1
0
 public RTSInnerFunction(IRTSType returnType, RTSList <IRTSLinker> arg, IRTSLinker body)
 {
     mLimitArg   = true;
     mArg        = arg;
     mBody       = body;
     mReturnType = returnType;
 }
예제 #2
0
 public RTSFuncR(IRTSType castType, string funcName, RTSList <IRTSRunner> args)
 {
     mFuncName = funcName;
     mArgs     = args;
     mArgC     = args == null ? 0 : args.length();
     mCast     = castType;
 }
예제 #3
0
 override public bool appendLeftChild(IRTSLinker linker)
 {
     if (linker.getId() == IRTSDefine.Linker.BRACKET)
     {
         IRTSType ctp = ((RTSBracketL)linker).getCastType();
         mCastType = ctp;
         return(ctp != null);
     }
     else if (linker.getId() == IRTSDefine.Linker.PROPERTY)
     {
         mProperty |= ((RTSPropertyL)linker).getProperty();
         return(true);
     }
     else if (linker.getId() == IRTSDefine.Linker.TYPE)
     {
         mProperty |= IRTSDefine.Property.DECALRE;
         mCastType  = ((RTSTypeL)linker).getRTSType();
         linker.setSuper(this);
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #4
0
 public RTSFuncListR(IRTSType castType, string[] funcNames, int argc, object[] args)
 {
     mFuncNames = funcNames;
     mArgC      = argc;
     mArgs      = args;
     mCast      = castType;
 }
        public IRTSDefine.Stack run(IRTSStack stack)
        {
            if (!mVarLoaded)
            {
                mVarLoaded = true;
                if (stack.getThread().loadRunner(mVar))
                {
                    return(0);
                }
            }
            object   obj = mVar.getOutput();
            IRTSType tp  = stack.getThread().getEngine().getRTSType(obj == null ? null : obj.GetType());
            object   newObj;

            if (mOperId == IRTSDefine.Linker.SELFADD)
            {
                newObj = tp.add(obj, 1);
            }
            else if (mOperId == IRTSDefine.Linker.SELFSUB)
            {
                newObj = tp.sub(obj, 1);
            }
            else
            {
                newObj = null;
            }
            mVar.evaluate(stack, newObj);
            mValue = mLeft ? obj : newObj;
            return(0);
        }
예제 #6
0
        override protected void onFinalRun(IRTSStack stack, object left, object right)
        {
            object   t  = left != null ? left : right;
            IRTSType tp = stack.getThread().getEngine().getRTSType(t == null ? null : t.GetType());

            mValue = tp.xor(left, right);
        }
예제 #7
0
 public RTSInnerFunction(IRTSLinker body)
 {
     mLimitArg   = false;
     mReturnType = null;
     mArg        = null;
     mBody       = body;
 }
예제 #8
0
        public RTSInnerFuncR(object[] args, IRTSFunction func)
        {
            mArgs       = args;
            mReturnType = func.returnType();
            mFunc       = func;
            IRTSLinker body = func.getBody();

            mBody = body == null ? null : body.createRunner();
        }
예제 #9
0
 public override bool appendLeftChild(IRTSLinker linker)
 {
     if (linker.getId() == IRTSDefine.Linker.BRACKET)
     {
         IRTSType ctp = ((RTSBracketL)linker).getCastType();
         mCastType = ctp;
         return(ctp != null);
     }
     return(false);
 }
 override public bool appendLeftChild(IRTSLinker linker)
 {
     if (linker.getId() == IRTSDefine.Linker.BRACKET)
     {
         mCastType = ((RTSBracketL)linker).getCastType();
         return(mCastType != null);
     }
     else
     {
         return(false);
     }
 }
        public bool evaluate(IRTSStack stack, object value)
        {
            object domain = mLeftR == null ? null : mLeftR.getOutput();

            if (domain == null)
            {
                return(false);
            }
            IRTSType tp = stack.getThread().getEngine().getRTSType(domain.GetType());

            mValue = tp.setProperty(stack.getThread().getEngine(), domain, mDomain, value);
            return(true);
        }
        override protected void onFinalRun(IRTSStack stack, object left, object right)
        {
            IRTSType tp = null;
            object   t  = left != null ? left : right;

            if (t != null)
            {
                tp = stack.getThread().getEngine().getRTSType(t.GetType());
            }
            if (tp == null)
            {
                tp = org.vr.rts.modify.RTSGeneral.TYPE;
            }
            int cp = tp.rtsCompare(left, right);

            setFinalV(cp);
        }
예제 #13
0
        public void addType(System.Type t1, IRTSType type)
        {
            if (t1 == null || type == null)
            {
                return;
            }
            int index = mTypes.lenth();

            for (int i = index - 1; i >= 0; i--)
            {
                System.Type t2 = mTypes.keyAt(i);
                if (isInherited(t1, t2))
                {
                    index = i;
                }
            }
            mTypes.insertAt(index, t1, type);
        }
예제 #14
0
 public RTSTypeL(IRTSType type)
     : base(IRTSDefine.Linker.TYPE)
 {
     mType = type;
 }
 public IRTSDefine.Stack run(IRTSStack stack)
 {
     if (mLeftRun)
     {
         mLeftRun = false;
         mLeftR   = mLeftL.createRunner();
         if (stack.getThread().loadRunner(mLeftR))
         {
             return(0);
         }
     }
     while (mArgNum > mArgPtr)
     {
         IRTSRunner r = mArgs.get(mArgPtr++).createRunner();
         mArgRs.add(r);
         if (stack.getThread().loadRunner(r))
         {
             return(0);
         }
     }
     if (mInvokeFunc)
     {
         mInvokeFunc = false;
         object domain = mLeftR == null ? null : mLeftR.getOutput();
         if (domain == null)
         {
             return(0);
         }
         IRTSType tp = stack.getThread().getEngine().getRTSType(domain.GetType());
         if (!mAsFunction)
         {
             mValue  = tp.getProperty(stack.getThread().getEngine(), domain, mDomain);
             mOutput = mValue as IRTSRunner;
             if (stack.getThread().loadRunner(mOutput))
             {
                 return(0);
             }
         }
         else
         {
             object[] args = new object[mArgNum];
             for (int i = 0; i < mArgNum; i++)
             {
                 IRTSRunner r = mArgRs.get(i);
                 args[i] = r == null ? null : r.getOutput();
             }
             mValue  = tp.function(stack.getThread().getEngine(), domain, mDomain, args);
             mOutput = mValue as IRTSRunner;
             if (stack.getThread().loadRunner(mOutput))
             {
                 return(0);
             }
         }
     }
     if (mOutput != null)
     {
         mValue  = mOutput.getOutput();
         mOutput = mValue as IRTSRunner;
         if (stack.getThread().loadRunner(mOutput))
         {
             return(0);
         }
     }
     return(0);
 }
 public RTSFuncDefineR(IRTSType returnType, string funcName, RTSList <IRTSLinker> arg, IRTSLinker body)
 {
     mFunction = new RTSInnerFunction(returnType, arg, body);
     mFuncName = funcName;
 }
 public RTSPluginFuncR(IRTSType returnType, object[] args, IRTSPlugin plugin)
 {
     mArgs       = args;
     mReturnType = returnType;
     mPlugin     = plugin;
 }
 public RTSPluginFunc(IRTSType retType, RTSPluginDelegate dele, int argC)
 {
     mReturnType = retType;
     mTarget     = dele;
     mArgC       = argC;
 }
 public IRTSDefine.Stack run(IRTSStack stack)
 {
     if (!mVarLoaded)
     {
         mVarLoaded = true;
         mVarR      = mVar == null ? null : mVar.createRunner();
         if (stack.getThread().loadRunner(mVarR))
         {
             return(0);
         }
     }
     if (!mIndexLoaded)
     {
         mIndexLoaded = true;
         mIndexR      = mIndex == null ? null : mIndex.createRunner();
         if (stack.getThread().loadRunner(mIndexR))
         {
             return(0);
         }
     }
     while (mArray != null && mListCur < mArray.length())
     {
         IRTSLinker l = mArray.get(mListCur);
         mArrayR[mListCur] = l == null ? null : l.createRunner();
         if (stack.getThread().loadRunner(mArrayR[mListCur++]))
         {
             return(0);
         }
     }
     if (mArrayR != null)
     {
         //org.vr.rts.typedef.RTSarray arr = new org.vr.rts.typedef.RTSarray(mArrayR.Length);
         object[] arr = new object[mArrayR.Length];
         for (int i = 0; i < mArrayR.Length; i++)
         {
             object v = mArrayR[i] == null ? null : mArrayR[i].getOutput();
             //arr.set(i, v);
             arr[i] = v;
         }
         mValue = arr;
     }
     else if (mVarR == null)
     {
         mValue = new object[0];
     }
     else
     {
         object obj   = mVarR.getOutput();
         object index = mIndexR == null ? null : mIndexR.getOutput();
         if (obj == null)
         {
             mValue = null;
         }
         else if (index is string)
         {
             var      eng = stack.getThread().getEngine();
             IRTSType tp  = eng.getRTSType(obj.GetType());
             mValue = tp.getProperty(eng, obj, RTSString.stringOf(index));
         }
         else if (obj is System.Collections.IList)
         {
             int n = RTSInteger.valueOf(index);
             mValue = ((System.Collections.IList)obj)[n];
         }
         else
         {
             int n = RTSInteger.valueOf(index);
             mValue = n == 0 ? obj : null;
         }
         mOutput = mValue as IRTSRunner;
         if (stack.getThread().loadRunner(mOutput))
         {
             return(0);
         }
     }
     if (mOutput != null)
     {
         mValue  = mOutput.getOutput();
         mOutput = mValue as IRTSRunner;
         if (stack.getThread().loadRunner(mOutput))
         {
             return(0);
         }
     }
     return(0);
 }
예제 #20
0
 public RTSVariableR(IRTSType castType, object value)
 {
     mCast     = castType;
     mValue    = castType == null ? value : castType.castValue(value);
     mProperty = IRTSDefine.Property.CONST;
 }
예제 #21
0
 public RTSVariableR(IRTSDefine.Property property, IRTSType castType, string varName)
 {
     mVar      = varName;
     mCast     = castType;
     mProperty = property;
 }
예제 #22
0
 public RTSCastR(IRTSType castType, IRTSRunner child)
 {
     mCastType = castType;
     mChild    = child;
 }