public MetaVariableExpression() { _pool = new NativeGU.NativeMemoryPool(); IntPtr exprMetaPtr = NativeGU.gu_alloc_variant((byte)PgfExprTag.PGF_EXPR_META, (UIntPtr)Marshal.SizeOf <NativePgfExprMeta>(), UIntPtr.Zero, ref _ptr, _pool.Ptr); Native.EditStruct <NativePgfExprMeta> (exprMetaPtr, (ref NativePgfExprMeta m) => m.Id = 0); }
public LiteralStringExpression(string s) : base() { _pool = new NativeGU.NativeMemoryPool(); var exprTag = (byte)(int)PgfExprTag.PGF_EXPR_LIT; IntPtr litPtr = NativeGU.gu_alloc_variant(exprTag, (UIntPtr)Marshal.SizeOf <NativePgfExprLit>(), UIntPtr.Zero, ref _ptr, _pool.Ptr); Native.EditStruct <NativePgfExprLit>(litPtr, (ref NativePgfExprLit lit) => { MkStringVariant((byte)PgfLiteralTag.PGF_LITERAL_STR, s, ref lit.lit); }); }
internal void Initialize <TNative>(PgfLiteralTag litTag, Native.StructAction <TNative> setValue, UIntPtr?size = null) { _pool = new NativeGU.NativeMemoryPool(); var exprTag = (byte)(int)PgfExprTag.PGF_EXPR_LIT; IntPtr litPtr = NativeGU.gu_alloc_variant(exprTag, (UIntPtr)Marshal.SizeOf <NativePgfExprLit>(), UIntPtr.Zero, ref _ptr, _pool.Ptr); Native.EditStruct <NativePgfExprLit> (litPtr, (ref NativePgfExprLit lit) => { IntPtr ilitPtr = NativeGU.gu_alloc_variant((byte)litTag, (UIntPtr)Marshal.SizeOf <TNative> (), UIntPtr.Zero, ref lit.lit, _pool.Ptr); Native.EditStruct <TNative>(ilitPtr, setValue); }); }
public ApplicationExpression(string fname, IEnumerable <Expression> args) { _pool = new NativeGU.NativeMemoryPool(); MkStringVariant((byte)PgfExprTag.PGF_EXPR_FUN, fname, ref _ptr); foreach (var arg in args) { var fun = _ptr; var exprApp = NativeGU.gu_alloc_variant((byte)PgfExprTag.PGF_EXPR_APP, (UIntPtr)Marshal.SizeOf <PgfExprApp>(), UIntPtr.Zero, ref _ptr, _pool.Ptr); Native.EditStruct <PgfExprApp> (exprApp, (ref PgfExprApp app) => { app.Function = fun; app.Argument = arg.Ptr; }); } }