Exemplo n.º 1
0
 private string TryGetPrefix(CType t)
 {
     string s;
     try
     {
         if (t is CAttrTerm)
         {
             CAttrTerm t2 = (CAttrTerm)t;
             s = t2.AttrStr + " " + ((CPrefix)t2.CoreType).Prefix;
         }
         else
         {
             s = ((CPrefix)t).Prefix;
         }
     }
     catch (InvalidCastException)
     {
         throw new InvalidOperationException();
     }
     return s;
 }
Exemplo n.º 2
0
 private CTerm UnwrapType(CType type, out string wrap)
 {
     CTerm core;
     if (type is CWrap)
     {
         AttrWrapMaker maker = new AttrWrapMaker(this);
         type.UnwrapTo(maker, out core);
         wrap = maker.Value;
     }
     else
     {
         core = (CTerm)type;
         wrap = "";
     }
     return core;
 }
Exemplo n.º 3
0
 private XmlElement MakeFieldEntry(CType type, string name, Offset offset)
 {
     XmlElement result;
     if (type is CBits)
     {
         CBits bit = (CBits)type;
         result = MakeElem("bit-field");
         AddTypeBasicAttrs(result, bit.Next, false);
         AddNameAndOffsetAttrs(result, name, offset);
         AddAttr(result, "len", bit.Len);
     }
     else
     {
         result = MakeElem("field");
         AddTypeBasicAttrs(result, type, true);
         AddNameAndOffsetAttrs(result, name, offset);
     }
     return result;
 }
Exemplo n.º 4
0
        private void AddTypeBasicAttrs(XmlElement elem, CType type, bool writeWrap)
        {
            string a_attr, a_base, a_wrap;
            CTerm core, inner;

            core = UnwrapType(type, out a_wrap);
            inner = StripTypeAttr(core, out a_attr);
            a_base = EncodeBaseType(inner);

            if (a_attr != "") { AddAttr(elem, "attr", a_attr); }
            AddAttr(elem, "base", a_base);
            if (writeWrap) { AddAttr(elem, "wrap", a_wrap); }
        }
Exemplo n.º 5
0
 public Entry(CType type, string name, Offset offset)
 {
     _type = type;
     _name = name;
     _offset = offset;
 }
Exemplo n.º 6
0
 public void Add(CType type, string name)
 {
     Add(type, name, Offset.Zero);
 }
Exemplo n.º 7
0
 public void Add(CType type, string name, Offset offset)
 {
     _entries.Add(new Entry(type, name, offset));
 }
Exemplo n.º 8
0
 public void Add(CType type)
 {
     _args.Add(type);
 }
Exemplo n.º 9
0
 public CArr(CType next, int len)
     : base(next)
 {
     _len = len;
 }
Exemplo n.º 10
0
 public CFunc(CType retType, CallConv callConv)
     : base(retType)
 {
     _args = new List<CType>();
     _callConv = callConv;
 }
Exemplo n.º 11
0
 public CFunc(CType retType)
     : this(retType, CallConvs.Default)
 {
 }
Exemplo n.º 12
0
 public CWrap(CType next)
 {
     _next = next;
 }
Exemplo n.º 13
0
 public CPtr(CType next)
     : base(next)
 {
 }
Exemplo n.º 14
0
 public CPtr(CType next)
     : base(next)
 {
 }