Blender V2.61 - r43446

py_capi_utils.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Campbell Barton
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #ifndef PY_CAPI_UTILS_H
00029 #define PY_CAPI_UTILS_H
00030 
00031 void            PyC_ObSpit(const char *name, PyObject *var);
00032 void            PyC_LineSpit(void);
00033 PyObject *      PyC_ExceptionBuffer(void);
00034 PyObject *      PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
00035 PyObject *      PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
00036 void            PyC_FileAndNum(const char **filename, int *lineno);
00037 void            PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */
00038 int             PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix);
00039 
00040 /* follow http://www.python.org/dev/peps/pep-0383/ */
00041 PyObject *      PyC_UnicodeFromByte(const char *str);
00042 PyObject *      PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size);
00043 const char *    PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
00044 
00045 /* name namespace function for bpy & bge */
00046 PyObject *      PyC_DefaultNameSpace(const char *filename);
00047 void            PyC_RunQuicky(const char *filepath, int n, ...);
00048 
00049 void PyC_MainModule_Backup(PyObject **main_mod);
00050 void PyC_MainModule_Restore(PyObject *main_mod);
00051 
00052 void PyC_SetHomePath(const char *py_path_bundle);
00053 
00054 #define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
00055 
00056 #endif // PY_CAPI_UTILS_H