bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/libbreezy
1
by Gustav Hartvigsson
the start of this dumb experiment |
1 |
/* libbreezy.c
|
2 |
*
|
|
3 |
* Copyright 2021 Gustav Hartvigsson
|
|
4 |
*
|
|
5 |
* This program is free software: you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License as published by
|
|
7 |
* the Free Software Foundation, either version 3 of the License, or
|
|
8 |
* (at your option) any later version.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
*/
|
|
18 |
||
19 |
#include "libbreezy.h" |
|
20 |
#include "libbreezy_private.h" |
|
21 |
||
22 |
BRZ_Ctx * private_get_brz_context (); |
|
23 |
||
24 |
||
25 |
void
|
|
26 |
brz_init () { |
|
27 |
Py_Initialize (); |
|
28 |
__brz_context__ = malloc (sizeof (BRZ_Ctx)); |
|
29 |
|
|
30 |
__brz_context__->program = |
|
31 |
PyRun_String (__BRZ_PY_PROGRAM__, |
|
32 |
0, |
|
33 |
__brz_context__->global, |
|
34 |
__brz_context__->local); |
|
35 |
|
|
36 |
}
|
|
37 |
||
38 |
void
|
|
39 |
brz_deinit () { |
|
40 |
|
|
41 |
Py_Finalize (); |
|
42 |
|
|
43 |
free (__brz_context__); |
|
44 |
|
|
45 |
}
|
|
46 |
||
47 |
char * |
|
48 |
brz_get_version_str () { |
|
49 |
char * retval = NULL; |
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
return retval; |
|
54 |
}
|
|
55 |
||
56 |
||
57 |
BRZ_Ctx * |
|
58 |
private_get_brz_context () { |
|
59 |
brz_assert_msg (__brz_context__ != NULL, "Context not initalized."); |
|
60 |
|
|
61 |
return __brz_context__; |
|
62 |
}
|