summaryrefslogtreecommitdiffstats
path: root/ue4/doxygen/cinstruction_8h-source.html
diff options
context:
space:
mode:
authormanuel <manuel@nc8430.lan>2009-05-30 16:32:43 +0200
committermanuel <manuel@nc8430.lan>2009-05-30 16:32:43 +0200
commitdcd1c9a6e1fbb7462db67a15b9e0dfd22d4f6a4f (patch)
tree31f5d51eefc95ed8ad71ddfc51eec6476c99165b /ue4/doxygen/cinstruction_8h-source.html
parent9d0b2d638db0f3d1f5b7ec46912c367adefbf91e (diff)
downloadooprog-dcd1c9a6e1fbb7462db67a15b9e0dfd22d4f6a4f.tar.gz
ooprog-dcd1c9a6e1fbb7462db67a15b9e0dfd22d4f6a4f.tar.bz2
ooprog-dcd1c9a6e1fbb7462db67a15b9e0dfd22d4f6a4f.zip
adding doxygen
Diffstat (limited to 'ue4/doxygen/cinstruction_8h-source.html')
-rw-r--r--ue4/doxygen/cinstruction_8h-source.html136
1 files changed, 136 insertions, 0 deletions
diff --git a/ue4/doxygen/cinstruction_8h-source.html b/ue4/doxygen/cinstruction_8h-source.html
new file mode 100644
index 0000000..2026b0e
--- /dev/null
+++ b/ue4/doxygen/cinstruction_8h-source.html
@@ -0,0 +1,136 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mycpu: mycpu/cinstruction.h Source File</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.3 -->
8<div class="tabs">
9 <ul>
10 <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11 <li><a href="annotated.html"><span>Classes</span></a></li>
12 <li class="current"><a href="files.html"><span>Files</span></a></li>
13 </ul>
14</div>
15<h1>mycpu/cinstruction.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
16<a name="l00008"></a>00008 <span class="preprocessor">#ifndef CINSTRUCTION_H</span>
17<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define CINSTRUCTION_H 1</span>
18<a name="l00010"></a>00010 <span class="preprocessor"></span>
19<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;iostream&gt;</span>
20<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;list&gt;</span>
21<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;sstream&gt;</span>
22<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;boost/lexical_cast.hpp&gt;</span>
23<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;assert.h&gt;</span>
24<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
25<a name="l00017"></a>00017
26<a name="l00023"></a><a class="code" href="classCInstructionError.html">00023</a> <span class="keyword">class </span><a class="code" href="classCInstructionError.html">CInstructionError</a>
27<a name="l00024"></a>00024 : <span class="keyword">public</span> std::invalid_argument
28<a name="l00025"></a>00025 {
29<a name="l00026"></a>00026 <span class="keyword">public</span>:
30<a name="l00037"></a><a class="code" href="classCInstructionError.html#c37becef1c3689b6917759d849ad23e2">00037</a> <a class="code" href="classCInstructionError.html#c37becef1c3689b6917759d849ad23e2" title="Default exception ctor.">CInstructionError</a>(<span class="keyword">const</span> std::string&amp; what)
31<a name="l00038"></a>00038 : std::invalid_argument(what)
32<a name="l00039"></a>00039 {}
33<a name="l00040"></a>00040 };
34<a name="l00041"></a>00041
35<a name="l00042"></a>00042 <span class="preprocessor">#include "ccpu.h"</span>
36<a name="l00043"></a>00043
37<a name="l00044"></a>00044 <span class="comment">/* forward declare CCPU */</span>
38<a name="l00045"></a>00045 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
39<a name="l00046"></a>00046 <span class="keyword">class </span><a class="code" href="classCCPU.html">CCPU</a>;
40<a name="l00047"></a>00047
41<a name="l00053"></a>00053 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
42<a name="l00054"></a><a class="code" href="classCInstruction.html">00054</a> <span class="keyword">class </span><a class="code" href="classCInstruction.html">CInstruction</a>
43<a name="l00055"></a>00055 {
44<a name="l00056"></a>00056 <span class="keyword">public</span>:
45<a name="l00067"></a><a class="code" href="classCInstruction.html#0bdc94fd4728d4035e1f13923376e450">00067</a> <a class="code" href="classCInstruction.html#0bdc94fd4728d4035e1f13923376e450" title="Default ctor.">CInstruction</a>(std::string name)
46<a name="l00068"></a>00068 : <a class="code" href="classCInstruction.html#18a74815caf3645a3368d185d38bf9bc">m_name</a>(name)
47<a name="l00069"></a>00069 {}
48<a name="l00070"></a>00070
49<a name="l00081"></a><a class="code" href="classCInstruction.html#ca5a5edd9b94718f1eb37b4269ade54e">00081</a> <span class="keyword">virtual</span> <a class="code" href="classCInstruction.html#ca5a5edd9b94718f1eb37b4269ade54e" title="Default dtor.">~CInstruction</a>()
50<a name="l00082"></a>00082 {}
51<a name="l00083"></a>00083
52<a name="l00094"></a><a class="code" href="classCInstruction.html#a62545e40a91e8f7b301ffdeaff7d04f">00094</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classCInstruction.html#a62545e40a91e8f7b301ffdeaff7d04f" title="implementation of operator ==">operator==</a>(std::string&amp; name)
53<a name="l00095"></a>00095 {
54<a name="l00096"></a>00096 <span class="keywordflow">return</span> name == <a class="code" href="classCInstruction.html#18a74815caf3645a3368d185d38bf9bc">m_name</a>;
55<a name="l00097"></a>00097 }
56<a name="l00098"></a>00098
57<a name="l00109"></a><a class="code" href="classCInstruction.html#334cc56829717b5946b9b42324aa26fe">00109</a> <span class="keyword">virtual</span> <a class="code" href="classCInstruction.html">CInstruction</a>&amp; <a class="code" href="classCInstruction.html#334cc56829717b5946b9b42324aa26fe" title="implementation of operator (CCPU)">operator()</a>(<a class="code" href="classCCPU.html">CCPU&lt;T&gt;</a> *cpu)
58<a name="l00110"></a>00110 {
59<a name="l00111"></a>00111 <a class="code" href="classCInstruction.html#7732a6024a2329d5d3f82b3093be42eb" title="executes the instruction">execute</a>(cpu);
60<a name="l00112"></a>00112 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
61<a name="l00113"></a>00113 }
62<a name="l00114"></a>00114
63<a name="l00125"></a><a class="code" href="classCInstruction.html#b240d30bea3acf8d4150f1a5b5f766ef">00125</a> <span class="keyword">virtual</span> <span class="keyword">const</span> std::string&amp; <a class="code" href="classCInstruction.html#b240d30bea3acf8d4150f1a5b5f766ef" title="returns instruction name">getName</a>()
64<a name="l00126"></a>00126 {
65<a name="l00127"></a>00127 <span class="keywordflow">return</span> <a class="code" href="classCInstruction.html#18a74815caf3645a3368d185d38bf9bc">m_name</a>;
66<a name="l00128"></a>00128 }
67<a name="l00129"></a>00129
68<a name="l00140"></a><a class="code" href="classCInstruction.html#4338f7ce91bca9c6bbcceb83a3212068">00140</a> <span class="keyword">virtual</span> std::ostream&amp; <a class="code" href="classCInstruction.html#4338f7ce91bca9c6bbcceb83a3212068" title="dumps information about instruction to outputstream">dump</a>(std::ostream&amp; stream)
69<a name="l00141"></a>00141 {
70<a name="l00142"></a>00142 stream &lt;&lt; <a class="code" href="classCInstruction.html#18a74815caf3645a3368d185d38bf9bc">m_name</a>;
71<a name="l00143"></a>00143 <span class="keywordflow">return</span> stream;
72<a name="l00144"></a>00144 }
73<a name="l00145"></a>00145
74<a name="l00157"></a><a class="code" href="classCInstruction.html#7651b4c147411bca34a0393adf03507d">00157</a> <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classCInstruction.html#7651b4c147411bca34a0393adf03507d" title="Shift/output operator for outputstream.">operator&lt;&lt;</a>(std::ostream&amp; stream, <a class="code" href="classCInstruction.html">CInstruction</a>&amp; instr)
75<a name="l00158"></a>00158 {
76<a name="l00159"></a>00159 <span class="keywordflow">return</span> instr.<a class="code" href="classCInstruction.html#4338f7ce91bca9c6bbcceb83a3212068" title="dumps information about instruction to outputstream">dump</a>(stream);
77<a name="l00160"></a>00160 }
78<a name="l00161"></a>00161
79<a name="l00172"></a>00172 <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &amp;quot;R1&amp;quot;)">parseRegister</a>(<span class="keyword">const</span> std::string&amp; str);
80<a name="l00173"></a>00173
81<a name="l00186"></a>00186 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">checkRegister</a>(<a class="code" href="classCCPU.html">CCPU&lt;T&gt;</a> *cpu, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> regidx);
82<a name="l00187"></a>00187
83<a name="l00198"></a>00198 <span class="keyword">virtual</span> <a class="code" href="classCInstruction.html">CInstruction</a> *<a class="code" href="classCInstruction.html#3362efb71ca3d9237c66952201564027" title="creates a new instance of this instruction">factory</a>() = 0;
84<a name="l00199"></a>00199
85<a name="l00211"></a>00211 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCInstruction.html#caab509da9dd1f300293d6fa5501049a" title="parses instruction parameters and prepares the instruction for executing">compile</a>(std::list&lt;std::string&gt;&amp; params) = 0;
86<a name="l00212"></a>00212
87<a name="l00223"></a>00223 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCInstruction.html#7732a6024a2329d5d3f82b3093be42eb" title="executes the instruction">execute</a>(<a class="code" href="classCCPU.html">CCPU&lt;T&gt;</a> *cpu) = 0;
88<a name="l00224"></a>00224
89<a name="l00225"></a>00225 <span class="keyword">protected</span>:
90<a name="l00226"></a>00226 <span class="comment">/* members */</span>
91<a name="l00228"></a><a class="code" href="classCInstruction.html#18a74815caf3645a3368d185d38bf9bc">00228</a> std::string <a class="code" href="classCInstruction.html#18a74815caf3645a3368d185d38bf9bc">m_name</a>;
92<a name="l00229"></a>00229 };
93<a name="l00230"></a>00230
94<a name="l00231"></a>00231 <span class="comment">/*----------------------------------------------------------------------------*/</span>
95<a name="l00232"></a>00232
96<a name="l00233"></a>00233 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
97<a name="l00234"></a><a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e">00234</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <a class="code" href="classCInstruction.html#70bbbf095733b8e51ea43597d082445e" title="parses register syntax Rx (e.g. &amp;quot;R1&amp;quot;)">CInstruction&lt;T&gt;::parseRegister</a>(<span class="keyword">const</span> std::string&amp; str)
98<a name="l00235"></a>00235 {
99<a name="l00236"></a>00236 <span class="keywordtype">unsigned</span> reg;
100<a name="l00237"></a>00237 <span class="keywordflow">if</span> (str.length() &lt; 2 || str[0] != <span class="charliteral">'r'</span>)
101<a name="l00238"></a>00238 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid syntax of register"</span>);
102<a name="l00239"></a>00239
103<a name="l00240"></a>00240 <span class="keywordflow">try</span>
104<a name="l00241"></a>00241 {
105<a name="l00242"></a>00242 reg = boost::lexical_cast&lt;<span class="keywordtype">unsigned</span>&gt;(str.substr(1));
106<a name="l00243"></a>00243 }
107<a name="l00244"></a>00244 <span class="keywordflow">catch</span>(boost::bad_lexical_cast&amp; ex)
108<a name="l00245"></a>00245 {
109<a name="l00246"></a>00246 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(<span class="stringliteral">"Invalid syntax of register"</span>);
110<a name="l00247"></a>00247 }
111<a name="l00248"></a>00248
112<a name="l00249"></a>00249 <span class="keywordflow">return</span> reg;
113<a name="l00250"></a>00250 }
114<a name="l00251"></a>00251
115<a name="l00252"></a>00252 <span class="comment">/*----------------------------------------------------------------------------*/</span>
116<a name="l00253"></a>00253
117<a name="l00254"></a>00254 <span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt;
118<a name="l00255"></a><a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b">00255</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classCInstruction.html#a03c72bae5244d808f5c045d2dc26f3b" title="performs a register boundary check does the register exist in cpu?">CInstruction&lt;T&gt;::checkRegister</a>(<a class="code" href="classCCPU.html">CCPU&lt;T&gt;</a> *cpu, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> regidx)
119<a name="l00256"></a>00256 {
120<a name="l00257"></a>00257 assert(cpu != NULL);
121<a name="l00258"></a>00258 <span class="keywordflow">if</span> (regidx &gt;= cpu-&gt;<a class="code" href="classCCPU.html#77eca5c67c741c8ff6c9bd298c5fe1b7" title="get number of registers">getRegisterCount</a>())
122<a name="l00259"></a>00259 {
123<a name="l00260"></a>00260 std::stringstream sstr;
124<a name="l00261"></a>00261 sstr &lt;&lt; <span class="stringliteral">"Register R"</span> &lt;&lt; regidx &lt;&lt; <span class="stringliteral">" doesn't exist (out of bound)"</span>;
125<a name="l00262"></a>00262 <span class="keywordflow">throw</span> <a class="code" href="classCInstructionError.html">CInstructionError</a>(sstr.str());
126<a name="l00263"></a>00263 }
127<a name="l00264"></a>00264 }
128<a name="l00265"></a>00265
129<a name="l00266"></a>00266 <span class="preprocessor">#endif</span>
130<a name="l00267"></a>00267 <span class="preprocessor"></span>
131<a name="l00268"></a>00268 <span class="comment">/* vim: set et sw=2 ts=2: */</span>
132</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sat May 30 16:32:35 2009 for mycpu by&nbsp;
133<a href="http://www.doxygen.org/index.html">
134<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
135</body>
136</html>