mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-01-05 20:26:32 +00:00
1b75d91002
Add arg to SATARep to specify drive types to show. Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
1438 lines
176 KiB
HTML
Executable file
1438 lines
176 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.13">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF9>CHashClass</span><span class=cF0> *</span><span class=cFD>ParseClass</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> keyword, </span><span class=cF9>I64</span><span class=cF0> fsp_flags, </span><span class=cF1>Bool</span><span class=cF0> is_extern)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc, *base_class;
|
|
<a name="l4"></a>
|
|
<a name="l5"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l6"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
|
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (is_extern)
|
|
<a name="l8"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l9"></a> tmpc = </span><span class=cFD>ParseClassNew</span><span class=cF0>;
|
|
<a name="l10"></a> tmpc->str = cc->cur_str;
|
|
<a name="l11"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l12"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpc, cc->htc.global_hash_table);
|
|
<a name="l13"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l14"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc, tmpc);
|
|
<a name="l15"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l20"></a> tmpc = </span><span class=cF5>HashFind</span><span class=cF0>(cc->cur_str, cc->htc.global_hash_table, </span><span class=cF3>HTT_CLASS</span><span class=cF0>);
|
|
<a name="l21"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l22"></a> tmpc = </span><span class=cF5>HashSingleTableFind</span><span class=cF0>(cc->cur_str, cc->htc.global_hash_table, </span><span class=cF3>HTT_CLASS</span><span class=cF0>);
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc)
|
|
<a name="l24"></a> {
|
|
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpc->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l26"></a> tmpc = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l27"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->use_count < </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l28"></a> </span><span class=cFD>UnusedExternWarning</span><span class=cF0>(cc, tmpc);
|
|
<a name="l29"></a> }
|
|
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc)
|
|
<a name="l31"></a> {
|
|
<a name="l32"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpc->src_link);
|
|
<a name="l33"></a> tmpc->src_link = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l34"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpc->idx);
|
|
<a name="l35"></a> tmpc->idx = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l36"></a> }
|
|
<a name="l37"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l38"></a> {
|
|
<a name="l39"></a> tmpc = </span><span class=cFD>ParseClassNew</span><span class=cF0>;
|
|
<a name="l40"></a> tmpc->str = cc->cur_str;
|
|
<a name="l41"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l42"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpc, cc->htc.global_hash_table);
|
|
<a name="l43"></a> }
|
|
<a name="l44"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&tmpc->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (fsp_flags & </span><span class=cF3>FSF_PUBLIC</span><span class=cF0>)
|
|
<a name="l46"></a> tmpc->type |= </span><span class=cF3>HTF_PUBLIC</span><span class=cF0>;
|
|
<a name="l47"></a> tmpc->use_count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (cc->last_U16 == </span><span class=cF6>'\n'</span><span class=cF0>)
|
|
<a name="l49"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc, tmpc, -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l50"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l51"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc, tmpc,</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l53"></a> {
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>base_class = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>base_class->type & </span><span class=cF3>HTT_CLASS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l55"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l57"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Only one base class allowed at this time at "</span><span class=cF0>);
|
|
<a name="l58"></a> tmpc->base_class = base_class;
|
|
<a name="l59"></a> tmpc->size += base_class->size;
|
|
<a name="l60"></a> }
|
|
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (keyword == </span><span class=cF3>KW_UNION</span><span class=cF0>)
|
|
<a name="l62"></a> </span><span class=cFD>ParseVarList</span><span class=cF0>(cc, tmpc, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_CLASS</span><span class=cF0> | </span><span class=cF3>PRSF_UNION</span><span class=cF0>);
|
|
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l64"></a> </span><span class=cFD>ParseVarList</span><span class=cF0>(cc, tmpc, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_CLASS</span><span class=cF0>);
|
|
<a name="l65"></a> tmpc->size += tmpc->neg_offset;
|
|
<a name="l66"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF1>return</span><span class=cF0> tmpc;
|
|
<a name="l68"></a>}
|
|
<a name="l69"></a>
|
|
<a name="l70"></a></span><span class=cF9>CHashFun</span><span class=cF0> *</span><span class=cFD>ParseFunJoin</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CHashClass</span><span class=cF0> *tmp_return, </span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF9>I64</span><span class=cF0> fsp_flags)
|
|
<a name="l71"></a>{
|
|
<a name="l72"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm, *header_list;
|
|
<a name="l73"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc = cc->aotc;
|
|
<a name="l74"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *header_return;
|
|
<a name="l75"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf;
|
|
<a name="l76"></a> </span><span class=cF9>I64</span><span class=cF0> header_arg_count;
|
|
<a name="l77"></a>
|
|
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (name)
|
|
<a name="l79"></a> </span><span class=cF7>{</span><span class=cF2>//if not fun_ptr</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l81"></a> {
|
|
<a name="l82"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmpf = </span><span class=cF5>HashFind</span><span class=cF0>(name, cc->htc.global_hash_table, </span><span class=cF3>HTT_FUN</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> && tmpf->type & </span><span class=cF3>HTF_IMPORT</span><span class=cF0>)
|
|
<a name="l83"></a> tmpf=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l84"></a> }
|
|
<a name="l85"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmpf = </span><span class=cF5>HashSingleTableFind</span><span class=cF0>(name, cc->htc.global_hash_table, </span><span class=cF3>HTT_FUN</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l87"></a> tmpf = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf && tmpf->use_count < </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l89"></a> </span><span class=cFD>UnusedExternWarning</span><span class=cF0>(cc, tmpf);
|
|
<a name="l90"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l91"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l92"></a> tmpf = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf)
|
|
<a name="l94"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l95"></a> tmpf->used_reg_mask = </span><span class=cF3>REGG_CLOBBERED</span><span class=cF0> + </span><span class=cF3>REGG_SAVED</span><span class=cF0> + </span><span class=cF3>REGG_STACK_TMP</span><span class=cF0>;
|
|
<a name="l96"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf->src_link);
|
|
<a name="l97"></a> tmpf->src_link = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l98"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf->idx);
|
|
<a name="l99"></a> tmpf->idx = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF5>Free</span><span class=cF0>(name);
|
|
<a name="l101"></a> header_arg_count = tmpf->arg_count;
|
|
<a name="l102"></a> header_list = tmpf->member_list_and_root;
|
|
<a name="l103"></a> header_return = tmpf->return_class;
|
|
<a name="l104"></a> tmpf->member_list_and_root = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l105"></a> </span><span class=cF5>ClassMemberListDel</span><span class=cF0>(tmpf);
|
|
<a name="l106"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l107"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l108"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l109"></a> tmpf = </span><span class=cFD>ParseFunNew</span><span class=cF0>;
|
|
<a name="l110"></a> header_return = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l111"></a> tmpf->used_reg_mask = </span><span class=cF3>REGG_CLOBBERED</span><span class=cF0> + </span><span class=cF3>REGG_SAVED</span><span class=cF0> + </span><span class=cF3>REGG_STACK_TMP</span><span class=cF0>;
|
|
<a name="l112"></a> tmpf->clobbered_reg_mask = </span><span class=cF3>REGG_CLOBBERED</span><span class=cF0> + </span><span class=cF3>REGG_STACK_TMP</span><span class=cF0>;
|
|
<a name="l113"></a> tmpf->str = name;
|
|
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l115"></a> tmpf->exe_addr = aotc->rip;
|
|
<a name="l116"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l117"></a> tmpf->exe_addr = &</span><span class=cFD>UndefinedExtern</span><span class=cF0>;
|
|
<a name="l118"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l119"></a> tmpf->flags |= fsp_flags & </span><span class=cF3>FSG_FUN_FLAGS1</span><span class=cF0>;
|
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (name) </span><span class=cF2>//if not fun_ptr</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpf, cc->htc.global_hash_table);
|
|
<a name="l122"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l123"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&tmpf->type, </span><span class=cF3>HTf_PUBLIC</span><span class=cF0>, fsp_flags & </span><span class=cF3>FSF_PUBLIC</span><span class=cF0>);
|
|
<a name="l124"></a> tmpf->return_class = tmp_return;
|
|
<a name="l125"></a> tmpf->use_count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l126"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc, tmpf);
|
|
<a name="l127"></a> </span><span class=cFD>ParseVarList</span><span class=cF0>(cc, tmpf, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_FUN_ARG</span><span class=cF0>);
|
|
<a name="l128"></a> tmpf->arg_count = tmpf->member_count;
|
|
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> < tmpf->arg_count << </span><span class=cFE>3</span><span class=cF0> <= </span><span class=cF3>I16_MAX</span><span class=cF0> && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Ff_DOT_DOT_DOT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l130"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Ff_RET1</span><span class=cF0>);
|
|
<a name="l131"></a> tmpm = tmpf->member_list_and_root;
|
|
<a name="l132"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm)
|
|
<a name="l133"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l134"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0> += </span><span class=cFE>16</span><span class=cF0>; </span><span class=cF2>//RBP+RETURN</span><span class=cF0>
|
|
<a name="l135"></a> tmpm = tmpm->next;
|
|
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l137"></a> tmpf->size = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (header_return)
|
|
<a name="l139"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>OptionGet</span><span class=cF7>(</span><span class=cF3>OPTf_WARN_HEADER_MISMATCH</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l141"></a> {
|
|
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf->return_class != header_return)
|
|
<a name="l143"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l144"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Fun Header return mismatch '%s'\n"</span><span class=cF0>, tmpf->str);
|
|
<a name="l145"></a> cc->warning_count++;
|
|
<a name="l146"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>MemberListCmp</span><span class=cF7>(</span><span class=cF0>tmpf->member_list_and_root, header_list, header_arg_count</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l148"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l149"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Fun header args mismatch '%s'\n"</span><span class=cF0>, tmpf->str);
|
|
<a name="l150"></a> cc->warning_count++;
|
|
<a name="l151"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l152"></a> }
|
|
<a name="l153"></a> </span><span class=cF5>MemberListDel</span><span class=cF0>(header_list);
|
|
<a name="l154"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l155"></a>
|
|
<a name="l156"></a> </span><span class=cF1>return</span><span class=cF0> tmpf;
|
|
<a name="l157"></a>}
|
|
<a name="l158"></a>
|
|
<a name="l159"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseFun</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CHashClass</span><span class=cF0> *tmp_return, </span><span class=cF1>U8</span><span class=cF0> *name, </span><span class=cF9>I64</span><span class=cF0> fsp_flags)
|
|
<a name="l160"></a>{
|
|
<a name="l161"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm;
|
|
<a name="l162"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *saved_leave_label;
|
|
<a name="l163"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, size, *r;
|
|
<a name="l164"></a> </span><span class=cF1>Bool</span><span class=cF0> old_trace;
|
|
<a name="l165"></a>
|
|
<a name="l166"></a> cc->fun_lex_file = cc->lex_include_stack;
|
|
<a name="l167"></a> cc->min_line=cc->max_line = cc->lex_include_stack->line_num;
|
|
<a name="l168"></a>
|
|
<a name="l169"></a> cc->flags &= ~</span><span class=cF3>CCF_NO_REG_OPT</span><span class=cF0>;
|
|
<a name="l170"></a> cc->htc.local_var_list = cc->htc.fun = </span><span class=cFD>ParseFunJoin</span><span class=cF0>(cc, tmp_return, name, fsp_flags);
|
|
<a name="l171"></a>
|
|
<a name="l172"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l173"></a> </span><span class=cF5>Btr</span><span class=cF0>(&cc->flags, </span><span class=cF3>CCf_PASS_TRACE_PRESENT</span><span class=cF0>);
|
|
<a name="l174"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l175"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ENTER</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l176"></a> saved_leave_label = cc->lb_leave;
|
|
<a name="l177"></a> cc->lb_leave = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l178"></a> cc->flags &= ~</span><span class=cF3>CCF_HAS_RETURN</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc,,, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l180"></a>
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (cc->max_line < cc->min_line)
|
|
<a name="l182"></a> cc->max_line = cc->min_line;
|
|
<a name="l183"></a>
|
|
<a name="l184"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun->return_class->size && !</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_HAS_RETURN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l185"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc, </span><span class=cF6>"Function should return val "</span><span class=cF0>);
|
|
<a name="l186"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, cc->lb_leave, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l187"></a> cc->lb_leave = saved_leave_label;
|
|
<a name="l188"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LEAVE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, cc->htc.fun->return_class);
|
|
<a name="l189"></a> cc->htc.fun->size &= ~</span><span class=cFE>7</span><span class=cF0>;
|
|
<a name="l190"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l191"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l192"></a> cc->htc.fun->exe_addr = cc->aotc->rip;
|
|
<a name="l193"></a> cc->htc.fun->type |= </span><span class=cF3>HTF_EXPORT</span><span class=cF0> | </span><span class=cF3>HTF_RESOLVE</span><span class=cF0>;
|
|
<a name="l194"></a> r = </span><span class=cFD>COCCompile</span><span class=cF0>(cc, &size, &cc->htc.fun->debug_info, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (r)
|
|
<a name="l196"></a> {
|
|
<a name="l197"></a> j = (size + </span><span class=cFE>7</span><span class=cF0>) >> </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l198"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < j; i++)
|
|
<a name="l199"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc, r[i]);
|
|
<a name="l200"></a> </span><span class=cF5>Free</span><span class=cF0>(r);
|
|
<a name="l201"></a> }
|
|
<a name="l202"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l203"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l204"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l205"></a> old_trace = </span><span class=cF5>Btr</span><span class=cF0>(&cc->opts, </span><span class=cF3>OPTf_TRACE</span><span class=cF0>);
|
|
<a name="l206"></a> cc->htc.fun->exe_addr = </span><span class=cFD>COCCompile</span><span class=cF0>(cc, &size, &cc->htc.fun->debug_info, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (old_trace)
|
|
<a name="l208"></a> {
|
|
<a name="l209"></a> </span><span class=cF5>Bts</span><span class=cF0>(&cc->opts, </span><span class=cF3>OPTf_TRACE</span><span class=cF0>);
|
|
<a name="l210"></a> </span><span class=cF5>Un</span><span class=cF0>(cc->htc.fun->exe_addr, size, </span><span class=cFE>64</span><span class=cF0>);
|
|
<a name="l211"></a> }
|
|
<a name="l212"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(cc->htc.fun->str);
|
|
<a name="l213"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l214"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&cc->htc.fun->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l215"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l216"></a> tmpm = cc->htc.fun->member_list_and_root;
|
|
<a name="l217"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm)
|
|
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF3>MLF_NO_UNUSED_WARN</span><span class=cF0>)
|
|
<a name="l220"></a> {
|
|
<a name="l221"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->use_count > </span><span class=cFE>1</span><span class=cF0> && </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>tmpm->str, </span><span class=cF6>"_anon_"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l222"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Unneeded no_warn\n $LK,\"FL:%s,%d\"$ '%s' in '%s'\n"</span><span class=cF0>,
|
|
<a name="l223"></a> cc->lex_include_stack->full_name, cc->lex_include_stack->line_num, tmpm->str, cc->htc.fun->str);
|
|
<a name="l224"></a> }
|
|
<a name="l225"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!tmpm->use_count && </span><span class=cF5>OptionGet</span><span class=cF7>(</span><span class=cF3>OPTf_WARN_UNUSED_VAR</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l226"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Unused var\n $LK,\"FL:%s,%d\"$ '%s' in '%s'\n"</span><span class=cF0>,
|
|
<a name="l227"></a> cc->lex_include_stack->full_name, cc->lex_include_stack->line_num, tmpm->str, cc->htc.fun->str);
|
|
<a name="l228"></a> tmpm = tmpm->next;
|
|
<a name="l229"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l230"></a> cc->htc.local_var_list = cc->htc.fun=cc->fun_lex_file = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l231"></a>}
|
|
<a name="l232"></a>
|
|
<a name="l233"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> saved_mode, </span><span class=cF9>CHashClass</span><span class=cF0> *saved_tmpc, </span><span class=cF9>I64</span><span class=cF0> saved_val, </span><span class=cF9>I64</span><span class=cF0> fsp_flags)
|
|
<a name="l234"></a>{
|
|
<a name="l235"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, mode, k, val;
|
|
<a name="l236"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
|
<a name="l237"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
|
|
<a name="l238"></a> </span><span class=cF9>CHashGlobalVar</span><span class=cF0> *tmpg;
|
|
<a name="l239"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc = cc->aotc;
|
|
<a name="l240"></a> </span><span class=cF9>CAOTHeapGlobal</span><span class=cF0> *tmphg;
|
|
<a name="l241"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
|
|
<a name="l242"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf, *tmpf_fun_ptr;
|
|
<a name="l243"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> tmpad;
|
|
<a name="l244"></a> </span><span class=cF1>Bool</span><span class=cF0> has_alias, undef_array_size, is_array;
|
|
<a name="l245"></a>
|
|
<a name="l246"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l247"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l248"></a> tmpc = </span><span class=cFD>ParseType</span><span class=cF0>(cc, &saved_tmpc, &saved_mode, </span><span class=cF3>NULL</span><span class=cF0>, &st, &tmpf_fun_ptr, &tmpex, &tmpad, fsp_flags);
|
|
<a name="l249"></a>
|
|
<a name="l250"></a> </span><span class=cF1>if</span><span class=cF0> (!st)
|
|
<a name="l251"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad.next)
|
|
<a name="l253"></a> is_array = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l254"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpad.total_count < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l255"></a> {
|
|
<a name="l256"></a> is_array = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l257"></a> tmpc--;
|
|
<a name="l258"></a> }
|
|
<a name="l259"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l260"></a> is_array = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l261"></a>
|
|
<a name="l262"></a> val = saved_val;
|
|
<a name="l263"></a> mode = saved_mode;
|
|
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0_EXTERN</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF7>)</span><span class=cF0> && tmpex->type & </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>)
|
|
<a name="l265"></a> {
|
|
<a name="l266"></a> val = tmpex->val;
|
|
<a name="l267"></a> mode = </span><span class=cF3>PRS0__EXTERN</span><span class=cF0> | </span><span class=cF3>PRS1_NOT_REALLY__EXTERN</span><span class=cF0>;
|
|
<a name="l268"></a> }
|
|
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l270"></a> {
|
|
<a name="l271"></a> </span><span class=cF1>switch</span><span class=cF0> (mode & </span><span class=cFE>255</span><span class=cF0>)
|
|
<a name="l272"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l273"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__INTERN</span><span class=cF0>:
|
|
<a name="l274"></a> tmpf = </span><span class=cFD>ParseFunJoin</span><span class=cF0>(cc, tmpc, st, fsp_flags);
|
|
<a name="l275"></a> tmpf->exe_addr = val;
|
|
<a name="l276"></a> </span><span class=cF5>Bts</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Ff_INTERNAL</span><span class=cF0>);
|
|
<a name="l277"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l278"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l279"></a>
|
|
<a name="l280"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__EXTERN</span><span class=cF0>:
|
|
<a name="l281"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>fsp_flags & </span><span class=cF3>FSF__</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>mode & </span><span class=cF3>PRS1_NOT_REALLY__EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l282"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting label with underscore at "</span><span class=cF0>);
|
|
<a name="l283"></a> tmpf = </span><span class=cFD>ParseFunJoin</span><span class=cF0>(cc, tmpc, st, fsp_flags);
|
|
<a name="l284"></a> tmpf->exe_addr = val;
|
|
<a name="l285"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(tmpf->str);
|
|
<a name="l286"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (saved_mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0__EXTERN</span><span class=cF0>)
|
|
<a name="l288"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Ff__EXTERN</span><span class=cF0>);
|
|
<a name="l289"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l290"></a> tmpf->type |= </span><span class=cF3>HTF_RESOLVE</span><span class=cF0>;
|
|
<a name="l291"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l292"></a>
|
|
<a name="l293"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_EXTERN</span><span class=cF0>:
|
|
<a name="l294"></a> </span><span class=cFD>ParseFunJoin</span><span class=cF0>(cc, tmpc, st, fsp_flags);
|
|
<a name="l295"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l296"></a>
|
|
<a name="l297"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>:
|
|
<a name="l298"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>fsp_flags & </span><span class=cF3>FSF__</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l299"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting label with underscore at "</span><span class=cF0>);
|
|
<a name="l300"></a>
|
|
<a name="l301"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_IMPORT</span><span class=cF0>:
|
|
<a name="l302"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l303"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"import not needed at "</span><span class=cF0>);
|
|
<a name="l304"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l305"></a> {
|
|
<a name="l306"></a> tmpf = </span><span class=cFD>ParseFunJoin</span><span class=cF0>(cc, tmpc, st, fsp_flags);
|
|
<a name="l307"></a> tmpf->type |= </span><span class=cF3>HTF_IMPORT</span><span class=cF0>;
|
|
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>)
|
|
<a name="l309"></a> tmpf->import_name = </span><span class=cF5>StrNew</span><span class=cF0>(val);
|
|
<a name="l310"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l311"></a> tmpf->import_name = </span><span class=cF5>StrNew</span><span class=cF0>(st);
|
|
<a name="l312"></a> }
|
|
<a name="l313"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l314"></a>
|
|
<a name="l315"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l316"></a> </span><span class=cFD>ParseFun</span><span class=cF0>(cc, tmpc, st, fsp_flags);
|
|
<a name="l317"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l318"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l319"></a> }
|
|
<a name="l320"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l321"></a> {
|
|
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad.total_count < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l323"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l324"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l325"></a> undef_array_size = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l326"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l327"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l328"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l329"></a> i = tmpad.total_count;
|
|
<a name="l330"></a> undef_array_size = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l331"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l332"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf_fun_ptr)
|
|
<a name="l333"></a> j = </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *);
|
|
<a name="l334"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l335"></a> j = tmpc->size;
|
|
<a name="l336"></a> j *= i;
|
|
<a name="l337"></a> has_alias = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l338"></a> tmphg = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l339"></a> </span><span class=cF1>switch</span><span class=cF0> (mode & </span><span class=cFE>255</span><span class=cF0>)
|
|
<a name="l340"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l341"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__EXTERN</span><span class=cF0>:
|
|
<a name="l342"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l343"></a> {
|
|
<a name="l344"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l345"></a> tmpg->data_addr_rip = val;
|
|
<a name="l346"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_EXPORT</span><span class=cF0>;
|
|
<a name="l347"></a> }
|
|
<a name="l348"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l349"></a> {
|
|
<a name="l350"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l351"></a> tmpg->data_addr = val;
|
|
<a name="l352"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>;
|
|
<a name="l353"></a> }
|
|
<a name="l354"></a> tmpg->flags |= </span><span class=cF3>GVF_ALIAS</span><span class=cF0>;
|
|
<a name="l355"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l356"></a>
|
|
<a name="l357"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>:
|
|
<a name="l358"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_IMPORT</span><span class=cF0>:
|
|
<a name="l359"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l360"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"import not needed at "</span><span class=cF0>);
|
|
<a name="l361"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l362"></a> {
|
|
<a name="l363"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l364"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_IMPORT</span><span class=cF0>;
|
|
<a name="l365"></a> </span><span class=cF1>if</span><span class=cF0> (mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>)
|
|
<a name="l366"></a> tmpg->import_name = </span><span class=cF5>StrNew</span><span class=cF0>(val);
|
|
<a name="l367"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l368"></a> tmpg->import_name = </span><span class=cF5>StrNew</span><span class=cF0>(st);
|
|
<a name="l369"></a> }
|
|
<a name="l370"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l371"></a>
|
|
<a name="l372"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_EXTERN</span><span class=cF0>:
|
|
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l374"></a> {
|
|
<a name="l375"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l376"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>;
|
|
<a name="l377"></a> }
|
|
<a name="l378"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l379"></a> {
|
|
<a name="l380"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l381"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0>;
|
|
<a name="l382"></a> }
|
|
<a name="l383"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l384"></a>
|
|
<a name="l385"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l386"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l387"></a> {
|
|
<a name="l388"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->opts, </span><span class=cF3>OPTf_GLOBALS_ON_DATA_HEAP</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l389"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'='</span><span class=cF0>)
|
|
<a name="l390"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Can't init global var on data heap in AOT module "</span><span class=cF0>);
|
|
<a name="l391"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l392"></a> tmphg = tmpg->heap_global=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTHeapGlobal</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l393"></a> tmphg->size = j;
|
|
<a name="l394"></a> tmphg->str = </span><span class=cF5>StrNew</span><span class=cF0>(st);
|
|
<a name="l395"></a> tmphg->next = aotc->heap_globals;
|
|
<a name="l396"></a> aotc->heap_globals = tmphg;
|
|
<a name="l397"></a> tmpg->flags = </span><span class=cF3>GVF_DATA_HEAP</span><span class=cF0>;
|
|
<a name="l398"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>; </span><span class=cF2>//TODO: HTF_EXPORT</span><span class=cF0>
|
|
<a name="l399"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && tmpex->type & </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>) </span><span class=cF2>//TODO!! extern</span><span class=cF0>
|
|
<a name="l400"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Feature not implemented "</span><span class=cF0>);
|
|
<a name="l401"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l402"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l403"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l404"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l405"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'='</span><span class=cF0>)
|
|
<a name="l406"></a> tmpg->data_addr = </span><span class=cF5>CAlloc</span><span class=cF0>(j);
|
|
<a name="l407"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->size >= </span><span class=cFE>8</span><span class=cF0>) </span><span class=cF2>//align</span><span class=cF0>
|
|
<a name="l408"></a> </span><span class=cF1>while</span><span class=cF0> (aotc->rip & </span><span class=cFE>7</span><span class=cF0>)
|
|
<a name="l409"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l410"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->size == </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l411"></a> </span><span class=cF1>while</span><span class=cF0> (aotc->rip & </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l412"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l413"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->size == </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l414"></a> </span><span class=cF1>while</span><span class=cF0> (aotc->rip & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l415"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l416"></a> tmpg->data_addr_rip = aotc->rip;
|
|
<a name="l417"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_EXPORT</span><span class=cF0>;
|
|
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && tmpex->type & </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>)
|
|
<a name="l419"></a> has_alias = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l420"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k < j; k++)
|
|
<a name="l421"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc, </span><span class=cFE>0</span><span class=cF0>); </span><span class=cF2>//Init AOT global to zero.</span><span class=cF0>
|
|
<a name="l422"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l423"></a> }
|
|
<a name="l424"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l425"></a> {
|
|
<a name="l426"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->opts, </span><span class=cF3>OPTf_GLOBALS_ON_DATA_HEAP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l427"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l428"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l429"></a> tmpg->data_addr = </span><span class=cF5>MAlloc</span><span class=cF0>(j);
|
|
<a name="l430"></a> tmpg->flags = </span><span class=cF3>GVF_DATA_HEAP</span><span class=cF0>;
|
|
<a name="l431"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l432"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l433"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l434"></a> tmpg = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l435"></a> tmpg->data_addr = </span><span class=cF5>MAlloc</span><span class=cF0>(j, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l436"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l437"></a> tmpg->type = </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>;
|
|
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && tmpex->type & </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0> && tmpex->type & </span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0> &&
|
|
<a name="l439"></a> </span><span class=cF5>MHeapCtrl</span><span class=cF7>(</span><span class=cF0>tmpex</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF5>MHeapCtrl</span><span class=cF7>(</span><span class=cF0>tmpg</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l440"></a> has_alias = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l441"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_var_init_flag</span><span class=cF0>)
|
|
<a name="l442"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpg->data_addr, </span><span class=cFB>sys_var_init_val</span><span class=cF0>, j);
|
|
<a name="l443"></a> }
|
|
<a name="l444"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l445"></a> tmpg->dim.next = tmpad.next;
|
|
<a name="l446"></a> </span><span class=cF1>if</span><span class=cF0> (fsp_flags & </span><span class=cF3>FSF_PUBLIC</span><span class=cF0>)
|
|
<a name="l447"></a> tmpg->type |= </span><span class=cF3>HTF_PUBLIC</span><span class=cF0>;
|
|
<a name="l448"></a> tmpg->var_class = tmpc;
|
|
<a name="l449"></a> tmpg->str = st;
|
|
<a name="l450"></a> tmpg->size = j;
|
|
<a name="l451"></a> tmpg->dim.total_count = i;
|
|
<a name="l452"></a> tmpg->use_count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l453"></a> </span><span class=cF1>if</span><span class=cF0> (cc->last_U16 == </span><span class=cF6>'\n'</span><span class=cF0>)
|
|
<a name="l454"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc, tmpg, -</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l455"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l456"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc, tmpg, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l457"></a> </span><span class=cF1>if</span><span class=cF0> (mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0_IMPORT</span><span class=cF0> || mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>)
|
|
<a name="l458"></a> tmpg->flags |= </span><span class=cF3>GVF_IMPORT</span><span class=cF0>;
|
|
<a name="l459"></a> </span><span class=cF1>if</span><span class=cF0> (mode & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>PRS0_EXTERN</span><span class=cF0>)
|
|
<a name="l460"></a> tmpg->flags |= </span><span class=cF3>GVF_EXTERN</span><span class=cF0>;
|
|
<a name="l461"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf_fun_ptr)
|
|
<a name="l462"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l463"></a> tmpg->fun_ptr = tmpf_fun_ptr;
|
|
<a name="l464"></a> tmpg->flags |= </span><span class=cF3>GVF_FUN</span><span class=cF0>;
|
|
<a name="l465"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (is_array)
|
|
<a name="l467"></a> tmpg->flags |= </span><span class=cF3>GVF_ARRAY</span><span class=cF0>;
|
|
<a name="l468"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpg, cc->htc.global_hash_table);
|
|
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>tmpg->flags & </span><span class=cF3>GVF_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l470"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(tmpg->str);
|
|
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'='</span><span class=cF0>)
|
|
<a name="l472"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l473"></a> </span><span class=cF1>if</span><span class=cF0> (undef_array_size)
|
|
<a name="l474"></a> {
|
|
<a name="l475"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l476"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l477"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l478"></a> </span><span class=cFD>ParseGlobalInit</span><span class=cF0>(cc, tmpg, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l479"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l480"></a> tmpg->size = tmpg->dim.total_count * tmpc->size;
|
|
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (tmphg)
|
|
<a name="l482"></a> tmphg->size = tmpg->size;
|
|
<a name="l483"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l484"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k < tmpg->size; k++)
|
|
<a name="l485"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l486"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l487"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_var_init_flag</span><span class=cF0>)
|
|
<a name="l488"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpg->data_addr, </span><span class=cFB>sys_var_init_val</span><span class=cF0>, k);
|
|
<a name="l489"></a> </span><span class=cF5>LexPopRestore</span><span class=cF0>(cc);
|
|
<a name="l490"></a> }
|
|
<a name="l491"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l492"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l493"></a> </span><span class=cFD>ParseGlobalInit</span><span class=cF0>(cc, tmpg, </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l495"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k < tmpg->size; k++)
|
|
<a name="l496"></a> </span><span class=cFD>AOTStoreCodeU8At</span><span class=cF0>(cc, tmpg->data_addr_rip + k, tmpg->data_addr[k]);
|
|
<a name="l497"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l498"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l499"></a> </span><span class=cF1>if</span><span class=cF0> (has_alias)
|
|
<a name="l500"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l501"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->use_count < </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l502"></a> {
|
|
<a name="l503"></a> </span><span class=cF5>PrintWarn</span><span class=cF0>(</span><span class=cF6>"Unused extern '%s'\n"</span><span class=cF0>, tmpex</span><span class=cF7>(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->str);
|
|
<a name="l504"></a> cc->warning_count++;
|
|
<a name="l505"></a> }
|
|
<a name="l506"></a> tmpex(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *)->flags |= </span><span class=cF3>GVF_ALIAS</span><span class=cF0>;
|
|
<a name="l507"></a> tmpex(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *)->data_addr = tmpg->data_addr;
|
|
<a name="l508"></a> tmpex(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *)->data_addr_rip = tmpg->data_addr_rip;
|
|
<a name="l509"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l510"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l511"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l512"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l513"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l514"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l515"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l516"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l517"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l518"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l519"></a> }
|
|
<a name="l520"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l521"></a>}
|
|
<a name="l522"></a>
|
|
<a name="l523"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseIf</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count, </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_break)
|
|
<a name="l524"></a>{
|
|
<a name="l525"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb, *lb1;
|
|
<a name="l526"></a> </span><span class=cF9>I64</span><span class=cF0> k;
|
|
<a name="l527"></a>
|
|
<a name="l528"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l529"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l530"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l531"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l532"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l533"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l534"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l535"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l536"></a> lb = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l537"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_BR_ZERO</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l538"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, lb_break);
|
|
<a name="l539"></a> k = </span><span class=cF5>ParseKeyWord</span><span class=cF0>(cc);
|
|
<a name="l540"></a> </span><span class=cF1>if</span><span class=cF0> (k == </span><span class=cF3>KW_ELSE</span><span class=cF0>)
|
|
<a name="l541"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l542"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l543"></a> lb1 = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l544"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb1, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l545"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l546"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, lb_break);
|
|
<a name="l547"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb1, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l548"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l549"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l550"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l551"></a>}
|
|
<a name="l552"></a>
|
|
<a name="l553"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseWhile</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count)
|
|
<a name="l554"></a>{
|
|
<a name="l555"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb, *lb_done;
|
|
<a name="l556"></a>
|
|
<a name="l557"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l558"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l559"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l560"></a> lb = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l561"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l562"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l563"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l564"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l565"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l566"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l567"></a> lb_done = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l568"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_BR_ZERO</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l569"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, lb_done);
|
|
<a name="l570"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l571"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l572"></a>}
|
|
<a name="l573"></a>
|
|
<a name="l574"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseDoWhile</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count)
|
|
<a name="l575"></a>{
|
|
<a name="l576"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb, *lb_done;
|
|
<a name="l577"></a>
|
|
<a name="l578"></a> lb = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l579"></a> lb_done = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l580"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l581"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, lb_done);
|
|
<a name="l582"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ParseKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>KW_WHILE</span><span class=cF0>)
|
|
<a name="l583"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing 'while' at"</span><span class=cF0>);
|
|
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l585"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l586"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l587"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l588"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l589"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l590"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l591"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_BR_NOT_ZERO</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l592"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l593"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l594"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l595"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l596"></a>}
|
|
<a name="l597"></a>
|
|
<a name="l598"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseFor</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count)
|
|
<a name="l599"></a>{
|
|
<a name="l600"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh;
|
|
<a name="l601"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb, *lb_done;
|
|
<a name="l602"></a>
|
|
<a name="l603"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l604"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l605"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l606"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count);
|
|
<a name="l607"></a>
|
|
<a name="l608"></a> lb = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l609"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l610"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l611"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l612"></a> lb_done = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l613"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_BR_ZERO</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l614"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l615"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l616"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l617"></a>
|
|
<a name="l618"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l619"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l620"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l621"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l622"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l623"></a> tmpcbh = </span><span class=cFD>COCPopNoFree</span><span class=cF0>(cc);
|
|
<a name="l624"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l625"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l626"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l627"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l628"></a>
|
|
<a name="l629"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, lb_done);
|
|
<a name="l630"></a> </span><span class=cFD>COCAppend</span><span class=cF0>(cc, tmpcbh);
|
|
<a name="l631"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l632"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l633"></a>}
|
|
<a name="l634"></a>
|
|
<a name="l635"></a></span><span class=cF1>class</span><span class=cF0> CSubSwitch
|
|
<a name="l636"></a>{
|
|
<a name="l637"></a> CSubSwitch *next, *last;
|
|
<a name="l638"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_start, *lb_break;
|
|
<a name="l639"></a>};
|
|
<a name="l640"></a>
|
|
<a name="l641"></a></span><span class=cF1>class</span><span class=cF0> CSwitchCase
|
|
<a name="l642"></a>{
|
|
<a name="l643"></a> CSwitchCase *next;
|
|
<a name="l644"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *label;
|
|
<a name="l645"></a> </span><span class=cF9>I64</span><span class=cF0> val;
|
|
<a name="l646"></a> CSubSwitch *ss;
|
|
<a name="l647"></a>};
|
|
<a name="l648"></a>
|
|
<a name="l649"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseSwitch</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count)
|
|
<a name="l650"></a>{
|
|
<a name="l651"></a> CSwitchCase *header = </span><span class=cF3>NULL</span><span class=cF0>, *tmps, *tmps1; </span><span class=cF2>//Leaks on except</span><span class=cF0>
|
|
<a name="l652"></a> CSubSwitch head, *tmpss; </span><span class=cF2>//Leaks on except</span><span class=cF0>
|
|
<a name="l653"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_default, *lb_fwd_case, *mc_jt, *lb_entry, **jmp_table;
|
|
<a name="l654"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi_sub, *tmpi_cmp, *tmpi_jmp, *tmpi_start;
|
|
<a name="l655"></a> </span><span class=cF1>Bool</span><span class=cF0> default_found = </span><span class=cF3>FALSE</span><span class=cF0>, nobound;
|
|
<a name="l656"></a> </span><span class=cF9>I64</span><span class=cF0> i, k_start = </span><span class=cF3>I64_MIN</span><span class=cF0>, k_end, lo = </span><span class=cF3>I64_MAX</span><span class=cF0>, hi = </span><span class=cF3>I64_MIN</span><span class=cF0>, range;
|
|
<a name="l657"></a>
|
|
<a name="l658"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l659"></a> nobound = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l660"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'['</span><span class=cF0>)
|
|
<a name="l661"></a> nobound = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l662"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l663"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '(' or '[' at "</span><span class=cF0>);
|
|
<a name="l664"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l665"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&head);
|
|
<a name="l666"></a>
|
|
<a name="l667"></a> head.last->lb_break = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l668"></a> head.last->lb_break->use_count++;
|
|
<a name="l669"></a> lb_default = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l670"></a> lb_default->use_count++;
|
|
<a name="l671"></a> mc_jt = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_JMP_TABLE</span><span class=cF0>);
|
|
<a name="l672"></a> mc_jt->begin = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l673"></a> mc_jt->begin->use_count++;
|
|
<a name="l674"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l675"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l676"></a> tmpi_sub = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l677"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SUB</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l678"></a> tmpi_cmp = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l679"></a> </span><span class=cF1>if</span><span class=cF0> (nobound)
|
|
<a name="l680"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l681"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOBOUND_SWITCH</span><span class=cF0>, mc_jt, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l682"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>']'</span><span class=cF0>)
|
|
<a name="l683"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ']' at "</span><span class=cF0>);
|
|
<a name="l684"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l685"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l686"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l687"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SWITCH</span><span class=cF0>, mc_jt, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l688"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l689"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l690"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l691"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF6>'{'</span><span class=cF0>)
|
|
<a name="l692"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '{' at "</span><span class=cF0>);
|
|
<a name="l693"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l694"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, mc_jt->begin, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l695"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l696"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l697"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token != </span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l698"></a> {
|
|
<a name="l699"></a>sw_cont:
|
|
<a name="l700"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>ParseKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l701"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l702"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_END</span><span class=cF0>:
|
|
<a name="l703"></a> </span><span class=cF1>goto</span><span class=cF0> sw_sub_end;
|
|
<a name="l704"></a>
|
|
<a name="l705"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_START</span><span class=cF0>:
|
|
<a name="l706"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l707"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l708"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l709"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l710"></a> tmpss = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CSubSwitch</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l711"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpss, head.last);
|
|
<a name="l712"></a> head.last->lb_break = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l713"></a> head.last->lb_break->use_count++;
|
|
<a name="l714"></a> lb_fwd_case = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l715"></a> tmpi_jmp = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb_fwd_case, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l716"></a>
|
|
<a name="l717"></a> tmpss->lb_start = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l718"></a> tmpi_start = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, tmpss->lb_start, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l719"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token != </span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l720"></a> {
|
|
<a name="l721"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>ParseKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l722"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l723"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_END</span><span class=cF0>:
|
|
<a name="l724"></a> </span><span class=cFD>OptFree</span><span class=cF0>(tmpi_jmp);
|
|
<a name="l725"></a> </span><span class=cF1>goto</span><span class=cF0> sw_sub_end;
|
|
<a name="l726"></a>
|
|
<a name="l727"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_START</span><span class=cF0>:
|
|
<a name="l728"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_CASE</span><span class=cF0>:
|
|
<a name="l729"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DEFAULT</span><span class=cF0>:
|
|
<a name="l730"></a> </span><span class=cF1>if</span><span class=cF0> (cc->coc.coc_head.last == tmpi_start)
|
|
<a name="l731"></a> {
|
|
<a name="l732"></a> </span><span class=cFD>OptFree</span><span class=cF0>(tmpi_jmp);
|
|
<a name="l733"></a> tmpss->lb_start = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l734"></a> }
|
|
<a name="l735"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l736"></a> {
|
|
<a name="l737"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RET</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l738"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_fwd_case, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l739"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SUB_CALL</span><span class=cF0>, tmpss->lb_start, </span><span class=cFE>0</span><span class=cF0>);</span><span class=cF2>//In case fall-thru</span><span class=cF0>
|
|
<a name="l740"></a> }
|
|
<a name="l741"></a> </span><span class=cF1>goto</span><span class=cF0> sw_cont;
|
|
<a name="l742"></a>
|
|
<a name="l743"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l744"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count);
|
|
<a name="l745"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l746"></a> }
|
|
<a name="l747"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l748"></a>
|
|
<a name="l749"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_CASE</span><span class=cF0>:
|
|
<a name="l750"></a> </span><span class=cF1>if</span><span class=cF0> (head.next != &head)
|
|
<a name="l751"></a> {
|
|
<a name="l752"></a> lb_fwd_case = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l753"></a> tmpi_jmp = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb_fwd_case, </span><span class=cFE>0</span><span class=cF0>);</span><span class=cF2>//In case fall-thru</span><span class=cF0>
|
|
<a name="l754"></a> }
|
|
<a name="l755"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l756"></a> lb_entry = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l757"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_entry, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l758"></a> lb_entry->use_count++;
|
|
<a name="l759"></a> </span><span class=cF1>if</span><span class=cF0> (head.next != &head)
|
|
<a name="l760"></a> {
|
|
<a name="l761"></a> tmpss = head.next;
|
|
<a name="l762"></a> </span><span class=cF1>while</span><span class=cF0> (tmpss != &head)
|
|
<a name="l763"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l764"></a> </span><span class=cF1>if</span><span class=cF0> (tmpss->lb_start)
|
|
<a name="l765"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SUB_CALL</span><span class=cF0>, tmpss->lb_start, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l766"></a> tmpss = tmpss->next;
|
|
<a name="l767"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l768"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_fwd_case, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l769"></a> }
|
|
<a name="l770"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l771"></a> {
|
|
<a name="l772"></a> </span><span class=cF1>if</span><span class=cF0> (k_start == </span><span class=cF3>I64_MIN</span><span class=cF0>)
|
|
<a name="l773"></a> k_start = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l774"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l775"></a> k_start++;
|
|
<a name="l776"></a> }
|
|
<a name="l777"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l778"></a> k_start = </span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
|
<a name="l779"></a> </span><span class=cF1>if</span><span class=cF0> (k_start < lo)
|
|
<a name="l780"></a> lo = k_start;
|
|
<a name="l781"></a> </span><span class=cF1>if</span><span class=cF0> (k_start > hi)
|
|
<a name="l782"></a> hi = k_start;
|
|
<a name="l783"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l784"></a> {
|
|
<a name="l785"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l786"></a> tmps = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CSwitchCase</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l787"></a> tmps->label = lb_entry;
|
|
<a name="l788"></a> tmps->val = k_start;
|
|
<a name="l789"></a> tmps->next = header;
|
|
<a name="l790"></a> header = tmps;
|
|
<a name="l791"></a> }
|
|
<a name="l792"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_ELLIPSIS</span><span class=cF0>)
|
|
<a name="l793"></a> {
|
|
<a name="l794"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l795"></a> k_end = </span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
|
<a name="l796"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l797"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l798"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l799"></a> </span><span class=cF1>if</span><span class=cF0> (k_end < lo)
|
|
<a name="l800"></a> lo = k_end;
|
|
<a name="l801"></a> </span><span class=cF1>if</span><span class=cF0> (k_end > hi)
|
|
<a name="l802"></a> hi = k_end;
|
|
<a name="l803"></a> </span><span class=cF1>if</span><span class=cF0> (k_start > k_end)
|
|
<a name="l804"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&k_start, &k_end);
|
|
<a name="l805"></a> </span><span class=cF1>for</span><span class=cF0> (i = k_start; i <= k_end; i++)
|
|
<a name="l806"></a> {
|
|
<a name="l807"></a> tmps = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CSwitchCase</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l808"></a> tmps->label = lb_entry;
|
|
<a name="l809"></a> tmps->val = i;
|
|
<a name="l810"></a> tmps->next = header;
|
|
<a name="l811"></a> header = tmps;
|
|
<a name="l812"></a> }
|
|
<a name="l813"></a> k_start = k_end;
|
|
<a name="l814"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l815"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l816"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l817"></a> }
|
|
<a name="l818"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l819"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l820"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l821"></a>
|
|
<a name="l822"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DEFAULT</span><span class=cF0>:
|
|
<a name="l823"></a> </span><span class=cF1>if</span><span class=cF0> (head.next != &head)
|
|
<a name="l824"></a> {
|
|
<a name="l825"></a> lb_fwd_case = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l826"></a> tmpi_jmp = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb_fwd_case, </span><span class=cFE>0</span><span class=cF0>);</span><span class=cF2>//In case fall-thru</span><span class=cF0>
|
|
<a name="l827"></a> }
|
|
<a name="l828"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l829"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_default, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l830"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l831"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l832"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l833"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l834"></a> </span><span class=cF1>if</span><span class=cF0> (head.next != &head)
|
|
<a name="l835"></a> {
|
|
<a name="l836"></a> tmpss = head.next;
|
|
<a name="l837"></a> </span><span class=cF1>while</span><span class=cF0> (tmpss != &head)
|
|
<a name="l838"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l839"></a> </span><span class=cF1>if</span><span class=cF0> (tmpss->lb_start)
|
|
<a name="l840"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SUB_CALL</span><span class=cF0>, tmpss->lb_start, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l841"></a> tmpss = tmpss->next;
|
|
<a name="l842"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l843"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_fwd_case, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l844"></a> }
|
|
<a name="l845"></a> default_found = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l846"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l847"></a>
|
|
<a name="l848"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l849"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, head.last->lb_break);
|
|
<a name="l850"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l851"></a> }
|
|
<a name="l852"></a>sw_sub_end:
|
|
<a name="l853"></a> tmpss = head.last;
|
|
<a name="l854"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, tmpss->lb_break, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l855"></a> </span><span class=cF1>if</span><span class=cF0> (tmpss == &head)
|
|
<a name="l856"></a> {
|
|
<a name="l857"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l858"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing '}' at "</span><span class=cF0>);
|
|
<a name="l859"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l860"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l861"></a> }
|
|
<a name="l862"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l863"></a> {
|
|
<a name="l864"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpss);
|
|
<a name="l865"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpss);
|
|
<a name="l866"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ParseKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>KW_END</span><span class=cF0>)
|
|
<a name="l867"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing 'end' at "</span><span class=cF0>);
|
|
<a name="l868"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l869"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l870"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l871"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l872"></a> }
|
|
<a name="l873"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l874"></a> </span><span class=cF1>if</span><span class=cF0> (!default_found)
|
|
<a name="l875"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_default, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l876"></a>
|
|
<a name="l877"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> < lo <= </span><span class=cFE>16</span><span class=cF0>)
|
|
<a name="l878"></a> lo = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l879"></a> range = hi - lo + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l880"></a> </span><span class=cF1>if</span><span class=cF0> (lo > hi || !</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> < range <= </span><span class=cFE>0xFFFF</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l881"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"switch range error at "</span><span class=cF0>);
|
|
<a name="l882"></a> jmp_table = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CCodeMisc</span><span class=cF0> *) * range + </span><span class=cFE>0x1FF</span><span class=cF7>)</span><span class=cF0> & ~</span><span class=cFE>0x1FF</span><span class=cF0>);
|
|
<a name="l883"></a> </span><span class=cF5>MemSetI64</span><span class=cF0>(jmp_table, lb_default, range);
|
|
<a name="l884"></a> tmpi_sub->ic_data = lo;
|
|
<a name="l885"></a> tmpi_cmp->ic_data = range;
|
|
<a name="l886"></a> tmps = header;
|
|
<a name="l887"></a> </span><span class=cF1>while</span><span class=cF0> (tmps)
|
|
<a name="l888"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l889"></a> tmps1 = tmps->next;
|
|
<a name="l890"></a> </span><span class=cF1>if</span><span class=cF0> (jmp_table[tmps->val - lo] != lb_default)
|
|
<a name="l891"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Duplicate case at "</span><span class=cF0>);
|
|
<a name="l892"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l893"></a> jmp_table[tmps->val - lo] = tmps->label;
|
|
<a name="l894"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l895"></a> tmps = tmps1;
|
|
<a name="l896"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l897"></a> mc_jt-></span><span class=cF1>default</span><span class=cF0> = lb_default;
|
|
<a name="l898"></a> mc_jt->jmp_table = jmp_table;
|
|
<a name="l899"></a> mc_jt->range = range;
|
|
<a name="l900"></a>}
|
|
<a name="l901"></a>
|
|
<a name="l902"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseNoWarn</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l903"></a>{
|
|
<a name="l904"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm;
|
|
<a name="l905"></a>
|
|
<a name="l906"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l907"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l908"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpm = cc->local_var_entry</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l909"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting local var at "</span><span class=cF0>);
|
|
<a name="l910"></a> tmpm->flags |= </span><span class=cF3>MLF_NO_UNUSED_WARN</span><span class=cF0>;
|
|
<a name="l911"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l912"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l913"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l914"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l915"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l916"></a>}
|
|
<a name="l917"></a>
|
|
<a name="l918"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseStreamBlk</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l919"></a>{
|
|
<a name="l920"></a> </span><span class=cF9>CLexHashTableContext</span><span class=cF0> *htc = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l921"></a> </span><span class=cF9>CStreamBlk</span><span class=cF0> *tmpe = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CStreamBlk</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l922"></a>
|
|
<a name="l923"></a> tmpe->body = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>""</span><span class=cF0>);
|
|
<a name="l924"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpe, cc->last_stream_blk);
|
|
<a name="l925"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l926"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&cc->coc.coc_next_misc);
|
|
<a name="l927"></a>
|
|
<a name="l928"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(htc, &cc->htc, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l929"></a> htc->old_flags = cc->flags;
|
|
<a name="l930"></a> cc->htc.next = htc;
|
|
<a name="l931"></a> cc->htc.fun = cc->htc.local_var_list =</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l932"></a> cc->htc.define_hash_table = cc->htc.hash_table_list =
|
|
<a name="l933"></a> cc->htc.global_hash_table = cc->htc.local_hash_table = </span><span class=cF5>Fs</span><span class=cF0>->hash_table;
|
|
<a name="l934"></a> cc->flags = cc->flags & ~(</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0> | </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>) | </span><span class=cF3>CCF_EXE_BLK</span><span class=cF0>;
|
|
<a name="l935"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'{'</span><span class=cF0>)
|
|
<a name="l936"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l937"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l938"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing '}' at "</span><span class=cF0>);
|
|
<a name="l939"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token != </span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l940"></a> </span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
|
|
<a name="l941"></a>
|
|
<a name="l942"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&cc->htc, htc, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CLexHashTableContext</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l943"></a> cc->flags = cc->flags & ~</span><span class=cF3>CCF_EXE_BLK</span><span class=cF0> | htc->old_flags & (</span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0> | </span><span class=cF3>CCF_EXE_BLK</span><span class=cF0> | </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>);
|
|
<a name="l944"></a> </span><span class=cF5>Free</span><span class=cF0>(htc);
|
|
<a name="l945"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l946"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpe);
|
|
<a name="l947"></a> </span><span class=cF1>if</span><span class=cF0> (*tmpe->body)
|
|
<a name="l948"></a> </span><span class=cFD>LexIncludeStr</span><span class=cF0>(cc, </span><span class=cF6>"StreamBlk"</span><span class=cF0>, tmpe->body, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l949"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l950"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpe->body);
|
|
<a name="l951"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpe);
|
|
<a name="l952"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}'</span><span class=cF0>
|
|
<a name="l953"></a>}
|
|
<a name="l954"></a>
|
|
<a name="l955"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseTryBlk</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count)
|
|
<a name="l956"></a>{
|
|
<a name="l957"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_catch, *lb_done, *lb_untry;
|
|
<a name="l958"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc = </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>];
|
|
<a name="l959"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmp_try = </span><span class=cF5>HashFind</span><span class=cF0>(</span><span class=cF6>"SysTry"</span><span class=cF0>, cc->htc.hash_table_list, </span><span class=cF3>HTT_FUN</span><span class=cF0>),
|
|
<a name="l960"></a> *tmp_untry = </span><span class=cF5>HashFind</span><span class=cF0>(</span><span class=cF6>"SysUntry"</span><span class=cF0>, cc->htc.hash_table_list, </span><span class=cF3>HTT_FUN</span><span class=cF0>);
|
|
<a name="l961"></a>
|
|
<a name="l962"></a> </span><span class=cF1>if</span><span class=cF0> (!tmp_try || !tmp_untry)
|
|
<a name="l963"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing header for SysTry() and SysUntry() at "</span><span class=cF0>);
|
|
<a name="l964"></a>
|
|
<a name="l965"></a> cc->flags |= </span><span class=cF3>CCF_NO_REG_OPT</span><span class=cF0>; </span><span class=cF2>//TODO:Currently no reg vars in funs with try/catch</span><span class=cF0>
|
|
<a name="l966"></a>
|
|
<a name="l967"></a> lb_catch = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l968"></a> lb_done = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l969"></a> lb_untry = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l970"></a>
|
|
<a name="l971"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_START</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l972"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_GET_LABEL</span><span class=cF0>, lb_untry, tmpc, </span><span class=cF3>ICF_PUSH_RES</span><span class=cF0>);
|
|
<a name="l973"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_GET_LABEL</span><span class=cF0>, lb_catch, tmpc, </span><span class=cF3>ICF_PUSH_RES</span><span class=cF0>);
|
|
<a name="l974"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmp_try->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l975"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l976"></a> cc->abs_counts.externs++;
|
|
<a name="l977"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l978"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_IMPORT</span><span class=cF0>, tmp_try, tmpc);
|
|
<a name="l979"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l980"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_INDIRECT2</span><span class=cF0>, &tmp_try->exe_addr, tmpc);
|
|
<a name="l981"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l982"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l983"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL</span><span class=cF0>, tmp_try->exe_addr, tmpc);
|
|
<a name="l984"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF5>Bt</span><span class=cF0>(&tmp_try->flags, </span><span class=cF3>Ff_RET1</span><span class=cF0>) || </span><span class=cF5>Bt</span><span class=cF0>(&tmp_try->flags, </span><span class=cF3>Ff_ARGPOP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmp_try->flags, </span><span class=cF3>Ff_NOARGPOP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l985"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD_RSP1</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>, tmpc);
|
|
<a name="l986"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l987"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD_RSP</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>, tmpc);
|
|
<a name="l988"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_END</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l989"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_END_EXP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l990"></a>
|
|
<a name="l991"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l992"></a>
|
|
<a name="l993"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_untry, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l994"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_START</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l995"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmp_untry->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l996"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l997"></a> cc->abs_counts.externs++;
|
|
<a name="l998"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l999"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_IMPORT</span><span class=cF0>, tmp_untry, tmpc);
|
|
<a name="l1000"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1001"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_INDIRECT2</span><span class=cF0>, &tmp_untry->exe_addr, tmpc);
|
|
<a name="l1002"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1003"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1004"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL</span><span class=cF0>, tmp_untry->exe_addr, tmpc);
|
|
<a name="l1005"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_END</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1006"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_END_EXP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l1007"></a>
|
|
<a name="l1008"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1009"></a>
|
|
<a name="l1010"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>ParseKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>KW_CATCH</span><span class=cF0>)
|
|
<a name="l1011"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing 'catch' at"</span><span class=cF0>);
|
|
<a name="l1012"></a>
|
|
<a name="l1013"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1014"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_catch, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1015"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l1016"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RET</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1017"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, lb_done, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1018"></a>}
|
|
<a name="l1019"></a>
|
|
<a name="l1020"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>ParseStatement</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> try_count=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_break=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> comp_flags=</span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>)
|
|
<a name="l1021"></a>{
|
|
<a name="l1022"></a> </span><span class=cF9>I64</span><span class=cF0> i, fsp_flags = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1023"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
|
|
<a name="l1024"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb;
|
|
<a name="l1025"></a> </span><span class=cF1>U8</span><span class=cF0> *import_name;
|
|
<a name="l1026"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmp_untry;
|
|
<a name="l1027"></a> </span><span class=cF9>CAOT</span><span class=cF0> *tmpaot;
|
|
<a name="l1028"></a>
|
|
<a name="l1029"></a> </span><span class=cF1>if</span><span class=cF0> (comp_flags & </span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF0>)
|
|
<a name="l1030"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1031"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> || cc->aot_depth)
|
|
<a name="l1032"></a> </span><span class=cFD>ParseAsmBlk</span><span class=cF0>(cc, </span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF0>);
|
|
<a name="l1033"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpaot = </span><span class=cFD>CompJoin</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>CMPF_ASM_BLK</span><span class=cF0> | </span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1034"></a> </span><span class=cFD>CompFixUpJITAsm</span><span class=cF0>(cc, tmpaot);
|
|
<a name="l1035"></a> fsp_flags = </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1036"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1037"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1038"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l1039"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1040"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1041"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1042"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'{'</span><span class=cF0>)
|
|
<a name="l1043"></a> {
|
|
<a name="l1044"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1045"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token != </span><span class=cF6>'}'</span><span class=cF0> && cc->token != </span><span class=cF3>TK_EOF</span><span class=cF0>)
|
|
<a name="l1046"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count, lb_break);
|
|
<a name="l1047"></a> </span><span class=cF1>if</span><span class=cF0> (cc->lex_include_stack == cc->fun_lex_file)
|
|
<a name="l1048"></a> cc->max_line = cc->lex_include_stack->line_num;
|
|
<a name="l1049"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1050"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1051"></a> }
|
|
<a name="l1052"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l1053"></a> {
|
|
<a name="l1054"></a> </span><span class=cF1>if</span><span class=cF0> (comp_flags & </span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>)
|
|
<a name="l1055"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1056"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1057"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1058"></a> }
|
|
<a name="l1059"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1060"></a> {
|
|
<a name="l1061"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1062"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1063"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex = cc->hash_entry)
|
|
<a name="l1064"></a> {
|
|
<a name="l1065"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF3>HTT_KEYWORD</span><span class=cF0>)
|
|
<a name="l1066"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1067"></a> i = tmpex(</span><span class=cF9>CHashGeneric</span><span class=cF0> *)->user_data0;
|
|
<a name="l1068"></a> </span><span class=cF1>switch</span><span class=cF0> [i]
|
|
<a name="l1069"></a> {
|
|
<a name="l1070"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_KWS_NUM</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>: </span><span class=cF2>//nobound switch</span><span class=cF0>
|
|
<a name="l1071"></a> </span><span class=cF1>default</span><span class=cF0>: </span><span class=cF2>//A keyword that is not valid here is just a symbol.</span><span class=cF0>
|
|
<a name="l1072"></a> </span><span class=cF1>goto</span><span class=cF0> sm_not_keyword_afterall;
|
|
<a name="l1073"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1074"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_ASM</span><span class=cF0>:
|
|
<a name="l1075"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun)
|
|
<a name="l1076"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1077"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot = </span><span class=cFD>CompJoin</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>CMPF_ASM_BLK</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1078"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ASM</span><span class=cF0>, tmpaot, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1079"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}' of asm{}</span><span class=cF0>
|
|
<a name="l1080"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1081"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1082"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1083"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> || cc->aot_depth)
|
|
<a name="l1084"></a> {
|
|
<a name="l1085"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1086"></a> </span><span class=cFD>ParseAsmBlk</span><span class=cF0>(cc, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1087"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> && cc->aot_depth == </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l1088"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}' of asm{}</span><span class=cF0>
|
|
<a name="l1089"></a> }
|
|
<a name="l1090"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1091"></a> {
|
|
<a name="l1092"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot = </span><span class=cFD>CompJoin</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>CMPF_ASM_BLK</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1093"></a> </span><span class=cFD>CompFixUpJITAsm</span><span class=cF0>(cc, tmpaot);
|
|
<a name="l1094"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}' of asm{}</span><span class=cF0>
|
|
<a name="l1095"></a> }
|
|
<a name="l1096"></a> fsp_flags = </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1097"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1098"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1099"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1100"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1101"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_LOCK</span><span class=cF0>:
|
|
<a name="l1102"></a> cc->lock_count++;
|
|
<a name="l1103"></a> </span><span class=cFD>ParseStatement</span><span class=cF0>(cc, try_count);
|
|
<a name="l1104"></a> cc->lock_count--;
|
|
<a name="l1105"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1106"></a>
|
|
<a name="l1107"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_TRY</span><span class=cF0>:
|
|
<a name="l1108"></a> </span><span class=cFD>ParseTryBlk</span><span class=cF0>(cc, try_count);
|
|
<a name="l1109"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1110"></a>
|
|
<a name="l1111"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_IF</span><span class=cF0>:
|
|
<a name="l1112"></a> </span><span class=cFD>ParseIf</span><span class=cF0>(cc, try_count, lb_break);
|
|
<a name="l1113"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1114"></a>
|
|
<a name="l1115"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_FOR</span><span class=cF0>:
|
|
<a name="l1116"></a> </span><span class=cFD>ParseFor</span><span class=cF0>(cc, try_count);
|
|
<a name="l1117"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1118"></a>
|
|
<a name="l1119"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_WHILE</span><span class=cF0>:
|
|
<a name="l1120"></a> </span><span class=cFD>ParseWhile</span><span class=cF0>(cc, try_count);
|
|
<a name="l1121"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1122"></a>
|
|
<a name="l1123"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DO</span><span class=cF0>:
|
|
<a name="l1124"></a> </span><span class=cFD>ParseDoWhile</span><span class=cF0>(cc, try_count);
|
|
<a name="l1125"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1126"></a>
|
|
<a name="l1127"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_SWITCH</span><span class=cF0>:
|
|
<a name="l1128"></a> </span><span class=cFD>ParseSwitch</span><span class=cF0>(cc, try_count);
|
|
<a name="l1129"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1130"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1131"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1132"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1133"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1134"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1135"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1136"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun)
|
|
<a name="l1137"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Not allowed in fun"</span><span class=cF0>);
|
|
<a name="l1138"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1139"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW__EXTERN</span><span class=cF0>:
|
|
<a name="l1140"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->opts, </span><span class=cF3>OPTf_EXTERNS_TO_IMPORTS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1141"></a> </span><span class=cF1>goto</span><span class=cF0> sm_underscore_import;
|
|
<a name="l1142"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpex = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l1143"></a> !</span><span class=cF7>(</span><span class=cF0>tmpex->type & </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1144"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting system sym at "</span><span class=cF0>);
|
|
<a name="l1145"></a> </span><span class=cF1>if</span><span class=cF0> (*cc->cur_str == </span><span class=cF6>'_'</span><span class=cF0>)
|
|
<a name="l1146"></a> fsp_flags |= </span><span class=cF3>FSF__</span><span class=cF0>;
|
|
<a name="l1147"></a> i = tmpex->val;
|
|
<a name="l1148"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1149"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpex = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l1150"></a> !</span><span class=cF7>(</span><span class=cF0>tmpex->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1151"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1152"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1153"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0__EXTERN</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, i, fsp_flags);
|
|
<a name="l1154"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1155"></a>
|
|
<a name="l1156"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW__IMPORT</span><span class=cF0>:
|
|
<a name="l1157"></a>sm_underscore_import:
|
|
<a name="l1158"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1159"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting system sym at "</span><span class=cF0>);
|
|
<a name="l1160"></a> </span><span class=cF1>if</span><span class=cF0> (*cc->cur_str == </span><span class=cF6>'_'</span><span class=cF0>)
|
|
<a name="l1161"></a> fsp_flags |= </span><span class=cF3>FSF__</span><span class=cF0>;
|
|
<a name="l1162"></a> import_name = cc->cur_str;
|
|
<a name="l1163"></a> cc->cur_str = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1164"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpex = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l1165"></a> !</span><span class=cF7>(</span><span class=cF0>tmpex->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1166"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1167"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1168"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0__IMPORT</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, import_name, fsp_flags);
|
|
<a name="l1169"></a> </span><span class=cF5>Free</span><span class=cF0>(import_name);
|
|
<a name="l1170"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1171"></a>
|
|
<a name="l1172"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_EXTERN</span><span class=cF0>:
|
|
<a name="l1173"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1174"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1175"></a> tmpex = cc->hash_entry;
|
|
<a name="l1176"></a> i = </span><span class=cF5>ParseKeyWord</span><span class=cF0>(cc);
|
|
<a name="l1177"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cF3>KW_CLASS</span><span class=cF0> || i == </span><span class=cF3>KW_UNION</span><span class=cF0>)
|
|
<a name="l1178"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1179"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1180"></a> </span><span class=cFD>ParseClass</span><span class=cF0>(cc, i, fsp_flags, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l1181"></a> fsp_flags &= </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1182"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1183"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1184"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpex || !</span><span class=cF7>(</span><span class=cF0>tmpex->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1185"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1186"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&cc->opts, </span><span class=cF3>OPTf_EXTERNS_TO_IMPORTS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1187"></a> </span><span class=cF1>goto</span><span class=cF0> sm_import;
|
|
<a name="l1188"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1189"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0_EXTERN</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, </span><span class=cFE>0</span><span class=cF0>, fsp_flags);
|
|
<a name="l1190"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1191"></a>
|
|
<a name="l1192"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_IMPORT</span><span class=cF0>:
|
|
<a name="l1193"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpex = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l1194"></a> !</span><span class=cF7>(</span><span class=cF0>tmpex->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1195"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1196"></a>sm_import:
|
|
<a name="l1197"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1198"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0_IMPORT</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, </span><span class=cFE>0</span><span class=cF0>, fsp_flags);
|
|
<a name="l1199"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1200"></a>
|
|
<a name="l1201"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW__INTERN</span><span class=cF0>:
|
|
<a name="l1202"></a> i = </span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
|
<a name="l1203"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpex = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l1204"></a> !</span><span class=cF7>(</span><span class=cF0>tmpex->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1205"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1206"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1207"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0__INTERN</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, i, fsp_flags);
|
|
<a name="l1208"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1209"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1210"></a> fsp_flags &= </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1211"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1212"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1213"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_STATIC</span><span class=cF0>:
|
|
<a name="l1214"></a> fsp_flags = </span><span class=cF3>FSF_STATIC</span><span class=cF0> | fsp_flags & </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1215"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1216"></a>
|
|
<a name="l1217"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_INTERRUPT</span><span class=cF0>:
|
|
<a name="l1218"></a> fsp_flags = </span><span class=cF3>FSF_INTERRUPT</span><span class=cF0> | </span><span class=cF3>FSF_NOARGPOP</span><span class=cF0> | fsp_flags & (</span><span class=cF3>FSG_FUN_FLAGS2</span><span class=cF0> | </span><span class=cF3>FSF_ASM</span><span class=cF0>);
|
|
<a name="l1219"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1220"></a>
|
|
<a name="l1221"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_HASERRCODE</span><span class=cF0>:
|
|
<a name="l1222"></a> fsp_flags = </span><span class=cF3>FSF_HASERRCODE</span><span class=cF0> | fsp_flags & (</span><span class=cF3>FSG_FUN_FLAGS2</span><span class=cF0> | </span><span class=cF3>FSF_ASM</span><span class=cF0>);
|
|
<a name="l1223"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1224"></a>
|
|
<a name="l1225"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_ARGPOP</span><span class=cF0>:
|
|
<a name="l1226"></a> fsp_flags = </span><span class=cF3>FSF_ARGPOP</span><span class=cF0> | fsp_flags & (</span><span class=cF3>FSG_FUN_FLAGS2</span><span class=cF0> | </span><span class=cF3>FSF_ASM</span><span class=cF0>);
|
|
<a name="l1227"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1228"></a>
|
|
<a name="l1229"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_NOARGPOP</span><span class=cF0>:
|
|
<a name="l1230"></a> fsp_flags = </span><span class=cF3>FSF_NOARGPOP</span><span class=cF0> | fsp_flags & (</span><span class=cF3>FSG_FUN_FLAGS2</span><span class=cF0> | </span><span class=cF3>FSF_ASM</span><span class=cF0>);
|
|
<a name="l1231"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1232"></a>
|
|
<a name="l1233"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_PUBLIC</span><span class=cF0>:
|
|
<a name="l1234"></a> fsp_flags = </span><span class=cF3>FSF_PUBLIC</span><span class=cF0> | fsp_flags & (</span><span class=cF3>FSG_FUN_FLAGS2</span><span class=cF0> | </span><span class=cF3>FSF_ASM</span><span class=cF0>);
|
|
<a name="l1235"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1236"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1237"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1238"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1239"></a>
|
|
<a name="l1240"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_RETURN</span><span class=cF0>:
|
|
<a name="l1241"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun)
|
|
<a name="l1242"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Not in fun. Can't return a val "</span><span class=cF0>);
|
|
<a name="l1243"></a> </span><span class=cF1>if</span><span class=cF0> (try_count)
|
|
<a name="l1244"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1245"></a> tmp_untry = </span><span class=cF5>HashFind</span><span class=cF0>(</span><span class=cF6>"SysUntry"</span><span class=cF0>, cc->htc.hash_table_list, </span><span class=cF3>HTT_FUN</span><span class=cF0>);
|
|
<a name="l1246"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < try_count; i++)
|
|
<a name="l1247"></a> {
|
|
<a name="l1248"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmp_untry->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1249"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1250"></a> cc->abs_counts.externs++;
|
|
<a name="l1251"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l1252"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_IMPORT</span><span class=cF0>, tmp_untry, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l1253"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1254"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_INDIRECT2</span><span class=cF0>, &tmp_untry->exe_addr,
|
|
<a name="l1255"></a> </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l1256"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1257"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1258"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL</span><span class=cF0>, tmp_untry->exe_addr, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l1259"></a> }
|
|
<a name="l1260"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1261"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l1262"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1263"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun->return_class->size)
|
|
<a name="l1264"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc, </span><span class=cF6>"Function should NOT return val "</span><span class=cF0>);
|
|
<a name="l1265"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1266"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l1267"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RETURN_VAL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, cc->htc.fun->return_class);
|
|
<a name="l1268"></a> cc->flags |= </span><span class=cF3>CCF_HAS_RETURN</span><span class=cF0>;
|
|
<a name="l1269"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1270"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun->return_class->size)
|
|
<a name="l1271"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc, </span><span class=cF6>"Function should return val "</span><span class=cF0>);
|
|
<a name="l1272"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, cc->lb_leave, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1273"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1274"></a>
|
|
<a name="l1275"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_GOTO</span><span class=cF0>:
|
|
<a name="l1276"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1277"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
|
<a name="l1278"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>g_lb = </span><span class=cFD>COCGoToLabelFind</span><span class=cF0>(cc, cc->cur_str)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1279"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1280"></a> g_lb = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_GOTO_LABEL</span><span class=cF0>);
|
|
<a name="l1281"></a> g_lb->str = cc->cur_str;
|
|
<a name="l1282"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1283"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1284"></a> g_lb->use_count++;
|
|
<a name="l1285"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, g_lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1286"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1287"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1288"></a>
|
|
<a name="l1289"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_BREAK</span><span class=cF0>:
|
|
<a name="l1290"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1291"></a> </span><span class=cF1>if</span><span class=cF0> (!lb_break)
|
|
<a name="l1292"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"'break' not allowed\n"</span><span class=cF0>);
|
|
<a name="l1293"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_JMP</span><span class=cF0>, lb_break, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1294"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1295"></a>
|
|
<a name="l1296"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_NO_WARN</span><span class=cF0>:
|
|
<a name="l1297"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1298"></a> </span><span class=cFD>ParseNoWarn</span><span class=cF0>(cc);
|
|
<a name="l1299"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1300"></a>
|
|
<a name="l1301"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_UNION</span><span class=cF0>:
|
|
<a name="l1302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_CLASS</span><span class=cF0>:
|
|
<a name="l1303"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1304"></a> tmpex = </span><span class=cFD>ParseClass</span><span class=cF0>(cc, i, fsp_flags, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l1305"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun && cc->token != </span><span class=cF6>';'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1306"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, </span><span class=cFE>0</span><span class=cF0>, fsp_flags);
|
|
<a name="l1307"></a> fsp_flags &= </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1308"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1309"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1310"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1311"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1312"></a> fsp_flags &= </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1313"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1314"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1315"></a> }
|
|
<a name="l1316"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1317"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1318"></a> </span><span class=cF7>{</span><span class=cF2>//Ident, found in hash table, not keyword</span><span class=cF0>
|
|
<a name="l1319"></a>sm_not_keyword_afterall:
|
|
<a name="l1320"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF7>(</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1321"></a> {
|
|
<a name="l1322"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun)
|
|
<a name="l1323"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1324"></a> </span><span class=cF1>if</span><span class=cF0> (fsp_flags & </span><span class=cF3>FSF_STATIC</span><span class=cF0>)
|
|
<a name="l1325"></a> </span><span class=cFD>ParseVarList</span><span class=cF0>(cc, cc->htc.fun, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_STATIC_LOCAL_VAR</span><span class=cF0>);
|
|
<a name="l1326"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1327"></a> </span><span class=cFD>ParseVarList</span><span class=cF0>(cc, cc->htc.fun, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_LOCAL_VAR</span><span class=cF0>);
|
|
<a name="l1328"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l1329"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1330"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1331"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1332"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1333"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1334"></a> </span><span class=cFD>ParseGlobalVarList</span><span class=cF0>(cc, </span><span class=cF3>PRS0_NULL</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>, tmpex, </span><span class=cFE>0</span><span class=cF0>, fsp_flags);
|
|
<a name="l1335"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1336"></a> }
|
|
<a name="l1337"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1338"></a> {
|
|
<a name="l1339"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF7>(</span><span class=cF3>HTT_OPCODE</span><span class=cF0> | </span><span class=cF3>HTT_ASM_KEYWORD</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1340"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1341"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun)
|
|
<a name="l1342"></a> {
|
|
<a name="l1343"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot = </span><span class=cFD>CompJoin</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>CMPF_ASM_BLK</span><span class=cF0> | </span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1344"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ASM</span><span class=cF0>, tmpaot, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1345"></a> }
|
|
<a name="l1346"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1347"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Use Asm Blk at "</span><span class=cF0>);
|
|
<a name="l1348"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1349"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1350"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1351"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1352"></a> </span><span class=cF1>goto</span><span class=cF0> sm_parse_exp;
|
|
<a name="l1353"></a> }
|
|
<a name="l1354"></a> fsp_flags &= </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1355"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1356"></a> }
|
|
<a name="l1357"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1358"></a> {</span><span class=cF2>//Ident, not in hash table</span><span class=cF0>
|
|
<a name="l1359"></a> </span><span class=cF1>if</span><span class=cF0> (cc->local_var_entry)
|
|
<a name="l1360"></a> </span><span class=cF1>goto</span><span class=cF0> sm_parse_exp;
|
|
<a name="l1361"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>g_lb = </span><span class=cFD>COCGoToLabelFind</span><span class=cF0>(cc, cc->cur_str)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1362"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1363"></a> g_lb = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_GOTO_LABEL</span><span class=cF0>);
|
|
<a name="l1364"></a> g_lb->str = cc->cur_str;
|
|
<a name="l1365"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1366"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1367"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (g_lb->flags & </span><span class=cF3>CMF_DEFINED</span><span class=cF0>)
|
|
<a name="l1368"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Duplicate goto label at "</span><span class=cF0>);
|
|
<a name="l1369"></a> g_lb->flags |= </span><span class=cF3>CMF_DEFINED</span><span class=cF0>;
|
|
<a name="l1370"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_LABEL</span><span class=cF0>, g_lb, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1371"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF2>//skip cur_str</span><span class=cF0>
|
|
<a name="l1372"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip colon</span><span class=cF0>
|
|
<a name="l1373"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1374"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Undefined identifier at "</span><span class=cF0>);
|
|
<a name="l1375"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun)
|
|
<a name="l1376"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"No global labels at "</span><span class=cF0>);
|
|
<a name="l1377"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1378"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1379"></a> }
|
|
<a name="l1380"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1381"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_STR</span><span class=cF0> || cc->token == </span><span class=cF3>TK_CHAR_CONST</span><span class=cF0>)
|
|
<a name="l1382"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1383"></a> </span><span class=cFD>ParseFunCall</span><span class=cF0>(cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l1384"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1385"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1386"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_EOF</span><span class=cF0>)
|
|
<a name="l1387"></a> </span><span class=cF7>{</span><span class=cF2>//Non-cur_str symbol, num or something</span><span class=cF0>
|
|
<a name="l1388"></a>sm_parse_exp:
|
|
<a name="l1389"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1390"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l1391"></a>sm_semicolon:
|
|
<a name="l1392"></a> </span><span class=cF1>if</span><span class=cF0> (comp_flags & </span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>)
|
|
<a name="l1393"></a> {
|
|
<a name="l1394"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l1395"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1396"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1397"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l1398"></a> }
|
|
<a name="l1399"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l1400"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1401"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1402"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1403"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done; </span><span class=cF2>//TK_EOF</span><span class=cF0>
|
|
<a name="l1404"></a> }
|
|
<a name="l1405"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1406"></a>sm_done:
|
|
<a name="l1407"></a>
|
|
<a name="l1408"></a> </span><span class=cF1>return</span><span class=cF0> fsp_flags & </span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1409"></a>}
|
|
</span></pre></body>
|
|
</html>
|