Exemplo n.º 1
0
        static string GetIntString(PrimitiveType primitive, ParserTargetInfo targetInfo)
        {
            uint width;
            bool signed;

            GetPrimitiveTypeWidth(primitive, targetInfo, out width, out signed);

            switch (width)
            {
            case 8:
                return(signed ? "sbyte" : "byte");

            case 16:
                return(signed ? "short" : "ushort");

            case 32:
                return(signed ? "int" : "uint");

            case 64:
                return(signed ? "long" : "ulong");

            default:
                throw new NotImplementedException();
            }
        }
Exemplo n.º 2
0
        public static void GetPrimitiveTypeWidth(PrimitiveType primitive,
                                                 ParserTargetInfo targetInfo, out uint width, out bool signed)
        {
            switch (primitive)
            {
            case PrimitiveType.Char:
                width  = targetInfo?.CharWidth ?? 8;
                signed = true;
                break;

            case PrimitiveType.UChar:
                width  = targetInfo?.CharWidth ?? 8;
                signed = false;
                break;

            case PrimitiveType.Short:
                width  = targetInfo?.ShortWidth ?? 16;
                signed = true;
                break;

            case PrimitiveType.UShort:
                width  = targetInfo?.ShortWidth ?? 16;
                signed = false;
                break;

            case PrimitiveType.Int:
                width  = targetInfo?.IntWidth ?? 32;
                signed = true;
                break;

            case PrimitiveType.UInt:
                width  = targetInfo?.IntWidth ?? 32;
                signed = false;
                break;

            case PrimitiveType.Long:
                width  = targetInfo?.LongWidth ?? 32;
                signed = true;
                break;

            case PrimitiveType.ULong:
                width  = targetInfo?.LongWidth ?? 32;
                signed = false;
                break;

            case PrimitiveType.LongLong:
                width  = targetInfo?.LongLongWidth ?? 64;
                signed = true;
                break;

            case PrimitiveType.ULongLong:
                width  = targetInfo?.LongLongWidth ?? 64;
                signed = false;
                break;

            default:
                throw new NotImplementedException();
            }
        }
Exemplo n.º 3
0
            public ParserTargetInfo(CppSharp.Parser.ParserTargetInfo _0)
            {
                __Instance                     = Marshal.AllocHGlobal(160);
                __ownsNativeInstance           = true;
                NativeToManagedMap[__Instance] = this;
                var arg0 = ReferenceEquals(_0, null) ? global::System.IntPtr.Zero : _0.__Instance;

                Internal.cctor_1((__Instance + __PointerAdjustment), arg0);
            }
Exemplo n.º 4
0
            public ParserTargetInfo(CppSharp.Parser.ParserTargetInfo _0)
            {
                __Instance                     = Marshal.AllocHGlobal(164);
                __ownsNativeInstance           = true;
                NativeToManagedMap[__Instance] = this;
                if (ReferenceEquals(_0, null))
                {
                    throw new global::System.ArgumentNullException("_0", "_0 cannot be null because it is a C++ reference (&).");
                }
                var arg0 = _0.__Instance;

                Internal.cctor_1((__Instance + __PointerAdjustment), arg0);
            }
Exemplo n.º 5
0
        static string GetIntString(PrimitiveType primitive, ParserTargetInfo targetInfo)
        {
            bool signed;
            uint width;

            switch (primitive)
            {
            case PrimitiveType.Short:
                width  = targetInfo.ShortWidth;
                signed = true;
                break;

            case PrimitiveType.UShort:
                width  = targetInfo.ShortWidth;
                signed = false;
                break;

            case PrimitiveType.Int:
                width  = targetInfo.IntWidth;
                signed = true;
                break;

            case PrimitiveType.UInt:
                width  = targetInfo.IntWidth;
                signed = false;
                break;

            case PrimitiveType.Long:
                width  = targetInfo.LongWidth;
                signed = true;
                break;

            case PrimitiveType.ULong:
                width  = targetInfo.LongWidth;
                signed = false;
                break;

            case PrimitiveType.LongLong:
                width  = targetInfo.LongLongWidth;
                signed = true;
                break;

            case PrimitiveType.ULongLong:
                width  = targetInfo.LongLongWidth;
                signed = false;
                break;

            default:
                throw new NotImplementedException();
            }

            switch (width)
            {
            case 8:
                return(signed ? "sbyte" : "byte");

            case 16:
                return(signed ? "short" : "ushort");

            case 32:
                return(signed ? "int" : "uint");

            case 64:
                return(signed ? "long" : "ulong");

            default:
                throw new NotImplementedException();
            }
        }
Exemplo n.º 6
0
 public static void GetPrimitiveTypeWidth(PrimitiveType primitive, ParserTargetInfo targetInfo, out uint width, out bool signed)
 {
     width = primitive.GetInfo(targetInfo, out signed).Width;
 }