summaryrefslogtreecommitdiffstats
path: root/pcilib/py.h
blob: 04b4e8be21c7973244516782d13b7c531fec7be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _PCILIB_PY_H
#define _PCILIB_PY_H

#include "pcilib.h"

typedef struct pcilib_py_s pcilib_py_t;
typedef void pcilib_py_object;

#ifdef __cplusplus
extern "C" {
#endif

int pcilib_init_py(pcilib_t *ctx);
int pcilib_py_add_script_dir(pcilib_t *ctx);
int pcilib_py_eval_string(pcilib_t *ctx, const char *codestr, pcilib_value_t *value);
void pcilib_free_py(pcilib_t *ctx);


int pcilib_py_init_script(pcilib_t *ctx, const char* module_name);
int pcilib_py_free_script(pcilib_t *ctx, const char* module_name);
int pcilib_script_run_func(pcilib_t *ctx, const char* module_name,
                           const char* func_name,  pcilib_value_t *val);
                           
int pcilib_py_get_transform_script_properties(pcilib_t *ctx,
                                              const char* module_name,
                                              pcilib_access_mode_t *mode);

/*!
 * \brief Converts pcilib_value_t to PyObject.
 * \param ctx pointer to pcilib_t context
 * \param val pointer to pcilib_value_t to convert
 * \return PyObject, containing value. NULL with error message, sended to errstream.
 */
pcilib_py_object* pcilib_get_value_as_pyobject(pcilib_t* ctx, pcilib_value_t *val, int *err);


/*!
 * \brief Converts PyObject to pcilib_value_t.
 * \param ctx pcilib context
 * \param pyVal python object, containing value
 * \param val initialized polymorphic value
 * \return 0 on success or memory error
 */
int pcilib_set_value_from_pyobject(pcilib_t* ctx, pcilib_value_t *val, pcilib_py_object* pyObjVal);


#ifdef __cplusplus
}
#endif


#endif /* _PCILIB_PY_H */