Debian Codegraph @

plugins/cfpython/include/cfpython.h

raw symbols SCIP
1 /*****************************************************************************/
2 /* CFPython - A Python module for Crossfire RPG. */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: [email protected] */
5 /*****************************************************************************/
6 /* That code is placed under the GNU General Public Licence (GPL) */
7 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
8 /*****************************************************************************/
9 /* CrossFire, A Multiplayer game for X-windows */
10 /* */
11 /* Copyright (C) 2000 Mark Wedel */
12 /* Copyright (C) 1992 Frank Tore Johansen */
13 /* */
14 /* This program is free software; you can redistribute it and/or modify */
15 /* it under the terms of the GNU General Public License as published by */
16 /* the Free Software Foundation; either version 2 of the License, or */
17 /* (at your option) any later version. */
18 /* */
19 /* This program is distributed in the hope that it will be useful, */
20 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 /* GNU General Public License for more details. */
23 /* */
24 /* You should have received a copy of the GNU General Public License */
25 /* along with this program; if not, write to the Free Software */
26 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* */
28 /*****************************************************************************/
29 #ifndef PLUGIN_PYTHON_H
30 #define PLUGIN_PYTHON_H
31
32 /* First the required header files - only the CF module interface and Python */
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 /* WIN32 */
42 #include <Python.h>
43 #endif
44
45 /* This is for allowing both python 3 and python 2.
46 * We also use some warnings and such with python 2.6 (and later 2.x).
47 */
48 #if PY_MAJOR_VERSION >= 3
49 # define IS_PY3K
50 #else /* Python 2.x */
51 # if PY_MINOR_VERSION >= 6 /* 2.6 or later */
52 # define IS_PY26
53 # else
54 # define IS_PY_LEGACY /* Pre-2.6 lack forward compat. changes for Py3 */
55 # endif
56 # if PY_MINOR_VERSION >= 5 /* PyNumberMethods changed in 2.5 */
57 # define IS_PY25
58 # endif
59 #endif
60
61 /* Python 2.5 or older doesn't define these. */
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 /* Python 2.6 and later use PyObject_HashNotImplemented to indicate no support
70 * for hash.
71 */
72 #ifdef IS_PY_LEGACY
73 # define PyObject_HashNotImplemented NULL
74 #endif
75
76 /* Handle Bytes vs. String */
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 /* include compile.h from python. Python.h doesn't pull it in with versions
84 * 2.3 and older, and it does have protection from double-imports.
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 /* PLUGIN_PYTHON_H */