1 // -*- C++ -*-
2 //
3 // KimAsapPython.h: Fake AsapPython.h file defining fake Python objects.
4 //
5 // Copyright (C) 2012-2013 Jakob Schiotz and the Department of Physics,
6 // Technical University of Denmark.  Email: schiotz@fysik.dtu.dk
7 //
8 // This file is part of Asap version 3.
9 // Asap is released under the GNU Lesser Public License (LGPL) version 3.
10 // However, the parts of Asap distributed within the OpenKIM project
11 // (including this file) are also released under the Common Development
12 // and Distribution License (CDDL) version 1.0.
13 //
14 // This program is free software: you can redistribute it and/or
15 // modify it under the terms of the GNU Lesser General Public License
16 // version 3 as published by the Free Software Foundation.  Permission
17 // to use other versions of the GNU Lesser General Public License may
18 // granted by Jakob Schiotz or the head of department of the
19 // Department of Physics, Technical University of Denmark, as
20 // described in section 14 of the GNU General Public License.
21 //
22 // This program is distributed in the hope that it will be useful,
23 // but WITHOUT ANY WARRANTY; without even the implied warranty of
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 // GNU General Public License for more details.
26 //
27 // You should have received a copy of the GNU General Public License
28 // and the GNU Lesser Public License along with this program.  If not,
29 // see <http://www.gnu.org/licenses/>.
30 
31 
32 
33 // Fake AsapPython.h file defining fake Python objects!
34 
35 #ifndef KIMASAPPYTHON_H
36 #define KIMASAPPYTHON_H
37 
38 #include "KIM_ModelHeaders.hpp"
39 
40 #define PyObject_HEAD int ob_refcnt;
41 
42 typedef struct {
43   PyObject_HEAD
44 } PyObject;
45 
46 
47 #define Py_INCREF(op) ((PyObject*)(op))->ob_refcnt++
48 
49 #define Py_DECREF(op)                                   \
50     do {                                                \
51         if (--((PyObject*)(op))->ob_refcnt == 0)        \
52           free(op);                                     \
53     } while (0)
54 
55 #define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
56 #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)
57 
58 #define CHECKREF(x)
59 
60 #define Py_None NULL
61 
62 #define PyErr_SetString(a, b) LOG_ERROR(b)
63 
64 // The following looks wrong on a 64-bit machine, but is actually OK
65 // as all stuff depending on this type being 32-bit is gone in the KIM
66 // wrapper case.
67 typedef int npy_int32;
68 
69 #endif // not KIMASAPPYTHON_H
70