Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1007 B

  1. #ifndef __LTRACE_H__
  2. #define __LTRACE_H__
  3. #define NO_LTRACE
  4. /*#ifndef NO_LTRACE
  5. #ifdef NDEBUG
  6. #error I want ltrace!
  7. #define NO_LTRACE
  8. #endif
  9. #endif*/
  10. #ifndef NO_LTRACE
  11. #ifndef THIS_FILE
  12. const TCHAR THIS_FILE[] = __FILE__;
  13. #endif
  14. class __CLTraceScope
  15. {
  16. public:
  17. __CLTraceScope(LPCTSTR, LPCTSTR, int);
  18. __CLTraceScope(LPCTSTR, int);
  19. ~__CLTraceScope();
  20. void scope(LPCTSTR, ...);
  21. void ltrace(LPCTSTR, ...);
  22. private:
  23. LPCTSTR spacing();
  24. LPCTSTR m_scope, m_file;
  25. int m_line;
  26. int m_depth;
  27. static int s_depth;
  28. // __CLTraceScope *m_pprev, *m_pnext;
  29. // static __CLTraceScope *s_pfirst, *s_plast;
  30. };
  31. #define LTSCOPE0(scope) __CLTraceScope __localscope(scope, THIS_FILE, __LINE__)
  32. #define LTSCOPE __CLTraceScope __localscope(THIS_FILE, __LINE__); __localscope.scope
  33. #define LTRACE __localscope.ltrace
  34. #else
  35. inline void __localscope_dummy(LPCTSTR, ...) {}
  36. #define LTSCOPE0(scope) (void(0))
  37. #define LTSCOPE ; __localscope_dummy
  38. #define LTRACE __localscope_dummy
  39. #endif
  40. #endif //__LTRACE_H__