You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.2 KiB
65 lines
1.2 KiB
include yslt.yml2
|
|
|
|
tstylesheet {
|
|
template "pEp" {
|
|
document("py_module.cc", "text") {
|
|
||
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <pybind11/pybind11.h>
|
|
#include <pybind11/detail/common.h>
|
|
#include "synth_shed.h"
|
|
|
|
using namespace std;
|
|
namespace py = pybind11;
|
|
|
|
PYBIND11_MODULE(synth_shed, m) {
|
|
|
|
`` apply "method"
|
|
|
|
`` apply "struct"
|
|
|
|
`` apply "enum"
|
|
|
|
}
|
|
||
|
|
}
|
|
document("gen_pybind.marker", "text") > ""
|
|
}
|
|
|
|
template "method" {
|
|
||
|
|
m.def("«@name»", &«@name», "");
|
|
||
|
|
}
|
|
|
|
template "struct" {
|
|
||
|
|
py::class_<«@name»>(m, "«@name»")
|
|
``apply "field"
|
|
;
|
|
|
|
||
|
|
}
|
|
|
|
template "field" {
|
|
||
|
|
.def_readwrite("«@name»", &::«../@name»::«@name»)
|
|
||
|
|
}
|
|
|
|
template "enum" {
|
|
||
|
|
py::enum_<::«@name»>(m, "«@name»")
|
|
``apply item
|
|
;
|
|
|
|
||
|
|
}
|
|
|
|
template "item" {
|
|
||
|
|
.value("«@name»", ::«@name», "")
|
|
||
|
|
}
|
|
}
|
|
|