📄 main_8cpp.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>a1: main.cpp File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.9.1 --><div class="qindex"><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="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div><h1>main.cpp File Reference</h1><code>#include "<a class="el" href="parse_8hpp-source.html">parse.hpp</a>"</code><br><code>#include "<a class="el" href="eval_8hpp-source.html">eval.hpp</a>"</code><br><code>#include <sstream></code><br><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a0">parse_eval_print</a> (string sexpr)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Parse and evaluate the s-expression, and print the result. <a href="#a0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a1">readsinglesymbol</a> (ifstream &fin, string &str)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Read single single symbol into the end of a string buffer. <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a2">readfile</a> (ifstream &fin)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Read, parse, evaluate, and print the expression one by one from the input stream. <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a3">readfile</a> (char *fn)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Read the expressions from the file. <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a4">readconsole</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Read, parse, evaluate, and print the expression one by one from the standard input, interactively. <a href="#a4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a5">main</a> (int argc, char *argv[])</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Call either the batch or interactive main drivers. <a href="#a5"></a><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Driver code implementing the main read-parse-eval-print loop. Supports both (1) an interactive mode, and (2) a batch mode where input expressions are read from the file specified by the first command-line argument.<hr><h2>Function Documentation</h2><a class="anchor" name="a5" doxytag="main.cpp::main"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">int main </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname" nowrap> <em>argc</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>char * </td> <td class="mdname" nowrap> <em>argv</em>[]</td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Call either the batch or interactive main drivers. <p> </td> </tr></table><a class="anchor" name="a0" doxytag="main.cpp::parse_eval_print"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void parse_eval_print </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">string </td> <td class="mdname1" valign="top" nowrap> <em>sexpr</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Parse and evaluate the s-expression, and print the result. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>sexpr</em> </td><td>The string vaule holding the s-expression. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a4" doxytag="main.cpp::readconsole"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void readconsole </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Read, parse, evaluate, and print the expression one by one from the standard input, interactively. <p> </td> </tr></table><a class="anchor" name="a3" doxytag="main.cpp::readfile"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void readfile </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname1" valign="top" nowrap> <em>fn</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Read the expressions from the file. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fn</em> </td><td>The file name. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a2" doxytag="main.cpp::readfile"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void readfile </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">ifstream & </td> <td class="mdname1" valign="top" nowrap> <em>fin</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Read, parse, evaluate, and print the expression one by one from the input stream. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fin</em> </td><td>The input file stream. </td></tr> </table></dl> </td> </tr></table><a class="anchor" name="a1" doxytag="main.cpp::readsinglesymbol"></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void readsinglesymbol </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">ifstream & </td> <td class="mdname" nowrap> <em>fin</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>string & </td> <td class="mdname" nowrap> <em>str</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Read single single symbol into the end of a string buffer. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fin</em> </td><td>The input file stream. </td></tr> <tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>The string buffer. </td></tr> </table></dl> </td> </tr></table><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 28 22:53:54 2007 for a1 by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -