CMake: add WITH_LINKER_LLD option for unix platforms
[blender-staging.git] / source / blender / python / BPY_extern.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16
17 /** \file
18  * \ingroup python
19  */
20
21 #ifndef __BPY_EXTERN_H__
22 #define __BPY_EXTERN_H__
23
24 struct ChannelDriver; /* DNA_anim_types.h */
25 struct ID;            /* DNA_ID.h */
26 struct ListBase;      /* DNA_listBase.h */
27 struct Object;        /* DNA_object_types.h */
28 struct PathResolvedRNA;
29 struct ReportList;
30 struct Text;              /* defined in DNA_text_types.h */
31 struct bConstraint;       /* DNA_constraint_types.h */
32 struct bConstraintOb;     /* DNA_constraint_types.h */
33 struct bConstraintTarget; /* DNA_constraint_types.h*/
34 struct bContext;
35 struct bContextDataResult;
36 struct bPythonConstraint; /* DNA_constraint_types.h */
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #include "BLI_utildefines.h"
43
44 void BPY_pyconstraint_exec(struct bPythonConstraint *con,
45                            struct bConstraintOb *cob,
46                            struct ListBase *targets);
47 //  void BPY_pyconstraint_settings(void *arg1, void *arg2);
48 void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct);
49 void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
50 int BPY_is_pyconstraint(struct Text *text);
51 //  void BPY_free_pyconstraint_links(struct Text *text);
52
53 void BPY_python_start(int argc, const char **argv);
54 void BPY_python_end(void);
55 void BPY_python_reset(struct bContext *C);
56 void BPY_python_use_system_env(void);
57
58 /* global interpreter lock */
59
60 typedef void *BPy_ThreadStatePtr;
61
62 BPy_ThreadStatePtr BPY_thread_save(void);
63 void BPY_thread_restore(BPy_ThreadStatePtr tstate);
64
65 /* our own wrappers to Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS */
66 #define BPy_BEGIN_ALLOW_THREADS \
67   { \
68     BPy_ThreadStatePtr _bpy_saved_tstate = BPY_thread_save(); \
69     (void)0
70 #define BPy_END_ALLOW_THREADS \
71   BPY_thread_restore(_bpy_saved_tstate); \
72   } \
73   (void)0
74
75 bool BPY_execute_filepath(struct bContext *C, const char *filepath, struct ReportList *reports);
76 bool BPY_execute_text(struct bContext *C,
77                       struct Text *text,
78                       struct ReportList *reports,
79                       const bool do_jump);
80
81 bool BPY_execute_string_as_number(struct bContext *C,
82                                   const char *imports[],
83                                   const char *expr,
84                                   const bool verbose,
85                                   double *r_value);
86 bool BPY_execute_string_as_intptr(struct bContext *C,
87                                   const char *imports[],
88                                   const char *expr,
89                                   const bool verbose,
90                                   intptr_t *r_value);
91 bool BPY_execute_string_as_string_and_size(struct bContext *C,
92                                            const char *imports[],
93                                            const char *expr,
94                                            const bool verbose,
95                                            char **r_value,
96                                            size_t *r_value_size);
97 bool BPY_execute_string_as_string(struct bContext *C,
98                                   const char *imports[],
99                                   const char *expr,
100                                   const bool verbose,
101                                   char **r_value);
102
103 bool BPY_execute_string_ex(struct bContext *C,
104                            const char *imports[],
105                            const char *expr,
106                            bool use_eval);
107 bool BPY_execute_string(struct bContext *C, const char *imports[], const char *expr);
108
109 void BPY_text_free_code(struct Text *text);
110 void BPY_modules_update(
111     struct bContext *C);  // XXX - annoying, need this for pointers that get out of date
112 void BPY_modules_load_user(struct bContext *C);
113
114 void BPY_app_handlers_reset(const short do_all);
115
116 void BPY_driver_reset(void);
117 float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
118                       struct ChannelDriver *driver,
119                       struct ChannelDriver *driver_orig,
120                       const float evaltime);
121
122 void BPY_DECREF(void *pyob_ptr); /* Py_DECREF() */
123 void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr);
124 int BPY_context_member_get(struct bContext *C,
125                            const char *member,
126                            struct bContextDataResult *result);
127 void BPY_context_set(struct bContext *C);
128 void BPY_context_update(struct bContext *C);
129
130 void BPY_id_release(struct ID *id);
131
132 bool BPY_string_is_keyword(const char *str);
133
134 /* I18n for addons */
135 #ifdef WITH_INTERNATIONAL
136 const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *msgid);
137 #endif
138
139 #ifdef __cplusplus
140 } /* extern "C" */
141 #endif
142
143 #endif /* __BPY_EXTERN_H__ */