| 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 |
#ifndef PLUGIN_PYTHON_H |
| 30 |
#define PLUGIN_PYTHON_H |
| 31 |
|
| 32 |
|
| 33 |
#ifdef WIN32 |
| 34 |
#ifdef _DEBUG |
| 35 |
#undef _DEBUG |
| 36 |
#include <Python.h> |
| 37 |
#define _DEBUG |
| 38 |
#else |
| 39 |
#include <Python.h> |
| 40 |
#endif |
| 41 |
#else |
| 42 |
#include <Python.h> |
| 43 |
#endif |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
#if PY_MAJOR_VERSION >= 3 |
| 49 |
# define IS_PY3K |
| 50 |
#else |
| 51 |
# if PY_MINOR_VERSION >= 6 |
| 52 |
# define IS_PY26 |
| 53 |
# else |
| 54 |
# define IS_PY_LEGACY |
| 55 |
# endif |
| 56 |
# if PY_MINOR_VERSION >= 5 |
| 57 |
# define IS_PY25 |
| 58 |
# endif |
| 59 |
#endif |
| 60 |
|
| 61 |
|
| 62 |
#ifndef Py_SIZE |
| 63 |
# define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) |
| 64 |
#endif |
| 65 |
#ifndef Py_TYPE |
| 66 |
# define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
| 67 |
#endif |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
#ifdef IS_PY_LEGACY |
| 73 |
# define PyObject_HashNotImplemented NULL |
| 74 |
#endif |
| 75 |
|
| 76 |
|
| 77 |
#ifdef IS_PY3K |
| 78 |
# define CF_IS_PYSTR(cfpy_obj) (PyUnicode_Check(cfpy_obj)) |
| 79 |
#else |
| 80 |
# define CF_IS_PYSTR(cfpy_obj) (PyString_Check(cfpy_obj) || PyUnicode_Check(cfpy_obj)) |
| 81 |
#endif |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
#include <compile.h> |
| 87 |
#include <plugin.h> |
| 88 |
|
| 89 |
#undef MODULEAPI |
| 90 |
#ifdef WIN32 |
| 91 |
# ifdef PYTHON_PLUGIN_EXPORTS |
| 92 |
# define MODULEAPI __declspec(dllexport) |
| 93 |
# else |
| 94 |
# define MODULEAPI __declspec(dllimport) |
| 95 |
# endif |
| 96 |
#else |
| 97 |
#ifdef HAVE_VISIBILITY |
| 98 |
# define MODULEAPI __attribute__((visibility("default"))) |
| 99 |
#else |
| 100 |
# define MODULEAPI |
| 101 |
#endif |
| 102 |
#endif |
| 103 |
|
| 104 |
#define PLUGIN_NAME "Python" |
| 105 |
#define PLUGIN_VERSION "CFPython Plugin 2.0a13 (Fido)" |
| 106 |
|
| 107 |
#include <plugin_common.h> |
| 108 |
#include <cfpython_object.h> |
| 109 |
#include <cfpython_map.h> |
| 110 |
#include <cfpython_archetype.h> |
| 111 |
#include <cfpython_party.h> |
| 112 |
#include <cfpython_region.h> |
| 113 |
|
| 114 |
typedef struct _cfpcontext { |
| 115 |
struct _cfpcontext *down; |
| 116 |
PyObject *who; |
| 117 |
PyObject *activator; |
| 118 |
PyObject *third; |
| 119 |
PyObject *event; |
| 120 |
char message[1024]; |
| 121 |
int fix; |
| 122 |
int event_code; |
| 123 |
char script[1024]; |
| 124 |
char options[1024]; |
| 125 |
int returnvalue; |
| 126 |
int parms[5]; |
| 127 |
struct talk_info *talk; |
| 128 |
} CFPContext; |
| 129 |
|
| 130 |
extern f_plug_api gethook; |
| 131 |
|
| 132 |
extern CFPContext *context_stack; |
| 133 |
|
| 134 |
extern CFPContext *current_context; |
| 135 |
|
| 136 |
#include <cfpython_proto.h> |
| 137 |
|
| 138 |
#endif |