123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- /*
- * Copyright (C) 2020,2023 Weber Yann
- *
- * This file is part of pyrpn.
- *
- * pyrpn is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * pyrpn is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with pyrpn. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _PYTHON_IFS_H__
- #define _PYTHON_IFS_H__
-
- #include "config.h"
-
- #include <errno.h>
-
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
- #include "structmember.h"
-
- #include "rpn_if.h"
- #include "rpn_if_default.h"
- #include "rpn_ifs.h"
- #include "python_rpnexpr.h"
- #include "python_if.h"
- #include "python_const.h"
-
-
- /**@file python_ifs.h */
-
- /** @brief RPNIFS Python class type definition */
- extern PyTypeObject RPNIFSType;
-
- /**@brief Points on Python's std mmap module */
- extern PyObject *mmap_module;
- /**@brief Python's mmap.mmap class */
- extern PyObject *mmap_cls;
-
- /** @brief Structure holding RPNIFS attributes */
- typedef struct
- {
- PyObject_VAR_HEAD;
-
- /** @brief Tuple with RPNIterExpr instances */
- PyObject *rpn_if;
-
- /** @brief Tuple with RPNExpr instances */
- PyObject *rpn_expr;
-
- /** @brief IFS pointer */
- rpn_ifs_t *ifs;
-
- /** @brief Pointer on IF expressions in the system */
- rpn_if_t **rifs;
-
-
- /**@brief Python mmap.mmap instance representing rif memory map
- * @note NULL if unpickled instance */
- PyObject *mmap;
-
- /**@brief Memory map buffer allowing acces to underlying pointer
- * @note unrelevant if unpickled instance */
- Py_buffer mm_buff;
-
- /**@brief Memory map buffer pointer */
- void *_mmap;
-
- } PyRPNIFS_t;
-
-
- PyObject *rpnifs_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
- int rpnifs_init(PyObject *self, PyObject *args, PyObject *kwds);
- void rpnifs_del(PyObject *self);
-
-
- PyObject *rpnifs_to_pos(PyObject *self, PyObject** argv, Py_ssize_t argc);
- PyObject *rpnifs_from_pos(PyObject *self, PyObject* _pos);
-
- PyObject *rpnifs_weights(PyObject *self, PyObject *const *args, Py_ssize_t nargs);
- PyObject *rpnifs_weight(PyObject *self, PyObject *const *args, Py_ssize_t nargs);
- PyObject *rpnifs_position(PyObject *self, PyObject *const *args, Py_ssize_t nargs);
- PyObject *rpnifs_run(PyObject *self, PyObject *const *args, Py_ssize_t nargs);
-
- PyObject *rpnifs_str(PyObject *self);
- PyObject *rpnifs_repr(PyObject *self);
-
- Py_ssize_t rpnifs_len(PyObject *self);
- PyObject *rpnifs_expr_item(PyObject *self, Py_ssize_t idx);
- int rpnifs_expr_ass_item(PyObject *self, Py_ssize_t idx, PyObject *value);
-
- int rpnifs_getbuffer(PyObject *self, Py_buffer *view, int flags);
- void rpnifs_releasebuffer(PyObject *self, Py_buffer *view);
-
- int _rpnifs_update_if_tuple(PyRPNIFS_t *ifs_self);
-
-
- #endif
|