FreeWRL/FreeX3D
3.0.0
Main Page
Related Pages
Data Structures
Files
File List
internal.h
1
/*******************************************************************
2
*
3
* FreeWRL sound module
4
*
5
* internal header - internal.h
6
*
7
* Version embedded.
8
*
9
*
10
*******************************************************************/
11
12
/****************************************************************************
13
This file is part of the FreeWRL/FreeX3D Distribution.
14
15
Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
16
17
FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
18
it under the terms of the GNU Lesser Public License as published by
19
the Free Software Foundation, either version 3 of the License, or
20
(at your option) any later version.
21
22
FreeWRL/FreeX3D is distributed in the hope that it will be useful,
23
but WITHOUT ANY WARRANTY; without even the implied warranty of
24
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
GNU General Public License for more details.
26
27
You should have received a copy of the GNU General Public License
28
along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
29
****************************************************************************/
30
31
32
33
#ifndef __FREEWRL_SND_INTERNAL_H__
34
#define __FREEWRL_SND_INTERNAL_H__
35
36
37
extern
const
char
*freewrl_snd_get_version();
38
39
/* Useful to suppress things from non-debug builds */
40
#if defined(FW_DEBUG)
41
# define DEBUG_(_expr) _expr
42
#else
43
# define DEBUG_(_expr)
44
#endif
45
46
/* To conform C99 ISO C (do not use GCC extension) */
47
#define DEBUG_MSG(...) DEBUG_(fprintf(stdout, __VA_ARGS__))
48
#define TRACE_MSG(...) DEBUG_(fprintf(stdout, __VA_ARGS__))
49
#define WARN_MSG(...) DEBUG_(fprintf(stdout, __VA_ARGS__))
50
#define ERROR_MSG(...) DEBUG_(fprintf(stderr, __VA_ARGS__))
51
52
#ifdef VERBOSE
53
#define DEBUG_FW(...) DEBUG_(printf("FW: " __VA_ARGS__))
54
#else
55
#define DEBUG_FW(...)
56
#endif
57
58
#ifdef ARGSVERBOSE
59
#define DEBUG_ARGS(...) DEBUG_(printf("TEXT: " __VA_ARGS__))
60
#else
61
#define DEBUG_ARGS(...)
62
#endif
63
67
#if defined(FW_DEBUG) && defined(DEBUG_MALLOC)
68
69
# define MALLOC(t,_sz) (t)freewrlMalloc(__LINE__,__FILE__,_sz)
70
# define REALLOC(_a,_b) freewrlRealloc(__LINE__,__FILE__,_a,_b)
71
# define FREE(_ptr) freewrlFree(__LINE__,__FILE__,_ptr)
72
# define STRDUP(_a) freewrlStrdup(__LINE__,__FILE__,_a)
73
#include <stdlib.h>
74
void
*freewrlMalloc(
int
line,
char
*file,
size_t
sz);
75
void
*freewrlRealloc(
int
line,
char
*file,
void
*ptr,
size_t
size);
76
void
freewrlFree(
int
line,
char
*file,
void
*a);
77
void
*freewrlStrdup(
int
line,
char
*file,
char
*str);
78
79
# define UNLINK(_fdd) do { \
80
TRACE_MSG("TRACE: unlink %s at %s:%d\n",_fdd,__FILE__,__LINE__); \
81
unlink (_fdd); \
82
} while (0)
83
84
# define ASSERT(_ptr) do { if (!(_ptr)) { \
85
ERROR_MSG("ERROR: assert failed: %s (%s:%d)\n", #_ptr, __FILE__, __LINE__); } \
86
} while (0)
87
88
#else
/* defined(FW_DEBUG) && defined(DEBUG_MALLOC) */
89
90
# define MALLOC(t,_sz) ((t)malloc(_sz))
91
# define REALLOC realloc
92
# define FREE free
93
#if defined(_MSC_VER)
94
# define STRDUP _strdup
95
# define UNLINK _unlink
96
# define TEMPNAM _tempnam
97
#else
98
# define STRDUP strdup
99
# define UNLINK unlink
100
# define TEMPNAM tempnam
101
#endif
102
# define ASSERT(_whatever)
103
104
#endif
/* defined(FW_DEBUG) && defined(DEBUG_MALLOC) */
105
106
/* This get always defined, but ERROR_MSG is no-op without _DEBUG */
107
108
#define FREE_IF_NZ(_ptr) if (_ptr) { \
109
FREE(_ptr); \
110
_ptr = 0; } \
111
else { \
112
DEBUG_MEM("free, pointer is already null at %s:%d\n", __FILE__, __LINE__); \
113
}
114
115
116
#endif
/* __FREEWRL_SND_INTERNAL_H__ */
src
sound
internal.h
Generated on Thu Dec 14 2017 12:14:40 for FreeWRL/FreeX3D by
1.8.6