예제 #1
0
        public static SymbolicExpression ExecFunction(this REngine engine, SymbolicExpressionParamList expressionParams, string functionName)
        {
            var paramValue = engine.GetFunction(expressionParams);
            var function   = $"{functionName}({paramValue})";

            return(engine.Evaluate(function));
        }
예제 #2
0
        public static SymbolicExpression ToExternalPointer(REngine engine, object instance)
        {
            if (instance == null)
            {
                return(engine.NilValue);
            }

            var tag = engine.CreateCharacterVector(new[] { NET_OBJ_TAG, instance.GetType().FullName });
            var ptr = engine.GetFunction <R_MakeExternalPtr>()(
                Marshal.GetIUnknownForObject(instance),
                tag.DangerousGetHandle(),
                engine.NilValue.DangerousGetHandle());

            var sexp = engine.CreateFromNativeSexp(ptr);

            return(sexp);
        }
예제 #3
0
        public static void Release(REngine engine, IntPtr pointer)
        {
            var objPtr = engine.GetFunction <R_ExternalPtrAddr>()(pointer);

            Marshal.Release(objPtr);
        }