예제 #1
0
# should re-write compiled functions to take a local and global dict
# as input.
from __future__ import absolute_import, print_function

import sys
import os
from . import ext_tools
from . import catalog
from . import common_info

from numpy.core.multiarray import _get_ndarray_c_version
ndarray_api_version = '/* NDARRAY API VERSION %x */' % (_get_ndarray_c_version(),)


# not an easy way for the user_path_list to come in here.
# the PYTHONCOMPILED environment variable offers the most hope.
# If the user sets ``os.environ['PYTHONCOMPILED']``, that path will
# be used to compile the extension in.  Note that .cpp and .so files
# will remain in that directory.  See the docstring of ``catalog.catalog``
# for more details.

function_catalog = catalog.catalog()


class inline_ext_function(ext_tools.ext_function):
    # Some specialization is needed for inline extension functions
    def function_declaration_code(self):
        code = 'static PyObject* %s(PyObject*self, PyObject* args)\n{\n'
        return code % self.name

    def template_declaration_code(self):
예제 #2
0
# should re-write compiled functions to take a local and global dict
# as input.


import sys
import os
from . import ext_tools
from . import catalog
from . import common_info

from numpy.core.multiarray import _get_ndarray_c_version
ndarray_api_version = '/* NDARRAY API VERSION %x */' % (_get_ndarray_c_version(),)


# not an easy way for the user_path_list to come in here.
# the PYTHONCOMPILED environment variable offers the most hope.
# If the user sets ``os.environ['PYTHONCOMPILED']``, that path will
# be used to compile the extension in.  Note that .cpp and .so files
# will remain in that directory.  See the docstring of ``catalog.catalog``
# for more details.

function_catalog = catalog.catalog()


class inline_ext_function(ext_tools.ext_function):
    # Some specialization is needed for inline extension functions
    def function_declaration_code(self):
        code = 'static PyObject* %s(PyObject*self, PyObject* args)\n{\n'
        return code % self.name

    def template_declaration_code(self):
예제 #3
0
# should re-write compiled functions to take a local and global dict
# as input.
import sys
import os
import ext_tools
import catalog
import common_info

from numpy.core.multiarray import _get_ndarray_c_version
ndarray_api_version = '/* NDARRAY API VERSION %x */' % (
    _get_ndarray_c_version(), )

# not an easy way for the user_path_list to come in here.
# the PYTHONCOMPILED environment variable offers the most hope.

function_catalog = catalog.catalog()


class inline_ext_function(ext_tools.ext_function):
    # Some specialization is needed for inline extension functions
    def function_declaration_code(self):
        code = 'static PyObject* %s(PyObject*self, PyObject* args)\n{\n'
        return code % self.name

    def template_declaration_code(self):
        code = 'template<class T>\n' \
               'static PyObject* %s(PyObject*self, PyObject* args)\n{\n'
        return code % self.name

    def parse_tuple_code(self):
        """ Create code block for PyArg_ParseTuple.  Variable declarations