[pypy-commit] pypy py3.5: hg merge default
arigo
pypy.commits at gmail.com
Sat Oct 7 09:11:07 EDT 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r92621:e1232edfd557
Date: 2017-10-06 04:26 +0200
http://bitbucket.org/pypy/pypy/changeset/e1232edfd557/
Log: hg merge default
diff too long, truncating to 2000 out of 8213 lines
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -40,3 +40,7 @@
2875f328eae2216a87f3d6f335092832eb031f56 release-pypy3.5-v5.7.1
c925e73810367cd960a32592dd7f728f436c125c release-pypy2.7-v5.8.0
a37ecfe5f142bc971a86d17305cc5d1d70abec64 release-pypy3.5-v5.8.0
+03d614975835870da65ff0481e1edad68ebbcb8d release-pypy2.7-v5.9.0
+d72f9800a42b46a8056951b1da2426d2c2d8d502 release-pypy3.5-v5.9.0
+03d614975835870da65ff0481e1edad68ebbcb8d release-pypy2.7-v5.9.0
+84a2f3e6a7f88f2fe698e473998755b3bd1a12e2 release-pypy2.7-v5.9.0
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -3,13 +3,6 @@
===========================
.. this is a revision shortly after release-pypy2.7-v5.9.0
-.. startrev:899e5245de1e
+.. startrev:d56dadcef996
-.. branch: cpyext-jit
-Differentiate the code to call METH_NOARGS, METH_O and METH_VARARGS in cpyext:
-this allows to write specialized code which is much faster than previous
-completely generic version. Moreover, let the JIT to look inside the cpyext
-module: the net result is that cpyext calls are up to 7x faster. However, this
-is true only for very simple situations: in all real life code, we are still
-much slower than CPython (more optimizations to come)
diff --git a/pypy/doc/whatsnew-pypy2-5.9.0.rst b/pypy/doc/whatsnew-pypy2-5.9.0.rst
--- a/pypy/doc/whatsnew-pypy2-5.9.0.rst
+++ b/pypy/doc/whatsnew-pypy2-5.9.0.rst
@@ -85,3 +85,12 @@
.. branch: py_ssize_t
Explicitly use Py_ssize_t as the Signed type in pypy c-api
+
+.. branch: cpyext-jit
+
+Differentiate the code to call METH_NOARGS, METH_O and METH_VARARGS in cpyext:
+this allows to write specialized code which is much faster than previous
+completely generic version. Moreover, let the JIT to look inside the cpyext
+module: the net result is that cpyext calls are up to 7x faster. However, this
+is true only for very simple situations: in all real life code, we are still
+much slower than CPython (more optimizations to come)
diff --git a/pypy/module/_cppyy/__init__.py b/pypy/module/_cppyy/__init__.py
--- a/pypy/module/_cppyy/__init__.py
+++ b/pypy/module/_cppyy/__init__.py
@@ -1,12 +1,10 @@
from pypy.interpreter.mixedmodule import MixedModule
class Module(MixedModule):
- "This module provides runtime bindings to C++ code for which reflection\n\
- info has been generated. Current supported back-ends are Reflex and CINT.\n\
- See http://doc.pypy.org/en/latest/cppyy.html for full details."
+ "This module brigdes the cppyy frontend with its backend, through PyPy.\n\
+ See http://cppyy.readthedocs.io/en/latest for full details."
interpleveldefs = {
- '_load_dictionary' : 'interp_cppyy.load_dictionary',
'_resolve_name' : 'interp_cppyy.resolve_name',
'_scope_byname' : 'interp_cppyy.scope_byname',
'_template_byname' : 'interp_cppyy.template_byname',
@@ -15,14 +13,13 @@
'_set_function_generator': 'interp_cppyy.set_function_generator',
'_register_class' : 'interp_cppyy.register_class',
'_get_nullptr' : 'interp_cppyy.get_nullptr',
- 'CPPInstanceBase' : 'interp_cppyy.W_CPPInstance',
+ 'CPPClassBase' : 'interp_cppyy.W_CPPClass',
'addressof' : 'interp_cppyy.addressof',
'bind_object' : 'interp_cppyy.bind_object',
}
appleveldefs = {
'_init_pythonify' : 'pythonify._init_pythonify',
- 'load_reflection_info' : 'pythonify.load_reflection_info',
'add_pythonization' : 'pythonify.add_pythonization',
'Template' : 'pythonify.CPPTemplate',
}
diff --git a/pypy/module/_cppyy/backend/create_cppyy_package.py b/pypy/module/_cppyy/backend/create_cppyy_package.py
deleted file mode 100755
--- a/pypy/module/_cppyy/backend/create_cppyy_package.py
+++ /dev/null
@@ -1,649 +0,0 @@
-#!/usr/bin/env python
-from __future__ import print_function
-
-import os, sys
-import argparse, re, shutil, tarfile, urllib2
-
-
-DEBUG_TESTBUILD = False
-
-TARBALL_CACHE_DIR = 'releases'
-
-ROOT_KEEP = ['build', 'cmake', 'config', 'core', 'etc', 'interpreter',
- 'io', 'LICENSE', 'net', 'Makefile', 'CMakeLists.txt', 'math',
- 'main'] # main only needed in more recent root b/c of rootcling
-ROOT_CORE_KEEP = ['CMakeLists.txt', 'base', 'clib', 'clingutils', 'cont',
- 'dictgen', 'foundation', 'lzma', 'macosx', 'meta',
- 'metacling', 'metautils', 'rootcling_stage1', 'textinput',
- 'thread', 'unix', 'utils', 'winnt', 'zip']
-ROOT_IO_KEEP = ['CMakeLists.txt', 'io', 'rootpcm']
-ROOT_NET_KEEP = ['CMakeLists.txt', 'net']
-ROOT_MATH_KEEP = ['CMakeLists.txt', 'mathcore']
-ROOT_ETC_KEEP = ['Makefile.arch', 'class.rules', 'cmake', 'dictpch',
- 'gdb-backtrace.sh', 'gitinfo.txt', 'helgrind-root.supp',
- 'hostcert.conf', 'system.plugins-ios',
- 'valgrind-root-python.supp', 'valgrind-root.supp', 'vmc']
-
-ROOT_EXPLICIT_REMOVE = ['core/base/v7', 'math/mathcore/v7', 'io/io/v7']
-
-
-ERR_RELEASE_NOT_FOUND = 2
-
-
-#
-## CLI arguments
-#
-class ReleaseValidation(argparse.Action):
- def __call__(self, parser, namespace, value, option_string=None):
- if not re.match(r'6\.\d\d\.\d\d', value):
- raise argparse.ArgumentTypeError(
- "release number should of the form '6.dd.dd'")
- setattr(namespace, self.dest, value)
- return value
-
-parser = argparse.ArgumentParser(
- description='Build PyPi package for cppyy containing the minimum of ROOT')
-parser.add_argument('-r', '--release', type=str, nargs='?',
- action=ReleaseValidation, help='ROOT release to use')
-
-args = parser.parse_args()
-
-
-#
-## ROOT source pull and cleansing
-#
-def clean_directory(directory, keeplist, trim_cmake=True):
- removed_entries = []
- for entry in os.listdir(directory):
- if entry[0] == '.' or entry in keeplist:
- continue
- removed_entries.append(entry)
- entry = os.path.join(directory, entry)
- print('now removing', entry)
- if os.path.isdir(entry):
- shutil.rmtree(entry)
- else:
- os.remove(entry)
-
- if not trim_cmake:
- return
-
- # now take the removed entries out of the CMakeLists.txt
- if removed_entries:
- inp = os.path.join(directory, 'CMakeLists.txt')
- print('trimming', inp)
- outp = inp+'.new'
- new_cml = open(outp, 'w')
- for line in open(inp).readlines():
- if ('add_subdirectory' in line) or\
- ('COMMAND' in line and 'copy' in line) or\
- ('ROOT_ADD_TEST_SUBDIRECTORY' in line) or\
- ('install(DIRECTORY' in line):
- for sub in removed_entries:
- if sub in line:
- line = '#'+line
- break
- new_cml.write(line)
- new_cml.close()
- os.rename(outp, inp)
- else:
- print('reusing existing %s/CMakeLists.txt' % (directory,))
-
-
-class ReleaseValidation(argparse.Action):
- def __call__(self, parser, namespace, value, option_string=None):
- if not re.match(r'6\.\d\d\.\d\d', value):
- raise argparse.ArgumentTypeError(
- "release number should of the form '6.dd.dd'")
- setattr(namespace, self.dest, value)
- return value
-
-parser = argparse.ArgumentParser(
- description='Build PyPi package for cppyy containing the minimum of ROOT')
-parser.add_argument('-r', '--release', type=str, nargs='?',
- action=ReleaseValidation, help='ROOT release to use')
-
-args = parser.parse_args()
-
-if not os.path.exists(TARBALL_CACHE_DIR):
- os.mkdir(TARBALL_CACHE_DIR)
-
-if args.release:
- # use provided release
- fn = 'root_v%s.source.tar.gz' % args.release
- addr = 'https://root.cern.ch/download/'+fn
- if not os.path.exists(os.path.join(TARBALL_CACHE_DIR, fn)):
- try:
- print('retrieving', fn)
- resp = urllib2.urlopen(addr, fn)
- out = open(os.path.join(TARBALL_CACHE_DIR, fn), 'wb')
- out.write(resp.read())
- out.close()
- except urllib2.HTTPError:
- print('release %s not found' % args.release)
- sys.exit(ERR_RELEASE_NOT_FOUND)
- else:
- print('reusing', fn, 'from local directory')
-else:
- print('provide release ... getting latest release is not yet implemented ...')
- sys.exit(1)
- # get latest and set fn, args.release, etc.
-
-# construct version for package
-args.version = ''
-testnext = False
-for c in args.release:
- if testnext:
- testnext = False
- if c == '0':
- continue
- if c == '.':
- testnext = True
- args.version += c
-args.version += '.0'
-
-fn = os.path.join(TARBALL_CACHE_DIR, fn)
-pkgdir = os.path.join('root-'+args.release)
-if not os.path.exists(pkgdir):
- print('now extracting', args.release)
- tf = tarfile.TarFile.gzopen(fn)
- tf.extractall()
- tf.close()
-else:
- print('reusing existing directory', pkgdir)
-
-# remove everything except for the listed set of libraries
-os.chdir(pkgdir)
-
-clean_directory(os.path.curdir, ROOT_KEEP)
-clean_directory('core', ROOT_CORE_KEEP)
-clean_directory('etc', ROOT_ETC_KEEP, trim_cmake=False)
-clean_directory('io', ROOT_IO_KEEP)
-clean_directory('math', ROOT_MATH_KEEP)
-clean_directory('net', ROOT_NET_KEEP)
-
-
-# trim main (only need rootcling)
-print('trimming main')
-for entry in os.listdir('main/src'):
- if entry != 'rootcling.cxx':
- os.remove('main/src/'+entry)
-inp = 'main/CMakeLists.txt'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
- if ('ROOT_EXECUTABLE' in line or\
- 'SET_TARGET_PROPERTIES' in line) and\
- not 'rootcling' in line:
- line = '#'+line
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-
-# remove afterimage and ftgl explicitly
-print('trimming externals')
-for cmf in ['AfterImage', 'FTGL']:
- os.remove('cmake/modules/Find%s.cmake' % (cmf,))
-inp = 'cmake/modules/SearchInstalledSoftware.cmake'
-outp = inp+'.new'
-now_stripping = False
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
- if '#---Check for ftgl if needed' == line[0:28] or\
- '#---Check for AfterImage' == line[0:24]:
- now_stripping = True
- elif '#---Check' == line[0:9]:
- now_stripping = False
- if now_stripping:
- line = '#'+line
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-inp = 'cmake/modules/RootBuildOptions.cmake'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
- if 'ROOT_BUILD_OPTION(builtin_ftgl' in line or\
- 'ROOT_BUILD_OPTION(builtin_afterimage' in line:
- line = '#'+line
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-
-# remove testing and examples
-print('trimming testing')
-inp = 'CMakeLists.txt'
-outp = inp+'.new'
-now_stripping = False
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
- if '#---Configure Testing using CTest' == line[0:33] or\
- '#---hsimple.root' == line[0:16]:
- now_stripping = True
- elif '#---Packaging' == line[0:13] or\
- '#---version' == line[0:11]:
- now_stripping = False
- if now_stripping:
- line = '#'+line
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-print('trimming RootCPack')
-inp = 'cmake/modules/RootCPack.cmake'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp):
- if 'README.txt' in line:
- line = '#'+line
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-# some more explicit removes:
-for dir_to_remove in ROOT_EXPLICIT_REMOVE:
- try:
- shutil.rmtree(dir_to_remove)
- except OSError:
- pass
-
-# special fixes
-inp = 'core/base/src/TVirtualPad.cxx'
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp):
- if '#include "X3DBuffer.h"' == line[0:22]:
- line = """//#include "X3DBuffer.h"
-typedef struct _x3d_sizeof_ {
- int numPoints;
- int numSegs;
- int numPolys;
-} Size3D;
-"""
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-inp = 'math/mathcore/src/Fitter.cxx'
-if os.path.exists(inp):
- outp = inp+'.new'
- new_cml = open(outp, 'w')
- for line in open(inp):
- if '#include "TF1.h"' in line:
- continue
- new_cml.write(line)
- new_cml.close()
- os.rename(outp, inp)
-
-# done
-os.chdir(os.path.pardir)
-
-# debugging: run a test build
-if DEBUG_TESTBUILD:
- print('running a debug test build')
- tb = "test_builddir"
- if os.path.exists(tb):
- shutil.rmtree(tb)
- os.mkdir(tb)
- os.chdir(tb)
- os.system('cmake ../%s -DCMAKE_INSTALL_PREFIX=../install -Dminimal=ON -Dasimage=OFF' % pkgdir)
- os.system('make -j 32')
-
-
-#
-## package creation
-#
-countdown = 0
-pidir = 'Package-'+args.release
-print('creating package', pidir)
-if not os.path.exists(pidir):
- os.mkdir(pidir)
-os.chdir(pidir); countdown += 1
-
-print('creating LICENSE.txt')
-with open('LICENSE.txt', 'w') as outp:
- outp.write("""There are three main parts:
-
- LLVM: distributed under University of Illinois/NCSA Open Source License
- https://opensource.org/licenses/UoI-NCSA.php
- ROOT: distributed under LGPL 2.1
- https://root.cern.ch/license
- Cppyy: distributed under LBNL BSD
- https://fedoraproject.org/wiki/Licensing/LBNLBSD
-""")
-
-print('creating MANIFEST.in')
-with open('MANIFEST.in', 'w') as outp:
- outp.write("""# Include the license file
-include LICENSE.txt
-
-# Include the data files
-recursive-include src *
-""")
-
-print('creating README.rst')
-with open('README.rst', 'w') as outp:
- outp.write("""PyPy cling-support
-==================
-
-----
-
-Find the documentation here:
- http://doc.pypy.org/en/latest/cppyy.html
-""")
-
-print('creating setup.cfg')
-with open('setup.cfg', 'w') as outp:
- outp.write("""[bdist_wheel]
-universal=0
-""")
-
-print('creating setup.py')
-with open('setup.py', 'w') as outp:
- outp.write("""import os, sys, subprocess
-from setuptools import setup, find_packages
-from distutils import log
-from distutils.command.build import build as _build
-from setuptools.command.install import install as _install
-from distutils.sysconfig import get_python_lib
-from distutils.errors import DistutilsSetupError
-from codecs import open
-
-here = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
- long_description = f.read()
-
-builddir = None
-def get_builddir():
- global builddir
- if builddir is None:
- topdir = os.getcwd()
- builddir = os.path.join(topdir, 'builddir')
- return builddir
-
-srcdir = None
-def get_srcdir():
- global srcdir
- if srcdir is None:
- topdir = os.getcwd()
- srcdir = os.path.join(topdir, 'src', 'backend')
- return srcdir
-
-class my_cmake_build(_build):
- def __init__(self, dist, *args, **kwargs):
- _build.__init__(self, dist, *args, **kwargs)
- # TODO: can't seem to find a better way of getting hold of
- # the install_lib parameter during the build phase ...
- prefix = ''
- try:
- prefix = dist.get_command_obj('install').install_lib
- except AttributeError:
- pass
- if not prefix:
- prefix = get_python_lib(1, 0)
- self.prefix = os.path.join(prefix, 'cppyy_backend')
-
- def run(self):
- # base run
- _build.run(self)
-
- # custom run
- log.info('Now building libcppyy_backend.so and dependencies')
- builddir = get_builddir()
- srcdir = get_srcdir()
- if not os.path.exists(builddir):
- log.info('Creating build directory %s ...' % builddir)
- os.makedirs(builddir)
-
- os.chdir(builddir)
- log.info('Running cmake for cppyy_backend')
- if subprocess.call([
- 'cmake', srcdir, '-Dminimal=ON -Dasimage=OFF',
- '-DCMAKE_INSTALL_PREFIX='+self.prefix]) != 0:
- raise DistutilsSetupError('Failed to configure cppyy_backend')
-
- nprocs = os.getenv("MAKE_NPROCS")
- if nprocs:
- try:
- ival = int(nprocs)
- nprocs = '-j'+nprocs
- except ValueError:
- log.warn("Integer expected for MAKE_NPROCS, but got %s (ignored)", nprocs)
- nprocs = '-j1'
- else:
- nprocs = '-j1'
- log.info('Now building cppyy_backend and dependencies ...')
- if subprocess.call(['make', nprocs]) != 0:
- raise DistutilsSetupError('Failed to build cppyy_backend')
-
- log.info('build finished')
-
-class my_libs_install(_install):
- def run(self):
- # base install
- _install.run(self)
-
- # custom install
- log.info('Now installing libcppyy_backend.so and dependencies')
- builddir = get_builddir()
- if not os.path.exists(builddir):
- raise DistutilsSetupError('Failed to find build dir!')
- os.chdir(builddir)
-
- prefix = self.install_lib
- log.info('Now installing in %s ...', prefix)
- if subprocess.call(['make', 'install']) != 0:
- raise DistutilsSetupError('Failed to install cppyy_backend')
-
- log.info('install finished')
-
- def get_outputs(self):
- outputs = _install.get_outputs(self)
- outputs.append(os.path.join(self.install_lib, 'cppyy_backend'))
- return outputs
-
-setup(
- name='PyPy-cppyy-backend',
-""")
- outp.write(" version='%s', # corresponds to ROOT %s, extra number is for packager\n"\
- % (args.version, args.release))
- outp.write(""" description='Cling support for PyPy',
- long_description=long_description,
-
- url='http://pypy.org',
-
- # Author details
- author='PyPy Developers',
- author_email='pypy-dev at python.org',
-
- license='LLVM: UoI-NCSA; ROOT: LGPL 2.1; Cppyy: LBNL BSD',
-
- classifiers=[
- 'Development Status :: 4 - Beta',
-
- 'Intended Audience :: Developers',
-
- 'Topic :: Software Development',
- 'Topic :: Software Development :: Interpreters',
-
- #'License :: OSI Approved :: MIT License',
-
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: Implementation :: PyPy',
- 'Programming Language :: C',
- 'Programming Language :: C++',
-
- 'Natural Language :: English'
- ],
-
- keywords='interpreter development',
-
- packages=find_packages('src', ['backend']),
- include_package_data=True,
-
- extras_require={
- },
-
- cmdclass = {
- 'build': my_cmake_build,
- 'install': my_libs_install,
- },
-)
-""")
-
-
-print('creating src ... ROOT part')
-if not os.path.exists('src'):
- os.mkdir('src')
-os.chdir('src'); countdown += 1
-if not os.path.exists('backend'):
- src = os.path.join(os.path.pardir, os.path.pardir, pkgdir)
- print('now copying', src)
- shutil.copytree(src, 'backend')
-
-print('creating src ... cppyy part')
-os.chdir('backend'); countdown += 1
-if not os.path.exists('cppyy'):
- os.mkdir('cppyy')
- os.chdir('cppyy'); countdown += 1
-
- with open('CMakeLists.txt', 'w') as outp:
- outp.write("""############################################################################
-# CMakeLists.txt file for building cppyy package
-############################################################################
-
-ROOT_GLOB_SOURCES(sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cxx)
-set_source_files_properties(${sources} COMPILE_FLAGS "-fomit-frame-pointer -fvisibility=hidden -DRPY_EXTERN=RPY_EXPORTED -DRPYTHON_LL2CTYPES")
-
-add_definitions(${CLING_CXXFLAGS})
-
-ROOT_LINKER_LIBRARY(cppyy_backend ${sources}
- LIBRARIES ${CMAKE_DL_LIBS}
- DEPENDENCIES Core Cling RIO Thread)
-
-add_dependencies(cppyy_backend CLING)
-""")
-
- os.mkdir('src')
- os.chdir('src'); countdown += 1
- print('pulling cppyy/clingcwrapper.cxx from pypy')
- base = 'https://bitbucket.org/pypy/pypy/raw/default/pypy/module/cppyy/'
- for cppyy_file in ['src/callcontext.h', 'include/capi.h', 'src/clingcwrapper.cxx',
- 'include/clingcwrapper.h', 'include/cpp_cppyy.h', 'include/cppyy.h']:
- resp = urllib2.urlopen(base+cppyy_file)
- with open(os.path.basename(cppyy_file), 'w') as outp:
- outp.write(resp.read())
-
- # fix include
- inp = 'capi.h'
- outp = inp+'.new'
- new_cml = open(outp, 'w')
- for line in open(inp).readlines():
- if 'src/precommondefs.h' in line:
- line = '#include "precommondefs.h"\n'
- new_cml.write(line)
- new_cml.close()
- os.rename(outp, inp)
-
- with open('precommondefs.h', 'w') as outp:
- outp.write("""/***** Start of precommondefs.h *****/
-
-/* This is extracted from pyconfig.h from CPython. It sets the macros
- that affect the features we get from system include files.
- It must not #include anything. */
-
-#ifndef __PYPY_PRECOMMONDEFS_H
-#define __PYPY_PRECOMMONDEFS_H
-
-
-/* Define on Darwin to activate all library features */
-#define _DARWIN_C_SOURCE 1
-/* This must be set to 64 on some systems to enable large file support. */
-#define _FILE_OFFSET_BITS 64
-/* Define on Linux to activate all library features */
-#define _GNU_SOURCE 1
-/* This must be defined on some systems to enable large file support. */
-#define _LARGEFILE_SOURCE 1
-/* Define on NetBSD to activate all library features */
-#define _NETBSD_SOURCE 1
-/* Define to activate features from IEEE Stds 1003.1-2001 */
-#ifndef _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 200112L
-#endif
-/* Define on FreeBSD to activate all library features */
-#define __BSD_VISIBLE 1
-#define __XSI_VISIBLE 700
-/* Windows: winsock/winsock2 mess */
-#define WIN32_LEAN_AND_MEAN
-#ifdef _WIN64
- typedef __int64 Signed;
- typedef unsigned __int64 Unsigned;
-# define SIGNED_MIN LLONG_MIN
-#else
- typedef long Signed;
- typedef unsigned long Unsigned;
-# define SIGNED_MIN LONG_MIN
-#endif
-
-#if !defined(RPY_ASSERT) && !defined(RPY_LL_ASSERT) && !defined(NDEBUG)
-# define NDEBUG
-#endif
-
-
-/* All functions and global variables declared anywhere should use
- one of the following attributes:
-
- RPY_EXPORTED: the symbol is exported out of libpypy-c.so.
-
- RPY_EXTERN: the symbol is not exported out of libpypy-c.so, but
- otherwise works like 'extern' by being available to
- other C sources.
-
- static: as usual, this means the symbol is local to this C file.
-
- Don't use _RPY_HIDDEN directly. For tests involving building a custom
- .so, translator/tool/cbuild.py overrides RPY_EXTERN so that it becomes
- equal to RPY_EXPORTED.
-
- Any function or global variable declared with no attribute at all is
- a bug; please report or fix it.
-*/
-#ifdef __GNUC__
-# define RPY_EXPORTED extern __attribute__((visibility("default")))
-# define _RPY_HIDDEN __attribute__((visibility("hidden")))
-#else
-# define RPY_EXPORTED extern __declspec(dllexport)
-# define _RPY_HIDDEN /* nothing */
-#endif
-#ifndef RPY_EXTERN
-# define RPY_EXTERN extern _RPY_HIDDEN
-#endif
-
-
-#endif /* __PYPY_PRECOMMONDEFS_H */
-
-/***** End of precommondefs.h *****/
-""")
-
-# back up to pip package top
-for i in range(countdown-1):
- os.chdir(os.path.pardir)
-
-# add cppyy module to cmake
-os.chdir('src/backend')
-inp = 'CMakeLists.txt'
-print('adding cppyy to cmake')
-outp = inp+'.new'
-new_cml = open(outp, 'w')
-for line in open(inp).readlines():
- if 'add_subdirectory' in line and 'net' in line:
- line += 'add_subdirectory (cppyy)\n'
- new_cml.write(line)
-new_cml.close()
-os.rename(outp, inp)
-
-# done!
diff --git a/pypy/module/_cppyy/bench/Makefile b/pypy/module/_cppyy/bench/Makefile
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-all: bench02Dict_reflex.so
-
-ROOTSYS := ${ROOTSYS}
-
-ifeq ($(ROOTSYS),)
- genreflex=genreflex
- cppflags=
-else
- genreflex=$(ROOTSYS)/bin/genreflex
- cppflags=-I$(ROOTSYS)/include -L$(ROOTSYS)/lib
-endif
-
-PLATFORM := $(shell uname -s)
-ifeq ($(PLATFORM),Darwin)
- cppflags+=-dynamiclib -single_module -arch x86_64
-endif
-
-ifeq ($(shell $(genreflex) --help | grep -- --with-methptrgetter),)
- genreflexflags=
- cppflags2=-O3 -fPIC
-else
- genreflexflags=--with-methptrgetter
- cppflags2=-Wno-pmf-conversions -O3 -fPIC
-endif
-
-
-bench02Dict_reflex.so: bench02.h bench02.cxx bench02.xml
- $(genreflex) bench02.h $(genreflexflags) --selection=bench02.xml -I$(ROOTSYS)/include
- g++ -o $@ bench02.cxx bench02_rflx.cpp -I$(ROOTSYS)/include -shared -std=c++11 -lHistPainter `root-config --libs` $(cppflags) $(cppflags2)
diff --git a/pypy/module/_cppyy/bench/bench02.cxx b/pypy/module/_cppyy/bench/bench02.cxx
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/bench02.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "bench02.h"
-
-#include "TROOT.h"
-#include "TApplication.h"
-#include "TDirectory.h"
-#include "TInterpreter.h"
-#include "TSystem.h"
-#include "TBenchmark.h"
-#include "TStyle.h"
-#include "TError.h"
-#include "Getline.h"
-#include "TVirtualX.h"
-
-#include "Api.h"
-
-#include <iostream>
-
-TClass *TClass::GetClass(const char*, Bool_t, Bool_t) {
- static TClass* dummy = new TClass("__dummy__", kTRUE);
- return dummy; // is deleted by gROOT at shutdown
-}
-
-class TTestApplication : public TApplication {
-public:
- TTestApplication(
- const char* acn, Int_t* argc, char** argv, Bool_t bLoadLibs = kTRUE);
- virtual ~TTestApplication();
-};
-
-TTestApplication::TTestApplication(
- const char* acn, int* argc, char** argv, bool do_load) : TApplication(acn, argc, argv) {
- if (do_load) {
- // follow TRint to minimize differences with CINT
- ProcessLine("#include <iostream>", kTRUE);
- ProcessLine("#include <_string>", kTRUE); // for std::string iostream.
- ProcessLine("#include <vector>", kTRUE); // needed because they're used within the
- ProcessLine("#include <pair>", kTRUE); // core ROOT dicts and CINT won't be able
- // to properly unload these files
- }
-
- // save current interpreter context
- gInterpreter->SaveContext();
- gInterpreter->SaveGlobalsContext();
-
- // prevent crashes on accessing history
- Gl_histinit((char*)"-");
-
- // prevent ROOT from exiting python
- SetReturnFromRun(kTRUE);
-}
-
-TTestApplication::~TTestApplication() {}
-
-static const char* appname = "pypy-cppyy";
-
-Bench02RootApp::Bench02RootApp() {
- gROOT->SetBatch(kTRUE);
- if (!gApplication) {
- int argc = 1;
- char* argv[1]; argv[0] = (char*)appname;
- gApplication = new TTestApplication(appname, &argc, argv, kFALSE);
- }
-}
-
-Bench02RootApp::~Bench02RootApp() {
- // TODO: ROOT globals cleanup ... (?)
-}
-
-void Bench02RootApp::report() {
- std::cout << "gROOT is: " << gROOT << std::endl;
- std::cout << "gApplication is: " << gApplication << std::endl;
-}
-
-void Bench02RootApp::close_file(TFile* f) {
- std::cout << "closing file " << f->GetName() << " ... " << std::endl;
- f->Write();
- f->Close();
- std::cout << "... file closed" << std::endl;
-}
diff --git a/pypy/module/_cppyy/bench/bench02.h b/pypy/module/_cppyy/bench/bench02.h
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/bench02.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "TString.h"
-
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TProfile.h"
-#include "TNtuple.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "TRandom.h"
-#include "TRandom3.h"
-
-#include "TROOT.h"
-#include "TApplication.h"
-#include "TSystem.h"
-
-#include "TArchiveFile.h"
-#include "TBasket.h"
-#include "TBenchmark.h"
-#include "TBox.h"
-#include "TBranchRef.h"
-#include "TBrowser.h"
-#include "TClassGenerator.h"
-#include "TClassRef.h"
-#include "TClassStreamer.h"
-#include "TContextMenu.h"
-#include "TEntryList.h"
-#include "TEventList.h"
-#include "TF1.h"
-#include "TFileCacheRead.h"
-#include "TFileCacheWrite.h"
-#include "TFileMergeInfo.h"
-#include "TFitResult.h"
-#include "TFolder.h"
-//#include "TFormulaPrimitive.h"
-#include "TFunction.h"
-#include "TFrame.h"
-#include "TGlobal.h"
-#include "THashList.h"
-#include "TInetAddress.h"
-#include "TInterpreter.h"
-#include "TKey.h"
-#include "TLegend.h"
-#include "TMethodCall.h"
-#include "TPluginManager.h"
-#include "TProcessUUID.h"
-#include "TSchemaRuleSet.h"
-#include "TStyle.h"
-#include "TSysEvtHandler.h"
-#include "TTimer.h"
-#include "TView.h"
-//#include "TVirtualCollectionProxy.h"
-#include "TVirtualFFT.h"
-#include "TVirtualHistPainter.h"
-#include "TVirtualIndex.h"
-#include "TVirtualIsAProxy.h"
-#include "TVirtualPadPainter.h"
-#include "TVirtualRefProxy.h"
-#include "TVirtualStreamerInfo.h"
-#include "TVirtualViewer3D.h"
-
-#include <typeinfo>
-#include <ostream>
-
-
-class Bench02RootApp {
-public:
- Bench02RootApp();
- ~Bench02RootApp();
-
- void report();
- void close_file(TFile* f);
-};
diff --git a/pypy/module/_cppyy/bench/bench02.xml b/pypy/module/_cppyy/bench/bench02.xml
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/bench02.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<lcgdict>
-
- <selection>
-
- <!-- ROOT classes -->
- <class pattern="T[A-Z]*" />
- <class pattern="ROOT::T[A-Z]*" />
- <class pattern="ROOT::Fit::*" />
-
- <!-- ROOT globals -->
- <variable name="gROOT" />
- <variable name="gSystem" />
- <variable name="gRandom" />
-
- <!-- STL classes actually used -->
- <class name="std::string" />
- <class name="std::ostream" />
- <class name="std::type_info" />
- <class pattern="std::vector<*>" />
- <class pattern="std::_Vector_base<*>" />
-
- <!-- helper -->
- <class name="Bench02RootApp" />
-
- </selection>
-
- <exclusion>
-
- <struct pattern="TString::*" />
- <class name="TString" >
- <field name="fRep" transient="true"/>
- </class>
-
- <class name="TUUID::uuid_time_t" />
-
- <class name="TClass::TNameMapNode" />
- <class name="TFileOpenHandle" />
-
- </exclusion>
-
-</lcgdict>
diff --git a/pypy/module/_cppyy/bench/hsimple.C b/pypy/module/_cppyy/bench/hsimple.C
deleted file mode 100644
--- a/pypy/module/_cppyy/bench/hsimple.C
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <TFile.h>
-#include <TNtuple.h>
-#include <TH2.h>
-#include <TProfile.h>
-#include <TCanvas.h>
-#include <TFrame.h>
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TRandom3.h>
-#include <TBenchmark.h>
-#include <TInterpreter.h>
-
-TFile *hsimple(Int_t get=0)
-{
-// This program creates :
-// - a one dimensional histogram
-// - a two dimensional histogram
-// - a profile histogram
-// - a memory-resident ntuple
-//
-// These objects are filled with some random numbers and saved on a file.
-// If get=1 the macro returns a pointer to the TFile of "hsimple.root"
-// if this file exists, otherwise it is created.
-// The file "hsimple.root" is created in $ROOTSYS/tutorials if the caller has
-// write access to this directory, otherwise the file is created in $PWD
-
- TString filename = "hsimple.root";
- TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
- dir.ReplaceAll("hsimple.C","");
- dir.ReplaceAll("/./","/");
- TFile *hfile = 0;
- if (get) {
- // if the argument get =1 return the file "hsimple.root"
- // if the file does not exist, it is created
- TString fullPath = dir+"hsimple.root";
- if (!gSystem->AccessPathName(fullPath,kFileExists)) {
- hfile = TFile::Open(fullPath); //in $ROOTSYS/tutorials
- if (hfile) return hfile;
- }
- //otherwise try $PWD/hsimple.root
- if (!gSystem->AccessPathName("hsimple.root",kFileExists)) {
- hfile = TFile::Open("hsimple.root"); //in current dir
- if (hfile) return hfile;
- }
- }
- //no hsimple.root file found. Must generate it !
- //generate hsimple.root in $ROOTSYS/tutorials if we have write access
- if (!gSystem->AccessPathName(dir,kWritePermission)) {
- filename = dir+"hsimple.root";
- } else if (!gSystem->AccessPathName(".",kWritePermission)) {
- //otherwise generate hsimple.root in the current directory
- } else {
- printf("you must run the script in a directory with write access\n");
- return 0;
- }
- hfile = (TFile*)gROOT->FindObject(filename); if (hfile) hfile->Close();
- hfile = new TFile(filename,"RECREATE","Demo ROOT file with histograms");
-
- // Create some histograms, a profile histogram and an ntuple
- TH1F *hpx = new TH1F("hpx","This is the px distribution",100,-4,4);
- hpx->SetFillColor(48);
- TH2F *hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
- TProfile *hprof = new TProfile("hprof","Profile of pz versus px",100,-4,4,0,20);
- TNtuple *ntuple = new TNtuple("ntuple","Demo ntuple","px:py:pz:random:i");
-
- gBenchmark->Start("hsimple");
-
- // Create a new canvas.
- TCanvas *c1 = new TCanvas("c1","Dynamic Filling Example",200,10,700,500);
- c1->SetFillColor(42);
- c1->GetFrame()->SetFillColor(21);
- c1->GetFrame()->SetBorderSize(6);
- c1->GetFrame()->SetBorderMode(-1);
-
-
- // Fill histograms randomly
- TRandom3 random;
- Float_t px, py, pz;
- const Int_t kUPDATE = 1000;
- for (Int_t i = 0; i < 50000; i++) {
- // random.Rannor(px,py);
- px = random.Gaus(0, 1);
- py = random.Gaus(0, 1);
- pz = px*px + py*py;
- Float_t rnd = random.Rndm(1);
- hpx->Fill(px);
- hpxpy->Fill(px,py);
- hprof->Fill(px,pz);
- ntuple->Fill(px,py,pz,rnd,i);
- if (i && (i%kUPDATE) == 0) {
- if (i == kUPDATE) hpx->Draw();
- c1->Modified();
- c1->Update();
- if (gSystem->ProcessEvents())
- break;
- }
- }
- gBenchmark->Show("hsimple");
-
- // Save all objects in this file
- hpx->SetFillColor(0);
- hfile->Write();
- hpx->SetFillColor(48);
- c1->Modified();
- return hfile;
-
-// Note that the file is automatically close when application terminates
-// or when the file destructor is called.
-}
diff --git a/pypy/module/_cppyy/bench/hsimple.py b/pypy/module/_cppyy/bench/hsimple.py
deleted file mode 100755
--- a/pypy/module/_cppyy/bench/hsimple.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-#*-*
-#*-* This program creates :
-#*-* - a one dimensional histogram
-#*-* - a two dimensional histogram
-#*-* - a profile histogram
-#*-* - a memory-resident ntuple
-#*-*
-#*-* These objects are filled with some random numbers and saved on a file.
-#*-*
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-
-_reflex = True # to keep things equal, set to False for full macro
-
-try:
- import cppyy, random
-
- if not hasattr(cppyy.gbl, 'gROOT'):
- cppyy.load_reflection_info('bench02Dict_reflex.so')
- _reflex = True
-
- TCanvas = cppyy.gbl.TCanvas
- TFile = cppyy.gbl.TFile
- TProfile = cppyy.gbl.TProfile
- TNtuple = cppyy.gbl.TNtuple
- TH1F = cppyy.gbl.TH1F
- TH2F = cppyy.gbl.TH2F
- TRandom3 = cppyy.gbl.TRandom3
-
- gROOT = cppyy.gbl.gROOT
- gBenchmark = cppyy.gbl.TBenchmark()
- gSystem = cppyy.gbl.gSystem
-
-except ImportError:
- from ROOT import TCanvas, TFile, TProfile, TNtuple, TH1F, TH2F, TRandom3
- from ROOT import gROOT, gBenchmark, gSystem
- import random
-
-if _reflex:
- gROOT.SetBatch(True)
-
-# Create a new ROOT binary machine independent file.
-# Note that this file may contain any kind of ROOT objects, histograms,
-# pictures, graphics objects, detector geometries, tracks, events, etc..
-# This file is now becoming the current directory.
-
-if not _reflex:
- hfile = gROOT.FindObject('hsimple.root')
- if hfile:
- hfile.Close()
- hfile = TFile('hsimple.root', 'RECREATE', 'Demo ROOT file with histograms' )
-
-# Create some histograms, a profile histogram and an ntuple
-hpx = TH1F('hpx', 'This is the px distribution', 100, -4, 4)
-hpx.SetFillColor(48)
-hpxpy = TH2F('hpxpy', 'py vs px', 40, -4, 4, 40, -4, 4)
-hprof = TProfile('hprof', 'Profile of pz versus px', 100, -4, 4, 0, 20)
-if not _reflex:
- ntuple = TNtuple('ntuple', 'Demo ntuple', 'px:py:pz:random:i')
-
-gBenchmark.Start('hsimple')
-
-# Create a new canvas, and customize it.
-c1 = TCanvas('c1', 'Dynamic Filling Example', 200, 10, 700, 500)
-c1.SetFillColor(42)
-c1.GetFrame().SetFillColor(21)
-c1.GetFrame().SetBorderSize(6)
-c1.GetFrame().SetBorderMode(-1)
-
-# Fill histograms randomly.
-random = TRandom3()
-kUPDATE = 1000
-for i in xrange(50000):
- # Generate random numbers
-# px, py = random.gauss(0, 1), random.gauss(0, 1)
- px, py = random.Gaus(0, 1), random.Gaus(0, 1)
- pz = px*px + py*py
-# rnd = random.random()
- rnd = random.Rndm(1)
-
- # Fill histograms
- hpx.Fill(px)
- hpxpy.Fill(px, py)
- hprof.Fill(px, pz)
- if not _reflex:
- ntuple.Fill(px, py, pz, rnd, i)
-
- # Update display every kUPDATE events
- if i and i%kUPDATE == 0:
- if i == kUPDATE:
- hpx.Draw()
-
- c1.Modified(True)
- c1.Update()
-
- if gSystem.ProcessEvents(): # allow user interrupt
- break
-
-gBenchmark.Show( 'hsimple' )
-
-# Save all objects in this file
-hpx.SetFillColor(0)
-if not _reflex:
- hfile.Write()
-hpx.SetFillColor(48)
-c1.Modified(True)
-c1.Update()
-
-# Note that the file is automatically closed when application terminates
-# or when the file destructor is called.
diff --git a/pypy/module/_cppyy/bench/hsimple_rflx.py b/pypy/module/_cppyy/bench/hsimple_rflx.py
deleted file mode 100755
--- a/pypy/module/_cppyy/bench/hsimple_rflx.py
+++ /dev/null
@@ -1,120 +0,0 @@
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-#*-*
-#*-* This program creates :
-#*-* - a one dimensional histogram
-#*-* - a two dimensional histogram
-#*-* - a profile histogram
-#*-* - a memory-resident ntuple
-#*-*
-#*-* These objects are filled with some random numbers and saved on a file.
-#*-*
-#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-
-try:
- import warnings
- warnings.simplefilter("ignore")
-
- import cppyy, random
- cppyy.load_reflection_info('bench02Dict_reflex.so')
-
- app = cppyy.gbl.Bench02RootApp()
- TCanvas = cppyy.gbl.TCanvas
- TFile = cppyy.gbl.TFile
- TProfile = cppyy.gbl.TProfile
- TNtuple = cppyy.gbl.TNtuple
- TH1F = cppyy.gbl.TH1F
- TH2F = cppyy.gbl.TH2F
- TRandom = cppyy.gbl.TRandom
-except ImportError:
- from ROOT import TCanvas, TFile, TProfile, TNtuple, TH1F, TH2F, TRandom
- import random
-
-import math
-
-#gROOT = cppyy.gbl.gROOT
-#gBenchmark = cppyy.gbl.gBenchmark
-#gRandom = cppyy.gbl.gRandom
-#gSystem = cppyy.gbl.gSystem
-
-#gROOT.Reset()
-
-# Create a new canvas, and customize it.
-#c1 = TCanvas( 'c1', 'Dynamic Filling Example', 200, 10, 700, 500 )
-#c1.SetFillColor( 42 )
-#c1.GetFrame().SetFillColor( 21 )
-#c1.GetFrame().SetBorderSize( 6 )
-#c1.GetFrame().SetBorderMode( -1 )
-
-# Create a new ROOT binary machine independent file.
-# Note that this file may contain any kind of ROOT objects, histograms,
-# pictures, graphics objects, detector geometries, tracks, events, etc..
-# This file is now becoming the current directory.
-
-#hfile = gROOT.FindObject( 'hsimple.root' )
-#if hfile:
-# hfile.Close()
-#hfile = TFile( 'hsimple.root', 'RECREATE', 'Demo ROOT file with histograms' )
-
-# Create some histograms, a profile histogram and an ntuple
-hpx = TH1F('hpx', 'This is the px distribution', 100, -4, 4)
-hpx.Print()
-#hpxpy = TH2F( 'hpxpy', 'py vs px', 40, -4, 4, 40, -4, 4 )
-#hprof = TProfile( 'hprof', 'Profile of pz versus px', 100, -4, 4, 0, 20 )
-#ntuple = TNtuple( 'ntuple', 'Demo ntuple', 'px:py:pz:random:i' )
-
-# Set canvas/frame attributes.
-#hpx.SetFillColor( 48 )
-
-#gBenchmark.Start( 'hsimple' )
-
-# Initialize random number generator.
-#gRandom.SetSeed()
-#rannor, rndm = gRandom.Rannor, gRandom.Rndm
-
-random = TRandom()
-random.SetSeed(0)
-
-# Fill histograms randomly.
-#px, py = Double(), Double()
-kUPDATE = 1000
-for i in xrange(2500000):
- # Generate random values.
-# px, py = random.gauss(0, 1), random.gauss(0, 1)
- px, py = random.Gaus(0, 1), random.Gaus(0, 1)
-# pt = (px*px + py*py)**0.5
- pt = math.sqrt(px*px + py*py)
-# pt = (px*px + py*py)
-# random = rndm(1)
-
- # Fill histograms.
- hpx.Fill(pt)
-# hpxpyFill( px, py )
-# hprofFill( px, pz )
-# ntupleFill( px, py, pz, random, i )
-
- # Update display every kUPDATE events.
-# if i and i%kUPDATE == 0:
-# if i == kUPDATE:
-# hpx.Draw()
-
-# c1.Modified()
-# c1.Update()
-
-# if gSystem.ProcessEvents(): # allow user interrupt
-# break
-
-#gBenchmark.Show( 'hsimple' )
-
-hpx.Print()
-
-# Save all objects in this file.
-#hpx.SetFillColor( 0 )
-#hfile.Write()
-#hfile.Close()
-#hpx.SetFillColor( 48 )
-#c1.Modified()
-#c1.Update()
-#c1.Draw()
-
-# Note that the file is automatically closed when application terminates
-# or when the file destructor is called.
diff --git a/pypy/module/_cppyy/capi/__init__.py b/pypy/module/_cppyy/capi/__init__.py
--- a/pypy/module/_cppyy/capi/__init__.py
+++ b/pypy/module/_cppyy/capi/__init__.py
@@ -1,16 +1,6 @@
from rpython.rtyper.lltypesystem import rffi, lltype
-# There are two possible ways of accessing the backend through the reflection
-# C-API: built it into pypy-c, or load it dynamically. The latter is preferred
-# (and is the default) for use with Reflex. B/c of some builtin pythonizations,
-# the former is recommended (for now) with CINT.
-
-# Note: if builtin_capi is chosen, then inside builtin_capi.py, there is still
-# the selection of the desired backend (default is Reflex).
-
-# choose C-API access method:
from pypy.module._cppyy.capi.loadable_capi import *
-#from pypy.module._cppyy.capi.builtin_capi import *
from pypy.module._cppyy.capi.capi_types import C_OBJECT,\
C_NULL_TYPE, C_NULL_OBJECT
diff --git a/pypy/module/_cppyy/capi/builtin_capi.py b/pypy/module/_cppyy/capi/builtin_capi.py
deleted file mode 100644
--- a/pypy/module/_cppyy/capi/builtin_capi.py
+++ /dev/null
@@ -1,590 +0,0 @@
-from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.rlib.rarithmetic import intmask
-from rpython.rlib import jit
-
-import cling_capi as backend
-
-from pypy.module._cppyy.capi.capi_types import C_SCOPE, C_TYPE, C_OBJECT,\
- C_METHOD, C_INDEX, C_INDEX_ARRAY, WLAVC_INDEX, C_FUNC_PTR
-
-identify = backend.identify
-pythonize = backend.pythonize
-register_pythonizations = backend.register_pythonizations
-std_string_name = backend.std_string_name
-
-ts_reflect = backend.ts_reflect
-ts_call = backend.ts_call
-ts_memory = backend.ts_memory
-ts_helper = backend.ts_helper
-
-def verify_backend(space):
- return True # by definition
-
-c_load_dictionary = backend.c_load_dictionary
-
-# name to opaque C++ scope representation ------------------------------------
-_c_num_scopes = rffi.llexternal(
- "cppyy_num_scopes",
- [C_SCOPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_num_scopes(space, cppscope):
- return _c_num_scopes(cppscope.handle)
-_c_scope_name = rffi.llexternal(
- "cppyy_scope_name",
- [C_SCOPE, rffi.INT], rffi.CCHARP,
- compilation_info = backend.eci)
-def c_scope_name(space, cppscope, iscope):
- return charp2str_free(space, _c_scope_name(cppscope.handle, iscope))
-
-_c_resolve_name = rffi.llexternal(
- "cppyy_resolve_name",
- [rffi.CCHARP], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_resolve_name(space, name):
- return charp2str_free(space, _c_resolve_name(name))
-_c_get_scope_opaque = rffi.llexternal(
- "cppyy_get_scope",
- [rffi.CCHARP], C_SCOPE,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_get_scope_opaque(space, name):
- return _c_get_scope_opaque(name)
-_c_actual_class = rffi.llexternal(
- "cppyy_actual_class",
- [C_TYPE, C_OBJECT], C_TYPE,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_actual_class(space, cppclass, cppobj):
- return _c_actual_class(cppclass.handle, cppobj)
-
-# memory management ----------------------------------------------------------
-_c_allocate = rffi.llexternal(
- "cppyy_allocate",
- [C_TYPE], C_OBJECT,
- releasegil=ts_memory,
- compilation_info=backend.eci)
-def c_allocate(space, cppclass):
- return _c_allocate(cppclass.handle)
-_c_deallocate = rffi.llexternal(
- "cppyy_deallocate",
- [C_TYPE, C_OBJECT], lltype.Void,
- releasegil=ts_memory,
- compilation_info=backend.eci)
-def c_deallocate(space, cppclass, cppobject):
- _c_deallocate(cppclass.handle, cppobject)
-_c_destruct = rffi.llexternal(
- "cppyy_destruct",
- [C_TYPE, C_OBJECT], lltype.Void,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_destruct(space, cppclass, cppobject):
- _c_destruct(cppclass.handle, cppobject)
-
-# method/function dispatching ------------------------------------------------
-_c_call_v = rffi.llexternal(
- "cppyy_call_v",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], lltype.Void,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_v(space, cppmethod, cppobject, nargs, args):
- _c_call_v(cppmethod, cppobject, nargs, args)
-_c_call_b = rffi.llexternal(
- "cppyy_call_b",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.UCHAR,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_b(space, cppmethod, cppobject, nargs, args):
- return _c_call_b(cppmethod, cppobject, nargs, args)
-_c_call_c = rffi.llexternal(
- "cppyy_call_c",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.CHAR,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_c(space, cppmethod, cppobject, nargs, args):
- return _c_call_c(cppmethod, cppobject, nargs, args)
-_c_call_h = rffi.llexternal(
- "cppyy_call_h",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.SHORT,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_h(space, cppmethod, cppobject, nargs, args):
- return _c_call_h(cppmethod, cppobject, nargs, args)
-_c_call_i = rffi.llexternal(
- "cppyy_call_i",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.INT,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_i(space, cppmethod, cppobject, nargs, args):
- return _c_call_i(cppmethod, cppobject, nargs, args)
-_c_call_l = rffi.llexternal(
- "cppyy_call_l",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONG,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_l(space, cppmethod, cppobject, nargs, args):
- return _c_call_l(cppmethod, cppobject, nargs, args)
-_c_call_ll = rffi.llexternal(
- "cppyy_call_ll",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONGLONG,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_ll(space, cppmethod, cppobject, nargs, args):
- return _c_call_ll(cppmethod, cppobject, nargs, args)
-_c_call_f = rffi.llexternal(
- "cppyy_call_f",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.FLOAT,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_f(space, cppmethod, cppobject, nargs, args):
- return _c_call_f(cppmethod, cppobject, nargs, args)
-_c_call_d = rffi.llexternal(
- "cppyy_call_d",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.DOUBLE,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_d(space, cppmethod, cppobject, nargs, args):
- return _c_call_d(cppmethod, cppobject, nargs, args)
-_c_call_ld = rffi.llexternal(
- "cppyy_call_ld",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.LONGDOUBLE,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_ld(space, cppmethod, cppobject, nargs, args):
- return _c_call_ld(cppmethod, cppobject, nargs, args)
-
-_c_call_r = rffi.llexternal(
- "cppyy_call_r",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP], rffi.VOIDP,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_r(space, cppmethod, cppobject, nargs, args):
- return _c_call_r(cppmethod, cppobject, nargs, args)
-_c_call_s = rffi.llexternal(
- "cppyy_call_s",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP, rffi.SIZE_TP], rffi.CCHARP,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_s(space, cppmethod, cppobject, nargs, args):
- length = lltype.malloc(rffi.SIZE_TP.TO, 1, flavor='raw')
- try:
- cstr = _c_call_s(cppmethod, cppobject, nargs, args, length)
- cstr_len = intmask(length[0])
- finally:
- lltype.free(length, flavor='raw')
- return cstr, cstr_len
-
-_c_constructor = rffi.llexternal(
- "cppyy_constructor",
- [C_METHOD, C_TYPE, rffi.INT, rffi.VOIDP], C_OBJECT,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_constructor(space, cppmethod, cppobject, nargs, args):
- return _c_constructor(cppmethod, cppobject, nargs, args)
-_c_call_o = rffi.llexternal(
- "cppyy_call_o",
- [C_METHOD, C_OBJECT, rffi.INT, rffi.VOIDP, C_TYPE], rffi.LONG,
- releasegil=ts_call,
- compilation_info=backend.eci)
-def c_call_o(space, method, cppobj, nargs, args, cppclass):
- return _c_call_o(method, cppobj, nargs, args, cppclass.handle)
-
-_c_get_function_address = rffi.llexternal(
- "cppyy_get_function_address",
- [C_SCOPE, C_INDEX], C_FUNC_PTR,
- releasegil=ts_reflect,
- compilation_info=backend.eci,
- random_effects_on_gcobjs=False)
-def c_get_function_address(space, cppscope, index):
- return _c_get_function_address(cppscope.handle, index)
-
-# handling of function argument buffer ---------------------------------------
-_c_allocate_function_args = rffi.llexternal(
- "cppyy_allocate_function_args",
- [rffi.SIZE_T], rffi.VOIDP,
- releasegil=ts_memory,
- compilation_info=backend.eci)
-def c_allocate_function_args(space, size):
- return _c_allocate_function_args(size)
-_c_deallocate_function_args = rffi.llexternal(
- "cppyy_deallocate_function_args",
- [rffi.VOIDP], lltype.Void,
- releasegil=ts_memory,
- compilation_info=backend.eci)
-def c_deallocate_function_args(space, args):
- _c_deallocate_function_args(args)
-_c_function_arg_sizeof = rffi.llexternal(
- "cppyy_function_arg_sizeof",
- [], rffi.SIZE_T,
- releasegil=ts_memory,
- compilation_info=backend.eci,
- random_effects_on_gcobjs=False)
- at jit.elidable
-def c_function_arg_sizeof(space):
- return _c_function_arg_sizeof()
-_c_function_arg_typeoffset = rffi.llexternal(
- "cppyy_function_arg_typeoffset",
- [], rffi.SIZE_T,
- releasegil=ts_memory,
- compilation_info=backend.eci,
- random_effects_on_gcobjs=False)
- at jit.elidable
-def c_function_arg_typeoffset(space):
- return _c_function_arg_typeoffset()
-
-# scope reflection information -----------------------------------------------
-_c_is_namespace = rffi.llexternal(
- "cppyy_is_namespace",
- [C_SCOPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_namespace(space, scope):
- return _c_is_namespace(scope)
-_c_is_template = rffi.llexternal(
- "cppyy_is_template",
- [rffi.CCHARP], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_template(space, name):
- return _c_is_template(name)
-_c_is_abstract = rffi.llexternal(
- "cppyy_is_abstract",
- [C_SCOPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_abstract(space, cpptype):
- return _c_is_abstract(cpptype)
-_c_is_enum = rffi.llexternal(
- "cppyy_is_enum",
- [rffi.CCHARP], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_enum(space, name):
- return _c_is_enum(name)
-
-# type/class reflection information ------------------------------------------
-_c_final_name = rffi.llexternal(
- "cppyy_final_name",
- [C_TYPE], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_final_name(space, cpptype):
- return charp2str_free(space, _c_final_name(cpptype))
-_c_scoped_final_name = rffi.llexternal(
- "cppyy_scoped_final_name",
- [C_TYPE], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_scoped_final_name(space, cpptype):
- return charp2str_free(space, _c_scoped_final_name(cpptype))
-_c_has_complex_hierarchy = rffi.llexternal(
- "cppyy_has_complex_hierarchy",
- [C_TYPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_has_complex_hierarchy(space, cpptype):
- return _c_has_complex_hierarchy(cpptype)
-_c_num_bases = rffi.llexternal(
- "cppyy_num_bases",
- [C_TYPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_num_bases(space, cppclass):
- return _c_num_bases(cppclass.handle)
-_c_base_name = rffi.llexternal(
- "cppyy_base_name",
- [C_TYPE, rffi.INT], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_base_name(space, cppclass, base_index):
- return charp2str_free(space, _c_base_name(cppclass.handle, base_index))
-_c_is_subtype = rffi.llexternal(
- "cppyy_is_subtype",
- [C_TYPE, C_TYPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci,
- random_effects_on_gcobjs=False)
- at jit.elidable
-def c_is_subtype(space, derived, base):
- if derived == base:
- return 1
- return _c_is_subtype(derived.handle, base.handle)
-
-_c_base_offset = rffi.llexternal(
- "cppyy_base_offset",
- [C_TYPE, C_TYPE, C_OBJECT, rffi.INT], rffi.LONG, # actually ptrdiff_t
- releasegil=ts_reflect,
- compilation_info=backend.eci,
- random_effects_on_gcobjs=False)
- at jit.elidable
-def c_base_offset(space, derived, base, address, direction):
- if derived == base:
- return 0
- return _c_base_offset(derived.handle, base.handle, address, direction)
-def c_base_offset1(space, derived_h, base, address, direction):
- return _c_base_offset(derived_h, base.handle, address, direction)
-
-# method/function reflection information -------------------------------------
-_c_num_methods = rffi.llexternal(
- "cppyy_num_methods",
- [C_SCOPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_num_methods(space, cppscope):
- return _c_num_methods(cppscope.handle)
-_c_method_index_at = rffi.llexternal(
- "cppyy_method_index_at",
- [C_SCOPE, rffi.INT], C_INDEX,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_index_at(space, cppscope, imethod):
- return _c_method_index_at(cppscope.handle, imethod)
-_c_method_indices_from_name = rffi.llexternal(
- "cppyy_method_indices_from_name",
- [C_SCOPE, rffi.CCHARP], C_INDEX_ARRAY,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_indices_from_name(space, cppscope, name):
- indices = _c_method_indices_from_name(cppscope.handle, name)
- if not indices:
- return []
- py_indices = []
- i = 0
- index = indices[i]
- while index != -1:
- i += 1
- py_indices.append(index)
- index = indices[i]
- c_free(space, rffi.cast(rffi.VOIDP, indices)) # c_free defined below
- return py_indices
-
-_c_method_name = rffi.llexternal(
- "cppyy_method_name",
- [C_SCOPE, C_INDEX], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_name(space, cppscope, index):
- return charp2str_free(space, _c_method_name(cppscope.handle, index))
-_c_method_result_type = rffi.llexternal(
- "cppyy_method_result_type",
- [C_SCOPE, C_INDEX], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_result_type(space, cppscope, index):
- return charp2str_free(space, _c_method_result_type(cppscope.handle, index))
-_c_method_num_args = rffi.llexternal(
- "cppyy_method_num_args",
- [C_SCOPE, C_INDEX], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_num_args(space, cppscope, index):
- return _c_method_num_args(cppscope.handle, index)
-_c_method_req_args = rffi.llexternal(
- "cppyy_method_req_args",
- [C_SCOPE, C_INDEX], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_req_args(space, cppscope, index):
- return _c_method_req_args(cppscope.handle, index)
-_c_method_arg_type = rffi.llexternal(
- "cppyy_method_arg_type",
- [C_SCOPE, C_INDEX, rffi.INT], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_arg_type(space, cppscope, index, arg_index):
- return charp2str_free(space, _c_method_arg_type(cppscope.handle, index, arg_index))
-_c_method_arg_default = rffi.llexternal(
- "cppyy_method_arg_default",
- [C_SCOPE, C_INDEX, rffi.INT], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_arg_default(space, cppscope, index, arg_index):
- return charp2str_free(space, _c_method_arg_default(cppscope.handle, index, arg_index))
-_c_method_signature = rffi.llexternal(
- "cppyy_method_signature",
- [C_SCOPE, C_INDEX], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_signature(space, cppscope, index):
- return charp2str_free(space, _c_method_signature(cppscope.handle, index))
-
-_c_method_is_template = rffi.llexternal(
- "cppyy_method_is_template",
- [C_SCOPE, C_INDEX], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_method_is_template(space, cppscope, index):
- return _c_method_is_template(cppscope.handle, index)
-_c_method_num_template_args = rffi.llexternal(
- "cppyy_method_num_template_args",
- [C_SCOPE, C_INDEX], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-_c_method_template_arg_name = rffi.llexternal(
- "cppyy_method_template_arg_name",
- [C_SCOPE, C_INDEX, C_INDEX], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_template_args(space, cppscope, index):
- nargs = _c_method_num_template_args(cppscope.handle, index)
- args = [c_resolve_name(space,
- charp2str_free(space, _c_method_template_arg_name(cppscope.handle, index, iarg)))
- for iarg in range(nargs)]
- return args
-
-_c_get_method = rffi.llexternal(
- "cppyy_get_method",
- [C_SCOPE, C_INDEX], C_METHOD,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_get_method(space, cppscope, index):
- return _c_get_method(cppscope.handle, index)
-_c_get_global_operator = rffi.llexternal(
- "cppyy_get_global_operator",
- [C_SCOPE, C_SCOPE, C_SCOPE, rffi.CCHARP], WLAVC_INDEX,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_get_global_operator(space, nss, lc, rc, op):
- if nss is not None:
- return _c_get_global_operator(nss.handle, lc.handle, rc.handle, op)
- return rffi.cast(WLAVC_INDEX, -1)
-
-# method properties ----------------------------------------------------------
-_c_is_constructor = rffi.llexternal(
- "cppyy_is_constructor",
- [C_TYPE, C_INDEX], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_constructor(space, cppclass, index):
- return _c_is_constructor(cppclass.handle, index)
-_c_is_staticmethod = rffi.llexternal(
- "cppyy_is_staticmethod",
- [C_TYPE, C_INDEX], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_staticmethod(space, cppclass, index):
- return _c_is_staticmethod(cppclass.handle, index)
-
-# data member reflection information -----------------------------------------
-_c_num_datamembers = rffi.llexternal(
- "cppyy_num_datamembers",
- [C_SCOPE], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_num_datamembers(space, cppscope):
- return _c_num_datamembers(cppscope.handle)
-_c_datamember_name = rffi.llexternal(
- "cppyy_datamember_name",
- [C_SCOPE, rffi.INT], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_datamember_name(space, cppscope, datamember_index):
- return charp2str_free(space, _c_datamember_name(cppscope.handle, datamember_index))
-_c_datamember_type = rffi.llexternal(
- "cppyy_datamember_type",
- [C_SCOPE, rffi.INT], rffi.CCHARP,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_datamember_type(space, cppscope, datamember_index):
- return charp2str_free(space, _c_datamember_type(cppscope.handle, datamember_index))
-_c_datamember_offset = rffi.llexternal(
- "cppyy_datamember_offset",
- [C_SCOPE, rffi.INT], rffi.LONG, # actually ptrdiff_t
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_datamember_offset(space, cppscope, datamember_index):
- return _c_datamember_offset(cppscope.handle, datamember_index)
-
-_c_datamember_index = rffi.llexternal(
- "cppyy_datamember_index",
- [C_SCOPE, rffi.CCHARP], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_datamember_index(space, cppscope, name):
- return _c_datamember_index(cppscope.handle, name)
-
-# data member properties -----------------------------------------------------
-_c_is_publicdata = rffi.llexternal(
- "cppyy_is_publicdata",
- [C_SCOPE, rffi.INT], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_publicdata(space, cppscope, datamember_index):
- return _c_is_publicdata(cppscope.handle, datamember_index)
-_c_is_staticdata = rffi.llexternal(
- "cppyy_is_staticdata",
- [C_SCOPE, rffi.INT], rffi.INT,
- releasegil=ts_reflect,
- compilation_info=backend.eci)
-def c_is_staticdata(space, cppscope, datamember_index):
- return _c_is_staticdata(cppscope.handle, datamember_index)
-
-# misc helpers ---------------------------------------------------------------
-_c_strtoll = rffi.llexternal(
- "cppyy_strtoll",
- [rffi.CCHARP], rffi.LONGLONG,
- releasegil=ts_helper,
- compilation_info=backend.eci)
-def c_strtoll(space, svalue):
- return _c_strtoll(svalue)
-_c_strtoull = rffi.llexternal(
- "cppyy_strtoull",
- [rffi.CCHARP], rffi.ULONGLONG,
- releasegil=ts_helper,
- compilation_info=backend.eci)
-def c_strtoull(space, svalue):
- return _c_strtoull(svalue)
-_c_free = rffi.llexternal(
- "cppyy_free",
- [rffi.VOIDP], lltype.Void,
- releasegil=ts_memory,
- compilation_info=backend.eci)
-def c_free(space, voidp):
- return _c_free(voidp)
-
-def charp2str_free(space, charp):
- string = rffi.charp2str(charp)
- voidp = rffi.cast(rffi.VOIDP, charp)
- _c_free(voidp)
- return string
-
-_c_charp2stdstring = rffi.llexternal(
- "cppyy_charp2stdstring",
- [rffi.CCHARP, rffi.SIZE_T], C_OBJECT,
- releasegil=ts_helper,
- compilation_info=backend.eci)
-def c_charp2stdstring(space, pystr, sz):
- with rffi.scoped_view_charp(pystr) as cstr:
- cppstr = _c_charp2stdstring(cstr, sz)
- return cppstr
-_c_stdstring2stdstring = rffi.llexternal(
- "cppyy_stdstring2stdstring",
- [C_OBJECT], C_OBJECT,
- releasegil=ts_helper,
- compilation_info=backend.eci)
-def c_stdstring2stdstring(space, cppobject):
- return _c_stdstring2stdstring(cppobject)
-
-_c_stdvector_valuetype = rffi.llexternal(
- "cppyy_stdvector_valuetype",
- [rffi.CCHARP], rffi.CCHARP,
- releasegil=ts_helper,
- compilation_info=backend.eci)
-def c_stdvector_valuetype(space, pystr):
- cstr = rffi.str2charp(pystr)
- result = _c_stdvector_valuetype(cstr)
- rffi.free_charp(cstr)
- if result:
- return charp2str_free(space, result)
- return ""
-_c_stdvector_valuesize = rffi.llexternal(
- "cppyy_stdvector_valuesize",
- [rffi.CCHARP], rffi.SIZE_T,
- releasegil=ts_helper,
- compilation_info=backend.eci)
-def c_stdvector_valuesize(space, pystr):
- cstr = rffi.str2charp(pystr)
- result = _c_stdvector_valuesize(cstr)
- rffi.free_charp(cstr)
- return result
diff --git a/pypy/module/_cppyy/capi/cling_capi.py b/pypy/module/_cppyy/capi/cling_capi.py
deleted file mode 100644
--- a/pypy/module/_cppyy/capi/cling_capi.py
+++ /dev/null
@@ -1,196 +0,0 @@
-import py, os
-
-from pypy.objspace.std.iterobject import W_AbstractSeqIterObject
-
-from pypy.interpreter.error import OperationError
-from pypy.interpreter.gateway import interp2app
-
-from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.rlib.rarithmetic import intmask
-from rpython.rlib import jit, libffi, rdynload
-
-from pypy.module._rawffi.array import W_ArrayInstance
-from pypy.module._cppyy.capi.capi_types import C_OBJECT
-
-__all__ = ['identify', 'std_string_name', 'eci', 'c_load_dictionary']
-
-pkgpath = py.path.local(__file__).dirpath().join(os.pardir)
-srcpath = pkgpath.join("src")
-incpath = pkgpath.join("include")
-
-import commands
-(config_stat, incdir) = commands.getstatusoutput("root-config --incdir")
-
-if os.environ.get("ROOTSYS"):
- if config_stat != 0: # presumably Reflex-only
- rootincpath = [os.path.join(os.environ["ROOTSYS"], "interpreter/cling/include"),
- os.path.join(os.environ["ROOTSYS"], "interpreter/llvm/inst/include"),
- os.path.join(os.environ["ROOTSYS"], "include"),]
- rootlibpath = [os.path.join(os.environ["ROOTSYS"], "lib64"), os.path.join(os.environ["ROOTSYS"], "lib")]
- else:
- rootincpath = [incdir]
- rootlibpath = commands.getoutput("root-config --libdir").split()
-else:
- if config_stat == 0:
- rootincpath = [incdir]
- rootlibpath = commands.getoutput("root-config --libdir").split()
- else:
- rootincpath = []
- rootlibpath = []
-
-def identify():
- return 'Cling'
-
-ts_reflect = False
-ts_call = 'auto'
-ts_memory = 'auto'
-ts_helper = 'auto'
-
-std_string_name = 'std::basic_string<char>'
-
-# force loading (and exposure) of libCore symbols
More information about the pypy-commit
mailing list