def test_ensure_apiname(): cases = [ (('Joan', 'joan.cpp'), apiname('Joan', ('joan.cpp', ), 'joan', 'Joan', (), ('joan.py', ), 'c++')), (('Joan', ['joan.h', 'joan.cpp'], 'pyjoan'), apiname('Joan', ('joan.h', 'joan.cpp'), 'pyjoan', 'Joan', ('joan.h', ), ('joan.py', ), 'c++')), (('Joan', ('joan.h', 'j*.c'), 'pyjoan', 'PyJoan'), apiname('Joan', ('joan.h', 'joan.c'), 'pyjoan', 'PyJoan', ('joan.h', ), ('joan.py', ), 'c')), ([ 'Joan', 'joan*', 'pyjoan', 'PyJoan', NotSpecified, ('phone.py', ), 'python' ], apiname('Joan', ('joan.c', 'joan.cpp', 'joan.h', 'joan.py'), 'pyjoan', 'PyJoan', ('joan.h', ), ('phone.py', ), 'python')), ({ 'srcname': 'Joan', 'srcfiles': 'joan.h', 'language': 'C' }, apiname('Joan', ('joan.h', ), 'joan', 'Joan', ('joan.h', ), ('joan.py', ), 'c')), (apiname('Joan', 'joan.cpp', 'pyjoan', 'PyJoan', None, ('loan.py', ), None), apiname('Joan', ('joan.cpp', ), 'pyjoan', 'PyJoan', (), (), 'c++')), (apiname('Joan', ('joan.cpp', ), 'pyjoan', NotSpecified, ('hdf5.h', ), (), NotSpecified), apiname('Joan', ('joan.cpp', ), 'pyjoan', 'Joan', ('hdf5.h', ), (), 'c++')), ] for x, exp in cases: yield check_ensure_apiname, x, exp
def test_ensure_apiname(): cases = [ (('Joan', 'joan'), apiname('Joan', 'joan', 'joan', 'Joan')), (('Joan', 'joan', 'pyjoan'), apiname('Joan', 'joan', 'pyjoan', 'Joan')), (('Joan', 'joan', 'pyjoan', 'PyJoan'), apiname('Joan', 'joan', 'pyjoan', 'PyJoan')), (['Joan', 'joan', 'pyjoan', 'PyJoan'], apiname('Joan', 'joan', 'pyjoan', 'PyJoan')), ({'srcname': 'Joan', 'srcfile': 'joan'}, apiname('Joan', 'joan', 'joan', 'Joan')), (apiname('Joan', 'joan', 'pyjoan', 'PyJoan'), apiname('Joan', 'joan', 'pyjoan', 'PyJoan')), (apiname('Joan', 'joan', 'pyjoan', NotSpecified), apiname('Joan', 'joan', 'pyjoan', 'Joan')), ] for x, exp in cases: yield check_ensure_apiname, x, exp
def test_ensure_apiname(): cases = [ (('Joan', 'joan'), apiname('Joan', 'joan', 'joan', 'Joan')), (('Joan', 'joan', 'pyjoan'), apiname('Joan', 'joan', 'pyjoan', 'Joan')), (('Joan', 'joan', 'pyjoan', 'PyJoan'), apiname('Joan', 'joan', 'pyjoan', 'PyJoan')), (['Joan', 'joan', 'pyjoan', 'PyJoan'], apiname('Joan', 'joan', 'pyjoan', 'PyJoan')), ({ 'srcname': 'Joan', 'srcfile': 'joan' }, apiname('Joan', 'joan', 'joan', 'Joan')), (apiname('Joan', 'joan', 'pyjoan', 'PyJoan'), apiname('Joan', 'joan', 'pyjoan', 'PyJoan')), (apiname('Joan', 'joan', 'pyjoan', NotSpecified), apiname('Joan', 'joan', 'pyjoan', 'Joan')), ] for x, exp in cases: yield check_ensure_apiname, x, exp
def test_ensure_apiname(): cases = [ (("Joan", "joan.cpp"), apiname("Joan", ("joan.cpp",), "joan", "Joan", (), ("joan.py",), "c++")), ( ("Joan", ["joan.h", "joan.cpp"], "pyjoan"), apiname("Joan", ("joan.h", "joan.cpp"), "pyjoan", "Joan", ("joan.h",), ("joan.py",), "c++"), ), ( ("Joan", ("joan.h", "j*.c"), "pyjoan", "PyJoan"), apiname("Joan", ("joan.h", "joan.c"), "pyjoan", "PyJoan", ("joan.h",), ("joan.py",), "c"), ), ( ["Joan", "joan*", "pyjoan", "PyJoan", NotSpecified, ("phone.py",), "python"], apiname( "Joan", ("joan.c", "joan.cpp", "joan.h", "joan.py"), "pyjoan", "PyJoan", ("joan.h",), ("phone.py",), "python", ), ), ( {"srcname": "Joan", "srcfiles": "joan.h", "language": "C"}, apiname("Joan", ("joan.h",), "joan", "Joan", ("joan.h",), ("joan.py",), "c"), ), ( apiname("Joan", "joan.cpp", "pyjoan", "PyJoan", None, ("loan.py",), None), apiname("Joan", ("joan.cpp",), "pyjoan", "PyJoan", (), (), "c++"), ), ( apiname("Joan", ("joan.cpp",), "pyjoan", NotSpecified, ("hdf5.h",), (), NotSpecified), apiname("Joan", ("joan.cpp",), "pyjoan", "Joan", ("hdf5.h",), (), "c++"), ), ] for x, exp in cases: yield check_ensure_apiname, x, exp
def test_ensure_apiname(): cases = [ (('Joan', 'joan.cpp'), apiname('Joan', ('joan.cpp',), 'joan', 'Joan', (), ('joan.py',), 'c++')), (('Joan', ['joan.h', 'joan.cpp'], 'pyjoan'), apiname('Joan', ('joan.h', 'joan.cpp'), 'pyjoan', 'Joan', ('joan.h',), ('joan.py',), 'c++')), (('Joan', ('joan.h', 'j*.c'), 'pyjoan', 'PyJoan'), apiname('Joan', ('joan.h', 'joan.c'), 'pyjoan', 'PyJoan', ('joan.h',), ('joan.py',), 'c')), (['Joan', 'joan*', 'pyjoan', 'PyJoan', NotSpecified, ('phone.py',), 'python'], apiname('Joan', ('joan.c', 'joan.cpp', 'joan.h', 'joan.py'), 'pyjoan', 'PyJoan', ('joan.h',), ('phone.py',), 'python')), ({'srcname': 'Joan', 'srcfiles': 'joan.h', 'language': 'C'}, apiname('Joan', ('joan.h',), 'joan', 'Joan', ('joan.h',), ('joan.py',), 'c')), (apiname('Joan', 'joan.cpp', 'pyjoan', 'PyJoan', None, ('loan.py',), None), apiname('Joan', ('joan.cpp',), 'pyjoan', 'PyJoan', (), (), 'c++')), (apiname('Joan', ('joan.cpp',), 'pyjoan', NotSpecified, ('hdf5.h',), (), NotSpecified), apiname('Joan', ('joan.cpp',), 'pyjoan', 'Joan', ('hdf5.h',), (), 'c++')), ] for x, exp in cases: yield check_ensure_apiname, x, exp
'GENERATE_LATEX': True # Could be 'YES' or True } doxyfile_name = './build/tally_doxyfile' extra_types = 'extra_types' # non-default value stlcontainers = [ ('set', 'str'), ('set', 'int32'), ('map', 'str', 'str'), ('map', 'str', 'int32'), ('map', 'int32', 'str'), ('map', 'str', 'uint32'), ('map', 'uint32', 'str'), ('map', 'str', 'float64'), ('map', 'uint32', 'uint32'), ('map', 'int32', 'int32'), ('map', 'int32', 'float64'), ('map', 'int32', 'complex'), ('map', 'uint32', 'float64'), ('map', 'str', ('vector', 'float64')), ('map', 'int32', ('vector', 'float64')), ] #stlcontainers_module = 'stlcontainers' classes = [apiname('Tally', 'cpp/tally.*', incfiles='tally.h')] functions = []
'xdress.extratypes') extra_types = 'cproj_extra_types' # non-default value _fromsrcdir = lambda x: os.path.join('src', x) _inbasics = { 'srcfiles': _fromsrcdir('basics*'), 'incfiles': 'basics.h', } _indiscovery = { 'srcfiles': _fromsrcdir('discovery*'), 'incfiles': 'discovery.h', } variables = [ apiname('PersonID', tarbase='pybasics', **_inbasics), apiname('*', **_indiscovery), ] functions = [ apiname('voided', **_inbasics), { 'srcname': 'func0', 'tarname': 'a_better_name', 'srcfiles': _fromsrcdir('basics*'), 'incfiles': 'basics.h', }, apiname('func1', **_inbasics), apiname('func2', **_inbasics), apiname('func3', **_inbasics), apiname('func4', tarbase='pybasics', **_inbasics),
plugins = ('xdress.autoall', 'xdress.pep8names', 'xdress.cythongen', 'xdress.extratypes') _fromsrcdir = lambda x: os.path.join('src', x) _fromgpu = {'srcfiles': _fromsrcdir('*.cu'), 'language': 'c'} _incommon = {'srcfiles': _fromsrcdir('common*'), 'incfiles': 'common.h', 'language': 'c' } variables = [ apiname('*', **_incommon) ] # stlcontainers = [ # ('vector', 'str'), # ('set', 'uint'), # ('map', 'int', 'float'), # ] # will be used later, but need to be present now # classes = [] functions = [ apiname('constructDebruijnGraphDevice',**_fromgpu), apiname('findComponentDevice',**_fromgpu), apiname('encodeLmer',**_fromgpu), apiname('encodeLmerComplement',**_fromgpu),
dtypes_module = 'dt' stlcontainers_module = 'stlc' _fromsrcdir = lambda x: os.path.join('src', x) _inbasics = {'srcfiles': _fromsrcdir('basics.[ch]*'), 'incfiles': 'basics.hpp', # trick to get around cython generating *.h 'language': 'c++', } _indiscovery = {'srcfiles': _fromsrcdir('discovery*'), 'incfiles': 'discovery.h', 'language': 'c++', } variables = [ apiname('PersonID', tarbase='pybasics', **_inbasics), apiname('*', **_indiscovery), ] functions = [ apiname('voided', **_inbasics), apiname('call_with_void_fp_struct', **_inbasics), {'srcname': 'func0', 'tarname': 'a_better_name', 'incfiles': 'basics.h', 'srcfiles': _fromsrcdir('basics.[ch]*')}, apiname('func1', **_inbasics), apiname('func2', **_inbasics), apiname('func3', **_inbasics), apiname('func4', tarbase='pybasics', **_inbasics), apiname(('findmin', 'int32', 'float32',), **_inbasics),
stlcontainers_module = 'stlc' _fromsrcdir = lambda x: os.path.join('src', x) _inbasics = { 'srcfiles': _fromsrcdir('basics.[ch]*'), 'incfiles': 'basics.hpp', # trick to get around cython generating *.h 'language': 'c++', } _indiscovery = { 'srcfiles': _fromsrcdir('discovery*'), 'incfiles': 'discovery.h', 'language': 'c++', } variables = [ apiname('PersonID', tarbase='pybasics', **_inbasics), apiname('*', **_indiscovery), ] functions = [ apiname('voided', **_inbasics), apiname('call_with_void_fp_struct', **_inbasics), { 'srcname': 'func0', 'tarname': 'a_better_name', 'incfiles': 'basics.h', 'srcfiles': _fromsrcdir('basics.[ch]*') }, apiname('func1', **_inbasics), apiname('func2', **_inbasics), apiname('func3', **_inbasics),
from xdress.utils import apiname package = 'dag_slicer' # top-level python package name packagedir = 'dag_slicer' # loation of the python package #plugins = ('xdress.stlwrap', 'xdress.cythongen', # 'xdress.autodescribe', 'xdress.autoall') extra_types = 'xdress_extra_types' stlcontainers = [ ('vector', 'str'), ('vector', 'int'), ('vector', ('vector', 'int')), ('vector', 'float'), ('vector', ('vector', 'float')), ] classes = [ apiname('Dag_Slicer', ['src/dag_slicer.hpp', 'src/dag_slicer.cpp'], incfiles='dag_slicer.hpp', language='c++'), ]
plugins = ('xdress.autoall', 'xdress.pep8names', 'xdress.cythongen', 'xdress.extratypes') extra_types = 'cproj_extra_types' # non-default value _fromsrcdir = lambda x: os.path.join('src', x) _inbasics = {'srcfiles': _fromsrcdir('basics*'), 'incfiles': 'basics.h', } _indiscovery = {'srcfiles': _fromsrcdir('discovery*'), 'incfiles': 'discovery.h', } variables = [ apiname('PersonID', tarbase='pybasics', **_inbasics), apiname('*', **_indiscovery), ] functions = [ apiname('voided', **_inbasics), {'srcname': 'func0', 'tarname': 'a_better_name', 'srcfiles': _fromsrcdir('basics*'), 'incfiles': 'basics.h', }, apiname('func1', **_inbasics), apiname('func2', **_inbasics), apiname('func3', **_inbasics), apiname('func4', tarbase='pybasics', **_inbasics), apiname('call_threenums_op_from_c', tarbase='pybasics', **_inbasics),
'b2VelocityConstraintPoint', 'b2Version', 'b2WeldJointDef', 'b2WheelJointDef', 'b2WorldManifold', 'b2WorldQueryWrapper', 'b2WorldRayCastWrapper', ] stlcontainers = [] dtypes_module = 'dt' stlcontainers_module = 'stlc' variables = [] functions = [] classes = [ # Structs apiname(srcname='b2AABB', tarname='BoxTwoAABB', **_api_name_kwargs('Collision/b2Collision*')), apiname(srcname='b2Block', tarname='BoxTwoBlock', **_api_name_kwargs('Common/b2BlockAllocator*')), apiname(srcname='b2BodyDef', tarname='BoxTwoBodyDef', **_api_name_kwargs('Dynamics/b2Body*')), apiname(srcname='b2Chunk', tarname='BoxTwoChunk', **_api_name_kwargs('Common/b2BlockAllocator*')), apiname(srcname='b2ClipVertex', tarname='BoxTwoClipVertex', **_api_name_kwargs('Collision/b2Collision*')), apiname(srcname='b2Color', tarname='BoxTwoColor', **_api_name_kwargs('Common/b2Draw*')), apiname(srcname='b2ContactEdge', tarname='BoxTwoContactEdge', **_api_name_kwargs('Dynamics/Contacts/b2Contact*')), apiname(srcname='b2ContactFeature', tarname='BoxTwoContactFeature', **_api_name_kwargs('Collision/b2Collision*')), apiname(srcname='b2ContactID', tarname='BoxTwoContactID',
package = 'iwrf' packagedir = 'iwrf' from xdress.utils import DEFAULT_PLUGINS from xdress.utils import apiname plugins = list(DEFAULT_PLUGINS) + ['xdress.autoall',] #xdress.autoall.clang_includes = ('../include',) classes = [apiname('iwrf_ts_processing', ('../iwrf_lib/iwrf_functions.c'), incfiles='../include/iwrf_functions.h'), apiname('iwrf_packet_info', ('../iwrf_lib/iwrf_functions.c'), incfiles='../include/iwrf_data.h')] functions = [apiname('iwrf_ts_processing_init',('../iwrf_lib/iwrf_functions.c'), incfiles= '../include/iwrf_functions.h')]
} doxyfile_name = './build/tally_doxyfile' extra_types = 'extra_types' # non-default value stlcontainers = [ ('set', 'str'), ('set', 'int32'), ('map', 'str', 'str'), ('map', 'str', 'int32'), ('map', 'int32', 'str'), ('map', 'str', 'uint32'), ('map', 'uint32', 'str'), ('map', 'str', 'float64'), ('map', 'uint32', 'uint32'), ('map', 'int32', 'int32'), ('map', 'int32', 'float64'), ('map', 'int32', 'complex'), ('map', 'uint32', 'float64'), ('map', 'str', ('vector', 'float64')), ('map', 'int32', ('vector', 'float64')), ] #stlcontainers_module = 'stlcontainers' classes = [apiname('Tally','cpp/tally.*',incfiles='tally.h')] functions = []
] stlcontainers_module = 'stlc' _fromsrcdir = lambda x: os.path.join('src', x) _inbasics = {'srcfiles': _fromsrcdir('basics.[ch]*'), 'incfiles': 'basics.h', 'language': 'c++', } _indiscovery = {'srcfiles': _fromsrcdir('discovery*'), 'incfiles': 'discovery.h', 'language': 'c++', } variables = [ apiname('PersonID', tarbase='pybasics', **_inbasics), apiname('*', **_indiscovery), ] functions = [ apiname('voided', **_inbasics), {'srcname': 'func0', 'tarname': 'a_better_name', 'incfiles': 'basics.h', 'srcfiles': _fromsrcdir('basics.[ch]*')}, apiname('func1', **_inbasics), apiname('func2', **_inbasics), apiname('func3', **_inbasics), apiname('func4', tarbase='pybasics', **_inbasics), apiname(('findmin', 'int32', 'float32',), **_inbasics), apiname(('findmin', 'float64', 'float32',), **_inbasics),
'cdef int i{var}\n' 'cdef int {var}_size\n' 'cdef {t.cython_npctypes[0]} * {var}_data\n' '{var}_size = len({var})\n' 'if isinstance({var}, np.ndarray) and (<np.ndarray> {var}).descr.type_num == {t.cython_nptype}:\n' ' {var}_data = <{t.cython_npctypes[0]} *> np.PyArray_DATA(<np.ndarray> {var})\n' ' {proxy_name} = {t.cython_ctype}(<size_t> {var}_size)\n' ' for i{var} in range({var}_size):\n' ' {proxy_name}[i{var}] = {var}_data[i{var}]\n' 'else:\n' ' {proxy_name} = {t.cython_ctype}(<size_t> {var}_size)\n' ' for i{var} in range({var}_size):\n' ' {proxy_name}[i{var}] = <{t.cython_npctypes[0]}> {var}[i{var}]\n' ), ('{proxy_name}') ) # register_class(name=None, template_args=None, cython_c_type=None, cython_cimport=None, cython_cy_type=None, cython_py_type=None, cython_template_class_name=None, cython_template_function_name=None, cython_cyimport=None, cython_pyimport=None, cython_c2py=None, cython_py2c=None, cpp_type=None, human_name=None, from_pytype=None)[source]¶ ts.register_class('Matrix', template_args=('t', 'x', 'y'), cython_c_type='eigen_matrix', cython_cimport=('eigen.matrix', 'Matrix', 'eigen_matrix'), cython_cy_type='np.ndarray', cython_py_type='np.ndarray', cython_template_class_name='Matrix{t}', cython_template_function_name='matrix_{t}', cython_cyimport=(('numpy', 'as', 'np'), ('{dtypes}',)), cython_pyimport=('numpy', 'as', 'np'), cython_c2py=c2py, cython_py2c=py2c, cpp_type='Eigen::Matrix') classes = [ apiname('EigenTest', **_incore) ] #del ts
from xdress.utils import apiname package = 'mypack' # top-level python package name packagedir = 'mypack' # loation of the python package stlcontainers = [ ('vector', 'str'), ('set', 'uint'), ('map', 'int', 'float'), ] classes = [ apiname('A', ('src/hoover.h', 'src/hoover.cpp'), incfiles='hoover.h'), apiname('B', ('src/hoover.h', 'src/hoover.cpp'), 'hoover_b', incfiles='hoover.h'), ] functions = [apiname('do_nothing_ab', ('src/hoover.h', 'src/hoover.cpp'), 'hoover_b', incfiles='hoover.h')]
from xdress.utils import apiname package = 'mypack' # top-level python package name packagedir = 'mypack' # loation of the python package extra_types = 'mypack_extra_types' stlcontainers = [ ('vector', 'str'), ('set', 'uint'), ('map', 'int', 'float'), ] classes = [ apiname('A', ('src/hoover.h', 'src/hoover.cpp'), incfiles='hoover.h'), apiname('B', ('src/hoover.h', 'src/hoover.cpp'), 'hoover_b', incfiles='hoover.h'), ] functions = [ apiname('do_nothing_ab', ('src/hoover.h', 'src/hoover.cpp'), 'hoover_b', incfiles='hoover.h') ]
'Vehicle', 'btAlignedObjectArray', 'btContactConstraint', # Excluded because they were causing xdress problems 'Gimpact', 'Featherstone', 'vectormath', 'MiniCL', 'Bullet-C-Api.h', 'BulletSoftBody', # Just to simplify things while I'm getting it to work ] def contains_excluded(path): for e in EXCLUDES: if e in path: return True return False INCLUDE_DIRS = [s[0] for s in os.walk(SOURCE_DIR) if not contains_excluded(s)] + [np.get_include()] ALL_FILES = [] [ALL_FILES.extend(os.path.join(d[0], f) for f in d[2]) for d in os.walk(SOURCE_DIR)] for f in ALL_FILES[:]: if contains_excluded(f): ALL_FILES.remove(f) SOURCE_FILES = [f for f in ALL_FILES if f.endswith('.cpp')] INC_FILES = [f for f in ALL_FILES if f.endswith('.h')] # execution includes = [SOURCE_DIR] package = PACKAGE_NAME # top-level python package name packagedir = PACKAGE_NAME # location of the python package # TODO: The incfiles is blank (for now) API_NAMES = [apiname('*', (f, f.replace('.cpp', '.h')), incfiles=[], language="c++") for f in SOURCE_FILES] extra_types = 'extra_types' stlcontainers = [] classes = API_NAMES functions = API_NAMES
('vector', 'ExNode'), ('vector', 'ExArc'), ('vector', ('vector', 'int')), ('map', 'int', 'float'), ('map', 'int', 'int'), ('map', 'int', 'bool'), ('map', 'int', ('vector', 'int')), ('map', 'int', ('vector', 'float')), ('map', 'int', ('vector', ('vector', 'int'))), ('map', 'int', ('map', 'int', ('vector', 'float'))), ('pair', 'int', 'int'), ] includes = [ os.path.expanduser('~/.local/include/cyclus'), '/usr/include/boost', ] classes = [ apiname('ProbSolution', 'cpp/problem.*', incfiles='problem.h', tarbase='_cproblem'), apiname('Solver', 'cpp/problem.*', incfiles='problem.h', tarbase='_cproblem'), apiname('ExGroup', 'cpp/exchange_instance.*', incfiles='exchange_instance.h'), apiname('ExNode', 'cpp/exchange_instance.*', incfiles='exchange_instance.h'), apiname('ExArc', 'cpp/exchange_instance.*', incfiles='exchange_instance.h'), apiname('ExSolution', 'cpp/exchange_instance.*', incfiles='exchange_instance.h'), ] functions = [ apiname('Run', 'cpp/exchange_instance.*', incfiles='exchange_instance.h'), ]
from xdress.utils import apiname package = 'memleak' # top-level python package name extra_types = 'extra_types' stlcontainers = [ ('vector', 'int'), ] classes = [ apiname('Hollow', 'hollow.*', incfiles='hollow.h'), ]
"GENERATE_LATEX": True, # Could be 'YES' or True } doxyfile_name = "./build/tally_doxyfile" includes = ["/mnt/data/opt/dagmc/hdf5/include"] extra_types = "extra_types" # non-default value stlcontainers = [ ("set", "str"), ("set", "int32"), ("map", "str", "str"), ("map", "str", "int32"), ("map", "int32", "str"), ("map", "str", "uint32"), ("map", "uint32", "str"), ("map", "str", "float64"), ("map", "uint32", "uint32"), ("map", "int32", "int32"), ("map", "int32", "float64"), ("map", "int32", "complex"), ("map", "uint32", "float64"), ("map", "str", ("vector", "float64")), ("map", "int32", ("vector", "float64")), ] # stlcontainers_module = 'stlcontainers' classes = [apiname("Tally", "src/tally.*", incfiles="tally.h")]