/usr/include/csound/sysdep.h is in libcsound64-dev 1:6.08.0~dfsg-1.
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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | /*
sysdep.h:
Copyright (C) 1991 Barry Vercoe, John ffitch
This file is part of Csound.
The Csound 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.
Csound 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 Csound; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
#ifndef CSOUND_SYSDEP_H
#define CSOUND_SYSDEP_H
/* check for the presence of a modern compiler (for use of certain features) */
#if defined(WIN32)
#if !defined(locale_t)
typedef void *locale_t;
#endif
#endif
/* this checks for 64BIT builds */
#if defined(__MACH__) || defined(LINUX)
#include <limits.h>
#if ( __WORDSIZE == 64 ) || defined(__x86_64__) || defined(__amd64__)
#define B64BIT
#endif
#endif
#if defined(WIN32)
#if _WIN64
#define B64BIT
#endif
#endif
#ifdef HAVE_GCC3
# undef HAVE_GCC3
#endif
#ifdef HAVE_C99
# undef HAVE_C99
#endif
#if (defined(__GNUC__) && (__GNUC__ >= 3))
# define HAVE_C99 1
# if defined(__BUILDING_LIBCSOUND) || defined(CSOUND_CSDL_H)
# ifndef _ISOC99_SOURCE
# define _ISOC99_SOURCE 1
# endif
# ifndef _ISOC9X_SOURCE
# define _ISOC9X_SOURCE 1
# endif
# endif
# if !(defined(__MACH__) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 2))
# define HAVE_GCC3 1
# endif
#elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
# define HAVE_C99 1
#endif
#if defined(__GNUC__)
# if defined(__GNUC_PATCHLEVEL__)
# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
# else
# define __GNUC_VERSION__ (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100)
# endif
#endif
#ifndef CABBAGE
#ifdef MSVC
typedef __int32 int32;
typedef __int16 int16;
typedef unsigned __int32 uint32;
typedef unsigned __int16 uint16;
#else
#include <stdint.h>
typedef int_least32_t int32;
typedef int_least16_t int16;
typedef uint_least32_t uint32;
typedef uint_least16_t uint16;
#endif
#endif
#if defined(HAVE_PTHREAD_SPIN_LOCK)
#include <pthread.h>
#endif
#if defined(HAVE_PTHREAD_SPIN_LOCK)
#include <pthread.h>
#endif
#ifdef __MACH__
#include <AvailabilityMacros.h>
#endif
#include "float-version.h"
/* Defined here as Android does not have log2 functions */
#define MYRECIPLN2 1.442695040888963407359924681001892137426 /* 1.0/log(2) */
#define LOG2(a) (MYRECIPLN2*log(a)) /* floating point logarithm base 2 */
#ifdef USE_DOUBLE
#define ACOS acos
#define ASIN asin
#define ATAN atan
#define ATAN2 atan2
#define COS cos
#define SIN sin
#define TAN tan
#define COSH cosh
#define SINH sinh
#define TANH tanh
#define ACOSH acosh
#define ASINH asinh
#define ATANH atanh
#define EXP exp
#define LOG log
#define LOG10 log10
/* #define LOG2 log2 */
#define POWER pow
#define SQRT sqrt
#define HYPOT hypot
#define FABS fabs
#define FLOOR floor
#define CEIL ceil
#define FMOD fmod
#define MODF modf
#else
#define ACOS acosf
#define ASIN asinf
#define ATAN atanf
#define ATAN2 atan2f
#define COS cosf
#define SIN sinf
#define TAN tanf
#define COSH coshf
#define SINH sinhf
#define TANH tanhf
#define ACOSH acoshf
#define ASINH asinhf
#define ATANH atanhf
#define EXP expf
#define LOG logf
#define LOG10 log10f
/* #define LOG2 log2f */
#define POWER powf
#define SQRT sqrtf
#define HYPOT hypotf
#define FABS fabsf
#define FLOOR floorf
#define CEIL ceilf
#define FMOD fmodf
#define MODF modff
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#if defined(HAVE_FCNTL_H) || defined(__unix) || defined(__unix__)
#include <fcntl.h>
#endif
#if defined(HAVE_UNISTD_H) || defined(__unix) || defined(__unix__)
#include <unistd.h>
#endif
/* Experiment with doubles or floats */
#ifndef __MYFLT_DEF
# define __MYFLT_DEF
# ifndef USE_DOUBLE
# define MYFLT float
# else
# define MYFLT double
# endif
#endif
/* Aligning to double boundaries, should work with MYFLT as float or double */
#define CS_FLOAT_ALIGN(x) ((int)(x + 7) & (~7))
#if defined(__BUILDING_LIBCSOUND) || defined(CSOUND_CSDL_H)
#define FL(x) ((MYFLT) (x))
/* find out operating system if not specified on the command line */
#if defined(_WIN32) || defined(__WIN32__)
# ifndef WIN32
# define WIN32 1
# endif
#elif (defined(linux) || defined(__linux)) && !defined(LINUX)
# define LINUX 1
#endif
#if defined(WIN32) && defined(_MSC_VER) && !defined(__GNUC__)
# ifndef MSVC
# define MSVC 1
# endif
#elif defined(MSVC)
# undef MSVC
#endif
/* inline keyword: always available in C++, C99, and GCC 3.x and above */
/* add any other compiler that supports 'inline' */
#if !(defined(__cplusplus) || defined(inline))
# if defined(HAVE_C99) || defined(HAVE_GCC3)
# if defined(__GNUC__) && defined(__STRICT_ANSI__)
# define inline __inline__
# endif
# elif defined(MSVC)
# define inline __inline
# else
# define inline
# endif
#endif
#define DIRSEP '/'
#ifdef WIN32
# undef DIRSEP
# define DIRSEP '\\'
# if !defined(O_NDELAY)
# define O_NDELAY (0)
# endif
# include <io.h>
#else
# ifdef DOSGCC
# if !defined(O_NDELAY)
# define O_NDELAY (0)
# endif
# endif
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
/* RWD for WIN32 on VC++ */
#endif
#ifndef MSVC
# include <sys/file.h>
#endif
#include <sys/stat.h>
#endif /* __BUILDING_LIBCSOUND || CSOUND_CSDL_H */
#ifdef WIN32
# define ENVSEP ';'
#else
# define ENVSEP ':'
#endif
/* standard integer types */
#if defined(USE_GUSI2)
/* When compiling with GUSI on MacOS 9 (for Python), */
/* all of the other integer types are already defined */
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
#elif defined(HAVE_STDINT_H) || defined(HAVE_C99)
# include <stdint.h>
# if defined(__CYGWIN__)
#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long
# endif
#else
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
# if defined(__GNUC__) || !defined(WIN32)
typedef long long int64_t;
typedef unsigned long long uint64_t;
typedef long long int_least64_t;
typedef unsigned long long uint_least64_t;
# else
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef __int64 int_least64_t;
typedef unsigned __int64 uint_least64_t;
# endif
#if !defined(_MSC_VER)
typedef long intptr_t;
typedef unsigned long uintptr_t;
#endif
#endif /* !(USE_GUSI2 || HAVE_STDINT_H || HAVE_C99) */
/* function attributes */
#if defined(HAVE_GCC3) && !defined(SWIG)
/* deprecated function, variable, or type that is to be removed eventually */
# define CS_DEPRECATED __attribute__ ((__deprecated__))
/* a function that should not be inlined */
# define CS_NOINLINE __attribute__ ((__noinline__))
/* a function that never returns (e.g. csoundDie()) */
# define CS_NORETURN __attribute__ ((__noreturn__))
/* printf-style function with first argument as format string */
# define CS_PRINTF1 __attribute__ ((__format__ (__printf__, 1, 2)))
/* printf-style function with second argument as format string */
# define CS_PRINTF2 __attribute__ ((__format__ (__printf__, 2, 3)))
/* printf-style function with third argument as format string */
# define CS_PRINTF3 __attribute__ ((__format__ (__printf__, 3, 4)))
/* a function with no side effects or dependencies on volatile data */
# define CS_PURE __attribute__ ((__pure__))
# define LIKELY(x) __builtin_expect(!!(x),1)
# define UNLIKELY(x) __builtin_expect(!!(x),0)
#else
# define CS_DEPRECATED
# define CS_NOINLINE
# define CS_NORETURN
# define CS_PRINTF1
# define CS_PRINTF2
# define CS_PRINTF3
# define CS_PURE
# define LIKELY(x) x
# define UNLIKELY(x) x
#endif
#if defined(__BUILDING_LIBCSOUND) || defined(CSOUND_CSDL_H)
/* macros for converting floats to integers */
/* MYFLT2LONG: converts with unspecified rounding */
/* MYFLT2LRND: rounds to nearest integer */
#ifdef USE_LRINT
# ifndef USE_DOUBLE
# define MYFLT2LONG(x) ((int32) lrintf((float) (x)))
# define MYFLT2LRND(x) ((int32) lrintf((float) (x)))
# else
# define MYFLT2LONG(x) ((int32) lrint((double) (x)))
# define MYFLT2LRND(x) ((int32) lrint((double) (x)))
# endif
#elif defined(MSVC)
# ifndef USE_DOUBLE
static inline int32 MYFLT2LRND(float fval)
{
int result;
_asm {
fld fval
fistp result
mov eax, result
}
return result;
}
# else
static inline int32 MYFLT2LRND(double fval)
{
int result;
_asm {
fld fval
fistp result
mov eax, result
}
return result;
}
# endif
# define MYFLT2LONG(x) MYFLT2LRND(x)
#else
# ifndef USE_DOUBLE
# define MYFLT2LONG(x) ((int32) (x))
# if defined(HAVE_GCC3) && defined(__i386__) && !defined(__ICC)
# define MYFLT2LRND(x) ((int32) lrintf((float) (x)))
# else
static inline int32 MYFLT2LRND(float fval)
{
return ((int32) (fval + (fval < 0.0f ? -0.5f : 0.5f)));
}
# endif
# else
# define MYFLT2LONG(x) ((int32) (x))
# if defined(HAVE_GCC3) && defined(__i386__) && !defined(__ICC)
# define MYFLT2LRND(x) ((int32) lrint((double) (x)))
# else
static inline int32 MYFLT2LRND(double fval)
{
return ((int32) (fval + (fval < 0.0 ? -0.5 : 0.5)));
}
# endif
# endif
#endif
/* inline functions and macros for clamping denormals to zero */
#if defined(__i386__) || defined(MSVC)
static inline float csoundUndenormalizeFloat(float x)
{
volatile float tmp = 1.0e-30f;
return ((x + 1.0e-30f) - tmp);
}
static inline double csoundUndenormalizeDouble(double x)
{
volatile double tmp = 1.0e-200;
return ((x + 1.0e-200) - tmp);
}
#else
# define csoundUndenormalizeFloat(x) x
# define csoundUndenormalizeDouble(x) x
#endif
#ifndef USE_DOUBLE
# define csoundUndenormalizeMYFLT csoundUndenormalizeFloat
#else
# define csoundUndenormalizeMYFLT csoundUndenormalizeDouble
#endif
#endif /* __BUILDING_LIBCSOUND || CSOUND_CSDL_H */
// This is wrong..... needs thought
/* #ifdef HAVE_SPRINTF_L */
/* # define CS_SPRINTF sprintf_l */
/* #elseif HAVE__SPRINT_L */
/* /\* this would be the case for the Windows locale aware function *\/ */
/* # define CS_SPRINTF _sprintf_l */
/* #else */
# define CS_SPRINTF cs_sprintf
# define CS_SSCANF cs_sscanf
/* #endif */
#if !defined(HAVE_STRLCAT) && !defined(strlcat)
size_t strlcat(char *dst, const char *src, size_t siz);
#endif
#endif /* CSOUND_SYSDEP_H */
|