本文整理汇总了C#中ParserTargetInfo类的典型用法代码示例。如果您正苦于以下问题:C# ParserTargetInfo类的具体用法?C# ParserTargetInfo怎么用?C# ParserTargetInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParserTargetInfo类属于命名空间,在下文中一共展示了ParserTargetInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParserTargetInfo
protected ParserTargetInfo(ParserTargetInfo.Internal* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
示例2: __CreateInstance
public static ParserTargetInfo __CreateInstance(ParserTargetInfo.Internal native, bool skipVTables = false)
{
return new ParserTargetInfo(native, skipVTables);
}
示例3: DumpSizes
static void DumpSizes(TextWriter writer, ParserTargetInfo target)
{
var sizes = new[]
{
new { Name = "gint8", Size = target.CharWidth},
new { Name = "gint16", Size = target.ShortWidth},
new { Name = "gint32", Size = target.IntWidth},
new { Name = "gint64", Size = GetTypeSize(target, target.Int64Type)},
new { Name = "float", Size = target.FloatWidth},
new { Name = "double", Size = target.DoubleWidth},
new { Name = "gpointer", Size = GetTypeSize(target, target.IntPtrType)},
};
// Write the size info for the basic types.
foreach (var size in sizes)
writer.WriteLine("DECL_SIZE2({0},{1})", size.Name, size.Size / 8);
}
示例4: __CopyValue
private static ParserTargetInfo.Internal* __CopyValue(ParserTargetInfo.Internal native)
{
var ret = Marshal.AllocHGlobal(176);
CppSharp.Parser.ParserTargetInfo.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return (ParserTargetInfo.Internal*) ret;
}
示例5: Dump
static void Dump(ASTContext ctx, ParserTargetInfo targetInfo, Target target)
{
var targetFile = target.Triple;
if (!string.IsNullOrEmpty (OutputDir))
targetFile = Path.Combine (OutputDir, targetFile);
targetFile += ".h";
using (var writer = new StreamWriter(targetFile))
//using (var writer = Console.Out)
{
writer.WriteLine("#ifndef USED_CROSS_COMPILER_OFFSETS");
writer.WriteLine("#ifdef {0}", target.Defines[0]);
writer.WriteLine ("#ifdef {0}", GetTargetPlatformDefine (target.Platform));
writer.WriteLine("#ifndef HAVE_BOEHM_GC");
writer.WriteLine("#define HAS_CROSS_COMPILER_OFFSETS");
writer.WriteLine("#if defined (USE_CROSS_COMPILE_OFFSETS) || defined (MONO_CROSS_COMPILE)");
writer.WriteLine("#if !defined (DISABLE_METADATA_OFFSETS)");
writer.WriteLine("#define USED_CROSS_COMPILER_OFFSETS");
DumpAligns(writer, targetInfo);
DumpSizes(writer, targetInfo);
DumpMetadataOffsets(writer, ctx, target);
writer.WriteLine("#endif //disable metadata check");
DumpJITOffsets(writer, ctx);
writer.WriteLine("#endif //cross compiler checks");
writer.WriteLine("#endif //gc check");
writer.WriteLine("#endif //os check");
writer.WriteLine("#endif //arch check");
writer.WriteLine("#endif //USED_CROSS_COMPILER_OFFSETS check");
}
Console.WriteLine("Generated offsets file: {0}", targetFile);
}
示例6: DumpAligns
static void DumpAligns(TextWriter writer, ParserTargetInfo target)
{
var aligns = new[]
{
new { Name = "gint8", Align = target.CharAlign},
new { Name = "gint16", Align = target.ShortAlign},
new { Name = "gint32", Align = target.IntAlign},
new { Name = "gint64", Align = GetTypeAlign(target, target.Int64Type)},
new { Name = "float", Align = target.FloatAlign},
new { Name = "double", Align = target.DoubleAlign},
new { Name = "gpointer", Align = GetTypeAlign(target, target.IntPtrType)},
};
// Write the alignment info for the basic types.
foreach (var align in aligns)
writer.WriteLine("DECL_ALIGN2({0},{1})", align.Name, align.Align / 8);
}
示例7: GetTypeAlign
static uint GetTypeAlign(ParserTargetInfo target, ParserIntType type)
{
switch (type)
{
case ParserIntType.SignedChar:
case ParserIntType.UnsignedChar:
return target.CharAlign;
case ParserIntType.SignedShort:
case ParserIntType.UnsignedShort:
return target.ShortAlign;
case ParserIntType.SignedInt:
case ParserIntType.UnsignedInt:
return target.IntAlign;
case ParserIntType.SignedLong:
case ParserIntType.UnsignedLong:
return target.LongAlign;
case ParserIntType.SignedLongLong:
case ParserIntType.UnsignedLongLong:
return target.LongLongAlign;
default:
throw new Exception("Type has no alignment");
}
}
示例8: ParserTargetInfo
private ParserTargetInfo(ParserTargetInfo.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
}
示例9: ParserTargetInfo
internal ParserTargetInfo(ParserTargetInfo.Internal* native)
: this(new global::System.IntPtr(native))
{
}
示例10: ParserTargetInfo
protected ParserTargetInfo(ParserTargetInfo.Internal* native, bool isInternalImpl = false)
{
__Instance = new global::System.IntPtr(native);
}
示例11: __CreateInstance
public static ParserTargetInfo __CreateInstance(ParserTargetInfo.Internal native)
{
return new ParserTargetInfo(native);
}
示例12: __CopyValue
private static void* __CopyValue(ParserTargetInfo.Internal native)
{
var ret = Marshal.AllocHGlobal(176);
CppSharp.Parser.ParserTargetInfo.Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer();
}
示例13: GetTypeSize
static uint GetTypeSize(ParserTargetInfo target, ParserIntType type)
{
switch (type)
{
case ParserIntType.SignedChar:
case ParserIntType.UnsignedChar:
return target.CharWidth;
case ParserIntType.SignedShort:
case ParserIntType.UnsignedShort:
return target.ShortWidth;
case ParserIntType.SignedInt:
case ParserIntType.UnsignedInt:
return target.IntWidth;
case ParserIntType.SignedLong:
case ParserIntType.UnsignedLong:
return target.LongWidth;
case ParserIntType.SignedLongLong:
case ParserIntType.UnsignedLongLong:
return target.LongLongWidth;
default:
throw new Exception("Type has no size");
}
}
示例14: ParserTargetInfo
private ParserTargetInfo(ParserTargetInfo.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
示例15: ParserTargetInfo
internal ParserTargetInfo(ParserTargetInfo.Internal native)
: this(&native)
{
}