PLearn 0.1
PythonIncludes.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // PythonIncludes.h
00004 //
00005 // Copyright (C) 2005 Nicolas Chapados 
00006 // 
00007 // Redistribution and use in source and binary forms, with or without
00008 // modification, are permitted provided that the following conditions are met:
00009 // 
00010 //  1. Redistributions of source code must retain the above copyright
00011 //     notice, this list of conditions and the following disclaimer.
00012 // 
00013 //  2. Redistributions in binary form must reproduce the above copyright
00014 //     notice, this list of conditions and the following disclaimer in the
00015 //     documentation and/or other materials provided with the distribution.
00016 // 
00017 //  3. The name of the authors may not be used to endorse or promote
00018 //     products derived from this software without specific prior written
00019 //     permission.
00020 // 
00021 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
00022 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00023 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
00024 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00026 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00027 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00029 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 // 
00032 // This file is part of the PLearn library. For more information on the PLearn
00033 // library, go to the PLearn Web site at www.plearn.org
00034 
00035 /* *******************************************************      
00036    * $Id: .pyskeleton_header 544 2003-09-01 00:05:31Z plearner $ 
00037    ******************************************************* */
00038 
00039 // Authors: Nicolas Chapados
00040 
00056 #ifdef PL_PYTHON_VERSION
00057 
00058 // Under Windows with Microsoft Visual Studio in debug mode, _DEBUG is defined
00059 // resulting in a dependence on the python24_d.lib library file. To get rid of
00060 // this, we undefine _DEBUG before including the python headers.
00061 #if defined(WIN32) && defined(_DEBUG)
00062 #define NEED_REDEFINE_DEBUG
00063 #undef _DEBUG
00064 #endif
00065 
00066 /* allow to be undefined
00067 #ifndef PL_PYTHON_VERSION
00068 #  define PL_PYTHON_VERSION 230
00069 #endif
00070 */
00071 
00072 #if defined(PL_USE_NUMARRAY) && defined(PL_USE_NUMPY)
00073 #  error "Symbols PL_USE_NUMARRAY and PL_USE_NUMPY are mutually exclusive; they should not both be defined"
00074 #endif
00075 
00076 #if PL_PYTHON_VERSION >= 270
00077 
00078 #include <python2.7/Python.h>
00079 #include <python2.7/compile.h>  // define PyCodeObject
00080 #include <python2.7/eval.h>     // for accessing PyEval_EvalCode: not included by default
00081 #ifdef PL_USE_NUMARRAY
00082 #  include <python2.7/numarray/libnumarray.h>
00083 #else
00084 #  ifdef PL_USE_NUMPY
00085 #    pragma GCC system_header //suppress all warnings/errors for numpy
00086 #    include <libnumarray.h>
00087 #  else
00088 #    error "should use either NumPy (preferred) or NUMARRAY (deprecated)"
00089 #  endif //def PL_USE_NUMPY
00090 #endif //def PL_USE_NUMARRAY
00091 
00092 #elif PL_PYTHON_VERSION >= 260
00093 
00094 #include <python2.6/Python.h>
00095 #include <python2.6/compile.h>  // define PyCodeObject
00096 #include <python2.6/eval.h>     // for accessing PyEval_EvalCode: not included by default
00097 #ifdef PL_USE_NUMARRAY
00098 #  include <python2.6/numarray/libnumarray.h>
00099 #else
00100 #  ifdef PL_USE_NUMPY
00101 #    pragma GCC system_header //suppress all warnings/errors for numpy
00102 #    include <libnumarray.h>
00103 #  else
00104 #    error "should use either NumPy (preferred) or NUMARRAY (deprecated)"
00105 #  endif //def PL_USE_NUMPY
00106 #endif //def PL_USE_NUMARRAY
00107 
00108 #elif PL_PYTHON_VERSION >= 250
00109 
00110 #include <python2.5/Python.h>
00111 #include <python2.5/compile.h>  // define PyCodeObject
00112 #include <python2.5/eval.h>     // for accessing PyEval_EvalCode: not included by default
00113 #ifdef PL_USE_NUMARRAY
00114 #  include <python2.5/numarray/libnumarray.h>
00115 #else
00116 #  ifdef PL_USE_NUMPY
00117 #    pragma GCC system_header //suppress all warnings/errors for numpy
00118 #    include <libnumarray.h>
00119 #  else
00120 #    error "should use either NumPy (preferred) or NUMARRAY (deprecated)"
00121 #  endif //def PL_USE_NUMPY
00122 #endif //def PL_USE_NUMARRAY
00123 
00124 #elif PL_PYTHON_VERSION >= 240
00125 
00126 #include <python2.4/Python.h>
00127 #include <python2.4/compile.h>  // define PyCodeObject
00128 #include <python2.4/eval.h>     // for accessing PyEval_EvalCode: not included by default
00129 #ifdef PL_USE_NUMARRAY
00130 #  include <python2.4/numarray/libnumarray.h>
00131 #else
00132 #  ifdef PL_USE_NUMPY
00133 #    pragma GCC system_header //suppress all warnings/errors for numpy
00134 #    include <libnumarray.h>
00135 #  else
00136 #    error "should use either NumPy (preferred) or NUMARRAY (deprecated)"
00137 #  endif //def PL_USE_NUMPY
00138 #endif //def PL_USE_NUMARRAY
00139 
00140 #elif PL_PYTHON_VERSION >= 230
00141 
00142 #include <python2.3/Python.h>
00143 #include <python2.3/compile.h>  // define PyCodeObject
00144 #include <python2.3/eval.h>     // for accessing PyEval_EvalCode: not included by default
00145 #include <python2.3/numarray/libnumarray.h>
00146 
00147 #else
00148 /*
00149 // it is not an error not to include python
00150 #  error "PL_PYTHON_VERSION should be defined to one of: 230, 240, 250"
00151 */
00152 #endif
00153 
00154 // Redefine _DEBUG if needed (see above).
00155 #ifdef NEED_REDEFINE_DEBUG
00156 #define _DEBUG
00157 #undef NEED_REDEFINE_DEBUG
00158 #endif
00159 
00160 // Undefine HAVE_LONG_LONG so we do not get an annoying warning when using
00161 // PythonIncludes.h together with NSPR or other libraries that also define
00162 // this. Works only because PythonIncludes.h *must* be the very first include,
00163 // so we know that if there is an HAVE_LONG_LONG defined, we are the one that
00164 // defined it.
00165 //
00166 #undef HAVE_LONG_LONG
00167 
00168 #endif //def PL_PYTHON_VERSION
00169 
00170 
00171 /*
00172   Local Variables:
00173   mode:c++
00174   c-basic-offset:4
00175   c-file-style:"stroustrup"
00176   c-file-offsets:((innamespace . 0)(inline-open . 0))
00177   indent-tabs-mode:nil
00178   fill-column:79
00179   End:
00180 */
00181 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines