Example #1
0
 public StiParserMethodInfo(ProryvFunctionType name, int number, Type[] arguments, Type returnType)
 {
     this.Name       = name;
     this.Number     = number;
     this.Arguments  = arguments;
     this.ReturnType = returnType;
 }
Example #2
0
        //private StiParserDataType get_category2(object par)
        //{
        //    //if (par == null) return StiParserDataType.None;
        //    if (par == null) return StiParserDataType.Object;
        //    Type type = par.GetType();
        //    if (type == typeof(double)) return StiParserDataType.zDouble;
        //    if (type == typeof(decimal)) return StiParserDataType.zDecimal;
        //    if (type == typeof(Int32)) return StiParserDataType.Int32;
        //    if (type == typeof(string)) return StiParserDataType.String;
        //    if (type == typeof(bool)) return StiParserDataType.Bool;
        //    if (type == typeof(float)) return StiParserDataType.zFloat;
        //    if (type == typeof(UInt32)) return StiParserDataType.UInt32;
        //    if (type == typeof(byte)) return StiParserDataType.Byte;
        //    if (type == typeof(sbyte)) return StiParserDataType.SByte;
        //    if (type == typeof(Int16)) return StiParserDataType.Int16;
        //    if (type == typeof(UInt16)) return StiParserDataType.UInt16;
        //    if (type == typeof(Int64)) return StiParserDataType.Int64;
        //    if (type == typeof(UInt64)) return StiParserDataType.UInt64;
        //    if (type == typeof(char)) return StiParserDataType.Char;
        //    if (type == typeof(DateTime)) return StiParserDataType.DateTime;
        //    if (type == typeof(TimeSpan)) return StiParserDataType.TimeSpan;
        //    if (type == typeof(System.Drawing.Image)) return StiParserDataType.Image;
        //    if (type == typeof(object)) return StiParserDataType.Object;
        //    return StiParserDataType.None;
        //}

        #region CheckParserMethodInfo
        private int CheckParserMethodInfo(ProryvFunctionType type, ArrayList args)
        {
            int count = args.Count;

            Type[] types = new Type[count];
            for (int index = 0; index < count; index++)
            {
                if (args[index] == null)
                {
                    types[index] = typeof(object);
                }
                else
                {
                    types[index] = args[index].GetType();
                }
            }

            StiParserMethodInfo methodInfo = GetParserMethodInfo(type, types);

            if (methodInfo != null)
            {
                return(methodInfo.Number);
            }

            return(0);
        }
Example #3
0
 public StiParserMethodInfo(ProryvFunctionType name, int number, Type[] arguments)
 {
     this.Name       = name;
     this.Number     = number;
     this.Arguments  = arguments;
     this.ReturnType = typeof(string);
 }
Example #4
0
        public StiParserMethodInfo GetParserMethodInfo(ProryvFunctionType type, Type[] args)
        {
            object obj = MethodsHash[type];

            if (obj == null)
            {
                return(null);
            }
            int count = args.Length;

            List <StiParserMethodInfo> methods = (List <StiParserMethodInfo>)obj;
            bool flag1 = false;

            foreach (StiParserMethodInfo methodInfo in methods)
            {
                if (methodInfo.Arguments.Length != count)
                {
                    continue;
                }
                flag1 = true;
                bool flag2 = true;
                for (int index = 0; index < count; index++)
                {
                    if (IsImplicitlyCastableTo(args[index], methodInfo.Arguments[index]))
                    {
                        continue;
                    }
                    flag2 = false;
                    break;
                }
                if (flag2)
                {
                    return(methodInfo);
                }
            }

            if (!flag1)
            {
                ThrowError(ParserErrorCode.NoOverloadForMethodTakesNArguments, Enum.GetName(typeof(ProryvFunctionType), type), count.ToString());
            }

            StringBuilder sb = new StringBuilder();

            for (int index = 0; index < count; index++)
            {
                sb.Append(args[index].Namespace == "System" ? args[index].Name : args[index].ToString());
                if (index < count - 1)
                {
                    sb.Append(",");
                }
            }

            ThrowError(ParserErrorCode.NoMatchingOverloadedMethod, Enum.GetName(typeof(ProryvFunctionType), type), sb.ToString());
            return(null);
        }
Example #5
0
        private static bool CheckForStoreToPrint(object objAsmList)
        {
            bool result = false;
            List <StiAsmCommand> asmList = objAsmList as List <StiAsmCommand>;

            if (asmList != null)
            {
                foreach (StiAsmCommand command in asmList)
                {
                    if (command.Type == StiAsmCommandType.PushSystemVariable)
                    {
                        ProryvSystemVariableType type = (ProryvSystemVariableType)command.Parameter1;
                        if (type == ProryvSystemVariableType.PageNumber ||
                            type == ProryvSystemVariableType.PageNumberThrough ||
                            type == ProryvSystemVariableType.TotalPageCount ||
                            type == ProryvSystemVariableType.TotalPageCountThrough ||
                            type == ProryvSystemVariableType.PageNofM ||
                            type == ProryvSystemVariableType.PageNofMThrough ||
                            type == ProryvSystemVariableType.IsFirstPage ||
                            type == ProryvSystemVariableType.IsFirstPageThrough ||
                            type == ProryvSystemVariableType.IsLastPage ||
                            type == ProryvSystemVariableType.IsLastPageThrough)
                        {
                            result = true;
                            break;
                        }
                    }
                    if (command.Type == StiAsmCommandType.PushFunction)
                    {
                        ProryvFunctionType type = (ProryvFunctionType)command.Parameter1;
                        if (type >= ProryvFunctionType.pCount && type <= ProryvFunctionType.pLast ||
                            type >= ProryvFunctionType.prCount && type <= ProryvFunctionType.prLast ||
                            type >= ProryvFunctionType.piCount && type <= ProryvFunctionType.piLast ||
                            type >= ProryvFunctionType.priCount && type <= ProryvFunctionType.priLast ||
                            type == ProryvFunctionType.GetAnchorPageNumber || type == ProryvFunctionType.GetAnchorPageNumberThrough)
                        {
                            result = true;
                            break;
                        }
                    }
                }
            }
            return(result);
        }