Пример #1
0
            ptr = cdata.unsafe_escaping_ptr()
            ptr = rffi.ptradd(ptr, offset)
            return cdataobj.W_CData(space, ptr, self)
        else:
            raise oefmt(space.w_TypeError,
                        "expected a cdata struct/union/array/pointer object")

    def _fget(self, attrchar):
        if attrchar == 'i':  # item
            return self.ctitem
        return W_CTypePtrBase._fget(self, attrchar)


# ____________________________________________________________

FILEP = rffi.COpaquePtr("FILE")
rffi_fdopen = rffi.llexternal("fdopen", [rffi.INT, rffi.CCHARP],
                              FILEP,
                              save_err=rffi.RFFI_SAVE_ERRNO)
rffi_setbuf = rffi.llexternal("setbuf", [FILEP, rffi.CCHARP], lltype.Void)
rffi_fclose = rffi.llexternal("fclose", [FILEP], rffi.INT)


class CffiFileObj(object):
    _immutable_ = True

    def __init__(self, fd, mode):
        self.llf = rffi_fdopen(fd, mode)
        if not self.llf:
            raise OSError(rposix.get_saved_errno(), "fdopen failed")
        rffi_setbuf(self.llf, lltype.nullptr(rffi.CCHARP.TO))
Пример #2
0
eci = ExternalCompilationInfo(
    libraries=libraries,
    includes=includes,
    post_include_bits=[
        # Unnamed structures are not supported by rffi_platform.
        # So we replace an attribute access with a macro call.
        '#define pypy_GENERAL_NAME_dirn(name) (name->d.dirn)',
    ],
)

eci = rffi_platform.configure_external_library('openssl', eci, [
    dict(prefix='openssl-', include_dir='inc32', library_dir='out32'),
])

ASN1_STRING = lltype.Ptr(lltype.ForwardReference())
ASN1_ITEM = rffi.COpaquePtr('ASN1_ITEM')
X509_NAME = rffi.COpaquePtr('X509_NAME')


class CConfigBootstrap:
    _compilation_info_ = eci
    OPENSSL_EXPORT_VAR_AS_FUNCTION = rffi_platform.Defined(
        "OPENSSL_EXPORT_VAR_AS_FUNCTION")


if rffi_platform.configure(CConfigBootstrap)["OPENSSL_EXPORT_VAR_AS_FUNCTION"]:
    ASN1_ITEM_EXP = lltype.Ptr(lltype.FuncType([], ASN1_ITEM))
else:
    ASN1_ITEM_EXP = ASN1_ITEM

        _compilation_info_ = eci
        TIMEVAL = platform.Struct('struct timeval', [('tv_sec', rffi.LONG),
                                                     ('tv_usec', rffi.LONG)])
        TIMESPEC = platform.Struct('struct timespec', [('tv_sec', rffi.TIME_T),
                                                       ('tv_nsec', rffi.LONG)])
        SEM_FAILED = platform.ConstantInteger('SEM_FAILED')
        SEM_VALUE_MAX = platform.DefinedConstantInteger('SEM_VALUE_MAX')
        SEM_TIMED_WAIT = platform.Has('sem_timedwait')
        SEM_T_SIZE = platform.SizeOf('sem_t')

    config = platform.configure(CConfig)
    TIMEVAL = config['TIMEVAL']
    TIMESPEC = config['TIMESPEC']
    TIMEVALP = rffi.CArrayPtr(TIMEVAL)
    TIMESPECP = rffi.CArrayPtr(TIMESPEC)
    SEM_T = rffi.COpaquePtr('sem_t', compilation_info=eci)
    #                rffi.cast(SEM_T, config['SEM_FAILED'])
    SEM_FAILED = config['SEM_FAILED']
    SEM_VALUE_MAX = config['SEM_VALUE_MAX']
    if SEM_VALUE_MAX is None:  # on Hurd
        SEM_VALUE_MAX = sys.maxint
    SEM_TIMED_WAIT = config['SEM_TIMED_WAIT']
    SEM_T_SIZE = config['SEM_T_SIZE']
    if sys.platform == 'darwin':
        HAVE_BROKEN_SEM_GETVALUE = True
    else:
        HAVE_BROKEN_SEM_GETVALUE = False

    def external(name, args, result, **kwargs):
        return rffi.llexternal(name,
                               args,
Пример #4
0
if IS_WINDOWS:

    def opendir(_):
        raise NotImplementedError("directory operations on windows")

    readdir = closedir = opendir
else:
    eci = ExternalCompilationInfo(includes=["sys/types.h", "dirent.h"])

    class CConfig:
        _compilation_info_ = eci
        DIRENT = platform.Struct(
            "struct dirent", [("d_name", lltype.FixedSizeArray(rffi.CHAR, 1))])

    config = platform.configure(CConfig)
    DIRP = rffi.COpaquePtr("DIR")
    DIRENT = config["DIRENT"]
    DIRENTP = lltype.Ptr(DIRENT)

    # XXX macro=True is hack to make sure we get the correct kind of
    # dirent struct (which depends on defines)
    os_opendir = rffi.llexternal("opendir", [rffi.CCHARP],
                                 DIRP,
                                 compilation_info=eci,
                                 save_err=rffi.RFFI_SAVE_ERRNO,
                                 macro=True)
    os_readdir = rffi.llexternal("readdir", [DIRP],
                                 DIRENTP,
                                 compilation_info=eci,
                                 save_err=rffi.RFFI_SAVE_ERRNO,
                                 macro=True)
Пример #5
0
from pypy.interpreter.function import ClassMethod, Method, StaticMethod
from pypy.interpreter.gateway import interp2app
from pypy.interpreter.typedef import (GetSetProperty, TypeDef,
                                      interp_attrproperty,
                                      interp_attrproperty_w)
from pypy.objspace.std.typeobject import W_TypeObject
from pypy.module.cpyext.api import (CONST_STRING, METH_CLASS, METH_COEXIST,
                                    METH_KEYWORDS, METH_NOARGS, METH_O,
                                    METH_STATIC, METH_VARARGS, PyObject,
                                    PyObjectFields, bootstrap_function,
                                    build_type_checkers, cpython_api,
                                    cpython_struct, generic_cpy_call)
from pypy.module.cpyext.pyobject import (Py_DecRef, from_ref, make_ref,
                                         make_typedescr)

PyCFunction_typedef = rffi.COpaquePtr(typedef='PyCFunction')
PyCFunction = lltype.Ptr(lltype.FuncType([PyObject, PyObject], PyObject))
PyCFunctionKwArgs = lltype.Ptr(
    lltype.FuncType([PyObject, PyObject, PyObject], PyObject))

PyMethodDef = cpython_struct('PyMethodDef', [
    ('ml_name', rffi.CCHARP),
    ('ml_meth', PyCFunction_typedef),
    ('ml_flags', rffi.INT_real),
    ('ml_doc', rffi.CCHARP),
])

PyCFunctionObjectStruct = cpython_struct(
    'PyCFunctionObject', PyObjectFields + (
        ('m_ml', lltype.Ptr(PyMethodDef)),
        ('m_self', PyObject),
Пример #6
0
globals().update(rffi_platform.configure(CConfig))

init = rffi.llexternal("zmq_init", [rffi.INT],
                       rffi.VOIDP,
                       compilation_info=info)

socket = rffi.llexternal("zmq_socket", [rffi.VOIDP, rffi.INT],
                         rffi.VOIDP,
                         compilation_info=info)

bind = rffi.llexternal("zmq_bind", [rffi.VOIDP, rffi.CCHARP],
                       rffi.INT,
                       compilation_info=info)

msg_t = rffi.COpaquePtr('zmq_msg_t', compilation_info=info)

msg_send = rffi.llexternal("zmq_msg_send", [msg_t, rffi.VOIDP, rffi.INT],
                           rffi.INT,
                           compilation_info=info)

msg_recv = rffi.llexternal("zmq_msg_recv", [msg_t, rffi.VOIDP, rffi.INT],
                           rffi.INT,
                           compilation_info=info)

msg_init_size = rffi.llexternal("zmq_msg_init_size", [msg_t, rffi.SIZE_T],
                                rffi.SIZE_T,
                                compilation_info=info)

msg_init = rffi.llexternal("zmq_msg_init", [msg_t],
                           rffi.INT,
Пример #7
0
                          rffi.INT,
                          save_err=rffi.RFFI_SAVE_ERRNO)

if sys.platform != 'win32':
    itimervalP = rffi.CArrayPtr(itimerval)
    c_setitimer = external('setitimer', [rffi.INT, itimervalP, itimervalP],
                           rffi.INT,
                           save_err=rffi.RFFI_SAVE_ERRNO)
    c_getitimer = external('getitimer', [rffi.INT, itimervalP], rffi.INT)

c_pthread_kill = external('pthread_kill', [lltype.Signed, rffi.INT],
                          rffi.INT,
                          save_err=rffi.RFFI_SAVE_ERRNO)

if sys.platform != 'win32':
    c_sigset_t = rffi.COpaquePtr('sigset_t', compilation_info=eci)
    c_sigemptyset = external('sigemptyset', [c_sigset_t], rffi.INT)
    c_sigaddset = external('sigaddset', [c_sigset_t, rffi.INT], rffi.INT)
    c_sigismember = external('sigismember', [c_sigset_t, rffi.INT], rffi.INT)
    c_sigwait = external('sigwait', [c_sigset_t, rffi.INTP],
                         rffi.INT,
                         releasegil=True,
                         save_err=rffi.RFFI_SAVE_ERRNO)
    c_sigpending = external('sigpending', [c_sigset_t],
                            rffi.INT,
                            save_err=rffi.RFFI_SAVE_ERRNO)
    c_pthread_sigmask = external('pthread_sigmask',
                                 [rffi.INT, c_sigset_t, c_sigset_t],
                                 rffi.INT,
                                 save_err=rffi.RFFI_SAVE_ERRNO)
Пример #8
0
for k, v in rffi_platform.configure(CConfig).items():
    globals()[k] = v


def winexternal(name, args, result, **kwds):
    return rffi.llexternal(name,
                           args,
                           result,
                           compilation_info=eci,
                           calling_conv='win',
                           **kwds)


if WIN32:
    HANDLE = rffi.COpaquePtr(typedef='HANDLE')
    assert rffi.cast(HANDLE, -1) == rffi.cast(HANDLE, -1)

    LPHANDLE = rffi.CArrayPtr(HANDLE)
    HMODULE = HANDLE
    NULL_HANDLE = rffi.cast(HANDLE, 0)
    INVALID_HANDLE_VALUE = rffi.cast(HANDLE, -1)
    GENERIC_READ = rffi.cast(DWORD, r_longlong(0x80000000))
    GENERIC_WRITE = rffi.cast(DWORD, r_longlong(0x40000000))
    GENERIC_EXECUTE = rffi.cast(DWORD, r_longlong(0x20000000))
    GENERIC_ALL = rffi.cast(DWORD, r_longlong(0x10000000))
    FILE_SHARE_READ = rffi.cast(DWORD, r_longlong(0x00000001))
    FILE_SHARE_WRITE = rffi.cast(DWORD, r_longlong(0x00000002))

    PFILETIME = rffi.CArrayPtr(FILETIME)
Пример #9
0
        ('next_in', rffi.CCHARP),
        ('avail_in', rffi.UINT),
        ('total_in_lo32', rffi.UINT),
        ('total_in_hi32', rffi.UINT),
        ('next_out', rffi.CCHARP),
        ('avail_out', rffi.UINT),
        ('total_out_lo32', rffi.UINT),
        ('total_out_hi32', rffi.UINT),
        ('state', rffi.VOIDP),
        ('bzalloc', lltype.Ptr(_alloc_type)),
        ('bzfree', lltype.Ptr(_free_type)),
        ('opaque', rffi.VOIDP),
    ])


FILE = rffi.COpaquePtr('FILE')
BZFILE = rffi.COpaquePtr('BZFILE')

constants = {}
constant_names = [
    'BZ_RUN', 'BZ_FLUSH', 'BZ_FINISH', 'BZ_OK', 'BZ_RUN_OK', 'BZ_FLUSH_OK',
    'BZ_FINISH_OK', 'BZ_STREAM_END', 'BZ_SEQUENCE_ERROR', 'BZ_PARAM_ERROR',
    'BZ_MEM_ERROR', 'BZ_DATA_ERROR', 'BZ_DATA_ERROR_MAGIC', 'BZ_IO_ERROR',
    'BZ_UNEXPECTED_EOF', 'BZ_OUTBUFF_FULL', 'BZ_CONFIG_ERROR'
]
for name in constant_names:
    setattr(CConfig, name, platform.DefinedConstantInteger(name))


class cConfig(object):
    pass
Пример #10
0
rffi_platform.verify_eci(eci.convert_sources_to_files())


def llexternal(name, args, result, **kwds):
    return rffi.llexternal(name,
                           args,
                           result,
                           compilation_info=eci,
                           _nowrapper=True,
                           **kwds)


# ----- types -----

handle = rffi.COpaquePtr(typedef='stacklet_handle', compilation_info=eci)
thread_handle = rffi.COpaquePtr(typedef='stacklet_thread_handle',
                                compilation_info=eci)
run_fn = lltype.Ptr(lltype.FuncType([handle, llmemory.Address], handle))

# ----- constants -----

null_handle = lltype.nullptr(handle.TO)


def is_empty_handle(h):
    return rffi.cast(lltype.Signed, h) == -1


# ----- functions -----
Пример #11
0
        # So we replace an attribute access with a macro call.
        '#define pypy_GENERAL_NAME_dirn(name) (name->d.dirn)',
        '#define pypy_GENERAL_NAME_uri(name) (name->d.uniformResourceIdentifier)',
        '#define pypy_GENERAL_NAME_pop_free(names) (sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free))',
        '#define pypy_X509_OBJECT_data_x509(obj) (obj->data.x509)',
        '#define pypy_DIST_POINT_fullname(obj) (obj->distpoint->name.fullname)',
    ],
)

eci = rffi_platform.configure_external_library('openssl', eci, [
    dict(prefix='openssl-', include_dir='inc32', library_dir='out32'),
])

ASN1_STRING = lltype.Ptr(lltype.ForwardReference())
ASN1_IA5STRING = ASN1_STRING
ASN1_ITEM = rffi.COpaquePtr('ASN1_ITEM')
ASN1_OBJECT = rffi.COpaquePtr('ASN1_OBJECT')
X509_NAME = rffi.COpaquePtr('X509_NAME')
X509_VERIFY_PARAM = rffi.COpaquePtr('X509_VERIFY_PARAM')
stack_st_X509_OBJECT = rffi.COpaquePtr('STACK_OF(X509_OBJECT)')
DIST_POINT = rffi.COpaquePtr('DIST_POINT')
stack_st_DIST_POINT = rffi.COpaquePtr('STACK_OF(X509_OBJECT)')
DH = rffi.COpaquePtr('DH')
EC_KEY = rffi.COpaquePtr('EC_KEY')
AUTHORITY_INFO_ACCESS = rffi.COpaquePtr('AUTHORITY_INFO_ACCESS')
GENERAL_NAME = lltype.Ptr(lltype.ForwardReference())


class CConfigBootstrap:
    _compilation_info_ = eci
    OPENSSL_EXPORT_VAR_AS_FUNCTION = rffi_platform.Defined(
Пример #12
0
        srcdir.join('src', 'cjkcodecs', '_codecs_iso2022.c'),
        srcdir.join('src', 'cjkcodecs', '_codecs_jp.c'),
        srcdir.join('src', 'cjkcodecs', '_codecs_kr.c'),
        srcdir.join('src', 'cjkcodecs', '_codecs_tw.c'),
        srcdir.join('src', 'cjkcodecs', 'multibytecodec.c'),
    ],
    includes=['src/cjkcodecs/multibytecodec.h'],
    include_dirs=[str(srcdir), cdir],
)

MBERR_TOOSMALL = -1  # insufficient output buffer space
MBERR_TOOFEW = -2  # incomplete input buffer
MBERR_INTERNAL = -3  # internal runtime error
MBERR_NOMEMORY = -4  # out of memory

MULTIBYTECODEC_P = rffi.COpaquePtr('struct MultibyteCodec_s',
                                   compilation_info=eci)


def llexternal(*args, **kwds):
    kwds.setdefault('compilation_info', eci)
    kwds.setdefault('sandboxsafe', True)
    kwds.setdefault('_nowrapper', True)
    return rffi.llexternal(*args, **kwds)


def getter_for(name):
    return llexternal('pypy_cjkcodec_%s' % name, [], MULTIBYTECODEC_P)


_codecs_getters = dict([(name, getter_for(name)) for name in codecs])
assert len(_codecs_getters) == len(codecs)
Пример #13
0
file_flags = {
    u"RDONLY": cConfig['O_RDONLY'],
    u"WRONLY": cConfig['O_WRONLY'],
    u"RDWR": cConfig['O_RDWR'],
    u"APPEND": cConfig['O_APPEND'],
    u"CREAT": cConfig['O_CREAT'],
    u"EXCL": cConfig['O_EXCL'],
    u"TRUNC": cConfig['O_TRUNC'],
}


dirent_ptr = lltype.Ptr(cConfig["dirent_t"])

# Handle types
loop_ptr = rffi.COpaquePtr("uv_loop_t")
handle_ptr  = lltype.Ptr(cConfig["handle_t"])
stream_ptr  = lltype.Ptr(cConfig["stream_t"])
tcp_ptr     = lltype.Ptr(cConfig["tcp_t"])
udp_ptr     = lltype.Ptr(cConfig["udp_t"])
pipe_ptr    = lltype.Ptr(cConfig["pipe_t"])
tty_ptr     = lltype.Ptr(cConfig["tty_t"])
poll_ptr    = lltype.Ptr(cConfig["poll_t"])
timer_ptr   = lltype.Ptr(cConfig["timer_t"])
prepare_ptr = lltype.Ptr(cConfig["prepare_t"])
check_ptr   = lltype.Ptr(cConfig["check_t"])
idle_ptr    = lltype.Ptr(cConfig["idle_t"])
async_ptr   = lltype.Ptr(cConfig["async_t"])
process_ptr = lltype.Ptr(cConfig["process_t"])

fs_event_ptr = lltype.Ptr(cConfig["fs_event_t"])
Пример #14
0
    CConfig.WSANETWORKEVENTS = platform.Struct(
        'struct _WSANETWORKEVENTS',
        [
            ('lNetworkEvents', rffi.LONG),
            ('iErrorCode', rffi.CFixedArray(rffi.INT, 10)),  #FD_MAX_EVENTS
        ])

    CConfig.WSAPROTOCOL_INFO = platform.Struct(
        'WSAPROTOCOL_INFOA', [])  # Struct is just passed between functions
    CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger(
        'FROM_PROTOCOL_INFO')

CConfig.timeval = platform.Struct('struct timeval', [('tv_sec', rffi.LONG),
                                                     ('tv_usec', rffi.LONG)])

fd_set = rffi.COpaquePtr('fd_set', compilation_info=eci)

if _WIN32:
    CConfig.WSAData = platform.Struct(
        'struct WSAData',
        [
            ('wVersion', rffi.USHORT),
            ('wHighVersion', rffi.USHORT),
            ('szDescription', rffi.CFixedArray(lltype.Char,
                                               1)),  # (WSADESCRIPTION_LEN+1)
            ('szSystemStatus', rffi.CFixedArray(lltype.Char,
                                                1)),  # (WSASYS_STATUS_LEN+1)
            ('iMaxSockets', rffi.USHORT),
            ('iMaxUdpDg', rffi.USHORT),
            ('lpVendorInfo', CCHARP)
        ])
Пример #15
0
class CConfig:
    _compilation_info_ = eci
    BZ_OK = platform.DefinedConstantInteger('BZ_OK')
    BZ_STREAM_END = platform.DefinedConstantInteger('BZ_STREAM_END')


globals().update(platform.configure(CConfig))


def external(name, args, result):
    return rffi.llexternal(name, args, result, compilation_info=eci)


BZFILEPTR = rffi.VOIDP
FILEP = rffi.COpaquePtr('FILE')

c_bz_read_open = external(
    'BZ2_bzReadOpen',
    [rffi.INTP, FILEP, rffi.INT, rffi.INT, rffi.VOIDP, rffi.INT], BZFILEPTR)

c_bz_read_close = external('BZ2_bzReadClose', [rffi.INTP, BZFILEPTR],
                           lltype.Void)

c_bz_read = external('BZ2_bzRead',
                     [rffi.INTP, BZFILEPTR, rffi.VOIDP, rffi.INT], rffi.INT)

c_bz_write_open = external('BZ2_bzWriteOpen',
                           [rffi.INTP, FILEP, rffi.INT, rffi.INT, rffi.INT],
                           BZFILEPTR)
Пример #16
0
    libname = 'expat'
    pre_include_bits = []
eci = ExternalCompilationInfo(
    libraries=[libname],
    library_dirs=platform.preprocess_library_dirs([]),
    includes=['expat.h'],
    include_dirs=platform.preprocess_include_dirs([]),
    pre_include_bits=pre_include_bits,
)

eci = rffi_platform.configure_external_library(libname, eci, [
    dict(prefix='expat-', include_dir='lib', library_dir='win32/bin/release'),
])

XML_Content_Ptr = lltype.Ptr(lltype.ForwardReference())
XML_Parser = rffi.COpaquePtr(typedef='XML_Parser')

xml_error_list = [
    "XML_ERROR_NO_MEMORY",
    "XML_ERROR_SYNTAX",
    "XML_ERROR_NO_ELEMENTS",
    "XML_ERROR_INVALID_TOKEN",
    "XML_ERROR_UNCLOSED_TOKEN",
    "XML_ERROR_PARTIAL_CHAR",
    "XML_ERROR_TAG_MISMATCH",
    "XML_ERROR_DUPLICATE_ATTRIBUTE",
    "XML_ERROR_JUNK_AFTER_DOC_ELEMENT",
    "XML_ERROR_PARAM_ENTITY_REF",
    "XML_ERROR_UNDEFINED_ENTITY",
    "XML_ERROR_RECURSIVE_ENTITY_REF",
    "XML_ERROR_ASYNC_ENTITY",
Пример #17
0
def _emulated_start_new_thread(func):
    import thread
    try:
        ident = thread.start_new_thread(func, ())
    except thread.error:
        ident = -1
    return rffi.cast(rffi.LONG, ident)

CALLBACK = lltype.Ptr(lltype.FuncType([], lltype.Void))
c_thread_start = llexternal('RPyThreadStart', [CALLBACK], rffi.LONG,
                            _callable=_emulated_start_new_thread,
                            releasegil=True)  # release the GIL, but most
                                              # importantly, reacquire it
                                              # around the callback

TLOCKP = rffi.COpaquePtr('struct RPyOpaque_ThreadLock',
                          compilation_info=eci)
TLOCKP_SIZE = rffi_platform.sizeof('struct RPyOpaque_ThreadLock', eci)
c_thread_lock_init = llexternal('RPyThreadLockInit', [TLOCKP], rffi.INT,
                                releasegil=False)   # may add in a global list
c_thread_lock_dealloc_NOAUTO = llexternal('RPyOpaqueDealloc_ThreadLock',
                                          [TLOCKP], lltype.Void,
                                          _nowrapper=True)
c_thread_acquirelock = llexternal('RPyThreadAcquireLock', [TLOCKP, rffi.INT],
                                  rffi.INT,
                                  releasegil=True)    # release the GIL
c_thread_acquirelock_timed = llexternal('RPyThreadAcquireLockTimed',
                                        [TLOCKP, rffi.LONGLONG, rffi.INT],
                                        rffi.INT,
                                        releasegil=True)    # release the GIL
c_thread_releaselock = llexternal('RPyThreadReleaseLock', [TLOCKP],
                                  lltype.Signed,
Пример #18
0
                               library_dirs=Config.LIBPCRE_LIBRARY_DIRS, \
                               libraries=Config.LIBPCRE_LIBRARIES, \
                               link_extra=Config.LIBPCRE_LINK_FLAGS, \
                               link_files=[Config.LIBPCRE_A])

class CConfig:
    _compilation_info_     = eci
    PCRE_DOTALL            = platform.DefinedConstantInteger("PCRE_DOTALL")
    PCRE_MULTILINE         = platform.DefinedConstantInteger("PCRE_MULTILINE")
    PCRE_INFO_CAPTURECOUNT = platform.DefinedConstantInteger("PCRE_INFO_CAPTURECOUNT")
    PCRE_ANCHORED          = platform.DefinedConstantInteger("PCRE_ANCHORED")
    PCRE_ERROR_NOMATCH     = platform.DefinedConstantInteger("PCRE_ERROR_NOMATCH")

cconfig = platform.configure(CConfig)

PCREP                  = rffi.COpaquePtr("pcre")
PCRE_DOTALL            = cconfig["PCRE_DOTALL"]
PCRE_MULTILINE         = cconfig["PCRE_MULTILINE"]
PCRE_INFO_CAPTURECOUNT = cconfig["PCRE_INFO_CAPTURECOUNT"]
PCRE_ANCHORED          = cconfig["PCRE_ANCHORED"]
PCRE_ERROR_NOMATCH     = cconfig["PCRE_ERROR_NOMATCH"]

pcre_compile = rffi.llexternal("pcre_compile", \
  [rffi.CCHARP, rffi.INT, rffi.CCHARPP, rffi.INTP, rffi.VOIDP], PCREP, compilation_info=eci)
pcre_fullinfo = rffi.llexternal("pcre_fullinfo", \
  [PCREP, rffi.VOIDP, rffi.INT, rffi.INTP], rffi.INT, compilation_info=eci)
pcre_exec = rffi.llexternal("pcre_exec", \
  [PCREP, rffi.VOIDP, rffi.CCHARP, rffi.INT, rffi.INT, rffi.INT, rffi.INTP, rffi.INT], \
  rffi.INT, compilation_info=eci)