~stomato463/+junk/nvdajp

« back to all changes in this revision

Viewing changes to source/NVDAHelper/common/debug.h

  • Committer: Masataka Shinke
  • Date: 2011-10-25 12:35:26 UTC
  • mfrom: (4185 jpmain)
  • mto: This revision was merged to the branch mainline in revision 4211.
  • Revision ID: mshinke@users.sourceforge.jp-20111025123526-ze527a2rl3z0g2ky
lp:~nishimotz/nvdajp/main : 4185 をマージ

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * base/debug.h
3
 
 * Part of the NV  Virtual Buffer Library
4
 
 * This library is copyright 2007, 2008 NV Virtual Buffer Library Contributors
5
 
 * This library is licensed under the GNU Lesser General Public Licence. See license.txt which is included with this library, or see
6
 
 * http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
7
 
 */
8
 
 
9
 
#ifndef DEBUG_H
10
 
#define DEBUG_H
11
 
 
12
 
#include <iostream>
13
 
 
14
 
extern std::wostream* _debugFile;
15
 
 
16
 
//initialization and termination functions
17
 
void debug_start(std::wostream* s);
18
 
void debug_end();
19
 
 
20
 
#ifdef DEBUG
21
 
 
22
 
#ifndef __GNUC__
23
 
#define __PRETTY_FUNCTION__ __FUNCTION__
24
 
#endif
25
 
 
26
 
#define __STR2WSTR(x) L##x
27
 
#define _STR2WSTR(x) __STR2WSTR(x)
28
 
 
29
 
#include <wchar.h>
30
 
 
31
 
#define DEBUG_MSG(messageArg) {\
32
 
        if(_debugFile!=NULL) {\
33
 
                wchar_t* __WFUNCTION__=(wchar_t*)malloc(sizeof(wchar_t)*1024);\
34
 
                mbstowcs(__WFUNCTION__,__PRETTY_FUNCTION__,1023);\
35
 
                (*_debugFile)<<L"debug "<<__WFUNCTION__<<L", line "<<__LINE__<<L" of file "<<_STR2WSTR(__FILE__)<<L":\n"<<messageArg<<std::endl<<std::flush;\
36
 
                free(__WFUNCTION__);\
37
 
        }\
38
 
}
39
 
 
40
 
#else
41
 
 
42
 
#define DEBUG_MSG(messageArg)
43
 
 
44
 
#endif
45
 
 
46
 
#endif