⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compiler_8h-source.html

📁 FastDb是高效的内存数据库系统
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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>FastDB: compiler.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.5 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a></div><h1>compiler.h</h1><div class="fragment"><pre>00001 <span class="comment">//-&lt; COMPILE.H &gt;-----------------------------------------------------*--------*</span>00002 <span class="comment">// FastDB                    Version 1.0         (c) 1999  GARRET    *     ?  *</span>00003 <span class="comment">// (Main Memory Database Management System)                          *   /\|  *</span>00004 <span class="comment">//                                                                   *  /  \  *</span>00005 <span class="comment">//                          Created:     20-Nov-98    K.A. Knizhnik  * / [] \ *</span>00006 <span class="comment">//                          Last update: 17-Jan-99    K.A. Knizhnik  * GARRET *</span>00007 <span class="comment">//-------------------------------------------------------------------*--------*</span>00008 <span class="comment">// Conditional expresion compiler</span>00009 <span class="comment">//-------------------------------------------------------------------*--------*</span>00010 00011 <span class="preprocessor">#ifndef __COMPILER_H__</span>00012 <span class="preprocessor"></span><span class="preprocessor">#define __COMPILER_H__</span>00013 <span class="preprocessor"></span>00014 <span class="preprocessor">#include &lt;setjmp.h&gt;</span>00015 00016 <span class="preprocessor">#if defined(__osf__) || defined(__FreeBSD__)</span>00017 <span class="preprocessor"></span><span class="preprocessor">#define longjmp(b,s) _longjmp(b,s) // do not restore signal context</span>00018 <span class="preprocessor"></span><span class="preprocessor">#define setjmp(b)  _setjmp(b)</span>00019 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00020 <span class="preprocessor"></span>00021 <span class="keyword">enum</span> dbvmCodes { 00022 <span class="preprocessor">#define DBVM(cop, type, n_operands, commutative) cop,</span>00023 <span class="preprocessor"></span><span class="preprocessor">#include "compiler.d"</span>00024 dbvmLastCode00025 };00026 00027 <span class="preprocessor">#define IS_CONSTANT(c) \</span>00028 <span class="preprocessor">(unsigned(c) - dbvmLoadVarBool &lt;= (unsigned)dbvmLoadVarStdString - dbvmLoadVarBool)</span>00029 <span class="preprocessor"></span>00030 <span class="keyword">enum</span> nodeType { 00031     tpInteger,00032     tpBoolean,00033     tpReal,00034     tpString,00035     tpReference,00036     tpArray,00037     tpRawBinary, 00038     tpFreeVar,  <span class="comment">// index of EXISTS clause </span>00039     tpList,     <span class="comment">// list of expressions</span>00040     tpVoid00041 };00042 00043 <span class="keyword">enum</span> tokens { 00044     tkn_ident,00045     tkn_lpar,00046     tkn_rpar,00047     tkn_lbr,00048     tkn_rbr,00049     tkn_dot,00050     tkn_comma,00051     tkn_power,00052     tkn_iconst,00053     tkn_sconst,00054     tkn_fconst,00055     tkn_add,00056     tkn_sub,00057     tkn_mul,00058     tkn_div,00059     tkn_and,00060     tkn_or,00061     tkn_not,00062     tkn_null,00063     tkn_neg,00064     tkn_eq,00065     tkn_ne,00066     tkn_gt,00067     tkn_ge,00068     tkn_lt,00069     tkn_le,00070     tkn_between,00071     tkn_escape,00072     tkn_exists,00073     tkn_like,00074     tkn_in,00075     tkn_length,00076     tkn_lower,00077     tkn_upper,00078     tkn_abs,00079     tkn_is,00080     tkn_integer,00081     tkn_real,00082     tkn_string,00083     tkn_first,00084     tkn_last,00085     tkn_current,00086     tkn_var,00087     tkn_col,00088     tkn_true,00089     tkn_false,00090     tkn_where, 00091     tkn_follow,00092     tkn_start,00093     tkn_from,00094     tkn_order,00095     tkn_by,00096     tkn_asc,00097     tkn_desc, 00098     tkn_eof,00099     tkn_insert, 00100     tkn_into, 00101     tkn_select, 00102     tkn_table,00103     tkn_error,00104     tkn_all, 00105     tkn_last_token00106 };    00107 00108 <span class="keyword">struct </span>dbStrLiteral { 00109     <span class="keywordtype">char</span>* str;00110     <span class="keywordtype">int</span>   len;00111 };00112 00113 00114 <span class="keyword">class </span><a class="code" href="classdbUserFunction.html">dbUserFunction</a>;00115 00116 <span class="keyword">class </span>FASTDB_DLL_ENTRY dbExprNodeAllocator { 00117   <span class="keyword">private</span>:00118     <span class="keyword">friend</span> <span class="keyword">class </span>dbExprNodeSegment;00119     dbExprNode*        freeNodeList;00120     dbExprNodeSegment* segmentList;00121     dbMutex            mutex;00122     00123   <span class="keyword">public</span>:  00124     dbMutex&amp;    getMutex() {00125         <span class="keywordflow">return</span> mutex;00126     }00127     dbExprNode* allocate();00128     <span class="keywordtype">void</span>        deallocate(dbExprNode* node);00129     <span class="keywordtype">void</span>        reset();00130 00131     ~dbExprNodeAllocator();00132     <span class="keyword">static</span> dbExprNodeAllocator instance;00133 };00134 00135 <span class="keyword">class </span>FASTDB_DLL_ENTRY dbExprNode { 00136     <span class="keyword">friend</span> <span class="keyword">class </span>dbExprNodeSegment;00137   <span class="keyword">public</span>:00138     nat1 cop;00139     nat1 type;00140     nat2 offs;00141 00142     <span class="keyword">static</span> <span class="keyword">const</span> nat1  nodeTypes[];00143     <span class="keyword">static</span> <span class="keyword">const</span> nat1  nodeOperands[];00144     <span class="keyword">static</span> <span class="keyword">const</span> nat1  commutativeOperator[];00145 00146     <span class="keyword">union </span>{ 00147         dbExprNode*  operand[3];00148         dbExprNode*  next;00149         oid_t        oid;00150         db_int8      ivalue;00151         real8        fvalue;00152         dbStrLiteral svalue;00153         <span class="keywordtype">void</span> <span class="keyword">const</span>*  var;00154 00155         <span class="keyword">struct </span>{ 00156             dbExprNode*         base;  <span class="comment">// the same as operand[0]</span>00157             <a class="code" href="classdbFieldDescriptor.html">dbFieldDescriptor</a>*  field;00158         } ref;00159 00160         <span class="keyword">struct </span>{ 00161             dbExprNode*         arg[3]; 00162             <span class="keywordtype">void</span>*               fptr;00163         } func;00164     };00165 00166     dbExprNode(dbExprNode* node);00167 00168     dbExprNode(<span class="keywordtype">int</span> cop, dbExprNode* left = NULL, dbExprNode* right = NULL, 00169                dbExprNode* right2 = NULL)00170     {00171         this-&gt;cop = cop;00172         type = nodeTypes[cop];00173         operand[0] = left;00174         operand[1] = right;00175         operand[2] = right2;00176     }00177     dbExprNode(<span class="keywordtype">int</span> cop, dbExprNode* expr1, dbExprNode* expr2, <span class="keywordtype">int</span> offs) { 00178         this-&gt;cop = cop;00179         this-&gt;offs = (nat2)offs;00180         type = nodeTypes[cop];00181         operand[0] = expr1;00182         operand[1] = expr2;00183     }00184     dbExprNode(<span class="keywordtype">int</span> cop, dbExprNode* expr, <span class="keywordtype">int</span> offs) { 00185         this-&gt;cop = cop;00186         this-&gt;offs = (nat2)offs;00187         type = nodeTypes[cop];00188         operand[0] = expr;00189     }00190     dbExprNode(<span class="keywordtype">int</span> cop, <a class="code" href="classdbFieldDescriptor.html">dbFieldDescriptor</a>* field, dbExprNode* base = NULL) 00191     {00192         this-&gt;cop = cop;00193         this-&gt;offs = (nat2)field-&gt;<a class="code" href="classdbFieldDescriptor.html#dbFieldDescriptoro17">dbsOffs</a>;00194         type = nodeTypes[cop];00195         ref.field = field;00196         ref.base = base;00197     }00198     dbExprNode(<span class="keywordtype">int</span> cop, db_int8 ivalue) { 00199         this-&gt;cop = cop;00200         this-&gt;ivalue = ivalue;00201         type = tpInteger;00202     }00203     dbExprNode(<span class="keywordtype">int</span> cop, real8 fvalue) { 00204         this-&gt;cop = cop;00205         this-&gt;fvalue = fvalue;00206         type = tpReal;00207     }00208     dbExprNode(<span class="keywordtype">int</span> cop, dbStrLiteral&amp; svalue) { 00209         this-&gt;cop = cop;00210         this-&gt;svalue = svalue;00211         type = tpString;00212     }00213     dbExprNode(<span class="keywordtype">int</span> cop, <span class="keywordtype">void</span> <span class="keyword">const</span>* var) { 00214         this-&gt;cop = cop;00215         this-&gt;var = var;00216         type = nodeTypes[cop];00217     }00218     dbExprNode(<span class="keywordtype">int</span> cop, <span class="keywordtype">void</span>* fptr, dbExprNode* expr1, dbExprNode* expr2 = NULL, dbExprNode* expr3 = NULL) { 00219         this-&gt;cop = cop;00220         func.arg[0] = expr1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -