annotate PyExtensionModule.h @ 92:a6718f9fe942

If a module appears to redefine one of our own types, refuse to load it. Also clear out the class dict for all refused modules now, so that we don't get stale names on the next scan due to not having cleared the module on unload
author Chris Cannam
date Mon, 14 Jan 2019 16:19:44 +0000
parents 27bab3a16c9a
children
rev   line source
fazekasgy@37 1 /*
fazekasgy@37 2
fazekasgy@37 3 * Vampy : This plugin is a wrapper around the Vamp plugin API.
fazekasgy@37 4 * It allows for writing Vamp plugins in Python.
fazekasgy@37 5
fazekasgy@37 6 * Centre for Digital Music, Queen Mary University of London.
fazekasgy@37 7 * Copyright (C) 2008-2009 Gyorgy Fazekas, QMUL. (See Vamp sources
fazekasgy@37 8 * for licence information.)
fazekasgy@37 9
fazekasgy@37 10 */
fazekasgy@37 11
fazekasgy@37 12 #ifndef _PYEXTENSIONMODULE_H_
fazekasgy@37 13 #define _PYEXTENSIONMODULE_H_
fazekasgy@37 14
fazekasgy@37 15 #include <Python.h>
fazekasgy@37 16 #include <limits.h>
fazekasgy@37 17 #include "PyRealTime.h"
fazekasgy@37 18 #include "PyFeature.h"
fazekasgy@37 19 #include "PyFeatureSet.h"
fazekasgy@37 20 #include "PyParameterDescriptor.h"
fazekasgy@37 21 #include "PyOutputDescriptor.h"
fazekasgy@37 22
fazekasgy@37 23 #ifndef UINT_MAX
fazekasgy@37 24 #define UINT_MAX ((unsigned int) -1)
fazekasgy@37 25 #endif
fazekasgy@37 26 #define UINT_MAXD ((double) UINT_MAX)
fazekasgy@37 27 /* long error() { std::cerr << "type error" << std::endl; return 0; } */
fazekasgy@37 28 #define _dbl2uint(x) ((x) < 0 || (x) > UINT_MAXD ? 0 : (unsigned int)(x)+0.5)
fazekasgy@37 29 #define _long2uint(x) ((x) < 0 || (x) > UINT_MAXD ? 0 : (unsigned int)(x))
fazekasgy@37 30
fazekasgy@37 31 using std::string;
fazekasgy@37 32 using std::vector;
fazekasgy@37 33
fazekasgy@37 34 enum eVampyFlags {
fazekasgy@37 35 vf_NULL = 0,
fazekasgy@37 36 vf_DEBUG = 1,
fazekasgy@37 37 vf_STRICT = 2,
fazekasgy@37 38 vf_QUIT = 4,
fazekasgy@37 39 vf_REALTIME = 8,
fazekasgy@37 40 vf_BUFFER = 16,
fazekasgy@37 41 vf_ARRAY = 32,
fazekasgy@37 42 vf_DEFAULT_V2 = (32 | 8)
fazekasgy@37 43 };
fazekasgy@37 44
fazekasgy@37 45 #define PyDescriptor_Check(v) ((v)->ob_type == &Feature_Type) || ((v)->ob_type == &OutputDescriptor_Type) || ((v)->ob_type == &ParameterDescriptor_Type)
fazekasgy@37 46
fazekasgy@37 47 #ifndef PyMODINIT_FUNC
fazekasgy@37 48 #define PyMODINIT_FUNC void
fazekasgy@37 49 #endif
fazekasgy@37 50
fazekasgy@37 51 PyMODINIT_FUNC initvampy();
fazekasgy@37 52
fazekasgy@37 53 #endif