File: compatibility.hh

package info (click to toggle)
faust 2.79.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 397,496 kB
  • sloc: cpp: 278,433; ansic: 116,164; javascript: 18,529; vhdl: 14,052; sh: 13,884; java: 5,900; objc: 3,852; python: 3,222; makefile: 2,655; cs: 1,672; lisp: 1,146; ruby: 954; yacc: 586; xml: 471; lex: 247; awk: 110; tcl: 26
file content (126 lines) | stat: -rw-r--r-- 3,519 bytes parent folder | download | duplicates (2)
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
/************************************************************************
 ************************************************************************
    FAUST compiler
    Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
    ---------------------------------------------------------------------
    This program 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 program 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 program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ************************************************************************
 ************************************************************************/

#ifndef __COMPATIBILITY__
#define __COMPATIBILITY__

unsigned faust_alarm(unsigned seconds);

#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1900)
#define faust_mkdir(path, attribute) mkdir(path)
#elif !defined(WIN32)
#define faust_mkdir(path, attribute) mkdir(path, attribute)
#endif

#if defined(_WIN32)
#include <assert.h>
#include <time.h>
#include <windows.h>

#ifdef __MINGW32__
// mingw has PATH_MAX defined in limits.h. Make sure that it's included.
#include <limits.h>
#else
#define PATH_MAX 512
#endif
#define YY_NO_UNISTD_H 1

#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)

#if GCC_VERSION < 40700 && !defined(__clang__)
struct timezone {
    int tz_minuteswest; /* minutes W of Greenwich */
    int tz_dsttime;     /* type of dst correction */
};
#endif

#define alarm(x) 0

#if !defined(__MINGW32__) && (_MSC_VER < 1900)
// mingw & VS2015 have these in its headers.
#define strdup _strdup
#define snprintf _snprintf
#endif

extern "C" {
#if (_MSC_VER <= 1700)
double rint(double nr);
#endif

int gettimeofday(struct timeval* tv, struct timezone* tz);
int chdir(const char* path);
#if _MSC_VER
#undef small
int mkdir(const char* path);
#endif
char* getcwd(char* str, int size);
#ifndef WIN32
int isatty(int file);
#endif
}

void  getFaustPathname(char* str, unsigned int size);
void  getFaustPathname(char* str, unsigned int size);
char* realpath(const char* path, char resolved_path[PATH_MAX]);
char* basename(const char* fullpath);

#ifdef NDEBUG
#undef assert
#define assert(_Expression)              \
    do {                                 \
        bool bTest = (_Expression) != 0; \
    } while (0)
#endif

// #define rintf(x) floor((x)+(((x) < 0 ) ? -0.5f :0.5f))
#define FAUST_PATH_MAX 1024

#if !defined(__MINGW32__)
#if (_MSC_VER <= 1700)
double remainder(double numerator, double denominator);
double rint(double nr);
#endif
/* missing on Windows : see http://bugs.mysql.com/bug.php?id=15936 */
#define S_IRWXU 0
#endif

#if !defined(__MINGW32__) || GCC_VERSION < 40903
#define S_IRWXG 0
#define S_IROTH 0
#define S_IXOTH 0
#define DIRSEP '\\'
#endif

#undef min
#undef max

#else

#include <libgen.h>
#include <unistd.h>

#define DIRSEP '/'
#define FAUST_PATH_MAX 1024

void getFaustPathname(char* str, unsigned int size);

#endif  // _WIN32
#endif