/usr/include/libprojectM/Common.hpp is in libprojectm-dev 2.1.0+dfsg-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /**
* projectM -- Milkdrop-esque visualisation SDK
* Copyright (C)2003-2007 projectM Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* See 'LICENSE.txt' included within this release
*
*/
/**
* $Id$
*
* $Log$
*/
#ifndef COMMON_HPP
#define COMMON_HPP
#include <vector>
#include <typeinfo>
#include <cstdarg>
#include <cassert>
#ifdef _MSC_sVER
#define strcasecmp(s, t) _strcmpi(s, t)
#endif
#ifdef _MSC_VER
#pragma warning( disable : 4244 4305 4996; once : 4018 )
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
typedef unsigned int uint;
#endif
#ifdef DEBUG
//extern FILE *debugFile;
#endif
#ifdef MACOS
#include <cstdio>
extern FILE *fmemopen(void *buf, size_t len, const char *pMode);
#endif /** MACOS */
#include "dlldefs.h"
#define DEFAULT_FONT_PATH "/home/carm/fonts/courier1.glf"
#define MAX_TOKEN_SIZE 512
#define MAX_PATH_SIZE 4096
#define STRING_BUFFER_SIZE 1024*150
#define STRING_LINE_SIZE 1024
#ifdef LINUX
#include <cstdlib>
#define projectM_isnan isnan
#endif
#ifdef WIN32
#define projectM_isnan(x) ((x) != (x))
#endif
#ifdef MACOS
#define projectM_isnan(x) ((x) != (x))
#endif
#ifdef LINUX
#define projectM_fmax fmax
#endif
#ifdef WIN32
#define projectM_fmax(x,y) ((x) >= (y) ? (x): (y))
#endif
#ifdef MACOS
#define projectM_fmax(x,y) ((x) >= (y) ? (x): (y))
#endif
#ifdef LINUX
#define projectM_fmin fmin
#endif
#ifdef WIN32
#define projectM_fmin(x,y) ((x) <= (y) ? (x): (y))
#endif
#ifdef MACOS
#define projectM_fmin(x,y) ((x) <= (y) ? (x): (y))
#endif
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif
#define MAX_DOUBLE_SIZE 10000000.0
#define MIN_DOUBLE_SIZE -10000000.0
#define MAX_INT_SIZE 10000000
#define MIN_INT_SIZE -10000000
/* default float initial value */
#define DEFAULT_DOUBLE_IV 0.0
/* default float lower bound */
#define DEFAULT_DOUBLE_LB MIN_DOUBLE_SIZE
/* default float upper bound */
#define DEFAULT_DOUBLE_UB MAX_DOUBLE_SIZE
#ifdef WIN32
#include <float.h>
#define isnan _isnan
#endif /** WIN32 */
/** Per-platform path separators */
#define WIN32_PATH_SEPARATOR '\\'
#define UNIX_PATH_SEPARATOR '/'
#ifdef WIN32
#define PATH_SEPARATOR WIN32_PATH_SEPARATOR
#else
#define PATH_SEPARATOR UNIX_PATH_SEPARATOR
#endif /** WIN32 */
#include <string>
const unsigned int NUM_Q_VARIABLES(32);
const std::string PROJECTM_FILE_EXTENSION("prjm");
const std::string MILKDROP_FILE_EXTENSION("milk");
const std::string PROJECTM_MODULE_EXTENSION("so");
template <class TraverseFunctor, class Container>
void traverse(Container & container)
{
TraverseFunctor functor;
for (typename Container::iterator pos = container.begin(); pos != container.end(); ++pos)
{
assert(pos->second);
functor(pos->second);
}
}
template <class TraverseFunctor, class Container>
void traverseVector(Container & container)
{
TraverseFunctor functor;
for (typename Container::iterator pos = container.begin(); pos != container.end(); ++pos)
{
assert(*pos);
functor(*pos);
}
}
template <class TraverseFunctor, class Container>
void traverse(Container & container, TraverseFunctor & functor)
{
for (typename Container::iterator pos = container.begin(); pos != container.end(); ++pos)
{
assert(pos->second);
functor(pos->second);
}
}
namespace TraverseFunctors
{
template <class Data>
class Delete
{
public:
void operator() (Data * data)
{
assert(data);
delete(data);
}
};
}
inline std::string parseExtension(const std::string & filename) {
const std::size_t start = filename.find_last_of('.');
if (start == std::string::npos || start >= (filename.length()-1))
return "";
else
return filename.substr(start+1, filename.length());
}
inline std::string parseFilename(const std::string & filename) {
const std::size_t start = filename.find_last_of('/');
if (start == std::string::npos || start >= (filename.length()-1))
return "";
else
return filename.substr(start+1, filename.length());
}
inline double meanSquaredError(const double & x, const double & y) {
return (x-y)*(x-y);
}
enum PresetRatingType {
FIRST_RATING_TYPE = 0,
HARD_CUT_RATING_TYPE = FIRST_RATING_TYPE,
SOFT_CUT_RATING_TYPE,
LAST_RATING_TYPE = SOFT_CUT_RATING_TYPE,
TOTAL_RATING_TYPES = SOFT_CUT_RATING_TYPE+1
};
typedef std::vector<int> RatingList;
#endif
|