00001
00002
00003
00004
00005
00006
00007 #ifndef PLAYBACK_MACROS_H_
00008 # define PLAYBACK_MACROS_H_
00009
00010 #define PB_STRINGIFY(macro_or_string) PB_STRINGIFY_ARG (macro_or_string)
00011 #define PB_STRINGIFY_ARG(contents) #contents
00012
00013 #ifndef TRUE
00014 # define TRUE 1
00015 #endif
00016 #ifndef FALSE
00017 # define FALSE 0
00018 #endif
00019
00020 #ifndef NULL
00021 # ifdef __cplusplus
00022 # define NULL (0L)
00023 # else
00024 # define NULL ((void*) 0)
00025 # endif
00026 #endif
00027
00028 #ifdef __cplusplus
00029 # define PB_BEGIN_DECLS extern "C" {
00030 # define PB_END_DECLS }
00031 #else
00032 # define PB_BEGIN_DECLS
00033 # define PB_END_DECLS
00034 #endif
00035
00036
00037 #if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
00038 # define PB_STRLOC __FILE__ ":" PB_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
00039 #else
00040 # define PB_STRLOC __FILE__ ":" PB_STRINGIFY (__LINE__)
00041 #endif
00042
00043 #ifdef PLAYBACK_DEBUG
00044 # define PB_LOG(...) do{ fprintf (stderr, PB_STRLOC ", " __VA_ARGS__ ); fprintf (stderr, "\n"); }while(0)
00045 #else
00046 # define PB_LOG(...)
00047 #endif
00048
00049 #define pb_return_if_fail(Exp) do{ \
00050 if ((Exp) == FALSE) { \
00051 PB_LOG ("assertion %s failed", #Exp); \
00052 return ; \
00053 } \
00054 }while(0)
00055
00056 #define pb_return_val_if_fail(Exp, Val) do{ \
00057 if ((Exp) == FALSE) { \
00058 PB_LOG ("assertion %s failed", #Exp); \
00059 return (Val); \
00060 } \
00061 }while(0)
00062
00063 #define pb_n_elements(x) (sizeof(x)/sizeof(x[0]))
00064
00065 #endif