Exemple #1
0
class CConfig:
    _compilation_info_ = eci
    TIMEVAL = rffi_platform.Struct('struct timeval', [('tv_sec', rffi.INT),
                                                      ('tv_usec', rffi.INT)])
    HAVE_GETTIMEOFDAY = rffi_platform.Has('gettimeofday')
    HAVE_FTIME = rffi_platform.Has(FTIME)
    if need_rusage:
        RUSAGE = rffi_platform.Struct('struct rusage', [('ru_utime', TIMEVAL),
                                                        ('ru_stime', TIMEVAL)])
Exemple #2
0
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes=includes
    )
    TIMEVAL = platform.Struct('struct timeval', [('tv_sec', rffi.INT),
                                                 ('tv_usec', rffi.INT)])
    HAVE_GETTIMEOFDAY = platform.Has('gettimeofday')
    HAVE_FTIME = platform.Has(FTIME)
    if need_rusage:
        RUSAGE = platform.Struct('struct rusage', [('ru_utime', TIMEVAL),
                                                   ('ru_stime', TIMEVAL)])
Exemple #3
0
class CConfig:
    _compilation_info_ = eci
    calling_conv = 'c'

    CHECK_LIBRARY = platform.Has('dump("x", (long)&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),
    ])
Exemple #4
0
class CConfigForClockGetTime:
    _compilation_info_ = ExternalCompilationInfo(includes=['time.h'],
                                                 libraries=libraries)
    _NO_MISSING_RT = rffi_platform.Has('printf("%d", clock_gettime(0, 0))')
    TIMESPEC = rffi_platform.Struct('struct timespec',
                                    [('tv_sec', rffi.LONG),
                                     ('tv_nsec', rffi.LONG)])
Exemple #5
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')
class CConfig:
    includes = ['locale.h', 'limits.h', 'ctype.h', 'wchar.h']
    libraries = libraries

    if HAVE_LANGINFO:
        includes += ['langinfo.h']
    if HAVE_LIBINTL:
        includes += ['libintl.h']
    if sys.platform == 'win32':
        includes += ['windows.h']
    _compilation_info_ = ExternalCompilationInfo(includes=includes,
                                                 libraries=libraries)
    HAVE_BIND_TEXTDOMAIN_CODESET = platform.Has('bind_textdomain_codeset')
    lconv = platform.Struct(
        "struct lconv",
        [
            # Numeric (non-monetary) information.
            ("decimal_point", rffi.CCHARP),  # Decimal point character.
            ("thousands_sep", rffi.CCHARP),  # Thousands separator.

            ## Each element is the number of digits in each group;
            ## elements with higher indices are farther left.
            ## An element with value CHAR_MAX means that no further grouping is done.
            ## An element with value 0 means that the previous element is used
            ## for all groups farther left.  */
            ("grouping", rffi.CCHARP),

            ## Monetary information.

            ## First three chars are a currency symbol from ISO 4217.
            ## Fourth char is the separator.  Fifth char is '\0'.
            ("int_curr_symbol", rffi.CCHARP),
            ("currency_symbol", rffi.CCHARP),  # Local currency symbol.
            ("mon_decimal_point", rffi.CCHARP),  # Decimal point character.
            ("mon_thousands_sep", rffi.CCHARP),  # Thousands separator.
            ("mon_grouping", rffi.CCHARP),  # Like `grouping' element (above).
            ("positive_sign", rffi.CCHARP),  # Sign for positive values.
            ("negative_sign", rffi.CCHARP),  # Sign for negative values.
            ("int_frac_digits", rffi.UCHAR),  # Int'l fractional digits.
            ("frac_digits", rffi.UCHAR),  # Local fractional digits.
            ## 1 if currency_symbol precedes a positive value, 0 if succeeds.
            ("p_cs_precedes", rffi.UCHAR),
            ## 1 iff a space separates currency_symbol from a positive value.
            ("p_sep_by_space", rffi.UCHAR),
            ## 1 if currency_symbol precedes a negative value, 0 if succeeds.
            ("n_cs_precedes", rffi.UCHAR),
            ## 1 iff a space separates currency_symbol from a negative value.
            ("n_sep_by_space", rffi.UCHAR),

            ## Positive and negative sign positions:
            ## 0 Parentheses surround the quantity and currency_symbol.
            ## 1 The sign string precedes the quantity and currency_symbol.
            ## 2 The sign string follows the quantity and currency_symbol.
            ## 3 The sign string immediately precedes the currency_symbol.
            ## 4 The sign string immediately follows the currency_symbol.
            ("p_sign_posn", rffi.UCHAR),
            ("n_sign_posn", rffi.UCHAR),
        ])
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes=['fcntl.h', 'sys/file.h', 'sys/ioctl.h'])
    flock = platform.Struct("struct flock", [('l_start', rffi.LONGLONG),
                                             ('l_len', rffi.LONGLONG),
                                             ('l_pid', rffi.LONG),
                                             ('l_type', rffi.SHORT),
                                             ('l_whence', rffi.SHORT)])
    has_flock = platform.Has('flock')
 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.DefinedConstantInteger('SEM_VALUE_MAX')
     SEM_TIMED_WAIT = platform.Has('sem_timedwait')
     SEM_T_SIZE = platform.SizeOf('sem_t')
Exemple #9
0
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes=["time.h"],
        libraries=libraries,
    )

    HAS_CLOCK_GETTIME = rffi_platform.Has('clock_gettime')

    CLOCK_REALTIME = rffi_platform.DefinedConstantInteger("CLOCK_REALTIME")
    CLOCK_MONOTONIC = rffi_platform.DefinedConstantInteger("CLOCK_MONOTONIC")
    CLOCK_MONOTONIC_RAW = rffi_platform.DefinedConstantInteger(
        "CLOCK_MONOTONIC_RAW")
    CLOCK_PROCESS_CPUTIME_ID = rffi_platform.DefinedConstantInteger(
        "CLOCK_PROCESS_CPUTIME_ID")
    CLOCK_THREAD_CPUTIME_ID = rffi_platform.DefinedConstantInteger(
        "CLOCK_THREAD_CPUTIME_ID")
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(includes=['dirent.h'])
    HAVE_DIRENT_H = platform.Has("opendir")
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(
        includes=['unistd.h', 'sys/syscall.h', 'sys/stat.h'])
    HAVE_SYS_SYSCALL_H = platform.Has("syscall")
    HAVE_SYS_STAT_H = platform.Has("stat")
    HAVE_SETSID = platform.Has("setsid")
Exemple #12
0
 class CConfig:
     _compilation_info_ = compilation_info
     HAS_LOCAL_MALLOC = rffi_platform.Has("GC_local_malloc")
Exemple #13
0
    # some constants are linux only so they will be correctly exposed outside
    # depending on the OS
    constant_names = ['MAP_SHARED', 'MAP_PRIVATE', 'MAP_FIXED',
                      'PROT_READ', 'PROT_WRITE',
                      'MS_SYNC']
    opt_constant_names = ['MAP_ANON', 'MAP_ANONYMOUS', 'MAP_NORESERVE',
                          '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', 'PAGE_NOACCESS']
    for name in constant_names:
        setattr(CConfig, name, rffi_platform.ConstantInteger(name))

    from rpython.rlib import rwin32

    from rpython.rlib.rwin32 import HANDLE, LPHANDLE
    from rpython.rlib.rwin32 import NULL_HANDLE, INVALID_HANDLE_VALUE
    from rpython.rlib.rwin32 import DWORD, WORD, DWORD_PTR, LPDWORD
Exemple #14
0
 class CConfig:
     _compilation_info_ = eci
     HAS = rffi_platform.Has("setupterm")
class CConfig:
    _compilation_info_ = ExternalCompilationInfo(includes=_includes,
                                                 libraries=rtime.libraries)
    CLOCKS_PER_SEC = platform.ConstantInteger("CLOCKS_PER_SEC")
    has_gettimeofday = platform.Has('gettimeofday')
Exemple #16
0
    ('h_addrtype', rffi.INT),
    ('h_length', rffi.INT),
    ('h_addr_list', rffi.CCHARPP),
])

CConfig.servent = platform.Struct('struct servent', [
    ('s_name', CCHARP),
    ('s_port', rffi.INT),
    ('s_proto', CCHARP),
])

CConfig.protoent = platform.Struct('struct protoent', [
    ('p_proto', rffi.INT),
])

CConfig.HAVE_ACCEPT4 = platform.Has('accept4')

if _POSIX:
    CConfig.nfds_t = platform.SimpleType('nfds_t')
    CConfig.pollfd = platform.Struct('struct pollfd',
                                     [('fd', socketfd_type),
                                      ('events', rffi.SHORT),
                                      ('revents', rffi.SHORT)])

    if _HAS_AF_PACKET:
        CConfig.sockaddr_ll = platform.Struct(
            'struct sockaddr_ll',
            [('sll_family', rffi.INT), ('sll_ifindex', rffi.INT),
             ('sll_protocol', rffi.INT), ('sll_pkttype', rffi.INT),
             ('sll_hatype', rffi.INT),
             ('sll_addr', rffi.CFixedArray(rffi.CHAR, 8)),
Exemple #17
0
    constant_names = [
        'MAP_SHARED', 'MAP_PRIVATE', 'MAP_FIXED', 'PROT_READ', 'PROT_WRITE',
        'MS_SYNC'
    ]
    opt_constant_names = [
        'MAP_ANON', 'MAP_ANONYMOUS', 'MAP_NORESERVE', '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)')
    CConfig.has_madvise = rffi_platform.Has('madvise(NULL, 0, 0)')
    # ^^ both are a dirty hack, this is probably a macro

    CConfig.MADV_DONTNEED = (
        rffi_platform.DefinedConstantInteger('MADV_DONTNEED'))
    CConfig.MADV_FREE = (rffi_platform.DefinedConstantInteger('MADV_FREE'))

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',
        'PAGE_NOACCESS', 'MEM_RESET'
    ]
    for name in constant_names: