aboutsummaryrefslogtreecommitdiffstats
path: root/common/pybindings.h
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-23 16:14:39 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-23 16:14:39 +0200
commit0ccd9febebdb7f2de700d116a8498f23de093e88 (patch)
tree094f717951a81fd91d01e3d776695629f354d089 /common/pybindings.h
parenta40d9dc514b680538d0ffa99873974a15bff9e97 (diff)
parent1e8840b0f9400a1dc17ba6c7496314f82f0db2e1 (diff)
downloadnextpnr-0ccd9febebdb7f2de700d116a8498f23de093e88.tar.gz
nextpnr-0ccd9febebdb7f2de700d116a8498f23de093e88.tar.bz2
nextpnr-0ccd9febebdb7f2de700d116a8498f23de093e88.zip
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'common/pybindings.h')
-rw-r--r--common/pybindings.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/common/pybindings.h b/common/pybindings.h
index 4379a1aa..1f5ca004 100644
--- a/common/pybindings.h
+++ b/common/pybindings.h
@@ -45,26 +45,18 @@ template <typename T> struct string_wrapper
{
from_pystring_converter()
{
- converter::registry::push_back(&convertible, &construct,
- boost::python::type_id<T>());
+ converter::registry::push_back(&convertible, &construct, boost::python::type_id<T>());
};
- static void *convertible(PyObject *object)
- {
- return PyUnicode_Check(object) ? object : 0;
- }
+ static void *convertible(PyObject *object) { return PyUnicode_Check(object) ? object : 0; }
- static void construct(PyObject *object,
- converter::rvalue_from_python_stage1_data *data)
+ static void construct(PyObject *object, converter::rvalue_from_python_stage1_data *data)
{
const wchar_t *value = PyUnicode_AsUnicode(object);
const std::wstring value_ws(value);
if (value == 0)
throw_error_already_set();
- void *storage =
- ((boost::python::converter::rvalue_from_python_storage<T> *)
- data)
- ->storage.bytes;
+ void *storage = ((boost::python::converter::rvalue_from_python_storage<T> *)data)->storage.bytes;
new (storage) T(fn(std::string(value_ws.begin(), value_ws.end())));
data->convertible = storage;
}
@@ -79,8 +71,7 @@ template <typename T> struct string_wrapper
std::string str(T &x) { return fn(x); }
};
- template <typename F1, typename F2>
- static void wrap(const char *type_name, F1 to_str_fn, F2 from_str_fn)
+ template <typename F1, typename F2> static void wrap(const char *type_name, F1 to_str_fn, F2 from_str_fn)
{
from_pystring_converter<F2>::fn = from_str_fn;
from_pystring_converter<F2>();