tr_dump.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  *
00003  * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  *
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  *
00026  **************************************************************************/
00027 
00033 #ifndef TR_DUMP_H
00034 #define TR_DUMP_H
00035 
00036 
00037 #include "pipe/p_compiler.h"
00038 
00039 
00040 boolean trace_dump_trace_begin(void);
00041 boolean trace_dump_enabled(void);
00042 void trace_dump_trace_end(void);
00043 void trace_dump_call_begin(const char *klass, const char *method);
00044 void trace_dump_call_end(void);
00045 void trace_dump_arg_begin(const char *name);
00046 void trace_dump_arg_end(void);
00047 void trace_dump_ret_begin(void);
00048 void trace_dump_ret_end(void);
00049 void trace_dump_bool(int value);
00050 void trace_dump_int(long long int value);
00051 void trace_dump_uint(long long unsigned value);
00052 void trace_dump_float(double value);
00053 void trace_dump_bytes(const void *data, long unsigned size);
00054 void trace_dump_string(const char *str);
00055 void trace_dump_enum(const char *value);
00056 void trace_dump_array_begin(void);
00057 void trace_dump_array_end(void);
00058 void trace_dump_elem_begin(void);
00059 void trace_dump_elem_end(void);
00060 void trace_dump_struct_begin(const char *name);
00061 void trace_dump_struct_end(void);
00062 void trace_dump_member_begin(const char *name);
00063 void trace_dump_member_end(void);
00064 void trace_dump_null(void);
00065 void trace_dump_ptr(const void *value);
00066 
00067 
00068 /*
00069  * Code saving macros. 
00070  */
00071 
00072 #define trace_dump_arg(_type, _arg) \
00073    do { \
00074       trace_dump_arg_begin(#_arg); \
00075       trace_dump_##_type(_arg); \
00076       trace_dump_arg_end(); \
00077    } while(0)
00078 
00079 #define trace_dump_ret(_type, _arg) \
00080    do { \
00081       trace_dump_ret_begin(); \
00082       trace_dump_##_type(_arg); \
00083       trace_dump_ret_end(); \
00084    } while(0)
00085 
00086 #define trace_dump_array(_type, _obj, _size) \
00087    do { \
00088       unsigned long idx; \
00089       trace_dump_array_begin(); \
00090       for(idx = 0; idx < (_size); ++idx) { \
00091          trace_dump_elem_begin(); \
00092          trace_dump_##_type((_obj)[idx]); \
00093          trace_dump_elem_end(); \
00094       } \
00095       trace_dump_array_end(); \
00096    } while(0)
00097 
00098 #define trace_dump_struct_array(_type, _obj, _size) \
00099    do { \
00100       unsigned long idx; \
00101       trace_dump_array_begin(); \
00102       for(idx = 0; idx < (_size); ++idx) { \
00103          trace_dump_elem_begin(); \
00104          trace_dump_##_type(&(_obj)[idx]); \
00105          trace_dump_elem_end(); \
00106       } \
00107       trace_dump_array_end(); \
00108    } while(0)
00109 
00110 #define trace_dump_member(_type, _obj, _member) \
00111    do { \
00112       trace_dump_member_begin(#_member); \
00113       trace_dump_##_type((_obj)->_member); \
00114       trace_dump_member_end(); \
00115    } while(0)
00116 
00117 #define trace_dump_arg_array(_type, _arg, _size) \
00118    do { \
00119       trace_dump_arg_begin(#_arg); \
00120       trace_dump_array(_type, _arg, _size); \
00121       trace_dump_arg_end(); \
00122    } while(0)
00123 
00124 #define trace_dump_member_array(_type, _obj, _member) \
00125    do { \
00126       trace_dump_member_begin(#_member); \
00127       trace_dump_array(_type, (_obj)->_member, sizeof((_obj)->_member)/sizeof((_obj)->_member[0])); \
00128       trace_dump_member_end(); \
00129    } while(0)
00130 
00131 
00132 #endif /* TR_DUMP_H */

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4