debug_out.h
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:2k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* debug_out.h - macros to use for debugging prints in places where calls
  2.                  to printf() and gang are ill-advised. */
  3. #ifdef PTHREAD_DEBUGGING
  4. #define PTHREAD_DEBUG_WriteStr(S) (void)machdep_sys_write(2,S,strlen(S))
  5. #define PTHREAD_DEBUG_WriteInt32Hex(X)
  6.   { char _xbuf[8]; int _temp = (int)(X), _temp2;
  7.     _temp2 = ((_temp>>28)&0xf);
  8.     _xbuf[0] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  9.     _temp2 = ((_temp>>24)&0xf);
  10.     _xbuf[1] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  11.     _temp2 = ((_temp>>20)&0xf);
  12.     _xbuf[2] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  13.     _temp2 = ((_temp>>16)&0xf);
  14.     _xbuf[3] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  15.     _temp2 = ((_temp>>12)&0xf);
  16.     _xbuf[4] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  17.     _temp2 = ((_temp>>8)&0xf);
  18.     _xbuf[5] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  19.     _temp2 = ((_temp>>4)&0xf);
  20.     _xbuf[6] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  21.     _temp2 = (_temp&0xf);
  22.     _xbuf[7] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a');
  23.     (void)machdep_sys_write(2,_xbuf,8);
  24.   }
  25. #ifdef __alpha
  26. #define PTHREAD_DEBUG_WriteInt64Hex(X)
  27.   { long _tempX = (long)(X),_tempY;
  28.     _tempY=((_tempX>>32)&0xffffffff);
  29.     PTHREAD_DEBUG_WriteInt32Hex(_tempY);
  30.     _tempY=(_tempX&0xffffffff);
  31.     PTHREAD_DEBUG_WriteInt32Hex(_tempY);
  32.   }
  33. #define PTHREAD_DEBUG_WritePointer(X) PTHREAD_DEBUG_WriteInt64Hex(X)
  34. #else
  35. #define PTHREAD_DEBUG_WriteInt64Hex(X) PTHREAD_DEBUG_WriteInt32Hex(X)
  36. #define PTHREAD_DEBUG_WritePointer(X) PTHREAD_DEBUG_WriteInt32Hex(X)
  37. #endif /* __alpha */
  38. #else /* ! PTHREAD_DEBUGGING */
  39. #define PTHREAD_DEBUG_WriteStr(S)
  40. #define PTHREAD_DEBUG_WriteInt32Hex(X)
  41. #define PTHREAD_DEBUG_WriteInt64HeX(X)
  42. #define PTHREAD_DEBUG_WritePointer(X)
  43. #endif /* PTHREAD_DEBUGGING */