From e1cec06f7483ea913885a7918728a1c3f8ece650 Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 31 May 2017 13:48:36 +0000 Subject: .NET binding to GF by Bjørnar Luteberget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/runtime/dotNet/Expr/MetaVariable.cs | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/runtime/dotNet/Expr/MetaVariable.cs (limited to 'src/runtime/dotNet/Expr/MetaVariable.cs') diff --git a/src/runtime/dotNet/Expr/MetaVariable.cs b/src/runtime/dotNet/Expr/MetaVariable.cs new file mode 100644 index 000000000..30ead9004 --- /dev/null +++ b/src/runtime/dotNet/Expr/MetaVariable.cs @@ -0,0 +1,34 @@ +using System; +using System.Runtime.InteropServices; + +namespace PGFSharp +{ + public class MetaVariableExpr : Expr { + + internal MetaVariableExpr() { + _pool = new NativeGU.NativeMemoryPool(); + IntPtr exprMetaPtr = NativeGU.gu_alloc_variant ((byte)PgfExprTag.PGF_EXPR_META, + (UIntPtr)Marshal.SizeOf (), UIntPtr.Zero, ref _ptr, _pool.Ptr); + + Native.EditStruct (exprMetaPtr, (ref NativePgfExprMeta m) => m.Id = 0); + } + + internal MetaVariableExpr(IntPtr ptr, NativeGU.NativeMemoryPool pool) : base(ptr, pool) { } + + + public int Id => Data.Id; + private NativePgfExprMeta Data => Marshal.PtrToStructure(DataPtr); + + public override R Accept (IVisitor visitor) + { + // return visitor.VisitMetaVariable (Id); + + // Not supported yet. + throw new NotImplementedException(); + } + + [StructLayout(LayoutKind.Sequential)] + private struct NativePgfExprMeta { public int Id; } + } +} + -- cgit v1.2.3