os/ossrv/genericopenlibs/liboil/src/liboildebug.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/liboildebug.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,139 @@
     1.4 +/*
     1.5 + * LIBOIL - Library of Optimized Inner Loops
     1.6 + * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
     1.7 + * All rights reserved.
     1.8 + *
     1.9 + * Redistribution and use in source and binary forms, with or without
    1.10 + * modification, are permitted provided that the following conditions
    1.11 + * are met:
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer.
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in the
    1.16 + *    documentation and/or other materials provided with the distribution.
    1.17 + * 
    1.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    1.19 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    1.20 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.21 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
    1.22 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    1.23 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    1.24 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    1.26 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    1.27 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.28 + * POSSIBILITY OF SUCH DAMAGE.
    1.29 + */
    1.30 +
    1.31 +#ifndef _LIBOIL_DEBUG_H_
    1.32 +#define _LIBOIL_DEBUG_H_
    1.33 +
    1.34 +#include <stdarg.h>
    1.35 +#include <liboil/liboilutils.h>
    1.36 +
    1.37 +OIL_BEGIN_DECLS
    1.38 +
    1.39 +#ifdef OIL_ENABLE_UNSTABLE_API
    1.40 +
    1.41 +/**
    1.42 + * OilDebugPrintFunc:
    1.43 + * @level: the debug level
    1.44 + * @file: name of the file where the debug message occurs
    1.45 + * @func: name of the function where the debug message occurs
    1.46 + * @line: line in the file where the debug message occurs
    1.47 + * @format: a printf format
    1.48 + * @varargs: varargs for the printf format
    1.49 + *
    1.50 + * Typedef describing functions that can be registered using
    1.51 + * oil_debug_set_print_function() so that it is called to
    1.52 + * print debugging messages.
    1.53 + */
    1.54 +typedef void (*OilDebugPrintFunc) (int level, const char *file,
    1.55 +    const char *func, int line, const char *format, va_list varargs);
    1.56 +
    1.57 +/**
    1.58 + * OilDebugLevel:
    1.59 + *
    1.60 + * Enumeration describing debug levels in Liboil.
    1.61 + */
    1.62 +typedef enum {
    1.63 +  OIL_DEBUG_NONE = 0,
    1.64 +  OIL_DEBUG_ERROR,
    1.65 +  OIL_DEBUG_WARNING,
    1.66 +  OIL_DEBUG_INFO,
    1.67 +  OIL_DEBUG_DEBUG,
    1.68 +  OIL_DEBUG_LOG
    1.69 +} OilDebugLevel;
    1.70 +
    1.71 +/**
    1.72 + * OIL_ERROR:
    1.73 + *
    1.74 + * Macro to call OIL_DEBUG_PRINT() with a level of #OIL_DEBUG_ERROR.
    1.75 + */
    1.76 +#define OIL_ERROR(args...) OIL_DEBUG_PRINT(OIL_DEBUG_ERROR, ##args)
    1.77 +/**
    1.78 + * OIL_WARNING:
    1.79 + *
    1.80 + * Macro to call OIL_DEBUG_PRINT() with a level of #OIL_DEBUG_WARNING.
    1.81 + */
    1.82 +#define OIL_WARNING(args...) OIL_DEBUG_PRINT(OIL_DEBUG_WARNING, ##args)
    1.83 +/**
    1.84 + * OIL_INFO:
    1.85 + *
    1.86 + * Macro to call OIL_DEBUG_PRINT() with a level of #OIL_DEBUG_INFO.
    1.87 + */
    1.88 +#define OIL_INFO(args...) OIL_DEBUG_PRINT(OIL_DEBUG_INFO, ##args)
    1.89 +/**
    1.90 + * OIL_DEBUG:
    1.91 + *
    1.92 + * Macro to call OIL_DEBUG_PRINT() with a level of #OIL_DEBUG_DEBUG.
    1.93 + */
    1.94 +#define OIL_DEBUG(args...) OIL_DEBUG_PRINT(OIL_DEBUG_DEBUG, ##args)
    1.95 +/**
    1.96 + * OIL_LOG:
    1.97 + *
    1.98 + * Macro to call OIL_DEBUG_PRINT() with a level of #OIL_DEBUG_LOG.
    1.99 + */
   1.100 +#define OIL_LOG(args...) OIL_DEBUG_PRINT(OIL_DEBUG_LOG, ##args)
   1.101 +
   1.102 +/**
   1.103 + * OIL_FUNCTION:
   1.104 + *
   1.105 + * Internal macro that points to __PRETTY_FUNCTION__ or __func__
   1.106 + * if the former is not available.
   1.107 + */
   1.108 +#if defined (__GNUC__) || defined (__PRETTY_FUNCTION__)
   1.109 +#define OIL_FUNCTION __PRETTY_FUNCTION__
   1.110 +#elif defined(__func__)
   1.111 +#define OIL_FUNCTION __func__
   1.112 +#else
   1.113 +#define OIL_FUNCTION ""
   1.114 +#endif
   1.115 +
   1.116 +/**
   1.117 + * OIL_DEBUG_PRINT:
   1.118 + * @level:
   1.119 + * @...:
   1.120 + *
   1.121 + * Macro to call oil_debug_print() with the correct values for
   1.122 + * the name of the source file, line of source file, and function.
   1.123 + */
   1.124 +#define OIL_DEBUG_PRINT(level, args...) do { \
   1.125 +  oil_debug_print((level), __FILE__, OIL_FUNCTION, __LINE__, ##args); \
   1.126 +}while(0)
   1.127 +
   1.128 +IMPORT_C void oil_debug_set_print_function (OilDebugPrintFunc func);
   1.129 +IMPORT_C int oil_debug_get_level (void);
   1.130 +IMPORT_C void oil_debug_set_level (int level);
   1.131 +
   1.132 +void _oil_debug_init (void);
   1.133 +
   1.134 +IMPORT_C void oil_debug_print (int level, const char *file, const char *func,
   1.135 +    int line, const char *format, ...);
   1.136 +
   1.137 +#endif
   1.138 +
   1.139 +OIL_END_DECLS
   1.140 +
   1.141 +#endif
   1.142 +