mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-09 09:21:58 +00:00
pyosys: rewrite wrapper generator
[skip ci]
This commit is contained in:
parent
88be728353
commit
384f7431fd
7 changed files with 738 additions and 2011 deletions
|
@ -48,6 +48,7 @@
|
|||
#include "kernel/hashlib.h"
|
||||
|
||||
namespace pybind11 {
|
||||
namespace hashlib {
|
||||
|
||||
template<typename T>
|
||||
struct is_pointer { static const bool value = false; };
|
||||
|
@ -59,6 +60,11 @@ bool is_mapping(object obj) {
|
|||
return isinstance(obj, mapping);
|
||||
}
|
||||
|
||||
// shim
|
||||
template <typename C, typename V>
|
||||
void bind_vector(module &m, const char *name_cstr) {
|
||||
pybind11::bind_vector<C>(m, name_cstr);
|
||||
}
|
||||
|
||||
// also used for std::set because the semantics are close enough
|
||||
template <typename C, typename T>
|
||||
|
@ -106,6 +112,13 @@ void bind_pool(module &m, const char *name_cstr) {
|
|||
});
|
||||
}
|
||||
|
||||
// shim
|
||||
template <typename C, typename T>
|
||||
void bind_set(module &m, const char *name_cstr) {
|
||||
bind_pool<C, T>(m, name_cstr);
|
||||
}
|
||||
|
||||
|
||||
template <typename C, typename K, typename V>
|
||||
void update_dict(C *target, iterable &iterable_or_mapping) {
|
||||
if (is_mapping(iterable_or_mapping)) {
|
||||
|
@ -272,4 +285,5 @@ void bind_idict(module &m, const char *name_cstr) {
|
|||
});
|
||||
}
|
||||
}
|
||||
}; // namespace hashlib
|
||||
}; // namespace pybind11
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue