示例#1
0
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes=['stdio.h', 'sys/types.h', 'bzlib.h'],
        libraries=['bz2'],
    )
    calling_conv = 'c'

    off_t = platform.SimpleType("off_t", rffi.LONGLONG)
    size_t = platform.SimpleType("size_t", rffi.ULONG)
    BUFSIZ = platform.ConstantInteger("BUFSIZ")
    _alloc_type = lltype.FuncType([rffi.VOIDP, rffi.INT, rffi.INT], rffi.VOIDP)
    _free_type = lltype.FuncType([rffi.VOIDP, rffi.VOIDP], lltype.Void)
    SEEK_SET = platform.ConstantInteger("SEEK_SET")
    bz_stream = platform.Struct('bz_stream', [
        ('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),
    ])
示例#2
0
文件: rwin32.py 项目: griels/pypy-sc
class CConfig:
    _compilation_info_ = eci

    if WIN32:
        DWORD_PTR = rffi_platform.SimpleType("DWORD_PTR", rffi.LONG)
        WORD = rffi_platform.SimpleType("WORD", rffi.UINT)
        DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT)
        BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG)
        INT = rffi_platform.SimpleType("INT", rffi.INT)
        LONG = rffi_platform.SimpleType("LONG", rffi.LONG)
        PLONG = rffi_platform.SimpleType("PLONG", rffi.LONGP)
        LPVOID = rffi_platform.SimpleType("LPVOID", rffi.INTP)
        LPCVOID = rffi_platform.SimpleType("LPCVOID", rffi.VOIDP)
        LPCTSTR = rffi_platform.SimpleType("LPCTSTR", rffi.CCHARP)
        LPDWORD = rffi_platform.SimpleType("LPDWORD", rffi.INTP)
        SIZE_T = rffi_platform.SimpleType("SIZE_T", rffi.SIZE_T)

        HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG)
        HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP)

        DEFAULT_LANGUAGE = rffi_platform.ConstantInteger(
            "MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)")

        for name in """FORMAT_MESSAGE_ALLOCATE_BUFFER FORMAT_MESSAGE_FROM_SYSTEM
              """.split():
            locals()[name] = rffi_platform.ConstantInteger(name)
示例#3
0
class CConfig:
    _compilation_info_ = eci
    calling_conv = 'c'

    CHECK_LIBRARY = platform.Has('dump("x", (int)&BZ2_bzCompress)')

    off_t = platform.SimpleType("off_t", rffi.LONGLONG)
    size_t = platform.SimpleType("size_t", rffi.ULONG)
    BUFSIZ = platform.ConstantInteger("BUFSIZ")
    _alloc_type = lltype.FuncType([rffi.VOIDP, rffi.INT, rffi.INT], rffi.VOIDP)
    _free_type = lltype.FuncType([rffi.VOIDP, rffi.VOIDP], lltype.Void)
    SEEK_SET = platform.ConstantInteger("SEEK_SET")
    bz_stream = platform.Struct('bz_stream',
                                [('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),
                                 ])
示例#4
0
    class CConfig:
        _compilation_info_ = ExternalCompilationInfo(includes=['windows.h'], )

        FILE_WRITE_ATTRIBUTES = platform.ConstantInteger(
            'FILE_WRITE_ATTRIBUTES')
        OPEN_EXISTING = platform.ConstantInteger('OPEN_EXISTING')
        FILE_FLAG_BACKUP_SEMANTICS = platform.ConstantInteger(
            'FILE_FLAG_BACKUP_SEMANTICS')
示例#5
0
class CConfig:
    _compilation_info_ = eci

    if WIN32:
        DWORD_PTR = rffi_platform.SimpleType("DWORD_PTR", rffi.LONG)
        WORD = rffi_platform.SimpleType("WORD", rffi.UINT)
        DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT)
        BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG)
        BYTE = rffi_platform.SimpleType("BYTE", rffi.UCHAR)
        WCHAR = rffi_platform.SimpleType("WCHAR", rffi.UCHAR)
        INT = rffi_platform.SimpleType("INT", rffi.INT)
        LONG = rffi_platform.SimpleType("LONG", rffi.LONG)
        PLONG = rffi_platform.SimpleType("PLONG", rffi.LONGP)
        LPVOID = rffi_platform.SimpleType("LPVOID", rffi.INTP)
        LPCVOID = rffi_platform.SimpleType("LPCVOID", rffi.VOIDP)
        LPSTR = rffi_platform.SimpleType("LPSTR", rffi.CCHARP)
        LPCSTR = rffi_platform.SimpleType("LPCSTR", rffi.CCHARP)
        LPWSTR = rffi_platform.SimpleType("LPWSTR", rffi.CWCHARP)
        LPCWSTR = rffi_platform.SimpleType("LPCWSTR", rffi.CWCHARP)
        LPDWORD = rffi_platform.SimpleType("LPDWORD", rffi.UINTP)
        SIZE_T = rffi_platform.SimpleType("SIZE_T", rffi.SIZE_T)
        ULONG_PTR = rffi_platform.SimpleType("ULONG_PTR", rffi.ULONG)

        HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG)
        HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP)

        FILETIME = rffi_platform.Struct('FILETIME',
                                        [('dwLowDateTime', rffi.UINT),
                                         ('dwHighDateTime', rffi.UINT)])
        SYSTEMTIME = rffi_platform.Struct('SYSTEMTIME',
                                          [])

        OSVERSIONINFOEX = rffi_platform.Struct(
            'OSVERSIONINFOEX',
            [('dwOSVersionInfoSize', rffi.UINT),
             ('dwMajorVersion', rffi.UINT),
             ('dwMinorVersion', rffi.UINT),
             ('dwBuildNumber',  rffi.UINT),
             ('dwPlatformId',  rffi.UINT),
             ('szCSDVersion', rffi.CFixedArray(lltype.Char, 1)),
             ('wServicePackMajor', rffi.USHORT),
             ('wServicePackMinor', rffi.USHORT),
             ('wSuiteMask', rffi.USHORT),
             ('wProductType', rffi.UCHAR),
         ])

        LPSECURITY_ATTRIBUTES = rffi_platform.SimpleType(
            "LPSECURITY_ATTRIBUTES", rffi.CCHARP)

        DEFAULT_LANGUAGE = rffi_platform.ConstantInteger(
            "MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)")

        for name in """FORMAT_MESSAGE_ALLOCATE_BUFFER FORMAT_MESSAGE_FROM_SYSTEM
                       MAX_PATH
                       WAIT_OBJECT_0 WAIT_TIMEOUT INFINITE
                       ERROR_INVALID_HANDLE
                    """.split():
            locals()[name] = rffi_platform.ConstantInteger(name)
示例#6
0
 class CConfig:
     _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.ConstantInteger('SEM_VALUE_MAX')
     SEM_TIMED_WAIT = platform.Has('sem_timedwait')
     SEM_T_SIZE = platform.SizeOf('sem_t')
示例#7
0
class CConfig:
    _compilation_info_ = compilation_info
    size_t = platform.SimpleType("size_t", rffi.ULONG)
    off_t = platform.SimpleType("off_t", rffi.LONG)

    MAP_PRIVATE = platform.ConstantInteger("MAP_PRIVATE")
    MAP_ANON = platform.DefinedConstantInteger("MAP_ANON")
    MAP_ANONYMOUS = platform.DefinedConstantInteger("MAP_ANONYMOUS")
    PROT_READ = platform.ConstantInteger("PROT_READ")
    PROT_WRITE = platform.ConstantInteger("PROT_WRITE")
    PROT_EXEC = platform.ConstantInteger("PROT_EXEC")
示例#8
0
文件: ll_os.py 项目: chyyuu/pygirl
 class CConfig:
     _compilation_info_ = ExternalCompilationInfo(
         includes = ['windows.h']
     )
     WIN32_FIND_DATA = platform.Struct('struct _WIN32_FIND_DATAA',
         [('cFileName', lltype.FixedSizeArray(rffi.CHAR, 1))])
     INVALID_HANDLE_VALUE = platform.ConstantInteger(
         'INVALID_HANDLE_VALUE')
     ERROR_FILE_NOT_FOUND = platform.ConstantInteger(
         'ERROR_FILE_NOT_FOUND')
     ERROR_NO_MORE_FILES = platform.ConstantInteger(
         'ERROR_NO_MORE_FILES')
示例#9
0
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes = _includes
    )
    CLOCKS_PER_SEC = platform.ConstantInteger("CLOCKS_PER_SEC")
    clock_t = platform.SimpleType("clock_t", rffi.ULONG)
    has_gettimeofday = platform.Has('gettimeofday')
示例#10
0
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes = ['windows.h'],
        libraries = ['kernel32'],
        )

    for name in CONSTANTS:
        locals()[name] = rffi_platform.ConstantInteger(name)
示例#11
0
文件: ll_os.py 项目: chyyuu/pygirl
 class CConfig:
     _compilation_info_ = ExternalCompilationInfo(
         includes = ['Windows.h']
     )
     MAX_PATH = platform.ConstantInteger('MAX_PATH')
     DWORD    = platform.SimpleType("DWORD", rffi.ULONG)
     LPCTSTR  = platform.SimpleType("LPCTSTR", rffi.CCHARP)
     LPTSTR   = platform.SimpleType("LPTSTR", rffi.CCHARP)
     LPTSTRP  = platform.SimpleType("LPTSTR*", rffi.CCHARPP)
示例#12
0
class CConfigure:
    _compilation_info_ = eci
    XML_Content = rffi_platform.Struct('XML_Content', [
        ('numchildren', rffi.UINT),
        ('children', XML_Content_Ptr),
        ('name', rffi.CCHARP),
        ('type', rffi.INT),
        ('quant', rffi.INT),
    ])
    for name in [
            'XML_PARAM_ENTITY_PARSING_NEVER',
            'XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE',
            'XML_PARAM_ENTITY_PARSING_ALWAYS'
    ]:
        locals()[name] = rffi_platform.ConstantInteger(name)
    XML_COMBINED_VERSION = rffi_platform.ConstantInteger(
        'XML_COMBINED_VERSION')
    XML_FALSE = rffi_platform.ConstantInteger('XML_FALSE')
    XML_TRUE = rffi_platform.ConstantInteger('XML_TRUE')
示例#13
0
    class CConfig:
        _compilation_info_ = ExternalCompilationInfo(pre_include_bits=[
            "/* a C comment */", "#include <stdio.h>",
            "#include <test_ctypes_platform.h>"
        ],
                                                     include_dirs=[str(udir)])

        FILE = rffi_platform.Struct('FILE', [])
        ushort = rffi_platform.SimpleType('unsigned short')
        XYZZY = rffi_platform.ConstantInteger('XYZZY')
示例#14
0
class CConfig:
    _compilation_info_ = eci

    FFI_OK = rffi_platform.ConstantInteger('FFI_OK')
    FFI_BAD_TYPEDEF = rffi_platform.ConstantInteger('FFI_BAD_TYPEDEF')
    FFI_DEFAULT_ABI = rffi_platform.ConstantInteger('FFI_DEFAULT_ABI')
    if _WIN32 and not _WIN64:
        FFI_STDCALL = rffi_platform.ConstantInteger('FFI_STDCALL')

    FFI_TYPE_STRUCT = rffi_platform.ConstantInteger('FFI_TYPE_STRUCT')

    size_t = rffi_platform.SimpleType("size_t", rffi.ULONG)
    ffi_abi = rffi_platform.SimpleType("ffi_abi", rffi.USHORT)

    ffi_type = rffi_platform.Struct('ffi_type', [('size', rffi.ULONG),
                                                 ('alignment', rffi.USHORT),
                                                 ('type', rffi.USHORT),
                                                 ('elements', FFI_TYPE_PP)])

    ffi_closure = rffi_platform.Struct('ffi_closure', [])
示例#15
0
 class CConfig:
     GET_FILEEX_INFO_LEVELS = platform.SimpleType('GET_FILEEX_INFO_LEVELS',
                                                  rffi.INT)
     GetFileExInfoStandard = platform.ConstantInteger(
         'GetFileExInfoStandard')
     WIN32_FILE_ATTRIBUTE_DATA = platform.Struct(
         '_WIN32_FILE_ATTRIBUTE_DATA', [('dwFileAttributes', rffi.ULONG),
                                        ('nFileSizeHigh', rffi.ULONG),
                                        ('nFileSizeLow', rffi.ULONG),
                                        ('ftCreationTime', FILETIME),
                                        ('ftLastAccessTime', FILETIME),
                                        ('ftCreationTime', FILETIME)])
示例#16
0
class CConfig:
    _compilation_info_ = eci

    if WIN32:
        DWORD_PTR = rffi_platform.SimpleType("DWORD_PTR", rffi.LONG)
        WORD = rffi_platform.SimpleType("WORD", rffi.UINT)
        DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT)
        BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG)
        BYTE = rffi_platform.SimpleType("BYTE", rffi.UCHAR)
        INT = rffi_platform.SimpleType("INT", rffi.INT)
        LONG = rffi_platform.SimpleType("LONG", rffi.LONG)
        PLONG = rffi_platform.SimpleType("PLONG", rffi.LONGP)
        LPVOID = rffi_platform.SimpleType("LPVOID", rffi.INTP)
        LPCVOID = rffi_platform.SimpleType("LPCVOID", rffi.VOIDP)
        LPSTR = rffi_platform.SimpleType("LPSTR", rffi.CCHARP)
        LPCSTR = rffi_platform.SimpleType("LPCSTR", rffi.CCHARP)
        LPDWORD = rffi_platform.SimpleType("LPDWORD", rffi.INTP)
        SIZE_T = rffi_platform.SimpleType("SIZE_T", rffi.SIZE_T)
        ULONG_PTR = rffi_platform.SimpleType("ULONG_PTR", rffi.ULONG)

        HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG)
        HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP)

        FILETIME = rffi_platform.Struct('FILETIME',
                                        [('dwLowDateTime', rffi.UINT),
                                         ('dwHighDateTime', rffi.UINT)])
        SYSTEMTIME = rffi_platform.Struct('SYSTEMTIME',
                                          [])

        LPSECURITY_ATTRIBUTES = rffi_platform.SimpleType(
            "LPSECURITY_ATTRIBUTES", rffi.CCHARP)

        DEFAULT_LANGUAGE = rffi_platform.ConstantInteger(
            "MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)")

        for name in """FORMAT_MESSAGE_ALLOCATE_BUFFER FORMAT_MESSAGE_FROM_SYSTEM
                       MAX_PATH
                    """.split():
            locals()[name] = rffi_platform.ConstantInteger(name)
示例#17
0
class CConfig:
    _compilation_info_ = eci

    RTLD_LOCAL = rffi_platform.DefinedConstantInteger('RTLD_LOCAL')
    RTLD_GLOBAL = rffi_platform.DefinedConstantInteger('RTLD_GLOBAL')
    RTLD_NOW = rffi_platform.DefinedConstantInteger('RTLD_NOW')

    FFI_OK = rffi_platform.ConstantInteger('FFI_OK')
    FFI_BAD_TYPEDEF = rffi_platform.ConstantInteger('FFI_BAD_TYPEDEF')
    FFI_DEFAULT_ABI = rffi_platform.ConstantInteger('FFI_DEFAULT_ABI')
    if _MS_WINDOWS:
        FFI_STDCALL = rffi_platform.ConstantInteger('FFI_STDCALL')

    FFI_TYPE_STRUCT = rffi_platform.ConstantInteger('FFI_TYPE_STRUCT')

    size_t = rffi_platform.SimpleType("size_t", rffi.ULONG)

    ffi_type = rffi_platform.Struct('ffi_type', [('size', rffi.ULONG),
                                                 ('alignment', rffi.USHORT),
                                                 ('type', rffi.USHORT),
                                                 ('elements', FFI_TYPE_PP)])

    ffi_closure = rffi_platform.Struct('ffi_closure', [])
示例#18
0
    class CConfig:
        _compilation_info_ = ExternalCompilationInfo(
            includes=['windows.h', 'winbase.h', 'sys/stat.h'], )

        GetFileExInfoStandard = platform.ConstantInteger(
            'GetFileExInfoStandard')
        FILE_ATTRIBUTE_DIRECTORY = platform.ConstantInteger(
            'FILE_ATTRIBUTE_DIRECTORY')
        FILE_ATTRIBUTE_READONLY = platform.ConstantInteger(
            'FILE_ATTRIBUTE_READONLY')
        ERROR_SHARING_VIOLATION = platform.ConstantInteger(
            'ERROR_SHARING_VIOLATION')
        _S_IFDIR = platform.ConstantInteger('_S_IFDIR')
        _S_IFREG = platform.ConstantInteger('_S_IFREG')

        WIN32_FILE_ATTRIBUTE_DATA = platform.Struct(
            'WIN32_FILE_ATTRIBUTE_DATA',
            [('dwFileAttributes', rwin32.DWORD),
             ('nFileSizeHigh', rwin32.DWORD), ('nFileSizeLow', rwin32.DWORD),
             ('ftCreationTime', rwin32.FILETIME),
             ('ftLastAccessTime', rwin32.FILETIME),
             ('ftLastWriteTime', rwin32.FILETIME)])

        BY_HANDLE_FILE_INFORMATION = platform.Struct(
            'BY_HANDLE_FILE_INFORMATION',
            [('dwFileAttributes', rwin32.DWORD),
             ('nFileSizeHigh', rwin32.DWORD), ('nFileSizeLow', rwin32.DWORD),
             ('nNumberOfLinks', rwin32.DWORD),
             ('nFileIndexHigh', rwin32.DWORD), ('nFileIndexLow', rwin32.DWORD),
             ('ftCreationTime', rwin32.FILETIME),
             ('ftLastAccessTime', rwin32.FILETIME),
             ('ftLastWriteTime', rwin32.FILETIME)])

        WIN32_FIND_DATA = platform.Struct(
            'WIN32_FIND_DATAA',
            # Only interesting fields
            [('dwFileAttributes', rwin32.DWORD),
             ('nFileSizeHigh', rwin32.DWORD), ('nFileSizeLow', rwin32.DWORD),
             ('ftCreationTime', rwin32.FILETIME),
             ('ftLastAccessTime', rwin32.FILETIME),
             ('ftLastWriteTime', rwin32.FILETIME)])
示例#19
0
class Configure:
    _compilation_info_ = eci

    JSType = platform.SimpleType('JSType', rffi.INT)
    JSPropertyAttributes = platform.SimpleType('JSPropertyAttributes',
                                               rffi.INT)
    c_bool = platform.SimpleType('bool', rffi.INT)


for name in [
        'kJSTypeUndefined', 'kJSTypeNull', 'kJSTypeBoolean', 'kJSTypeNumber',
        'kJSTypeString', 'kJSTypeObject', 'kJSPropertyAttributeNone',
        'kJSPropertyAttributeReadOnly', 'kJSPropertyAttributeDontEnum',
        'kJSPropertyAttributeDontDelete'
]:
    setattr(Configure, name, platform.ConstantInteger(name))

globals().update(platform.configure(Configure))

NULL = lltype.nullptr(rffi.VOIDP.TO)

# ------------------------------------------------------------------------------
# globals
# ------------------------------------------------------------------------------

_JSEvaluateScript = external('JSEvaluateScript', [
    JSContextRef, JSStringRef, JSObjectRef, JSStringRef, rffi.INT, JSValueRefP
], JSValueRef)
# args are: context, script, this (can be NULL),
# sourceURL (can be NULL, for exceptions), startingLineNumber,
# exception pointer (can be NULL)
示例#20
0
class CConfig:
    _compilation_info_ = eci

    OPENSSL_VERSION_NUMBER = rffi_platform.ConstantInteger(
        "OPENSSL_VERSION_NUMBER")
    SSL_FILETYPE_PEM = rffi_platform.ConstantInteger("SSL_FILETYPE_PEM")
    SSL_OP_ALL = rffi_platform.ConstantInteger("SSL_OP_ALL")
    SSL_VERIFY_NONE = rffi_platform.ConstantInteger("SSL_VERIFY_NONE")
    SSL_ERROR_WANT_READ = rffi_platform.ConstantInteger("SSL_ERROR_WANT_READ")
    SSL_ERROR_WANT_WRITE = rffi_platform.ConstantInteger(
        "SSL_ERROR_WANT_WRITE")
    SSL_ERROR_ZERO_RETURN = rffi_platform.ConstantInteger(
        "SSL_ERROR_ZERO_RETURN")
    SSL_ERROR_WANT_X509_LOOKUP = rffi_platform.ConstantInteger(
        "SSL_ERROR_WANT_X509_LOOKUP")
    SSL_ERROR_WANT_CONNECT = rffi_platform.ConstantInteger(
        "SSL_ERROR_WANT_CONNECT")
    SSL_ERROR_SYSCALL = rffi_platform.ConstantInteger("SSL_ERROR_SYSCALL")
    SSL_ERROR_SSL = rffi_platform.ConstantInteger("SSL_ERROR_SSL")
    SSL_CTRL_OPTIONS = rffi_platform.ConstantInteger("SSL_CTRL_OPTIONS")
    BIO_C_SET_NBIO = rffi_platform.ConstantInteger("BIO_C_SET_NBIO")
示例#21
0
文件: roci.py 项目: njues/Sypy
class CConfig:
    _compilation_info_ = eci

    ub1 = platform.SimpleType('ub1', rffi.UINT)
    sb1 = platform.SimpleType('sb1', rffi.INT)
    ub2 = platform.SimpleType('ub2', rffi.UINT)
    sb2 = platform.SimpleType('sb2', rffi.INT)
    ub4 = platform.SimpleType('ub4', rffi.UINT)
    sb4 = platform.SimpleType('sb4', rffi.INT)
    sword = platform.SimpleType('sword', rffi.INT)
    uword = platform.SimpleType('uword', rffi.UINT)
    boolean = platform.SimpleType('oci_boolean', rffi.UINT)
    OCIDuration = platform.SimpleType('OCIDuration', rffi.UINT)
    OCIInd = platform.SimpleType('OCIInd', rffi.INT)
    OCIPinOpt = platform.SimpleType('OCIPinOpt', rffi.INT)
    OCILockOpt = platform.SimpleType('OCILockOpt', rffi.INT)
    OCITypeCode = platform.SimpleType('OCITypeCode', rffi.UINT)

    OCINumber = platform.Struct('OCINumber', [])
    OCITime = platform.Struct('OCITime', [
        ('OCITimeHH', rffi.INT),
        ('OCITimeMI', rffi.INT),
        ('OCITimeSS', rffi.INT),
    ])
    OCIDate = platform.Struct('OCIDate', [
        ('OCIDateYYYY', rffi.INT),
        ('OCIDateMM', rffi.INT),
        ('OCIDateDD', rffi.INT),
        ('OCIDateTime', OCITime),
    ])

    defines = '''
    OCI_ATTR_SERVER OCI_ATTR_SESSION OCI_ATTR_USERNAME OCI_ATTR_PASSWORD
    OCI_ATTR_STMT_TYPE OCI_ATTR_PARAM OCI_ATTR_PARAM_COUNT OCI_ATTR_ROW_COUNT
    OCI_ATTR_NAME OCI_ATTR_INTERNAL_NAME OCI_ATTR_EXTERNAL_NAME
    OCI_ATTR_SCALE OCI_ATTR_PRECISION OCI_ATTR_IS_NULL
    OCI_ATTR_DATA_SIZE OCI_ATTR_DATA_TYPE OCI_ATTR_REF_TDO
    OCI_ATTR_SCHEMA_NAME OCI_ATTR_TYPE_NAME OCI_ATTR_TYPECODE
    OCI_ATTR_NUM_TYPE_ATTRS OCI_ATTR_LIST_TYPE_ATTRS
    OCI_ATTR_COLLECTION_ELEMENT OCI_ATTR_MAXDATA_SIZE
    OCI_ATTR_CHARSET_FORM OCI_ATTR_CHARSET_ID OCI_ATTR_ENV_CHARSET_ID
    OCI_ATTR_PARSE_ERROR_OFFSET
    OCI_ATTR_SPOOL_OPEN_COUNT OCI_ATTR_SPOOL_BUSY_COUNT OCI_ATTR_SPOOL_TIMEOUT
    OCI_ATTR_SPOOL_GETMODE OCI_ATTR_PURITY OCI_ATTR_CONNECTION_CLASS
    OCI_ATTR_PURITY_DEFAULT
    SQLT_CHR SQLT_LNG SQLT_AFC SQLT_RDD SQLT_BIN SQLT_LBI SQLT_LVC SQLT_LVB
    SQLT_BFLOAT SQLT_IBFLOAT SQLT_BDOUBLE SQLT_IBDOUBLE
    SQLT_NUM SQLT_VNU SQLT_DAT SQLT_ODT SQLT_DATE SQLT_TIMESTAMP
    SQLT_TIMESTAMP_TZ SQLT_TIMESTAMP_LTZ SQLT_INTERVAL_DS
    SQLT_CLOB SQLT_CLOB SQLT_BLOB SQLT_BFILE SQLT_RSET SQLT_NTY
    '''.split()

    constants = '''
    OCI_DEFAULT OCI_OBJECT OCI_THREADED OCI_EVENTS
    OCI_SUCCESS OCI_SUCCESS_WITH_INFO OCI_INVALID_HANDLE OCI_NO_DATA
    OCI_HTYPE_ERROR OCI_HTYPE_SVCCTX OCI_HTYPE_SERVER OCI_HTYPE_SESSION
    OCI_HTYPE_STMT OCI_HTYPE_DESCRIBE OCI_HTYPE_BIND OCI_HTYPE_DEFINE
    OCI_HTYPE_ENV OCI_HTYPE_SPOOL OCI_HTYPE_AUTHINFO 
    OCI_DTYPE_PARAM OCI_DTYPE_TIMESTAMP OCI_DTYPE_INTERVAL_DS OCI_DTYPE_LOB
    OCI_CRED_RDBMS OCI_CRED_EXT OCI_SPOOL_ATTRVAL_NOWAIT
    OCI_NTV_SYNTAX OCI_COMMIT_ON_SUCCESS
    OCI_FETCH_NEXT
    OCI_IND_NULL OCI_IND_NOTNULL
    OCI_PIN_ANY OCI_LOCK_NONE OCI_OBJECTFREE_FORCE
    OCI_OTYPE_PTR OCI_PTYPE_TYPE
    OCI_STMT_SELECT OCI_STMT_CREATE OCI_STMT_DROP OCI_STMT_ALTER
    OCI_STMT_INSERT OCI_STMT_DELETE OCI_STMT_UPDATE
    SQLCS_IMPLICIT SQLCS_NCHAR
    OCI_TEMP_CLOB OCI_TEMP_BLOB OCI_DURATION_SESSION OCI_ONE_PIECE
    OCI_NUMBER_SIGNED
    OCI_TYPECODE_CHAR OCI_TYPECODE_VARCHAR OCI_TYPECODE_VARCHAR2
    OCI_TYPECODE_NUMBER OCI_TYPECODE_DATE OCI_TYPECODE_TIMESTAMP
    OCI_TYPECODE_NAMEDCOLLECTION OCI_TYPECODE_OBJECT
    OCI_NLS_MAXBUFSZ OCI_NLS_CS_ORA_TO_IANA OCI_UTF16ID
    OCI_SPC_STMTCACHE OCI_SPC_HOMOGENEOUS
    OCI_SESSGET_SPOOL OCI_SESSGET_CREDPROXY OCI_SESSGET_STMTCACHE
    OCI_SESSGET_CREDEXT OCI_SESSRLS_DROPSESS
    '''.split()

    for c in defines:
        locals()[c] = platform.DefinedConstantInteger(c)
    for c in constants:
        locals()[c] = platform.ConstantInteger(c)

    INT_MAX = platform.ConstantInteger('INT_MAX')
示例#22
0
class CConfigure:
    _compilation_info_ = eci
    XML_Content = rffi_platform.Struct('XML_Content', [
        ('numchildren', rffi.UINT),
        ('children', XML_Content_Ptr),
        ('name', rffi.CCHARP),
        ('type', rffi.INT),
        ('quant', rffi.INT),
    ])
    XML_Encoding = rffi_platform.Struct('XML_Encoding', [
        ('map', rffi.CFixedArray(rffi.INT, 1)),
        ('data', rffi.VOIDP),
        ('convert', rffi.VOIDP),
        ('release', rffi.VOIDP),
    ])
    for name in ['XML_PARAM_ENTITY_PARSING_NEVER',
                 'XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE',
                 'XML_PARAM_ENTITY_PARSING_ALWAYS']:
        locals()[name] = rffi_platform.ConstantInteger(name)
    XML_MAJOR_VERSION = rffi_platform.ConstantInteger('XML_MAJOR_VERSION')
    XML_MINOR_VERSION = rffi_platform.ConstantInteger('XML_MINOR_VERSION')
    XML_MICRO_VERSION = rffi_platform.ConstantInteger('XML_MICRO_VERSION')
    XML_FALSE = rffi_platform.ConstantInteger('XML_FALSE')
    XML_TRUE = rffi_platform.ConstantInteger('XML_TRUE')

    for name in xml_error_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    for name in xml_model_list:
        locals()[name] = rffi_platform.ConstantInteger(name)
    XML_Parser_SIZE = rffi_platform.SizeOf("XML_Parser")
示例#23
0
    class CConfig:
        _compilation_info_ = ExternalCompilationInfo(
            includes=['windows.h', 'winbase.h', 'sys/stat.h'], )
        WIN32_FIND_DATA = platform.Struct(
            'struct _WIN32_FIND_DATA' + suffix,
            # Only interesting fields
            [('dwFileAttributes', rwin32.DWORD),
             ('nFileSizeHigh', rwin32.DWORD), ('nFileSizeLow', rwin32.DWORD),
             ('ftCreationTime', rwin32.FILETIME),
             ('ftLastAccessTime', rwin32.FILETIME),
             ('ftLastWriteTime', rwin32.FILETIME),
             ('cFileName', lltype.FixedSizeArray(traits.CHAR, 250))])
        ERROR_FILE_NOT_FOUND = platform.ConstantInteger('ERROR_FILE_NOT_FOUND')
        ERROR_NO_MORE_FILES = platform.ConstantInteger('ERROR_NO_MORE_FILES')

        GetFileExInfoStandard = platform.ConstantInteger(
            'GetFileExInfoStandard')
        FILE_ATTRIBUTE_DIRECTORY = platform.ConstantInteger(
            'FILE_ATTRIBUTE_DIRECTORY')
        FILE_ATTRIBUTE_READONLY = platform.ConstantInteger(
            'FILE_ATTRIBUTE_READONLY')
        INVALID_FILE_ATTRIBUTES = platform.ConstantInteger(
            'INVALID_FILE_ATTRIBUTES')
        ERROR_SHARING_VIOLATION = platform.ConstantInteger(
            'ERROR_SHARING_VIOLATION')
        _S_IFDIR = platform.ConstantInteger('_S_IFDIR')
        _S_IFREG = platform.ConstantInteger('_S_IFREG')
        _S_IFCHR = platform.ConstantInteger('_S_IFCHR')
        _S_IFIFO = platform.ConstantInteger('_S_IFIFO')
        FILE_TYPE_UNKNOWN = platform.ConstantInteger('FILE_TYPE_UNKNOWN')
        FILE_TYPE_CHAR = platform.ConstantInteger('FILE_TYPE_CHAR')
        FILE_TYPE_PIPE = platform.ConstantInteger('FILE_TYPE_PIPE')

        WIN32_FILE_ATTRIBUTE_DATA = platform.Struct(
            'WIN32_FILE_ATTRIBUTE_DATA',
            [('dwFileAttributes', rwin32.DWORD),
             ('nFileSizeHigh', rwin32.DWORD), ('nFileSizeLow', rwin32.DWORD),
             ('ftCreationTime', rwin32.FILETIME),
             ('ftLastAccessTime', rwin32.FILETIME),
             ('ftLastWriteTime', rwin32.FILETIME)])

        BY_HANDLE_FILE_INFORMATION = platform.Struct(
            'BY_HANDLE_FILE_INFORMATION',
            [('dwFileAttributes', rwin32.DWORD),
             ('nFileSizeHigh', rwin32.DWORD), ('nFileSizeLow', rwin32.DWORD),
             ('nNumberOfLinks', rwin32.DWORD),
             ('nFileIndexHigh', rwin32.DWORD), ('nFileIndexLow', rwin32.DWORD),
             ('ftCreationTime', rwin32.FILETIME),
             ('ftLastAccessTime', rwin32.FILETIME),
             ('ftLastWriteTime', rwin32.FILETIME)])
示例#24
0
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(includes=['float.h'])

    DBL_MAX = rffi_platform.DefinedConstantDouble('DBL_MAX')
    DBL_MIN = rffi_platform.DefinedConstantDouble('DBL_MIN')
    DBL_MANT_DIG = rffi_platform.ConstantInteger('DBL_MANT_DIG')
示例#25
0
文件: rzlib.py 项目: xx312022850/pypy
    """
    Definitions for basic types defined by zlib.
    """
    _compilation_info_ = eci

    # XXX If Z_PREFIX was defined for the libz build, then these types are
    # named z_uInt, z_uLong, and z_Bytef instead.
    uInt = rffi_platform.SimpleType('uInt', rffi.UINT)
    uLong = rffi_platform.SimpleType('uLong', rffi.ULONG)
    Bytef = rffi_platform.SimpleType('Bytef', rffi.UCHAR)
    voidpf = rffi_platform.SimpleType('voidpf', rffi.VOIDP)

    ZLIB_VERSION = rffi_platform.DefinedConstantString('ZLIB_VERSION')

for _name in constantnames:
    setattr(SimpleCConfig, _name, rffi_platform.ConstantInteger(_name))

config = rffi_platform.configure(SimpleCConfig)
voidpf = config['voidpf']
uInt = config['uInt']
uLong = config['uLong']
Bytef = config['Bytef']
Bytefp = lltype.Ptr(lltype.Array(Bytef, hints={'nolength': True}))

ZLIB_VERSION = config['ZLIB_VERSION']

for _name in constantnames:
    globals()[_name] = config[_name]

# The following parameter is copied from zutil.h, version 0.95,
# according to CPython's zlibmodule.c
示例#26
0
 class CConfig:
     _compilation_info_ = eci
     PROV_RSA_FULL = rffi_platform.ConstantInteger("PROV_RSA_FULL")
     CRYPT_VERIFYCONTEXT = rffi_platform.ConstantInteger(
         "CRYPT_VERIFYCONTEXT")
示例#27
0
class CConfig:
    _compilation_info_ = eci

    if WIN32:
        DWORD_PTR = rffi_platform.SimpleType("DWORD_PTR", rffi.LONG)
        WORD = rffi_platform.SimpleType("WORD", rffi.UINT)
        DWORD = rffi_platform.SimpleType("DWORD", rffi.UINT)
        BOOL = rffi_platform.SimpleType("BOOL", rffi.LONG)
        BYTE = rffi_platform.SimpleType("BYTE", rffi.UCHAR)
        WCHAR = rffi_platform.SimpleType("WCHAR", rffi.UCHAR)
        INT = rffi_platform.SimpleType("INT", rffi.INT)
        LONG = rffi_platform.SimpleType("LONG", rffi.LONG)
        PLONG = rffi_platform.SimpleType("PLONG", rffi.LONGP)
        LPVOID = rffi_platform.SimpleType("LPVOID", rffi.INTP)
        LPCVOID = rffi_platform.SimpleType("LPCVOID", rffi.VOIDP)
        LPSTR = rffi_platform.SimpleType("LPSTR", rffi.CCHARP)
        LPCSTR = rffi_platform.SimpleType("LPCSTR", rffi.CCHARP)
        LPWSTR = rffi_platform.SimpleType("LPWSTR", rffi.CWCHARP)
        LPCWSTR = rffi_platform.SimpleType("LPCWSTR", rffi.CWCHARP)
        LPDWORD = rffi_platform.SimpleType("LPDWORD", rffi.UINTP)
        SIZE_T = rffi_platform.SimpleType("SIZE_T", rffi.SIZE_T)
        ULONG_PTR = rffi_platform.SimpleType("ULONG_PTR", rffi.ULONG)

        HRESULT = rffi_platform.SimpleType("HRESULT", rffi.LONG)
        HLOCAL = rffi_platform.SimpleType("HLOCAL", rffi.VOIDP)

        FILETIME = rffi_platform.Struct('FILETIME',
                                        [('dwLowDateTime', rffi.UINT),
                                         ('dwHighDateTime', rffi.UINT)])
        SYSTEMTIME = rffi_platform.Struct('SYSTEMTIME',
                                          [])

        OSVERSIONINFOEX = rffi_platform.Struct(
            'OSVERSIONINFOEX',
            [('dwOSVersionInfoSize', rffi.UINT),
             ('dwMajorVersion', rffi.UINT),
             ('dwMinorVersion', rffi.UINT),
             ('dwBuildNumber',  rffi.UINT),
             ('dwPlatformId',  rffi.UINT),
             ('szCSDVersion', rffi.CFixedArray(lltype.Char, 1)),
             ('wServicePackMajor', rffi.USHORT),
             ('wServicePackMinor', rffi.USHORT),
             ('wSuiteMask', rffi.USHORT),
             ('wProductType', rffi.UCHAR),
         ])

        LPSECURITY_ATTRIBUTES = rffi_platform.SimpleType(
            "LPSECURITY_ATTRIBUTES", rffi.CCHARP)

        DEFAULT_LANGUAGE = rffi_platform.ConstantInteger(
            "MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)")

        defines = """FORMAT_MESSAGE_ALLOCATE_BUFFER FORMAT_MESSAGE_FROM_SYSTEM
                       MAX_PATH
                       WAIT_OBJECT_0 WAIT_TIMEOUT INFINITE
                       ERROR_INVALID_HANDLE
                       DELETE READ_CONTROL SYNCHRONIZE WRITE_DAC
                       WRITE_OWNER PROCESS_ALL_ACCESS
                       PROCESS_CREATE_PROCESS PROCESS_CREATE_THREAD
                       PROCESS_DUP_HANDLE PROCESS_QUERY_INFORMATION
                       PROCESS_SET_QUOTA
                       PROCESS_SUSPEND_RESUME PROCESS_TERMINATE
                       PROCESS_VM_OPERATION PROCESS_VM_READ
                       PROCESS_VM_WRITE
                       CTRL_C_EVENT CTRL_BREAK_EVENT
                    """
        from pypy.translator.platform import host_factory
        static_platform = host_factory()
        if static_platform.name == 'msvc':
            defines += ' PROCESS_QUERY_LIMITED_INFORMATION' 
        for name in defines.split():
            locals()[name] = rffi_platform.ConstantInteger(name)
示例#28
0

constants = {}
if _POSIX:
    # constants, look in sys/mman.h and platform docs for the meaning
    # some constants are linux only so they will be correctly exposed outside
    # depending on the OS
    constant_names = [
        'MAP_SHARED', 'MAP_PRIVATE', 'PROT_READ', 'PROT_WRITE', 'MS_SYNC'
    ]
    opt_constant_names = [
        'MAP_ANON', 'MAP_ANONYMOUS', 'PROT_EXEC', 'MAP_DENYWRITE',
        'MAP_EXECUTABLE'
    ]
    for name in constant_names:
        setattr(CConfig, name, rffi_platform.ConstantInteger(name))
    for name in opt_constant_names:
        setattr(CConfig, name, rffi_platform.DefinedConstantInteger(name))

    CConfig.MREMAP_MAYMOVE = (
        rffi_platform.DefinedConstantInteger("MREMAP_MAYMOVE"))
    CConfig.has_mremap = rffi_platform.Has('mremap(NULL, 0, 0, 0)')
    # a dirty hack, this is probably a macro

elif _MS_WINDOWS:
    constant_names = [
        'PAGE_READONLY', 'PAGE_READWRITE', 'PAGE_WRITECOPY', 'FILE_MAP_READ',
        'FILE_MAP_WRITE', 'FILE_MAP_COPY', 'DUPLICATE_SAME_ACCESS',
        'MEM_COMMIT', 'MEM_RESERVE', 'MEM_RELEASE', 'PAGE_EXECUTE_READWRITE'
    ]
    for name in constant_names:
示例#29
0
    ("fd", rffi.INT),
])
CConfig.epoll_event = rffi_platform.Struct("struct epoll_event",
                                           [("events", rffi.UINT),
                                            ("data", CConfig.epoll_data)])

public_symbols = [
    "EPOLLIN", "EPOLLOUT", "EPOLLPRI", "EPOLLERR", "EPOLLHUP", "EPOLLET",
    "EPOLLONESHOT", "EPOLLRDNORM", "EPOLLRDBAND", "EPOLLWRNORM", "EPOLLWRBAND",
    "EPOLLMSG"
]
for symbol in public_symbols:
    setattr(CConfig, symbol, rffi_platform.DefinedConstantInteger(symbol))

for symbol in ["EPOLL_CTL_ADD", "EPOLL_CTL_MOD", "EPOLL_CTL_DEL"]:
    setattr(CConfig, symbol, rffi_platform.ConstantInteger(symbol))

cconfig = rffi_platform.configure(CConfig)

epoll_event = cconfig["epoll_event"]
EPOLL_CTL_ADD = cconfig["EPOLL_CTL_ADD"]
EPOLL_CTL_MOD = cconfig["EPOLL_CTL_MOD"]
EPOLL_CTL_DEL = cconfig["EPOLL_CTL_DEL"]

epoll_create = rffi.llexternal("epoll_create", [rffi.INT],
                               rffi.INT,
                               compilation_info=eci)
epoll_ctl = rffi.llexternal(
    "epoll_ctl", [rffi.INT, rffi.INT, rffi.INT,
                  lltype.Ptr(epoll_event)],
    rffi.INT,
示例#30
0
def add_simple_type(type_name):
    for name in ['size', 'alignment', 'type']:
        setattr(CConfig, type_name + '_' + name,
            rffi_platform.ConstantInteger(type_name + '.' + name))