当前位置: 首页>>代码示例>>Python>>正文


Python LowLevelDatabase.gettype方法代码示例

本文整理汇总了Python中pypy.translator.c.database.LowLevelDatabase.gettype方法的典型用法代码示例。如果您正苦于以下问题:Python LowLevelDatabase.gettype方法的具体用法?Python LowLevelDatabase.gettype怎么用?Python LowLevelDatabase.gettype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.translator.c.database.LowLevelDatabase的用法示例。


在下文中一共展示了LowLevelDatabase.gettype方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_typedef

# 需要导入模块: from pypy.translator.c.database import LowLevelDatabase [as 别名]
# 或者: from pypy.translator.c.database.LowLevelDatabase import gettype [as 别名]
def test_typedef():
    A = Typedef(Signed, 'test4')
    db = LowLevelDatabase()
    assert db.gettype(A) == "test4 @"

    PA = CArrayPtr(A)
    assert db.gettype(PA) == "test4 *@"

    F = FuncType((A,), A)
    assert db.gettype(F) == "test4 (@)(test4)"
开发者ID:ieure,项目名称:pypy,代码行数:12,代码来源:test_database.py

示例2: generate_macro_wrapper

# 需要导入模块: from pypy.translator.c.database import LowLevelDatabase [as 别名]
# 或者: from pypy.translator.c.database.LowLevelDatabase import gettype [as 别名]
def generate_macro_wrapper(name, macro, functype, eci):
    """Wraps a function-like macro inside a real function, and expose
    it with llexternal."""

    # Generate the function call
    from pypy.translator.c.database import LowLevelDatabase
    from pypy.translator.c.support import cdecl
    wrapper_name = 'pypy_macro_wrapper_%s' % (name,)
    argnames = ['arg%d' % (i,) for i in range(len(functype.ARGS))]
    db = LowLevelDatabase()
    implementationtypename = db.gettype(functype, argnames=argnames)
    if functype.RESULT is lltype.Void:
        pattern = '%s { %s(%s); }'
    else:
        pattern = '%s { return %s(%s); }'
    source = pattern % (
        cdecl(implementationtypename, wrapper_name),
        macro, ', '.join(argnames))

    # Now stuff this source into a "companion" eci that will be used
    # by ll2ctypes.  We replace eci._with_ctypes, so that only one
    # shared library is actually compiled (when ll2ctypes calls the
    # first function)
    ctypes_eci = eci.merge(ExternalCompilationInfo(
            separate_module_sources=[source],
            export_symbols=[wrapper_name],
            ))
    if hasattr(eci, '_with_ctypes'):
        ctypes_eci = eci._with_ctypes.merge(ctypes_eci)
    eci._with_ctypes = ctypes_eci
    func = llexternal(wrapper_name, functype.ARGS, functype.RESULT,
                      compilation_info=eci, _nowrapper=True)
    # _nowrapper=True returns a pointer which is not hashable
    return lambda *args: func(*args)
开发者ID:,项目名称:,代码行数:36,代码来源:

示例3: test_intlong_unique

# 需要导入模块: from pypy.translator.c.database import LowLevelDatabase [as 别名]
# 或者: from pypy.translator.c.database.LowLevelDatabase import gettype [as 别名]
def test_intlong_unique():
    A = INT_real
    B = Signed
    db = LowLevelDatabase()
    assert db.gettype(A) == "int @"
    assert db.gettype(B) == "long @"
开发者ID:ieure,项目名称:pypy,代码行数:8,代码来源:test_database.py

示例4: test_voidp

# 需要导入模块: from pypy.translator.c.database import LowLevelDatabase [as 别名]
# 或者: from pypy.translator.c.database.LowLevelDatabase import gettype [as 别名]
def test_voidp():
    A = VOIDP
    db = LowLevelDatabase()
    assert db.gettype(A) == "void *@"
开发者ID:ieure,项目名称:pypy,代码行数:6,代码来源:test_database.py


注:本文中的pypy.translator.c.database.LowLevelDatabase.gettype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。