123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /*
- * Copyright (C) 2020 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_PYRPN_H__
- #define _PYTHON_PYRPN_H__
-
- #include "config.h"
-
- #include <errno.h>
-
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
- #include "structmember.h"
-
- #include "rpn_jit.h"
- #include "python_rpnexpr.h"
- #include "python_if.h"
- #include "python_const.h"
- #include "python_rpntoken.h"
-
- /**@file python_pyrpn.h
- * @brief Python module & type headers
- * @ingroup python_ext
- * @ingroup pymod_pyrpn
- *
- * This file is the header of the pyrpn Python module definition
- */
-
- /**@defgroup python_ext Python extension
- * @brief RPNIFS python extension
- *
- * RPNIFS comes with a python extension module allowing to use the RPN
- * expressions in python.
- *
- * @ref python_pyrpn.c and @ref python_rpnexpr.c should be compiled in a .so file
- * in order to expose a pyrpn Python module.
- *
- * This module contains functions :
- * - pyrpn.get_ops() returning a dict with long & short operations
- * - pyrpn.random_expr(args_count, token_count=10) generating a random expression
- *
- * And it contains the pyrpn.RPNExpr class with following methods :
- * - pyrpn.RPNExpr.__init__(self, expression, args_count, stack_size=16)
- * - pyrpn.RPNExpr.eval(self, ...) expression evaluation
- * - pyrpn.RPNExpr.reset_stack(self) to set all stack items to 0
- */
-
- /**@defgroup pymod_pyrpn pyrpn Python module
- * @brief Python extension main entry-point
- * @ingroup python_ext
- */
-
- /**@brief RPNExpr Python class type definition */
- extern PyTypeObject RPNExprType;
-
- /**@brief Python module initialization function
- * @return The initialized module
- * @ingroup pymod_pyrpn */
- PyMODINIT_FUNC PyInit_pyrpn(void);
-
- /**@brief Python module specs
- * @ingroup pymod_pyrpn */
- extern PyModuleDef rpnmodule;
-
- /**@brief Return a dict with valid operations (short keys and long values)
- * @param mod pyrpn module object
- * @param noargs Dummy argument for METH_NOARG
- * @return The a new dict
- * @ingroup pymod_pyrpn
- */
- PyObject* pyrpn_ops(PyObject* mod, PyObject* noargs);
-
- /**@brief Return a new Python str with a random RPN expression
- * @param mod pyrpn module object
- * @param args Position arguments in Python list
- * @param kwds Keywords arguments in Python dict
- * @return A str instance
- * @ingroup pymod_pyrpn
- */
- PyObject* pyrpn_random(PyObject *mod, PyObject *args, PyObject *kwds);
-
- /**@mainpage
- * Documentation entrypoints :
- * - @ref python_ext
- * - @ref rpn_lang
- * - @ref rpn
- */
-
- #endif
|