示例#1
0
        public static void RefreshBasicCode(Page obj, BasicType bType)
        {
            string signCode = bType.ToString();
            int    typeID   = Convert.ToInt32(bType);

            RefreshBasicCode(obj, signCode, typeID);
        }
示例#2
0
        public static string QueryBasicCode(Page obj, BasicType bType, int codeID)
        {
            string signCode = bType.ToString();
            int    typeID   = Convert.ToInt32(bType);

            return(QueryBasicCode(obj, signCode, typeID, codeID));
        }
示例#3
0
            public void Variable(BasicType type, string name)
            {
                this.sb.Append(type.ToString()).Append("V(");

                this.sb.Append(name);

                this.sb.Append(")");
            }
示例#4
0
文件: Load.cs 项目: SiteView/ECC8.13
        public Load(string name, ExtensionType extensionType, BasicType basicType, object value)
        {

            this.name = name;
            
            if (extensionType != ExtensionType.List)
            {
                throw new Exception("Not supported type");
            }

            this.data = new List(basicType.ToString(), value);

        }
示例#5
0
            public void Array(BasicType type, string name, BasicExpression[] subs)
            {
                this.sb.Append(type.ToString()).Append("A(");

                this.sb.Append(name);

                foreach (BasicExpression sub in subs)
                {
                    this.sb.Append(", ");
                    sub.Accept(this);
                }

                this.sb.Append(")");
            }
示例#6
0
            public void Literal(BasicType type, object o)
            {
                this.sb.Append(type.ToString()).Append("L(");

                string s = o.ToString();

                if (type == BasicType.Str)
                {
                    s = "\"" + s + "\"";
                }

                this.sb.Append(s);

                this.sb.Append(")");
            }
示例#7
0
        public string _ToNormalizedString(bool Normalized = true)
        {
            var Parts = new List <string>();

            if (Typedef)
            {
                Parts.Add("typedef");
            }
            if (Const)
            {
                Parts.Add("const");
            }
            if (Volatile)
            {
                Parts.Add("volatile");
            }
            if (Sign == CTypeSign.Unsigned)
            {
                Parts.Add("unsigned");
            }
            if (!Normalized)
            {
                if (Storage != CTypeStorage.Auto)
                {
                    Parts.Add(Storage.ToString().ToLower());
                }
            }
            for (int n = 0; n < LongCount; n++)
            {
                Parts.Add("long");
            }
            if (BasicType != CTypeBasic.ComplexType)
            {
                Parts.Add(BasicType.ToString().ToLower());
            }
            else
            {
                if (ComplexType != null)
                {
                    Parts.Add(Normalized ? ComplexType.ToNormalizedString() : ComplexType.ToString());
                }
            }
            return(String.Join(" ", Parts));
        }
示例#8
0
        public static string ToExportType(this BasicType _this)
        {
            switch (_this)
            {
            case BasicType.@bool:
                return("bool");

            case BasicType.@char:
                return("char");

            case BasicType.UInt8:
                return("byte");

            case BasicType.SInt16:
                return("short");

            case BasicType.UInt16:
                return("ushort");

            case BasicType.@int:
                return("int");

            case BasicType.unsignedint:
                return("uint");

            case BasicType.SInt64:
                return("long");

            case BasicType.UInt64:
                return("ulong");

            case BasicType.@float:
                return("float");

            case BasicType.@string:
                return("string");

            default:
                throw new NotSupportedException(_this.ToString());
            }
        }
示例#9
0
        public Sort BuildBasicType(BasicType basicType)
        {
            Context z3 = ((Z3apiProverContext)container).z3;
            Sort    typeAst;

            if (basicType.IsBool)
            {
                typeAst = z3.MkBoolSort();
            }
            else if (basicType.IsInt)
            {
                typeAst = z3.MkIntSort();
            }
            else if (basicType.IsReal)
            {
                typeAst = z3.MkRealSort();
            }
            else
            {
                throw new Exception("Unknown Basic Type " + basicType.ToString());
            }
            return(typeAst);
        }
示例#10
0
文件: diautil.cs 项目: zpplus/runtime
        private String GetTypeString(IDiaSymbol s)
        {
            SymTagEnum tag = (SymTagEnum)s.symTag;

            if (tag == SymTagEnum.SymTagData || tag == SymTagEnum.SymTagTypedef)
            {
                s   = s.type;
                tag = (SymTagEnum)s.symTag;
            }

            StringBuilder str = new StringBuilder();

            if (s.name != null)
            {
                str.Append(s.name);
            }
            else if (tag == SymTagEnum.SymTagPointerType)
            {
                str.Append(GetTypeString(s.type));
                str.Append("*");
            }
            else if (tag == SymTagEnum.SymTagBaseType)
            {
                BasicType bt = (BasicType)s.baseType;
                str.AppendFormat("(base type={0}, len={1:d})", bt.ToString(), s.length);
            }
            else if (tag == SymTagEnum.SymTagArrayType)
            {
                str.Append(GetTypeString(s.type));

                bool succ = true;
                int  i;

                try
                {
                    UInt32 rank = s.rank;

                    IDiaEnumSymbols e;
                    s.findChildren(SymTagEnum.SymTagDimension, null, (UInt32)NameSearchOptions.nsNone, out e);

                    for (i = 0; i < e.count; i++)
                    {
                        IDiaSymbol ds;
                        UInt32     celt;
                        e.Next(1, out ds, out celt);

                        str.Append("[" + GetBoundString(ds.lowerBound) + ".." + GetBoundString(ds.upperBound) + "]");
                    }
                }
                catch (Exception)
                {
                    succ = false;
                }

                if (succ == false)
                {
                    try
                    {
                        succ = true;
                        IDiaEnumSymbols e;
                        s.findChildren(SymTagEnum.SymTagCustomType, null, (UInt32)NameSearchOptions.nsNone, out e);

                        for (i = 0; i < e.count; i++)
                        {
                            IDiaSymbol ds;
                            UInt32     celt;
                            e.Next(1, out ds, out celt);

                            str.Append("[" + GetTypeString(ds) + "]");
                        }
                    }
                    catch (Exception)
                    {
                        succ = false;
                    }
                }

                if (succ == false)
                {
                    try
                    {
                        succ = true;
                        str.AppendFormat("[{0:d}]", s.length / s.type.length);
                    }
                    catch (Exception)
                    {
                        succ = false;
                    }
                }
            }
            else if (tag == SymTagEnum.SymTagFunctionType)
            {
                str.Append("Function Type");
            }
            else if (tag == SymTagEnum.SymTagCustomType)
            {
                throw new Exception("NYI");

                /*
                 * str.Append("Custom Type: ");
                 * try
                 * {
                 *  str.Append(s.guid.ToString());
                 * }
                 * catch (Exception e)
                 * {
                 *  try
                 *  {
                 *      str.AppendFormat("{0:x}:{0:x}", s.oemId, s.oemSymbolId);
                 *  }
                 *  catch (Exception)
                 *  {
                 *  }
                 * }
                 * DWORD len = 0;
                 * if ( s.get_types( 0, &len, NULL ) == S_OK && len > 0 ) {
                 *  IDiaSymbol** psyms = new IDiaSymbol*[ len ];
                 *  s.get_types( len, &len, psyms );
                 *  for ( DWORD i = 0; i < len; ++i ) {
                 *      printf( " <" );
                 *      printType( psyms[i] );
                 *      printf( ">" );
                 *      psyms[i]->Release();
                 *  }
                 *  delete [] psyms;
                 * }
                 * len = 0;
                 * if ( s.get_dataBytes( 0, &len, NULL ) == S_OK && len > 0 ) {
                 *  BYTE* pdata = new BYTE[ len ];
                 *  s.get_dataBytes( len, &len, pdata );
                 *  printf( "<data" );
                 *  for ( DWORD i = 0; i < len; ++i ) {
                 *      printf( " %02x", pdata[i] );
                 *  }
                 *  printf( " data>" );
                 *  delete [] pdata;
                 * }
                 */
            }
            else
            {
                str.Append("No Type.");
            }

            return(str.ToString());
        }
示例#11
0
        public static ADBBaseObject GetGraphObjectFromType(BasicType myTypeOfValue, Object myValue)
        {
            switch (myTypeOfValue)
            {

                case BasicType.Double:
                    if (myValue == null)
                        return new DBDouble();
                    else
                        return new DBDouble(myValue);

                case BasicType.UInt64:
                    if (myValue == null)
                        return new DBUInt64();
                    else
                        return new DBUInt64(myValue);

                case BasicType.Int64:
                    if (myValue == null)
                        return new DBInt64();
                    else
                        return new DBInt64(myValue);

                case BasicType.Int32:
                    if (myValue == null)
                        return new DBInt32();
                    else
                        return new DBInt32(myValue);

                case BasicType.String:
                    if (myValue == null)
                        return new DBString();
                    else
                        return new DBString(myValue);

                case BasicType.DateTime:
                    if (myValue == null)
                        return new DBDateTime();
                    else
                        return new DBDateTime(myValue);

                case BasicType.Boolean:
                    if (myValue == null)
                        return new DBBoolean();
                    else
                        return new DBBoolean(myValue);

                case BasicType.SetOfDBObjects:
                    if (myValue != null)
                        return new DBEdge(myValue);
                    return new DBEdge();

                case BasicType.Unknown:
                    if (myValue is String)
                        return new DBString(myValue);
                    return new DBNumber(myValue);

                case BasicType.NotABasicType:
                case BasicType.Reference:

                    if (myValue != null)
                    {

                        var _ADBBaseObject = myValue as ADBBaseObject;

                        if (_ADBBaseObject != null)
                            return _ADBBaseObject;

                        return new DBReference(myValue);

                    }

                    else
                    {

                        if (myTypeOfValue == BasicType.Reference)
                            return new DBReference();

                        return null;

                    }

                default:
                    throw new GraphDBException(new Error_TypeDoesNotExist(myTypeOfValue.ToString()));

            }
        }