00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _COMPIZ_H
00027 #define _COMPIZ_H
00028
00029 #include <compiz-common.h>
00030
00031 #include <string>
00032 #include <list>
00033 #include <cstdarg>
00034
00035 #define STRINGIFY(x) #x
00036 #define TOSTRING(x) STRINGIFY (x)
00037
00038 #define RESTRICT_VALUE(value, min, max) \
00039 (((value) < (min)) ? (min): ((value) > (max)) ? (max) : (value))
00040
00041 #define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
00042
00043 #define TIMEVALDIFF(tv1, tv2) \
00044 ((tv1)->tv_sec == (tv2)->tv_sec || (tv1)->tv_usec >= (tv2)->tv_usec) ? \
00045 ((((tv1)->tv_sec - (tv2)->tv_sec) * 1000000) + \
00046 ((tv1)->tv_usec - (tv2)->tv_usec)) / 1000 : \
00047 ((((tv1)->tv_sec - 1 - (tv2)->tv_sec) * 1000000) + \
00048 (1000000 + (tv1)->tv_usec - (tv2)->tv_usec)) / 1000
00049
00050 #define MULTIPLY_USHORT(us1, us2) \
00051 (((GLuint) (us1) * (GLuint) (us2)) / 0xffff)
00052
00053 #define DEG2RAD (M_PI / 180.0f)
00054
00055 #if defined(HAVE_SCANDIR_POSIX)
00056
00057 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const dirent **, const dirent **))(d));
00058 #else
00059 #define scandir(a,b,c,d) scandir((a), (b), (c), (int(*)(const void*,const void*))(d));
00060 #endif
00061
00062 typedef std::string CompString;
00063 typedef std::list<CompString> CompStringList;
00064
00065 CompString compPrintf (const char *format, ...);
00066 CompString compPrintf (const char *format, va_list ap);
00067
00068
00069
00070 typedef enum {
00071 CompLogLevelFatal = 0,
00072 CompLogLevelError,
00073 CompLogLevelWarn,
00074 CompLogLevelInfo,
00075 CompLogLevelDebug
00076 } CompLogLevel;
00077
00078 void
00079 compLogMessage (const char *componentName,
00080 CompLogLevel level,
00081 const char *format,
00082 ...);
00083
00084 const char *
00085 logLevelToString (CompLogLevel level);
00086
00087 extern char *programName;
00088 extern char **programArgv;
00089 extern int programArgc;
00090
00091 #endif