pypy / pypy / module / _rawffi /

""" Low-level interface to clibffi

from pypy.interpreter.mixedmodule import MixedModule
from pypy.module._rawffi.interp_rawffi import W_CDLL
from pypy.rpython.lltypesystem import lltype, rffi
from pypy.module._rawffi.tracker import Tracker
import sys

class Module(MixedModule):

    interpleveldefs = {
        'CDLL'               : 'interp_rawffi.W_CDLL',
        'FuncPtr'            : 'interp_rawffi.W_FuncPtr',
        'Structure'          : 'structure.W_Structure',
        'StructureInstance'  : 'structure.W_StructureInstance',
        'StructureInstanceAutoFree' : 'structure.W_StructureInstanceAutoFree',
        'Array'              : 'array.W_Array',
        'ArrayInstance'      : 'array.W_ArrayInstance',
        'ArrayInstanceAutoFree' : 'array.W_ArrayInstanceAutoFree',
        'sizeof'             : 'interp_rawffi.sizeof',
        'alignment'          : 'interp_rawffi.alignment',
        'charp2string'       : 'interp_rawffi.charp2string',
        'wcharp2unicode'     : 'interp_rawffi.wcharp2unicode',
        'charp2rawstring'    : 'interp_rawffi.charp2rawstring',
        'wcharp2rawunicode'  : 'interp_rawffi.wcharp2rawunicode',
        'CallbackPtr'        : 'callback.W_CallbackPtr',
        '_num_of_allocated_objects' : 'tracker.num_of_allocated_objects',
        'get_libc'           : 'interp_rawffi.get_libc',
        'get_errno'          : 'interp_rawffi.get_errno',
        'set_errno'          : 'interp_rawffi.set_errno',
        'get_last_error'     : 'interp_rawffi.get_last_error',
        'set_last_error'     : 'interp_rawffi.set_last_error',
        'SegfaultException'  : 'space.new_exception_class("_rawffi.SegfaultException")',

    appleveldefs = {

    def buildloaders(cls):
        from pypy.module._rawffi import interp_rawffi

        if hasattr(interp_rawffi, 'FormatError'):
            Module.interpleveldefs['FormatError'] = 'interp_rawffi.FormatError'
        if hasattr(interp_rawffi, 'check_HRESULT'):
            Module.interpleveldefs['check_HRESULT'] = 'interp_rawffi.check_HRESULT'

        from pypy.rlib import clibffi
            if hasattr(clibffi, name):
                Module.interpleveldefs[name] = "space.wrap(%r)" % getattr(clibffi, name)
        super(Module, cls).buildloaders()
    buildloaders = classmethod(buildloaders)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.