コード例 #1
0
                              ('num_fields', rffi.INT))
FIELD_S = rffi.CStruct('_cffi_field_s', ('name', rffi.CCHARP),
                       ('field_offset', rffi.SIZE_T),
                       ('field_size', rffi.SIZE_T),
                       ('field_type_op', _CFFI_OPCODE_T))
ENUM_S = rffi.CStruct('_cffi_enum_s', ('name', rffi.CCHARP),
                      ('type_index', rffi.INT), ('type_prim', rffi.INT),
                      ('enumerators', rffi.CCHARP))
TYPENAME_S = rffi.CStruct('_cffi_typename_s', ('name', rffi.CCHARP),
                          ('type_index', rffi.INT))

PCTX = rffi.CStructPtr(
    '_cffi_type_context_s', ('types', rffi.VOIDPP),
    ('globals', rffi.CArrayPtr(GLOBAL_S)), ('fields', rffi.CArrayPtr(FIELD_S)),
    ('struct_unions', rffi.CArrayPtr(STRUCT_UNION_S)),
    ('enums', rffi.CArrayPtr(ENUM_S)),
    ('typenames', rffi.CArrayPtr(TYPENAME_S)), ('num_globals', rffi.INT),
    ('num_struct_unions', rffi.INT), ('num_enums', rffi.INT),
    ('num_typenames', rffi.INT), ('includes', rffi.CCHARPP),
    ('num_types', rffi.INT), ('flags', rffi.INT))

PINFO = rffi.CStructPtr('_cffi_parse_info_s', ('ctx', PCTX),
                        ('output', rffi.VOIDPP), ('output_size', rffi.UINT),
                        ('error_location', rffi.SIZE_T),
                        ('error_message', rffi.CCHARP))

PEXTERNPY = rffi.CStructPtr('_cffi_externpy_s', ('name', rffi.CCHARP),
                            ('size_of_result', rffi.SIZE_T),
                            ('reserved1', rffi.VOIDP),
                            ('reserved2', rffi.VOIDP))
コード例 #2
0
ファイル: ll_termios.py プロジェクト: sota/pypy-old
c_config = rffi_platform.configure(CConfig)
NCCS = c_config['NCCS']

TCFLAG_T = rffi.UINT
CC_T = rffi.UCHAR
SPEED_T = rffi.UINT
INT = rffi.INT

_add = []
if c_config['_HAVE_STRUCT_TERMIOS_C_ISPEED']:
    _add.append(('c_ispeed', SPEED_T))
if c_config['_HAVE_STRUCT_TERMIOS_C_OSPEED']:
    _add.append(('c_ospeed', SPEED_T))
TERMIOSP = rffi.CStructPtr('termios', ('c_iflag', TCFLAG_T),
                           ('c_oflag', TCFLAG_T), ('c_cflag', TCFLAG_T),
                           ('c_lflag', TCFLAG_T), ('c_line', CC_T),
                           ('c_cc', lltype.FixedSizeArray(CC_T, NCCS)), *_add)


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


c_tcsetattr = c_external('tcsetattr', [INT, INT, TERMIOSP], INT)
c_cfgetispeed = c_external('cfgetispeed', [TERMIOSP], SPEED_T)
c_cfgetospeed = c_external('cfgetospeed', [TERMIOSP], SPEED_T)
c_cfsetispeed = c_external('cfsetispeed', [TERMIOSP, SPEED_T], INT)
c_cfsetospeed = c_external('cfsetospeed', [TERMIOSP, SPEED_T], INT)
c_tcsendbreak = c_external('tcsendbreak', [INT, INT], INT)
c_tcdrain = c_external('tcdrain', [INT], INT)
c_tcflush = c_external('tcflush', [INT, INT], INT)
コード例 #3
0
from sota.constants import LIBDIR, PYPYDIR, CLIDIR
sys.path.insert(0, PYPYDIR)

from rpython.rtyper.lltypesystem import rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo

cli_eci = ExternalCompilationInfo(include_dirs=[CLIDIR],
                                  includes=['cli.h'],
                                  library_dirs=[LIBDIR],
                                  libraries=['cli'],
                                  use_cpp_linker=True)
CliToken = rffi.CStruct('CliToken', ('name', rffi.CCHARP),
                        ('value', rffi.CCHARP))
CliTokenPtr = rffi.CArrayPtr(CliToken)
CliTokensPtr = rffi.CStructPtr('CliTokens', ('count', rffi.LONG),
                               ('tokens', CliTokenPtr))
c_parse = rffi.llexternal('parse', [rffi.LONG, rffi.CCHARPP],
                          CliTokensPtr,
                          compilation_info=cli_eci)
c_clean = rffi.llexternal('clean', [CliTokensPtr],
                          rffi.LONG,
                          compilation_info=cli_eci)

#class CliParseError(Exception):
#    '''
#    CliParseError
#    '''
#    def __init__(self, result):
#        '''
#        init
#        '''
コード例 #4
0
ファイル: revdb.py プロジェクト: soIu/rpython
        n += 1
    assert i == len(breakpoints)


# ____________________________________________________________

## @specialize.arg(2)
## def _change_time(mode, time, callback):
##     ll_callback = llhelper(_CALLBACK_NOARG_FNPTR, callback)
##     llop.revdb_change_time(lltype.Void, mode, time, ll_callback)
## _CALLBACK_NOARG_FNPTR = lltype.Ptr(lltype.FuncType([], lltype.Void))
_CALLBACK_GCREF_FNPTR = lltype.Ptr(
    lltype.FuncType([llmemory.GCREF], lltype.Void))
_CMDPTR = rffi.CStructPtr('rpy_revdb_command_s', ('cmd', rffi.INT),
                          ('arg1', lltype.SignedLongLong),
                          ('arg2', lltype.SignedLongLong),
                          ('arg3', lltype.SignedLongLong),
                          hints={'ignore_revdb': True})


class RegisterDebugCommand(ExtRegistryEntry):
    _about_ = register_debug_command

    def compute_result_annotation(self, s_command_num, s_lambda_func):
        command_num = s_command_num.const
        lambda_func = s_lambda_func.const
        assert isinstance(command_num, (int, str))
        t = self.bookkeeper.annotator.translator
        if t.config.translation.reverse_debugger:
            func = lambda_func()
            try: