diff options
Diffstat (limited to 'docs/doxygen/nel/eval__num__expr_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/eval__num__expr_8cpp-source.html | 1388 |
1 files changed, 1388 insertions, 0 deletions
diff --git a/docs/doxygen/nel/eval__num__expr_8cpp-source.html b/docs/doxygen/nel/eval__num__expr_8cpp-source.html new file mode 100644 index 00000000..d84d6662 --- /dev/null +++ b/docs/doxygen/nel/eval__num__expr_8cpp-source.html @@ -0,0 +1,1388 @@ +<!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> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </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> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </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> + + +<!-- 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> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <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> </center> +<hr><h1>eval_num_expr.cpp</h1><a href="eval__num__expr_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000, 2001 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NeL Network Services.</font> +00010 <font class="comment"> * NEVRAX NeL Network Services 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 Network Services 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 Network Services; 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">#include "<a class="code" href="eval__num__expr_8h.html">nel/misc/eval_num_expr.h</a>"</font> +00029 +00030 <font class="keyword">namespace </font>NLMISC +00031 { +00032 +00033 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00034 +00035 <font class="comment">// ***************************************************************************</font> +00036 +<a name="l00037"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c0">00037</a> CEvalNumExpr::TReturnState CEvalNumExpr::readDecimal (<font class="keywordtype">double</font> &<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>) +00038 { +00039 <font class="comment">// Read first integer value</font> +00040 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c1">readIntegerNumberDecimal</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>); +00041 +00042 <font class="comment">// Dot ?</font> +00043 <font class="keywordtype">char</font> currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00044 <font class="keywordflow">if</font> (currentChar == <font class="charliteral">'.'</font>) +00045 { +00046 <font class="comment">// Next char</font> +00047 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00048 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00049 <font class="keywordflow">if</font> (currentChar < '0' || currentChar > <font class="charliteral">'9'</font>) +00050 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s5">NumberSyntaxError</a>; +00051 +00052 <font class="comment">// Read the decimal part</font> +00053 <font class="keyword">const</font> <font class="keywordtype">char</font> *start = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00054 <font class="keywordtype">double</font> fract; +00055 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c1">readIntegerNumberDecimal</a> (fract); +00056 fract /= (double)pow (10 ,(<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>-start)); +00057 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> += fract; +00058 } +00059 +00060 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00061 } +00062 +00063 <font class="comment">// ***************************************************************************</font> +00064 +<a name="l00065"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c1">00065</a> <font class="keywordtype">void</font> CEvalNumExpr::readIntegerNumberDecimal (<font class="keywordtype">double</font> &<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>) +00066 { +00067 <font class="comment">// Registered values</font> +00068 <font class="keyword">register</font> <font class="keywordtype">double</font> regValue = 0; +00069 +00070 <font class="comment">// Read the first value</font> +00071 <font class="keywordtype">char</font> currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00072 <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'0'</font>) && (currentChar <= <font class="charliteral">'9'</font>)) +00073 { +00074 regValue += (currentChar - <font class="charliteral">'0'</font>); +00075 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00076 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00077 +00078 <font class="comment">// For each values</font> +00079 <font class="keywordflow">while</font> ((currentChar >= <font class="charliteral">'0'</font>) && (currentChar <= <font class="charliteral">'9'</font>)) +00080 { +00081 regValue *= 10; +00082 regValue += (currentChar - <font class="charliteral">'0'</font>); +00083 +00084 <font class="comment">// Next char</font> +00085 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00086 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00087 } +00088 } +00089 +00090 <font class="comment">// Store value</font> +00091 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = regValue; +00092 } +00093 +00094 <font class="comment">// ***************************************************************************</font> +00095 +<a name="l00096"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">00096</a> CEvalNumExpr::TReturnState CEvalNumExpr::getNextToken (TToken &token) +00097 { +00098 <font class="comment">// Get the current char</font> +00099 uint8 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00100 +00101 <font class="comment">// Skip space</font> +00102 <font class="keywordflow">while</font> ((currentChar!=0) && (currentChar<=0x20)) +00103 { +00104 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00105 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00106 } +00107 +00108 <font class="comment">// Can be an operator ?</font> +00109 <font class="keywordflow">if</font> (currentChar <= 128) +00110 { +00111 <font class="comment">// Get the operator</font> +00112 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r2">_OperatorArray</a>[currentChar]; +00113 +00114 <font class="comment">// Is an operator ?</font> +00115 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u33">NotOperator</a>) +00116 { +00117 <font class="comment">// It is an operator</font> +00118 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u4">Operator</a>; +00119 +00120 <font class="comment">// Is a 2 characters operator ?</font> +00121 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u34">ExtOperator</a>) +00122 { +00123 <font class="comment">// Return next character</font> +00124 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00125 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00126 } +00127 <font class="keywordflow">else</font> +00128 { +00129 <font class="comment">// Have a second character ?</font> +00130 <font class="keywordtype">char</font> secondChar = *(<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+1); +00131 +00132 <font class="comment">// What kind of 1st character</font> +00133 <font class="keywordflow">switch</font> (currentChar) +00134 { +00135 <font class="keywordflow">case</font> <font class="charliteral">'!'</font>: +00136 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'='</font>) +00137 { +00138 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u25">NotEqual</a>; +00139 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00140 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00141 } +00142 <font class="keywordflow">else</font> +00143 { +00144 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u9">Not</a>; +00145 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00146 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00147 } +00148 <font class="keywordflow">case</font> <font class="charliteral">'&'</font>: +00149 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'&'</font>) +00150 { +00151 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u29">LogicalAnd</a>; +00152 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00153 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00154 } +00155 <font class="keywordflow">else</font> +00156 { +00157 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u26">And</a>; +00158 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=1; +00159 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00160 } +00161 <font class="keywordflow">case</font> <font class="charliteral">'-'</font>: +00162 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'>'</font>) +00163 { +00164 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u19">SRightShift</a>; +00165 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00166 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00167 } +00168 <font class="keywordflow">else</font> +00169 { +00170 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u15">Minus</a>; +00171 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00172 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00173 } +00174 <font class="keywordflow">case</font> <font class="charliteral">'<'</font>: +00175 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'<'</font>) +00176 { +00177 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u16">ULeftShift</a>; +00178 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00179 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00180 } +00181 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'='</font>) +00182 { +00183 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u21">InferiorEqual</a>; +00184 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00185 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00186 } +00187 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'-'</font>) +00188 { +00189 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u18">SLeftShift</a>; +00190 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00191 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00192 } +00193 <font class="keywordflow">else</font> +00194 { +00195 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u20">Inferior</a>; +00196 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=1; +00197 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00198 } +00199 <font class="keywordflow">case</font> <font class="charliteral">'='</font>: +00200 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'='</font>) +00201 { +00202 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u24">Equal</a>; +00203 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00204 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00205 } +00206 <font class="keywordflow">case</font> <font class="charliteral">'>'</font>: +00207 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'>'</font>) +00208 { +00209 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u17">URightShift</a>; +00210 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00211 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00212 } +00213 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'='</font>) +00214 { +00215 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u23">SuperiorEqual</a>; +00216 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00217 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00218 } +00219 <font class="keywordflow">else</font> +00220 { +00221 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u22">Superior</a>; +00222 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=1; +00223 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00224 } +00225 <font class="keywordflow">case</font> <font class="charliteral">'^'</font>: +00226 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'^'</font>) +00227 { +00228 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u31">LogicalXor</a>; +00229 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00230 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00231 } +00232 <font class="keywordflow">else</font> +00233 { +00234 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u28">Xor</a>; +00235 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=1; +00236 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00237 } +00238 <font class="keywordflow">case</font> <font class="charliteral">'|'</font>: +00239 <font class="keywordflow">if</font> (secondChar == <font class="charliteral">'|'</font>) +00240 { +00241 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u30">LogicalOr</a>; +00242 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=2; +00243 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00244 } +00245 <font class="keywordflow">else</font> +00246 { +00247 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u27">Or</a>; +00248 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+=1; +00249 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00250 } +00251 } +00252 +00253 <font class="comment">// Can't found the operator</font> +00254 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s6">UnkownOperator</a>; +00255 } +00256 } +00257 <font class="comment">// Is End, '(', ')', '.' ?</font> +00258 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (currentChar == 0) +00259 { +00260 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u8">End</a>; +00261 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00262 } +00263 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (currentChar == <font class="charliteral">'('</font>) +00264 { +00265 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00266 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u5">Open</a>; +00267 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00268 } +00269 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (currentChar == <font class="charliteral">')'</font>) +00270 { +00271 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00272 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u6">Close</a>; +00273 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00274 } +00275 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (currentChar == <font class="charliteral">','</font>) +00276 { +00277 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00278 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u7">Coma</a>; +00279 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00280 } +00281 <font class="comment">// Is a number ?</font> +00282 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'0'</font>) && (currentChar <= <font class="charliteral">'9'</font>) || (currentChar == <font class="charliteral">'.'</font>)) +00283 { +00284 <font class="comment">// This is a number</font> +00285 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u0">Number</a>; +00286 +00287 <font class="comment">// Have a second character ?</font> +00288 <font class="keywordtype">char</font> secondChar = *(<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>+1); +00289 +00290 <font class="comment">// Is an hexadecimal value ?</font> +00291 <font class="keywordflow">if</font> ((currentChar == <font class="charliteral">'0'</font>) && (secondChar == <font class="charliteral">'x'</font>)) +00292 { +00293 <font class="comment">// Go to the number</font> +00294 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> +=2; +00295 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00296 +00297 <font class="comment">// Registered values</font> +00298 <font class="keyword">register</font> <font class="keywordtype">double</font> regValue = 0; +00299 <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'0'</font>) && (currentChar <= <font class="charliteral">'9'</font>)) +00300 { +00301 regValue += (currentChar - <font class="charliteral">'0'</font>); +00302 } +00303 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'a'</font>) && (currentChar <= <font class="charliteral">'f'</font>)) +00304 { +00305 regValue += (currentChar - <font class="charliteral">'a'</font> + 10); +00306 } +00307 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'A'</font>) && (currentChar <= <font class="charliteral">'F'</font>)) +00308 { +00309 regValue += (currentChar - <font class="charliteral">'A'</font> + 10); +00310 } +00311 <font class="keywordflow">else</font> +00312 { +00313 <font class="comment">// Number syntax error</font> +00314 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s5">NumberSyntaxError</a>; +00315 } +00316 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00317 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00318 +00319 <font class="comment">// For each values</font> +00320 <font class="keywordflow">while</font> (1) +00321 { +00322 <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'0'</font>) && (currentChar <= <font class="charliteral">'9'</font>)) +00323 { +00324 regValue *= 16; +00325 regValue += (currentChar - <font class="charliteral">'0'</font>); +00326 } +00327 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'a'</font>) && (currentChar <= <font class="charliteral">'f'</font>)) +00328 { +00329 regValue *= 16; +00330 regValue += (currentChar - <font class="charliteral">'a'</font> + 10); +00331 } +00332 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((currentChar >= <font class="charliteral">'A'</font>) && (currentChar <= <font class="charliteral">'F'</font>)) +00333 { +00334 regValue *= 16; +00335 regValue += (currentChar - <font class="charliteral">'A'</font> + 10); +00336 } +00337 <font class="keywordflow">else</font> +00338 { +00339 <font class="comment">// Stop</font> +00340 <font class="keywordflow">break</font>; +00341 } +00342 +00343 <font class="comment">// Next char</font> +00344 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00345 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00346 } +00347 +00348 <font class="comment">// Store value</font> +00349 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a> = regValue; +00350 +00351 <font class="comment">// Number ok</font> +00352 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00353 } +00354 <font class="comment">// Is an octal value ?</font> +00355 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ((currentChar == <font class="charliteral">'0'</font>) && (secondChar >= <font class="charliteral">'0'</font>) && (secondChar <= <font class="charliteral">'9'</font>)) +00356 { +00357 <font class="comment">// Go to the number</font> +00358 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> ++; +00359 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00360 +00361 <font class="comment">// Registered values</font> +00362 <font class="keyword">register</font> <font class="keywordtype">double</font> regValue = 0; +00363 +00364 <font class="comment">// Check octal number</font> +00365 <font class="keywordflow">if</font> (currentChar > <font class="charliteral">'7'</font>) +00366 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s5">NumberSyntaxError</a>; +00367 +00368 <font class="comment">// Read the first value</font> +00369 regValue += (currentChar - <font class="charliteral">'0'</font>); +00370 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00371 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00372 +00373 <font class="comment">// For each values</font> +00374 <font class="keywordflow">while</font> ((currentChar >= <font class="charliteral">'0'</font>) && (currentChar <= <font class="charliteral">'9'</font>)) +00375 { +00376 <font class="comment">// Check octal number</font> +00377 <font class="keywordflow">if</font> (currentChar > <font class="charliteral">'7'</font>) +00378 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s5">NumberSyntaxError</a>; +00379 +00380 regValue *= 8; +00381 regValue += (currentChar - <font class="charliteral">'0'</font>); +00382 +00383 <font class="comment">// Next char</font> +00384 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00385 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00386 } +00387 +00388 <font class="comment">// Store value</font> +00389 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a> = regValue; +00390 +00391 <font class="comment">// Number ok</font> +00392 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00393 } +00394 <font class="comment">// It is a decimal value</font> +00395 <font class="keywordflow">else</font> +00396 { +00397 <font class="comment">// Read value</font> +00398 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15">TReturnState</a> state = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c0">readDecimal</a> (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a>); +00399 <font class="keywordflow">if</font> (state == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00400 { +00401 <font class="comment">// Exponent ?</font> +00402 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00403 <font class="keywordflow">if</font> ( (currentChar == <font class="charliteral">'e'</font>) || (currentChar == <font class="charliteral">'E'</font>) ) +00404 { +00405 <font class="comment">// Next char</font> +00406 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00407 +00408 <font class="comment">// Minus ?</font> +00409 <font class="keywordtype">bool</font> negative = <font class="keyword">false</font>; +00410 <font class="keywordflow">if</font> (*<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> == <font class="charliteral">'-'</font>) +00411 { +00412 negative = <font class="keyword">true</font>; +00413 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00414 } +00415 +00416 <font class="comment">// Read value</font> +00417 <font class="keywordtype">double</font> exponent; +00418 state = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c0">readDecimal</a> (exponent); +00419 <font class="keywordflow">if</font> (state == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00420 { +00421 <font class="comment">// Negative value ?</font> +00422 <font class="keywordflow">if</font> (negative) +00423 exponent = -exponent; +00424 +00425 <font class="comment">// Raise 10 at the power of</font> +00426 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a> *= pow (10.0, exponent); +00427 } +00428 <font class="keywordflow">else</font> +00429 { +00430 <font class="keywordflow">return</font> state; +00431 } +00432 } +00433 +00434 <font class="comment">// Number ok</font> +00435 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00436 } +00437 <font class="keywordflow">else</font> +00438 { +00439 <font class="keywordflow">return</font> state; +00440 } +00441 } +00442 } +00443 <font class="comment">// Is a string ?</font> +00444 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (currentChar == <font class="charliteral">'"'</font>) +00445 { +00446 <font class="comment">// Look for the end of the string</font> +00447 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00448 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00449 <font class="keyword">const</font> <font class="keywordtype">char</font> *start = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00450 <font class="keywordflow">while</font> ( (currentChar != 0) && (currentChar != <font class="charliteral">'"'</font>) ) +00451 { +00452 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00453 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00454 } +00455 +00456 <font class="comment">// End reached ?</font> +00457 <font class="keywordflow">if</font> (currentChar == 0) +00458 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s13">MustBeDoubleQuote</a>; +00459 +00460 <font class="comment">// This is a user string, copy the string</font> +00461 uint size = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> - start; +00462 <font class="keywordflow">if</font> (size >= (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u62">InternalStringLen</a>-1)) +00463 { +00464 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o4">_InternalStlString</a>.resize (size); +00465 uint i; +00466 <font class="keywordflow">for</font> (i=0; i<size; i++) +00467 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o4">_InternalStlString</a>[i] = start[i]; +00468 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o4">_InternalStlString</a>.c_str (); +00469 } +00470 <font class="keywordflow">else</font> +00471 { +00472 memcpy (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o3">_InternalString</a>, start, size); +00473 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o3">_InternalString</a>[size] = 0; +00474 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o3">_InternalString</a>; +00475 } +00476 +00477 <font class="comment">// Token</font> +00478 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00479 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u3">String</a>; +00480 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00481 } +00482 } +00483 +00484 <font class="comment">// Read a string</font> +00485 <font class="keyword">const</font> <font class="keywordtype">char</font> *start = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00486 <font class="keywordflow">while</font> ( (currentChar >= 128) || <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r3">_StringChar</a>[currentChar] ) +00487 { +00488 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>++; +00489 currentChar = *<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a>; +00490 } +00491 +00492 <font class="comment">// Is pi ?</font> +00493 <font class="keywordflow">if</font> (((<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> - start) == 2) && (start[0] == <font class="charliteral">'p'</font>) && (start[1] == <font class="charliteral">'i'</font>)) +00494 { +00495 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u0">Number</a>; +00496 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a> = 3.1415926535897932384626433832795; +00497 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00498 } +00499 <font class="comment">// Is e ?</font> +00500 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (((<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> - start) == 1) && (start[0] == <font class="charliteral">'e'</font>)) +00501 { +00502 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u0">Number</a>; +00503 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a> = 2.7182818284590452353602874713527; +00504 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00505 } +00506 +00507 <font class="comment">// This is a user string, copy the string</font> +00508 uint size = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> - start; +00509 <font class="keywordflow">if</font> (size >= (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u62">InternalStringLen</a>-1)) +00510 { +00511 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o4">_InternalStlString</a>.resize (size); +00512 uint i; +00513 <font class="keywordflow">for</font> (i=0; i<size; i++) +00514 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o4">_InternalStlString</a>[i] = start[i]; +00515 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o4">_InternalStlString</a>.c_str (); +00516 } +00517 <font class="keywordflow">else</font> +00518 { +00519 memcpy (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o3">_InternalString</a>, start, size); +00520 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o3">_InternalString</a>[size] = 0; +00521 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o3">_InternalString</a>; +00522 } +00523 +00524 <font class="comment">// Search for a reserved word ?</font> +00525 uint begin = 0; +00526 uint end = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u61">ReservedWordCount</a>-1; +00527 sint result = strcmp (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a>, <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r1">_ReservedWord</a>[begin]); +00528 <font class="keywordflow">if</font> ( result >= 0 ) +00529 { +00530 <font class="comment">// The first is the good ?</font> +00531 <font class="keywordflow">if</font> ( result == 0 ) +00532 { +00533 end = begin; +00534 } +00535 +00536 result = strcmp (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a>, <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r1">_ReservedWord</a>[end]); +00537 <font class="keywordflow">if</font> (result <= 0) +00538 { +00539 <font class="comment">// The last is the good ?</font> +00540 <font class="keywordflow">if</font> ( result == 0 ) +00541 { +00542 begin = end; +00543 } +00544 +00545 <font class="comment">// While there is a middle..</font> +00546 <font class="keywordflow">while</font> ((end - begin) > 1) +00547 { +00548 uint middle = begin + (end - begin) / 2; +00549 result = strcmp (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a>, <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r1">_ReservedWord</a>[middle]); +00550 <font class="keywordflow">if</font> (result == 0) +00551 { +00552 begin = middle; +00553 end = middle; +00554 <font class="keywordflow">break</font>; +00555 } +00556 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (result < 0) +00557 { +00558 end = middle; +00559 } +00560 <font class="keywordflow">else</font> +00561 { +00562 begin = middle; +00563 } +00564 } +00565 } +00566 +00567 <font class="comment">// Found ?</font> +00568 <font class="keywordflow">if</font> (end == begin) +00569 { +00570 <font class="comment">// Return the token</font> +00571 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o2">_ReservedWordFound</a> = (TReservedWord)begin; +00572 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r0">_ReservedWordToken</a>[begin]; +00573 +00574 <font class="comment">// Ok</font> +00575 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00576 } +00577 } +00578 +00579 <font class="comment">// Token</font> +00580 token = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u3">String</a>; +00581 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00582 } +00583 +00584 <font class="comment">// ***************************************************************************</font> +00585 +<a name="l00586"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">00586</a> CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (<font class="keyword">const</font> <font class="keywordtype">char</font> *expression, <font class="keywordtype">double</font> &result, +00587 <font class="keywordtype">int</font> *errorIndex, uint32 userData) +00588 { +00589 <font class="comment">// Init the ptr</font> +00590 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> = expression; +00591 +00592 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64">TToken</a> nextToken; +00593 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15">TReturnState</a> error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">evalExpression</a> (result, nextToken, userData); +00594 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00595 { +00596 <font class="comment">// The end ?</font> +00597 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u8">End</a>) +00598 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +00599 <font class="keywordflow">else</font> +00600 { +00601 <font class="keywordflow">if</font> (errorIndex) +00602 *errorIndex = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> - expression; +00603 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s12">MustBeEnd</a>; +00604 } +00605 } +00606 <font class="keywordflow">else</font> +00607 { +00608 <font class="keywordflow">if</font> (errorIndex) +00609 *errorIndex = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o1">_ExprPtr</a> - expression; +00610 <font class="keywordflow">return</font> error; +00611 } +00612 } +00613 +00614 <font class="comment">// ***************************************************************************</font> +00615 +<a name="l00616"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c3">00616</a> CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (<font class="keywordtype">double</font> &finalResult, TToken &nextToken, uint32 userData) +00617 { +00618 <font class="comment">// Array of result</font> +00619 +00620 uint exprCount = 0; +00621 <font class="keywordtype">double</font> result[<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +00622 vector<double> resultSup; +00623 +00624 uint opCount = 0; +00625 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65">TOperator</a> resultOp[<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +00626 vector<TOperator> resultOpSup; +00627 +00628 <font class="comment">// Read a token</font> +00629 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15">TReturnState</a> error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00630 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00631 <font class="keywordflow">return</font> error; +00632 <font class="keywordflow">while</font> (1) +00633 { +00634 <font class="comment">// Unary opertor</font> +00635 uint unaryOpCount = 0; +00636 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65">TOperator</a> resultUnaryOp[<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +00637 vector<TOperator> resultUnaryOpSup; +00638 +00639 <font class="comment">// Current value</font> +00640 <font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>; +00641 +00642 <font class="comment">// Unary operator ?</font> +00643 <font class="keywordflow">if</font> ( (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u4">Operator</a>) && ( (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u15">Minus</a>) || (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u9">Not</a>) || (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a> == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u10">Tilde</a>) ) ) +00644 { +00645 <font class="comment">// Push the unary operator</font> +00646 <font class="keywordflow">if</font> (unaryOpCount<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>) +00647 resultUnaryOp[unaryOpCount] = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a>; +00648 <font class="keywordflow">else</font> +00649 resultUnaryOpSup.push_back (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a>); +00650 unaryOpCount++; +00651 +00652 <font class="comment">// Read next token</font> +00653 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00654 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00655 <font class="keywordflow">return</font> error; +00656 } +00657 +00658 <font class="comment">// Parenthesis ?</font> +00659 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u5">Open</a>) +00660 { +00661 <font class="comment">// Eval sub expression</font> +00662 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">evalExpression</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, nextToken, userData); +00663 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00664 { +00665 <font class="keywordflow">if</font> (nextToken != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u6">Close</a>) +00666 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s8">MustBeClose</a>; +00667 } +00668 <font class="keywordflow">else</font> +00669 <font class="keywordflow">return</font> error; +00670 +00671 <font class="comment">// Get next token</font> +00672 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00673 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00674 <font class="keywordflow">return</font> error; +00675 } +00676 <font class="comment">// This is a function ?</font> +00677 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ( (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u1">Function1</a>) || (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u2">Function2</a>) ) +00678 { +00679 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64">TToken</a> backupedToken = nextToken; +00680 +00681 <font class="comment">// Get the function</font> +00682 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66">TReservedWord</a> reservedWord = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o2">_ReservedWordFound</a>; +00683 +00684 <font class="comment">// Read a token</font> +00685 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00686 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00687 { +00688 <font class="comment">// Open ?</font> +00689 <font class="keywordflow">if</font> (nextToken != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u5">Open</a>) +00690 { +00691 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s7">MustBeOpen</a>; +00692 } +00693 +00694 <font class="comment">// Eval an expression</font> +00695 <font class="keywordtype">double</font> arg0; +00696 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">evalExpression</a> (arg0, nextToken, userData); +00697 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00698 { +00699 <font class="comment">// 2 arg ?</font> +00700 <font class="keywordflow">if</font> (backupedToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u2">Function2</a>) +00701 { +00702 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u7">Coma</a>) +00703 { +00704 <font class="comment">// Second argument</font> +00705 <font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>; +00706 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">evalExpression</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, nextToken, userData); +00707 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00708 { +00709 <font class="comment">// Final with close ?</font> +00710 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u6">Close</a>) +00711 { +00712 <font class="keywordflow">switch</font> (reservedWord) +00713 { +00714 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u39">Atan2</a>: +00715 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = atan2 (arg0, <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>); +00716 <font class="keywordflow">break</font>; +00717 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u50">Max</a>: +00718 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (arg0><a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>) ? arg0 : <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>; +00719 <font class="keywordflow">break</font>; +00720 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u51">Min</a>: +00721 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (arg0<<a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>) ? arg0 : <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>; +00722 <font class="keywordflow">break</font>; +00723 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u52">Pow</a>: +00724 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = pow (arg0, <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>); +00725 <font class="keywordflow">break</font>; +00726 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u53">Rand</a>: +00727 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = arg0 + (<a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>-arg0) * (double)rand () / (double)(RAND_MAX+1); +00728 <font class="keywordflow">break</font>; +00729 <font class="keywordflow">default</font>: +00730 <font class="comment">// Can't be hear after getToken</font> +00731 <a class="code" href="debug_8h.html#a12">nlstop</a>; +00732 } +00733 } +00734 <font class="keywordflow">else</font> +00735 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s8">MustBeClose</a>; +00736 } +00737 <font class="keywordflow">else</font> +00738 <font class="keywordflow">return</font> error; +00739 } +00740 <font class="keywordflow">else</font> +00741 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s9">MustBeComa</a>; +00742 } +00743 <font class="keywordflow">else</font> +00744 { +00745 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u6">Close</a>) +00746 { +00747 <font class="comment">// Eval the function</font> +00748 <font class="keywordflow">switch</font> (reservedWord) +00749 { +00750 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u35">Abs</a>: +00751 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = fabs (arg0); +00752 <font class="keywordflow">break</font>; +00753 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u36">Acos</a>: +00754 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = acos (arg0); +00755 <font class="keywordflow">break</font>; +00756 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u37">Asin</a>: +00757 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = asin (arg0); +00758 <font class="keywordflow">break</font>; +00759 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u38">Atan</a>: +00760 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = atan (arg0); +00761 <font class="keywordflow">break</font>; +00762 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u40">Ceil</a>: +00763 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = ceil (arg0); +00764 <font class="keywordflow">break</font>; +00765 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u42">Cosh</a>: +00766 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = cosh (arg0); +00767 <font class="keywordflow">break</font>; +00768 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u41">Cos</a>: +00769 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = cos (arg0); +00770 <font class="keywordflow">break</font>; +00771 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u44">Exponent</a>: +00772 { +00773 <font class="keywordtype">int</font> exponent; +00774 frexp( arg0, &exponent); +00775 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (double)exponent; +00776 } +00777 <font class="keywordflow">break</font>; +00778 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u43">Exp</a>: +00779 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = exp (arg0); +00780 <font class="keywordflow">break</font>; +00781 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u45">Floor</a>: +00782 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = floor (arg0); +00783 <font class="keywordflow">break</font>; +00784 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u46">Int</a>: +00785 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (double)(int)(arg0); +00786 <font class="keywordflow">break</font>; +00787 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u48">Log10</a>: +00788 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = log10 (arg0); +00789 <font class="keywordflow">break</font>; +00790 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u47">Log</a>: +00791 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = log (arg0); +00792 <font class="keywordflow">break</font>; +00793 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u49">Mantissa</a>: +00794 { +00795 <font class="keywordtype">int</font> exponent; +00796 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = frexp( arg0, &exponent); +00797 } +00798 <font class="keywordflow">break</font>; +00799 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u54">Round</a>: +00800 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = floor (arg0 + 0.5); +00801 <font class="keywordflow">break</font>; +00802 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u56">Sinh</a>: +00803 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = sinh (arg0); +00804 <font class="keywordflow">break</font>; +00805 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u55">Sin</a>: +00806 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = sin (arg0); +00807 <font class="keywordflow">break</font>; +00808 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u58">Sqrt</a>: +00809 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = sqrt (arg0); +00810 <font class="keywordflow">break</font>; +00811 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u57">Sq</a>: +00812 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = arg0 * arg0; +00813 <font class="keywordflow">break</font>; +00814 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u60">Tanh</a>: +00815 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = tanh (arg0); +00816 <font class="keywordflow">break</font>; +00817 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u59">Tan</a>: +00818 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = tan (arg0); +00819 <font class="keywordflow">break</font>; +00820 <font class="keywordflow">default</font>: +00821 <font class="comment">// Can't be hear after getToken</font> +00822 <a class="code" href="debug_8h.html#a12">nlstop</a> +00823 } +00824 } +00825 <font class="keywordflow">else</font> +00826 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s8">MustBeClose</a>; +00827 } +00828 } +00829 <font class="keywordflow">else</font> +00830 <font class="keywordflow">return</font> error; +00831 } +00832 <font class="keywordflow">else</font> +00833 <font class="keywordflow">return</font> error; +00834 +00835 <font class="comment">// Get next token</font> +00836 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00837 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00838 <font class="keywordflow">return</font> error; +00839 } +00840 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u0">Number</a>) +00841 { +00842 <font class="comment">// Save the internal value</font> +00843 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o6">_Value</a>; +00844 +00845 <font class="comment">// Get next token</font> +00846 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00847 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00848 <font class="keywordflow">return</font> error; +00849 } +00850 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u3">String</a>) +00851 { +00852 <font class="comment">// Copy the string</font> +00853 <font class="keywordtype">char</font> internalString[<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u62">InternalStringLen</a>]; +00854 std::string internalStlString; +00855 <font class="keyword">const</font> <font class="keywordtype">char</font> *internalStringPtr; +00856 <font class="keywordflow">if</font> (strlen (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a>) >= <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u62">InternalStringLen</a>-1) +00857 { +00858 internalStlString = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a>; +00859 internalStringPtr = internalStlString.c_str (); +00860 } +00861 <font class="keywordflow">else</font> +00862 { +00863 strcpy (internalString ,<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o5">_InternalStringPtr</a>); +00864 internalStringPtr = internalString; +00865 } +00866 +00867 <font class="comment">// Read a token</font> +00868 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00869 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00870 { +00871 <font class="comment">// Open ?</font> +00872 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u5">Open</a>) +00873 { +00874 <font class="comment">// Eval an expression</font> +00875 <font class="keywordtype">double</font> arg0; +00876 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">evalExpression</a> (arg0, nextToken, userData); +00877 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00878 { +00879 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u7">Coma</a>) +00880 { +00881 <font class="comment">// Second argument</font> +00882 <font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>; +00883 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a1">evalExpression</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, nextToken, userData); +00884 <font class="keywordflow">if</font> (error == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00885 { +00886 <font class="comment">// Final with close ?</font> +00887 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u6">Close</a>) +00888 { +00889 <font class="comment">// Eval the function</font> +00890 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#b1">evalFunction</a> (internalStringPtr, arg0, <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>); +00891 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00892 <font class="keywordflow">return</font> error; +00893 +00894 <font class="comment">// Get next token</font> +00895 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00896 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00897 <font class="keywordflow">return</font> error; +00898 } +00899 <font class="keywordflow">else</font> +00900 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s8">MustBeClose</a>; +00901 } +00902 <font class="keywordflow">else</font> +00903 <font class="keywordflow">return</font> error; +00904 } +00905 <font class="keywordflow">else</font> +00906 { +00907 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u6">Close</a>) +00908 { +00909 <font class="comment">// Eval the function</font> +00910 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#b1">evalFunction</a> (internalStringPtr, arg0, <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>); +00911 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00912 <font class="keywordflow">return</font> error; +00913 +00914 <font class="comment">// Get next token</font> +00915 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00916 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00917 <font class="keywordflow">return</font> error; +00918 } +00919 <font class="keywordflow">else</font> +00920 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s8">MustBeClose</a>; +00921 } +00922 } +00923 <font class="keywordflow">else</font> +00924 <font class="keywordflow">return</font> error; +00925 } +00926 <font class="keywordflow">else</font> +00927 { +00928 <font class="comment">// This is a user value</font> +00929 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#b0">evalValue</a> (internalStringPtr, <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, userData); +00930 <font class="keywordflow">if</font> (error != <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>) +00931 <font class="keywordflow">return</font> error; +00932 } +00933 } +00934 <font class="keywordflow">else</font> +00935 <font class="keywordflow">return</font> error; +00936 } +00937 <font class="keywordflow">else</font> +00938 { +00939 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s10">MustBeExpression</a>; +00940 } +00941 +00942 <font class="comment">// Eval unary operator</font> +00943 sint i; +00944 <font class="keywordflow">for</font> (i=unaryOpCount-1; i>=0; i--) +00945 { +00946 <font class="keywordflow">switch</font> ((i<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?resultUnaryOp[i]:resultUnaryOpSup[i-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]) +00947 { +00948 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u9">Not</a>: +00949 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (double)(uint)((floor (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>+0.5)==0.0)); +00950 <font class="keywordflow">break</font>; +00951 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u10">Tilde</a>: +00952 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = (double)~((uint)floor (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>+0.5)); +00953 <font class="keywordflow">break</font>; +00954 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u15">Minus</a>: +00955 <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a> = -<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>; +00956 <font class="keywordflow">break</font>; +00957 <font class="keywordflow">default</font>: +00958 <font class="comment">// Can't be hear after getToken</font> +00959 <a class="code" href="debug_8h.html#a12">nlstop</a> +00960 } +00961 } +00962 +00963 <font class="comment">// Push the value</font> +00964 <font class="keywordflow">if</font> (exprCount < <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>) +00965 result[exprCount] = <a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>; +00966 <font class="keywordflow">else</font> +00967 resultSup.push_back (<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>); +00968 exprCount++; +00969 +00970 <font class="comment">// Look for an operator</font> +00971 <font class="comment">// Operator ?</font> +00972 <font class="keywordflow">if</font> (nextToken == <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u64u4">Operator</a>) +00973 { +00974 <font class="comment">// Yes, push it</font> +00975 <font class="keywordflow">if</font> (opCount < <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>) +00976 resultOp[opCount] = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a>; +00977 <font class="keywordflow">else</font> +00978 resultOpSup.push_back (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#o7">_Op</a>); +00979 opCount++; +00980 } +00981 <font class="keywordflow">else</font> +00982 { +00983 <font class="comment">// Exit the evaluate loop</font> +00984 <font class="keywordflow">break</font>; +00985 } +00986 +00987 <font class="comment">// Next token</font> +00988 error = <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#c2">getNextToken</a> (nextToken); +00989 } +00990 +00991 <font class="comment">// Reduce the expression</font> +00992 uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = 1; +00993 <font class="keywordflow">while</font> (exprCount != 1) +00994 { +00995 <font class="comment">// Reduct ?</font> +00996 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65">TOperator</a> before = (((<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1)<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?resultOp[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1]:resultOpSup[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]); +00997 <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65">TOperator</a> after = (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> < opCount)?(((index)<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?resultOp[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]:resultOpSup[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]):<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u33">NotOperator</a>; +00998 <font class="keywordflow">if</font> ((<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> == opCount) || (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r5">_OperatorPrecedence</a>[before] <= <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r5">_OperatorPrecedence</a>[after])) +00999 { +01000 <font class="comment">// Eval the value</font> +01001 <font class="keywordtype">double</font> &v0 = ((<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1)<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?result[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1]:resultSup[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +01002 <font class="keywordtype">double</font> &v1 = ((index)<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?result[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]:resultSup[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +01003 +01004 <font class="comment">// Choose the operator</font> +01005 <font class="keywordflow">switch</font> (before) +01006 { +01007 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u9">Not</a>: +01008 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u10">Tilde</a>: +01009 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s11">NotUnaryOperator</a>; +01010 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u11">Mul</a>: +01011 v0 *= v1; +01012 <font class="keywordflow">break</font>; +01013 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u12">Div</a>: +01014 v0 /= v1; +01015 <font class="keywordflow">break</font>; +01016 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u13">Remainder</a>: +01017 v0 = fmod (v0, v1); +01018 <font class="keywordflow">break</font>; +01019 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u14">Plus</a>: +01020 v0 += v1; +01021 <font class="keywordflow">break</font>; +01022 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u15">Minus</a>: +01023 v0 -= v1; +01024 <font class="keywordflow">break</font>; +01025 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u16">ULeftShift</a>: +01026 v0 = (double)(((uint)floor (v0 + 0.5))<<((uint)floor (v1 + 0.5))); +01027 <font class="keywordflow">break</font>; +01028 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u17">URightShift</a>: +01029 v0 = (double)(((uint)floor (v0 + 0.5))>>((uint)floor (v1 + 0.5))); +01030 <font class="keywordflow">break</font>; +01031 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u18">SLeftShift</a>: +01032 v0 = (double)(((sint)floor (v0 + 0.5))<<((sint)floor (v1 + 0.5))); +01033 <font class="keywordflow">break</font>; +01034 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u19">SRightShift</a>: +01035 v0 = (double)(((sint)floor (v0 + 0.5))>>((sint)floor (v1 + 0.5))); +01036 <font class="keywordflow">break</font>; +01037 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u20">Inferior</a>: +01038 v0 = (v0<v1)?1.0:0.0; +01039 <font class="keywordflow">break</font>; +01040 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u21">InferiorEqual</a>: +01041 v0 = (v0<=v1)?1.0:0.0; +01042 <font class="keywordflow">break</font>; +01043 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u22">Superior</a>: +01044 v0 = (v0>v1)?1.0:0.0; +01045 <font class="keywordflow">break</font>; +01046 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u23">SuperiorEqual</a>: +01047 v0 = (v0>=v1)?1.0:0.0; +01048 <font class="keywordflow">break</font>; +01049 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u24">Equal</a>: +01050 v0 = (v0==v1)?1.0:0.0; +01051 <font class="keywordflow">break</font>; +01052 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u25">NotEqual</a>: +01053 v0 = (v0!=v1)?1.0:0.0; +01054 <font class="keywordflow">break</font>; +01055 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u26">And</a>: +01056 v0 = (double)(((uint)floor (v0 + 0.5)) & ((uint)floor (v1 + 0.5))); +01057 <font class="keywordflow">break</font>; +01058 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u27">Or</a>: +01059 v0 = (double)(((uint)floor (v0 + 0.5)) | ((uint)floor (v1 + 0.5))); +01060 <font class="keywordflow">break</font>; +01061 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u28">Xor</a>: +01062 v0 = (double)(((uint)floor (v0 + 0.5)) ^ ((uint)floor (v1 + 0.5))); +01063 <font class="keywordflow">break</font>; +01064 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u29">LogicalAnd</a>: +01065 v0 = (double)(uint)((floor (v0 + 0.5) != 0.0) && (floor (v1 + 0.5) != 0.0)); +01066 <font class="keywordflow">break</font>; +01067 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u30">LogicalOr</a>: +01068 v0 = (double)(uint)((floor (v0 + 0.5) != 0.0) || (floor (v1 + 0.5) != 0.0)); +01069 <font class="keywordflow">break</font>; +01070 <font class="keywordflow">case</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u65u31">LogicalXor</a>: +01071 { +01072 <font class="keywordtype">bool</font> b0 = floor (v0 + 0.5) != 0.0; +01073 <font class="keywordtype">bool</font> b1 = floor (v1 + 0.5) != 0.0; +01074 v0 = (double)(uint)((b0&&!b1) || ((!b0)&&b1)); +01075 } +01076 <font class="keywordflow">break</font>; +01077 <font class="keywordflow">default</font>: +01078 <a class="code" href="debug_8h.html#a6">nlassert</a> (0); +01079 } +01080 +01081 <font class="comment">// Decal others values</font> +01082 uint i = <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>; +01083 <font class="keywordflow">for</font> (; i<exprCount-1; i++) +01084 { +01085 <font class="comment">// Copy</font> +01086 <font class="keywordflow">if</font> (i<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>) +01087 result[i] = (i+1<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?result[i+1]:resultSup[i+1-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +01088 <font class="keywordflow">else</font> +01089 resultSup[i-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>] = (i+1<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?result[i+1]:resultSup[i+1-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +01090 } +01091 exprCount--; +01092 +01093 <font class="comment">// Decal operators</font> +01094 i = <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>-1; +01095 <font class="keywordflow">for</font> (; i<opCount-1; i++) +01096 { +01097 <font class="comment">// Copy</font> +01098 <font class="keywordflow">if</font> (i<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>) +01099 resultOp[i] = (i+1<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?resultOp[i+1]:resultOpSup[i+1-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +01100 <font class="keywordflow">else</font> +01101 resultOpSup[i-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>] = (i+1<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>)?resultOp[i+1]:resultOpSup[i+1-<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u67u63">InternalOperator</a>]; +01102 +01103 } +01104 opCount--; +01105 +01106 <font class="comment">// Last one ?</font> +01107 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> > 1) +01108 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>--; +01109 } +01110 <font class="keywordflow">else</font> +01111 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>++; +01112 } +01113 +01114 finalResult = result[0]; +01115 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s0">NoError</a>; +01116 } +01117 +01118 <font class="comment">// ***************************************************************************</font> +01119 +<a name="l01120"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a3">01120</a> <font class="keywordtype">bool</font> CEvalNumExpr::internalCheck () +01121 { +01122 <font class="keywordflow">for</font> (uint i=0; i<<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#u66u61">ReservedWordCount</a>-1; i++) +01123 <font class="keywordflow">if</font> (strcmp (<a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r1">_ReservedWord</a>[i], <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r1">_ReservedWord</a>[i+1]) >= 0) +01124 { +01125 <a class="code" href="debug_8h.html#a6">nlassert</a> (0); +01126 <font class="keywordflow">return</font> <font class="keyword">false</font>; +01127 } +01128 <font class="keywordflow">return</font> <font class="keyword">true</font>; +01129 } +01130 +01131 <font class="comment">// ***************************************************************************</font> +01132 +01133 <font class="comment">// ASCII TABLE</font> +01134 +01135 <font class="comment">/*</font> +01136 <font class="comment">0 NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI </font> +01137 <font class="comment">1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US </font> +01138 <font class="comment">2 ! " # $ % & ' ( ) * + , - . / </font> +01139 <font class="comment">3 0 1 2 3 4 5 6 7 8 9 : ; < = > ? </font> +01140 <font class="comment">4 @ A B C D E F G H I J K L M N O </font> +01141 <font class="comment">5 P Q R S T U V W X Y Z [ \ ] ^ _ </font> +01142 <font class="comment">6 ` a b c d e f g h i j k l m n o </font> +01143 <font class="comment">7 p q r s t u v w x y z { | } ~</font> +01144 <font class="comment">*/</font> +01145 +01146 <font class="comment">// ***************************************************************************</font> +01147 +<a name="l01148"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r2">01148</a> <font class="keyword">const</font> CEvalNumExpr::TOperator CEvalNumExpr::_OperatorArray[128] = +01149 { +01150 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, +01151 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, +01152 NotOperator, ExtOperator, NotOperator, NotOperator, NotOperator, Remainder, ExtOperator, NotOperator, NotOperator, NotOperator, Mul, Plus, NotOperator, ExtOperator, NotOperator, Div, +01153 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, ExtOperator, ExtOperator, ExtOperator, NotOperator, +01154 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, +01155 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, ExtOperator, NotOperator, +01156 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, +01157 NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, NotOperator, ExtOperator, NotOperator, Tilde, NotOperator, +01158 }; +01159 +01160 <font class="comment">// ***************************************************************************</font> +01161 +<a name="l01162"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r3">01162</a> <font class="keyword">const</font> <font class="keywordtype">bool</font> CEvalNumExpr::_StringChar[128] = +01163 { +01164 <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, +01165 <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, +01166 <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, +01167 <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">true</font>, +01168 <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, +01169 <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">true</font>, +01170 <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, +01171 <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">true</font>, <font class="keyword">false</font>, <font class="keyword">true</font>, +01172 }; +01173 +01174 <font class="comment">// ***************************************************************************</font> +01175 +<a name="l01176"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#b0">01176</a> CEvalNumExpr::TReturnState CEvalNumExpr::evalValue (<font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>, <font class="keywordtype">double</font> &result, uint32 userData) +01177 { +01178 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s1">UnkownValue</a>; +01179 } +01180 +01181 <font class="comment">// ***************************************************************************</font> +01182 +<a name="l01183"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#b1">01183</a> CEvalNumExpr::TReturnState CEvalNumExpr::evalFunction (<font class="keyword">const</font> <font class="keywordtype">char</font> *funcName, <font class="keywordtype">double</font> arg0, <font class="keywordtype">double</font> &result) +01184 { +01185 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s3">UnkownFunction</a>; +01186 } +01187 +01188 <font class="comment">// ***************************************************************************</font> +01189 +<a name="l01190"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#b2">01190</a> CEvalNumExpr::TReturnState CEvalNumExpr::evalFunction (<font class="keyword">const</font> <font class="keywordtype">char</font> *funcName, <font class="keywordtype">double</font> arg0, <font class="keywordtype">double</font> <a class="code" href="driver__opengl__extension__def_8h.html#a401">arg1</a>, <font class="keywordtype">double</font> &result) +01191 { +01192 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#s15s3">UnkownFunction</a>; +01193 } +01194 +01195 <font class="comment">// ***************************************************************************</font> +01196 +<a name="l01197"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r1">01197</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CEvalNumExpr::_ReservedWord[ReservedWordCount] = +01198 { +01199 <font class="stringliteral">"abs"</font>, <font class="comment">// Abs</font> +01200 <font class="stringliteral">"acos"</font>, <font class="comment">// Acos</font> +01201 <font class="stringliteral">"asin"</font>, <font class="comment">// Asin</font> +01202 <font class="stringliteral">"atan"</font>, <font class="comment">// Atan</font> +01203 <font class="stringliteral">"atan2"</font>, <font class="comment">// Atan2</font> +01204 <font class="stringliteral">"ceil"</font>, <font class="comment">// Ceil</font> +01205 <font class="stringliteral">"cos"</font>, <font class="comment">// Cos</font> +01206 <font class="stringliteral">"cosh"</font>, <font class="comment">// Cosh</font> +01207 <font class="stringliteral">"exp"</font>, <font class="comment">// Exp</font> +01208 <font class="stringliteral">"exponent"</font>, <font class="comment">// Exponent</font> +01209 <font class="stringliteral">"floor"</font>, <font class="comment">// Floor</font> +01210 <font class="stringliteral">"int"</font>, <font class="comment">// Int</font> +01211 <font class="stringliteral">"log"</font>, <font class="comment">// Log</font> +01212 <font class="stringliteral">"log10"</font>, <font class="comment">// Log10</font> +01213 <font class="stringliteral">"mantissa"</font>, <font class="comment">// Mantissa</font> +01214 <font class="stringliteral">"max"</font>, <font class="comment">// Max</font> +01215 <font class="stringliteral">"min"</font>, <font class="comment">// Min</font> +01216 <font class="stringliteral">"pow"</font>, <font class="comment">// Pow</font> +01217 <font class="stringliteral">"rand"</font>, <font class="comment">// Rand</font> +01218 <font class="stringliteral">"round"</font>, <font class="comment">// Round</font> +01219 <font class="stringliteral">"sin"</font>, <font class="comment">// Sin</font> +01220 <font class="stringliteral">"sinh"</font>, <font class="comment">// Sinh</font> +01221 <font class="stringliteral">"sq"</font>, <font class="comment">// Sq</font> +01222 <font class="stringliteral">"sqrt"</font>, <font class="comment">// Sqrt</font> +01223 <font class="stringliteral">"tan"</font>, <font class="comment">// Tan</font> +01224 <font class="stringliteral">"tanh"</font>, <font class="comment">// Tanh</font> +01225 }; +01226 +01227 <font class="comment">// ***************************************************************************</font> +01228 +<a name="l01229"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r0">01229</a> <font class="keyword">const</font> CEvalNumExpr::TToken CEvalNumExpr::_ReservedWordToken[ReservedWordCount] = +01230 { +01231 Function1, <font class="comment">// Abs</font> +01232 Function1, <font class="comment">// Acos</font> +01233 Function1, <font class="comment">// Asin</font> +01234 Function1, <font class="comment">// Atan</font> +01235 Function2, <font class="comment">// Atan2</font> +01236 Function1, <font class="comment">// Ceil</font> +01237 Function1, <font class="comment">// Cos</font> +01238 Function1, <font class="comment">// Cosh</font> +01239 Function1, <font class="comment">// Exp</font> +01240 Function1, <font class="comment">// Exponent</font> +01241 Function1, <font class="comment">// Floor</font> +01242 Function1, <font class="comment">// Int</font> +01243 Function1, <font class="comment">// Log</font> +01244 Function1, <font class="comment">// Log10</font> +01245 Function1, <font class="comment">// Mantissa</font> +01246 Function2, <font class="comment">// Max</font> +01247 Function2, <font class="comment">// Min</font> +01248 Function2, <font class="comment">// Pow</font> +01249 Function2, <font class="comment">// Rand</font> +01250 Function1, <font class="comment">// Round</font> +01251 Function1, <font class="comment">// Sin</font> +01252 Function1, <font class="comment">// Sinh</font> +01253 Function1, <font class="comment">// Sq</font> +01254 Function1, <font class="comment">// Sqrt</font> +01255 Function1, <font class="comment">// Tan</font> +01256 Function1, <font class="comment">// Tanh</font> +01257 }; +01258 +01259 <font class="comment">// ***************************************************************************</font> +01260 +<a name="l01261"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r4">01261</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CEvalNumExpr::_ErrorString[ReturnValueCount]= +01262 { +01263 <font class="stringliteral">"No error"</font>, +01264 <font class="stringliteral">"Unkown value"</font>, +01265 <font class="stringliteral">"Error during user defined value evaluation"</font>, +01266 <font class="stringliteral">"Unkown function"</font>, +01267 <font class="stringliteral">"Error during user defined function evaluation"</font>, +01268 <font class="stringliteral">"Syntax error in a number expression"</font>, +01269 <font class="stringliteral">"Unkown operator"</font>, +01270 <font class="stringliteral">"Should be a open parentesis"</font>, +01271 <font class="stringliteral">"Should be a close parentesis"</font>, +01272 <font class="stringliteral">"Should be a coma character"</font>, +01273 <font class="stringliteral">"Should be an expression"</font>, +01274 <font class="stringliteral">"Should not be an unary operator"</font>, +01275 <font class="stringliteral">"Should be the end of the expression"</font>, +01276 <font class="stringliteral">"Should be a double quote"</font>, +01277 }; +01278 +01279 <font class="comment">// ***************************************************************************</font> +01280 +<a name="l01281"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#a2">01281</a> <font class="keyword">const</font> <font class="keywordtype">char</font>* CEvalNumExpr::getErrorString (TReturnState state)<font class="keyword"> const</font> +01282 <font class="keyword"></font>{ +01283 <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r4">_ErrorString</a>[state]; +01284 } +01285 +01286 <font class="comment">// ***************************************************************************</font> +01287 +<a name="l01288"></a><a class="code" href="classNLMISC_1_1CEvalNumExpr.html#r5">01288</a> <font class="keyword">const</font> <font class="keywordtype">int</font> CEvalNumExpr::_OperatorPrecedence[]= +01289 { +01290 0, <font class="comment">// Not</font> +01291 0, <font class="comment">// Tilde</font> +01292 1, <font class="comment">// Mul</font> +01293 1, <font class="comment">// Div</font> +01294 1, <font class="comment">// Remainder</font> +01295 2, <font class="comment">// Plus</font> +01296 2, <font class="comment">// Minus</font> +01297 3, <font class="comment">// ULeftShift</font> +01298 3, <font class="comment">// URightShift</font> +01299 3, <font class="comment">// SLeftShift</font> +01300 3, <font class="comment">// SRightShift</font> +01301 4, <font class="comment">// Inferior</font> +01302 4, <font class="comment">// InferiorEqual</font> +01303 4, <font class="comment">// Superior</font> +01304 4, <font class="comment">// SuperiorEqual</font> +01305 5, <font class="comment">// Equal</font> +01306 5, <font class="comment">// NotEqual</font> +01307 6, <font class="comment">// And</font> +01308 7, <font class="comment">// Or</font> +01309 8, <font class="comment">// Xor</font> +01310 9, <font class="comment">// LogicalAnd</font> +01311 10, <font class="comment">// LogicalOr</font> +01312 11, <font class="comment">// LogicalXor</font> +01313 0xffffffff, <font class="comment">// OperatorCount</font> +01314 20, <font class="comment">// NotOperator</font> +01315 }; +01316 +01317 <font class="comment">// ***************************************************************************</font> +01318 +01319 } +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </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> |