1254 lines
151 KiB
HTML
Executable File
1254 lines
151 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF9>CHashClass</span><span class=cF0> *</span><span class=cFD>PrsClass</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</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> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l5"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (is_extern) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l7"></a> tmpc=</span><span class=cFD>PrsClassNew</span><span class=cF0>;
|
|
<a name="l8"></a> tmpc->str=cc->cur_str;
|
|
<a name="l9"></a> cc->cur_str=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l10"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpc,cc->htc.glbl_hash_table);
|
|
<a name="l11"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l12"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpc);
|
|
<a name="l13"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l14"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l15"></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="l16"></a> tmpc=</span><span class=cF5>HashFind</span><span class=cF0>(cc->cur_str,cc->htc.glbl_hash_table,</span><span class=cF3>HTT_CLASS</span><span class=cF0>);
|
|
<a name="l17"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l18"></a> tmpc=</span><span class=cF5>HashSingleTableFind</span><span class=cF0>(cc->cur_str,cc->htc.glbl_hash_table,</span><span class=cF3>HTT_CLASS</span><span class=cF0>);
|
|
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc) {
|
|
<a name="l20"></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="l21"></a> tmpc=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l22"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->use_cnt<3)
|
|
<a name="l23"></a> </span><span class=cFD>UnusedExternWarning</span><span class=cF0>(cc,tmpc);
|
|
<a name="l24"></a> }
|
|
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc) {
|
|
<a name="l26"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpc->src_link);
|
|
<a name="l27"></a> tmpc->src_link=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l28"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpc->idx);
|
|
<a name="l29"></a> tmpc->idx=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l30"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l31"></a> tmpc=</span><span class=cFD>PrsClassNew</span><span class=cF0>;
|
|
<a name="l32"></a> tmpc->str=cc->cur_str;
|
|
<a name="l33"></a> cc->cur_str=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l34"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpc,cc->htc.glbl_hash_table);
|
|
<a name="l35"></a> }
|
|
<a name="l36"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&tmpc->flags,</span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (fsp_flags&</span><span class=cF3>FSF_PUBLIC</span><span class=cF0>)
|
|
<a name="l38"></a> tmpc->type|=</span><span class=cF3>HTF_PUBLIC</span><span class=cF0>;
|
|
<a name="l39"></a> tmpc->use_cnt=0;
|
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (cc->last_U16==</span><span class=cF6>'\n'</span><span class=cF0>)
|
|
<a name="l41"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpc,-1);
|
|
<a name="l42"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l43"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpc,0);
|
|
<a name="l44"></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="l45"></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> ||
|
|
<a name="l46"></a> !</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="l47"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l48"></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="l49"></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="l50"></a> tmpc->base_class=base_class;
|
|
<a name="l51"></a> tmpc->size+=base_class->size;
|
|
<a name="l52"></a> }
|
|
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (keyword==</span><span class=cF3>KW_UNION</span><span class=cF0>)
|
|
<a name="l54"></a> </span><span class=cFD>PrsVarLst</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="l55"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l56"></a> </span><span class=cFD>PrsVarLst</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="l57"></a> tmpc->size+=tmpc->neg_offset;
|
|
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l59"></a> </span><span class=cF1>return</span><span class=cF0> tmpc;
|
|
<a name="l60"></a>}
|
|
<a name="l61"></a>
|
|
<a name="l62"></a></span><span class=cF9>CHashFun</span><span class=cF0> *</span><span class=cFD>PrsFunJoin</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashClass</span><span class=cF0> *tmp_return,
|
|
<a name="l63"></a> </span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>I64</span><span class=cF0> fsp_flags)
|
|
<a name="l64"></a>{
|
|
<a name="l65"></a> </span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm,*header_lst;
|
|
<a name="l66"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l67"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *header_return;
|
|
<a name="l68"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf;
|
|
<a name="l69"></a> </span><span class=cF9>I64</span><span class=cF0> header_arg_cnt;
|
|
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (name) </span><span class=cF7>{</span><span class=cF2>//if not fun_ptr</span><span class=cF0>
|
|
<a name="l71"></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="l72"></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.glbl_hash_table,</span><span class=cF3>HTT_FUN</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l73"></a> tmpf->type & </span><span class=cF3>HTF_IMPORT</span><span class=cF0>)
|
|
<a name="l74"></a> tmpf=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l75"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l76"></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.glbl_hash_table,</span><span class=cF3>HTT_FUN</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l77"></a> !</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="l78"></a> tmpf=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf && tmpf->use_cnt<3)
|
|
<a name="l80"></a> </span><span class=cFD>UnusedExternWarning</span><span class=cF0>(cc,tmpf);
|
|
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l82"></a> tmpf=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l84"></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_STK_TMP</span><span class=cF0>;
|
|
<a name="l85"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf->src_link);
|
|
<a name="l86"></a> tmpf->src_link=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l87"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf->idx);
|
|
<a name="l88"></a> tmpf->idx=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l89"></a> </span><span class=cF5>Free</span><span class=cF0>(name);
|
|
<a name="l90"></a> header_arg_cnt=tmpf->arg_cnt;
|
|
<a name="l91"></a> header_lst=tmpf->member_lst_and_root;
|
|
<a name="l92"></a> header_return=tmpf->return_class;
|
|
<a name="l93"></a> tmpf->member_lst_and_root=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l94"></a> </span><span class=cF5>ClassMemberLstDel</span><span class=cF0>(tmpf);
|
|
<a name="l95"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l96"></a> tmpf=</span><span class=cFD>PrsFunNew</span><span class=cF0>;
|
|
<a name="l97"></a> header_return=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l98"></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_STK_TMP</span><span class=cF0>;
|
|
<a name="l99"></a> tmpf->clobbered_reg_mask=</span><span class=cF3>REGG_CLOBBERED</span><span class=cF0>+</span><span class=cF3>REGG_STK_TMP</span><span class=cF0>;
|
|
<a name="l100"></a> tmpf->str=name;
|
|
<a name="l101"></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="l102"></a> tmpf->exe_addr=aotc->rip;
|
|
<a name="l103"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l104"></a> tmpf->exe_addr=&</span><span class=cFD>UndefinedExtern</span><span class=cF0>;
|
|
<a name="l105"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l106"></a> tmpf->flags|=fsp_flags&</span><span class=cF3>FSG_FUN_FLAGS1</span><span class=cF0>;
|
|
<a name="l107"></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="l108"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpf,cc->htc.glbl_hash_table);
|
|
<a name="l109"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l110"></a> </span><span class=cF5>BEqu</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="l111"></a> tmpf->return_class=tmp_return;
|
|
<a name="l112"></a> tmpf->use_cnt=0;
|
|
<a name="l113"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpf);
|
|
<a name="l114"></a> </span><span class=cFD>PrsVarLst</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="l115"></a> tmpf->arg_cnt=tmpf->member_cnt;
|
|
<a name="l116"></a> </span><span class=cF1>if</span><span class=cF0> (0<tmpf->arg_cnt<<3<=</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="l117"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Ff_RET1</span><span class=cF0>);
|
|
<a name="l118"></a> tmpm=tmpf->member_lst_and_root;
|
|
<a name="l119"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l120"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>+=16; </span><span class=cF2>//RBP+RETURN</span><span class=cF0>
|
|
<a name="l121"></a> tmpm=tmpm->next;
|
|
<a name="l122"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l123"></a> tmpf->size=0;
|
|
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (header_return) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GetOption</span><span class=cF7>(</span><span class=cF3>OPTf_WARN_HEADER_MISMATCH</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf->return_class!=header_return) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l127"></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="l128"></a> cc->warning_cnt++;
|
|
<a name="l129"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l130"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>MemberLstCmp</span><span class=cF7>(</span><span class=cF0>tmpf->member_lst_and_root,header_lst,header_arg_cnt</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l131"></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="l132"></a> cc->warning_cnt++;
|
|
<a name="l133"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l134"></a> }
|
|
<a name="l135"></a> </span><span class=cF5>MemberLstDel</span><span class=cF0>(header_lst);
|
|
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l137"></a> </span><span class=cF1>return</span><span class=cF0> tmpf;
|
|
<a name="l138"></a>}
|
|
<a name="l139"></a>
|
|
<a name="l140"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsFun</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</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="l141"></a>{
|
|
<a name="l142"></a> </span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm;
|
|
<a name="l143"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *saved_leave_label;
|
|
<a name="l144"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,size,*r;
|
|
<a name="l145"></a> </span><span class=cF1>Bool</span><span class=cF0> old_trace;
|
|
<a name="l146"></a>
|
|
<a name="l147"></a> cc->fun_lex_file=cc->lex_include_stk;
|
|
<a name="l148"></a> cc->min_line=cc->max_line=cc->lex_include_stk->line_num;
|
|
<a name="l149"></a>
|
|
<a name="l150"></a> cc->flags&=~</span><span class=cF3>CCF_NO_REG_OPT</span><span class=cF0>;
|
|
<a name="l151"></a> cc->htc.local_var_lst=cc->htc.fun=</span><span class=cFD>PrsFunJoin</span><span class=cF0>(cc,tmp_return,name,fsp_flags);
|
|
<a name="l152"></a>
|
|
<a name="l153"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l154"></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="l155"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l156"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ENTER</span><span class=cF0>,0,0);
|
|
<a name="l157"></a> saved_leave_label=cc->lb_leave;
|
|
<a name="l158"></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="l159"></a> cc->flags&=~</span><span class=cF3>CCF_HAS_RETURN</span><span class=cF0>;
|
|
<a name="l160"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,,,0);
|
|
<a name="l161"></a>
|
|
<a name="l162"></a> </span><span class=cF1>if</span><span class=cF0> (cc->max_line<cc->min_line)
|
|
<a name="l163"></a> cc->max_line=cc->min_line;
|
|
<a name="l164"></a>
|
|
<a name="l165"></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="l166"></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="l167"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,cc->lb_leave,0);
|
|
<a name="l168"></a> cc->lb_leave=saved_leave_label;
|
|
<a name="l169"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LEAVE</span><span class=cF0>,0,cc->htc.fun->return_class);
|
|
<a name="l170"></a> cc->htc.fun->size&=~7;
|
|
<a name="l171"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags&</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l172"></a> cc->htc.fun->exe_addr=cc->aotc->rip;
|
|
<a name="l173"></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="l174"></a> r=</span><span class=cFD>COCCompile</span><span class=cF0>(cc,&size,&cc->htc.fun->dbg_info,</span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (r) {
|
|
<a name="l176"></a> j=(size+7)>>3;
|
|
<a name="l177"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<j;i++)
|
|
<a name="l178"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc,r[i]);
|
|
<a name="l179"></a> </span><span class=cF5>Free</span><span class=cF0>(r);
|
|
<a name="l180"></a> }
|
|
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l182"></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="l183"></a> cc->htc.fun->exe_addr=</span><span class=cFD>COCCompile</span><span class=cF0>(
|
|
<a name="l184"></a> cc,&size,&cc->htc.fun->dbg_info,</span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l185"></a> </span><span class=cF1>if</span><span class=cF0> (old_trace) {
|
|
<a name="l186"></a> </span><span class=cF5>Bts</span><span class=cF0>(&cc->opts,</span><span class=cF3>OPTf_TRACE</span><span class=cF0>);
|
|
<a name="l187"></a> </span><span class=cF5>Un</span><span class=cF0>(cc->htc.fun->exe_addr,size,64);
|
|
<a name="l188"></a> }
|
|
<a name="l189"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(cc->htc.fun->str);
|
|
<a name="l190"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l191"></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="l192"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l193"></a> tmpm=cc->htc.fun->member_lst_and_root;
|
|
<a name="l194"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l195"></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="l196"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->use_cnt>1&&</span><span class=cF5>StrCmp</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="l197"></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="l198"></a> cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
|
|
<a name="l199"></a> tmpm->str,cc->htc.fun->str);
|
|
<a name="l200"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!tmpm->use_cnt && </span><span class=cF5>GetOption</span><span class=cF7>(</span><span class=cF3>OPTf_WARN_UNUSED_VAR</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l201"></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="l202"></a> cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
|
|
<a name="l203"></a> tmpm->str,cc->htc.fun->str);
|
|
<a name="l204"></a> tmpm=tmpm->next;
|
|
<a name="l205"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l206"></a> cc->htc.local_var_lst=cc->htc.fun=cc->fun_lex_file=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l207"></a>}
|
|
<a name="l208"></a>
|
|
<a name="l209"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsGlblVarLst</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</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,
|
|
<a name="l210"></a> </span><span class=cF9>I64</span><span class=cF0> saved_val,</span><span class=cF9>I64</span><span class=cF0> fsp_flags)
|
|
<a name="l211"></a>{
|
|
<a name="l212"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,mode,k,val;
|
|
<a name="l213"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
|
<a name="l214"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
|
|
<a name="l215"></a> </span><span class=cF9>CHashGlblVar</span><span class=cF0> *tmpg;
|
|
<a name="l216"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l217"></a> </span><span class=cF9>CAOTHeapGlbl</span><span class=cF0> *tmphg;
|
|
<a name="l218"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
|
|
<a name="l219"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf,*tmpf_fun_ptr;
|
|
<a name="l220"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> tmpad;
|
|
<a name="l221"></a> </span><span class=cF1>Bool</span><span class=cF0> has_alias,undef_array_size,is_array;
|
|
<a name="l222"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l223"></a> tmpc=</span><span class=cFD>PrsType</span><span class=cF0>(cc,&saved_tmpc,&saved_mode,</span><span class=cF3>NULL</span><span class=cF0>,&st,
|
|
<a name="l224"></a> &tmpf_fun_ptr,&tmpex,&tmpad,fsp_flags);
|
|
<a name="l225"></a>
|
|
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (!st) </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad.next)
|
|
<a name="l228"></a> is_array=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l229"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpad.total_cnt<0) {
|
|
<a name="l230"></a> is_array=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l231"></a> tmpc--;
|
|
<a name="l232"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l233"></a> is_array=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l234"></a>
|
|
<a name="l235"></a> val=saved_val;
|
|
<a name="l236"></a> mode=saved_mode;
|
|
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && mode&255==</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> &&
|
|
<a name="l238"></a> tmpex->type&</span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>) {
|
|
<a name="l239"></a> val=tmpex->val;
|
|
<a name="l240"></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="l241"></a> }
|
|
<a name="l242"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'('</span><span class=cF0>) {
|
|
<a name="l243"></a> </span><span class=cF1>switch</span><span class=cF0> (mode&255) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l244"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__INTERN</span><span class=cF0>:
|
|
<a name="l245"></a> tmpf=</span><span class=cFD>PrsFunJoin</span><span class=cF0>(cc,tmpc,st,fsp_flags);
|
|
<a name="l246"></a> tmpf->exe_addr=val;
|
|
<a name="l247"></a> </span><span class=cF5>Bts</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Ff_INTERNAL</span><span class=cF0>);
|
|
<a name="l248"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l249"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l250"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__EXTERN</span><span class=cF0>:
|
|
<a name="l251"></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="l252"></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="l253"></a> tmpf=</span><span class=cFD>PrsFunJoin</span><span class=cF0>(cc,tmpc,st,fsp_flags);
|
|
<a name="l254"></a> tmpf->exe_addr=val;
|
|
<a name="l255"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(tmpf->str);
|
|
<a name="l256"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Cf_EXTERN</span><span class=cF0>);
|
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (saved_mode&255==</span><span class=cF3>PRS0__EXTERN</span><span class=cF0>)
|
|
<a name="l258"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Ff__EXTERN</span><span class=cF0>);
|
|
<a name="l259"></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="l260"></a> tmpf->type|=</span><span class=cF3>HTF_RESOLVE</span><span class=cF0>;
|
|
<a name="l261"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l262"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_EXTERN</span><span class=cF0>:
|
|
<a name="l263"></a> </span><span class=cFD>PrsFunJoin</span><span class=cF0>(cc,tmpc,st,fsp_flags);
|
|
<a name="l264"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l265"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>:
|
|
<a name="l266"></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="l267"></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="l268"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_IMPORT</span><span class=cF0>:
|
|
<a name="l269"></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="l270"></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="l271"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l272"></a> tmpf=</span><span class=cFD>PrsFunJoin</span><span class=cF0>(cc,tmpc,st,fsp_flags);
|
|
<a name="l273"></a> tmpf->type|=</span><span class=cF3>HTF_IMPORT</span><span class=cF0>;
|
|
<a name="l274"></a> </span><span class=cF1>if</span><span class=cF0> (mode&255==</span><span class=cF3>PRS0__IMPORT</span><span class=cF0>)
|
|
<a name="l275"></a> tmpf->import_name=</span><span class=cF5>StrNew</span><span class=cF0>(val);
|
|
<a name="l276"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l277"></a> tmpf->import_name=</span><span class=cF5>StrNew</span><span class=cF0>(st);
|
|
<a name="l278"></a> }
|
|
<a name="l279"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l280"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l281"></a> </span><span class=cFD>PrsFun</span><span class=cF0>(cc,tmpc,st,fsp_flags);
|
|
<a name="l282"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l283"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l284"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l285"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad.total_cnt<0) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l286"></a> i=0;
|
|
<a name="l287"></a> undef_array_size=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l288"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l289"></a> i=tmpad.total_cnt;
|
|
<a name="l290"></a> undef_array_size=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l291"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf_fun_ptr)
|
|
<a name="l293"></a> j=</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *);
|
|
<a name="l294"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l295"></a> j=tmpc->size;
|
|
<a name="l296"></a> j*=i;
|
|
<a name="l297"></a> has_alias=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l298"></a> tmphg=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l299"></a> </span><span class=cF1>switch</span><span class=cF0> (mode&255) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l300"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__EXTERN</span><span class=cF0>:
|
|
<a name="l301"></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="l302"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l303"></a> tmpg->data_addr_rip=val;
|
|
<a name="l304"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_EXPORT</span><span class=cF0>;
|
|
<a name="l305"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l306"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l307"></a> tmpg->data_addr=val;
|
|
<a name="l308"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>;
|
|
<a name="l309"></a> }
|
|
<a name="l310"></a> tmpg->flags|=</span><span class=cF3>GVF_ALIAS</span><span class=cF0>;
|
|
<a name="l311"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l312"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0__IMPORT</span><span class=cF0>:
|
|
<a name="l313"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_IMPORT</span><span class=cF0>:
|
|
<a name="l314"></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="l315"></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="l316"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l317"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l318"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_IMPORT</span><span class=cF0>;
|
|
<a name="l319"></a> </span><span class=cF1>if</span><span class=cF0> (mode&255==</span><span class=cF3>PRS0__IMPORT</span><span class=cF0>)
|
|
<a name="l320"></a> tmpg->import_name=</span><span class=cF5>StrNew</span><span class=cF0>(val);
|
|
<a name="l321"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l322"></a> tmpg->import_name=</span><span class=cF5>StrNew</span><span class=cF0>(st);
|
|
<a name="l323"></a> }
|
|
<a name="l324"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l325"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS0_EXTERN</span><span class=cF0>:
|
|
<a name="l326"></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="l327"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l328"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>;
|
|
<a name="l329"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l330"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l331"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>|</span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0>;
|
|
<a name="l332"></a> }
|
|
<a name="l333"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l334"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l335"></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="l336"></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_GLBLS_ON_DATA_HEAP</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l337"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'='</span><span class=cF0>)
|
|
<a name="l338"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Can't init glbl var on data heap in AOT module "</span><span class=cF0>);
|
|
<a name="l339"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l340"></a> tmphg=tmpg->heap_glbl=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTHeapGlbl</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l341"></a> tmphg->size=j;
|
|
<a name="l342"></a> tmphg->str=</span><span class=cF5>StrNew</span><span class=cF0>(st);
|
|
<a name="l343"></a> tmphg->next=aotc->heap_glbls;
|
|
<a name="l344"></a> aotc->heap_glbls=tmphg;
|
|
<a name="l345"></a> tmpg->flags=</span><span class=cF3>GVF_DATA_HEAP</span><span class=cF0>;
|
|
<a name="l346"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>; </span><span class=cF2>//TODO: HTF_EXPORT</span><span class=cF0>
|
|
<a name="l347"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && tmpex->type & </span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>) </span><span class=cF2>//TODO!! extern</span><span class=cF0>
|
|
<a name="l348"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Feature not implemented "</span><span class=cF0>);
|
|
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<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>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l351"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'='</span><span class=cF0>)
|
|
<a name="l352"></a> tmpg->data_addr=</span><span class=cF5>CAlloc</span><span class=cF0>(j);
|
|
<a name="l353"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->size>=8) </span><span class=cF2>//align</span><span class=cF0>
|
|
<a name="l354"></a> </span><span class=cF1>while</span><span class=cF0> (aotc->rip&7)
|
|
<a name="l355"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,0);
|
|
<a name="l356"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->size==4)
|
|
<a name="l357"></a> </span><span class=cF1>while</span><span class=cF0> (aotc->rip&3)
|
|
<a name="l358"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,0);
|
|
<a name="l359"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->size==2)
|
|
<a name="l360"></a> </span><span class=cF1>while</span><span class=cF0> (aotc->rip&1)
|
|
<a name="l361"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,0);
|
|
<a name="l362"></a> tmpg->data_addr_rip=aotc->rip;
|
|
<a name="l363"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0> | </span><span class=cF3>HTF_EXPORT</span><span class=cF0>;
|
|
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && tmpex->type & </span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>)
|
|
<a name="l365"></a> has_alias=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l366"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k<j;k++)
|
|
<a name="l367"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,0); </span><span class=cF2>//Init AOT glbl to zero.</span><span class=cF0>
|
|
<a name="l368"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l369"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l370"></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_GLBLS_ON_DATA_HEAP</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l371"></a> tmpg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l372"></a> tmpg->data_addr=</span><span class=cF5>MAlloc</span><span class=cF0>(j);
|
|
<a name="l373"></a> tmpg->flags=</span><span class=cF3>GVF_DATA_HEAP</span><span class=cF0>;
|
|
<a name="l374"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<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>CHashGlblVar</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l376"></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="l377"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l378"></a> tmpg->type=</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>;
|
|
<a name="l379"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex && tmpex->type&</span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0> &&
|
|
<a name="l380"></a> tmpex->type&</span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0> &&
|
|
<a name="l381"></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="l382"></a> has_alias=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l383"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_var_init_flag</span><span class=cF0>)
|
|
<a name="l384"></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="l385"></a> }
|
|
<a name="l386"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l387"></a> tmpg->dim.next=tmpad.next;
|
|
<a name="l388"></a> </span><span class=cF1>if</span><span class=cF0> (fsp_flags&</span><span class=cF3>FSF_PUBLIC</span><span class=cF0>)
|
|
<a name="l389"></a> tmpg->type|=</span><span class=cF3>HTF_PUBLIC</span><span class=cF0>;
|
|
<a name="l390"></a> tmpg->var_class=tmpc;
|
|
<a name="l391"></a> tmpg->str=st;
|
|
<a name="l392"></a> tmpg->size=j;
|
|
<a name="l393"></a> tmpg->dim.total_cnt=i;
|
|
<a name="l394"></a> tmpg->use_cnt=0;
|
|
<a name="l395"></a> </span><span class=cF1>if</span><span class=cF0> (cc->last_U16==</span><span class=cF6>'\n'</span><span class=cF0>)
|
|
<a name="l396"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpg,-1);
|
|
<a name="l397"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l398"></a> </span><span class=cF5>HashSrcFileSet</span><span class=cF0>(cc,tmpg,0);
|
|
<a name="l399"></a> </span><span class=cF1>if</span><span class=cF0> (mode&255==</span><span class=cF3>PRS0_IMPORT</span><span class=cF0> || mode&255==</span><span class=cF3>PRS0__IMPORT</span><span class=cF0>)
|
|
<a name="l400"></a> tmpg->flags|=</span><span class=cF3>GVF_IMPORT</span><span class=cF0>;
|
|
<a name="l401"></a> </span><span class=cF1>if</span><span class=cF0> (mode&255==</span><span class=cF3>PRS0_EXTERN</span><span class=cF0>)
|
|
<a name="l402"></a> tmpg->flags|=</span><span class=cF3>GVF_EXTERN</span><span class=cF0>;
|
|
<a name="l403"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf_fun_ptr) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l404"></a> tmpg->fun_ptr=tmpf_fun_ptr;
|
|
<a name="l405"></a> tmpg->flags|=</span><span class=cF3>GVF_FUN</span><span class=cF0>;
|
|
<a name="l406"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l407"></a> </span><span class=cF1>if</span><span class=cF0> (is_array)
|
|
<a name="l408"></a> tmpg->flags|=</span><span class=cF3>GVF_ARRAY</span><span class=cF0>;
|
|
<a name="l409"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpg,cc->htc.glbl_hash_table);
|
|
<a name="l410"></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="l411"></a> </span><span class=cF5>SysSymImportsResolve</span><span class=cF0>(tmpg->str);
|
|
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'='</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l413"></a> </span><span class=cF1>if</span><span class=cF0> (undef_array_size) {
|
|
<a name="l414"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l415"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l416"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l417"></a> </span><span class=cFD>PrsGlblInit</span><span class=cF0>(cc,tmpg,1);
|
|
<a name="l418"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l419"></a> tmpg->size=tmpg->dim.total_cnt*tmpc->size;
|
|
<a name="l420"></a> </span><span class=cF1>if</span><span class=cF0> (tmphg)
|
|
<a name="l421"></a> tmphg->size=tmpg->size;
|
|
<a name="l422"></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="l423"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k<tmpg->size;k++)
|
|
<a name="l424"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,0);
|
|
<a name="l425"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l426"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_var_init_flag</span><span class=cF0>)
|
|
<a name="l427"></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="l428"></a> </span><span class=cF5>LexPopRestore</span><span class=cF0>(cc);
|
|
<a name="l429"></a> }
|
|
<a name="l430"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l431"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l432"></a> </span><span class=cFD>PrsGlblInit</span><span class=cF0>(cc,tmpg,2);
|
|
<a name="l433"></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="l434"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k<tmpg->size;k++)
|
|
<a name="l435"></a> </span><span class=cFD>AOTStoreCodeU8At</span><span class=cF0>(cc,tmpg->data_addr_rip+k,tmpg->data_addr[k]);
|
|
<a name="l436"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l437"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (has_alias) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l439"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->use_cnt<2) {
|
|
<a name="l440"></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>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->str);
|
|
<a name="l441"></a> cc->warning_cnt++;
|
|
<a name="l442"></a> }
|
|
<a name="l443"></a> tmpex(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)->flags|=</span><span class=cF3>GVF_ALIAS</span><span class=cF0>;
|
|
<a name="l444"></a> tmpex(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)->data_addr=tmpg->data_addr;
|
|
<a name="l445"></a> tmpex(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)->data_addr_rip=tmpg->data_addr_rip;
|
|
<a name="l446"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l448"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l449"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l450"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l451"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l452"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l453"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l454"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l455"></a> }
|
|
<a name="l456"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l457"></a>}
|
|
<a name="l458"></a>
|
|
<a name="l459"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsIf</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt,</span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_break)
|
|
<a name="l460"></a>{
|
|
<a name="l461"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb,*lb1;
|
|
<a name="l462"></a> </span><span class=cF9>I64</span><span class=cF0> k;
|
|
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l464"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l465"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l467"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l468"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l469"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l470"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l471"></a> lb=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l472"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_BR_ZERO</span><span class=cF0>,lb,0);
|
|
<a name="l473"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,lb_break);
|
|
<a name="l474"></a> k=</span><span class=cF5>PrsKeyWord</span><span class=cF0>(cc);
|
|
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (k==</span><span class=cF3>KW_ELSE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l476"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l477"></a> lb1=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l478"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,lb1,0);
|
|
<a name="l479"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb,0);
|
|
<a name="l480"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,lb_break);
|
|
<a name="l481"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb1,0);
|
|
<a name="l482"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l483"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb,0);
|
|
<a name="l484"></a>}
|
|
<a name="l485"></a>
|
|
<a name="l486"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsWhile</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt)
|
|
<a name="l487"></a>{
|
|
<a name="l488"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb,*lb_done;
|
|
<a name="l489"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l490"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l491"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l492"></a> lb=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l493"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb,0);
|
|
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l495"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l496"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l497"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l498"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l499"></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="l500"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_BR_ZERO</span><span class=cF0>,lb_done,0);
|
|
<a name="l501"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,lb_done);
|
|
<a name="l502"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,lb,0);
|
|
<a name="l503"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_done,0);
|
|
<a name="l504"></a>}
|
|
<a name="l505"></a>
|
|
<a name="l506"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsDoWhile</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt)
|
|
<a name="l507"></a>{
|
|
<a name="l508"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb,*lb_done;
|
|
<a name="l509"></a> lb=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l510"></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="l511"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb,0);
|
|
<a name="l512"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,lb_done);
|
|
<a name="l513"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PrsKeyWord</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="l514"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing 'while' at"</span><span class=cF0>);
|
|
<a name="l515"></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="l516"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l517"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l518"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l519"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l520"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l521"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l522"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_BR_NOT_ZERO</span><span class=cF0>,lb,0);
|
|
<a name="l523"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_done,0);
|
|
<a name="l524"></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="l525"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l526"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l527"></a>}
|
|
<a name="l528"></a>
|
|
<a name="l529"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsFor</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt)
|
|
<a name="l530"></a>{
|
|
<a name="l531"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh;
|
|
<a name="l532"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb,*lb_done;
|
|
<a name="l533"></a>
|
|
<a name="l534"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l535"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l536"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l537"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l538"></a>
|
|
<a name="l539"></a> lb=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l540"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb,0);
|
|
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l542"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l543"></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="l544"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_BR_ZERO</span><span class=cF0>,lb_done,0);
|
|
<a name="l545"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l546"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l547"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l548"></a>
|
|
<a name="l549"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l550"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l551"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l552"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,</span><span class=cF3>NULL</span><span class=cF0>,0);
|
|
<a name="l553"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l554"></a> tmpcbh=</span><span class=cFD>COCPopNoFree</span><span class=cF0>(cc);
|
|
<a name="l555"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l556"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l557"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l558"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l559"></a>
|
|
<a name="l560"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,lb_done);
|
|
<a name="l561"></a> </span><span class=cFD>COCAppend</span><span class=cF0>(cc,tmpcbh);
|
|
<a name="l562"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,lb,0);
|
|
<a name="l563"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_done,0);
|
|
<a name="l564"></a>}
|
|
<a name="l565"></a>
|
|
<a name="l566"></a></span><span class=cF1>class</span><span class=cF0> CSubSwitch {
|
|
<a name="l567"></a> CSubSwitch *next,*last;
|
|
<a name="l568"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_start,*lb_break;
|
|
<a name="l569"></a>};
|
|
<a name="l570"></a>
|
|
<a name="l571"></a></span><span class=cF1>class</span><span class=cF0> CSwitchCase {
|
|
<a name="l572"></a> CSwitchCase *next;
|
|
<a name="l573"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *label;
|
|
<a name="l574"></a> </span><span class=cF9>I64</span><span class=cF0> val;
|
|
<a name="l575"></a> CSubSwitch *ss;
|
|
<a name="l576"></a>};
|
|
<a name="l577"></a>
|
|
<a name="l578"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsSwitch</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt)
|
|
<a name="l579"></a>{
|
|
<a name="l580"></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="l581"></a> CSubSwitch head,*tmpss; </span><span class=cF2>//Leaks on except</span><span class=cF0>
|
|
<a name="l582"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_dft,*lb_fwd_case,*mc_jt,*lb_entry,**jmp_table;
|
|
<a name="l583"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi_sub,*tmpi_cmp,*tmpi_jmp,*tmpi_start;
|
|
<a name="l584"></a> </span><span class=cF1>Bool</span><span class=cF0> dft_found=</span><span class=cF3>FALSE</span><span class=cF0>,nobound;
|
|
<a name="l585"></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="l586"></a>
|
|
<a name="l587"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l588"></a> nobound=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l589"></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="l590"></a> nobound=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l591"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l592"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' or '[' at "</span><span class=cF0>);
|
|
<a name="l593"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l594"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&head);
|
|
<a name="l595"></a>
|
|
<a name="l596"></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="l597"></a> head.last->lb_break->use_cnt++;
|
|
<a name="l598"></a> lb_dft=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc,</span><span class=cF3>CMT_LABEL</span><span class=cF0>);
|
|
<a name="l599"></a> lb_dft->use_cnt++;
|
|
<a name="l600"></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="l601"></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="l602"></a> mc_jt->begin->use_cnt++;
|
|
<a name="l603"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l604"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l605"></a> tmpi_sub=</span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_IMM_I64</span><span class=cF0>,0,</span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l606"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_SUB</span><span class=cF0>,0,</span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l607"></a> tmpi_cmp=</span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_IMM_I64</span><span class=cF0>,0,</span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l608"></a> </span><span class=cF1>if</span><span class=cF0> (nobound) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l609"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_NOBOUND_SWITCH</span><span class=cF0>,mc_jt,0);
|
|
<a name="l610"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>']'</span><span class=cF0>)
|
|
<a name="l611"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ']' at "</span><span class=cF0>);
|
|
<a name="l612"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l613"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_SWITCH</span><span class=cF0>,mc_jt,0);
|
|
<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=cF7>}</span><span class=cF0>
|
|
<a name="l617"></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="l618"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '{' at "</span><span class=cF0>);
|
|
<a name="l619"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l620"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,mc_jt->begin,0);
|
|
<a name="l621"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l622"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>'}'</span><span class=cF0>) {
|
|
<a name="l623"></a>sw_cont:
|
|
<a name="l624"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>PrsKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l625"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_END</span><span class=cF0>:
|
|
<a name="l626"></a> </span><span class=cF1>goto</span><span class=cF0> sw_sub_end;
|
|
<a name="l627"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_START</span><span class=cF0>:
|
|
<a name="l628"></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="l629"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l630"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l631"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l632"></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="l633"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpss,head.last);
|
|
<a name="l634"></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="l635"></a> head.last->lb_break->use_cnt++;
|
|
<a name="l636"></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="l637"></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,0);
|
|
<a name="l638"></a>
|
|
<a name="l639"></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="l640"></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,0);
|
|
<a name="l641"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>'}'</span><span class=cF0>) {
|
|
<a name="l642"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>PrsKeyWord</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l643"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_END</span><span class=cF0>:
|
|
<a name="l644"></a> </span><span class=cFD>OptFree</span><span class=cF0>(tmpi_jmp);
|
|
<a name="l645"></a> </span><span class=cF1>goto</span><span class=cF0> sw_sub_end;
|
|
<a name="l646"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_START</span><span class=cF0>:
|
|
<a name="l647"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_CASE</span><span class=cF0>:
|
|
<a name="l648"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DFT</span><span class=cF0>:
|
|
<a name="l649"></a> </span><span class=cF1>if</span><span class=cF0> (cc->coc.coc_head.last==tmpi_start) {
|
|
<a name="l650"></a> </span><span class=cFD>OptFree</span><span class=cF0>(tmpi_jmp);
|
|
<a name="l651"></a> tmpss->lb_start=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l652"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l653"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_RET</span><span class=cF0>,0,0);
|
|
<a name="l654"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_fwd_case,0);
|
|
<a name="l655"></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,0);</span><span class=cF2>//In case fall-thru</span><span class=cF0>
|
|
<a name="l656"></a> }
|
|
<a name="l657"></a> </span><span class=cF1>goto</span><span class=cF0> sw_cont;
|
|
<a name="l658"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l659"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l660"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l661"></a> }
|
|
<a name="l662"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l663"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_CASE</span><span class=cF0>:
|
|
<a name="l664"></a> </span><span class=cF1>if</span><span class=cF0> (head.next!=&head) {
|
|
<a name="l665"></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="l666"></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,0);</span><span class=cF2>//In case fall-thru</span><span class=cF0>
|
|
<a name="l667"></a> }
|
|
<a name="l668"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l669"></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="l670"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_entry,0);
|
|
<a name="l671"></a> lb_entry->use_cnt++;
|
|
<a name="l672"></a> </span><span class=cF1>if</span><span class=cF0> (head.next!=&head) {
|
|
<a name="l673"></a> tmpss=head.next;
|
|
<a name="l674"></a> </span><span class=cF1>while</span><span class=cF0> (tmpss!=&head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l675"></a> </span><span class=cF1>if</span><span class=cF0> (tmpss->lb_start)
|
|
<a name="l676"></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,0);
|
|
<a name="l677"></a> tmpss=tmpss->next;
|
|
<a name="l678"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l679"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_fwd_case,0);
|
|
<a name="l680"></a> }
|
|
<a name="l681"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>':'</span><span class=cF0>) {
|
|
<a name="l682"></a> </span><span class=cF1>if</span><span class=cF0> (k_start==</span><span class=cF3>I64_MIN</span><span class=cF0>)
|
|
<a name="l683"></a> k_start=0;
|
|
<a name="l684"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l685"></a> k_start++;
|
|
<a name="l686"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l687"></a> k_start=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
|
<a name="l688"></a> </span><span class=cF1>if</span><span class=cF0> (k_start<lo) lo=k_start;
|
|
<a name="l689"></a> </span><span class=cF1>if</span><span class=cF0> (k_start>hi) hi=k_start;
|
|
<a name="l690"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>':'</span><span class=cF0>) {
|
|
<a name="l691"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l692"></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="l693"></a> tmps->label=lb_entry;
|
|
<a name="l694"></a> tmps->val=k_start;
|
|
<a name="l695"></a> tmps->next=header;
|
|
<a name="l696"></a> header=tmps;
|
|
<a name="l697"></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="l698"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l699"></a> k_end=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
|
<a name="l700"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l701"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l702"></a> </span><span class=cF1>if</span><span class=cF0> (k_end<lo) lo=k_end;
|
|
<a name="l703"></a> </span><span class=cF1>if</span><span class=cF0> (k_end>hi) hi=k_end;
|
|
<a name="l704"></a> </span><span class=cF1>if</span><span class=cF0> (k_start>k_end)
|
|
<a name="l705"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&k_start,&k_end);
|
|
<a name="l706"></a> </span><span class=cF1>for</span><span class=cF0> (i=k_start;i<=k_end;i++) {
|
|
<a name="l707"></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="l708"></a> tmps->label=lb_entry;
|
|
<a name="l709"></a> tmps->val=i;
|
|
<a name="l710"></a> tmps->next=header;
|
|
<a name="l711"></a> header=tmps;
|
|
<a name="l712"></a> }
|
|
<a name="l713"></a> k_start=k_end;
|
|
<a name="l714"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l715"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l716"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l717"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l718"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l719"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DFT</span><span class=cF0>:
|
|
<a name="l720"></a> </span><span class=cF1>if</span><span class=cF0> (head.next!=&head) {
|
|
<a name="l721"></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="l722"></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,0);</span><span class=cF2>//In case fall-thru</span><span class=cF0>
|
|
<a name="l723"></a> }
|
|
<a name="l724"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l725"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_dft,0);
|
|
<a name="l726"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l727"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l728"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l729"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l730"></a> </span><span class=cF1>if</span><span class=cF0> (head.next!=&head) {
|
|
<a name="l731"></a> tmpss=head.next;
|
|
<a name="l732"></a> </span><span class=cF1>while</span><span class=cF0> (tmpss!=&head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l733"></a> </span><span class=cF1>if</span><span class=cF0> (tmpss->lb_start)
|
|
<a name="l734"></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,0);
|
|
<a name="l735"></a> tmpss=tmpss->next;
|
|
<a name="l736"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l737"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_fwd_case,0);
|
|
<a name="l738"></a> }
|
|
<a name="l739"></a> dft_found=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l740"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l741"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l742"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,head.last->lb_break);
|
|
<a name="l743"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l744"></a> }
|
|
<a name="l745"></a>sw_sub_end:
|
|
<a name="l746"></a> tmpss=head.last;
|
|
<a name="l747"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,tmpss->lb_break,0);
|
|
<a name="l748"></a> </span><span class=cF1>if</span><span class=cF0> (tmpss==&head) {
|
|
<a name="l749"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l750"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing '}' at "</span><span class=cF0>);
|
|
<a name="l751"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l752"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l753"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l754"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpss);
|
|
<a name="l755"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpss);
|
|
<a name="l756"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PrsKeyWord</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="l757"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing 'end' at "</span><span class=cF0>);
|
|
<a name="l758"></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="l759"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l760"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l761"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ':' at "</span><span class=cF0>);
|
|
<a name="l762"></a> }
|
|
<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> (!dft_found)
|
|
<a name="l765"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_dft,0);
|
|
<a name="l766"></a>
|
|
<a name="l767"></a> </span><span class=cF1>if</span><span class=cF0> (0<lo<=16)
|
|
<a name="l768"></a> lo=0;
|
|
<a name="l769"></a> range=hi-lo+1;
|
|
<a name="l770"></a> </span><span class=cF1>if</span><span class=cF0> (lo>hi || !</span><span class=cF7>(</span><span class=cF0>0<range<=0xFFFF</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l771"></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="l772"></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+0x1FF</span><span class=cF7>)</span><span class=cF0>&~0x1FF);
|
|
<a name="l773"></a> </span><span class=cF5>MemSetI64</span><span class=cF0>(jmp_table,lb_dft,range);
|
|
<a name="l774"></a> tmpi_sub->ic_data=lo;
|
|
<a name="l775"></a> tmpi_cmp->ic_data=range;
|
|
<a name="l776"></a> tmps=header;
|
|
<a name="l777"></a> </span><span class=cF1>while</span><span class=cF0> (tmps) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l778"></a> tmps1=tmps->next;
|
|
<a name="l779"></a> </span><span class=cF1>if</span><span class=cF0> (jmp_table[tmps->val-lo]!=lb_dft)
|
|
<a name="l780"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Duplicate case at "</span><span class=cF0>);
|
|
<a name="l781"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l782"></a> jmp_table[tmps->val-lo]=tmps->label;
|
|
<a name="l783"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l784"></a> tmps=tmps1;
|
|
<a name="l785"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l786"></a> mc_jt->dft=lb_dft;
|
|
<a name="l787"></a> mc_jt->jmp_table=jmp_table;
|
|
<a name="l788"></a> mc_jt->range=range;
|
|
<a name="l789"></a>}
|
|
<a name="l790"></a>
|
|
<a name="l791"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsNoWarn</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc)
|
|
<a name="l792"></a>{
|
|
<a name="l793"></a> </span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm;
|
|
<a name="l794"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l795"></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="l796"></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="l797"></a> tmpm->flags|=</span><span class=cF3>MLF_NO_UNUSED_WARN</span><span class=cF0>;
|
|
<a name="l798"></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="l799"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l800"></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="l801"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l802"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l803"></a>}
|
|
<a name="l804"></a>
|
|
<a name="l805"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsStreamBlk</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc)
|
|
<a name="l806"></a>{
|
|
<a name="l807"></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="l808"></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="l809"></a> tmpe->body=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>""</span><span class=cF0>);
|
|
<a name="l810"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpe,cc->last_stream_blk);
|
|
<a name="l811"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l812"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&cc->coc.coc_next_misc);
|
|
<a name="l813"></a>
|
|
<a name="l814"></a> </span><span class=cF5>MemCpy</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="l815"></a> htc->old_flags=cc->flags;
|
|
<a name="l816"></a> cc->htc.next=htc;
|
|
<a name="l817"></a> cc->htc.fun=cc->htc.local_var_lst=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l818"></a> cc->htc.define_hash_table=cc->htc.hash_table_lst=
|
|
<a name="l819"></a> cc->htc.glbl_hash_table=cc->htc.local_hash_table=</span><span class=cF5>Fs</span><span class=cF0>->hash_table;
|
|
<a name="l820"></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="l821"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'{'</span><span class=cF0>)
|
|
<a name="l822"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l823"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l824"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing '}' at "</span><span class=cF0>);
|
|
<a name="l825"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token && cc->token!=</span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l826"></a> </span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
|
|
<a name="l827"></a>
|
|
<a name="l828"></a> </span><span class=cF5>MemCpy</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="l829"></a> cc->flags=cc->flags&~</span><span class=cF3>CCF_EXE_BLK</span><span class=cF0> |
|
|
<a name="l830"></a> 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="l831"></a> </span><span class=cF5>Free</span><span class=cF0>(htc);
|
|
<a name="l832"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l833"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpe);
|
|
<a name="l834"></a> </span><span class=cF1>if</span><span class=cF0> (*tmpe->body)
|
|
<a name="l835"></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="l836"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l837"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpe->body);
|
|
<a name="l838"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpe);
|
|
<a name="l839"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}'</span><span class=cF0>
|
|
<a name="l840"></a>}
|
|
<a name="l841"></a>
|
|
<a name="l842"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsTryBlk</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt)
|
|
<a name="l843"></a>{
|
|
<a name="l844"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *lb_catch,*lb_done,*lb_untry;
|
|
<a name="l845"></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="l846"></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_lst,</span><span class=cF3>HTT_FUN</span><span class=cF0>),
|
|
<a name="l847"></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_lst,</span><span class=cF3>HTT_FUN</span><span class=cF0>);
|
|
<a name="l848"></a>
|
|
<a name="l849"></a> </span><span class=cF1>if</span><span class=cF0> (!tmp_try || !tmp_untry)
|
|
<a name="l850"></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="l851"></a>
|
|
<a name="l852"></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="l853"></a>
|
|
<a name="l854"></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="l855"></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="l856"></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="l857"></a>
|
|
<a name="l858"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_CALL_START</span><span class=cF0>,0,0);
|
|
<a name="l859"></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="l860"></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="l861"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l862"></a> cc->abs_cnts.externs++;
|
|
<a name="l863"></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="l864"></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="l865"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l866"></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="l867"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l868"></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="l869"></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>) ||
|
|
<a name="l870"></a> </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="l871"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ADD_RSP1</span><span class=cF0>,16,tmpc);
|
|
<a name="l872"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l873"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ADD_RSP</span><span class=cF0>,16,tmpc);
|
|
<a name="l874"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_CALL_END</span><span class=cF0>,0,tmpc);
|
|
<a name="l875"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_END_EXP</span><span class=cF0>,0,0,</span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l876"></a>
|
|
<a name="l877"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt+1);
|
|
<a name="l878"></a>
|
|
<a name="l879"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_untry,0);
|
|
<a name="l880"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_CALL_START</span><span class=cF0>,0,0);
|
|
<a name="l881"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l882"></a> cc->abs_cnts.externs++;
|
|
<a name="l883"></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="l884"></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="l885"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l886"></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="l887"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l888"></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="l889"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_CALL_END</span><span class=cF0>,0,tmpc);
|
|
<a name="l890"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_END_EXP</span><span class=cF0>,0,0,</span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l891"></a>
|
|
<a name="l892"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,lb_done,0);
|
|
<a name="l893"></a>
|
|
<a name="l894"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PrsKeyWord</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="l895"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing 'catch' at"</span><span class=cF0>);
|
|
<a name="l896"></a>
|
|
<a name="l897"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l898"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_catch,0);
|
|
<a name="l899"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt+1);
|
|
<a name="l900"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_RET</span><span class=cF0>,0,tmpc);
|
|
<a name="l901"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,lb_done,0);
|
|
<a name="l902"></a>}
|
|
<a name="l903"></a>
|
|
<a name="l904"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>PrsStmt</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> try_cnt=0,
|
|
<a name="l905"></a> </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> cmp_flags=</span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>)
|
|
<a name="l906"></a>{
|
|
<a name="l907"></a> </span><span class=cF9>I64</span><span class=cF0> i,fsp_flags=0;
|
|
<a name="l908"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
|
|
<a name="l909"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *g_lb;
|
|
<a name="l910"></a> </span><span class=cF1>U8</span><span class=cF0> *import_name;
|
|
<a name="l911"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmp_untry;
|
|
<a name="l912"></a> </span><span class=cF9>CAOT</span><span class=cF0> *tmpaot;
|
|
<a name="l913"></a> </span><span class=cF1>if</span><span class=cF0> (cmp_flags&</span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l914"></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="l915"></a> </span><span class=cFD>PrsAsmBlk</span><span class=cF0>(cc,</span><span class=cF3>CMPF_ONE_ASM_INS</span><span class=cF0>);
|
|
<a name="l916"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpaot=</span><span class=cFD>CmpJoin</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="l917"></a> </span><span class=cFD>CmpFixUpJITAsm</span><span class=cF0>(cc,tmpaot);
|
|
<a name="l918"></a> fsp_flags=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l919"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l920"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l921"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l922"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l923"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'{'</span><span class=cF0>) {
|
|
<a name="l924"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l925"></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="l926"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt,lb_break);
|
|
<a name="l927"></a> </span><span class=cF1>if</span><span class=cF0> (cc->lex_include_stk==cc->fun_lex_file)
|
|
<a name="l928"></a> cc->max_line=cc->lex_include_stk->line_num;
|
|
<a name="l929"></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=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l930"></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="l931"></a> </span><span class=cF1>if</span><span class=cF0> (cmp_flags&</span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>)
|
|
<a name="l932"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l933"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l934"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l935"></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>
|
|
<a name="l936"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex=cc->hash_entry) {
|
|
<a name="l937"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF3>HTT_KEYWORD</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l938"></a> i=tmpex(</span><span class=cF9>CHashGeneric</span><span class=cF0> *)->user_data0;
|
|
<a name="l939"></a> </span><span class=cF1>switch</span><span class=cF0> [i] {
|
|
<a name="l940"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_KWS_NUM</span><span class=cF0>-1: </span><span class=cF2>//nobound switch</span><span class=cF0>
|
|
<a name="l941"></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="l942"></a> </span><span class=cF1>goto</span><span class=cF0> sm_not_keyword_afterall;
|
|
<a name="l943"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l944"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_ASM</span><span class=cF0>:
|
|
<a name="l945"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l946"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot=</span><span class=cFD>CmpJoin</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="l947"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ASM</span><span class=cF0>,tmpaot,0);
|
|
<a name="l948"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}' of asm{}</span><span class=cF0>
|
|
<a name="l949"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l950"></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="l951"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l952"></a> </span><span class=cFD>PrsAsmBlk</span><span class=cF0>(cc,0);
|
|
<a name="l953"></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==1)
|
|
<a name="l954"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}' of asm{}</span><span class=cF0>
|
|
<a name="l955"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l956"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot=</span><span class=cFD>CmpJoin</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="l957"></a> </span><span class=cFD>CmpFixUpJITAsm</span><span class=cF0>(cc,tmpaot);
|
|
<a name="l958"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip '}' of asm{}</span><span class=cF0>
|
|
<a name="l959"></a> }
|
|
<a name="l960"></a> fsp_flags=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l961"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l962"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l963"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l964"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l965"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_LOCK</span><span class=cF0>:
|
|
<a name="l966"></a> cc->lock_cnt++;
|
|
<a name="l967"></a> </span><span class=cFD>PrsStmt</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l968"></a> cc->lock_cnt--;
|
|
<a name="l969"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l970"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_TRY</span><span class=cF0>:
|
|
<a name="l971"></a> </span><span class=cFD>PrsTryBlk</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l972"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l973"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_IF</span><span class=cF0>:
|
|
<a name="l974"></a> </span><span class=cFD>PrsIf</span><span class=cF0>(cc,try_cnt,lb_break);
|
|
<a name="l975"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l976"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_FOR</span><span class=cF0>:
|
|
<a name="l977"></a> </span><span class=cFD>PrsFor</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l978"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l979"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_WHILE</span><span class=cF0>:
|
|
<a name="l980"></a> </span><span class=cFD>PrsWhile</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l981"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l982"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DO</span><span class=cF0>:
|
|
<a name="l983"></a> </span><span class=cFD>PrsDoWhile</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l984"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l985"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_SWITCH</span><span class=cF0>:
|
|
<a name="l986"></a> </span><span class=cFD>PrsSwitch</span><span class=cF0>(cc,try_cnt);
|
|
<a name="l987"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l988"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l989"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l990"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l991"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l992"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l993"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun)
|
|
<a name="l994"></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="l995"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l996"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW__EXTERN</span><span class=cF0>:
|
|
<a name="l997"></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="l998"></a> </span><span class=cF1>goto</span><span class=cF0> sm_underscore_import;
|
|
<a name="l999"></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="l1000"></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="l1001"></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="l1002"></a> </span><span class=cF1>if</span><span class=cF0> (*cc->cur_str==</span><span class=cF6>'_'</span><span class=cF0>)
|
|
<a name="l1003"></a> fsp_flags|=</span><span class=cF3>FSF__</span><span class=cF0>;
|
|
<a name="l1004"></a> i=tmpex->val;
|
|
<a name="l1005"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1006"></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="l1007"></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="l1008"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1009"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1010"></a> </span><span class=cFD>PrsGlblVarLst</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="l1011"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1012"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW__IMPORT</span><span class=cF0>:
|
|
<a name="l1013"></a>sm_underscore_import:
|
|
<a name="l1014"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1015"></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="l1016"></a> </span><span class=cF1>if</span><span class=cF0> (*cc->cur_str==</span><span class=cF6>'_'</span><span class=cF0>)
|
|
<a name="l1017"></a> fsp_flags|=</span><span class=cF3>FSF__</span><span class=cF0>;
|
|
<a name="l1018"></a> import_name=cc->cur_str;
|
|
<a name="l1019"></a> cc->cur_str=0;
|
|
<a name="l1020"></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="l1021"></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="l1022"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1023"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1024"></a> </span><span class=cFD>PrsGlblVarLst</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,
|
|
<a name="l1025"></a> import_name,fsp_flags);
|
|
<a name="l1026"></a> </span><span class=cF5>Free</span><span class=cF0>(import_name);
|
|
<a name="l1027"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1028"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_EXTERN</span><span class=cF0>:
|
|
<a name="l1029"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1030"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1031"></a> tmpex=cc->hash_entry;
|
|
<a name="l1032"></a> i=</span><span class=cF5>PrsKeyWord</span><span class=cF0>(cc);
|
|
<a name="l1033"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1034"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1035"></a> </span><span class=cFD>PrsClass</span><span class=cF0>(cc,i,fsp_flags,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l1036"></a> fsp_flags&=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1037"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1038"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1039"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpex ||
|
|
<a name="l1040"></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="l1041"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1042"></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="l1043"></a> </span><span class=cF1>goto</span><span class=cF0> sm_import;
|
|
<a name="l1044"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1045"></a> </span><span class=cFD>PrsGlblVarLst</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,0,fsp_flags);
|
|
<a name="l1046"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1047"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_IMPORT</span><span class=cF0>:
|
|
<a name="l1048"></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="l1049"></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="l1050"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1051"></a>sm_import:
|
|
<a name="l1052"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1053"></a> </span><span class=cFD>PrsGlblVarLst</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,0,fsp_flags);
|
|
<a name="l1054"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1055"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW__INTERN</span><span class=cF0>:
|
|
<a name="l1056"></a> i=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc);
|
|
<a name="l1057"></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="l1058"></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="l1059"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l1060"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1061"></a> </span><span class=cFD>PrsGlblVarLst</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="l1062"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1063"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1064"></a> fsp_flags&=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1065"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1066"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1067"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_STATIC</span><span class=cF0>:
|
|
<a name="l1068"></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="l1069"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1070"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_INTERRUPT</span><span class=cF0>:
|
|
<a name="l1071"></a> fsp_flags=</span><span class=cF3>FSF_INTERRUPT</span><span class=cF0>|</span><span class=cF3>FSF_NOARGPOP</span><span class=cF0>|
|
|
<a name="l1072"></a> 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="l1073"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1074"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_HASERRCODE</span><span class=cF0>:
|
|
<a name="l1075"></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="l1076"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1077"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_ARGPOP</span><span class=cF0>:
|
|
<a name="l1078"></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="l1079"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1080"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_NOARGPOP</span><span class=cF0>:
|
|
<a name="l1081"></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="l1082"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1083"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_PUBLIC</span><span class=cF0>:
|
|
<a name="l1084"></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="l1085"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1086"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1087"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1088"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1089"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_RETURN</span><span class=cF0>:
|
|
<a name="l1090"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun)
|
|
<a name="l1091"></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="l1092"></a> </span><span class=cF1>if</span><span class=cF0> (try_cnt) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1093"></a> tmp_untry=</span><span class=cF5>HashFind</span><span class=cF0>(</span><span class=cF6>"SysUntry"</span><span class=cF0>,
|
|
<a name="l1094"></a> cc->htc.hash_table_lst,</span><span class=cF3>HTT_FUN</span><span class=cF0>);
|
|
<a name="l1095"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<try_cnt;i++) {
|
|
<a name="l1096"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1097"></a> cc->abs_cnts.externs++;
|
|
<a name="l1098"></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="l1099"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_CALL_IMPORT</span><span class=cF0>,
|
|
<a name="l1100"></a> 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="l1101"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1102"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_CALL_INDIRECT2</span><span class=cF0>,
|
|
<a name="l1103"></a> &tmp_untry->exe_addr,
|
|
<a name="l1104"></a> </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l1105"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1106"></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,
|
|
<a name="l1107"></a> </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l1108"></a> }
|
|
<a name="l1109"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1110"></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=cF7>{</span><span class=cF0>
|
|
<a name="l1111"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun->return_class->size)
|
|
<a name="l1112"></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="l1113"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l1114"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l1115"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_RETURN_VAL</span><span class=cF0>,0,cc->htc.fun->return_class);
|
|
<a name="l1116"></a> cc->flags|=</span><span class=cF3>CCF_HAS_RETURN</span><span class=cF0>;
|
|
<a name="l1117"></a> </span><span class=cF7>}</span><span class=cF0> </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="l1118"></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="l1119"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,cc->lb_leave,0);
|
|
<a name="l1120"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1121"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_GOTO</span><span class=cF0>:
|
|
<a name="l1122"></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="l1123"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
|
<a name="l1124"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1125"></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="l1126"></a> g_lb->str=cc->cur_str;
|
|
<a name="l1127"></a> cc->cur_str=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1128"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1129"></a> g_lb->use_cnt++;
|
|
<a name="l1130"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,g_lb,0);
|
|
<a name="l1131"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1132"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1133"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_BREAK</span><span class=cF0>:
|
|
<a name="l1134"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1135"></a> </span><span class=cF1>if</span><span class=cF0> (!lb_break)
|
|
<a name="l1136"></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="l1137"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_JMP</span><span class=cF0>,lb_break,0);
|
|
<a name="l1138"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1139"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_NO_WARN</span><span class=cF0>:
|
|
<a name="l1140"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1141"></a> </span><span class=cFD>PrsNoWarn</span><span class=cF0>(cc);
|
|
<a name="l1142"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1143"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_UNION</span><span class=cF0>:
|
|
<a name="l1144"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_CLASS</span><span class=cF0>:
|
|
<a name="l1145"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1146"></a> tmpex=</span><span class=cFD>PrsClass</span><span class=cF0>(cc,i,fsp_flags,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l1147"></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="l1148"></a> </span><span class=cFD>PrsGlblVarLst</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,0,fsp_flags);
|
|
<a name="l1149"></a> fsp_flags&=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1150"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1151"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1152"></a> fsp_flags&=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1153"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1154"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1155"></a> }
|
|
<a name="l1156"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF2>//Ident, found in hash table, not keyword</span><span class=cF0>
|
|
<a name="l1157"></a>sm_not_keyword_afterall:
|
|
<a name="l1158"></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="l1159"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1160"></a> </span><span class=cF1>if</span><span class=cF0> (fsp_flags&</span><span class=cF3>FSF_STATIC</span><span class=cF0>)
|
|
<a name="l1161"></a> </span><span class=cFD>PrsVarLst</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="l1162"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1163"></a> </span><span class=cFD>PrsVarLst</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="l1164"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'}'</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1165"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1166"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1167"></a> </span><span class=cFD>PrsGlblVarLst</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,0,fsp_flags);
|
|
<a name="l1168"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1169"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l1170"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1171"></a> </span><span class=cF1>if</span><span class=cF0> (cc->htc.fun) {
|
|
<a name="l1172"></a> </span><span class=cF1>if</span><span class=cF0> (tmpaot=</span><span class=cFD>CmpJoin</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="l1173"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ASM</span><span class=cF0>,tmpaot,0);
|
|
<a name="l1174"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1175"></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="l1176"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1177"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1178"></a> </span><span class=cF1>goto</span><span class=cF0> sm_prs_exp;
|
|
<a name="l1179"></a> }
|
|
<a name="l1180"></a> fsp_flags&=</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1181"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1182"></a> } </span><span class=cF1>else</span><span class=cF0> {</span><span class=cF2>//Ident, not in hash table</span><span class=cF0>
|
|
<a name="l1183"></a> </span><span class=cF1>if</span><span class=cF0> (cc->local_var_entry)
|
|
<a name="l1184"></a> </span><span class=cF1>goto</span><span class=cF0> sm_prs_exp;
|
|
<a name="l1185"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1186"></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="l1187"></a> g_lb->str=cc->cur_str;
|
|
<a name="l1188"></a> cc->cur_str=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1189"></a> </span><span class=cF7>}</span><span class=cF0> </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="l1190"></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="l1191"></a> g_lb->flags|=</span><span class=cF3>CMF_DEFINED</span><span class=cF0>;
|
|
<a name="l1192"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_LABEL</span><span class=cF0>,g_lb,0);
|
|
<a name="l1193"></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="l1194"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip colon</span><span class=cF0>
|
|
<a name="l1195"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1196"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Undefined identifier at "</span><span class=cF0>);
|
|
<a name="l1197"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.fun)
|
|
<a name="l1198"></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="l1199"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1200"></a> }
|
|
<a name="l1201"></a> </span><span class=cF7>}</span><span class=cF0> </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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1202"></a> </span><span class=cFD>PrsFunCall</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="l1203"></a> </span><span class=cF1>goto</span><span class=cF0> sm_semicolon;
|
|
<a name="l1204"></a> </span><span class=cF7>}</span><span class=cF0> </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>) </span><span class=cF7>{</span><span class=cF2>//Non-cur_str symbol, num or something</span><span class=cF0>
|
|
<a name="l1205"></a>sm_prs_exp:
|
|
<a name="l1206"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>PrsExpression</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="l1207"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l1208"></a>sm_semicolon:
|
|
<a name="l1209"></a> </span><span class=cF1>if</span><span class=cF0> (cmp_flags&</span><span class=cF3>CMPF_PRS_SEMICOLON</span><span class=cF0>) {
|
|
<a name="l1210"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l1211"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1212"></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="l1213"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l1214"></a> }
|
|
<a name="l1215"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>','</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> sm_done;
|
|
<a name="l1216"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1217"></a> </span><span class=cF1>goto</span><span class=cF0> sm_done; </span><span class=cF2>//TK_EOF</span><span class=cF0>
|
|
<a name="l1218"></a> }
|
|
<a name="l1219"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1220"></a>sm_done:
|
|
<a name="l1221"></a> </span><span class=cF1>return</span><span class=cF0> fsp_flags&</span><span class=cF3>FSF_ASM</span><span class=cF0>;
|
|
<a name="l1222"></a>}
|
|
</span></pre></body>
|
|
</html>
|