00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __HTDEBUG_H__
00022 #define __HTDEBUG_H__
00023
00024 #include <stdio.h>
00025
00026 #include "global.h"
00027
00028
00029 #define HTDEBUG
00030
00031
00032 void ht_assert_failed(char *file, int line, char *assertion);
00033 void ht_error(char *file, int line, char *format,...);
00034 void ht_trace(char *file, int line, char *format,...);
00035 void ht_warn(char *file, int line, char *format,...);
00036
00037 typedef qword timepoint;
00038
00039 typedef int timer_handle;
00040
00041 timer_handle new_timer();
00042 void start_timer(timer_handle handle);
00043 void stop_timer(timer_handle handle);
00044 void delete_timer(timer_handle handle);
00045
00046 dword get_timer_sec(timer_handle handle);
00047 dword get_timer_msec(timer_handle handle);
00048 dword get_timer_tick(timer_handle h);
00049
00050 #define HT_ERROR(a...) ht_error(__FILE__, __LINE__, a)
00051 #define HT_WARN(a...) ht_warn(__FILE__, __LINE__, a)
00052
00053 #ifdef HTDEBUG
00054 #define HT_TRACE(a...) ht_trace(__FILE__, __LINE__, a)
00055 #else
00056 #define HT_TRACE(a...) ((void)0)
00057 #endif
00058
00059 #ifdef HTDEBUG
00060 # define assert(a) if (!(a)) ht_assert_failed(__FILE__, __LINE__, (#a));
00061 #else
00062 # define assert(a) ((void)0)
00063 #endif
00064
00065 #endif
00066