I am trying to make it so that the Chaiscript module for c++ will work with python. My problem is that the main class I need to use is more advanced then what is used in the tutorials, making it challenging to complete my goal.
The class I want to implement in cython is:
// chaiscript.hpp
#include "chaiscript_basic.hpp"
#include "language/chaiscript_parser.hpp"
#include "chaiscript_stdlib.hpp"
namespace chaiscript
{
class ChaiScript : public ChaiScript_Basic
{
public:
ChaiScript(std::vector<std::string> t_modulepaths = {},
std::vector<std::string> t_usepaths = {},
const std::vector<Options> &t_opts = chaiscript::default_options())
: ChaiScript_Basic(
chaiscript::Std_Lib::library(),
std::make_unique<parser::ChaiScript_Parser<eval::Noop_Tracer, optimizer::Optimizer_Default>>(),
t_modulepaths, t_usepaths, t_opts)
{
}
};
}
and the cython I have gotten written so far is:
from libcpp.vector cimport vector
from libcpp.string cimport string
from libcpp.utility cimport *
cdef extern from "./chaiscript.hpp" namespace "chaiscript":
cdef cppclass ChaiScript:
ChaiScript(vector[string] t_modulepaths = {},
vector[string] t_usepaths = {},
const vector[Options] &t_opts = default_options())
cdef class PyChaiscript:
cdef ChaiScript * ptr