Esempio n. 1
0
        public override int visitArrayExpression(CArrayExpression pArrExp, CSymbolTable pSymbolTable,
                                                 ref INTER_VARIANT pvar, RUL_TOKEN_SUBTYPE AssignType)
        {
            //try
            {
                int             i32Idx    = pArrExp.GetToken().GetSymbolTableIndex();
                CVariable       pVariable = pSymbolTable.GetAt(i32Idx);
                INTER_SAFEARRAY prgsa     = pVariable.GetValue().GetValue().prgsa;

                //evaluate the expressions...
                EXPR_VECTOR pvecExpressions = pArrExp.GetExpressions();
                List <int>  vecDims         = new List <int>();
                prgsa.GetDims(ref vecDims);

                if (vecDims.Count != pvecExpressions.Count)
                {
                    //throw (C_TC_ERROR_DIM_MISMATCH, pArrExp);
                }
                byte[] by;
                switch (prgsa.Type())
                {
                case VARIANT_TYPE.RUL_CHAR:
                    by = new byte[1];
                    //by[0] = ' ';
                    by[0] = 0;
                    pvar.SetValue(by, 0, prgsa.Type());
                    break;

                case VARIANT_TYPE.RUL_INT:
                    by = new byte[4];
                    by = BitConverter.GetBytes((int)0);
                    pvar.SetValue(by, 0, prgsa.Type());
                    break;

                case VARIANT_TYPE.RUL_BOOL:
                    by    = new byte[1];
                    by[0] = 0;
                    pvar.SetValue(by, 0, prgsa.Type());
                    break;

                case VARIANT_TYPE.RUL_FLOAT:
                    by = new byte[4];
                    by = BitConverter.GetBytes((float)0.0);
                    pvar.SetValue(by, 0, prgsa.Type());
                    break;

                case VARIANT_TYPE.RUL_DOUBLE:
                    by = new byte[4];
                    by = BitConverter.GetBytes((double)0.0);
                    pvar.SetValue(by, 0, prgsa.Type());
                    break;

                case VARIANT_TYPE.RUL_CHARPTR:
                case VARIANT_TYPE.RUL_SAFEARRAY:
                case VARIANT_TYPE.RUL_DD_STRING:
                case VARIANT_TYPE.RUL_UNSIGNED_CHAR:
                    by    = new byte[1];
                    by[0] = 0;
                    pvar.SetValue(by, 0, prgsa.Type());
                    break;
                }
                return(TYPE_SUCCESS);
            }

            /*
             * catch (CRIDEError* perr)
             * {
             *      pvecErrors.push_back(perr);
             * }
             * catch (...)
             * {
             *      throw (C_UM_ERROR_UNKNOWNERROR, pArrExp);
             * }
             * return TYPE_FAILURE;
             */
        }
Esempio n. 2
0
 public virtual int visitArrayExpression(CArrayExpression pStatement, CSymbolTable pSymbolTable,
                                         ref INTER_VARIANT pvar, RUL_TOKEN_SUBTYPE AssignType = RUL_TOKEN_SUBTYPE.RUL_ASSIGN) //Anil August 26 2005 to Fix a[exp1] += exp2
 {
     return(0);
 }