Obj FuncWeakPointerObj( Obj self, Obj list ) { Obj wp; Int i; Int len; len = LEN_LIST(list); wp = (Obj) NewBag(T_WPOBJ, (len+1)*sizeof(Obj)); STORE_LEN_WPOBJ(wp,len); for (i = 1; i <= len ; i++) { ELM_WPOBJ(wp,i) = ELM0_LIST(list,i); CHANGED_BAG(wp); /* this must be here in case list is in fact an object and causes a GC in the element access method */ } return wp; }
Obj GAP_ElmList(Obj list, UInt pos) { if (pos == 0) return 0; return ELM0_LIST(list, pos); }