Implements mutation & copy for rpnepxr
This commit is contained in:
parent
65875ab93a
commit
3c593f2a04
4 changed files with 723 additions and 2 deletions
|
|
@ -22,12 +22,14 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
#include "structmember.h"
|
||||
|
||||
#include "rpn_jit.h"
|
||||
#include "python_const.h"
|
||||
|
||||
/**@defgroup python_type RPNExpr Python class
|
||||
* @brief Exposed Python class : RPNExpr
|
||||
|
|
@ -134,6 +136,14 @@ PyObject* rpnexpr_getstate(PyObject *self, PyObject *noargs);
|
|||
*/
|
||||
PyObject* rpnexpr_setstate(PyObject *cls, PyObject *state);
|
||||
|
||||
/**@brief RPNExpr __copy__ method for cloning
|
||||
* @param self RPNExpr instance
|
||||
* @param noargs Not an argument...
|
||||
* @return A new cloned instance
|
||||
* @ref rpnexpr_setstate
|
||||
*/
|
||||
PyObject* rpnexpr_copy(PyObject *cls, PyObject *noargs);
|
||||
|
||||
/**@brief Eval an RPN expression given arguments and return the
|
||||
* value
|
||||
* @param self RPNExpr instance
|
||||
|
|
@ -144,6 +154,13 @@ PyObject* rpnexpr_setstate(PyObject *cls, PyObject *state);
|
|||
*/
|
||||
PyObject* rpnexpr_eval(PyObject* self, PyObject** argv, Py_ssize_t argc);
|
||||
|
||||
/**@brief Mutate an RPN expression given arguments and return the value
|
||||
* @param PyObject* RPNExpr instance
|
||||
* @param PyObject* Positionnal arguments
|
||||
* @param PyObject* Keyword arguments
|
||||
*/
|
||||
PyObject* rpnexpr_mutate(PyObject* self, PyObject *args, PyObject *kwds);
|
||||
|
||||
/**@brief Set all stack item to zero
|
||||
* @param self RPNExpr instance
|
||||
* @param noargs Dummy argument for METH_NOARG
|
||||
|
|
@ -172,4 +189,19 @@ PyObject* rpnexpr_str(PyObject *self);
|
|||
*/
|
||||
PyObject* rpnexpr_random(PyObject *cls, PyObject *args, PyObject *kwds);
|
||||
|
||||
/**@brief Return a new named tuple containing default mutation parameters
|
||||
* @param PyObject* The class (class method)
|
||||
* @param PyObject** The arguments (FASTCALL)
|
||||
* @param Py_ssize_t The number of arguments
|
||||
* @return The named tuple
|
||||
*/
|
||||
PyObject* rpnexpr_default_mutation_params(PyObject *cls, PyObject **argv, Py_ssize_t argc);
|
||||
|
||||
/**@brief Try to convert a python object into a rpn_mutation_params_t
|
||||
* @param PyObject* The python object
|
||||
* @param rpn_mutation_params_t A pointer on the parameters to initialize
|
||||
* @return -1 on failure and raise an exception
|
||||
*/
|
||||
int rpnexpr_pyobj_to_mutation_params(PyObject* py_params, rpn_mutation_params_t *params);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue