view PyExtensionModule.h @ 46:af9c4cee95a8

VC++ fixes. Much of this is changing "and" to "&&". I had never realised until today that "and" is in fact a keyword in C++, albeit not one that has been there since the start, so this should compile (I eventually looked this up having been puzzled by how this code could ever build with any other compiler). However, despite its keywordness, "and" still doesn't seem to be acceptable to VC++. Possibly there's an option to change this, or one could use a macro -- but why not just stick with the token that compilers are known to like?
author cannam
date Mon, 05 Oct 2009 16:14:25 +0000
parents 27bab3a16c9a
children
line wrap: on
line source
/*

 * Vampy : This plugin is a wrapper around the Vamp plugin API.
 * It allows for writing Vamp plugins in Python.

 * Centre for Digital Music, Queen Mary University of London.
 * Copyright (C) 2008-2009 Gyorgy Fazekas, QMUL. (See Vamp sources 
 * for licence information.)

*/

#ifndef _PYEXTENSIONMODULE_H_
#define _PYEXTENSIONMODULE_H_

#include <Python.h>
#include <limits.h>
#include "PyRealTime.h"
#include "PyFeature.h"
#include "PyFeatureSet.h"
#include "PyParameterDescriptor.h"
#include "PyOutputDescriptor.h"

#ifndef UINT_MAX
#define UINT_MAX ((unsigned int) -1)
#endif
#define UINT_MAXD ((double) UINT_MAX)
/* long error() { std::cerr << "type error" << std::endl; return 0; } */
#define _dbl2uint(x) ((x) < 0 || (x) > UINT_MAXD ? 0 : (unsigned int)(x)+0.5)
#define _long2uint(x) ((x) < 0 || (x) > UINT_MAXD ? 0 : (unsigned int)(x))

using std::string;
using std::vector;

enum eVampyFlags {
	vf_NULL = 0,
	vf_DEBUG = 1, 
	vf_STRICT = 2,
	vf_QUIT = 4,
	vf_REALTIME = 8,
	vf_BUFFER = 16,
	vf_ARRAY = 32,
	vf_DEFAULT_V2 = (32 | 8)
};

#define PyDescriptor_Check(v) ((v)->ob_type == &Feature_Type) || ((v)->ob_type == &OutputDescriptor_Type) || ((v)->ob_type == &ParameterDescriptor_Type)

#ifndef PyMODINIT_FUNC
#define PyMODINIT_FUNC void
#endif

PyMODINIT_FUNC initvampy();

#endif