BEAM BLOCKAGE
pybeamb_compat.h File Reference

Python compability file for making it possible to compile beamb for both python >2.6 and python3. More...

#include "Python.h"

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)
 
#define PY_COMPARE_STRING_WITH_ATTRO_NAME(name, ptr)
 
#define MOD_INIT_ERROR
 
#define MOD_INIT_SUCCESS(val)
 
#define MOD_INIT(name)
 
#define MOD_INIT_DEF(ob, name, doc, methods)
 
#define MOD_INIT_CREATE_CAPI(ptr, name)
 
#define MOD_INIT_IS_CAPI(ptr)
 
#define MOD_INIT_GET_CAPI(ptr, name)
 
#define MOD_INIT_SETUP_TYPE(itype, otype)
 
#define MOD_INIT_VERIFY_TYPE_READY(type)
 
#define MOD_DIR_FORWARD_DECLARE(name)
 Macros that can be used to simplify way of generating dir content that is necessary for executing dir() on an object.
 
#define MOD_DIR_REFERENCE(name)
 
#define MOD_DIR_APPEND(list, str)
 
#define MOD_DIR_FUNCTION(name, method_listing)
 

Detailed Description

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

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

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)

◆ MOD_DIR_FORWARD_DECLARE

#define MOD_DIR_FORWARD_DECLARE ( name)
Value:
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.

◆ 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; \
}

◆ MOD_DIR_REFERENCE

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

◆ MOD_INIT

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

◆ MOD_INIT_CREATE_CAPI

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

◆ MOD_INIT_DEF

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

◆ MOD_INIT_GET_CAPI

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

◆ MOD_INIT_IS_CAPI

#define MOD_INIT_IS_CAPI ( ptr)
Value:
PyCObject_Check(ptr)

◆ MOD_INIT_SETUP_TYPE

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

◆ PY_COMPARE_ATTRO_NAME_WITH_STRING

#define PY_COMPARE_ATTRO_NAME_WITH_STRING ( ptr,
name )
Value:
PyBeambAPI_CompareWithASCIIString(ptr, name)

◆ PY_COMPARE_STRING_WITH_ATTRO_NAME

#define PY_COMPARE_STRING_WITH_ATTRO_NAME ( name,
ptr )
Value:
PyBeambAPI_CompareWithASCIIString(ptr, name)