aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/common_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/common_8cpp-source.html670
1 files changed, 670 insertions, 0 deletions
diff --git a/docs/doxygen/nel/common_8cpp-source.html b/docs/doxygen/nel/common_8cpp-source.html
new file mode 100644
index 00000000..e85b663b
--- /dev/null
+++ b/docs/doxygen/nel/common_8cpp-source.html
@@ -0,0 +1,670 @@
+<!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>common.cpp</h1><a href="common_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 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">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font>
+00027
+00028 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00029 <font class="preprocessor"></font><font class="preprocessor">#include &lt;windows.h&gt;</font>
+00030 <font class="preprocessor">#elif defined NL_OS_UNIX</font>
+00031 <font class="preprocessor"></font><font class="preprocessor">#include &lt;<a class="code" href="unistd_8h.html">unistd.h</a>&gt;</font>
+00032 <font class="preprocessor">#include &lt;string.h&gt;</font>
+00033 <font class="preprocessor">#include &lt;errno.h&gt;</font>
+00034 <font class="preprocessor">#endif</font>
+00035 <font class="preprocessor"></font>
+00036 <font class="preprocessor">#include "<a class="code" href="command_8h.html">nel/misc/command.h</a>"</font>
+00037
+00038 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00039
+00040 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00041 <font class="preprocessor"></font><font class="preprocessor"># ifdef __STL_DEBUG</font>
+00042 <font class="preprocessor"></font><font class="preprocessor"># define STL_MODE "debug"</font>
+00043 <font class="preprocessor"></font><font class="preprocessor"># else</font>
+00044 <font class="preprocessor"></font><font class="preprocessor"># define STL_MODE "normal"</font>
+00045 <font class="preprocessor"></font><font class="preprocessor"># endif // __STL_DEBUG</font>
+00046 <font class="preprocessor"></font><font class="preprocessor"># if(__SGI_STL_PORT &lt; 0x400)</font>
+00047 <font class="preprocessor"></font><font class="preprocessor"># define STL_STR_VER "&lt; 4.0"</font>
+00048 <font class="preprocessor"></font><font class="preprocessor"># elif(__SGI_STL_PORT == 0x400)</font>
+00049 <font class="preprocessor"></font><font class="preprocessor"># define STL_STR_VER "4.0"</font>
+00050 <font class="preprocessor"></font><font class="preprocessor"># elif(__SGI_STL_PORT == 0x450)</font>
+00051 <font class="preprocessor"></font><font class="preprocessor"># define STL_STR_VER "4.5"</font>
+00052 <font class="preprocessor"></font><font class="preprocessor"># elif(__SGI_STL_PORT &gt; 0x450)</font>
+00053 <font class="preprocessor"></font><font class="preprocessor"># define STL_STR_VER "&gt; 4.5"</font>
+00054 <font class="preprocessor"></font><font class="preprocessor"># endif // __SGI_STL_PORT</font>
+00055 <font class="preprocessor"></font><font class="preprocessor"># pragma message("Using STLport version "STL_STR_VER" in "STL_MODE" mode")</font>
+00056 <font class="preprocessor"></font><font class="preprocessor">#endif // NL_OS_WINDOWS</font>
+00057 <font class="preprocessor"></font>
+00058 <font class="keyword">namespace </font>NLMISC
+00059 {
+00060
+00061 <font class="comment">/*</font>
+00062 <font class="comment"> * Portable Sleep() function that suspends the execution of the calling thread for a number of milliseconds.</font>
+00063 <font class="comment"> * Note: the resolution of the timer is system-dependant and may be more than 1 millisecond.</font>
+00064 <font class="comment"> */</font>
+00065 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a236">nlSleep</a>( uint32 ms )
+00066 {
+00067 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00068 <font class="preprocessor"></font>
+00070 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00071 <font class="preprocessor"></font> ms = max(ms, (uint32)1);
+00072 <font class="preprocessor">#endif</font>
+00073 <font class="preprocessor"></font>
+00074 Sleep( ms );
+00075
+00076 <font class="preprocessor">#elif defined NL_OS_UNIX</font>
+00077 <font class="preprocessor"></font> usleep( ms*1000 );
+00078 <font class="preprocessor">#endif</font>
+00079 <font class="preprocessor"></font>}
+00080
+00081
+00082 <font class="comment">/*</font>
+00083 <font class="comment"> * Returns Thread Id (note: on Linux, Process Id is the same as the Thread Id)</font>
+00084 <font class="comment"> */</font>
+00085 uint <a class="code" href="namespaceNLMISC.html#a237">getThreadId</a>()
+00086 {
+00087 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00088 <font class="preprocessor"></font> <font class="keywordflow">return</font> GetCurrentThreadId();
+00089 <font class="preprocessor">#elif defined NL_OS_UNIX</font>
+00090 <font class="preprocessor"></font> <font class="keywordflow">return</font> getpid();
+00091 <font class="preprocessor">#endif</font>
+00092 <font class="preprocessor"></font>
+00093 }
+00094
+00095
+00096 <font class="comment">/*</font>
+00097 <font class="comment"> * Returns a readable string from a vector of bytes. '\0' are replaced by ' '</font>
+00098 <font class="comment"> */</font>
+00099 string <a class="code" href="namespaceNLMISC.html#a238">stringFromVector</a>( <font class="keyword">const</font> vector&lt;uint8&gt;&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>, <font class="keywordtype">bool</font> limited )
+00100 {
+00101 string <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>;
+00102
+00103 <font class="keywordflow">if</font> (!<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.empty())
+00104 {
+00105 <font class="keywordtype">int</font> size = <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.size ();
+00106 <font class="keywordflow">if</font> (limited &amp;&amp; size &gt; 1000)
+00107 {
+00108 string middle = <font class="stringliteral">"...&lt;buf too big,skip middle part&gt;..."</font>;
+00109 <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.resize (1000 + middle.size());
+00110 memcpy (&amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.begin(), &amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.begin(), 500);
+00111 memcpy (&amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.begin()+500, &amp;*middle.begin(), middle.size());
+00112 memcpy (&amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.begin()+500+middle.size(), &amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.begin()+size-500, 500);
+00113 }
+00114 <font class="keywordflow">else</font>
+00115 {
+00116 <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.resize (size);
+00117 memcpy( &amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.begin(), &amp;*<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.begin(), <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>.size() );
+00118 }
+00119
+00120 <font class="comment">// Replace '\0' characters</font>
+00121 string::iterator is;
+00122 <font class="keywordflow">for</font> ( is=<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.begin(); is!=<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.end(); ++is )
+00123 {
+00124 <font class="comment">// remplace non printable char and % with '?' chat</font>
+00125 <font class="keywordflow">if</font> ( ! isprint((uint8)(*is)) || (*is) == <font class="charliteral">'%'</font>)
+00126 {
+00127 (*is) = <font class="charliteral">'?'</font>;
+00128 }
+00129 }
+00130 }
+00131 <font class="comment">/*</font>
+00132 <font class="comment"> if ( ! v.empty() )</font>
+00133 <font class="comment"> {</font>
+00134 <font class="comment"> // Copy contents</font>
+00135 <font class="comment"> s.resize( v.size() );</font>
+00136 <font class="comment"> memcpy( &amp;*s.begin(), &amp;*v.begin(), v.size() );</font>
+00137 <font class="comment"></font>
+00138 <font class="comment"> // Replace '\0' characters</font>
+00139 <font class="comment"> string::iterator is;</font>
+00140 <font class="comment"> for ( is=s.begin(); is!=s.end(); ++is )</font>
+00141 <font class="comment"> {</font>
+00142 <font class="comment"> // remplace non printable char and % with '?' chat</font>
+00143 <font class="comment"> if ( ! isprint((*is)) || (*is) == '%')</font>
+00144 <font class="comment"> {</font>
+00145 <font class="comment"> (*is) = '?';</font>
+00146 <font class="comment"> }</font>
+00147 <font class="comment"> }</font>
+00148 <font class="comment"> }</font>
+00149 <font class="comment">*/</font> <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>;
+00150 }
+00151
+00152
+00153 sint <a class="code" href="namespaceNLMISC.html#a211">smprintf</a>( <font class="keywordtype">char</font> *buffer, size_t count, <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ... )
+00154 {
+00155 sint ret;
+00156
+00157 va_list args;
+00158 va_start( args, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a> );
+00159 ret = vsnprintf( buffer, count, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, args );
+00160 <font class="keywordflow">if</font> ( ret == -1 )
+00161 {
+00162 buffer[count-1] = <font class="charliteral">'\0'</font>;
+00163 }
+00164 va_end( args );
+00165
+00166 <font class="keywordflow">return</font>( ret );
+00167 }
+00168
+00169
+00170 sint64 <a class="code" href="namespaceNLMISC.html#a239">atoiInt64</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *ident, sint64 base)
+00171 {
+00172 sint64 number = 0;
+00173 <font class="keywordtype">bool</font> neg = <font class="keyword">false</font>;
+00174
+00175 <font class="comment">// NULL string</font>
+00176 <a class="code" href="debug_8h.html#a6">nlassert</a> (ident != NULL);
+00177
+00178 <font class="comment">// empty string</font>
+00179 <font class="keywordflow">if</font> (*ident == <font class="charliteral">'\0'</font>) <font class="keywordflow">goto</font> end;
+00180
+00181 <font class="comment">// + sign</font>
+00182 <font class="keywordflow">if</font> (*ident == <font class="charliteral">'+'</font>) ident++;
+00183
+00184 <font class="comment">// - sign</font>
+00185 <font class="keywordflow">if</font> (*ident == <font class="charliteral">'-'</font>) { neg = <font class="keyword">true</font>; ident++; }
+00186
+00187 <font class="keywordflow">while</font> (*ident != <font class="charliteral">'\0'</font>)
+00188 {
+00189 <font class="keywordflow">if</font> (isdigit(*ident))
+00190 {
+00191 number *= base;
+00192 number += (*ident)-<font class="charliteral">'0'</font>;
+00193 }
+00194 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (base &gt; 10 &amp;&amp; islower(*ident))
+00195 {
+00196 number *= base;
+00197 number += (*ident)-<font class="charliteral">'a'</font>+10;
+00198 }
+00199 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (base &gt; 10 &amp;&amp; isupper(*ident))
+00200 {
+00201 number *= base;
+00202 number += (*ident)-<font class="charliteral">'A'</font>+10;
+00203 }
+00204 <font class="keywordflow">else</font>
+00205 {
+00206 <font class="keywordflow">goto</font> end;
+00207 }
+00208 ident++;
+00209 }
+00210 end:
+00211 <font class="keywordflow">if</font> (neg) number = -number;
+00212 <font class="keywordflow">return</font> number;
+00213
+00215 <font class="comment">/* uint64 k = 0;</font>
+00216 <font class="comment"></font>
+00217 <font class="comment"> while (*ident != '\0')</font>
+00218 <font class="comment"> {</font>
+00219 <font class="comment"> switch(*(ident++))</font>
+00220 <font class="comment"> {</font>
+00221 <font class="comment"> case '0':</font>
+00222 <font class="comment"> k +=0;</font>
+00223 <font class="comment"> break;</font>
+00224 <font class="comment"> case '1':</font>
+00225 <font class="comment"> k +=1;</font>
+00226 <font class="comment"> break;</font>
+00227 <font class="comment"> case '2':</font>
+00228 <font class="comment"> k +=2;</font>
+00229 <font class="comment"> break;</font>
+00230 <font class="comment"> case '3':</font>
+00231 <font class="comment"> k +=3;</font>
+00232 <font class="comment"> break;</font>
+00233 <font class="comment"> case '4':</font>
+00234 <font class="comment"> k +=4;</font>
+00235 <font class="comment"> break;</font>
+00236 <font class="comment"> case '5':</font>
+00237 <font class="comment"> k +=5;</font>
+00238 <font class="comment"> break;</font>
+00239 <font class="comment"> case '6':</font>
+00240 <font class="comment"> k +=6;</font>
+00241 <font class="comment"> break;</font>
+00242 <font class="comment"> case '7':</font>
+00243 <font class="comment"> k +=7;</font>
+00244 <font class="comment"> break;</font>
+00245 <font class="comment"> case '8':</font>
+00246 <font class="comment"> k +=8;</font>
+00247 <font class="comment"> break;</font>
+00248 <font class="comment"> case '9':</font>
+00249 <font class="comment"> k +=9;</font>
+00250 <font class="comment"> break;</font>
+00251 <font class="comment"> case 'a':</font>
+00252 <font class="comment"> k +=10;</font>
+00253 <font class="comment"> break;</font>
+00254 <font class="comment"> case 'b':</font>
+00255 <font class="comment"> k +=11;</font>
+00256 <font class="comment"> break;</font>
+00257 <font class="comment"> case 'c':</font>
+00258 <font class="comment"> k +=12;</font>
+00259 <font class="comment"> break;</font>
+00260 <font class="comment"> case 'd':</font>
+00261 <font class="comment"> k +=13;</font>
+00262 <font class="comment"> break;</font>
+00263 <font class="comment"> case 'e':</font>
+00264 <font class="comment"> k +=14;</font>
+00265 <font class="comment"> break;</font>
+00266 <font class="comment"> case 'f':</font>
+00267 <font class="comment"> k +=15;</font>
+00268 <font class="comment"> break;</font>
+00269 <font class="comment"></font>
+00270 <font class="comment"> case 'A':</font>
+00271 <font class="comment"> k +=10;</font>
+00272 <font class="comment"> break;</font>
+00273 <font class="comment"> case 'B':</font>
+00274 <font class="comment"> k +=11;</font>
+00275 <font class="comment"> break;</font>
+00276 <font class="comment"> case 'C':</font>
+00277 <font class="comment"> k +=12;</font>
+00278 <font class="comment"> break;</font>
+00279 <font class="comment"> case 'D':</font>
+00280 <font class="comment"> k +=13;</font>
+00281 <font class="comment"> break;</font>
+00282 <font class="comment"> case 'E':</font>
+00283 <font class="comment"> k +=14;</font>
+00284 <font class="comment"> break;</font>
+00285 <font class="comment"> case 'F':</font>
+00286 <font class="comment"> k +=15;</font>
+00287 <font class="comment"> break;</font>
+00288 <font class="comment"></font>
+00289 <font class="comment"> case 0:</font>
+00290 <font class="comment"> return k;</font>
+00291 <font class="comment"> break;</font>
+00292 <font class="comment"> }</font>
+00293 <font class="comment"> if(*ident != 0) k *= base;</font>
+00294 <font class="comment"> }</font>
+00295 <font class="comment"></font>
+00296 <font class="comment"> return k;</font>
+00297 <font class="comment">*/</font>
+00298 }
+00299
+00300 <font class="keywordtype">void</font> <a class="code" href="namespaceNLMISC.html#a240">itoaInt64</a> (sint64 number, <font class="keywordtype">char</font> *str, sint64 base)
+00301 {
+00302 str[0] = <font class="charliteral">'\0'</font>;
+00303 <font class="keywordtype">char</font> b[256];
+00304 <font class="keywordflow">if</font>(!number)
+00305 {
+00306 str[0] = <font class="charliteral">'0'</font>;
+00307 str[1] = <font class="charliteral">'\0'</font>;
+00308 <font class="keywordflow">return</font>;
+00309 }
+00310 memset(b,<font class="charliteral">'\0'</font>,255);
+00311 memset(b,<font class="charliteral">'0'</font>,64);
+00312 sint n;
+00313 sint64 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = number;
+00314 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &lt; 0) <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = -<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
+00315 <font class="keywordtype">char</font> baseTable[] = <font class="stringliteral">"0123456789abcdefghijklmnopqrstuvwyz"</font>;
+00316 <font class="keywordflow">for</font>(n = 0; n &lt; 64; n ++)
+00317 {
+00318 sint <a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a> = (sint)(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> % base);
+00319 b[64 - n] = baseTable[<a class="code" href="driver__opengl__extension__def_8h.html#a410">num</a>];
+00320 <font class="keywordflow">if</font>(!<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)
+00321 {
+00322 <font class="keywordtype">int</font> k;
+00323 <font class="keywordtype">int</font> j = 0;
+00324
+00325 <font class="keywordflow">if</font> (number &lt; 0)
+00326 {
+00327 str[j++] = <font class="charliteral">'-'</font>;
+00328 }
+00329
+00330 <font class="keywordflow">for</font>(k = 64 - n + 1; k &lt;= 64; k++)
+00331 {
+00332 str[j ++] = b[k];
+00333 }
+00334 str[j] = <font class="charliteral">'\0'</font>;
+00335 <font class="keywordflow">break</font>;
+00336 }
+00337 <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> /= base;
+00338 }
+00339 }
+00340
+00341 uint <a class="code" href="namespaceNLMISC.html#a223">raiseToNextPowerOf2</a>(uint <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
+00342 {
+00343 uint <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>=1;
+00344 <font class="keywordflow">while</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>&lt;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
+00345 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>&lt;&lt;=1;
+00346
+00347 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00348 }
+00349
+00350 uint <a class="code" href="namespaceNLMISC.html#a224">getPowerOf2</a>(uint <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
+00351 {
+00352 uint <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>=1;
+00353 uint ret=0;
+00354 <font class="keywordflow">while</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>&lt;<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
+00355 {
+00356 ret++;
+00357 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>&lt;&lt;=1;
+00358 }
+00359
+00360 <font class="keywordflow">return</font> ret;
+00361 }
+00362
+00363 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLMISC.html#a225">isPowerOf2</a>(sint32 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>)
+00364 {
+00365 <font class="keywordflow">while</font>(v)
+00366 {
+00367 <font class="keywordflow">if</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>&amp;1)
+00368 {
+00369 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>&gt;&gt;=1;
+00370 <font class="keywordflow">if</font>(v)
+00371 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00372 }
+00373 <font class="keywordflow">else</font>
+00374 <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>&gt;&gt;=1;
+00375 }
+00376
+00377 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00378 }
+00379
+00380 string <a class="code" href="namespaceNLMISC.html#a241">bytesToHumanReadable</a> (uint32 bytes)
+00381 {
+00382 <font class="keyword">static</font> <font class="keywordtype">char</font> *divTable[]= { <font class="stringliteral">"b"</font>, <font class="stringliteral">"kb"</font>, <font class="stringliteral">"mb"</font>, <font class="stringliteral">"gb"</font>, <font class="stringliteral">"tb"</font> };
+00383 uint div = 0;
+00384 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = (float)bytes;
+00385 <font class="keywordtype">float</font> newres = <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00386 <font class="keywordflow">while</font> (true)
+00387 {
+00388 newres /= 1024;
+00389 <font class="keywordflow">if</font>(newres &lt; 1.0f || div &gt; 4)
+00390 <font class="keywordflow">break</font>;
+00391 div++;
+00392 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = newres;
+00393 }
+00394 <font class="keywordtype">int</font> ires = (int) <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00395 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>-(float)ires &lt; .01f)
+00396 <font class="keywordflow">return</font> <a class="code" href="namespaceNLMISC.html#a243">toString</a> (<font class="stringliteral">"%.0f%s"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, divTable[div]);
+00397 <font class="keywordflow">else</font>
+00398 <font class="keywordflow">return</font> <a class="code" href="namespaceNLMISC.html#a243">toString</a> (<font class="stringliteral">"%.2f%s"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>, divTable[div]);
+00399 }
+00400
+00401 <a class="code" href="namespaceNLMISC.html#a288">NLMISC_COMMAND</a>(bthr, <font class="stringliteral">"Convert a bytes number into an human readable"</font>, <font class="stringliteral">"&lt;int&gt;"</font>)
+00402 {
+00403 <font class="keywordflow">if</font> (args.size() != 1)
+00404 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00405
+00406 log.displayNL(<font class="stringliteral">"%d -&gt; %s"</font>, atoi(args[0].c_str()), <a class="code" href="namespaceNLMISC.html#a241">bytesToHumanReadable</a>(atoi(args[0].c_str())).c_str());
+00407
+00408 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00409 }
+00410
+00411 std::string <a class="code" href="namespaceNLMISC.html#a229">strlwr</a> ( <font class="keyword">const</font> std::string &amp;str )
+00412 {
+00413 string <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00414 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>.reserve (str.size());
+00415 <font class="keywordflow">for</font> (uint i=0; i&lt;str.size(); i++)
+00416 {
+00417 <font class="keywordflow">if</font> ( (str[i] &gt;= <font class="charliteral">'A'</font>) &amp;&amp; (str[i] &lt;= <font class="charliteral">'Z'</font>) )
+00418 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> += str[i] - <font class="charliteral">'A'</font> + <font class="charliteral">'a'</font>;
+00419 <font class="keywordflow">else</font>
+00420 <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> += str[i];
+00421 }
+00422
+00423 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
+00424 }
+00425
+00426 std::string &amp;<a class="code" href="namespaceNLMISC.html#a229">strlwr</a> ( std::string &amp;str )
+00427 {
+00428 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=str.size()-1; i&gt;=0; i--)
+00429 {
+00430 <font class="keywordflow">if</font> ( (str[i] &gt;= <font class="charliteral">'A'</font>) &amp;&amp; (str[i] &lt;= <font class="charliteral">'Z'</font>) )
+00431 {
+00432 str[i] = str[i] - <font class="charliteral">'A'</font> + <font class="charliteral">'a'</font>;
+00433 }
+00434 }
+00435
+00436 <font class="keywordflow">return</font> (str);
+00437 }
+00438
+00439 <font class="keywordtype">char</font> *<a class="code" href="namespaceNLMISC.html#a229">strlwr</a> ( <font class="keywordtype">char</font> *str )
+00440 {
+00441 <font class="keywordflow">if</font> (str == NULL)
+00442 <font class="keywordflow">return</font> (NULL);
+00443
+00444 <font class="keywordflow">while</font> (*str != <font class="charliteral">'\0'</font>)
+00445 {
+00446 <font class="keywordflow">if</font> ( (*str &gt;= <font class="charliteral">'A'</font>) &amp;&amp; (*str &lt;= <font class="charliteral">'Z'</font>) )
+00447 {
+00448 *str = *str - <font class="charliteral">'A'</font> + <font class="charliteral">'a'</font>;
+00449 }
+00450 str++;
+00451 }
+00452
+00453 <font class="keywordflow">return</font> (str);
+00454 }
+00455
+00456 std::string &amp;<a class="code" href="namespaceNLMISC.html#a232">strupr</a> ( std::string &amp;str )
+00457 {
+00458 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i=str.size()-1; i&gt;=0; i--)
+00459 {
+00460 <font class="keywordflow">if</font> ( (str[i] &gt;= <font class="charliteral">'a'</font>) &amp;&amp; (str[i] &lt;= <font class="charliteral">'z'</font>) )
+00461 {
+00462 str[i] = str[i] - <font class="charliteral">'a'</font> + <font class="charliteral">'A'</font>;
+00463 }
+00464 }
+00465
+00466 <font class="keywordflow">return</font> (str);
+00467 }
+00468
+00469 <font class="keywordtype">char</font> *<a class="code" href="namespaceNLMISC.html#a232">strupr</a> ( <font class="keywordtype">char</font> *str )
+00470 {
+00471 <font class="keywordflow">if</font> (str == NULL)
+00472 <font class="keywordflow">return</font> (NULL);
+00473
+00474 <font class="keywordflow">while</font> (*str != <font class="charliteral">'\0'</font>)
+00475 {
+00476 <font class="keywordflow">if</font> ( (*str &gt;= <font class="charliteral">'a'</font>) &amp;&amp; (*str &lt;= <font class="charliteral">'z'</font>) )
+00477 {
+00478 *str = *str - <font class="charliteral">'a'</font> + <font class="charliteral">'A'</font>;
+00479 }
+00480 str++;
+00481 }
+00482
+00483 <font class="keywordflow">return</font> (str);
+00484 }
+00485
+00486 sint <a class="code" href="namespaceNLMISC.html#a234">nlstricmp</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *lhs,<font class="keyword">const</font> <font class="keywordtype">char</font> *rhs)
+00487 {
+00488 <a class="code" href="debug_8h.html#a6">nlassert</a>(lhs);
+00489 <a class="code" href="debug_8h.html#a6">nlassert</a>(rhs);
+00490 uint lchar, rchar;
+00491 <font class="keywordflow">while</font> (*lhs != <font class="charliteral">'\0'</font> &amp;&amp; *rhs != <font class="charliteral">'\0'</font>)
+00492 {
+00493 lchar = ::toupper(*lhs);
+00494 rchar = ::toupper(*rhs);
+00495 <font class="keywordflow">if</font> (lchar != rchar) <font class="keywordflow">return</font> lchar - rchar;
+00496 ++lhs;
+00497 ++rhs;
+00498 }
+00499 <font class="keywordflow">if</font> (*lhs != 0) <font class="keywordflow">return</font> 1;
+00500 <font class="keywordflow">if</font> (*rhs != 0) <font class="keywordflow">return</font> -1;
+00501 <font class="keywordflow">return</font> 0;
+00502 }
+00503
+00504 sint <a class="code" href="namespaceNLMISC.html#a234">nlstricmp</a>(<font class="keyword">const</font> std::string &amp;lhs,<font class="keyword">const</font> std::string &amp;rhs)
+00505 {
+00506 <font class="keywordflow">return</font> <a class="code" href="namespaceNLMISC.html#a234">nlstricmp</a>(lhs.c_str(), rhs.c_str());
+00507 }
+00508
+00509
+00510
+00511 <font class="comment">//</font>
+00512 <font class="comment">// Exceptions</font>
+00513 <font class="comment">//</font>
+00514
+<a name="l00515"></a><a class="code" href="classNLMISC_1_1Exception.html#a0">00515</a> Exception::Exception() : _Reason("Unknown Exception")
+00516 {
+00517 <font class="comment">// nlinfo("Exception will be launched: %s", _Reason.c_str());</font>
+00518 }
+00519
+<a name="l00520"></a><a class="code" href="classNLMISC_1_1Exception.html#a1">00520</a> Exception::Exception(<font class="keyword">const</font> std::string &amp;reason) : _Reason(reason)
+00521 {
+00522 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Exception will be launched: %s"</font>, <a class="code" href="classNLMISC_1_1Exception.html#n0">_Reason</a>.c_str());
+00523 }
+00524
+<a name="l00525"></a><a class="code" href="classNLMISC_1_1Exception.html#a2">00525</a> Exception::Exception(<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, ...)
+00526 {
+00527 <a class="code" href="common_8h.html#a0">NLMISC_CONVERT_VARGS</a> (<a class="code" href="classNLMISC_1_1Exception.html#n0">_Reason</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a398">format</a>, NLMISC::MaxCStringSize);
+00528 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Exception will be launched: %s"</font>, <a class="code" href="classNLMISC_1_1Exception.html#n0">_Reason</a>.c_str());
+00529 }
+00530
+<a name="l00531"></a><a class="code" href="classNLMISC_1_1Exception.html#a4">00531</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *Exception::what() <font class="keyword">const</font> <font class="keywordflow">throw</font>()
+00532 {
+00533 <font class="keywordflow">return</font> _Reason.c_str();
+00534 }
+00535
+00536 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLMISC.html#a242">launchProgram</a> (<font class="keyword">const</font> std::string &amp;programName, <font class="keyword">const</font> std::string &amp;arguments)
+00537 {
+00538
+00539 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00540 <font class="preprocessor"></font>
+00541 SECURITY_ATTRIBUTES sa;
+00542 sa.nLength = <font class="keyword">sizeof</font> (sa);
+00543 sa.lpSecurityDescriptor = NULL;
+00544 sa.bInheritHandle = FALSE;
+00545
+00546 STARTUPINFO si;
+00547 si.cb = <font class="keyword">sizeof</font> (si);
+00548 si.lpReserved = NULL;
+00549 si.lpDesktop = NULL;
+00550 si.lpTitle = NULL;
+00551 si.dwFlags = STARTF_USESHOWWINDOW;
+00552 si.cbReserved2 = 0;
+00553 si.wShowWindow = SW_MINIMIZE;
+00554 si.lpReserved2 = NULL;
+00555
+00556 PROCESS_INFORMATION pi;
+00557
+00558 BOOL <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = CreateProcess(programName.c_str(), (<font class="keywordtype">char</font>*)arguments.c_str(), &amp;sa, &amp;sa, FALSE, 0, NULL, NULL, &amp;si, &amp;pi);
+00559
+00560 <font class="keywordflow">if</font> (res)
+00561 {
+00562 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"Successful launch '%s' with arg '%s'"</font>, programName.c_str(), arguments.c_str());
+00563 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00564 }
+00565 <font class="keywordflow">else</font>
+00566 {
+00567 LPVOID lpMsgBuf;
+00568 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &amp;lpMsgBuf, 0, NULL);
+00569 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Failed launched '%s' with arg '%s' err %d: '%s'"</font>, programName.c_str(), arguments.c_str(), GetLastError (), lpMsgBuf);
+00570 LocalFree(lpMsgBuf);
+00571 }
+00572
+00573 <font class="preprocessor">#elif defined(NL_OS_UNIX)</font>
+00574 <font class="preprocessor"></font>
+00575 <font class="keywordtype">int</font> status = vfork ();
+00576 <font class="keywordflow">if</font> (status == -1)
+00577 {
+00578 <font class="keywordtype">char</font> *err = strerror (errno);
+00579 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Failed launched '%s' with arg '%s' err %d: '%s'"</font>, programName.c_str(), arguments.c_str(), errno, err);
+00580 }
+00581 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (status == 0)
+00582 {
+00583 status = execlp(programName.c_str(), programName.c_str(), arguments.c_str(), 0);
+00584 <font class="keywordflow">if</font> (status == -1)
+00585 {
+00586 perror(<font class="stringliteral">"Failed launched"</font>);
+00587 _exit(EXIT_FAILURE);
+00588 }
+00589 }
+00590 <font class="keywordflow">else</font>
+00591 {
+00592 <a class="code" href="debug_8h.html#a0">nldebug</a>(<font class="stringliteral">"Successful launch '%s' with arg '%s'"</font>, programName.c_str(), arguments.c_str());
+00593 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00594 }
+00595 <font class="preprocessor">#else</font>
+00596 <font class="preprocessor"></font> <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"launchProgram() not implemented"</font>);
+00597 <font class="preprocessor">#endif</font>
+00598 <font class="preprocessor"></font>
+00599 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00600
+00601 }
+00602
+00603 } <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>