Skip to content

Commit 2b78033

Browse files
Added pythonCAPI.h - for Windoze python support.
1 parent c22c6d8 commit 2b78033

File tree

2 files changed

+39
-15
lines changed

2 files changed

+39
-15
lines changed

pythonBuffer.h

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
/*
2-
@copyright Steve Keen 2023
2+
@copyright Russell Standish 2024
33
@author Russell Standish
4-
This file is part of Minsky.
4+
This file is part of Classdesc
55
6-
Minsky is free software: you can redistribute it and/or modify it
7-
under the terms of the GNU General Public License as published by
8-
the Free Software Foundation, either version 3 of the License, or
9-
(at your option) any later version.
10-
11-
Minsky is distributed in the hope that it will be useful,
12-
but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
GNU General Public License for more details.
15-
16-
You should have received a copy of the GNU General Public License
17-
along with Minsky. If not, see <http://www.gnu.org/licenses/>.
6+
Open source licensed under the MIT license. See LICENSE for details.
187
*/
198

209
/* A buffer implementation for marshalling function arguments from python onjects
@@ -28,7 +17,12 @@
2817
#include "signature.h"
2918
#include <deque>
3019
#include <numeric>
31-
#include <Python.h>
20+
//#ifdef MXE
21+
//#include <MXEPython.h>
22+
//#else
23+
//#include <Python.h>
24+
//#endif
25+
#include "pythonCAPI.h"
3226

3327
#define CLASSDESC_PY_EXCEPTION_ABSORB(ret) \
3428
catch (const std::exception& ex) \

pythonCAPI.h

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
@copyright Russell Standish 2025
3+
@author Russell Standish
4+
This file is part of Classdesc
5+
6+
Open source licensed under the MIT license. See LICENSE for details.
7+
*/
8+
9+
// Declares functions usded from the Python C API
10+
#ifndef CLASSDESC_PYTHON_CAPI_H
11+
#define CLASSDESC_PYTHON_CAPI_H
12+
13+
// TODO - is this field used on Windows?
14+
#define _PyObject_HEAD_EXTRA
15+
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
16+
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
17+
18+
extern "C" {
19+
typedef ssize_t Py_ssize_t;
20+
typedef struct _object {
21+
_PyObject_HEAD_EXTRA
22+
Py_ssize_t ob_refcnt;
23+
struct _typeobject *ob_type;
24+
} PyObject;
25+
26+
PyObject* PyUnicode_FromString(const char *);
27+
PyObject* PyDict_New();
28+
29+
}
30+
#endif

0 commit comments

Comments
 (0)