class CConfig: _compilation_info_ = ExternalCompilationInfo( pre_include_lines=[ "/* a C comment */", "#include <stdio.h>", "#include <test_ctypes_platform.h>" ], include_dirs=[str(configdir)]) FILE = configure.Struct('FILE', []) ushort = configure.SimpleType('unsigned short') XYZZY = configure.ConstantInteger('XYZZY')
class CConfig: _compilation_info_ = ExternalCompilationInfo(post_include_lines=[ '/* a C comment */', '#define XYZZY 42', 'typedef int foo;', 'struct s {', 'int i;', 'double f;' '};' ]) s = configure.Struct('struct s', [('i', ctypes.c_int)], ifdef='XYZZY') z = configure.Struct('struct z', [('i', ctypes.c_int)], ifdef='FOOBAR') foo = configure.SimpleType('foo', ifdef='XYZZY') bar = configure.SimpleType('bar', ifdef='FOOBAR')
class CConfig: _compilation_info_ = ExternalCompilationInfo(post_include_lines=""" struct x { int foo; unsigned long bar; }; struct y { char c; struct x x; }; """.split("\n")) x = configure.Struct("struct x", [("bar", ctypes.c_short)]) y = configure.Struct("struct y", [("x", x)])
class CConfig: _compilation_info_ = ExternalCompilationInfo( pre_include_lines = ["/* a C comment */", "#include <stdio.h>", "#include <test_ctypes_platform2.h>"], include_dirs = [str(configdir)] ) FILE = configure.Struct('FILE', []) ushort = configure.SimpleType('unsigned short') XYZZY = configure.ConstantInteger('XYZZY') XUZ = configure.Has('XUZ') large = configure.DefinedConstantInteger('large') undef = configure.Defined('really_undefined')
def eci_from_header(c_header_source): return ExternalCompilationInfo( pre_include_lines=c_header_source.split("\n"))
def test_sizeof(): assert configure.sizeof("char", ExternalCompilationInfo()) == 1
def test_check_eci(): eci = ExternalCompilationInfo() assert configure.check_eci(eci) eci = ExternalCompilationInfo(libraries=['some_name_that_doesnt_exist_']) assert not configure.check_eci(eci)