ROPO
Loading...
Searching...
No Matches
pyropo_compat.h File Reference
#include "Python.h"
Include dependency graph for pyropo_compat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PyInt_Check   PyLong_Check
 
#define PyInt_FromLong   PyLong_FromLong
 
#define PyInt_AsLong   PyLong_AsLong
 
#define PyInt_Type   PyLong_Type
 
#define PyString_Check   PyUnicode_Check
 
#define PyString_AsString   PyUnicode_AsUTF8
 
#define PyString_FromString   PyUnicode_FromString
 
#define PyString_FromFormat   PyUnicode_FromFormat
 
#define PY_RAVE_ATTRO_NAME_TO_STRING   PyString_AsString
 
#define PY_COMPARE_ATTRO_NAME_WITH_STRING(ptr, name)   PyRopoAPI_CompareWithASCIIString(ptr, name)
 
#define PY_COMPARE_STRING_WITH_ATTRO_NAME(name, ptr)   PyRopoAPI_CompareWithASCIIString(ptr, name)
 
#define MOD_INIT_ERROR
 
#define MOD_INIT_SUCCESS(val)
 
#define MOD_INIT(name)   void init##name(void)
 
#define MOD_INIT_DEF(ob, name, doc, methods)    ob = Py_InitModule3(name, methods, doc);
 
#define MOD_INIT_CREATE_CAPI(ptr, name)   PyCObject_FromVoidPtr(ptr, name)
 
#define MOD_INIT_IS_CAPI(ptr)   PyCObject_Check(ptr)
 
#define MOD_INIT_GET_CAPI(ptr, name)   PyCObject_AsVoidPtr(ptr)
 
#define MOD_INIT_SETUP_TYPE(itype, otype)   itype.ob_type = otype
 
#define MOD_INIT_VERIFY_TYPE_READY(type)
 
#define MOD_DIR_FORWARD_DECLARE(name)   static PyObject* _##name##__dir__(name *self)
 
#define MOD_DIR_REFERENCE(name)   _##name##__dir__
 
#define MOD_DIR_APPEND(list, str)
 
#define MOD_DIR_FUNCTION(name, method_listing)
 

Detailed Description

Python compability file for making it possible to compile bropo for both python >2.6 and python3

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2010-03-30

Definition in file pyropo_compat.h.

Macro Definition Documentation

◆ MOD_DIR_APPEND

#define MOD_DIR_APPEND ( list,
str )
Value:
do { \
PyObject *o = PyUnicode_FromString(str); \
if (o != NULL) \
PyList_Append(list, o); \
Py_XDECREF(o); \
} while (0)

Definition at line 105 of file pyropo_compat.h.

◆ MOD_DIR_FORWARD_DECLARE

#define MOD_DIR_FORWARD_DECLARE ( name)    static PyObject* _##name##__dir__(name *self)

Macros that can be used to simplify way of generating dir content that is necessary for executing dir() on an object

Definition at line 101 of file pyropo_compat.h.

◆ MOD_DIR_FUNCTION

#define MOD_DIR_FUNCTION ( name,
method_listing )
Value:
static PyObject * _##name##__dir__(name *self) { \
int i=0; \
PyObject* rc = PyList_New(0); \
if (!rc) \
return NULL; \
\
while (method_listing[i].ml_name != NULL) { \
MOD_DIR_APPEND(rc, method_listing[i++].ml_name); \
} \
\
return rc; \
}

Definition at line 113 of file pyropo_compat.h.

◆ MOD_DIR_REFERENCE

#define MOD_DIR_REFERENCE ( name)    _##name##__dir__

Definition at line 103 of file pyropo_compat.h.

◆ MOD_INIT

#define MOD_INIT ( name)    void init##name(void)

Definition at line 88 of file pyropo_compat.h.

◆ MOD_INIT_CREATE_CAPI

#define MOD_INIT_CREATE_CAPI ( ptr,
name )   PyCObject_FromVoidPtr(ptr, name)

Definition at line 91 of file pyropo_compat.h.

◆ MOD_INIT_DEF

#define MOD_INIT_DEF ( ob,
name,
doc,
methods )    ob = Py_InitModule3(name, methods, doc);

Definition at line 89 of file pyropo_compat.h.

◆ MOD_INIT_ERROR

#define MOD_INIT_ERROR

Definition at line 86 of file pyropo_compat.h.

◆ MOD_INIT_GET_CAPI

#define MOD_INIT_GET_CAPI ( ptr,
name )   PyCObject_AsVoidPtr(ptr)

Definition at line 93 of file pyropo_compat.h.

◆ MOD_INIT_IS_CAPI

#define MOD_INIT_IS_CAPI ( ptr)    PyCObject_Check(ptr)

Definition at line 92 of file pyropo_compat.h.

◆ MOD_INIT_SETUP_TYPE

#define MOD_INIT_SETUP_TYPE ( itype,
otype )   itype.ob_type = otype

Definition at line 94 of file pyropo_compat.h.

◆ MOD_INIT_SUCCESS

#define MOD_INIT_SUCCESS ( val)

Definition at line 87 of file pyropo_compat.h.

◆ MOD_INIT_VERIFY_TYPE_READY

#define MOD_INIT_VERIFY_TYPE_READY ( type)

Definition at line 95 of file pyropo_compat.h.

◆ PY_COMPARE_ATTRO_NAME_WITH_STRING

#define PY_COMPARE_ATTRO_NAME_WITH_STRING ( ptr,
name )   PyRopoAPI_CompareWithASCIIString(ptr, name)

Definition at line 60 of file pyropo_compat.h.

◆ PY_COMPARE_STRING_WITH_ATTRO_NAME

#define PY_COMPARE_STRING_WITH_ATTRO_NAME ( name,
ptr )   PyRopoAPI_CompareWithASCIIString(ptr, name)

Definition at line 62 of file pyropo_compat.h.

◆ PY_RAVE_ATTRO_NAME_TO_STRING

#define PY_RAVE_ATTRO_NAME_TO_STRING   PyString_AsString

Definition at line 56 of file pyropo_compat.h.

◆ PyInt_AsLong

#define PyInt_AsLong   PyLong_AsLong

Definition at line 41 of file pyropo_compat.h.

◆ PyInt_Check

#define PyInt_Check   PyLong_Check

Definition at line 39 of file pyropo_compat.h.

◆ PyInt_FromLong

#define PyInt_FromLong   PyLong_FromLong

Definition at line 40 of file pyropo_compat.h.

◆ PyInt_Type

#define PyInt_Type   PyLong_Type

Definition at line 42 of file pyropo_compat.h.

◆ PyString_AsString

#define PyString_AsString   PyUnicode_AsUTF8

Definition at line 47 of file pyropo_compat.h.

◆ PyString_Check

#define PyString_Check   PyUnicode_Check

Definition at line 46 of file pyropo_compat.h.

◆ PyString_FromFormat

#define PyString_FromFormat   PyUnicode_FromFormat

Definition at line 49 of file pyropo_compat.h.

◆ PyString_FromString

#define PyString_FromString   PyUnicode_FromString

Definition at line 48 of file pyropo_compat.h.