Exemplo n.º 1
0
 internal static int PyVisit(IntPtr ob, IntPtr visit, IntPtr arg)
 {
     if (ob == IntPtr.Zero)
     {
         return 0;
     }
     var visitFunc = NativeCall.GetDelegate<Interop.ObjObjFunc>(visit);
     return visitFunc(ob, arg);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Wrapper for calling tp_clear
 /// </summary>
 internal void CallTypeClear()
 {
     if (tpHandle == IntPtr.Zero || pyHandle == IntPtr.Zero)
     {
         return;
     }
     var clearPtr = Marshal.ReadIntPtr(tpHandle, TypeOffset.tp_clear);
     if (clearPtr == IntPtr.Zero)
     {
         return;
     }
     var clearFunc = NativeCall.GetDelegate<Interop.InquiryFunc>(clearPtr);
     clearFunc(pyHandle);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Wrapper for calling tp_traverse
        /// </summary>
        internal void CallTypeTraverse(Interop.ObjObjFunc visitproc, IntPtr arg)
        {
            if (tpHandle == IntPtr.Zero || pyHandle == IntPtr.Zero)
            {
                return;
            }
            var traversePtr = Marshal.ReadIntPtr(tpHandle, TypeOffset.tp_traverse);
            if (traversePtr == IntPtr.Zero)
            {
                return;
            }
            var traverseFunc = NativeCall.GetDelegate<Interop.ObjObjArgFunc>(traversePtr);

            var visiPtr = Marshal.GetFunctionPointerForDelegate(visitproc);
            traverseFunc(pyHandle, visiPtr, arg);
        }
Exemplo n.º 4
0
        internal void CallTypeClear()
        {
            if (tpHandle == IntPtr.Zero || pyHandle == IntPtr.Zero)
            {
                return;
            }

            var clearPtr = Runtime.PyType_GetSlot(TypeReference, TypeSlotID.tp_clear);

            if (clearPtr == IntPtr.Zero)
            {
                return;
            }
            var clearFunc = NativeCall.GetDelegate <Interop.InquiryFunc>(clearPtr);

            clearFunc(pyHandle);
        }
Exemplo n.º 5
0
        internal void CallTypeTraverse(Interop.ObjObjFunc visitproc, IntPtr arg)
        {
            if (tpHandle == IntPtr.Zero || pyHandle == IntPtr.Zero)
            {
                return;
            }
            var traversePtr = Runtime.PyType_GetSlot(TypeReference, TypeSlotID.tp_traverse);

            if (traversePtr == IntPtr.Zero)
            {
                return;
            }
            var traverseFunc = NativeCall.GetDelegate <Interop.ObjObjArgFunc>(traversePtr);

            var visiPtr = Marshal.GetFunctionPointerForDelegate(visitproc);

            traverseFunc(pyHandle, visiPtr, arg);
        }