Sha256: 7a294caa256b5507dd554f6f3bfbcedbabb2ad864b059d517558f5520100b56b

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'ffi'
require 'rupy/python'

module Rupy
    #Contains Python C API macros reimplmented in Ruby. For internal use only.
    module Macros
        def self.Py_TYPE(pObjPointer)
            pStruct = Python::PyObjectStruct.new pObjPointer
            pStruct[:ob_type]
        end

        def self.PyObject_TypeCheck(pObject, pTypePointer)
            if Py_TYPE(pObject) == pTypePointer
                1
            else
                0
            end
        end

        def self.Py_True
            Python.Py_TrueStruct.to_ptr
        end

        def self.Py_False
            Python.Py_ZeroStruct.to_ptr
        end

        def self.Py_None
            Python.Py_NoneStruct.to_ptr
        end

        def self.Py_RETURN_FALSE
            Python.Py_IncRef(self.Py_False)
            self.Py_False
        end

        def self.Py_RETURN_TRUE
            Python.Py_IncRef(self.Py_True)
            self.Py_True
        end

        def self.Py_RETURN_NONE
            Python.Py_IncRef(self.Py_None)
            self.Py_None
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rupy-0.4.2 lib/rupy/macros.rb
rupy-0.4.1 lib/rupy/macros.rb
rupy-0.4.0 ./lib/rupy/macros.rb