aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/debug_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/debug_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/debug_8cpp-source.html1083
1 files changed, 1083 insertions, 0 deletions
diff --git a/docs/doxygen/nel/debug_8cpp-source.html b/docs/doxygen/nel/debug_8cpp-source.html
new file mode 100644
index 00000000..55add418
--- /dev/null
+++ b/docs/doxygen/nel/debug_8cpp-source.html
@@ -0,0 +1,1083 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>debug.cpp</h1><a href="debug_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#ifdef HAVE_NELCONFIG_H</font>
+00027 <font class="preprocessor"></font><font class="preprocessor"># include "nelconfig.h"</font>
+00028 <font class="preprocessor">#endif // HAVE_NELCONFIG_H</font>
+00029 <font class="preprocessor"></font>
+00030 <font class="preprocessor">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="log_8h.html">nel/misc/log.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="displayer_8h.html">nel/misc/displayer.h</a>"</font>
+00033 <font class="preprocessor">#include "<a class="code" href="mem__displayer_8h.html">nel/misc/mem_displayer.h</a>"</font>
+00034 <font class="preprocessor">#include "<a class="code" href="command_8h.html">nel/misc/command.h</a>"</font>
+00035 <font class="preprocessor">#include "<a class="code" href="report_8h.html">nel/misc/report.h</a>"</font>
+00036 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
+00037
+00038 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00039 <font class="preprocessor"></font><font class="preprocessor"># define _WIN32_WINDOWS 0x0410</font>
+00040 <font class="preprocessor"></font><font class="preprocessor"># define WINVER 0x0400</font>
+00041 <font class="preprocessor"></font><font class="preprocessor"># include &lt;windows.h&gt;</font>
+00042 <font class="preprocessor"># include &lt;direct.h&gt;</font>
+00043 <font class="preprocessor"># include &lt;imagehlp.h&gt;</font>
+00044 <font class="preprocessor"># pragma comment(lib, "imagehlp.lib")</font>
+00045 <font class="preprocessor"></font><font class="preprocessor"># define getcwd(_a, _b) (_getcwd(_a,_b))</font>
+00046 <font class="preprocessor"></font><font class="preprocessor">#elif defined NL_OS_UNIX</font>
+00047 <font class="preprocessor"></font><font class="preprocessor"># include &lt;<a class="code" href="unistd_8h.html">unistd.h</a>&gt;</font>
+00048 <font class="preprocessor"># include &lt;stdio.h&gt;</font>
+00049 <font class="preprocessor"># include &lt;stdlib.h&gt;</font>
+00050 <font class="preprocessor"># define IsDebuggerPresent() false</font>
+00051 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
+00052 <font class="preprocessor"></font>
+00053 <font class="preprocessor">#include &lt;stdarg.h&gt;</font>
+00054 <font class="preprocessor">#include &lt;iostream&gt;</font>
+00055
+00056 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00057
+00058 <font class="comment">// If you don't want to add default displayer, put 0 instead of 1. In this case, you</font>
+00059 <font class="comment">// have to manage yourself displayer (in final release for example, we have to put 0)</font>
+00060 <font class="comment">// Alternatively, you can use --without-logging when using configure to set</font>
+00061 <font class="comment">// it to 0.</font>
+00062 <font class="preprocessor">#ifndef NEL_DEFAULT_DISPLAYER</font>
+<a name="l00063"></a><a class="code" href="debug_8cpp.html#a0">00063</a> <font class="preprocessor"></font><font class="preprocessor">#define NEL_DEFAULT_DISPLAYER 1</font>
+00064 <font class="preprocessor"></font><font class="preprocessor">#endif // NEL_DEFAULT_DISPLAYER</font>
+00065 <font class="preprocessor"></font>
+00066 <font class="comment">// Put 0 if you don't want to display in file "log.log"</font>
+00067 <font class="comment">// Alternatively, you can use --without-logging when using configure to set</font>
+00068 <font class="comment">// it to 0.</font>
+00069 <font class="preprocessor">#ifndef NEL_LOG_IN_FILE</font>
+<a name="l00070"></a><a class="code" href="debug_8cpp.html#a1">00070</a> <font class="preprocessor"></font><font class="preprocessor">#define NEL_LOG_IN_FILE 1</font>
+00071 <font class="preprocessor"></font><font class="preprocessor">#endif // NEL_LOG_IN_FILE</font>
+00072 <font class="preprocessor"></font>
+<a name="l00073"></a><a class="code" href="debug_8cpp.html#a2">00073</a> <font class="preprocessor">#define DEFAULT_DISPLAYER NEL_DEFAULT_DISPLAYER</font>
+00074 <font class="preprocessor"></font>
+<a name="l00075"></a><a class="code" href="debug_8cpp.html#a3">00075</a> <font class="preprocessor">#define LOG_IN_FILE NEL_LOG_IN_FILE</font>
+00076 <font class="preprocessor"></font>
+00077 <font class="comment">// If true, debug system will trap crashs even if the appli is in debugger</font>
+<a name="l00078"></a><a class="code" href="debug_8cpp.html#a4">00078</a> <font class="keyword">static</font> <font class="keyword">const</font> <font class="keywordtype">bool</font> <a class="code" href="debug_8cpp.html#a4">TrapCrashInDebugger</a> = <font class="keyword">false</font>;
+00079
+00080 <font class="keyword">namespace </font>NLMISC
+00081 {
+00082
+00083 <font class="comment">// Need an assert in the macro</font>
+00084 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLMISC.html#a15">DebugNeedAssert</a> = <font class="keyword">false</font>;
+00085
+00086 CLog *<a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a> = NULL;
+00087 CLog *<a class="code" href="namespaceNLMISC.html#a9">WarningLog</a> = NULL;
+00088 CLog *<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a> = NULL;
+00089 CLog *<a class="code" href="namespaceNLMISC.html#a11">DebugLog</a> = NULL;
+00090 CLog *<a class="code" href="namespaceNLMISC.html#a12">AssertLog</a> = NULL;
+00091
+00092 CMemDisplayer *<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a> = NULL;
+00093 CMsgBoxDisplayer *<a class="code" href="namespaceNLMISC.html#a14">DefaultMsgBoxDisplayer</a> = NULL;
+00094
+00095 <font class="keyword">static</font> CStdDisplayer *<a class="code" href="namespaceNLMISC.html#a190">sd</a> = NULL;
+00096 <font class="keyword">static</font> CFileDisplayer *<a class="code" href="namespaceNLMISC.html#a191">fd</a> = NULL;
+00097
+00098 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a245">nlFatalError</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ...)
+00099 {
+00100 <font class="keywordtype">char</font> *str;
+00101 <a class="code" href="common_8h.html#a0">NLMISC_CONVERT_VARGS</a> (str, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, 256<font class="comment">/*NLMISC::MaxCStringSize*/</font>);
+00102
+00103 NLMISC::DebugNeedAssert = NLMISC::DefaultMsgBoxDisplayer==0;
+00104
+00105 NLMISC::ErrorLog-&gt;displayNL (str);
+00106
+00107 <font class="keywordflow">if</font> (NLMISC::DebugNeedAssert)
+00108 <a class="code" href="debug_8h.html#a5">NLMISC_BREAKPOINT</a>;
+00109
+00110 <font class="preprocessor">#ifndef NL_OS_WINDOWS</font>
+00111 <font class="preprocessor"></font> exit(EXIT_FAILURE);
+00112 <font class="preprocessor">#endif</font>
+00113 <font class="preprocessor"></font>
+00114 }
+00115
+00116 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a246">nlError</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ...)
+00117 {
+00118 <font class="keywordtype">char</font> *str;
+00119 <a class="code" href="common_8h.html#a0">NLMISC_CONVERT_VARGS</a> (str, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, 256<font class="comment">/*NLMISC::MaxCStringSize*/</font>);
+00120
+00121 NLMISC::DebugNeedAssert = NLMISC::DefaultMsgBoxDisplayer==0;
+00122
+00123 NLMISC::ErrorLog-&gt;displayNL (str);
+00124
+00125 <font class="keywordflow">if</font> (NLMISC::DebugNeedAssert)
+00126 <a class="code" href="debug_8h.html#a5">NLMISC_BREAKPOINT</a>;
+00127
+00128 <font class="preprocessor">#ifndef NL_OS_WINDOWS</font>
+00129 <font class="preprocessor"></font> exit(EXIT_FAILURE);
+00130 <font class="preprocessor">#endif</font>
+00131 <font class="preprocessor"></font>}
+00132
+00133 <font class="comment">// the default behavior is to display all in standard output and to a file named "log.log";</font>
+00134
+00135 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a293">initDebug2</a> (<font class="keywordtype">bool</font> logInFile)
+00136 {
+00137 <font class="keyword">static</font> <font class="keywordtype">bool</font> alreadyInit = <font class="keyword">false</font>;
+00138
+00139 <font class="keywordflow">if</font> (!alreadyInit)
+00140 {
+00141 <font class="preprocessor">#if DEFAULT_DISPLAYER</font>
+00142 <font class="preprocessor"></font>
+00143 <font class="comment">// put the standard displayer everywhere</font>
+00144
+00145 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00146 <font class="preprocessor"></font> <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a190">sd</a>);
+00147 <font class="preprocessor">#endif // NL_DEBUG</font>
+00148 <font class="preprocessor"></font> <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a190">sd</a>);
+00149 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a190">sd</a>);
+00150 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a190">sd</a>);
+00151 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a190">sd</a>);
+00152
+00153 <font class="comment">// put the memory displayer everywhere</font>
+00154
+00155 <font class="comment">// use the memory displayer and bypass all filter (even for the debug mode)</font>
+00156 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>, <font class="keyword">true</font>);
+00157 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>, <font class="keyword">true</font>);
+00158 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>, <font class="keyword">true</font>);
+00159 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>, <font class="keyword">true</font>);
+00160 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>, <font class="keyword">true</font>);
+00161
+00162 <font class="comment">// put the file displayer only if wanted</font>
+00163
+00164 <font class="preprocessor">#if LOG_IN_FILE</font>
+00165 <font class="preprocessor"></font> <font class="keywordflow">if</font> (logInFile)
+00166 {
+00167 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00168 <font class="preprocessor"></font> <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a191">fd</a>);
+00169 <font class="preprocessor">#endif // NL_DEBUG</font>
+00170 <font class="preprocessor"></font> <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a191">fd</a>);
+00171 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a191">fd</a>);
+00172 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a191">fd</a>);
+00173 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a191">fd</a>);
+00174 }
+00175 <font class="preprocessor">#endif // LOG_IN_FILE</font>
+00176 <font class="preprocessor"></font>
+00177 <font class="comment">// put the message box only in release for error</font>
+00178
+00179 <font class="keywordflow">if</font> (<a class="code" href="debug_8cpp.html#a4">TrapCrashInDebugger</a> || !<a class="code" href="displayer_8cpp.html#a0">IsDebuggerPresent</a> ())
+00180 {
+00181 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a14">DefaultMsgBoxDisplayer</a>);
+00182 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a1">addDisplayer</a> (<a class="code" href="namespaceNLMISC.html#a14">DefaultMsgBoxDisplayer</a>);
+00183 }
+00184
+00185 <font class="preprocessor">#endif // DEFAULT_DISPLAYER</font>
+00186 <font class="preprocessor"></font> alreadyInit = <font class="keyword">true</font>;
+00187 }
+00188 <font class="keywordflow">else</font>
+00189 {
+00190 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"NLMISC::initDebug2() already called"</font>);
+00191 }
+00192 }
+00193
+00194
+00195 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00196 <font class="preprocessor"></font>
+00197 <font class="comment">//</font>
+00198 <font class="comment">//</font>
+00199 <font class="comment">//</font>
+00200
+00201 <font class="keyword">static</font> DWORD __stdcall GetModuleBase(HANDLE hProcess, DWORD dwReturnAddress)
+00202 {
+00203 IMAGEHLP_MODULE moduleInfo;
+00204
+00205 <font class="keywordflow">if</font> (SymGetModuleInfo(hProcess, dwReturnAddress, &amp;moduleInfo))
+00206 <font class="keywordflow">return</font> moduleInfo.BaseOfImage;
+00207 <font class="keywordflow">else</font>
+00208 {
+00209 MEMORY_BASIC_INFORMATION memoryBasicInfo;
+00210
+00211 <font class="keywordflow">if</font> (::VirtualQueryEx(hProcess, (LPVOID) dwReturnAddress,
+00212 &amp;memoryBasicInfo, <font class="keyword">sizeof</font>(memoryBasicInfo)))
+00213 {
+00214 DWORD cch = 0;
+00215 <font class="keywordtype">char</font> szFile[MAX_PATH] = { 0 };
+00216
+00217 cch = GetModuleFileNameA((HINSTANCE)memoryBasicInfo.AllocationBase,
+00218 szFile, MAX_PATH);
+00219
+00220 <font class="keywordflow">if</font> (cch &amp;&amp; (lstrcmp(szFile, <font class="stringliteral">"DBFN"</font>)== 0))
+00221 {
+00222 <font class="keywordflow">if</font> (!SymLoadModule(hProcess,
+00223 NULL, <font class="stringliteral">"MN"</font>,
+00224 NULL, (DWORD) memoryBasicInfo.AllocationBase, 0))
+00225 {
+00226 DWORD dwError = GetLastError();
+00227 <font class="comment">// nlinfo("Error: %d", dwError);</font>
+00228 }
+00229 }
+00230 <font class="keywordflow">else</font>
+00231 {
+00232 <font class="keywordflow">if</font> (!SymLoadModule(hProcess,
+00233 NULL, ((cch) ? szFile : NULL),
+00234 NULL, (DWORD) memoryBasicInfo.AllocationBase, 0))
+00235 {
+00236 DWORD dwError = GetLastError();
+00237 <font class="comment">// nlinfo("Error: %d", dwError);</font>
+00238 }
+00239
+00240 }
+00241
+00242 <font class="keywordflow">return</font> (DWORD) memoryBasicInfo.AllocationBase;
+00243 }
+00244 <font class="comment">// else</font>
+00245 <font class="comment">// nlinfo("Error is %d", GetLastError());</font>
+00246 }
+00247
+00248 <font class="keywordflow">return</font> 0;
+00249 }
+00250
+00251 LPVOID __stdcall FunctionTableAccess (HANDLE hProcess, DWORD AddrBase)
+00252 {
+00253 AddrBase = 0x40291f;
+00254 DWORD <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> = SymGetModuleBase (hProcess, AddrBase);
+00255 HRESULT hr = GetLastError ();
+00256
+00257 IMAGEHLP_MODULE moduleInfo;
+00258 moduleInfo.SizeOfStruct = <font class="keyword">sizeof</font>(IMAGEHLP_MODULE);
+00259 SymGetModuleInfo(hProcess, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, &amp;moduleInfo);
+00260 hr = GetLastError ();
+00261 SymLoadModule(hProcess, NULL, NULL, NULL, 0, 0);
+00262 hr = GetLastError ();
+00263
+00264 LPVOID temp = SymFunctionTableAccess (hProcess, AddrBase);
+00265 hr = GetLastError ();
+00266 <font class="keywordflow">return</font> temp;
+00267 }
+00268
+00269 <font class="keyword">class </font>EDebug : <font class="keyword">public</font> ETrapDebug
+00270 {
+00271 <font class="keyword">public</font>:
+00272
+00273 EDebug() { _Reason = <font class="stringliteral">"Nothing about EDebug"</font>; }
+00274
+00275 ~EDebug () { }
+00276
+00277 EDebug(EXCEPTION_POINTERS * pexp) : m_pexp(pexp) { <a class="code" href="debug_8h.html#a6">nlassert</a>(pexp != 0); createWhat(); }
+00278 EDebug(<font class="keyword">const</font> EDebug&amp; se) : m_pexp(se.m_pexp) { createWhat(); }
+00279
+00280 <font class="keywordtype">void</font> createWhat ()
+00281 {
+00282 string shortExc, longExc, subject;
+00283 string <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, ext;
+00284 sint skipNFirst = 0;
+00285 _Reason = <font class="stringliteral">""</font>;
+00286
+00287 <font class="keywordflow">if</font> (m_pexp == NULL)
+00288 {
+00289 _Reason = <font class="stringliteral">"Unknown exception, don't have context."</font>;
+00290 }
+00291 <font class="keywordflow">else</font>
+00292 {
+00293 <font class="keywordflow">switch</font> (m_pexp-&gt;ExceptionRecord-&gt;ExceptionCode)
+00294 {
+00295 <font class="keywordflow">case</font> EXCEPTION_ACCESS_VIOLATION : shortExc=<font class="stringliteral">"Access Violation"</font>; longExc=<font class="stringliteral">"The thread attempted to read from or write to a virtual address for which it does not have the appropriate access"</font>;
+00296 ext = <font class="stringliteral">", thread attempts to "</font>;
+00297 ext += m_pexp-&gt;ExceptionRecord-&gt;ExceptionInformation[0]?<font class="stringliteral">"write"</font>:<font class="stringliteral">"read"</font>;
+00298 <font class="keywordflow">if</font> (m_pexp-&gt;ExceptionRecord-&gt;ExceptionInformation[1])
+00299 ext += <a class="code" href="namespaceNLMISC.html#a243">toString</a>(<font class="stringliteral">" at 0x%X"</font>,m_pexp-&gt;ExceptionRecord-&gt;ExceptionInformation[1]);
+00300 <font class="keywordflow">else</font>
+00301 ext += <font class="stringliteral">" at &lt;NULL&gt;"</font>;
+00302 <font class="keywordflow">break</font>;
+00303 <font class="keywordflow">case</font> EXCEPTION_DATATYPE_MISALIGNMENT : shortExc=<font class="stringliteral">"Datatype Misalignment"</font>; longExc=<font class="stringliteral">"The thread attempted to read or write data that is misaligned on hardware that does not provide alignment. For example, 16-bit values must be aligned on 2-byte boundaries, 32-bit values on 4-byte boundaries, and so on"</font>; <font class="keywordflow">break</font>;
+00304 <font class="keywordflow">case</font> EXCEPTION_BREAKPOINT : shortExc=<font class="stringliteral">"Breakpoint"</font>; longExc=<font class="stringliteral">"A breakpoint was encountered"</font>; <font class="keywordflow">break</font>;
+00305 <font class="keywordflow">case</font> EXCEPTION_SINGLE_STEP : shortExc=<font class="stringliteral">"Single Step"</font>; longExc=<font class="stringliteral">"A trace trap or other single-instruction mechanism signaled that one instruction has been executed"</font>; <font class="keywordflow">break</font>;
+00306 <font class="keywordflow">case</font> EXCEPTION_ARRAY_BOUNDS_EXCEEDED : shortExc=<font class="stringliteral">"Array Bounds Exceeded"</font>; longExc=<font class="stringliteral">"The thread attempted to access an array element that is out of bounds, and the underlying hardware supports bounds checking"</font>; <font class="keywordflow">break</font>;
+00307 <font class="keywordflow">case</font> EXCEPTION_FLT_DENORMAL_OPERAND : shortExc=<font class="stringliteral">"Float Denormal Operand"</font>; longExc=<font class="stringliteral">"One of the operands in a floating-point operation is denormal. A denormal value is one that is too small to represent as a standard floating-point value"</font>; <font class="keywordflow">break</font>;
+00308 <font class="keywordflow">case</font> EXCEPTION_FLT_DIVIDE_BY_ZERO : shortExc=<font class="stringliteral">"Float Divide By Zero"</font>; longExc=<font class="stringliteral">"The thread attempted to divide a floating-point value by a floating-point divisor of zero"</font>; <font class="keywordflow">break</font>;
+00309 <font class="keywordflow">case</font> EXCEPTION_FLT_INEXACT_RESULT : shortExc=<font class="stringliteral">"Float Inexact Result"</font>; longExc=<font class="stringliteral">"The result of a floating-point operation cannot be represented exactly as a decimal fraction"</font>; <font class="keywordflow">break</font>;
+00310 <font class="keywordflow">case</font> EXCEPTION_FLT_INVALID_OPERATION : shortExc=<font class="stringliteral">"Float Invalid Operation"</font>; longExc=<font class="stringliteral">"This exception represents any floating-point exception not included in this list"</font>; <font class="keywordflow">break</font>;
+00311 <font class="keywordflow">case</font> EXCEPTION_FLT_OVERFLOW : shortExc=<font class="stringliteral">"Float Overflow"</font>; longExc=<font class="stringliteral">"The exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type"</font>; <font class="keywordflow">break</font>;
+00312 <font class="keywordflow">case</font> EXCEPTION_FLT_STACK_CHECK : shortExc=<font class="stringliteral">"Float Stack Check"</font>; longExc=<font class="stringliteral">"The stack overflowed or underflowed as the result of a floating-point operation"</font>; <font class="keywordflow">break</font>;
+00313 <font class="keywordflow">case</font> EXCEPTION_FLT_UNDERFLOW : shortExc=<font class="stringliteral">"Float Underflow"</font>; longExc=<font class="stringliteral">"The exponent of a floating-point operation is less than the magnitude allowed by the corresponding type"</font>; <font class="keywordflow">break</font>;
+00314 <font class="keywordflow">case</font> EXCEPTION_INT_DIVIDE_BY_ZERO : shortExc=<font class="stringliteral">"Integer Divide By Zero"</font>; longExc=<font class="stringliteral">"The thread attempted to divide an integer value by an integer divisor of zero"</font>; <font class="keywordflow">break</font>;
+00315 <font class="keywordflow">case</font> EXCEPTION_INT_OVERFLOW : shortExc=<font class="stringliteral">"Integer Overflow"</font>; longExc=<font class="stringliteral">"The result of an integer operation caused a carry out of the most significant bit of the result"</font>; <font class="keywordflow">break</font>;
+00316 <font class="keywordflow">case</font> EXCEPTION_PRIV_INSTRUCTION : shortExc=<font class="stringliteral">"Privileged Instruction"</font>; longExc=<font class="stringliteral">"The thread attempted to execute an instruction whose operation is not allowed in the current machine mode"</font>; <font class="keywordflow">break</font>;
+00317 <font class="keywordflow">case</font> EXCEPTION_IN_PAGE_ERROR : shortExc=<font class="stringliteral">"In Page Error"</font>; longExc=<font class="stringliteral">"The thread tried to access a page that was not present, and the system was unable to load the page. -ie. the program or memory mapped file couldn't be paged in because it isn't accessable any more. Device drivers can return this exception if something went wrong with the read (i.e hardware problems)"</font>; <font class="keywordflow">break</font>;
+00318 <font class="keywordflow">case</font> EXCEPTION_ILLEGAL_INSTRUCTION : shortExc=<font class="stringliteral">"Illegal Instruction"</font>; longExc=<font class="stringliteral">"The thread tried to execute an invalid instruction -such as MMX opcodes on a non MMX system. Branching to an invalid location can cause this -something stack corruption often causes"</font>; <font class="keywordflow">break</font>;
+00319 <font class="keywordflow">case</font> EXCEPTION_NONCONTINUABLE_EXCEPTION : shortExc=<font class="stringliteral">"Noncontinuable Exception"</font>; longExc=<font class="stringliteral">"The thread attempted to continue execution after a noncontinuable exception occurred"</font>; <font class="keywordflow">break</font>;
+00320 <font class="keywordflow">case</font> EXCEPTION_STACK_OVERFLOW : shortExc=<font class="stringliteral">"Stack Overflow"</font>; longExc=<font class="stringliteral">"Stack overflow. Can occur during errant recursion, or when a function creates a particularly large array on the stack"</font>; <font class="keywordflow">break</font>;
+00321 <font class="keywordflow">case</font> EXCEPTION_INVALID_DISPOSITION : shortExc=<font class="stringliteral">"Invalid Disposition"</font>; longExc=<font class="stringliteral">"Whatever number the exception filter returned, it wasn't a value the OS knows about"</font>; <font class="keywordflow">break</font>;
+00322 <font class="keywordflow">case</font> EXCEPTION_GUARD_PAGE : shortExc=<font class="stringliteral">"Guard Page"</font>; longExc=<font class="stringliteral">"Memory Allocated as PAGE_GUARD by VirtualAlloc() has been accessed"</font>; <font class="keywordflow">break</font>;
+00323 <font class="keywordflow">case</font> EXCEPTION_INVALID_HANDLE : shortExc=<font class="stringliteral">"Invalid Handle"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00324 <font class="keywordflow">case</font> CONTROL_C_EXIT : shortExc=<font class="stringliteral">"Control-C"</font>; longExc=<font class="stringliteral">"Lets the debugger know the user hit Ctrl-C. Seemingly for console apps only"</font>; <font class="keywordflow">break</font>;
+00325 <font class="keywordflow">case</font> STATUS_NO_MEMORY : shortExc=<font class="stringliteral">"No Memory"</font>; longExc=<font class="stringliteral">"Called by HeapAlloc() if you specify HEAP_GENERATE_EXCEPTIONS and there is no memory or heap corruption"</font>;
+00326 ext = <font class="stringliteral">", unable to allocate "</font>;
+00327 ext += <a class="code" href="namespaceNLMISC.html#a243">toString</a> (<font class="stringliteral">"%d bytes"</font>, m_pexp-&gt;ExceptionRecord-&gt;ExceptionInformation [0]);
+00328 <font class="keywordflow">break</font>;
+00329 <font class="keywordflow">case</font> STATUS_WAIT_0 : shortExc=<font class="stringliteral">"Wait 0"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00330 <font class="keywordflow">case</font> STATUS_ABANDONED_WAIT_0 : shortExc=<font class="stringliteral">"Abandoned Wait 0"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00331 <font class="keywordflow">case</font> STATUS_USER_APC : shortExc=<font class="stringliteral">"User APC"</font>; longExc=<font class="stringliteral">"A user APC was delivered to the current thread before the specified Timeout interval expired"</font>; <font class="keywordflow">break</font>;
+00332 <font class="keywordflow">case</font> STATUS_TIMEOUT : shortExc=<font class="stringliteral">"Timeout"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00333 <font class="keywordflow">case</font> STATUS_PENDING : shortExc=<font class="stringliteral">"Pending"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00334 <font class="keywordflow">case</font> STATUS_SEGMENT_NOTIFICATION : shortExc=<font class="stringliteral">"Segment Notification"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00335 <font class="keywordflow">case</font> STATUS_FLOAT_MULTIPLE_FAULTS : shortExc=<font class="stringliteral">"Float Multiple Faults"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00336 <font class="keywordflow">case</font> STATUS_FLOAT_MULTIPLE_TRAPS : shortExc=<font class="stringliteral">"Float Multiple Traps"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00337 <font class="keywordflow">case</font> STATUS_ILLEGAL_VLM_REFERENCE : shortExc=<font class="stringliteral">"Illegal VLM Reference"</font>; longExc=<font class="stringliteral">""</font>; <font class="keywordflow">break</font>;
+00338 <font class="keywordflow">case</font> 0xE06D7363 : shortExc=<font class="stringliteral">"Microsoft C++ Exception"</font>; longExc=<font class="stringliteral">"Microsoft C++ Exception"</font>; <font class="keywordflow">break</font>; <font class="comment">// cpp exception</font>
+00339 <font class="keywordflow">case</font> 0xACE0ACE : shortExc=<font class="stringliteral">""</font>; longExc=<font class="stringliteral">""</font>;
+00340 <font class="keywordflow">if</font> (m_pexp-&gt;ExceptionRecord-&gt;NumberParameters == 1)
+00341 skipNFirst = m_pexp-&gt;ExceptionRecord-&gt;ExceptionInformation [0];
+00342 <font class="keywordflow">break</font>; <font class="comment">// just want the stack</font>
+00343 <font class="keywordflow">default</font> : shortExc=<font class="stringliteral">"Unknown Exception"</font>; longExc=<font class="stringliteral">"Unknown Exception "</font>+<a class="code" href="namespaceNLMISC.html#a243">toString</a>(<font class="stringliteral">"0x%X"</font>, m_pexp-&gt;ExceptionRecord-&gt;ExceptionCode); <font class="keywordflow">break</font>;
+00344 };
+00345
+00346 <font class="keywordflow">if</font>(m_pexp-&gt;ExceptionRecord != NULL)
+00347 {
+00348 <font class="keywordflow">if</font> (m_pexp-&gt;ExceptionRecord-&gt;ExceptionAddress)
+00349 <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> = <a class="code" href="namespaceNLMISC.html#a243">toString</a>(<font class="stringliteral">" at 0x%X"</font>, m_pexp-&gt;ExceptionRecord-&gt;ExceptionAddress);
+00350 <font class="keywordflow">else</font>
+00351 <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> = <font class="stringliteral">" at &lt;NULL&gt;"</font>;
+00352 }
+00353
+00354 string progname;
+00355 <font class="keywordflow">if</font>(!shortExc.empty() || !longExc.empty())
+00356 {
+00357 <font class="keywordtype">char</font> name[1024];
+00358 GetModuleFileName (NULL, name, 1023);
+00359 progname = CFile::getFilename(name);
+00360 progname += <font class="stringliteral">" "</font>;
+00361 }
+00362
+00363 subject = progname + shortExc + <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>;
+00364
+00365 <font class="keywordflow">if</font> (_Reason.empty())
+00366 {
+00367 <font class="keywordflow">if</font> (!shortExc.empty()) _Reason += shortExc + <font class="stringliteral">" exception generated"</font> + <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> + ext + <font class="stringliteral">".\n"</font>;
+00368 <font class="keywordflow">if</font> (!longExc.empty()) _Reason += longExc + <font class="stringliteral">".\n"</font>;
+00369 }
+00370
+00371 <font class="comment">// display the stack</font>
+00372 addStackAndLogToReason (skipNFirst);
+00373
+00374 <font class="keywordflow">if</font>(!shortExc.empty() || !longExc.empty())
+00375 {
+00376 <font class="keywordtype">bool</font> i = <font class="keyword">false</font>;
+00377 <a class="code" href="namespaceNLMISC.html#a312">report</a> (progname+shortExc, <font class="stringliteral">""</font>, subject, _Reason, <font class="keyword">true</font>, 1, <font class="keyword">true</font>, 1, <font class="keyword">true</font>, i);
+00378 }
+00379 }
+00380 }
+00381
+00382 <font class="comment">// display the callstack</font>
+00383 <font class="keywordtype">void</font> addStackAndLogToReason (sint skipNFirst = 0)
+00384 {
+00385 <font class="comment">// ace hack</font>
+00386 skipNFirst = 0;
+00387
+00388 DWORD symOptions = SymGetOptions();
+00389 symOptions |= SYMOPT_LOAD_LINES;
+00390 symOptions &amp;= ~SYMOPT_UNDNAME;
+00391 SymSetOptions (symOptions);
+00392
+00393 <a class="code" href="debug_8h.html#a9">nlverify</a> (SymInitialize(getProcessHandle(), NULL, FALSE) == TRUE);
+00394
+00395 STACKFRAME callStack;
+00396 ::ZeroMemory (&amp;callStack, <font class="keyword">sizeof</font>(callStack));
+00397 callStack.AddrPC.Mode = AddrModeFlat;
+00398 callStack.AddrPC.Offset = m_pexp-&gt;ContextRecord-&gt;Eip;
+00399 callStack.AddrStack.Mode = AddrModeFlat;
+00400 callStack.AddrStack.Offset = m_pexp-&gt;ContextRecord-&gt;Esp;
+00401 callStack.AddrFrame.Mode = AddrModeFlat;
+00402 callStack.AddrFrame.Offset = m_pexp-&gt;ContextRecord-&gt;Ebp;
+00403
+00404 _Reason += <font class="stringliteral">"\nCallstack:\n"</font>;
+00405 _Reason += <font class="stringliteral">"-------------------------------\n"</font>;
+00406 <font class="keywordflow">for</font> (sint32 i = 0; ; i++)
+00407 {
+00408 SetLastError(0);
+00409 BOOL <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = StackWalk (IMAGE_FILE_MACHINE_I386, getProcessHandle(), GetCurrentThread(), &amp;callStack,
+00410 m_pexp-&gt;ContextRecord, NULL, FunctionTableAccess, GetModuleBase, NULL);
+00411
+00412 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> == FALSE || callStack.AddrFrame.Offset == 0)
+00413 <font class="keywordflow">break</font>;
+00414
+00415 string symInfo, srcInfo;
+00416
+00417 <font class="keywordflow">if</font> (i &gt;= skipNFirst)
+00418 {
+00419 srcInfo = getSourceInfo (callStack.AddrPC.Offset);
+00420 symInfo = getFuncInfo (callStack.AddrPC.Offset, callStack.AddrFrame.Offset);
+00421 _Reason += srcInfo + <font class="stringliteral">": "</font> + symInfo + <font class="stringliteral">"\n"</font>;
+00422 }
+00423 }
+00424 _Reason += <font class="stringliteral">"-------------------------------\n"</font>;
+00425 _Reason += <font class="stringliteral">"\n"</font>;
+00426 <font class="keywordflow">if</font>(DefaultMemDisplayer)
+00427 {
+00428 _Reason += <font class="stringliteral">"Log with no filter:\n"</font>;
+00429 _Reason += <font class="stringliteral">"-------------------------------\n"</font>;
+00430 <a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>-&gt;write (_Reason);
+00431 }
+00432 <font class="keywordflow">else</font>
+00433 {
+00434 _Reason += <font class="stringliteral">"No log\n"</font>;
+00435 }
+00436 _Reason += <font class="stringliteral">"-------------------------------\n"</font>;
+00437
+00438 <a class="code" href="debug_8h.html#a9">nlverify</a> (SymCleanup(getProcessHandle()) == TRUE);
+00439 }
+00440
+00441 string getSourceInfo (DWORD <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>)
+00442 {
+00443 string str;
+00444
+00445 IMAGEHLP_LINE line;
+00446 ::ZeroMemory (&amp;line, <font class="keyword">sizeof</font> (line));
+00447 line.SizeOfStruct = <font class="keyword">sizeof</font>(line);
+00448
+00449 <font class="comment">// "Debugging Applications" John Robbins</font>
+00450 <font class="comment">// The problem is that the symbol engine finds only those source</font>
+00451 <font class="comment">// line addresses (after the first lookup) that fall exactly on</font>
+00452 <font class="comment">// a zero displacement. I'll walk backward 100 bytes to</font>
+00453 <font class="comment">// find the line and return the proper displacement.</font>
+00454 <font class="keywordtype">bool</font> ok = <font class="keyword">true</font>;
+00455 DWORD displacement = 0 ;
+00456 DWORD resdisp;
+00457 <font class="keywordflow">while</font> (!SymGetLineFromAddr (getProcessHandle(), <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a> - displacement, (DWORD*)&amp;resdisp, &amp;line))
+00458 {
+00459 <font class="keywordflow">if</font> (100 == ++displacement)
+00460 {
+00461 ok = <font class="keyword">false</font>;
+00462 <font class="keywordflow">break</font>;
+00463 }
+00464 }
+00465
+00466 <font class="comment">// "Debugging Applications" John Robbins</font>
+00467 <font class="comment">// I found the line, and the source line information is correct, so</font>
+00468 <font class="comment">// change the displacement if I had to search backward to find the source line.</font>
+00469 <font class="keywordflow">if</font> (displacement)
+00470 resdisp = displacement;
+00471
+00472 <font class="keywordflow">if</font> (ok)
+00473 {
+00474 str = line.FileName;
+00475 str += <font class="stringliteral">"("</font> + <a class="code" href="namespaceNLMISC.html#a243">toString</a> (line.LineNumber) + <font class="stringliteral">")"</font>;
+00476 str += <a class="code" href="namespaceNLMISC.html#a243">toString</a>(<font class="stringliteral">": 0x%X"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>);
+00477 }
+00478 <font class="keywordflow">else</font>
+00479 {
+00480 HRESULT hr = GetLastError();
+00481 IMAGEHLP_MODULE module;
+00482 ::ZeroMemory (&amp;module, <font class="keyword">sizeof</font>(module));
+00483 module.SizeOfStruct = <font class="keyword">sizeof</font>(module);
+00484
+00485 <font class="keywordflow">if</font> (SymGetModuleInfo (getProcessHandle(), <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>, &amp;module))
+00486 {
+00487 str = module.ModuleName;
+00488 }
+00489 <font class="keywordflow">else</font>
+00490 {
+00491 HRESULT hr = GetLastError ();
+00492 str = <font class="stringliteral">"&lt;NoModule&gt;"</font>;
+00493 }
+00494 str += <a class="code" href="namespaceNLMISC.html#a243">toString</a>(<font class="stringliteral">"!0x%X"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a414">addr</a>);
+00495 }
+00496
+00497 <font class="comment">/*</font>
+00498 <font class="comment"> DWORD disp;</font>
+00499 <font class="comment"> if (SymGetLineFromAddr (getProcessHandle(), addr, &amp;disp, &amp;line))</font>
+00500 <font class="comment"> {</font>
+00501 <font class="comment"> str = line.FileName;</font>
+00502 <font class="comment"> str += "(" + toString (line.LineNumber) + ")";</font>
+00503 <font class="comment"> }</font>
+00504 <font class="comment"> else</font>
+00505 <font class="comment"> {</font>
+00506 <font class="comment"> HRESULT hr = GetLastError();</font>
+00507 <font class="comment"> IMAGEHLP_MODULE module;</font>
+00508 <font class="comment"> ::ZeroMemory (&amp;module, sizeof(module));</font>
+00509 <font class="comment"> module.SizeOfStruct = sizeof(module);</font>
+00510 <font class="comment"></font>
+00511 <font class="comment"> if (SymGetModuleInfo (getProcessHandle(), addr, &amp;module))</font>
+00512 <font class="comment"> {</font>
+00513 <font class="comment"> str = module.ModuleName;</font>
+00514 <font class="comment"> }</font>
+00515 <font class="comment"> else</font>
+00516 <font class="comment"> {</font>
+00517 <font class="comment"> HRESULT hr = GetLastError ();</font>
+00518 <font class="comment"> str = "&lt;NoModule&gt;";</font>
+00519 <font class="comment"> }</font>
+00520 <font class="comment"> char tmp[32];</font>
+00521 <font class="comment"> sprintf (tmp, "!0x%X", addr);</font>
+00522 <font class="comment"> str += tmp;</font>
+00523 <font class="comment"> }</font>
+00524 <font class="comment"> str +=" DEBUG:"+toString("0x%08X", addr);*/</font>
+00525
+00526 <font class="keywordflow">return</font> str;
+00527 }
+00528
+00529 HANDLE getProcessHandle()
+00530 {
+00531 <font class="keywordflow">return</font> CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)GetCurrentProcessId();
+00532 }
+00533
+00534 <font class="comment">// return true if found</font>
+00535 <font class="keywordtype">bool</font> findAndErase(string &amp;str, <font class="keyword">const</font> <font class="keywordtype">char</font> *token, <font class="keyword">const</font> <font class="keywordtype">char</font> *replace = NULL)
+00536 {
+00537 <font class="keywordtype">int</font> pos;
+00538 <font class="keywordflow">if</font> ((pos = str.find(token)) != string::npos)
+00539 {
+00540 str.erase (pos,strlen(token));
+00541 <font class="keywordflow">if</font> (replace != NULL)
+00542 str.insert (pos, replace);
+00543 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00544 }
+00545 <font class="keywordflow">else</font>
+00546 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00547 }
+00548
+00549 <font class="comment">// remove space and const stuffs</font>
+00550 <font class="comment">// rawType contains the type without anything (to compare with known type)</font>
+00551 <font class="comment">// displayType contains the type without std:: and stl ugly things</font>
+00552 <font class="keywordtype">void</font> cleanType(string &amp;rawType, string &amp;displayType)
+00553 {
+00554 <font class="keywordflow">while</font> (findAndErase(rawType, <font class="stringliteral">"std::"</font>)) ;
+00555 <font class="keywordflow">while</font> (findAndErase(displayType, <font class="stringliteral">"std::"</font>)) ;
+00556
+00557 <font class="keywordflow">while</font> (findAndErase(rawType, <font class="stringliteral">"const"</font>)) ;
+00558
+00559 <font class="keywordflow">while</font> (findAndErase(rawType, <font class="stringliteral">" "</font>)) ;
+00560
+00561 <font class="keywordflow">while</font> (findAndErase(rawType, <font class="stringliteral">"&amp;"</font>)) ;
+00562
+00563 <font class="comment">// rename ugly stl type</font>
+00564
+00565 <font class="keywordflow">while</font> (findAndErase(rawType, <font class="stringliteral">"classbasic_string&lt;char,classchar_traits&lt;char&gt;,classallocator&lt;char&gt;&gt;"</font>, <font class="stringliteral">"string"</font>)) ;
+00566 <font class="keywordflow">while</font> (findAndErase(displayType, <font class="stringliteral">"class basic_string&lt;char,class char_traits&lt;char&gt;,class allocator&lt;char&gt; &gt;"</font>, <font class="stringliteral">"string"</font>)) ;
+00567 <font class="keywordflow">while</font> (findAndErase(rawType, <font class="stringliteral">"classvector&lt;char,class char_traits&lt;char&gt;,class allocator&lt;char&gt; &gt;"</font>, <font class="stringliteral">"string"</font>)) ;
+00568 }
+00569
+00570 string getFuncInfo (DWORD funcAddr, DWORD stackAddr)
+00571 {
+00572 string str (<font class="stringliteral">"NoSymbol"</font>);
+00573
+00574 DWORD symSize = 10000;
+00575 PIMAGEHLP_SYMBOL sym = (PIMAGEHLP_SYMBOL) GlobalAlloc (GMEM_FIXED, symSize);
+00576 ::ZeroMemory (sym, symSize);
+00577 sym-&gt;SizeOfStruct = symSize;
+00578 sym-&gt;MaxNameLength = symSize - <font class="keyword">sizeof</font>(IMAGEHLP_SYMBOL);
+00579
+00580 DWORD disp = 0;
+00581 <font class="keywordflow">if</font> (SymGetSymFromAddr (getProcessHandle(), funcAddr, &amp;disp, sym) == FALSE)
+00582 {
+00583 <font class="keywordflow">return</font> str;
+00584 }
+00585
+00586 CHAR undecSymbol[1024];
+00587 <font class="keywordflow">if</font> (UnDecorateSymbolName (sym-&gt;Name, undecSymbol, 1024, UNDNAME_COMPLETE | UNDNAME_NO_THISTYPE | UNDNAME_NO_SPECIAL_SYMS | UNDNAME_NO_MEMBER_TYPE | UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS ) &gt; 0)
+00588 {
+00589 str = undecSymbol;
+00590 }
+00591 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (SymUnDName (sym, undecSymbol, 1024) == TRUE)
+00592 {
+00593 str = undecSymbol;
+00594 }
+00595
+00596 <font class="comment">// replace param with the value of the stack for this param</font>
+00597
+00598 string parse = str;
+00599 str = <font class="stringliteral">""</font>;
+00600 uint pos = 0;
+00601 sint stop = 0;
+00602
+00603 string <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
+00604
+00605 uint i = parse.find (<font class="stringliteral">"("</font>);
+00606
+00607 <font class="comment">// copy the function name</font>
+00608 str = parse.substr(0, i);
+00609
+00610 <font class="comment">// nlinfo ("not parsed '%s'", parse.c_str());</font>
+00611
+00613
+00614 <font class="comment">/* // if there s parameter, parse them</font>
+00615 <font class="comment"> if(i!=string::npos)</font>
+00616 <font class="comment"> {</font>
+00617 <font class="comment"> // copy the '('</font>
+00618 <font class="comment"> str += parse[i];</font>
+00619 <font class="comment"> for (i++; i &lt; parse.size (); i++)</font>
+00620 <font class="comment"> {</font>
+00621 <font class="comment"> if (parse[i] == '&lt;')</font>
+00622 <font class="comment"> stop++;</font>
+00623 <font class="comment"> if (parse[i] == '&gt;')</font>
+00624 <font class="comment"> stop--;</font>
+00625 <font class="comment"></font>
+00626 <font class="comment"> if (stop==0 &amp;&amp; (parse[i] == ',' || parse[i] == ')'))</font>
+00627 <font class="comment"> {</font>
+00628 <font class="comment"> ULONG *addr = (ULONG*)(stackAddr) + 2 + pos++;</font>
+00629 <font class="comment"></font>
+00630 <font class="comment"> string displayType = type;</font>
+00631 <font class="comment"> cleanType (type, displayType);</font>
+00632 <font class="comment"></font>
+00633 <font class="comment"> char tmp[1024];</font>
+00634 <font class="comment"> if(type == "void")</font>
+00635 <font class="comment"> {</font>
+00636 <font class="comment"> tmp[0]='\0';</font>
+00637 <font class="comment"> }</font>
+00638 <font class="comment"> else if(type == "int")</font>
+00639 <font class="comment"> {</font>
+00640 <font class="comment"> sprintf (tmp, "%d", *addr);</font>
+00641 <font class="comment"> }</font>
+00642 <font class="comment"> else if (type == "char")</font>
+00643 <font class="comment"> {</font>
+00644 <font class="comment"> if (isprint(*addr))</font>
+00645 <font class="comment"> {</font>
+00646 <font class="comment"> sprintf (tmp, "'%c'", *addr);</font>
+00647 <font class="comment"> }</font>
+00648 <font class="comment"> else</font>
+00649 <font class="comment"> {</font>
+00650 <font class="comment"> sprintf (tmp, "%d", *addr);</font>
+00651 <font class="comment"> }</font>
+00652 <font class="comment"> }</font>
+00653 <font class="comment"> else if (type == "char*" &amp;&amp; *addr != NULL)</font>
+00654 <font class="comment"> {</font>
+00655 <font class="comment"> uint pos = 0;</font>
+00656 <font class="comment"> tmp[pos++] = '\"';</font>
+00657 <font class="comment"> for (uint i = 0; i &lt; strlen((char*)*addr); i++)</font>
+00658 <font class="comment"> {</font>
+00659 <font class="comment"> if (pos == 1020)</font>
+00660 <font class="comment"> break;</font>
+00661 <font class="comment"> char c = ((char *)*addr)[i];</font>
+00662 <font class="comment"> if (c == '\n')</font>
+00663 <font class="comment"> {</font>
+00664 <font class="comment"> tmp[pos++] = '\\';</font>
+00665 <font class="comment"> tmp[pos++] = 'n';</font>
+00666 <font class="comment"> }</font>
+00667 <font class="comment"> else if (c == '\r')</font>
+00668 <font class="comment"> {</font>
+00669 <font class="comment"> tmp[pos++] = '\\';</font>
+00670 <font class="comment"> tmp[pos++] = 'r';</font>
+00671 <font class="comment"> }</font>
+00672 <font class="comment"> else if (c == '\t')</font>
+00673 <font class="comment"> {</font>
+00674 <font class="comment"> tmp[pos++] = '\\';</font>
+00675 <font class="comment"> tmp[pos++] = 't';</font>
+00676 <font class="comment"> }</font>
+00677 <font class="comment"> else</font>
+00678 <font class="comment"> tmp[pos++] = c;</font>
+00679 <font class="comment"> }</font>
+00680 <font class="comment"> tmp[pos++] = '\"';</font>
+00681 <font class="comment"> tmp[pos++] = '\0';</font>
+00682 <font class="comment"> }</font>
+00683 <font class="comment"> else if (type == "string" &amp;&amp; *addr != NULL)</font>
+00684 <font class="comment"> {</font>
+00685 <font class="comment"> sprintf (tmp, "\"%s\"", ((string*)addr)-&gt;c_str());</font>
+00686 <font class="comment"> }</font>
+00687 <font class="comment"> else</font>
+00688 <font class="comment"> {</font>
+00689 <font class="comment"> if(*addr == NULL)</font>
+00690 <font class="comment"> sprintf (tmp, "&lt;NULL&gt;");</font>
+00691 <font class="comment"> else</font>
+00692 <font class="comment"> sprintf (tmp, "0x%X", *addr);</font>
+00693 <font class="comment"> }</font>
+00694 <font class="comment"></font>
+00695 <font class="comment"> str += displayType;</font>
+00696 <font class="comment"> if(tmp[0]!='\0')</font>
+00697 <font class="comment"> {</font>
+00698 <font class="comment"> str += "=";</font>
+00699 <font class="comment"> str += tmp;</font>
+00700 <font class="comment"> }</font>
+00701 <font class="comment"> str += parse[i];</font>
+00702 <font class="comment"> type = "";</font>
+00703 <font class="comment"> }</font>
+00704 <font class="comment"> else</font>
+00705 <font class="comment"> {</font>
+00706 <font class="comment"> type += parse[i];</font>
+00707 <font class="comment"> }</font>
+00708 <font class="comment"> }</font>
+00709 <font class="comment"> GlobalFree (sym);</font>
+00710 <font class="comment"> if (disp != 0)</font>
+00711 <font class="comment"> {</font>
+00712 <font class="comment"> str += " + ";</font>
+00713 <font class="comment"> str += toString (disp);</font>
+00714 <font class="comment"> str += " bytes";</font>
+00715 <font class="comment"> }</font>
+00716 <font class="comment"> }</font>
+00717 <font class="comment">*/</font>
+00718 <font class="comment">// nlinfo ("after parsing '%s'", str.c_str());</font>
+00719
+00720 <font class="keywordflow">return</font> str;
+00721 }
+00722
+00723 <font class="keyword">private</font>:
+00724 EXCEPTION_POINTERS * m_pexp;
+00725 };
+00726
+00727 <font class="comment">// workaround of VCPP synchronous exception and se translator</font>
+00728 <font class="keywordtype">bool</font> global_force_exception_flag = <font class="keyword">false</font>;
+00729 <font class="preprocessor">#define WORKAROUND_VCPP_SYNCHRONOUS_EXCEPTION if (global_force_exception_flag) force_exception_frame();</font>
+00730 <font class="preprocessor"></font><font class="keywordtype">void</font> force_exception_frame(...) {std::cout.flush();}
+00731
+00732 <font class="keyword">static</font> <font class="keywordtype">void</font> exceptionTranslator(<font class="keywordtype">unsigned</font>, EXCEPTION_POINTERS *pexp)
+00733 {
+00734 <font class="comment">// ace desactive because we can't debug if activated</font>
+00735 <font class="comment">//if (!TrapCrashInDebugger &amp;&amp; IsDebuggerPresent ())</font>
+00736 {
+00737 <font class="keywordflow">if</font> (pexp-&gt;ExceptionRecord-&gt;ExceptionCode == 0xACE0ACE)
+00738 <font class="keywordflow">throw</font> EDebug (pexp);
+00739 <font class="keywordflow">else</font>
+00740 <font class="keywordflow">return</font>;
+00741 }
+00742 <font class="comment">/*else</font>
+00743 <font class="comment"> {</font>
+00744 <font class="comment"> if (pexp-&gt;ExceptionRecord-&gt;ExceptionCode == EXCEPTION_BREAKPOINT)</font>
+00745 <font class="comment"> return;</font>
+00746 <font class="comment"> else</font>
+00747 <font class="comment"> throw EDebug (pexp);</font>
+00748 <font class="comment"> }*/</font>
+00749 }
+00750
+00751 <font class="preprocessor">#endif // NL_OS_WINDOWS</font>
+00752 <font class="preprocessor"></font>
+00753 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a249">getCallStackAndLog</a> (string &amp;result, sint skipNFirst)
+00754 {
+00755 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00756 <font class="preprocessor"></font> <font class="keywordflow">try</font>
+00757 {
+00758 WORKAROUND_VCPP_SYNCHRONOUS_EXCEPTION <font class="comment">// force to install a exception frame </font>
+00759
+00760 DWORD array[1];
+00761 array[0] = skipNFirst;
+00762 RaiseException (0xACE0ACE, 0, 1, array);
+00763 }
+00764 <font class="keywordflow">catch</font> (EDebug &amp;e)
+00765 {
+00766 result += e.what();
+00767 }
+00768 <font class="preprocessor">#else</font>
+00769 <font class="preprocessor"></font> result += <font class="stringliteral">"No callstack available"</font>;
+00770 <font class="preprocessor">#endif</font>
+00771 <font class="preprocessor"></font>}
+00772
+00773
+00774 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a247">createDebug</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *logPath, <font class="keywordtype">bool</font> logInFile)
+00775 {
+00776 NL_ALLOC_CONTEXT (_Debug)
+00777
+00778 <font class="keyword">static</font> <font class="keywordtype">bool</font> alreadyCreate = <font class="keyword">false</font>;
+00779 <font class="keywordflow">if</font> (!alreadyCreate)
+00780 {
+00781 <font class="comment">// Debug Info for mutexes</font>
+00782 <font class="preprocessor">#ifdef MUTEX_DEBUG</font>
+00783 <font class="preprocessor"></font> initAcquireTimeMap();
+00784 <font class="preprocessor">#endif</font>
+00785 <font class="preprocessor"></font>
+00786 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00787 <font class="preprocessor"></font> <font class="comment">//if (!IsDebuggerPresent ())</font>
+00788 {
+00789 _set_se_translator(exceptionTranslator);
+00790 }
+00791 <font class="preprocessor">#endif // NL_OS_WINDOWS</font>
+00792 <font class="preprocessor"></font>
+00793
+00794 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a> = <font class="keyword">new</font> CLog (CLog::LOG_ERROR);
+00795 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a> = <font class="keyword">new</font> CLog (CLog::LOG_WARNING);
+00796 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a> = <font class="keyword">new</font> CLog (CLog::LOG_INFO);
+00797 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a> = <font class="keyword">new</font> CLog (CLog::LOG_DEBUG);
+00798 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a> = <font class="keyword">new</font> CLog (CLog::LOG_ASSERT);
+00799
+00800 <a class="code" href="namespaceNLMISC.html#a190">sd</a> = <font class="keyword">new</font> CStdDisplayer (<font class="stringliteral">"DEFAULT_SD"</font>);
+00801 <font class="keywordflow">if</font> (<a class="code" href="debug_8cpp.html#a4">TrapCrashInDebugger</a> || !<a class="code" href="displayer_8cpp.html#a0">IsDebuggerPresent</a> ())
+00802 {
+00803 <a class="code" href="namespaceNLMISC.html#a14">DefaultMsgBoxDisplayer</a> = <font class="keyword">new</font> CMsgBoxDisplayer (<font class="stringliteral">"DEFAULT_MBD"</font>);
+00804 }
+00805 <font class="preprocessor">#if LOG_IN_FILE</font>
+00806 <font class="preprocessor"></font> <font class="keywordflow">if</font> (logInFile)
+00807 {
+00808 string fn;
+00809 <font class="keywordflow">if</font> (logPath != NULL)
+00810 {
+00811 fn += logPath;
+00812 }
+00813 <font class="keywordflow">else</font>
+00814 {
+00815 <font class="comment">// log.log must always be accessed in creation current path directory</font>
+00816 <font class="keywordtype">char</font> tmpPath[1024];
+00817 fn += getcwd(tmpPath, 1024);
+00818 fn += <font class="stringliteral">"/"</font>;
+00819 }
+00820 fn += <font class="stringliteral">"log.log"</font>;
+00821 <a class="code" href="namespaceNLMISC.html#a191">fd</a> = <font class="keyword">new</font> CFileDisplayer (fn, <font class="keyword">false</font>, <font class="stringliteral">"DEFAULT_FD"</font>);
+00822 }
+00823 <font class="preprocessor">#endif // LOG_IN_FILE</font>
+00824 <font class="preprocessor"></font> <a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a> = <font class="keyword">new</font> CMemDisplayer (<font class="stringliteral">"DEFAULT_MD"</font>);
+00825
+00826 <a class="code" href="namespaceNLMISC.html#a293">initDebug2</a>(logInFile);
+00827
+00828 alreadyCreate = <font class="keyword">true</font>;
+00829 }
+00830 }
+00831
+00832
+00833
+00834
+00835 <font class="comment">//</font>
+00836 <font class="comment">// Commands</font>
+00837 <font class="comment">//</font>
+00838
+00839 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a> (displayMemlog, <font class="stringliteral">"displays the last N line of the log in memory"</font>, <font class="stringliteral">"[&lt;NbLines&gt;]"</font>)
+00840 {
+00841 uint nbLines;
+00842
+00843 <font class="keywordflow">if</font> (args.size() == 0) nbLines = 100;
+00844 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (args.size() == 1) nbLines = atoi(args[0].c_str());
+00845 <font class="keywordflow">else</font> <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00846
+00847 <font class="keywordflow">if</font> (<a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a> == NULL) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00848
+00849 deque&lt;string&gt;::const_iterator it;
+00850
+00851 <font class="keyword">const</font> deque&lt;string&gt; &amp;str = <a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CMemDisplayer.html#a4">lockStrings</a> ();
+00852
+00853 <font class="keywordflow">if</font> (nbLines &gt;= str.size())
+00854 it = str.begin();
+00855 <font class="keywordflow">else</font>
+00856 it = str.end() - nbLines;
+00857
+00858 <a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CMemDisplayer.html#a2">write</a> (&amp;log);
+00859
+00860 <a class="code" href="namespaceNLMISC.html#a13">DefaultMemDisplayer</a>-&gt;<a class="code" href="classNLMISC_1_1CMemDisplayer.html#a5">unlockStrings</a> ();
+00861
+00862 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00863 }
+00864
+00865
+00866 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(resetFilters, <font class="stringliteral">"disable all filters on Nel loggers"</font>, <font class="stringliteral">"[debug|info|warning|error|assert]"</font>)
+00867 {
+00868 <font class="keywordflow">if</font>(args.size() == 0)
+00869 {
+00870 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00871 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00872 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00873 <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00874 <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00875 }
+00876 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (args.size() == 1)
+00877 {
+00878 <font class="keywordflow">if</font> (args[0] == <font class="stringliteral">"debug"</font>) <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00879 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (args[0] == <font class="stringliteral">"info"</font>) <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00880 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (args[0] == <font class="stringliteral">"warning"</font>) <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00881 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (args[0] == <font class="stringliteral">"error"</font>) <a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00882 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (args[0] == <font class="stringliteral">"assert"</font>) <a class="code" href="namespaceNLMISC.html#a12">AssertLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a15">resetFilters</a>();
+00883 }
+00884 <font class="keywordflow">else</font>
+00885 {
+00886 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00887 }
+00888
+00889 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00890 }
+00891
+00892 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(addPositiveFilterDebug, <font class="stringliteral">"add a positive filter on DebugLog"</font>, <font class="stringliteral">"&lt;filterstr&gt;"</font>)
+00893 {
+00894 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00895 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a13">addPositiveFilter</a>( args[0].c_str() );
+00896 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00897 }
+00898
+00899 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(addNegativeFilterDebug, <font class="stringliteral">"add a negative filter on DebugLog"</font>, <font class="stringliteral">"&lt;filterstr&gt;"</font>)
+00900 {
+00901 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00902 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a14">addNegativeFilter</a>( args[0].c_str() );
+00903 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00904 }
+00905
+00906 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(removeFilterDebug, <font class="stringliteral">"remove a filter on DebugLog"</font>, <font class="stringliteral">"[&lt;filterstr&gt;]"</font>)
+00907 {
+00908 <font class="keywordflow">if</font>(args.size() == 0)
+00909 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a16">removeFilter</a>();
+00910 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(args.size() == 1)
+00911 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a16">removeFilter</a>( args[0].c_str() );
+00912 <font class="keywordflow">else</font> <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00913 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00914 }
+00915
+00916 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(displayFilterDebug, <font class="stringliteral">"display filter on DebugLog"</font>, <font class="stringliteral">""</font>)
+00917 {
+00918 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00919 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(log);
+00920 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00921 }
+00922
+00923 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(addPositiveFilterInfo, <font class="stringliteral">"add a positive filter on InfoLog"</font>, <font class="stringliteral">"&lt;filterstr&gt;"</font>)
+00924 {
+00925 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00926 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a13">addPositiveFilter</a>( args[0].c_str() );
+00927 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00928 }
+00929
+00930 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(addNegativeFilterInfo, <font class="stringliteral">"add a negative filter on InfoLog"</font>, <font class="stringliteral">"&lt;filterstr&gt;"</font>)
+00931 {
+00932 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00933 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a14">addNegativeFilter</a>( args[0].c_str() );
+00934 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00935 }
+00936
+00937 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(removeFilterInfo, <font class="stringliteral">"remove a filter on InfoLog"</font>, <font class="stringliteral">"[&lt;filterstr&gt;]"</font>)
+00938 {
+00939 <font class="keywordflow">if</font>(args.size() == 0)
+00940 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a16">removeFilter</a>();
+00941 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(args.size() == 1)
+00942 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a16">removeFilter</a>( args[0].c_str() );
+00943 <font class="keywordflow">else</font> <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00944 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00945 }
+00946
+00947 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(displayFilterInfo, <font class="stringliteral">"display filter on InfoLog"</font>, <font class="stringliteral">"[d|i|w|e]"</font>)
+00948 {
+00949 <font class="keywordflow">if</font>(args.size() &gt; 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00950 <font class="keywordflow">if</font> ( args.size() == 1 )
+00951 {
+00952 <font class="keywordflow">if</font> ( strcmp( args[0].c_str(), <font class="stringliteral">"d"</font> ) == 0 )
+00953 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(*<a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>);
+00954 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ( strcmp( args[0].c_str(), <font class="stringliteral">"i"</font> ) == 0 )
+00955 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(*<a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>);
+00956 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ( strcmp( args[0].c_str(), <font class="stringliteral">"w"</font> ) == 0 )
+00957 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(*<a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>);
+00958 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ( strcmp( args[0].c_str(), <font class="stringliteral">"e"</font> ) == 0 )
+00959 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(*<a class="code" href="namespaceNLMISC.html#a8">ErrorLog</a>);
+00960 <font class="keywordflow">else</font>
+00961 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00962 }
+00963 <font class="keywordflow">else</font>
+00964 {
+00965 <a class="code" href="namespaceNLMISC.html#a10">InfoLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(log);
+00966 }
+00967 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00968 }
+00969
+00970 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(addPositiveFilterWarning, <font class="stringliteral">"add a positive filter on WarningLog"</font>, <font class="stringliteral">"&lt;filterstr&gt;"</font>)
+00971 {
+00972 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00973 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a13">addPositiveFilter</a>( args[0].c_str() );
+00974 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00975 }
+00976
+00977 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(addNegativeFilterWarning, <font class="stringliteral">"add a negative filter on WarningLog"</font>, <font class="stringliteral">"&lt;filterstr&gt;"</font>)
+00978 {
+00979 <font class="keywordflow">if</font>(args.size() != 1) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00980 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a14">addNegativeFilter</a>( args[0].c_str() );
+00981 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00982 }
+00983
+00984 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(removeFilterWarning, <font class="stringliteral">"remove a filter on WarningLog"</font>, <font class="stringliteral">"[&lt;filterstr&gt;]"</font>)
+00985 {
+00986 <font class="keywordflow">if</font>(args.size() == 0)
+00987 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a16">removeFilter</a>();
+00988 <font class="keywordflow">else</font> <font class="keywordflow">if</font>(args.size() == 1)
+00989 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a16">removeFilter</a>( args[0].c_str() );
+00990 <font class="keywordflow">else</font> <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00991 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00992 }
+00993
+00994 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(displayFilterWarning, <font class="stringliteral">"display filter on WarningLog"</font>, <font class="stringliteral">""</font>)
+00995 {
+00996 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00997 <a class="code" href="namespaceNLMISC.html#a9">WarningLog</a>-&gt;<a class="code" href="classNLMISC_1_1CLog.html#a17">displayFilter</a>(log);
+00998 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00999 }
+01000
+01001 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(<a class="code" href="debug_8h.html#a15">assert</a>, <font class="stringliteral">"generate a failed assert"</font>, <font class="stringliteral">""</font>)
+01002 {
+01003 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01004 <a class="code" href="debug_8h.html#a8">nlassertex</a> (<font class="keyword">false</font>, (<font class="stringliteral">"Assert generated by the assert command"</font>));
+01005 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01006 }
+01007
+01008 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(stop, <font class="stringliteral">"generate a stop"</font>, <font class="stringliteral">""</font>)
+01009 {
+01010 <font class="keywordflow">if</font>(args.size() != 0) <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01011 <a class="code" href="debug_8h.html#a14">nlstopex</a> ((<font class="stringliteral">"Stop generated by the stop command"</font>));
+01012 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01013 }
+01014
+01015 } <font class="comment">// NLMISC</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>