diff options
Diffstat (limited to 'libs/fluidsynth/src/fluidsynth_priv.h')
-rw-r--r-- | libs/fluidsynth/src/fluidsynth_priv.h | 164 |
1 files changed, 36 insertions, 128 deletions
diff --git a/libs/fluidsynth/src/fluidsynth_priv.h b/libs/fluidsynth/src/fluidsynth_priv.h index 384785fccd..7a3ce6d6d1 100644 --- a/libs/fluidsynth/src/fluidsynth_priv.h +++ b/libs/fluidsynth/src/fluidsynth_priv.h @@ -18,6 +18,13 @@ * 02110-1301, USA */ +/** + * @file fluidsynth_priv.h + * + * lightweight part of fluid_sys.h, containing forward declarations of fluidsynth's private types and private macros + * + * include this one file in fluidsynth's private header files + */ #ifndef _FLUIDSYNTH_PRIV_H #define _FLUIDSYNTH_PRIV_H @@ -26,131 +33,16 @@ #include "config.h" -#if HAVE_STRING_H -#include <string.h> -#endif - #if HAVE_STDLIB_H -#include <stdlib.h> +#include <stdlib.h> // malloc, free #endif #if HAVE_STDIO_H -#include <stdio.h> -#endif - -#if HAVE_MATH_H -#include <math.h> +#include <stdio.h> // printf #endif -#if HAVE_ERRNO_H -#include <errno.h> -#endif - -#if HAVE_STDARG_H -#include <stdarg.h> -#endif - -#if HAVE_UNISTD_H -#include <unistd.h> -#endif - -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#if HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#if HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#if HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - -#if HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - -#if HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -#if HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - -#if HAVE_NETINET_TCP_H -#include <netinet/tcp.h> -#endif - -#if HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -#if HAVE_LIMITS_H -#include <limits.h> -#endif - -#if HAVE_PTHREAD_H -#include <pthread.h> -#endif - -#if HAVE_OPENMP -#include <omp.h> -#endif - -#if HAVE_IO_H -#include <io.h> // _open(), _close(), read(), write() on windows -#endif - -#if HAVE_SIGNAL_H -#include <signal.h> -#endif - -/** Integer types */ -#if HAVE_STDINT_H -#include <stdint.h> - -#else - -/* Assume GLIB types */ -typedef gint8 int8_t; -typedef guint8 uint8_t; -typedef gint16 int16_t; -typedef guint16 uint16_t; -typedef gint32 int32_t; -typedef guint32 uint32_t; -typedef gint64 int64_t; -typedef guint64 uint64_t; - -#endif - -#if defined(WIN32) && HAVE_WINDOWS_H -//#include <winsock2.h> -//#include <ws2tcpip.h> /* Provides also socklen_t */ -#include <windows.h> - -/* WIN32 special defines */ -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -#ifdef _MSC_VER -#pragma warning(disable : 4244) -#pragma warning(disable : 4101) -#pragma warning(disable : 4305) -#pragma warning(disable : 4996) -#endif - -#endif - -/* Darwin special defines (taken from config_macosx.h) */ -#ifdef DARWIN -# define MACINTOSH -# define __Types__ +#if HAVE_STRING_H +#include <string.h> #endif @@ -168,13 +60,6 @@ typedef float fluid_real_t; typedef double fluid_real_t; #endif - -#if defined(WIN32) -typedef SOCKET fluid_socket_t; -#else -typedef int fluid_socket_t; -#endif - #if defined(SUPPORTS_VLA) # define FLUID_DECLARE_VLA(_type, _name, _len) \ _type _name[_len] @@ -240,7 +125,6 @@ typedef void (*fluid_rvoice_function_t)(void *obj, const fluid_rvoice_param_t pa * * SYSTEM INTERFACE */ -typedef FILE *fluid_file; #define FLUID_MALLOC(_n) malloc(_n) #define FLUID_REALLOC(_p,_n) realloc(_p,_n) @@ -349,6 +233,30 @@ do { strncpy(_dst,_src,_n); \ #define FLUID_LIKELY G_LIKELY #define FLUID_UNLIKELY G_UNLIKELY -char *fluid_error(void); +/* Misc */ +#if defined(__INTEL_COMPILER) +#define FLUID_RESTRICT restrict +#elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) +#define FLUID_RESTRICT __restrict__ +#elif defined(_MSC_VER) && _MSC_VER >= 1400 +#define FLUID_RESTRICT __restrict +#else +#warning "Dont know how this compiler handles restrict pointers, refuse to use them." +#define FLUID_RESTRICT +#endif + +#define FLUID_N_ELEMENTS(struct) (sizeof (struct) / sizeof (struct[0])) +#define FLUID_MEMBER_SIZE(struct, member) ( sizeof (((struct *)0)->member) ) + + +#define fluid_return_if_fail(cond) \ +if(cond) \ + ; \ +else \ + return + +#define fluid_return_val_if_fail(cond, val) \ + fluid_return_if_fail(cond) (val) + #endif /* _FLUIDSYNTH_PRIV_H */ |