/// <summary> /// Creates new instance of SymbolicExpression. /// </summary> /// <param name="engine">The engine.</param> /// <param name="pointer">The pointer.</param> protected internal SymbolicExpression(REngine engine, IntPtr pointer) : base(IntPtr.Zero, true) { this.engine = engine; this.sexp = (SEXPREC)Marshal.PtrToStructure(pointer, typeof(SEXPREC)); SetHandle(pointer); Preserve(); }
/// <summary> /// Gets an enumerator over this pairlist /// </summary> /// <returns>The enumerator</returns> public IEnumerator <Symbol> GetEnumerator() { if (Count != 0) { for (SEXPREC sexp = GetInternalStructure(); sexp.sxpinfo.type != SymbolicExpressionType.Null; sexp = (SEXPREC)Marshal.PtrToStructure(sexp.listsxp.cdrval, typeof(SEXPREC))) { yield return(new Symbol(Engine, sexp.listsxp.tagval)); } } }