Jack2  1.9.10
systemdeps.h
00001 /*
00002 Copyright (C) 2004-2012 Grame
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU Lesser General Public License as published by
00006 the Free Software Foundation; either version 2.1 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018 */
00019 
00020 #ifndef __jack_systemdeps_h__
00021 #define __jack_systemdeps_h__
00022 
00023 #ifndef POST_PACKED_STRUCTURE
00024 
00025     #ifdef __GNUC__
00026         /* POST_PACKED_STRUCTURE needs to be a macro which
00027            expands into a compiler directive. The directive must
00028            tell the compiler to arrange the preceding structure
00029            declaration so that it is packed on byte-boundaries rather 
00030            than use the natural alignment of the processor and/or
00031            compiler.
00032         */
00033 
00034         #define PRE_PACKED_STRUCTURE
00035         #define POST_PACKED_STRUCTURE __attribute__((__packed__))
00036 
00037     #else
00038     
00039         #ifdef _MSC_VER
00040             #define PRE_PACKED_STRUCTURE1 __pragma(pack(push,1))
00041             #define PRE_PACKED_STRUCTURE    PRE_PACKED_STRUCTURE1
00042             /* PRE_PACKED_STRUCTURE needs to be a macro which
00043             expands into a compiler directive. The directive must
00044             tell the compiler to arrange the following structure
00045             declaration so that it is packed on byte-boundaries rather
00046             than use the natural alignment of the processor and/or
00047             compiler.
00048             */
00049             #define POST_PACKED_STRUCTURE ;__pragma(pack(pop))
00050             /* and POST_PACKED_STRUCTURE needs to be a macro which
00051             restores the packing to its previous setting */
00052         #else
00053             #define PRE_PACKED_STRUCTURE
00054             #define POST_PACKED_STRUCTURE
00055         #endif /* _MSC_VER */
00056 
00057     #endif /* __GNUC__ */
00058 
00059 #endif
00060 
00061 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(GNU_WIN32)
00062 
00063     #include <windows.h>
00064 
00065     #ifdef _MSC_VER     /* Microsoft compiler */
00066         #define __inline__ inline
00067         #if (!defined(int8_t) && !defined(_STDINT_H))
00068             #define __int8_t_defined
00069             typedef char int8_t;
00070             typedef unsigned char uint8_t;
00071             typedef short int16_t;
00072             typedef unsigned short uint16_t;
00073             typedef long int32_t;
00074             typedef unsigned long uint32_t;
00075             typedef LONGLONG int64_t;
00076             typedef ULONGLONG uint64_t;
00077         #endif
00078     #elif __MINGW32__   /* MINGW */
00079         #include <stdint.h>
00080         #include <sys/types.h>
00081     #else               /* other compilers ...*/
00082         #include <inttypes.h>
00083         #include <pthread.h>
00084         #include <sys/types.h>
00085     #endif
00086 
00087     #if !defined(_PTHREAD_H) && !defined(PTHREAD_WIN32)
00088 
00092         typedef HANDLE jack_native_thread_t;
00093     #else
00094         #ifdef PTHREAD_WIN32            // Added by JE - 10-10-2011
00095             #include <ptw32/pthread.h>  // Makes sure we #include the ptw32 version !
00096         #endif
00097 
00101         typedef pthread_t jack_native_thread_t;
00102     #endif
00103 
00104 #endif /* WIN32 && !__CYGWIN__ && !GNU_WIN32 */
00105 
00106 #if defined(__APPLE__) || defined(__linux__) || defined(__sun__) || defined(sun) || defined(__unix__) || defined(__CYGWIN__) || defined(GNU_WIN32)
00107 
00108     #if defined(__CYGWIN__) || defined(GNU_WIN32)
00109         #include <stdint.h>
00110     #endif
00111         #include <inttypes.h>
00112         #include <pthread.h>
00113         #include <sys/types.h>
00114 
00119         typedef pthread_t jack_native_thread_t;
00120 
00121 #endif /* __APPLE__ || __linux__ || __sun__ || sun */
00122 
00123 #if defined(__arm__)
00124     #undef POST_PACKED_STRUCTURE
00125     #define POST_PACKED_STRUCTURE
00126 #endif /* __arm__ */
00127 
00128 #endif /* __jack_systemdeps_h__ */