Commit fddb5559 authored by André Anjos's avatar André Anjos 💬
Browse files

xbob -> bob

parent a7c1fc3e
......@@ -24,8 +24,8 @@ install:
- "python bootstrap.py"
- "CFLAGS=-coverage ./bin/buildout"
script:
- "./bin/python -c 'from xbob.blitz import get_config; print(get_config())'"
- "./bin/coverage run --source=xbob.blitz ./bin/nosetests -sv"
- "./bin/python -c 'from bob.blitz import get_config; print(get_config())'"
- "./bin/coverage run --source=bob.blitz ./bin/nosetests -sv"
- "./bin/sphinx-build -b doctest doc sphinx"
- "./bin/sphinx-build -b html doc sphinx"
after_success:
......
include LICENSE README.rst bootstrap.py buildout.cfg
recursive-include doc conf.py *.rst
recursive-include xbob *.cpp *.h
recursive-include bob *.cpp *.h
......@@ -2,16 +2,16 @@
.. Andre Anjos <andre.anjos@idiap.ch>
.. Thu 29 Aug 2013 16:07:57 CEST
.. image:: https://travis-ci.org/bioidiap/xbob.blitz.svg?branch=master
:target: https://travis-ci.org/bioidiap/xbob.blitz
.. image:: https://coveralls.io/repos/bioidiap/xbob.blitz/badge.png
:target: https://coveralls.io/r/bioidiap/xbob.blitz
.. image:: http://img.shields.io/github/tag/bioidiap/xbob.blitz.png
:target: https://github.com/bioidiap/xbob.blitz
.. image:: http://img.shields.io/pypi/v/xbob.blitz.png
:target: https://pypi.python.org/pypi/xbob.blitz
.. image:: http://img.shields.io/pypi/dm/xbob.blitz.png
:target: https://pypi.python.org/pypi/xbob.blitz
.. image:: https://travis-ci.org/bioidiap/bob.blitz.svg?branch=master
:target: https://travis-ci.org/bioidiap/bob.blitz
.. image:: https://coveralls.io/repos/bioidiap/bob.blitz/badge.png
:target: https://coveralls.io/r/bioidiap/bob.blitz
.. image:: http://img.shields.io/github/tag/bioidiap/bob.blitz.png
:target: https://github.com/bioidiap/bob.blitz
.. image:: http://img.shields.io/pypi/v/bob.blitz.png
:target: https://pypi.python.org/pypi/bob.blitz
.. image:: http://img.shields.io/pypi/dm/bob.blitz.png
:target: https://pypi.python.org/pypi/bob.blitz
====================================
Python bindings for Blitz++ Arrays
......@@ -44,7 +44,7 @@ Testing
You can run a set of tests using the nose test runner::
$ nosetests -sv xbob.blitz
$ nosetests -sv bob.blitz
You can run our documentation tests using sphinx itself::
......@@ -52,7 +52,7 @@ You can run our documentation tests using sphinx itself::
You can test overall test coverage with::
$ nosetests --with-coverage --cover-package=xbob.blitz
$ nosetests --with-coverage --cover-package=bob.blitz
The ``coverage`` egg must be installed for this to work properly.
......
......@@ -5,9 +5,9 @@
* @brief Implements some constructions exported to all modules
*/
#define XBOB_BLITZ_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#define BOB_BLITZ_MODULE
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <algorithm>
/*******************
......@@ -171,7 +171,7 @@ PyObject* PyBlitzArray_PyBASE(PyBlitzArrayObject* o) {
template <typename T>
PyObject* getitem_inner(PyBlitzArrayObject* o, Py_ssize_t* pos) {
Py_ssize_t tmp[XBOB_BLITZ_MAXDIMS];
Py_ssize_t tmp[BOB_BLITZ_MAXDIMS];
/* Fix negative indexes and check ranges */
for (Py_ssize_t i=0; i<o->ndim; ++i) {
......@@ -212,7 +212,7 @@ PyObject* getitem_inner(PyBlitzArrayObject* o, Py_ssize_t* pos) {
}
default:
PyErr_Format(PyExc_NotImplementedError, "cannot index %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", Py_TYPE(o)->tp_name, o->ndim, PyBlitzArray_TypenumAsString(o->type_num), XBOB_BLITZ_MAXDIMS); return 0;
PyErr_Format(PyExc_NotImplementedError, "cannot index %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", Py_TYPE(o)->tp_name, o->ndim, PyBlitzArray_TypenumAsString(o->type_num), BOB_BLITZ_MAXDIMS); return 0;
}
}
......@@ -285,7 +285,7 @@ PyObject* PyBlitzArray_GetItem(PyBlitzArrayObject* o, Py_ssize_t* pos) {
template <typename T>
int setitem_inner(PyBlitzArrayObject* o, Py_ssize_t* pos, PyObject* value) {
Py_ssize_t tmp[XBOB_BLITZ_MAXDIMS];
Py_ssize_t tmp[BOB_BLITZ_MAXDIMS];
/* Fix negative indexes and check ranges */
for (Py_ssize_t i=0; i<o->ndim; ++i) {
......@@ -334,7 +334,7 @@ int setitem_inner(PyBlitzArrayObject* o, Py_ssize_t* pos, PyObject* value) {
}
default:
PyErr_Format(PyExc_NotImplementedError, "cannot set item on %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", Py_TYPE(o)->tp_name, o->ndim, PyBlitzArray_TypenumAsString(o->type_num), XBOB_BLITZ_MAXDIMS);
PyErr_Format(PyExc_NotImplementedError, "cannot set item on %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", Py_TYPE(o)->tp_name, o->ndim, PyBlitzArray_TypenumAsString(o->type_num), BOB_BLITZ_MAXDIMS);
return -1;
}
......@@ -448,7 +448,7 @@ template<typename T> void deallocate_inner(PyBlitzArrayObject* o) {
break;
default:
PyErr_Format(PyExc_NotImplementedError, "cannot deallocate %s(@%" PY_FORMAT_SIZE_T "d,%s>, this number of dimensions is outside the range of supported dimensions [1,%d]", Py_TYPE(o)->tp_name, o->ndim, PyBlitzArray_TypenumAsString(o->type_num), XBOB_BLITZ_MAXDIMS);
PyErr_Format(PyExc_NotImplementedError, "cannot deallocate %s(@%" PY_FORMAT_SIZE_T "d,%s>, this number of dimensions is outside the range of supported dimensions [1,%d]", Py_TYPE(o)->tp_name, o->ndim, PyBlitzArray_TypenumAsString(o->type_num), BOB_BLITZ_MAXDIMS);
return;
}
......@@ -583,7 +583,7 @@ PyObject* simplenew_1(int type_num, Py_ssize_t ndim, Py_ssize_t* shape) {
return simplenew_2<T,4>(type_num, ndim, shape);
default:
PyErr_Format(PyExc_NotImplementedError, "cannot allocate %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", PyBlitzArray_Type.tp_name, ndim, PyBlitzArray_TypenumAsString(type_num), XBOB_BLITZ_MAXDIMS);
PyErr_Format(PyExc_NotImplementedError, "cannot allocate %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", PyBlitzArray_Type.tp_name, ndim, PyBlitzArray_TypenumAsString(type_num), BOB_BLITZ_MAXDIMS);
return 0;
}
......@@ -742,7 +742,7 @@ PyObject* simplenewfromdata_1(int type_num, Py_ssize_t ndim,
return simplenewfromdata_2<T,4>(type_num, ndim, shape, stride, data, writeable);
default:
PyErr_Format(PyExc_NotImplementedError, "cannot allocate %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", PyBlitzArray_Type.tp_name, ndim, PyBlitzArray_TypenumAsString(type_num), XBOB_BLITZ_MAXDIMS);
PyErr_Format(PyExc_NotImplementedError, "cannot allocate %s(@%" PY_FORMAT_SIZE_T "d,'%s'): this number of dimensions is outside the range of supported dimensions [1,%d]", PyBlitzArray_Type.tp_name, ndim, PyBlitzArray_TypenumAsString(type_num), BOB_BLITZ_MAXDIMS);
return 0;
}
......@@ -887,7 +887,7 @@ static int ndarray_behaves (PyArrayObject* o) {
if (!PyArray_ISBEHAVED_RO(ao)) return 0;
// checks if the number of dimensions is supported
if (PyArray_NDIM(ao) < 1 || PyArray_NDIM(ao) > XBOB_BLITZ_MAXDIMS) return 0;
if (PyArray_NDIM(ao) < 1 || PyArray_NDIM(ao) > BOB_BLITZ_MAXDIMS) return 0;
// checks if the type number if supported
switch(fix_integer_type_num(PyArray_DESCR(ao)->type_num)) {
......@@ -928,7 +928,7 @@ PyObject* PyBlitzArray_FromNumpyArray(PyArrayObject* o) {
}
if (!ndarray_behaves(o)) {
PyErr_Format(PyExc_ValueError, "cannot convert `%s' which doesn't behave (memory contiguous, aligned, C-style, minimum 1 and up to %d dimensions) into a `%s'", Py_TYPE(o)->tp_name, XBOB_BLITZ_MAXDIMS, PyBlitzArray_Type.tp_name);
PyErr_Format(PyExc_ValueError, "cannot convert `%s' which doesn't behave (memory contiguous, aligned, C-style, minimum 1 and up to %d dimensions) into a `%s'", Py_TYPE(o)->tp_name, BOB_BLITZ_MAXDIMS, PyBlitzArray_Type.tp_name);
return 0;
}
......@@ -996,14 +996,14 @@ PyObject* PyBlitzArray_NUMPY_WRAP(PyObject* bz) {
int PyBlitzArray_Converter(PyObject* o, PyBlitzArrayObject** a) {
// is already a xbob.blitz.array
// is already a bob.blitz.array
if (PyBlitzArray_Check(o)) {
*a = reinterpret_cast<PyBlitzArrayObject*>(o);
Py_INCREF(*a);
return 1;
}
// is numpy.ndarray wrapped around a xbob.blitz.array
// is numpy.ndarray wrapped around a bob.blitz.array
if (PyArray_Check(o)) {
PyArrayObject* arr = reinterpret_cast<PyArrayObject*>(o);
if (PyBlitzArray_CheckNumpyBase(arr)) {
......@@ -1032,14 +1032,14 @@ int PyBlitzArray_Converter(PyObject* o, PyBlitzArrayObject** a) {
int PyBlitzArray_OutputConverter(PyObject* o, PyBlitzArrayObject** a) {
// is already a xbob.blitz.array
// is already a bob.blitz.array
if (PyBlitzArray_Check(o)) {
*a = reinterpret_cast<PyBlitzArrayObject*>(o);
Py_INCREF(o);
return 1;
}
// is numpy.ndarray wrapped around a xbob.blitz.array
// is numpy.ndarray wrapped around a bob.blitz.array
if (PyArray_Check(o)) {
PyArrayObject* arr = reinterpret_cast<PyArrayObject*>(o);
if (PyBlitzArray_CheckNumpyBase(arr)) {
......@@ -1075,7 +1075,7 @@ int PyBlitzArray_OutputConverter(PyObject* o, PyBlitzArrayObject** a) {
int PyBlitzArray_BehavedConverter(PyObject* o, PyBlitzArrayObject** a) {
// is already a xbob.blitz.array
// is already a bob.blitz.array
// TODO: Don't we check in these conditions?
if (PyBlitzArray_Check(o)) {
*a = reinterpret_cast<PyBlitzArrayObject*>(o);
......@@ -1083,7 +1083,7 @@ int PyBlitzArray_BehavedConverter(PyObject* o, PyBlitzArrayObject** a) {
return 1;
}
// is numpy.ndarray wrapped around a xbob.blitz.array
// is numpy.ndarray wrapped around a bob.blitz.array
if (PyArray_Check(o)) {
PyArrayObject* arr = reinterpret_cast<PyArrayObject*>(o);
if (PyArray_ISCARRAY_RO(arr) && PyBlitzArray_CheckNumpyBase(arr)) {
......@@ -1141,8 +1141,8 @@ int PyBlitzArray_IndexConverter(PyObject* o, PyBlitzArrayObject** shape) {
(*shape)->ndim = PySequence_Size(o);
if ((*shape)->ndim == 0 || (*shape)->ndim > XBOB_BLITZ_MAXDIMS) {
PyErr_Format(PyExc_TypeError, "shape/index must be a sequence with at least 1 and at most %d element(s) (you passed a sequence with %" PY_FORMAT_SIZE_T "d elements)", XBOB_BLITZ_MAXDIMS, (*shape)->ndim);
if ((*shape)->ndim == 0 || (*shape)->ndim > BOB_BLITZ_MAXDIMS) {
PyErr_Format(PyExc_TypeError, "shape/index must be a sequence with at least 1 and at most %d element(s) (you passed a sequence with %" PY_FORMAT_SIZE_T "d elements)", BOB_BLITZ_MAXDIMS, (*shape)->ndim);
return 0;
}
......
......@@ -5,11 +5,11 @@
* @brief Pure python bindings for Blitz Arrays
*/
#define XBOB_BLITZ_MODULE
#include <xbob.blitz/capi.h>
#define BOB_BLITZ_MODULE
#include <bob.blitz/capi.h>
#include <structmember.h>
PyDoc_STRVAR(s_array_str, XBOB_EXT_MODULE_PREFIX ".array");
PyDoc_STRVAR(s_array_str, BOB_EXT_MODULE_PREFIX ".array");
PyDoc_STRVAR(s_array_doc,
"array(shape, dtype) -> new n-dimensional blitz::Array\n\
......@@ -191,7 +191,7 @@ PyDoc_STRVAR(s_private_array_doc,
"x.__array__([dtype]) -> numpy.ndarray\n\
x.as_ndarray([dtype]) -> numpy.ndarray\n\
\n\
numpy.ndarray accessor (shallow wraps ``xbob.blitz.array`` as\n\
numpy.ndarray accessor (shallow wraps ``bob.blitz.array`` as\n\
numpy.ndarray). If ``dtype`` is given and the current data type\n\
is not the same, then forces the creation of a copy conforming\n\
to the require data type, if possible.\n\
......
......@@ -8,10 +8,10 @@
import numpy
from pkg_resources import resource_filename
from xbob.extension import Extension as XbobExtension
from bob.extension import Extension as BobExtension
from distutils.version import StrictVersion
class Extension(XbobExtension):
class Extension(BobExtension):
"""Extension building with pkg-config packages and blitz.array.
See the documentation for :py:class:`distutils.extension.Extension` for more
......@@ -24,7 +24,7 @@ class Extension(XbobExtension):
This extension adds ``blitz>=0.10`` as a requirement for extensions derived
from this class.
See the help for :py:class:`xbob.extension.Extension` for more details on
See the help for :py:class:`bob.extension.Extension` for more details on
options.
"""
......@@ -39,7 +39,7 @@ class Extension(XbobExtension):
kwargs.setdefault('include_dirs', []).append(self_include_dir)
macros = [
("PY_ARRAY_UNIQUE_SYMBOL", "XBOB_NUMPY_C_API"),
("PY_ARRAY_UNIQUE_SYMBOL", "BOB_NUMPY_C_API"),
("NO_IMPORT_ARRAY", "1"),
]
......@@ -49,4 +49,4 @@ class Extension(XbobExtension):
kwargs.setdefault('define_macros', []).extend(macros)
# Run the constructor for the base class
XbobExtension.__init__(self, *args, **kwargs)
BobExtension.__init__(self, *args, **kwargs)
......@@ -2,18 +2,18 @@
* @author Andre Anjos <andre.anjos@idiap.ch>
* @date Tue 8 Oct 08:19:28 2013
*
* @brief Defines the xbob.blitz C-API
* @brief Defines the bob.blitz C-API
*
* This module allows somebody else, externally to this package, to include the
* xbob.blitz C-API functionality on their own package. Because the API is
* compiled with a Python module (named `xbob.blitz`), we need to dig it out
* bob.blitz C-API functionality on their own package. Because the API is
* compiled with a Python module (named `bob.blitz`), we need to dig it out
* from there and bind it to the following C-API members. We do this using a
* PyCObject/PyCapsule module as explained in:
* http://docs.python.org/2/extending/extending.html#using-capsules.
*/
#ifndef XBOB_BLITZ_C_API_H
#define XBOB_BLITZ_C_API_H
#ifndef BOB_BLITZ_C_API_H
#define BOB_BLITZ_C_API_H
#ifdef __cplusplus
extern "C" {
......@@ -23,15 +23,15 @@ extern "C" {
#include <numpy/arrayobject.h>
/* Define Module Name and Prefix for other Modules
Note: We cannot use XBOB_EXT_* macros here, unfortunately */
#define XBOB_BLITZ_PREFIX "xbob.blitz"
#define XBOB_BLITZ_FULL_NAME "xbob.blitz._library"
Note: We cannot use BOB_EXT_* macros here, unfortunately */
#define BOB_BLITZ_PREFIX "bob.blitz"
#define BOB_BLITZ_FULL_NAME "bob.blitz._library"
/* Define API version */
#define XBOB_BLITZ_API_VERSION 0x0200
#define BOB_BLITZ_API_VERSION 0x0200
/* Maximum number of dimensions supported at this library */
#define XBOB_BLITZ_MAXDIMS 4
#define BOB_BLITZ_MAXDIMS 4
/* Type definition for PyBlitzArrayObject */
typedef struct {
......@@ -42,8 +42,8 @@ typedef struct {
void* data; ///< a pointer to the internal data buffer
int type_num; ///< numpy type number of elements
Py_ssize_t ndim; ///< number of dimensions
Py_ssize_t shape[XBOB_BLITZ_MAXDIMS]; ///< shape
Py_ssize_t stride[XBOB_BLITZ_MAXDIMS]; ///< strides
Py_ssize_t shape[BOB_BLITZ_MAXDIMS]; ///< shape
Py_ssize_t stride[BOB_BLITZ_MAXDIMS]; ///< strides
int writeable; ///< 1 if data is writeable, 0 otherwise
/* Base pointer, if the memory of this object is coming from elsewhere */
......@@ -223,9 +223,9 @@ enum _PyBlitzArray_ENUM{
#define PyBlitzArray_Cast_PROTO (PyBlitzArrayObject* o, int typenum)
#ifdef XBOB_BLITZ_MODULE
#ifdef BOB_BLITZ_MODULE
/* This section is used when compiling `xbob.blitz' itself */
/* This section is used when compiling `bob.blitz' itself */
extern int PyBlitzArray_APIVersion;
......@@ -417,12 +417,12 @@ enum _PyBlitzArray_ENUM{
/**
* Returns -1 on error, 0 on success.
*/
static int import_xbob_blitz(void) {
static int import_bob_blitz(void) {
PyObject *c_api_object;
PyObject *module;
module = PyImport_ImportModule(XBOB_BLITZ_FULL_NAME);
module = PyImport_ImportModule(BOB_BLITZ_FULL_NAME);
if (module == NULL) return -1;
......@@ -454,15 +454,15 @@ enum _PyBlitzArray_ENUM{
# else
"cobject"
# endif
" at `" XBOB_BLITZ_FULL_NAME "._C_API'");
" at `" BOB_BLITZ_FULL_NAME "._C_API'");
return -1;
}
/* Checks that the imported version matches the compiled version */
int imported_version = *(int*)PyBlitzArray_API[PyBlitzArray_APIVersion_NUM];
if (XBOB_BLITZ_API_VERSION != imported_version) {
PyErr_Format(PyExc_RuntimeError, XBOB_BLITZ_FULL_NAME " import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", XBOB_BLITZ_API_VERSION, imported_version);
if (BOB_BLITZ_API_VERSION != imported_version) {
PyErr_Format(PyExc_RuntimeError, BOB_BLITZ_FULL_NAME " import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOB_BLITZ_API_VERSION, imported_version);
return -1;
}
......@@ -475,10 +475,10 @@ enum _PyBlitzArray_ENUM{
}
# endif // !defined(NO_IMPORT_ARRAY)
#endif // XBOB_BLITZ_MODULE
#endif // BOB_BLITZ_MODULE
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* XBOB_BLITZ_C_API_H */
#endif /* BOB_BLITZ_C_API_H */
......@@ -6,8 +6,8 @@
* easier and other cleanup helpers.
*/
#ifndef XBOB_BLITZ_CLEANUP_H
#define XBOB_BLITZ_CLEANUP_H
#ifndef BOB_BLITZ_CLEANUP_H
#define BOB_BLITZ_CLEANUP_H
#include <Python.h>
#include <boost/shared_ptr.hpp>
......@@ -42,4 +42,4 @@ template <typename T> boost::shared_ptr<T> make_xsafe(T* o) {
return boost::shared_ptr<T>(o, &__xdecref<T>);
}
#endif /* XBOB_BLITZ_CLEANUP_H */
#endif /* BOB_BLITZ_CLEANUP_H */
......@@ -6,10 +6,10 @@
* transforming C++ objects into our Pythonic blitz::Array<> layer.
*/
#ifndef XBOB_BLITZ_CPP_API_H
#define XBOB_BLITZ_CPP_API_H
#ifndef BOB_BLITZ_CPP_API_H
#define BOB_BLITZ_CPP_API_H
#include <xbob.blitz/capi.h>
#include <bob.blitz/capi.h>
#include <complex>
#include <blitz/array.h>
......@@ -173,7 +173,7 @@ template <typename T, int N>
PyObject* PyBlitzArrayCxx_NewFromConstArray(const blitz::Array<T,N>& a) {
if (!PyBlitzArrayCxx_IsBehaved(a)) {
PyErr_Format(PyExc_ValueError, "cannot convert C++ blitz::Array<%s,%d> which doesn't behave (memory contiguous, aligned, C-style) into a pythonic %s.array", PyBlitzArray_TypenumAsString(PyBlitzArrayCxx_CToTypenum<T>()), N, XBOB_BLITZ_PREFIX);
PyErr_Format(PyExc_ValueError, "cannot convert C++ blitz::Array<%s,%d> which doesn't behave (memory contiguous, aligned, C-style) into a pythonic %s.array", PyBlitzArray_TypenumAsString(PyBlitzArrayCxx_CToTypenum<T>()), N, BOB_BLITZ_PREFIX);
return 0;
}
......@@ -195,11 +195,11 @@ PyObject* PyBlitzArrayCxx_NewFromConstArray(const blitz::Array<T,N>& a) {
}
catch (std::exception& e) {
PyErr_Format(PyExc_RuntimeError, "caught exception while instantiating %s.array(@%d,'%s'): %s", XBOB_BLITZ_PREFIX, N, PyBlitzArray_TypenumAsString(PyBlitzArrayCxx_CToTypenum<T>()), e.what());
PyErr_Format(PyExc_RuntimeError, "caught exception while instantiating %s.array(@%d,'%s'): %s", BOB_BLITZ_PREFIX, N, PyBlitzArray_TypenumAsString(PyBlitzArrayCxx_CToTypenum<T>()), e.what());
}
catch (...) {
PyErr_Format(PyExc_RuntimeError, "caught unknown exception while instantiating %s.array(@%d,'%s')", XBOB_BLITZ_PREFIX, N, PyBlitzArray_TypenumAsString(PyBlitzArrayCxx_CToTypenum<T>()));
PyErr_Format(PyExc_RuntimeError, "caught unknown exception while instantiating %s.array(@%d,'%s')", BOB_BLITZ_PREFIX, N, PyBlitzArray_TypenumAsString(PyBlitzArrayCxx_CToTypenum<T>()));
}
/** some test code
......@@ -277,4 +277,4 @@ blitz::Array<T,N>* PyBlitzArrayCxx_AsBlitz(PyBlitzArrayObject* array, const char
return PyBlitzArrayCxx_AsBlitz<T,N>(array);
}
#endif /* XBOB_BLITZ_CPP_API_H */
#endif /* BOB_BLITZ_CPP_API_H */
......@@ -8,9 +8,9 @@
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#define XBOB_BLITZ_MODULE
#include <xbob.blitz/capi.h>
#include <xbob.blitz/cleanup.h>
#define BOB_BLITZ_MODULE
#include <bob.blitz/capi.h>
#include <bob.blitz/cleanup.h>
static PyObject* PyBlitzArray_as_blitz(PyObject*, PyObject* args, PyObject* kwds) {
......@@ -27,20 +27,20 @@ static PyObject* PyBlitzArray_as_blitz(PyObject*, PyObject* args, PyObject* kwds
PyDoc_STRVAR(s_as_blitz_str, "as_blitz");
PyDoc_STRVAR(s_as_blitz__doc__,
"as_blitz(x) -> xbob.blitz.array\n\
"as_blitz(x) -> bob.blitz.array\n\
\n\
Converts any compatible python object into a shallow " XBOB_EXT_MODULE_PREFIX ".array\n\
Converts any compatible python object into a shallow " BOB_EXT_MODULE_PREFIX ".array\n\
\n\
This function works by first converting the input object ``x`` into\n\
a :py:class:`numpy.ndarray` and then shallow wrapping that ``ndarray``\n\
into a new :py:class:`" XBOB_EXT_MODULE_PREFIX ".array`. You can access the converted\n\
into a new :py:class:`" BOB_EXT_MODULE_PREFIX ".array`. You can access the converted\n\
``ndarray`` using the returned value's ``base`` attribute. If the\n\
``ndarray`` cannot be shallow-wrapped, a :py:class:`ValueError` is\n\
raised.\n\
\n\
In the case the input object ``x`` is already a behaved (C-style,\n\
memory-aligned, contiguous) :py:class:`numpy.ndarray`, then this\n\
function only shallow wrap's it into a ``" XBOB_EXT_MODULE_PREFIX ".array`` skin.\n\
function only shallow wrap's it into a ``" BOB_EXT_MODULE_PREFIX ".array`` skin.\n\
"
);
......@@ -54,14 +54,14 @@ static PyMethodDef module_methods[] = {
{0} /* Sentinel */
};
int PyBlitzArray_APIVersion = XBOB_BLITZ_API_VERSION;
int PyBlitzArray_APIVersion = BOB_BLITZ_API_VERSION;
PyDoc_STRVAR(module_docstr, "Blitz++ array definition and generic functions");
#if PY_VERSION_HEX >= 0x03000000
static PyModuleDef module_definition = {
PyModuleDef_HEAD_INIT,
XBOB_EXT_MODULE_NAME,
BOB_EXT_MODULE_NAME,
module_docstr,
-1,
module_methods,
......@@ -77,15 +77,15 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject* m = PyModule_Create(&module_definition);
# else
PyObject* m = Py_InitModule3(XBOB_EXT_MODULE_NAME, module_methods, module_docstr);
PyObject* m = Py_InitModule3(BOB_EXT_MODULE_NAME, module_methods, module_docstr);
# endif
if (!m) return 0;
auto m_ = make_safe(m); ///< protects against early returns
/* register version numbers and constants */
if (PyModule_AddIntConstant(m, "__api_version__", XBOB_BLITZ_API_VERSION) < 0)
if (PyModule_AddIntConstant(m, "__api_version__", BOB_BLITZ_API_VERSION) < 0)
return 0;
if (PyModule_AddStringConstant(m, "__version__", XBOB_EXT_MODULE_VERSION) < 0)
if (PyModule_AddStringConstant(m, "__version__", BOB_EXT_MODULE_VERSION) < 0)
return 0;
/* register the type object to python */
......@@ -144,7 +144,7 @@ static PyObject* create_module (void) {
/* defines the PyCapsule */
PyObject* c_api_object = PyCapsule_New((void *)PyBlitzArray_API,
XBOB_EXT_MODULE_PREFIX "." XBOB_EXT_MODULE_NAME "._C_API", 0);
BOB_EXT_MODULE_PREFIX "." BOB_EXT_MODULE_NAME "._C_API", 0);
#else
......@@ -164,7 +164,7 @@ static PyObject* create_module (void) {
}
PyMODINIT_FUNC XBOB_EXT_ENTRY_NAME (void) {
PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) {
# if PY_VERSION_HEX >= 0x03000000
return
# endif
......
......@@ -17,8 +17,8 @@
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include <xbob.blitz/capi.h>
#include <xbob.blitz/cleanup.h>
#include <bob.blitz/capi.h>
#include <bob.blitz/cleanup.h>
static int dict_set(PyObject* d, const char* key, const char* value) {
PyObject* v = Py_BuildValue("s", value);
......@@ -113,7 +113,7 @@ PyDoc_STRVAR(module_docstr,
#if PY_VERSION_HEX >= 0x03000000
static PyModuleDef module_definition = {
PyModuleDef_HEAD_INIT,
XBOB_EXT_MODULE_NAME,
BOB_EXT_MODULE_NAME,
module_docstr,
-1,
module_methods,
......@@ -126,28 +126,28 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject* m = PyModule_Create(&module_definition);
# else
PyObject* m = Py_InitModule3(XBOB_EXT_MODULE_NAME, module_methods, module_docstr);
PyObject* m = Py_InitModule3(BOB_EXT_MODULE_NAME, module_methods, module_docstr);
# endif
if (!m) return 0;
auto m_ = make_safe(m); ///< protects against early returns
/* register version numbers and constants */
if (PyModule_AddIntConstant(m, "api", XBOB_BLITZ_API_VERSION) < 0)
if (PyModule_AddIntConstant(m, "api", BOB_BLITZ_API_VERSION) < 0)
return 0;
if (PyModule_AddStringConstant(m, "module", XBOB_EXT_MODULE_VERSION) < 0)
if (PyModule_AddStringConstant(m, "module", BOB_EXT_MODULE_VERSION) < 0)
return 0;
PyObject* externals = build_version_dictionary();
if (!externals) return 0;
if (PyModule_AddObject(m, "externals", externals) < 0) return 0;
if (import_xbob_blitz() < 0) return 0;
if (import_bob_blitz() < 0) return 0;
Py_INCREF(m);
return m;
}
PyMODINIT_FUNC XBOB_EXT_ENTRY_NAME (void) {
PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) {
# if PY_VERSION_HEX >= 0x03000000
return
# endif
......
......@@ -4,17 +4,17 @@
[buildout]
parts = scripts
eggs = xbob.blitz
eggs = bob.blitz
debug = true
verbose = true
extensions = xbob.buildout
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = src/xbob.extension
develop = src/bob.extension
.
[sources]
xbob.extension = git https://github.com/bioidiap/xbob.extension branch=prototype
bob.extension = git https://github.com/bioidiap/bob.extension
[scripts]
recipe = xbob.buildout:scripts
recipe = bob.buildout:scripts
......@@ -9,16 +9,16 @@
===============
This section includes information for using the pure C or C++ API for
manipulating :py:class:`xbob.xbob.blitz` objects in compiled code.
manipulating :py:class:`bob.bob.blitz` objects in compiled code.
C API
-----
The C API of ``xbob.blitz`` allows users to leverage from automatic converters
between :py:class:`numpy.ndarray` and :py:class:`xbob.blitz.array` within their